diff --git a/src/XMonad/Custom/AudioKeyBindings.hs b/src/XMonad/Custom/AudioKeyBindings.hs new file mode 100644 index 0000000..c10bc96 --- /dev/null +++ b/src/XMonad/Custom/AudioKeyBindings.hs @@ -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 = [ + ("", playerctl "play-pause") + , ("", playerctl "previous") + , ("", playerctl "next") + , ("", amixer "toggle") + , ("", increaseVolume 5) + , ("", decreaseVolume 5) + , ("", increaseVolume 5) + , ("", 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 ++ "%-" diff --git a/xmonad-custom.cabal b/xmonad-custom.cabal index a2a39b4..0ed91c6 100644 --- a/xmonad-custom.cabal +++ b/xmonad-custom.cabal @@ -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