41 lines
1.3 KiB
Bash
Executable file
41 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
#define icons for workspaces 1-9
|
|
#icontheme=$(geticons -U)
|
|
icontheme=$(grep "gtk-icon-theme-name" "$HOME"/.config/gtk-3.0/settings.ini | cut --delimiter="=" -f 2)
|
|
|
|
workspaces() {
|
|
# if [[ ${1:0:12} == "activewindowv2" ]]; then
|
|
# fi
|
|
|
|
if [[ ${1:0:12} == "activewindow" ]]; then #set focused workspace
|
|
line=$(hyprctl activewindow | rg Window | cut -f 4- -d ' ' | sed 's/://')
|
|
class=$(hyprctl activewindow | rg "class:" | awk '{print $2}')
|
|
export iconpath=$(geticons "$class" -s 32 -c 1 -t "$icontheme" | head -n 1)
|
|
export title=$line
|
|
fi
|
|
}
|
|
|
|
module() {
|
|
#output eww widget
|
|
echo "(box \
|
|
:orientation \"h\" \
|
|
:halign \"start\" \
|
|
:valign \"center\" \
|
|
:space-evenly false \
|
|
(image \
|
|
:class \"app-icon\" \
|
|
:path \"$iconpath\" \
|
|
:image-width \"18\") \
|
|
(label \
|
|
:class \"app-name\" \
|
|
:limit-width \"45\" \
|
|
:text \"$title\" \
|
|
:tooltip \"$title\"))"
|
|
}
|
|
|
|
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
|
|
workspaces "$event"
|
|
module
|
|
done
|