From 5123a3eda25957e1efe4e0b280e3c25e414a2b87 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 28 Feb 2024 13:42:48 +0100 Subject: eww, Hyprland: Fix various issues related to multimonitor --- .config/eww/eww.yuck | 4 +- .config/eww/scripts/active-workspace-listener | 2 +- .config/eww/scripts/workspace-list-listener | 25 ++++----- .config/hypr/hyprland.conf.in | 80 +++++++++++++-------------- 4 files changed, 54 insertions(+), 57 deletions(-) diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index b50fcc0..b1b02ca 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -2,7 +2,7 @@ (deflisten active-workspace `stdbuf -oL scripts/active-workspace-listener`) -(deflisten workspace-list :initial '[1]' +(deflisten workspace-list :initial '[[1]]' `stdbuf -oL scripts/workspace-list-listener`) (deflisten datetime @@ -73,7 +73,7 @@ (defwidget workspaces [monitor] (box :class "workspaces" :space-evenly false - (for id in workspace-list + (for id in {workspace-list[monitor]} (button :class {active-workspace[monitor] == id ? "active" : ""} :onclick `hyprctl dispatch workspace ${id}` id)))) diff --git a/.config/eww/scripts/active-workspace-listener b/.config/eww/scripts/active-workspace-listener index 3f57ec5..3c47e87 100755 --- a/.config/eww/scripts/active-workspace-listener +++ b/.config/eww/scripts/active-workspace-listener @@ -11,4 +11,4 @@ readonly IPC=/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock hyprctl -j monitors esac done -} | jq -cr '[.[] | .activeWorkspace.name]' +} | jq -cr '[.[] | .activeWorkspace.id % 10]' diff --git a/.config/eww/scripts/workspace-list-listener b/.config/eww/scripts/workspace-list-listener index 9ad35ca..5ab5c19 100755 --- a/.config/eww/scripts/workspace-list-listener +++ b/.config/eww/scripts/workspace-list-listener @@ -2,20 +2,17 @@ readonly IPC=/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock -ws="`hyprctl -j workspaces | jq -r 'sort_by(.id) | .[] | .name'`" -jo -a $ws +hyptctl -j workspaces | jq -cr ' + [.[].id] + | group_by(. / 10 | floor) + | [.[] | map(. % 10)] +' socat -u UNIX-CONNECT:"$IPC" - \ | stdbuf -oL grep -E '^(create|destroy)workspace>>' \ - | while IFS='>>' read -r e _ n - do - case "$e" in - c*) - ws="`printf '%s\n%s\n' "$ws" $n | sort -n`" - ;; - d*) - ws="`echo "$ws" | grep -v "^$n$"`" - ;; - esac - jo -a $ws - done + | while read -r _; do hyprctl -j workspaces; done \ + | jq -cr ' + [.[].id] + | group_by(. / 10 | floor) + | [.[] | map(. % 10) | sort_by(.)] + ' diff --git a/.config/hypr/hyprland.conf.in b/.config/hypr/hyprland.conf.in index 2df8959..6b3362b 100644 --- a/.config/hypr/hyprland.conf.in +++ b/.config/hypr/hyprland.conf.in @@ -113,48 +113,48 @@ bind = $modkey, up, movefocus, u bind = $modkey, right, movefocus, r # Switch workspaces with modkey + [0-9] -bind = $modkey, 0, focusworkspaceoncurrentmonitor, 1 -bind = $modkey, 1, focusworkspaceoncurrentmonitor, 2 -bind = $modkey, 2, focusworkspaceoncurrentmonitor, 3 -bind = $modkey, 3, focusworkspaceoncurrentmonitor, 4 -bind = $modkey, 4, focusworkspaceoncurrentmonitor, 5 -bind = $modkey, 5, focusworkspaceoncurrentmonitor, 6 -bind = $modkey, 6, focusworkspaceoncurrentmonitor, 7 -bind = $modkey, 7, focusworkspaceoncurrentmonitor, 8 -bind = $modkey, 8, focusworkspaceoncurrentmonitor, 9 -bind = $modkey, 9, focusworkspaceoncurrentmonitor, 10 -bind = $modkey, 10, focusworkspaceoncurrentmonitor, 1 -bind = $modkey, 11, focusworkspaceoncurrentmonitor, 2 -bind = $modkey, 12, focusworkspaceoncurrentmonitor, 3 -bind = $modkey, 13, focusworkspaceoncurrentmonitor, 4 -bind = $modkey, 14, focusworkspaceoncurrentmonitor, 5 -bind = $modkey, 15, focusworkspaceoncurrentmonitor, 6 -bind = $modkey, 16, focusworkspaceoncurrentmonitor, 7 -bind = $modkey, 17, focusworkspaceoncurrentmonitor, 8 -bind = $modkey, 18, focusworkspaceoncurrentmonitor, 9 -bind = $modkey, 19, focusworkspaceoncurrentmonitor, 10 +bind = $modkey, 0, hyprwork, 1 +bind = $modkey, 1, hyprwork, 2 +bind = $modkey, 2, hyprwork, 3 +bind = $modkey, 3, hyprwork, 4 +bind = $modkey, 4, hyprwork, 5 +bind = $modkey, 5, hyprwork, 6 +bind = $modkey, 6, hyprwork, 7 +bind = $modkey, 7, hyprwork, 8 +bind = $modkey, 8, hyprwork, 9 +bind = $modkey, 9, hyprwork, 10 +bind = $modkey, 10, hyprwork, 1 +bind = $modkey, 11, hyprwork, 2 +bind = $modkey, 12, hyprwork, 3 +bind = $modkey, 13, hyprwork, 4 +bind = $modkey, 14, hyprwork, 5 +bind = $modkey, 15, hyprwork, 6 +bind = $modkey, 16, hyprwork, 7 +bind = $modkey, 17, hyprwork, 8 +bind = $modkey, 18, hyprwork, 9 +bind = $modkey, 19, hyprwork, 10 # Move active window to a workspace with modkey + SHIFT + [0-9] -bind = $modkey CONTROL, 0, movetoworkspace, 1 -bind = $modkey CONTROL, 1, movetoworkspace, 2 -bind = $modkey CONTROL, 2, movetoworkspace, 3 -bind = $modkey CONTROL, 3, movetoworkspace, 4 -bind = $modkey CONTROL, 4, movetoworkspace, 5 -bind = $modkey CONTROL, 5, movetoworkspace, 6 -bind = $modkey CONTROL, 6, movetoworkspace, 7 -bind = $modkey CONTROL, 7, movetoworkspace, 8 -bind = $modkey CONTROL, 8, movetoworkspace, 9 -bind = $modkey CONTROL, 9, movetoworkspace, 10 -bind = $modkey CONTROL, 10, movetoworkspace, 1 -bind = $modkey CONTROL, 11, movetoworkspace, 2 -bind = $modkey CONTROL, 12, movetoworkspace, 3 -bind = $modkey CONTROL, 13, movetoworkspace, 4 -bind = $modkey CONTROL, 14, movetoworkspace, 5 -bind = $modkey CONTROL, 15, movetoworkspace, 6 -bind = $modkey CONTROL, 16, movetoworkspace, 7 -bind = $modkey CONTROL, 17, movetoworkspace, 8 -bind = $modkey CONTROL, 18, movetoworkspace, 9 -bind = $modkey CONTROL, 19, movetoworkspace, 10 +bind = $modkey CONTROL, 0, hyprmove, 1 +bind = $modkey CONTROL, 1, hyprmove, 2 +bind = $modkey CONTROL, 2, hyprmove, 3 +bind = $modkey CONTROL, 3, hyprmove, 4 +bind = $modkey CONTROL, 4, hyprmove, 5 +bind = $modkey CONTROL, 5, hyprmove, 6 +bind = $modkey CONTROL, 6, hyprmove, 7 +bind = $modkey CONTROL, 7, hyprmove, 8 +bind = $modkey CONTROL, 8, hyprmove, 9 +bind = $modkey CONTROL, 9, hyprmove, 10 +bind = $modkey CONTROL, 10, hyprmove, 1 +bind = $modkey CONTROL, 11, hyprmove, 2 +bind = $modkey CONTROL, 12, hyprmove, 3 +bind = $modkey CONTROL, 13, hyprmove, 4 +bind = $modkey CONTROL, 14, hyprmove, 5 +bind = $modkey CONTROL, 15, hyprmove, 6 +bind = $modkey CONTROL, 16, hyprmove, 7 +bind = $modkey CONTROL, 17, hyprmove, 8 +bind = $modkey CONTROL, 18, hyprmove, 9 +bind = $modkey CONTROL, 19, hyprmove, 10 # Media keys __binde(, xf86audiomute, amixer -q sset Master toggle) -- cgit v1.2.3