-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: feat(sway): Add basic tray with EWW
WIP because this needs to handle systems without a battery, and maybe have a network icon.
- Loading branch information
1 parent
4813ce2
commit 607c030
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* { all: unset; } | ||
|
||
.tray-items { | ||
font-size: 1.35em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(defwindow tray | ||
:monitor 0 | ||
:geometry (geometry :height "0%" | ||
:width "0%" | ||
:anchor "bottom left") | ||
:stacking "bottom" | ||
:exclusive true | ||
:focusable false | ||
|
||
(_tray_items)) | ||
|
||
(defwidget _tray_items [] | ||
(box :class "tray-items" | ||
|
||
:spacing 3 | ||
:vexpand true | ||
:hexpand true | ||
:valign "center" | ||
:halign "start" | ||
:space-evenly false | ||
|
||
(_battery_icon) | ||
(_clock) | ||
"|" | ||
(systray :spacing 5 | ||
:orientation "horizontal" | ||
:space-evenly false))) | ||
|
||
(defvar battery_icons `[ | ||
"", | ||
"", | ||
"", | ||
"", | ||
"" | ||
]`) | ||
|
||
(defwidget _battery_icon [] | ||
(label :text { | ||
jq(EWW_BATTERY, "first(.[])").status == "Charging" ? | ||
"" : | ||
battery_icons[round(jq(EWW_BATTERY, "first(.[])").capacity / 25, 0)] | ||
} | ||
:tooltip "${jq(EWW_BATTERY, "first(.[])").capacity}%")) | ||
|
||
(defwidget _clock [] | ||
(label :text { formattime(EWW_TIME, "%R") } | ||
:tooltip { formattime(EWW_TIME, "%F") })) |