From a7c09f875e9e82841e705dc8eaccc843e4440f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 16 Jul 2022 14:22:04 +0200 Subject: [PATCH] add system key bindings --- src/XMonad/Custom/SystemKeyBindings.hs | 24 ++++++++++++++++++++++++ xmonad-custom.cabal | 1 + 2 files changed, 25 insertions(+) create mode 100644 src/XMonad/Custom/SystemKeyBindings.hs diff --git a/src/XMonad/Custom/SystemKeyBindings.hs b/src/XMonad/Custom/SystemKeyBindings.hs new file mode 100644 index 0000000..e891b13 --- /dev/null +++ b/src/XMonad/Custom/SystemKeyBindings.hs @@ -0,0 +1,24 @@ +module XMonad.Custom.SystemKeyBindings (mySystemKeyBindings) where + +import XMonad + +import XMonad.Custom.BindingUtils + +mySystemKeyBindings :: [([Char], X ())] +mySystemKeyBindings = addSubMapKey mySystemKey $ [ + ("p", spawn "poweroff"), + ("r", systemctl "reboot"), + ("l", i3lock), + ("s", i3lock <+> systemctl "suspend"), + ("h", i3lock <+> systemctl "hibernate"), + ("t", i3lock <+> systemctl "hybrid-sleep") + ] + where + mySystemKey = "" + + +i3lock :: X() +i3lock = spawn "i3lock-fancy --pixelate -- maim" + +systemctl :: String -> X() +systemctl cmd = spawn $ "systemctl " ++ cmd diff --git a/xmonad-custom.cabal b/xmonad-custom.cabal index 6f918fe..f6580f9 100644 --- a/xmonad-custom.cabal +++ b/xmonad-custom.cabal @@ -11,6 +11,7 @@ flag pedantic library exposed-modules: XMonad.Custom.BindingUtils XMonad.Custom.BasicKeyBindings + XMonad.Custom.SystemKeyBindings XMonad.Custom.UniversitySetup hs-source-dirs: src ghc-options: -funbox-strict-fields -Wall -Wno-unused-do-bind