aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rwxr-xr-x.config/eww/scripts/workspace.sh32
1 files changed, 15 insertions, 17 deletions
diff --git a/.config/eww/scripts/workspace.sh b/.config/eww/scripts/workspace.sh
index a2d314f..a72bc81 100755
--- a/.config/eww/scripts/workspace.sh
+++ b/.config/eww/scripts/workspace.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-#define icons for workspaces 1-9
+# Define icons for workspaces 1-9
ic=(0         󰻧)
workspaces() {
@@ -9,10 +9,8 @@ workspaces() {
o1 o2 o3 o4 o5 o6 o7 o8 o9 \
f1 f2 f3 f4 f5 f6 f7 f8 f9
-# Get occupied workspaces and remove workspace -99 aka scratchpad if it exists
-# a="$(hyprctl workspaces | grep ID | awk '{print $3}')"
-# a="$(echo "${a//-99/}" | sed '/^[[:space:]]*$/d')"
-ows="$(hyprctl workspaces -j | jq '.[] | del(select(.id == -99)) | .id')"
+# Get occupied workspaces
+ows="$(swaymsg -t get_workspaces -r | jq -r -c '.[] | .name')"
for num in $ows; do
export o"$num"="$num"
@@ -20,25 +18,25 @@ done
# Get Focused workspace for current monitor ID
arg="$1"
-num="$(hyprctl monitors -j | jq --argjson arg "$arg" '.[] | select(.id == $arg).activeWorkspace.id')"
+num="$(swaymsg -t get_outputs --raw | jq --argjson arg "$arg" -r -c '.[$arg].current_workspace')"
export f"$num"="$num"
-echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" \
+echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs swaymsg workspace \" \
(box :class \"workspace\" :orientation \"h\" :space-evenly \"false\" \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 1\" :class \"w0$o1$f1\" \"${ic[1]} ₁\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 2\" :class \"w0$o2$f2\" \"${ic[2]} ₂\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 3\" :class \"w0$o3$f3\" \"${ic[3]} ₃\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 4\" :class \"w0$o4$f4\" \"${ic[4]} ₄\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 5\" :class \"w0$o5$f5\" \"${ic[5]} ₅\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 6\" :class \"w0$o6$f6\" \"${ic[6]} ₆\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 7\" :class \"w0$o7$f7\" \"${ic[7]} ₇\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 8\" :class \"w0$o8$f8\" \"${ic[8]} ₈\") \
- (button :onclick \"hyprctl dispatch focusworkspaceoncurrentmonitor 9\" :class \"w0$o9$f9\" \"${ic[9]} ₉\") \
+ (button :onclick \"scripts/dispatch.sh 1\" :class \"w0$o1$f1\" \"${ic[1]} ₁\") \
+ (button :onclick \"scripts/dispatch.sh 2\" :class \"w0$o2$f2\" \"${ic[2]} ₂\") \
+ (button :onclick \"scripts/dispatch.sh 3\" :class \"w0$o3$f3\" \"${ic[3]} ₃\") \
+ (button :onclick \"scripts/dispatch.sh 4\" :class \"w0$o4$f4\" \"${ic[4]} ₄\") \
+ (button :onclick \"scripts/dispatch.sh 5\" :class \"w0$o5$f5\" \"${ic[5]} ₅\") \
+ (button :onclick \"scripts/dispatch.sh 6\" :class \"w0$o6$f6\" \"${ic[6]} ₆\") \
+ (button :onclick \"scripts/dispatch.sh 7\" :class \"w0$o7$f7\" \"${ic[7]} ₇\") \
+ (button :onclick \"scripts/dispatch.sh 8\" :class \"w0$o8$f8\" \"${ic[8]} ₈\") \
+ (button :onclick \"scripts/dispatch.sh 9\" :class \"w0$o9$f9\" \"${ic[9]} ₉\") \
)\
)"
}
workspaces $1
-socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r; do
+swaymsg -t subscribe -m "['workspace']" | while read -r _ ; do
workspaces $1
done