user/eww: add linebar
This commit is contained in:
parent
1e80b3f543
commit
26d248d971
4 changed files with 86 additions and 1 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
${pkgs.feh}/bin/feh --no-fehbg --bg-fill ~/Pictures/Wallpapers/current
|
${pkgs.feh}/bin/feh --no-fehbg --bg-fill ~/Pictures/Wallpapers/current
|
||||||
|
|
||||||
${pkgs.procps}/bin/pkill -SIGINT eww
|
${pkgs.procps}/bin/pkill -SIGINT eww
|
||||||
${pkgs.eww}/bin/eww open mainbar
|
${pkgs.eww}/bin/eww open linebar
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
(defwindow mainbar :monitor 0
|
||||||
:geometry (geometry :x "0%"
|
:geometry (geometry :x "0%"
|
||||||
:y "0%"
|
:y "0%"
|
||||||
|
|
@ -24,6 +35,7 @@
|
||||||
`date "+:%S"`)
|
`date "+:%S"`)
|
||||||
|
|
||||||
(deflisten lworkspaces "./scripts/workspaces.sh")
|
(deflisten lworkspaces "./scripts/workspaces.sh")
|
||||||
|
(deflisten llineworkspaces "./scripts/line-workspaces.sh")
|
||||||
(deflisten ltitle "./scripts/title.sh")
|
(deflisten ltitle "./scripts/title.sh")
|
||||||
|
|
||||||
(defwidget bar []
|
(defwidget bar []
|
||||||
|
|
@ -34,9 +46,16 @@
|
||||||
(title)
|
(title)
|
||||||
(time))))
|
(time))))
|
||||||
|
|
||||||
|
(defwidget wlinebar []
|
||||||
|
(eventbox :onscroll "./scripts/scroll.sh {}"
|
||||||
|
(line_workspaces)))
|
||||||
|
|
||||||
(defwidget workspaces []
|
(defwidget workspaces []
|
||||||
(literal :content lworkspaces))
|
(literal :content lworkspaces))
|
||||||
|
|
||||||
|
(defwidget line_workspaces []
|
||||||
|
(literal :content llineworkspaces))
|
||||||
|
|
||||||
(defwidget title []
|
(defwidget title []
|
||||||
(literal :content ltitle))
|
(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