nixos-configs/configs/eww/traybuttons/traybuttons.yuck

86 lines
2 KiB
Text

(defvar osk-toggle-state false)
(defwidget osk-toggle []
(eventbox :class {osk-toggle-state ? "toggle-on" : "toggle-off"}
:onclick "$HYPR_PATH/osk-toggle.sh toggle &"
(box :class "osk-toggle"
:space-evenly true
:spacing 6
:orientation "h"
(label :text " 󰌌 ")
)
)
)
(defwindow osk-toggle
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "10px"
:y "9px"
:width "0px"
:height "0px"
:anchor "top left"
)
(osk-toggle)
)
(defvar toggle-state false)
(defwidget tablet-toggle []
(eventbox :class {toggle-state ? "toggle-on" : "toggle-off"}
:onclick {toggle-state ? "$HYPR_PATH/laptop-mode.sh &" :
"$HYPR_PATH/tablet-mode.sh &"}
(box :class "tablet-toggle"
:space-evenly true
:spacing 6
:orientation "h"
(label :text " 󰦧 ")
)
)
)
(defwindow tablet-toggle
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "72px"
:y "9px"
:width "0px"
:height "0px"
:anchor "top left"
)
(tablet-toggle)
)
(defvar notif-panel-state false)
(defwidget notif-panel []
(button :class {notif-panel-state ? "toggle-on" : "toggle-off"}
:onclick {notif-panel-state ? "swaync-client -cp; eww update notif-panel-state=false" :
"swaync-client -op; eww update notif-panel-state=true"}
(box :class "notif-panel"
:space-evenly true
:spacing 6
:orientation "h"
(label :text " ${notif_icon} ")
)
)
)
(defwindow notif-panel
:monitor 0
:stacking "overlay"
:exclusive "ignore"
:geometry (geometry :x "50px"
:y "11px"
:width "0px"
:height "0px"
:anchor "top right"
)
(notif-panel)
)