mirror of
https://github.com/GRFreire/dotfiles.git
synced 2026-01-09 20:19:37 +00:00
qtile: add media control shortcuts
This commit is contained in:
parent
97c2a1e1ad
commit
2e0b8e1197
@ -27,6 +27,7 @@ WEB_QUICK_OPEN = os.path.expanduser(
|
||||
"~/.local/bin/firefox-quick-keywords"
|
||||
) # https://github.com/GRFreire/firefox-quick-keywords
|
||||
|
||||
MEDIA_CONTROL = os.path.expanduser("~/.config/qtile/media_control.sh")
|
||||
keys = [
|
||||
# Launch programs
|
||||
Key([MOD], "Return", lazy.spawn(TERMINAL), desc="Launch terminal"),
|
||||
@ -71,6 +72,14 @@ keys = [
|
||||
Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
||||
# System
|
||||
Key([MOD], "BackSpace", lazy.spawn(POWER_MENU), desc="Open power menu"),
|
||||
# Media
|
||||
Key([], "XF86AudioPlay", lazy.spawn(f"{MEDIA_CONTROL} play"), desc="Media control - play"),
|
||||
Key([], "XF86AudioStop", lazy.spawn(f"{MEDIA_CONTROL} stop"), desc="Media control - stop"),
|
||||
Key([], "XF86AudioNext", lazy.spawn(f"{MEDIA_CONTROL} next"), desc="Media control - next"),
|
||||
Key([], "XF86AudioPrev", lazy.spawn(f"{MEDIA_CONTROL} prev"), desc="Media control - prev"),
|
||||
Key([], "XF86AudioRaiseVolume", lazy.spawn(f"{MEDIA_CONTROL} vol_up"), desc="Media control - volume up"),
|
||||
Key([], "XF86AudioLowerVolume", lazy.spawn(f"{MEDIA_CONTROL} vol_down"), desc="Media control - volume down"),
|
||||
Key([], "XF86AudioMute", lazy.spawn(f"{MEDIA_CONTROL} vol_mute"), desc="Media control - mute volume"),
|
||||
]
|
||||
|
||||
group_names = [
|
||||
|
||||
45
.config/qtile/media_control.sh
Executable file
45
.config/qtile/media_control.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
control_play() {
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
|
||||
mpc toggle
|
||||
}
|
||||
|
||||
control_stop() {
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop
|
||||
mpc stop
|
||||
}
|
||||
|
||||
control_next() {
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
|
||||
mpc next
|
||||
}
|
||||
|
||||
control_prev() {
|
||||
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous
|
||||
mpc prev
|
||||
}
|
||||
|
||||
case $1 in
|
||||
# Control
|
||||
play )
|
||||
control_play ;;
|
||||
stop )
|
||||
control_stop ;;
|
||||
next )
|
||||
control_next ;;
|
||||
prev )
|
||||
control_prev ;;
|
||||
|
||||
# Volume
|
||||
vol_up )
|
||||
amixer -q sset Master 5%+;;
|
||||
vol_down )
|
||||
amixer -q sset Master 5%-;;
|
||||
vol_mute )
|
||||
amixer -q -D pulse sset Master toggle;;
|
||||
* )
|
||||
echo "Command not valid" ; exit 1;;
|
||||
esac
|
||||
|
||||
exit 0;
|
||||
Loading…
Reference in New Issue
Block a user