Switch to the amazing chunkwm and skhd, eliminating the need for a separate mpd-mediakeys service
This commit is contained in:
parent
79e7fccab4
commit
cc4d9c2b2e
6 changed files with 380 additions and 36 deletions
25
local/bin/qtb
Executable file
25
local/bin/qtb
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/zsh
|
||||
|
||||
# The arguments should be a command to run in qutebrowser. If no arguments are
|
||||
# provided, then :open -w is run by default.
|
||||
cmd=($@)
|
||||
(( $# < 1 )) && cmd=(:open -w)
|
||||
|
||||
# There should only be one qutebrowser socket, but just in case we only take
|
||||
# the first result we find.
|
||||
sockets=( ${TMPDIR}qutebrowser/ipc*(N) )
|
||||
SOCKET=$sockets[1]
|
||||
|
||||
if [[ -w $SOCKET ]]; then
|
||||
# We have a legit socket. Let's send the commands to qutebrowser. Yay!
|
||||
jo target_arg=null protocol_version=1 cwd=$PWD "args[]=$cmd" | socat - UNIX-CONNECT:$SOCKET
|
||||
else
|
||||
# No socket. Let's start qutebrowser!
|
||||
open -a qutebrowser.app
|
||||
# If we were given commands to run, we still wanna run them once qutebrowser
|
||||
# starts, so wait a little while and then re-exec this script.
|
||||
if (( $# )); then
|
||||
sleep 5
|
||||
exec qtb "$@"
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue