Brain Drain Friday: My Work-in-Progress Qtile Rice

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@thecrazygm·
0.000 HBD
Brain Drain Friday: My Work-in-Progress Qtile Rice
Hey everyone,

It's another Brain Drain Friday! My brain feels like it's running on fumes, so instead of a deep technical dive, I wanted to do something fun that most Linux enthusiasts can appreciate: "ricing" the desktop.

For those unfamiliar, "ricing" is just a term for customizing your desktop's appearance and functionality to make it your own – from colors and fonts to window manager behavior. It’s a bit of an art form and a fun way to express yourself.

I'm always tweaking my setup, and right now I'm running Qtile, a tiling window manager written and configured in Python. I wanted to share my current work-in-progress look and highlight a few key snippets from my `config.py` that make it all work.

![My current Qtile desktop setup - a constant work in progress!](https://files.peakd.com/file/peakd-hive/thecrazygm/Eo1uPU2jbUsGWjYpdvr4MQLxYoE7Cxbe3X6wdos2imfbRMuknqJPqRoUZwzx1jvG6zj.png)

Here are a few pieces of the configuration that you might not be able to see clearly in the image, but that define how my desktop looks and feels:

#### 1. The Color Palette

A good rice starts with a good color scheme. I'm using a new theme that defines a set of colors I can reference throughout the entire configuration, from the bar to the window borders. This makes it super easy to change the entire look and feel just by editing one section.

```python
# --- Colors (New Theme from rootloops.sh) ---
colors = {
    "background": "#0a0611",
    "foreground": "#e5dff1",
    "red": "#d97780",
    "green": "#7aa860",
    "yellow": "#bc904f",
    "blue": "#6b9bd9",
    "magenta": "#b77ed1",
    "cyan": "#52a9a9",
    "white": "#beb1da",
    "brightBlack": "#584875",
}
```

#### 2. Layout Theme and Window Borders

I like a clean, minimalist look with just enough of a border to know which window is active. The `layout_theme` applies these settings to all my layouts (like `MonadTall` and `Max`), ensuring consistency. The active window gets a nice magenta border, while inactive windows have a more subdued gray.

```python
# --- Layouts ---
layout_theme = {
    "border_width": 2,
    "margin": 8,
    "border_focus": colors["magenta"],
    "border_normal": colors["brightBlack"],
}

layouts = [
    layout.MonadTall(**layout_theme),
    layout.Max(**layout_theme),
    layout.Floating(**layout_theme),
]
```

#### 3. Multi-Monitor Workspace (Group) Handling

I run a multi-monitor setup, and one of the best things about Qtile is how you can customize it to manage workspaces across screens. I have a couple of helper functions, `go_to_group_on_screen` and `move_window_to_group_on_screen`, that automatically switch focus to the correct monitor when I switch to certain workspaces. For my setup:

- Workspaces 1-5 live on my primary monitor (index 0).
- Workspaces 6-9 are designated for my second monitor (index 1).

```python
# Helper function example
def go_to_group_on_screen(group_name: str):
    def _inner(qtile_instance):
        # ... logic to determine which screen the group belongs to ...
        if 1 <= int(group_name) <= 5:
            target_screen_index = 0  # Monitor 1
        elif 6 <= int(group_name) <= 9:
            target_screen_index = 1  # Monitor 2
        # ... logic to switch to the screen and then the group ...
        qtile_instance.to_screen(target_screen_index)
        qtile_instance.groups_map[group_name].toscreen()
    return _inner
```

#### 4. Custom Autostart Script

To get everything running on login (like my notification daemon, wallpaper setter, etc.), Qtile has a startup hook. I have it set to run an `autostart.sh` script located in my config directory. This keeps my Python config clean and lets me manage startup applications with a simple shell script.

```python
# --- Autostart ---
@hook.subscribe.startup_once
def autostart():
    home = os.path.expanduser("~/.config/qtile/autostart.sh")
    # Check if the script exists and is executable
    if os.path.exists(home) and os.access(home, os.X_OK):
        subprocess.Popen([home])
```

It’s always a fun process, and there’s always something new to tweak. What does your desktop look like? Share a link or describe your setup in the comments!

As always,
Michael Garcia a.k.a. TheCrazyGM
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,