Add hyprstack config

This commit is contained in:
2024-07-06 12:59:14 +03:00
parent ead8c1df03
commit b820d657ee
32 changed files with 1417 additions and 0 deletions
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
direction=$1
current=$2
if [[ $direction == "down" ]]; then
target=$(($current+1))
if [[ $target == 11 ]]; then
exit 0
fi
hyprctl dispatch workspace $target
elif [[ $direction == "up" ]]; then
target=$(($current-1))
hyprctl dispatch workspace $target
else
target=$1
hyprctl dispatch workspace $target
fi
@@ -0,0 +1,6 @@
##!/usr/bin/env sh
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}'
@@ -0,0 +1,46 @@
#!/usr/bin/env sh
## NOTE: This file is unused currently
NUMBER_OF_WORKSPACES=6
window_class() {
echo `hyprctl activewindow -j | jq --raw-output .class`
}
window_title() {
echo `hyprctl activewindow -j | jq --raw-output .title`
}
workspaces (){
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
seq 1 $NUMBER_OF_WORKSPACES | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
}
if [[ $1 == 'workspaces' ]]; then
echo "{ \"workspaces\": $(workspaces), \"active\": 1, \"active_empty\": true }"
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
active=$(eww get workspaces | jq .active)
if [[ ${line:0:9} == 'workspace' ]]; then
active=${line:11:2}
fi
active_empty='true'
let "i = $active - 1"
if [[ $(workspaces | jq --raw-output .[$i].windows) -gt 0 ]]; then active_empty='false'; fi
eww update workspaces="{
\"workspaces\": $(workspaces),
\"active\": $active,
\"active_empty\": $active_empty
}"
eww update dock_reveal="$active_empty"
done
fi
if [[ $1 == 'window' ]]; then
window_class
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
window_class
done
fi
@@ -0,0 +1,13 @@
(deflisten active-workspace :initial "." "sh widgets/workspaces/get-active-workspace.sh")
(defwidget workspaces [?monitor-workspaces]
(box :class "workspaces"
:orientation "h"
:space-evenly true
:halign "start"
:spacing 10
(for workspace in monitor-workspaces
(button :class "workspace ${active-workspace == workspace ? "current" : ""}" :onclick "hyprctl dispatch workspace ${workspace}" "${workspace}")
)
)
)