ENH rename formatCmd and add shell sequencer
This commit is contained in:
parent
83abef8540
commit
7a7365de3d
|
@ -267,11 +267,11 @@ myQuitPrompt = confirmPrompt T.promptTheme "quit?" $ io exitSuccess
|
||||||
|
|
||||||
-- shell commands
|
-- shell commands
|
||||||
|
|
||||||
formatCmd :: String -> [String] -> String
|
fmtCmd :: String -> [String] -> String
|
||||||
formatCmd cmd args = unwords $ cmd : args
|
fmtCmd cmd args = unwords $ cmd : args
|
||||||
|
|
||||||
spawnCmd :: String -> [String] -> X ()
|
spawnCmd :: String -> [String] -> X ()
|
||||||
spawnCmd cmd args = spawn $ formatCmd cmd args
|
spawnCmd cmd args = spawn $ fmtCmd cmd args
|
||||||
|
|
||||||
(#!&&) :: String -> String -> String
|
(#!&&) :: String -> String -> String
|
||||||
cmdA #!&& cmdB = cmdA ++ " && " ++ cmdB
|
cmdA #!&& cmdB = cmdA ++ " && " ++ cmdB
|
||||||
|
@ -283,13 +283,18 @@ cmdA #!|| cmdB = cmdA ++ " || " ++ cmdB
|
||||||
|
|
||||||
infixr 0 #!||
|
infixr 0 #!||
|
||||||
|
|
||||||
|
(#!>>) :: String -> String -> String
|
||||||
|
cmdA #!>> cmdB = cmdA ++ "; " ++ cmdB
|
||||||
|
|
||||||
|
infixr 0 #!>>
|
||||||
|
|
||||||
magicStringWS :: String
|
magicStringWS :: String
|
||||||
magicStringWS = "%%%%%"
|
magicStringWS = "%%%%%"
|
||||||
|
|
||||||
spawnCmdOwnWS :: String -> [String] -> String -> X ()
|
spawnCmdOwnWS :: String -> [String] -> String -> X ()
|
||||||
spawnCmdOwnWS cmd args ws = spawn
|
spawnCmdOwnWS cmd args ws = spawn
|
||||||
$ formatCmd cmd args
|
$ fmtCmd cmd args
|
||||||
#!&& formatCmd "xit-event" [magicStringWS, ws]
|
#!&& fmtCmd "xit-event" [magicStringWS, ws]
|
||||||
|
|
||||||
-- spawnKill :: [String] -> X ()
|
-- spawnKill :: [String] -> X ()
|
||||||
-- spawnKill = mapM_ (spawn . ("killall " ++))
|
-- spawnKill = mapM_ (spawn . ("killall " ++))
|
||||||
|
@ -407,10 +412,10 @@ runRecompile = do
|
||||||
confDir <- getXMonadDir
|
confDir <- getXMonadDir
|
||||||
spawn $ cmd confDir
|
spawn $ cmd confDir
|
||||||
where
|
where
|
||||||
cmd c = formatCmd "cd" [c]
|
cmd c = fmtCmd "cd" [c]
|
||||||
#!&& formatCmd "stack" ["install", ":xmonad"]
|
#!&& fmtCmd "stack" ["install", ":xmonad"]
|
||||||
#!&& formatCmd "notify-send" ["\"compilation succeeded\""]
|
#!&& fmtCmd "notify-send" ["\"compilation succeeded\""]
|
||||||
#!|| formatCmd "notify-send" ["\"compilation failed\""]
|
#!|| fmtCmd "notify-send" ["\"compilation failed\""]
|
||||||
|
|
||||||
myMultimediaCtl :: String
|
myMultimediaCtl :: String
|
||||||
myMultimediaCtl = "playerctl"
|
myMultimediaCtl = "playerctl"
|
||||||
|
@ -442,8 +447,8 @@ runToggleBluetooth = spawn
|
||||||
$ "bluetoothctl show | grep -q \"Powered: no\""
|
$ "bluetoothctl show | grep -q \"Powered: no\""
|
||||||
#!&& "a=on"
|
#!&& "a=on"
|
||||||
#!|| "a=off"
|
#!|| "a=off"
|
||||||
#!>> formatCmd "bluetoothctl" ["power", "$a", ">", "/dev/null"]
|
#!>> fmtCmd "bluetoothctl" ["power", "$a", ">", "/dev/null"]
|
||||||
#!&& formatCmd "notify-send" ["\"bluetooth powered $a\""]
|
#!&& fmtCmd "notify-send" ["\"bluetooth powered $a\""]
|
||||||
|
|
||||||
-- TODO write these in haskell
|
-- TODO write these in haskell
|
||||||
runIncBacklight :: X ()
|
runIncBacklight :: X ()
|
||||||
|
@ -474,7 +479,7 @@ showKeybindings x = addName "Show Keybindings" $ io $ do
|
||||||
hPutStr h (unlines $ showKm x)
|
hPutStr h (unlines $ showKm x)
|
||||||
hClose h
|
hClose h
|
||||||
return ()
|
return ()
|
||||||
where cmd = formatCmd myDmenuCmd $ myDmenuArgs ++
|
where cmd = fmtCmd myDmenuCmd $ myDmenuArgs ++
|
||||||
[ "-dmenu"
|
[ "-dmenu"
|
||||||
, "-p"
|
, "-p"
|
||||||
, "commands"
|
, "commands"
|
||||||
|
|
Loading…
Reference in New Issue