add audio key bindings
This commit is contained in:
parent
fd3d735ab9
commit
fd2f78294c
2 changed files with 41 additions and 0 deletions
40
src/XMonad/Custom/AudioKeyBindings.hs
Normal file
40
src/XMonad/Custom/AudioKeyBindings.hs
Normal file
|
@ -0,0 +1,40 @@
|
|||
module XMonad.Custom.AudioKeyBindings (myAudioKeyBindings) where
|
||||
|
||||
import XMonad
|
||||
import XMonad.Custom.BindingUtils
|
||||
|
||||
myAudioKeyBindings :: [(String, X ())]
|
||||
myAudioKeyBindings = concat $ [
|
||||
myMediaKeyBindings
|
||||
, myAudioUtilKeyBindings
|
||||
]
|
||||
|
||||
myMediaKeyBindings :: [(String, X ())]
|
||||
myMediaKeyBindings = [
|
||||
("<XF86AudioPlay>", playerctl "play-pause")
|
||||
, ("<XF86AudioPrev>", playerctl "previous")
|
||||
, ("<XF86AudioNext>", playerctl "next")
|
||||
, ("<XF86Tools>", amixer "toggle")
|
||||
, ("<XF86MonBrightnessUp>", increaseVolume 5)
|
||||
, ("<XF86MonBrightnessDown>", decreaseVolume 5)
|
||||
, ("<XF86KbdBrightnessUp>", increaseVolume 5)
|
||||
, ("<XF86KbdBrightnessDown>", decreaseVolume 5)
|
||||
]
|
||||
|
||||
myAudioUtilKeyBindings :: [(String, X ())]
|
||||
myAudioUtilKeyBindings = addMainModifierToBinding $ addSubMapKey "a" $ [
|
||||
("q", spawn "qpwgraph")
|
||||
, ("p", spawn "pavucontrol")
|
||||
]
|
||||
|
||||
playerctl :: String -> X ()
|
||||
playerctl a = spawn $ "playerctl " ++ a
|
||||
|
||||
amixer :: String -> X ()
|
||||
amixer a = spawn $ "amixer sset Master " ++ a
|
||||
|
||||
increaseVolume :: Int -> X ()
|
||||
increaseVolume p = amixer $ show p ++ "%+"
|
||||
|
||||
decreaseVolume :: Int -> X ()
|
||||
decreaseVolume p = amixer $ show p ++ "%-"
|
|
@ -12,6 +12,7 @@ library
|
|||
exposed-modules: XMonad.Custom.BindingUtils
|
||||
XMonad.Custom.BasicKeyBindings
|
||||
XMonad.Custom.SystemKeyBindings
|
||||
XMonad.Custom.AudioKeyBindings
|
||||
XMonad.Custom.ProgramWorkspaces
|
||||
XMonad.Custom.UniversitySetup
|
||||
XMonad.Custom.Layout
|
||||
|
|
Loading…
Reference in a new issue