diff --git a/bin/xmonad.hs b/bin/xmonad.hs index 47e232b..4c02c50 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE MultiWayIf #-} -------------------------------------------------------------------------------- -- | XMonad binary @@ -446,7 +445,8 @@ mkKeys ts c = , ("M-b", "launch bitwarden selector", runBwMenu) , ("M-C-e", "launch editor", runEditor) , ("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-f", "launch file manager", runFileManager) ] ++ diff --git a/lib/XMonad/Internal/Command/Desktop.hs b/lib/XMonad/Internal/Command/Desktop.hs index 8235413..8052e47 100644 --- a/lib/XMonad/Internal/Command/Desktop.hs +++ b/lib/XMonad/Internal/Command/Desktop.hs @@ -4,6 +4,7 @@ module XMonad.Internal.Command.Desktop ( myTerm , runTerm + , runTMux , runCalc , runBrowser , runEditor @@ -59,6 +60,15 @@ myTerm = "urxvt" runTerm :: X () 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 = spawnCmd myTerm ["-e", "R"] @@ -67,7 +77,7 @@ runBrowser = spawn "brave-accel" runEditor :: X () 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 = spawn "pcmanfm" diff --git a/lib/XMonad/Internal/Notify.hs b/lib/XMonad/Internal/Notify.hs index 9fe7b14..2f93df9 100644 --- a/lib/XMonad/Internal/Notify.hs +++ b/lib/XMonad/Internal/Notify.hs @@ -49,8 +49,7 @@ fmtNotifyCmd note = ++ getBody note where -- 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 }]) $ appImage n - getBody n = maybeToList $ (fmap quote . parseBody) =<< body n - quote s = "\"" ++ s ++ "\"" + getBody n = maybeToList $ (fmap doubleQuote . parseBody) =<< body n diff --git a/lib/XMonad/Internal/Shell.hs b/lib/XMonad/Internal/Shell.hs index 084a716..fab6758 100644 --- a/lib/XMonad/Internal/Shell.hs +++ b/lib/XMonad/Internal/Shell.hs @@ -5,6 +5,8 @@ module XMonad.Internal.Shell ( fmtCmd , spawnCmd , spawnSound + , doubleQuote + , singleQuote , (#!&&) , (#!||) , (#!>>) @@ -55,3 +57,9 @@ infixr 0 #!|| cmdA #!>> cmdB = cmdA ++ "; " ++ cmdB infixr 0 #!>> + +doubleQuote :: String -> String +doubleQuote s = "\"" ++ s ++ "\"" + +singleQuote :: String -> String +singleQuote s = "'" ++ s ++ "'"