aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2015-05-24 16:22:22 +0200
committerDuncaen <mail@duncano.de>2015-05-24 16:22:22 +0200
commitb61f03eac788cf9a58976cd3b5ff48c7ff3e97ac (patch)
tree9cf3d03f24effb5f8ddd844511085e1a863cf811
parenta63bebd97e846177a2818ff42e369b0c48f4f278 (diff)
downloaddotfiles-b61f03eac788cf9a58976cd3b5ff48c7ff3e97ac.tar.gz
bin/dmenu_playerctl: add smarter player selection by play status
-rwxr-xr-xbin/dmenu_playerctl13
-rw-r--r--mkshrc14
2 files changed, 22 insertions, 5 deletions
diff --git a/bin/dmenu_playerctl b/bin/dmenu_playerctl
index 64cbe41..8fa8794 100755
--- a/bin/dmenu_playerctl
+++ b/bin/dmenu_playerctl
@@ -1,7 +1,17 @@
#!/bin/mksh
select_player() {
- echo $1 | tr ' ' '\n' | ${DMENU}
+ playing=""
+ for p in $1; do
+ if [ $(playerctl -p "$p" status) == "Playing" ]; then
+ [ -z "$playing" ] && playing="$p" || playing="$playing\n$p"
+ fi
+ done
+ case $(echo "$playing" | wc -l) in
+ 0) exit ;;
+ 1) echo "$playing" ;;
+ *) echo $(echo "$playing" | ${DMENU}) ;;
+ esac
}
prompt() {
@@ -19,6 +29,7 @@ play_pause() {
}
player_menu() {
+ [ -z "$1" ] && exit
CMDS="$(play_pause $1)\nStop\nNext\nPrevious\nVolume"
ret=$(echo $CMDS | ${DMENU} -p "$(prompt $1)" -i | tr '[A-Z]' '[a-z]')
case "$ret" in
diff --git a/mkshrc b/mkshrc
index b8b63f0..119b873 100644
--- a/mkshrc
+++ b/mkshrc
@@ -480,9 +480,6 @@ export INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE=0
export INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS=true
export INFINALITY_FT_USE_VARIOUS_TWEAKS=true
-# Keychain
-[ -r /usr/bin/keychain ] && eval `keychain --eval --agents ssh id_rsa`
-
alias check-updates="sudo sh -c 'cd /var/cache/void-packages && chpst -u voidupdates:voidupdates void-updates -p 20 -r git://github.com/voidlinux/void-packages.git -s /var/cache/void-packages -o /srv/http/void-updates'"
alias bt='echo 0 | gdb -batch-silent -ex "run" -ex "set logging overwrite on" -ex "set logging file gdb.bt" -ex "set logging on" -ex "set pagination off" -ex "handle SIG33 pass nostop noprint" -ex "echo backtrace:\n" -ex "backtrace full" -ex "echo \n\nregisters:\n" -ex "info registers" -ex "echo \n\ncurrent instructions:\n" -ex "x/16i \$pc" -ex "echo \n\nthreads backtrace:\n" -ex "thread apply all backtrace" -ex "set logging off" -ex "quit" --args'
# alias keychain=eval_keychain
@@ -498,10 +495,19 @@ unset p
# fix del key
printf '\033[?1h\033=' >/dev/tty
-
#
PS1='$(slcp $COLUMNS $?)'
+# z
+if [ -r /home/duncan/repos/github.com/Duncaen/dotfiles/z/z.sh ]; then
+ . /home/duncan/repos/github.com/Duncaen/dotfiles/z/z.sh
+
+ function _z_add {
+ _z --add "$PWD"
+ }
+ PS1+='$(_z_add)'
+fi
+
# If this is an xterm set the title to user@host:dir
case "$TERM" in
dvtm*|xterm*|rxvt*)