AutoYADM commit: 2025-07-22 18:32:45
This commit is contained in:
parent
91b8a0717d
commit
83d941fc4d
2 changed files with 58 additions and 30 deletions
|
@ -1,33 +1,60 @@
|
|||
declare-option -hidden str discord_fifo
|
||||
# my BASED implementation
|
||||
|
||||
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 &
|
||||
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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
# }
|
||||
# }
|
||||
|
|
|
@ -90,6 +90,7 @@ alias global t cwd-terminal
|
|||
# discord rich presence
|
||||
try %{
|
||||
source %exp{%val{config}/discord.kak}
|
||||
require-module discord-rtp
|
||||
# hook global -once ClientCreate .* %{
|
||||
# discord-presence-enable
|
||||
# }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue