xmonad + xmobar - using mpd/ncmpcpp

This commit is contained in:
Felix Van der Jeugt 2015-04-12 21:19:15 +02:00
parent f4d4b5b0cd
commit 67d5f6b40d
4 changed files with 15 additions and 16 deletions

10
config/xmobar/scripts/music Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
if mpc -q; then
case "$(mpc status | sed -n '2s/\[\(\w*\)\].*/\1/p')" in
"playing") icon="<icon=music/play.xpm/>" ;;
"paused") icon="<icon=music/pause.xpm/>" ;;
esac
echo '<action=`urxvtc -e "ncmpcpp"`>'"$icon"'</action>'
fi

View File

@ -1,11 +0,0 @@
#!/bin/bash
status=$(quodlibet --status | cut -d' ' -f1)
case "$status" in
"playing") icon="<icon=music/play.xpm/>" ;;
"paused") icon="<icon=music/pause.xpm/>" ;;
*) ;;
esac
echo '<action=`quodlibet --toggle-window`>'"$icon"'</action>'

View File

@ -50,9 +50,9 @@ Config { font = "xft:Source Code Pro:size=9"
, "--load-icon-patterns", "<icon=cpu/%%.xpm/>" , "--load-icon-patterns", "<icon=cpu/%%.xpm/>"
, "--load-icon-patterns", "<icon=cpu4/%%.xpm/>" , "--load-icon-patterns", "<icon=cpu4/%%.xpm/>"
] 50 ] 50
, Run Com ".config/xmobar/scripts/quodlibet" [] "quodlibet" 10 , Run Com ".config/xmobar/scripts/music" [] "music" 10
, Run Com ".config/xmobar/scripts/sound" [] "sound" 10 , Run Com ".config/xmobar/scripts/sound" [] "sound" 10
, Run StdinReader , Run StdinReader
] ]
, template = " %StdinReader%} %date% {%multicpu%%quodlibet%%sound%%wlp7s0wi%%enp9s0%%bright%%battery% " , template = " %StdinReader%} %date% {%multicpu%%music%%sound%%wlp7s0wi%%enp9s0%%bright%%battery% "
} }

View File

@ -184,9 +184,9 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
, ((0, xF86XK_AudioMute), spawn "sound_control.sh toggle") , ((0, xF86XK_AudioMute), spawn "sound_control.sh toggle")
, ((0, xF86XK_AudioRaiseVolume), spawn "sound_control.sh up") , ((0, xF86XK_AudioRaiseVolume), spawn "sound_control.sh up")
, ((0, xF86XK_AudioLowerVolume), spawn "sound_control.sh down") , ((0, xF86XK_AudioLowerVolume), spawn "sound_control.sh down")
, ((0, xF86XK_AudioNext), spawn "quodlibet --next") , ((0, xF86XK_AudioNext), spawn "mpc -q next")
, ((0, xF86XK_AudioPlay), spawn "quodlibet --play-pause") , ((0, xF86XK_AudioPlay), spawn "mpc -q toggle")
, ((0, xF86XK_AudioPrev), spawn "quodlibet --previous") , ((0, xF86XK_AudioPrev), spawn "mpc -q prev")
, ((0, xF86XK_MonBrightnessUp), spawn "xbacklight -inc 10") , ((0, xF86XK_MonBrightnessUp), spawn "xbacklight -inc 10")
, ((0, xF86XK_MonBrightnessDown), spawn "xbacklight -dec 10") , ((0, xF86XK_MonBrightnessDown), spawn "xbacklight -dec 10")