dotfiles/.config/kak/discord.kak

60 lines
1.9 KiB
Text

# my BASED implementation
provide-module discord-rpc %~
declare-option bool discord_rpc_autostart true
define-command -hidden start-discord-rpc %{
nop %sh{
lock="/tmp/kak-discord"
if [ ! -f "$lock" ]; then
{
discord-rpc-cli -c '1397337509393989713' -d 'I just be editing text i just be writing text and editing it' -N kak -I 'i just be editing text!!!'
} >/dev/null 2>&1 </dev/null &
pid="$!"
echo "$pid">"$lock"
fi
}
}
define-command -hidden stop-discord-rpc %{
nop %sh{
lock="/tmp/kak-discord"
if [ -f "$lock" ]; then
kill "$(cat "$lock")"
rm "$lock"
fi
}
}
~
# declare-option -hidden str discord_fifo
# define-command -hidden discord-fifo-send -params 1 %{ nop %sh{
# { echo "$1" > "$kak_opt_discord_fifo"; } >/dev/null 2>&1 </dev/null &
# } }
# define-command discord-presence-enable \
# -docstring "Enable Discord rich presence for this kakoune session" %{
# evaluate-commands %sh{
# if [ -z "$kak_opt_discord_fifo" ] && [ "$(pidof vesktop)" ]; then
# fifo=${TMPDIR:-/tmp}/kakoune-discord
# if [ ! -p "$fifo" ]; then
# mkfifo "$fifo"
# kakoune-discord "$fifo" >/dev/null 2>&1 </dev/null &
# fi
# cat<<EOF
# set-option global discord_fifo $fifo
# discord-fifo-send '+'
# hook global -group discord FocusIn .* %{ discord-fifo-send %reg{%} }
# hook global -group discord WinDisplay .* %{ discord-fifo-send %reg{%} }
# hook global -group discord KakEnd .* %{ discord-fifo-send '-' }
# define-command discord-presence-disable \
# -docstring "Disable Discord rich presence for this kakoune session" %{
# discord-fifo-send '-'
# unset-option global discord_fifo
# remove-hooks global discord
# }
# EOF
# fi
# }
# }