16 lines
496 B
Bash
Executable File
16 lines
496 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -n "$SWAYSOCK" ] ; then
|
|
# When using the sway compositor
|
|
swaymsg -t get_workspaces -r | jq -r '.[]|select(.focused==true).name'
|
|
elif [ -n "$I3SOCK" ] ; then
|
|
# When using i3
|
|
i3-msg -t get_workspaces | jq -r '.[]|select(.focused==true).name'
|
|
elif [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -v xdtool >&- ; then
|
|
# if we are running under a generic Xorg session that isn't Xwayland
|
|
xdotool get_desktop 2>/dev/null
|
|
else
|
|
# Fall back to a 0 if unknown
|
|
echo 0
|
|
fi
|