78 lines
2.4 KiB
Plaintext

(deflisten sway--data :initial '{"mode": "default"}'
`~/.config/eww/modules/workspaces/sway.py`)
(defvar hypr--data '{}')
(defwidget sway--workspace [ws]
(button :onclick "swaymsg workspace ${ws['index']}"
(circular-progress
:class 'indicator-circle sway--ws ${ws.active ? "sway--active" : ""} ${ws.visible ? "sway--visible" : ""} ${ws.focused ? "sway--focused" : ""} ${ws.alerted ? "sway--alerted" : ""}'
:value 100
:start-at 0
:clockwise true
:width 16
:thickness 1
(box :class 'fill' ))))
(defwidget hypr--workspace [ws]
(button :onclick "hyprmsg dispatch workspace ${ws['index']}"
(circular-progress
:class 'indicator-circle sway--ws ${ws.active ? "sway--active" : ""} ${ws.visible ? "sway--visible" : ""} ${ws.focused ? "sway--focused": ""}'
:value 100
:start-at 0
:clockwise true
:width 15
:thickness 1
(box :class 'fill' :visible {ws.focused}))))
(defwidget sway-mode []
(box :orientation "v"
:halign "center"
:space-evenly false
:spacing 0
:class "module text"
:visible {sway--data != '' && sway--data.mode != "default"}
(label :class "special"
:text "${hypr--data.mode}")
"sway mode"))
(defwidget sway-workspace [group]
(box :orientation "v"
:halign "center"
:valign "center"
:space-evenly false
:spacing 0
:class 'module text'
(label :class '${sway--data.visible[group].focused ? "special" : "offline"} nebula medium small'
:text '${sway--data.visible[group].name}')))
; (label :text "current workspace")))
(defwidget hypr-workspace [group]
(box :orientation "v"
:halign "center"
:space-evenly false
:spacing 0
:class 'module text'
(label :class '${hypr--data.visible[group].focused ? "special" : "offline"}'
:text '${hypr--data.visible[group].name}')
(label :text "current workspace")))
(defwidget sway-workspaces [group]
(box :orientation "h"
:halign "start"
:visible {sway--data != ''}
:space-evenly false
:spacing 5
:class "sway--root"
(for workspace in {sway--data.ws[sway--data.context ?: "personal"][group]}
(sway--workspace :ws workspace))))
(defwidget hypr-workspaces [group]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 5
:class "sway--root"
(for workspace in {hypr--data.ws[hypr--data.context ?: "personal"][group]}
(hypr--workspace :ws workspace))))