user/eww: add linebar
This commit is contained in:
parent
1e80b3f543
commit
26d248d971
4 changed files with 86 additions and 1 deletions
|
|
@ -47,3 +47,26 @@ window {
|
|||
}
|
||||
}
|
||||
|
||||
.widget.line-workspaces {
|
||||
color: transparent;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
font-size: 0;
|
||||
|
||||
button {
|
||||
padding: 0 17px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
background-color: $background;
|
||||
}
|
||||
|
||||
.occupied {
|
||||
background-color: $accent;
|
||||
}
|
||||
|
||||
.focused {
|
||||
background-color: $foreground;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
(defwindow linebar :monitor 0
|
||||
:geometry (geometry :x "35px"
|
||||
:y "0%"
|
||||
:width "100%"
|
||||
:height "2px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:windowtype "dock"
|
||||
:wm-ignore false
|
||||
(wlinebar))
|
||||
|
||||
(defwindow mainbar :monitor 0
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0%"
|
||||
|
|
@ -24,6 +35,7 @@
|
|||
`date "+:%S"`)
|
||||
|
||||
(deflisten lworkspaces "./scripts/workspaces.sh")
|
||||
(deflisten llineworkspaces "./scripts/line-workspaces.sh")
|
||||
(deflisten ltitle "./scripts/title.sh")
|
||||
|
||||
(defwidget bar []
|
||||
|
|
@ -34,9 +46,16 @@
|
|||
(title)
|
||||
(time))))
|
||||
|
||||
(defwidget wlinebar []
|
||||
(eventbox :onscroll "./scripts/scroll.sh {}"
|
||||
(line_workspaces)))
|
||||
|
||||
(defwidget workspaces []
|
||||
(literal :content lworkspaces))
|
||||
|
||||
(defwidget line_workspaces []
|
||||
(literal :content llineworkspaces))
|
||||
|
||||
(defwidget title []
|
||||
(literal :content ltitle))
|
||||
|
||||
|
|
|
|||
43
res/eww/scripts/line-workspaces.sh
Executable file
43
res/eww/scripts/line-workspaces.sh
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Checks if a list ($1) contains an element ($2)
|
||||
contains() {
|
||||
for e in $1; do
|
||||
[ "$e" -eq "$2" ] && echo 1 && return
|
||||
done
|
||||
echo 0
|
||||
}
|
||||
|
||||
print_workspaces() {
|
||||
buf=""
|
||||
desktops=$(bspc query -D --names)
|
||||
focused_desktop=$(bspc query -D -d focused --names)
|
||||
occupied_desktops=$(bspc query -D -d .occupied --names)
|
||||
urgent_desktops=$(bspc query -D -d .urgent --names)
|
||||
|
||||
for d in $desktops; do
|
||||
if [ "$(contains "$focused_desktop" "$d")" -eq 1 ]; then
|
||||
ws=$d
|
||||
class="focused"
|
||||
elif [ "$(contains "$occupied_desktops" "$d")" -eq 1 ]; then
|
||||
ws=$d
|
||||
class="occupied"
|
||||
elif [ "$(contains "$urgent_desktops" "$d")" -eq 1 ]; then
|
||||
ws=$d
|
||||
class="urgent"
|
||||
else
|
||||
ws=$d
|
||||
class="empty"
|
||||
fi
|
||||
|
||||
buf="$buf (eventbox :cursor \"hand\" (button :class \"$class\" :onclick \"bspc desktop -f $ws\" \"\"))"
|
||||
done
|
||||
|
||||
echo "(box :class \"widget line-workspaces\" :halign \"start\" :valign \"center\" :vexpand true :hexpand true $buf)"
|
||||
}
|
||||
|
||||
# Listen to bspwm changes
|
||||
print_workspaces
|
||||
bspc subscribe desktop node_transfer | while read -r _ ; do
|
||||
print_workspaces
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue