No description
  • Python 92.8%
  • Shell 7.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-20 20:44:15 -04:00
icons 5D Utilities: tray launcher for user-defined commands (5D icon, white/black, settings dialog) 2026-08-14 09:09:26 -04:00
service resilience: broken config can't crash-loop the service — _read_config falls back to <config>.last-good snapshot with one-shot desktop alert; malformed item/toggle sections skipped. smoke test steps 12-13 cover corrupt-parse survival + one-shot notify + snapshot refresh 2026-08-20 20:44:15 -04:00
.gitignore 5D Utilities: tray launcher for user-defined commands (5D icon, white/black, settings dialog) 2026-08-14 09:09:26 -04:00
install.sh 5D Utilities: tray launcher for user-defined commands (5D icon, white/black, settings dialog) 2026-08-14 09:09:26 -04:00
LICENSE 5D Utilities: tray launcher for user-defined commands (5D icon, white/black, settings dialog) 2026-08-14 09:09:26 -04:00
README.md toggles: Cachy5D service on/off switches ([toggle.*] in utilities.conf); /proc state detection, SIGTERM->SIGKILL stop, 5s poll + aboutToShow refresh. smoke test covers parse/state/kill/hostname gate 2026-08-20 12:35:08 -04:00

5D Utilities

A system tray button on your Plasma panel with your own list of one-click functions — plus a Home/Work mode toggle. The tray icon is the 5D logo (white or black, your choice). Add and remove functions by editing one config file; switch modes from the tray whenever you feel like it, and each mode can run its own commands and swap your terminal's waifufetch banner.

Built on the same pattern as the rog-z13-power-management tray service: a small PyQt6 app running as a systemd user service.

Features

  • Your functions, your menu — every [item.*] section in utilities.conf becomes a tray menu entry that runs its command.
  • Home/Work modes — a radio group at the top of the tray menu. Switching mode runs that mode's on-switch commands and swaps the waifufetch line in ~/.zshrc (e.g. plain at home, a specific image at work).
  • 5D icon, white or black — pick the tint in Settings… (white on dark panels, black on light ones).
  • No restart to edit — the menu picks up config changes within ~15 seconds, or hit Reload config.
  • Per-function options — run in a terminal, ask before running, pop a notification when it finishes, give an entry an icon.
  • Settings window — tabs: icon color / terminal / tooltip, plus one tab per mode for its name, ~/.zshrc line, and on-switch commands.
  • Service toggles (Cachy5D) — on machines in TOGGLE_HOSTNAMES the menu gets checkable on/off switches for long-running services (vLLM, ComfyUI). The tick mirrors whether the service is actually running; toggling ON launches it in the background, OFF stops it (SIGTERM, then SIGKILL after 8s).

Requirements

  • Any Linux with a system tray; developed on CachyOS / KDE Plasma 6
  • python-pyqt6 (includes QtSvg)
  • libnotify (only if you use the notify = true function option)

Install

Recommended — packaged (installs to /usr/bin, auto-start included):

Add Fifthdread's package repo to paru (one command, adds + syncs):

curl -fsSL https://5d.fyi/addrepo | bash

Prefer not to run a script? Add the repo by hand, then sync:

mkdir -p ~/.config/paru && printf '[fifthdread]\nUrl = https://forgejo.fifthdread.com/Fifthdread/pkgbuilds.git\nSkipReview\n' >> ~/.config/paru/paru.conf
paru -Sy --pkgbuilds

Then install:

paru -S 5d-utilities-git

Dependencies are pulled automatically, and the install hook enables + starts the tray service for you.

Or from source:

git clone ssh://git@forgejo.fifthdread.com:223/Fifthdread/5d_utilities.git
cd 5d_utilities
./install.sh

Either path: a 5D tray icon appears. Left-click (or right-click) it for your modes and functions. The config files are written on first run at:

~/.config/5d-utilities/utilities.conf   # your functions (hand-edit this)
~/.config/5d-utilities/settings.conf    # modes + app settings (edited via Settings…)

Modes (Home / Work)

The tray menu opens with a Home / Work radio group. Select the other mode to switch to it — the current mode is shown checked and in the tooltip.

Switching into a mode:

  1. Runs that mode's on-switch commands (configured in Settings… → your mode tab, one shell command per line, run via bash -c in the background).
  2. If that mode has a zshrc waifufetch line set, rewrites ~/.zshrc: the existing waifufetch invocation line is replaced with it (appended if none exists). The first write backs up ~/.zshrc to ~/.zshrc.5d-utilities.bak.

The active mode is remembered across restarts, so ~/.zshrc and the mode never drift apart — switch modes from the tray whenever you feel like it.

Example — the default config is exactly your use case:

Mode ~/.zshrc waifufetch line on-switch commands
Home waifufetch (empty)
Work waifufetch --image '/home/fifthdread/Pictures/5D/5D filled white.png' (empty — add your own)

Adding and removing functions

Open Edit functions… from the tray menu (or edit utilities.conf directly). Each function is one section — copy a block to add one, delete a block to remove one:

[item.terminal]                      # section name is just an id
label = Open Terminal                # what the tray menu shows
command = konsole                    # the shell command to run
icon = utilities-terminal            # optional menu icon (freedesktop name)

[item.screenshot]
label = Screenshot (area)
command = spectacle -b -r
icon = spectacle
confirm = true                       # ask before running

[item.script]
label = Run my script
command = ~/scripts/thing.sh
terminal = true                      # run inside a terminal window

[item.light]
label = Toggle desk lights
command = curl -s http://desk.local/api/light/toggle
notify = true                        # notify when it finishes

Commands run via bash -c, so ~, $(...), pipes, and && all work.

