eww: Better workspaces

This commit is contained in:
2024-05-15 23:22:39 +02:00
parent f4b52e2836
commit 6540833edc
3 changed files with 39 additions and 18 deletions

View File

@ -31,18 +31,23 @@ window {
border-radius: 30px;
padding-top: 3px;
padding-bottom: 5px;
margin-top: 3px;
margin-bottom: 3px;
box-shadow: 0 0px 5px 1px #06060b;
transition: all 1s;
margin-bottom: 6px;
transition: border-color 0.5s;
}
.workspace.active {
border: solid $highlight2 2px;
}
.workspace:hover {
background-color: $lowlight2;
}
.workspace:active {
background-color: $highlight2;
}
.workspaces {
margin-top: 10px;
margin-bottom: 10px;
}

View File

@ -50,10 +50,26 @@
:valign "start"
:class "workspaces"
:space-evenly: false
(for workspace in workspaces_json
(button :visible {workspace.monitor == monitor} :class 'workspace ${workspace.class}'
(label :text '${workspace.id}'))
)))
; can't use a for loop here because that breaks css animations
(workspace :n 1)
(workspace :n 2)
(workspace :n 3)
(workspace :n 4)
(workspace :n 5)
(workspace :n 6)
(workspace :n 7)
(workspace :n 8)
(workspace :n 9)
(workspace :n 10)
(workspace :n 11)
(workspace :n 12)
))
(defwidget workspace [n]
(button :visible {jq(workspaces, '.["${n}"] != null')}
:class 'workspace ${workspaces[n].class}'
(label :text n))
)
(defwidget speaker []
(eventbox
@ -110,7 +126,6 @@
bat_charge < 15 ? "battery-gauge low" :
"battery-gauge"
}
;:style {bat_charge < 15 ? "color: red;" : ""}
)
;(label :text "${bat_charge}%")
))
@ -160,7 +175,7 @@
(defvar show_volume false)
(defpoll workspaces_json :interval "1s" "eww-workspaces")
(defpoll workspaces :interval "1s" "eww-workspaces")
(defpoll volume_out :interval "1s" "pamixer --get-volume")
(defpoll vpn_status :interval "1s" "mullvad-status")
(defpoll current_minute :interval "1s" "date +%M")

View File

@ -5,5 +5,6 @@ let active = (hyprctl activeworkspace -j | from json | get id)
hyprctl workspaces -j |
from json |
sort-by id |
each {|w| {id: $w.id monitor: $w.monitorID class: (if ($w.id == $active) {"active"} else {""}) }} |
each {|w| {$w.id: {monitor: $w.monitorID class: (if ($w.id == $active) {"active"} else {""}) }}} |
reduce {|a, b| $a | merge $b } |
to json