This commit is contained in:
2026-03-29 14:01:52 +03:00
commit 0611279128
210 changed files with 60454 additions and 0 deletions

10
contrib/README Normal file
View File

@@ -0,0 +1,10 @@
_cmus (originally _cmus_remote)
zsh completion for cmus-remote by Christian Schneider strcat AT gmx DOT net
extended for the main cmus binary by Frank Terbeck.
cmus-updategaim.py
Joshua Kwan <joshk@triplehelix.org>
cmus-updatepidgin.py
Based on Joshua's cmus-updategaim.py script.
David Thiel <lx@redundancy.redundancy.org>

52
contrib/_cmus Normal file
View File

@@ -0,0 +1,52 @@
#compdef cmus cmus-remote
local expl cmus_commands
cmus_commands=(
add bind browser-up cd clear colorscheme echo factivate
filter fset invert load mark player-next player-pause
player-play quit refresh run save search-next search-prev
seek set showbind shuffle source toggle unbind unmark view
vol win-activate win-add-l win-add-p win-add-Q win-add-q
win-bottom win-down win-mv-after win-mv-before win-next
win-page-down win-page-up win-remove win-sel-cur
win-toggle win-top win-up win-update
)
_cmus_volume() {
local expl
compset -P '[-+]'
_wanted list expl volume compadd $expl - {0..100}
}
case $service in
(cmus-remote)
_arguments -C -s\
'--server[connect using socket SOCKET]:socket:_files' \
'--help[display this help and exit]:' \
'--version[Display version information and exit.]:' \
'(--play -p)'{--play,-p}'[Start playing.]:' \
'(--pause -u)'{--pause,-u}'[Toggle pause.]:' \
'(--stop -s)'{--stop,-s}'[Stop playing.]:' \
'(--next -n)'{--next,-n}'[Skip forward in playlist.]:' \
'(--prev -r)'{--prev,-r}'[Skip backward in playlist.]:' \
'(--file -f)'{--file,-f}'[Play a file.]:file:_files' \
'(--repeat -R)'{--repeat,-R}'[Toggle repeat.]:' \
'(--shuffle -S)'{--shuffle,-S}'[Toggle shuffle.]:' \
'(--volume -v)'{--volume,-V+}'[Change volume. See vol command in cmus(1).]:volume:_cmus_volume' \
'(--seek -k)'{--seek,-k+}'[Seek. See seek command in cmus(1).]:seek [+-]<num>[m/h]' \
'(--query -Q)'{--query,-Q}'[Get player status (same as -C status).]:' \
'(--library -l)'{--library,-l+}'[Modify library instead of playlist.]:playlists/files/directories/URLs:_files' \
'(--playlist -P)'{--playlist,-P}'[Modify playlist (default).]::Playlist:_files' \
'(--queue -q)'{--queue,-q}'[Modify play queue instead of playlist.]:' \
'(--clear -c)'{--clear,-c}'[Clear playlist, library (-l) or play queue (-q).]:playlist' \
'(--raw -C)'{--raw,-C+}'[Treat arguments (instead of stdin) as raw commands.]:command:(${cmus_commands[@]}):' \
;;
(cmus)
_arguments \
'--listen[listen on ADDR instead of $CMUS_SOCKET or $XDG_RUNTIME_DIR/cmus-socket]:socket:_files' \
'--plugins[list available plugins and exit]' \
'--help[display this help and exit]' \
'--version[display version information]'
;;
esac

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dbus
import sys
args = {}
for n in range(1, len(sys.argv) - 1, 2):
args[sys.argv[n]] = sys.argv[n + 1]
obj = dbus.SessionBus().get_object("net.sf.gaim.GaimService", "/net/sf/gaim/GaimObject")
gaim = dbus.Interface(obj, "net.sf.gaim.GaimInterface")
current = gaim.GaimSavedstatusGetCurrent()
status_type = gaim.GaimSavedstatusGetType(current)
saved = gaim.GaimSavedstatusNew("", status_type)
gaim.GaimSavedstatusSetMessage(saved, "%s - %s" % (args["artist"], args["title"]))
gaim.GaimSavedstatusActivate(saved)

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dbus
import sys
args = {}
for n in range(1, len(sys.argv) - 1, 2):
args[sys.argv[n]] = sys.argv[n + 1]
obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
pidgin = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
current = pidgin.PurpleSavedstatusGetCurrent()
status_type = pidgin.PurpleSavedstatusGetType(current)
saved = pidgin.PurpleSavedstatusNew("", status_type)
pidgin.PurpleSavedstatusSetMessage(saved, "%s - %s" % (args["artist"], args["title"]))
pidgin.PurpleSavedstatusActivate(saved)

View File

@@ -0,0 +1,75 @@
# bash completion for cmus-remote and cmus
_cmus-remote()
{
local cur prev longopts shortopts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# maybe we'll differentiate between $cur starting with - or --
longopts="--server --passwd --help --version --play --pause --stop
--next --prev --file --repeat --shuffle --volume --seek
--library --playlist --queue --clear --raw"
shortopts="-p -u -s -n -r -f -R -S -v -k -Q -l -P -q -c -C"
COMPREPLY=()
case "${prev}" in
--server) # can be a hostname[:port] or a filename
compopt -o nospace
_known_hosts_real -c "${cur}"
;&
--file|-f)
_filedir
return 0
;;
--passwd) # do not attempt to complete anything
;&
--volume|-v)
;&
--seek|-k)
;&
--raw|-C)
# supporting completion for raw commands would be nice (TODO)
return 0
;;
*)
;;
esac
if [[ ${cur} == -* ]]; then
COMPREPLY=(
$(compgen -W "${shortopts[*]} ${longopts[*]}" -- ${cur})
)
else
_filedir
fi
}
_cmus()
{
local cur prev opts
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--listen --plugins --show-cursor --help --version"
COMPREPLY=()
case "${prev}" in
--listen)
compopt -o nospace
_ip_addresses
_filedir
return 0;
;;
--plugins|--help|--version)
return 0;
;;
*)
;;
esac
COMPREPLY=($(compgen -W "${opts[*]}" -- ${cur}))
}
complete -F _cmus-remote cmus-remote
complete -F _cmus cmus