ENH add a tmux command
This commit is contained in:
parent
54f0903214
commit
359312ff50
|
@ -1,6 +1,5 @@
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- | XMonad binary
|
-- | XMonad binary
|
||||||
|
@ -446,7 +445,8 @@ mkKeys ts c =
|
||||||
, ("M-b", "launch bitwarden selector", runBwMenu)
|
, ("M-b", "launch bitwarden selector", runBwMenu)
|
||||||
, ("M-C-e", "launch editor", runEditor)
|
, ("M-C-e", "launch editor", runEditor)
|
||||||
, ("M-C-w", "launch browser", runBrowser)
|
, ("M-C-w", "launch browser", runBrowser)
|
||||||
, ("M-C-t", "launch terminal", runTerm)
|
, ("M-C-t", "launch terminal with tmux", runTMux)
|
||||||
|
, ("M-C-S-t", "launch terminal", runTerm)
|
||||||
, ("M-C-q", "launch calc", runCalc)
|
, ("M-C-q", "launch calc", runCalc)
|
||||||
, ("M-C-f", "launch file manager", runFileManager)
|
, ("M-C-f", "launch file manager", runFileManager)
|
||||||
] ++
|
] ++
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
module XMonad.Internal.Command.Desktop
|
module XMonad.Internal.Command.Desktop
|
||||||
( myTerm
|
( myTerm
|
||||||
, runTerm
|
, runTerm
|
||||||
|
, runTMux
|
||||||
, runCalc
|
, runCalc
|
||||||
, runBrowser
|
, runBrowser
|
||||||
, runEditor
|
, runEditor
|
||||||
|
@ -59,6 +60,15 @@ myTerm = "urxvt"
|
||||||
runTerm :: X ()
|
runTerm :: X ()
|
||||||
runTerm = spawn myTerm
|
runTerm = spawn myTerm
|
||||||
|
|
||||||
|
runTMux :: X ()
|
||||||
|
runTMux = spawn
|
||||||
|
$ "tmux has-session"
|
||||||
|
#!&& fmtCmd myTerm ["-e", "bash", "-c", singleQuote c]
|
||||||
|
#!|| fmtNotifyCmd defNoteError { body = Just $ Text msg }
|
||||||
|
where
|
||||||
|
c = "exec tmux attach-session -d"
|
||||||
|
msg = "could not connect to tmux session"
|
||||||
|
|
||||||
runCalc :: X ()
|
runCalc :: X ()
|
||||||
runCalc = spawnCmd myTerm ["-e", "R"]
|
runCalc = spawnCmd myTerm ["-e", "R"]
|
||||||
|
|
||||||
|
@ -67,7 +77,7 @@ runBrowser = spawn "brave-accel"
|
||||||
|
|
||||||
runEditor :: X ()
|
runEditor :: X ()
|
||||||
runEditor = spawnCmd "emacsclient"
|
runEditor = spawnCmd "emacsclient"
|
||||||
["-c", "-e", "\"(select-frame-set-input-focus (selected-frame))\""]
|
["-c", "-e", doubleQuote "(select-frame-set-input-focus (selected-frame))"]
|
||||||
|
|
||||||
runFileManager :: X ()
|
runFileManager :: X ()
|
||||||
runFileManager = spawn "pcmanfm"
|
runFileManager = spawn "pcmanfm"
|
||||||
|
|
|
@ -49,8 +49,7 @@ fmtNotifyCmd note =
|
||||||
++ getBody note
|
++ getBody note
|
||||||
where
|
where
|
||||||
-- TODO add the rest of the options as needed
|
-- TODO add the rest of the options as needed
|
||||||
getSummary = (:[]) . quote . summary
|
getSummary = (:[]) . doubleQuote . summary
|
||||||
getIcon n = maybe [] (\i -> ["-i", case i of { Icon s -> s; File s -> s }])
|
getIcon n = maybe [] (\i -> ["-i", case i of { Icon s -> s; File s -> s }])
|
||||||
$ appImage n
|
$ appImage n
|
||||||
getBody n = maybeToList $ (fmap quote . parseBody) =<< body n
|
getBody n = maybeToList $ (fmap doubleQuote . parseBody) =<< body n
|
||||||
quote s = "\"" ++ s ++ "\""
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ module XMonad.Internal.Shell
|
||||||
( fmtCmd
|
( fmtCmd
|
||||||
, spawnCmd
|
, spawnCmd
|
||||||
, spawnSound
|
, spawnSound
|
||||||
|
, doubleQuote
|
||||||
|
, singleQuote
|
||||||
, (#!&&)
|
, (#!&&)
|
||||||
, (#!||)
|
, (#!||)
|
||||||
, (#!>>)
|
, (#!>>)
|
||||||
|
@ -55,3 +57,9 @@ infixr 0 #!||
|
||||||
cmdA #!>> cmdB = cmdA ++ "; " ++ cmdB
|
cmdA #!>> cmdB = cmdA ++ "; " ++ cmdB
|
||||||
|
|
||||||
infixr 0 #!>>
|
infixr 0 #!>>
|
||||||
|
|
||||||
|
doubleQuote :: String -> String
|
||||||
|
doubleQuote s = "\"" ++ s ++ "\""
|
||||||
|
|
||||||
|
singleQuote :: String -> String
|
||||||
|
singleQuote s = "'" ++ s ++ "'"
|
||||||
|
|
Loading…
Reference in New Issue