Service toggles (Cachy5D)

On the machine whose hostname is in the app's TOGGLE_HOSTNAMES list (default Cachy5D), the tray menu shows a Services group above your functions: checkable on/off switches for long-running services like vLLM or ComfyUI.

The checkmark is a true toggle: it mirrors whether the service's process is actually running (re-polled every 5s and each time the menu opens), not the last click. A service that died on its own, or that you started outside the tray, shows its real state.

Each toggle is a [toggle.<name>] section in utilities.conf. For example, a Qwen 3.8 + vLLM service (launch-qwen38.sh) and ComfyUI:

toggle.qwen toggle.comfy
label = Qwen 3.8 (vLLM) label = ComfyUI
launch = ~/launch-qwen38.sh launch = ~/comfy/ComfyUI/launch.sh
pattern = vllm serve dir = ~/comfy/ComfyUI
pattern = comfy launch
  • ON — runs launch in the background (use terminal = true to open a terminal instead) and notifies "… launched".
  • OFF — SIGTERMs every process matching pattern, SIGKILLs survivors after 8s, and notifies once it's gone. Custom shut-down logic can be supplied via an optional stop shell command.
  • pattern is a regex matched against every process's command line: it both decides "is it running?" and picks which PIDs to stop. Match what you see in ps aux.
  • dir sets the launch working directory — required when the launch script creates relative paths (ComfyUI's python3 -m venv comfy-env, for instance).
  • Sections are skipped on machines not in TOGGLE_HOSTNAMES, so utilities.conf can be shared safely between machines.

Settings (Settings… in the tray menu)

General tab:

Setting What it does
Tray icon color White or black 5D logo — pick what reads best on your panel
Terminal command Which terminal terminal = true functions open in (default konsole)
Tooltip Hover text under the tray icon

One tab per mode (Home, Work):

Setting What it does
Mode name Label shown in the tray menu's mode radio group
zshrc waifufetch line The exact waifufetch command line written into ~/.zshrc when this mode is active. Empty = leave ~/.zshrc alone
On-switch commands Shell commands (one per line) run when switching into this mode

Tray usage

  • Left / middle click — open the mode + function menu at the cursor
  • Right-click — the same menu (Plasma's native context menu)
  • Home / Work — pick the active mode (see Modes)
  • Services — checkable on/off switches for long-running services (Cachy5D only; see Service toggles)
  • Reload config — apply utilities.conf / settings.conf edits immediately
  • Edit functions… — open utilities.conf in your editor
  • Settings… — General tab (icon color, terminal, tooltip) + one tab per mode
  • Quit — stop the tray app (disable it with systemctl --user disable --now 5d-utilities)

Configuration reference

utilities.conf — the functions list

Key Values Default Description
label any text (required) Menu entry text
command any shell string (required) Run via bash -c
icon freedesktop icon name Icon shown next to the label
confirm true / false false Ask "Run …?" before executing
terminal true / false false Run inside the terminal from Settings
notify true / false false KDE notification when the command finishes

Sections are shown in file order. Unknown sections and sections without a label or command are skipped.

Service toggles[toggle.<name>] sections, shown only on machines whose hostname is in the app's TOGGLE_HOSTNAMES list (default: Cachy5D):

Key Values Default Description
label any text (required) Menu entry text
launch any shell string (required) Start the service via bash -c (background)
pattern regex (required) Matched against process command lines — decides running? and picks PIDs to stop
dir path Working directory for launch
icon freedesktop icon name Icon shown next to the label
terminal true / false false Launch inside the Settings terminal instead of the background
stop any shell string Custom stop command; default is SIGTERM then SIGKILL after 8s

Sections are skipped on other machines, so utilities.conf can be shared.

settings.conf — modes + app settings (edited via Settings…)

[general]
icon_color = white       # white | black
terminal = konsole
tooltip = 5D Utilities
current_mode = home      # the active mode (changed from the tray menu)

[mode.home]              # one section per mode — Home and Work by default
name = Home
zshrc_line = waifufetch  # the ~/.zshrc waifufetch line when this mode is active
on_switch =              # commands run on switch into this mode, one per line

[mode.work]
name = Work
zshrc_line = waifufetch --image '/home/fifthdread/Pictures/5D/5D filled white.png'
on_switch =
  • zshrc_line — exact command line written into ~/.zshrc, replacing the existing waifufetch invocation (appended if none is present). Empty leaves ~/.zshrc untouched.
  • on_switch — one shell command per line, run via bash -c (background) each time you switch into that mode. Useful for work-specific settings (network mounts, DPI, keyboard backlight, …).
  • Only the waifufetch line in ~/.zshrc is ever touched; everything else is left alone. First write backs up to ~/.zshrc.5d-utilities.bak.

Uninstall

Packaged:

paru -R 5d-utilities-git

From source:

systemctl --user disable --now 5d-utilities
rm ~/.local/bin/5d-utilities ~/.local/share/icons/hicolor/scalable/apps/5d-utilities.svg ~/.config/systemd/user/5d-utilities.service
rm -rf ~/.config/5d-utilities

Project layout

├── install.sh              # from-source installer (deps, icon, unit, enable)
├── icons/
│   └── 5d-utilities.svg    # the 5D logo (white vector, tinted at runtime)
├── service/
│   ├── 5d-utilities        # the tray app: modes + function menu + settings dialog (PyQt6)
│   ├── 5d-utilities.service  # systemd user unit (graphical-session.target)
│   └── smoke-test.py       # headless startup + mode-switch test (dev only, not packaged)
├── LICENSE                 # GPL-3.0-or-later
└── CONTEXT.md              # agent knowledge (local, not on the Forgejo page)

Credits