[eww] Add workspaces & systray
This commit is contained in:
parent
c8ab72f878
commit
e4b35d69e8
5 changed files with 85 additions and 16 deletions
|
@ -36,27 +36,39 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label, .systray {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.workspace {
|
||||||
|
color: $foreground;
|
||||||
|
label {
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace:hover {
|
||||||
|
background-color: $hovered;
|
||||||
|
}
|
||||||
|
|
||||||
|
.workspace.active {
|
||||||
|
background-color: $selected;
|
||||||
|
}
|
||||||
|
|
||||||
scale {
|
scale {
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
}
|
slider {
|
||||||
|
|
||||||
scale slider {
|
|
||||||
all: unset;
|
all: unset;
|
||||||
}
|
}
|
||||||
|
trough {
|
||||||
scale trough {
|
|
||||||
min-height: 6px;
|
min-height: 6px;
|
||||||
min-width: 60px;
|
min-width: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressbar trough {
|
progressbar trough {
|
||||||
border: 2px solid $accent2;
|
border: 2px solid $accent2;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
progress {
|
progress {
|
||||||
background-color: $accent1;
|
background-color: $accent1;
|
||||||
|
|
|
@ -15,14 +15,37 @@
|
||||||
; Window Title
|
; Window Title
|
||||||
(deflisten window-title "hyprctl activewindow -j | jq --raw-output .title; socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}'")
|
(deflisten window-title "hyprctl activewindow -j | jq --raw-output .title; socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}'")
|
||||||
|
|
||||||
|
; Workspaces
|
||||||
|
(deflisten workspaces "~/.config/eww/scripts/get-workspaces.sh")
|
||||||
|
(deflisten active-workspace "~/.config/eww/scripts/get-active-workspace.sh")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Widgets
|
; Widgets
|
||||||
(defwidget bar-left []
|
(defwidget bar-left []
|
||||||
(box :halign "start"
|
(box :halign "start"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
|
(workspaces)
|
||||||
|
(systray :spacing 8
|
||||||
|
:icon-size 16
|
||||||
|
:class "systray"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget workspaces []
|
||||||
|
(eventbox :onscroll "~/.config/eww/scripts/change-active-workspace.sh {} ${active-workspace}"
|
||||||
|
(box :spacing 0
|
||||||
|
(for workspace in workspaces
|
||||||
|
(eventbox :onclick "hyprctl dispatch workspace ${workspace}"
|
||||||
|
:class "workspace ${workspace == active-workspace ? "active" : ""}"
|
||||||
|
(label :text "${workspace}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
(defwidget bar-middle []
|
(defwidget bar-middle []
|
||||||
(label :limit-width 2
|
(label :limit-width 2
|
||||||
|
@ -30,6 +53,7 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(defwidget bar-right []
|
(defwidget bar-right []
|
||||||
(box :halign "end"
|
(box :halign "end"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
|
|
21
.config/eww/scripts/change-active-workspace
Executable file
21
.config/eww/scripts/change-active-workspace
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
function clamp {
|
||||||
|
min=$1
|
||||||
|
max=$2
|
||||||
|
val=$3
|
||||||
|
python -c "print(max($min, min($val, $max)))"
|
||||||
|
}
|
||||||
|
|
||||||
|
direction=$1
|
||||||
|
current=$2
|
||||||
|
if test "$direction" = "down"
|
||||||
|
then
|
||||||
|
target=$(clamp 1 10 $(($current+1)))
|
||||||
|
echo "jumping to $target"
|
||||||
|
hyprctl dispatch workspace $target
|
||||||
|
elif test "$direction" = "up"
|
||||||
|
then
|
||||||
|
target=$(clamp 1 10 $(($current-1)))
|
||||||
|
echo "jumping to $target"
|
||||||
|
hyprctl dispatch workspace $target
|
||||||
|
fi
|
6
.config/eww/scripts/get-active-workspace.sh
Executable file
6
.config/eww/scripts/get-active-workspace.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
||||||
|
|
||||||
|
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||||
|
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
6
.config/eww/scripts/get-workspaces.sh
Executable file
6
.config/eww/scripts/get-workspaces.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
hyprctl workspaces -j | jq -c '[.[].id] | map(tostring)'
|
||||||
|
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||||
|
hyprctl workspaces -j | jq -c '[.[].id] | map(tostring)'
|
||||||
|
done
|
Loading…
Reference in a new issue