From dca451c996c317ef65c3a49a257e4c89bd4f8a0d Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Thu, 1 Jun 2023 15:20:52 -0400 Subject: [PATCH] Workspace switching sound should now work correctly in Sway. --- scripts/announce_workspace.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/announce_workspace.sh b/scripts/announce_workspace.sh index b956839..71b0b91 100755 --- a/scripts/announce_workspace.sh +++ b/scripts/announce_workspace.sh @@ -1,8 +1,17 @@ #!/usr/bin/env bash -workSpace="$(i3-msg -t get_workspaces \ - | jq '.[] | select(.focused==true).name' \ - | cut -d"\"" -f2)" +path="$(readlink -f $0)" +path="${path%/*/*}" +path="${path##*/}" +if [[ "$path" == "i3" ]]; then + workSpace="$(i3-msg -t get_workspaces \ + | jq '.[] | select(.focused==true).name' \ + | cut -d"\"" -f2)" +else + workSpace="$(swaymsg -t get_workspaces \ + | jq '.[] | select(.focused==true).name' \ + | cut -d"\"" -f2)" +fi left=9 right=0 msg="Workspace ${workSpace}"