updates to Makefile, vim-swap-handler, disp, and nws

This commit is contained in:
randomuser 2022-06-13 16:39:17 -05:00
parent 3751a7d125
commit d8febccf82
4 changed files with 94 additions and 65 deletions

View File

@ -19,6 +19,7 @@ sh:
cp -f sh/proxtest $(DESTDIR)$(PREFIX)/bin cp -f sh/proxtest $(DESTDIR)$(PREFIX)/bin
cp -f sh/pco $(DESTDIR)$(PREFIX)/bin cp -f sh/pco $(DESTDIR)$(PREFIX)/bin
cp -f sh/git-survey $(DESTDIR)$(PREFIX)/bin cp -f sh/git-survey $(DESTDIR)$(PREFIX)/bin
cp -f sh/vim-swap-handler $(DESTDIR)$(PREFIX)/bin
mkc: mkc:
cc c/scream.c -o c/scream cc c/scream.c -o c/scream

28
sh/vim-swap-handler Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
# when the vim SwapExists autocommand is fired, this script is
# called with the path of the file in question.
# mad props to daniel conway for having this big brain idea
# note to self: protect $1 from expansion as it can contain a
# ~
[ "$#" -eq 0 ] && exit 2
window=$(
xdotool search --name "$1" | \
sed 1q
)
desk=$(
xdotool get_desktop_for_window "$window" 2>/dev/null || printf "none"
)
[ "$desk" = "none" ] && exit 1
desk=$(($desk + 1))
bspc desktop -f "^${desk}"
killall -10 simplestatus
xdotool set_window --urgency 1 "$window"
exit 0