eww
This commit is contained in:
parent
4667653ed1
commit
d149a7704b
8 changed files with 41 additions and 117 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Depends on bspwm
|
# Depends on bspwm
|
||||||
{ pkgs, ... }: {
|
{ pkgs, ... }: {
|
||||||
home.packages = with pkgs; [ xtitle ];
|
home.packages = with pkgs; [ socat ];
|
||||||
programs.eww = {
|
programs.eww = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configDir = ../../res/eww;
|
configDir = ../../res/eww;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
self: super: {
|
self: super: {
|
||||||
eww = super.eww.overrideAttrs (old: rec {
|
eww = (super.eww.override { withWayland = true; }).overrideAttrs (old: rec {
|
||||||
patches = old.patches ++ [
|
patches = old.patches ++ [
|
||||||
# Use normal scroll events instead of smooth scroll ( due to https://bugzilla.gnome.org/show_bug.cgi?id=675959 )
|
# Use normal scroll events instead of smooth scroll ( due to https://bugzilla.gnome.org/show_bug.cgi?id=675959 )
|
||||||
./patches/eww.patch
|
./patches/eww.patch
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,3 @@
|
||||||
(defwindow linebar :monitor 0
|
|
||||||
:geometry (geometry :x "30px"
|
|
||||||
: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%"
|
||||||
|
|
@ -16,8 +5,8 @@
|
||||||
:height "30px"
|
:height "30px"
|
||||||
:anchor "top center")
|
:anchor "top center")
|
||||||
:stacking "fg"
|
:stacking "fg"
|
||||||
:windowtype "dock"
|
:exclusive false
|
||||||
:wm-ignore false
|
:focusable false
|
||||||
(bar))
|
(bar))
|
||||||
|
|
||||||
(defvar time-extended false) ; for :run-while property of below variable
|
(defvar time-extended false) ; for :run-while property of below variable
|
||||||
|
|
@ -34,8 +23,6 @@
|
||||||
:run-while time-extended
|
:run-while time-extended
|
||||||
`date "+:%S"`)
|
`date "+:%S"`)
|
||||||
|
|
||||||
(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 []
|
||||||
|
|
@ -46,15 +33,19 @@
|
||||||
(title)
|
(title)
|
||||||
(time))))
|
(time))))
|
||||||
|
|
||||||
(defwidget wlinebar []
|
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/workspaces.sh")
|
||||||
(eventbox :onscroll "./scripts/scroll.sh {}"
|
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/active-workspace.sh")
|
||||||
(line_workspaces)))
|
|
||||||
|
|
||||||
(defwidget workspaces []
|
(defwidget workspaces []
|
||||||
(literal :content lworkspaces))
|
(box :class "widget workspaces"
|
||||||
|
:halign "start"
|
||||||
(defwidget line_workspaces []
|
:valign "center"
|
||||||
(literal :content llineworkspaces))
|
:vexpand true
|
||||||
|
:hexpand true
|
||||||
|
(for workspace in workspaces
|
||||||
|
(eventbox :cursor "hand"
|
||||||
|
(button :class "${workspace.id == current_workspace ? "focused" : (workspace.windows > 0 ? "occupied" : "empty")}"
|
||||||
|
:onclick "hyprctl dispatch workspace ${workspace.id}"
|
||||||
|
"${workspace.id == current_workspace ? "" : (workspace.windows > 0 ? "" : "")}")))))
|
||||||
|
|
||||||
(defwidget title []
|
(defwidget title []
|
||||||
(literal :content ltitle))
|
(literal :content ltitle))
|
||||||
|
|
@ -72,6 +63,5 @@
|
||||||
(time_extension :text {time-extended ? petimea : ""})
|
(time_extension :text {time-extended ? petimea : ""})
|
||||||
(label :text ptime
|
(label :text ptime
|
||||||
:class "base")
|
:class "base")
|
||||||
(time_extension :text {time-extended ? petimeb : ""})
|
(time_extension :text {time-extended ? petimeb : ""}))))
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
|
||||||
6
res/eww/scripts/active-workspace.sh
Executable file
6
res/eww/scripts/active-workspace.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
||||||
|
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||||
|
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
xtitle -s | while read -r line ; do
|
out () {
|
||||||
trunc=$(echo $line | cut -c-85)
|
if [ -z "$1" ]; then
|
||||||
if [ -z "$line" ]; then
|
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "(box :class \"widget title\" :halign \"center\" :valign \"center\" :vexpand true :hexpand true (label :text \"${trunc}\"))"
|
echo "(box :class \"widget title\" :halign \"center\" :valign \"center\" :vexpand true :hexpand true (label :text \"$1\"))"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
init=$(hyprctl activewindow -j | jq --raw-output .title)
|
||||||
|
out "$init"
|
||||||
|
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}' | while read -r line ; do
|
||||||
|
trunc=$(echo $line | cut -c-85)
|
||||||
|
out "$trunc"
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,11 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Checks if a list ($1) contains an element ($2)
|
spaces (){
|
||||||
contains() {
|
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
|
||||||
for e in $1; do
|
seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
|
||||||
[ "$e" -eq "$2" ] && echo 1 && return
|
|
||||||
done
|
|
||||||
echo 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_workspaces() {
|
spaces
|
||||||
buf=""
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||||
desktops=$(bspc query -D --names)
|
spaces
|
||||||
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
|
|
||||||
icon=""
|
|
||||||
class="focused"
|
|
||||||
elif [ "$(contains "$occupied_desktops" "$d")" -eq 1 ]; then
|
|
||||||
ws=$d
|
|
||||||
icon=""
|
|
||||||
class="occupied"
|
|
||||||
elif [ "$(contains "$urgent_desktops" "$d")" -eq 1 ]; then
|
|
||||||
ws=$d
|
|
||||||
icon=""
|
|
||||||
class="urgent"
|
|
||||||
else
|
|
||||||
ws=$d
|
|
||||||
icon=""
|
|
||||||
class="empty"
|
|
||||||
fi
|
|
||||||
|
|
||||||
buf="$buf (eventbox :cursor \"hand\" (button :class \"$class\" :onclick \"bspc desktop -f $ws\" \"$icon\"))"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "(box :class \"widget 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
|
done
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
# spicetify
|
# spicetify
|
||||||
|
|
||||||
dunst
|
dunst
|
||||||
# eww
|
eww
|
||||||
# picom
|
# picom
|
||||||
#
|
#
|
||||||
# xorg
|
# xorg
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue