Add WM export, make workspaces block bspwm compatible

This commit is contained in:
Riyyi
2019-05-24 18:32:14 +02:00
parent b78c0e3ed2
commit 565faa1b81
4 changed files with 21 additions and 11 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ start() {
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
# Create named pipe
[ -e "$PIPE" ] && rm "$PIPE"
[ -p $PIPE ] && rm "$PIPE"
mkfifo "$PIPE"
# Directory of this script
+15 -8
View File
@@ -1,18 +1,25 @@
#!/bin/sh
# Suppress output
NULL="> /dev/null 2>&1"
NULL=""
# Scroll up, scroll down
U="A4:i3-msg workspace prev_on_output $NULL:"
D="A5:i3-msg workspace next_on_output $NULL:"
if [ "$WM" = "bspwm" ];then
SWITCH="bspc desktop -f"
# i3
# WMNAME="$(xprop -root '\t$0' _NET_WM_NAME | cut -f 2 | tr -d '"')"
U="A4:$SWITCH prev.local:"
D="A5:$SWITCH next.local:"
elif [ "$WM" = "i3" ];then
SWITCH="i3-msg workspace"
NULL="> /dev/null 2>&1"
U="A4:$SWITCH prev_on_output $NULL:"
D="A5:$SWITCH next_on_output $NULL:"
fi
CURRENT=$(xprop -root _NET_CURRENT_DESKTOP | awk '{print $3 + 1}')
WORKSPACES="$(xprop -root '\n$0\n$1\n$2\n$3\n$4\n$5\n$6\n$7\n$8\n$9' _NET_DESKTOP_NAMES \
| awk -v c="$CURRENT" -v n="$NULL" \
| awk -v c="$CURRENT" -v s="$SWITCH" -v n="$NULL" \
-v c7="$COLOR7" -v c15="$COLOR15" -v b="$BGCOLOR" -v bi="$BGCOLOR_INACTIVE" '
/".*"/ {
name = substr($0, 2, length($0) - 2);
@@ -21,8 +28,8 @@ WORKSPACES="$(xprop -root '\n$0\n$1\n$2\n$3\n$4\n$5\n$6\n$7\n$8\n$9' _NET_DESKTO
printf "%{B%s} %s %{B%s}",
b, name, bi
else
printf "%{F%s}%{A:i3-msg workspace %s %s:} %s %{A}%{F%s}",
c7, name, n, name, c15
printf "%{F%s}%{A:%s \"%s\" %s:} %s %{A}%{F%s}",
c7, s, name, n, name, c15
}
')"