Post

Styling nwg-dock-hyprland with pywal

Customize your nwg-dock-hyprland dock with themes generated by pywal.

Styling nwg-dock-hyprland with pywal

Introduction

This guide shows how to use pywal to theme your nwg-dock-hyprland dock, creating a consistent look with your wallpaper.

Prerequisites

Make sure these are installed:

Install Dependencies

  1. pywal:
    1
    
    pip install pywal
    
  2. nwg-dock-hyprland: (Install according to your distro, e.g., Arch)
    1
    
    yay -S nwg-dock-hyprland  # For Arch-based
    

Theme Generation

Use pywal to set up colors.

Generate a Color Scheme

  1. Run wal:
    1
    
    wal -i /path/to/your/wallpaper.jpg  # Replace with your wallpaper
    

Custom CSS

Create a CSS template for the dock.

Create CSS Template

  1. Create the template:
    1
    2
    
    mkdir -p ~/.config/wal/templates/
    touch ~/.config/wal/templates/nwg-dock.css
    
  2. Add this CSS content:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    * {
        background-color: {background};
    }
    
    button {
        background: {background};
        border-style: none;
        box-shadow: none;
    }
    
    button:hover {
        background-color: {color1};
    }
    
    box#box-dock {
        background-color: rgba({background.rgb}, 0.85);
        border-radius: 16px;
        padding: 6px;
        margin: 6px;
        border: 2px solid {color1};
    }
    
    /* Add more custom styling as needed */
    

Hyprland and Scripting

Configure Hyprland and create a script.

Hyprland Configuration

  1. Add to your config (hyprland.conf or autostart):
    1
    
    exec-once = wal -R
    

Create the Update Script

  1. Create the script:
    1
    2
    3
    
    mkdir -p ~/.local/bin/
    touch ~/.local/bin/update-dock-colors.sh
    chmod +x ~/.local/bin/update-dock-colors.sh
    
  2. Add script content:
    1
    2
    3
    4
    5
    6
    7
    8
    
    #!/bin/bash
    
    wal -i "$1" -n
    cat ~/.cache/wal/colors.css > ~/.config/nwg-dock-hyprland/style.css
    cat ~/.cache/wal/nwg-dock.css >> ~/.config/nwg-dock-hyprland/style.css
    
    killall nwg-dock-hyprland
    nwg-dock-hyprland &
    

Using the Script

  1. Run the script:
    1
    
    ~/.local/bin/update-dock-colors.sh /path/to/wallpaper.jpg # Replace with your wallpaper
    

Conclusion

Now, your dock is themed by pywal! Run the script whenever you change your wallpaper.

This post is licensed under CC BY 4.0 by the author.