diff --git a/de/home/.config/eww/eww.scss b/de/home/.config/eww/eww.scss index a4df91d..67705b9 100644 --- a/de/home/.config/eww/eww.scss +++ b/de/home/.config/eww/eww.scss @@ -59,6 +59,7 @@ $bar-module-border-radius: 8px; padding: 0px 5px; } } +.workspaces>revealer>box>box>button, .workspaces>box>box>button { margin: 5px 0px; background-color: $bar-module-bg-color; @@ -173,7 +174,7 @@ label { .profile { border-radius: $bar-module-border-radius; } -.workspaces button, +//.workspaces button, .leftgroup button { // background-color: $bar-module-bg-color; // border-left: 1px solid $bar-module-fg-color; diff --git a/de/home/.config/eww/modules/bar/workspaces.yuck b/de/home/.config/eww/modules/bar/workspaces.yuck index 8039e21..19d872a 100644 --- a/de/home/.config/eww/modules/bar/workspaces.yuck +++ b/de/home/.config/eww/modules/bar/workspaces.yuck @@ -1,5 +1,7 @@ (deflisten workspacesArray :initial '[{"name": "placeholder","focused":true,"num":0}]' 'scripts/bar/workspaces') +(deflisten activeWorkspace :initial '0' + 'scripts/bar/active-workspace') (defvar wsreveal true) (defwidget workspaces [array] @@ -15,22 +17,36 @@ (box (for entry in array (literal - :visible {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? true : false} - :content {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? "(workspace :ws entry)" : "(box :visible false)"})))) + :visible {(entry.num < activeWorkspace) ? true : false} + :content {(entry.num < activeWorkspace) ? "(workspace :ws entry)" : "(box :visible false)"})))) + (box + (for entry in array + (literal + :visible {entry.focused ? true : false} + :content {entry.focused ? "(workspace :ws entry)" : "(box :visible false)"}))) + (revealer + :reveal wsreveal + :transition "slideright" + :duration "500ms" + (box + (for entry in array + (literal + :visible {(entry.num > activeWorkspace) ? true : false} + :content {(entry.num > activeWorkspace) ? "(workspace :ws entry)" : "(box :visible false)"})))))) - (for entry in array +; (for entry in array ; {entry.focused ? (workspace :ws entry) : ""}))) ; (for ws in {} - (box +; (box ; (literal ; :visible {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? true : false} ; :content {(entry.num < jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? "(workspace :ws entry)" : "(box :visible false)"}) - (literal - :visible {entry.focused ? true : false} - :content {entry.focused ? "(workspace :ws entry)" : "(box :visible false)"}) - (literal - :visible {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? true : false} - :content {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num', 'r')) ? "(workspace :ws entry)" : "(box :visible false)"}))))) +; (literal +; :visible {entry.focused ? true : false} +; :content {entry.focused ? "(workspace :ws entry)" : "(box :visible false)"}) +; (literal +; :visible {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num')) ? true : false} +; :content {(entry.num > jq(array, '.. | select(.type?) | select(.focused==true).num')) ? "(workspace :ws entry)" : "(box :visible false)"}))))) ;; {entry.focused ? "${entry.num}" : ""}))) ; (button :onclick `swaymsg workspace "${entry.name}"` diff --git a/de/home/.config/eww/scripts/bar/active-workspace b/de/home/.config/eww/scripts/bar/active-workspace new file mode 100755 index 0000000..5ec124e --- /dev/null +++ b/de/home/.config/eww/scripts/bar/active-workspace @@ -0,0 +1,14 @@ +#!/bin/bash + +function get_workspaces_info() { + output=$(swaymsg -t get_workspaces | jq -r '.. | select(.type?) | select(.focused==true).num') + echo $output +} + +get_workspaces_info + +swaymsg -t subscribe '["workspace"]' --monitor | { + while read -r event; do + get_workspaces_info + done +}