From 037e038190019aecceaeab879ff20e892ab1d90d Mon Sep 17 00:00:00 2001 From: pascalyazid Date: Tue, 5 May 2026 17:03:02 +0200 Subject: [PATCH 1/2] Added per monitor workspace highlights. --- widget/Workspaces.tsx | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/widget/Workspaces.tsx b/widget/Workspaces.tsx index 9339e2b..f0839ce 100644 --- a/widget/Workspaces.tsx +++ b/widget/Workspaces.tsx @@ -1,30 +1,37 @@ import { execAsync, createSubprocess } from "ags/process" +import { Gdk } from "ags/gtk4" import GLib from "gi://GLib?version=2.0" const HIS = GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE") const sock = `${GLib.getenv("XDG_RUNTIME_DIR")}/hypr/${HIS}/.socket2.sock` -export default function Workspaces() { +export default function Workspaces({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) { + const monitorName = gdkmonitor.get_connector() + // Listen to the Hyprland socket for instant workspace updates const activeWs = createSubprocess( 1, [ "sh", "-c", - `hyprctl activeworkspace -j | grep '"id":' | head -1 | awk '{print $2}' | tr -d ','; nc -U ${sock}`, + ` +MON="${monitorName}" +print_ws() { + hyprctl monitors -j | python3 -c "import json, sys; mon = sys.argv[1]; data = json.load(sys.stdin); print(next((m.get('activeWorkspace', {}).get('id', 0) for m in data if m.get('name') == mon), 0))" "$MON" +} + +print_ws +nc -U ${sock} | while IFS= read -r line; do + case "$line" in + focusedmon*|workspace*|workspacev2*|moveworkspace*|moveworkspacev2*|createworkspace*|destroyworkspace*) + print_ws + ;; + esac +done +`, ], (out, prev) => { - // Multi-monitor focus changes emit focusedmon without workspace events. - const focusedMonMatch = out.match(/(?:^|\n)focusedmon>>[^,\n]+,(\d+)/) - if (focusedMonMatch) return parseInt(focusedMonMatch[1]) - - const match = out.match(/(?:^|\n)workspace>>(\d+)/) - if (match) return parseInt(match[1]) - - const matchV2 = out.match(/(?:^|\n)workspacev2>>(\d+),/) - if (matchV2) return parseInt(matchV2[1]) - - const num = parseInt(out) + const num = parseInt(out.trim()) if (!isNaN(num) && num > 0) return num return prev From 92cd72224af4a31df401ca29161b3809748c14e0 Mon Sep 17 00:00:00 2001 From: pascalyazid Date: Tue, 5 May 2026 17:11:00 +0200 Subject: [PATCH 2/2] Formatting and linting --- README.md | 8 +++++--- widget/QuickSettings.tsx | 2 +- widget/Workspaces.tsx | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0f71895..d865c3b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ yay -S astal-gjs astal-mpris astal-tray astal-network astal-bluetooth astal-wire ## 🚀 Setup & Installation 1. **Clone/Place the Config:** Ensure this repository is placed at `~/.config/ags`. -2. **Wallpaper Directory:** Create a folder at `~/wallpapers` where you can place your `.jpg` or `.png` wallpapers in. The theme switcher looks here by default. +2. **Wallpaper Directory:** Create a folder at `~/wallpapers` where you can place your `.jpg` or `.png` wallpapers in. The theme switcher looks here by default. ```bash mkdir -p ~/wallpapers ``` @@ -80,7 +80,6 @@ include ~/.cache/wal/colors-kitty.conf _Next time you open Kitty, it will perfectly match your wallpaper._ - ### Example 2: Dunst (Notification Daemon) Pywal doesn't generate a theme for every application, hence you have to define some templates yourself in `~/.config/wal/templates`. @@ -110,6 +109,7 @@ In this case we will create a template for Dunst: frame_color = "{color9}" timeout = 0 ``` + After switching the wallpaper, pywal will generate a theme with the exactly same name in `~/.cache/wal` You can create a symlink so dunst will always have the current theme: @@ -117,11 +117,13 @@ You can create a symlink so dunst will always have the current theme: ln -sf ~/.cache/wal/dunstrc ~/.config/dunst/dunstrc ``` -Because dunst doesn't apply the theme while it's running, we added +Because dunst doesn't apply the theme while it's running, we added + ```bash killall dunst dunst & ``` + in the `update_script.sh` Bash-Script which runs every time the wallpaper is switched. You can add your own commands in there if needed. diff --git a/widget/QuickSettings.tsx b/widget/QuickSettings.tsx index 5ebeb26..514f278 100644 --- a/widget/QuickSettings.tsx +++ b/widget/QuickSettings.tsx @@ -3,7 +3,7 @@ import AstalNetwork from "gi://AstalNetwork?version=0.1" import AstalBluetooth from "gi://AstalBluetooth?version=0.1" import AstalWp from "gi://AstalWp?version=0.1" import { createBinding } from "ags" -import { execAsync, createSubprocess } from "ags/process" +import { execAsync } from "ags/process" function NetworkItem() { const network = AstalNetwork.Network.get_default() diff --git a/widget/Workspaces.tsx b/widget/Workspaces.tsx index f0839ce..4cbc6fa 100644 --- a/widget/Workspaces.tsx +++ b/widget/Workspaces.tsx @@ -5,7 +5,11 @@ import GLib from "gi://GLib?version=2.0" const HIS = GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE") const sock = `${GLib.getenv("XDG_RUNTIME_DIR")}/hypr/${HIS}/.socket2.sock` -export default function Workspaces({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) { +export default function Workspaces({ + gdkmonitor, +}: { + gdkmonitor: Gdk.Monitor +}) { const monitorName = gdkmonitor.get_connector() // Listen to the Hyprland socket for instant workspace updates