New backup 2025-07-24 11:00:03

This commit is contained in:
Penelope Gwen 2025-07-24 11:00:03 -07:00
parent b22cfccfcd
commit 2f5d0c97cc
3 changed files with 42 additions and 11 deletions

View file

@ -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;

View file

@ -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
; {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}"`

View file

@ -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
}