AutoYADM commit: 2025-07-22 17:45:49
This commit is contained in:
parent
9895a4de5e
commit
91b8a0717d
2 changed files with 42 additions and 0 deletions
33
.config/kak/discord.kak
Normal file
33
.config/kak/discord.kak
Normal file
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
}
|
||||
}
|
|
@ -87,3 +87,12 @@ define-command -docstring "New terminal in cwd" cwd-terminal %{
|
|||
alias global t cwd-terminal
|
||||
|
||||
|
||||
# discord rich presence
|
||||
try %{
|
||||
source %exp{%val{config}/discord.kak}
|
||||
# hook global -once ClientCreate .* %{
|
||||
# discord-presence-enable
|
||||
# }
|
||||
} catch %{
|
||||
echo -debug Couldn't start discord RTP: %val{error}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue