summaryrefslogtreecommitdiffstats
path: root/pkgs/haskell/xmonad-tv/src/Shortcuts.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-12-04 01:55:06 +0000
committertv <tv@krebsco.de>2026-12-04 03:05:12 +0000
commit607fb1010baae845910e75ba31687bffb259636b (patch)
tree13feecaa2c3c2091c83ea80ebfa1cdbe4db8f361 /pkgs/haskell/xmonad-tv/src/Shortcuts.hs
parent3b8389042fde0a9dcb1eaa8d6401e8332915af88 (diff)
xmonad-tv: update from the dirt
Diffstat (limited to 'pkgs/haskell/xmonad-tv/src/Shortcuts.hs')
-rw-r--r--pkgs/haskell/xmonad-tv/src/Shortcuts.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkgs/haskell/xmonad-tv/src/Shortcuts.hs b/pkgs/haskell/xmonad-tv/src/Shortcuts.hs
new file mode 100644
index 00000000..3ac7070b
--- /dev/null
+++ b/pkgs/haskell/xmonad-tv/src/Shortcuts.hs
@@ -0,0 +1,26 @@
+module Shortcuts
+ ( Config
+ , new
+ )
+ where
+
+import Data.Map (Map)
+import System.Posix.Process (executeFile)
+import XMonad (Layout, KeyMask, KeySym, X, XConfig, xfork)
+import XMonad.Util.EZConfig (mkKeymap)
+import qualified Data.Map.Strict as Map
+
+
+type Config = Map String String
+
+
+new :: Config -> XConfig Layout -> Map (KeyMask, KeySym) (X ())
+new config xconfig =
+ mkKeymap xconfig $
+ map (\(key, path) -> (key, forkFile path [] Nothing)) $
+ Map.toList config
+
+
+forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X ()
+forkFile path args env =
+ xfork (executeFile path True args env) >> return ()