diff --git a/roles/eww/files/change-active-workspace b/roles/eww/files/change-active-workspace deleted file mode 100755 index 7a693aa..0000000 --- a/roles/eww/files/change-active-workspace +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - - diff --git a/roles/eww/files/get-active-workspace b/roles/eww/files/get-active-workspace deleted file mode 100755 index e283064..0000000 --- a/roles/eww/files/get-active-workspace +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -swaymsg -t get_workspaces --raw | jq -r '.[] | select(.focused == true) | .name' diff --git a/roles/eww/files/get-workspaces b/roles/eww/files/get-workspaces index 970cdb0..387cd39 100755 --- a/roles/eww/files/get-workspaces +++ b/roles/eww/files/get-workspaces @@ -1,3 +1,13 @@ #!/bin/bash -swaymsg -t get_workspaces --raw | jq -c 'map({name: .name | tostring, output: .output, icon: .name[2:]})' +function run() { + swaymsg -t get_workspaces --raw | jq -c 'map({name: .name | tostring, output: .output, icon: .name[2:], focused: .focused})' +} + +run + +swaymsg -t subscribe '["workspace"]' --monitor | { + while read -r; do + run + done +} diff --git a/roles/eww/templates/eww.yuck.j2 b/roles/eww/templates/eww.yuck.j2 index 26fc27e..195f2a6 100644 --- a/roles/eww/templates/eww.yuck.j2 +++ b/roles/eww/templates/eww.yuck.j2 @@ -27,7 +27,7 @@ (label :text "${current_workspace}" :visible false) (for workspace in workspaces (eventbox :onclick "swaymsg workspace ${workspace.name}" - (box :class "workspace-entry ${workspace.name == current_workspace ? "current" : ""}" + (box :class "workspace-entry ${workspace.focused ? "current" : ""}" (label :text "${workspace.icon}") ) )