Xmonad updates

This commit is contained in:
Derek Taylor 2021-02-26 00:26:50 -06:00
parent a09a39a82a
commit 24a351360b
2 changed files with 6 additions and 41 deletions

View File

@ -608,24 +608,6 @@ calcPrompt c ans =
where f = reverse . dropWhile isSpace
#+END_SRC
*** editPrompt
editPrompt is a simple prompt that allows you to open a file in your text editor. The path defaults to the $HOME directory.
#+begin_src haskell
editPrompt :: String -> X ()
editPrompt home = do
str <- inputPrompt cfg "EDIT: ~/"
case str of
Just s -> openInEditor s
Nothing -> pure ()
where
cfg = dtXPConfig { defaultText = "" }
openInEditor :: String -> X ()
openInEditor path =
safeSpawn "emacsclient" ["-c", "-a", "emacs", path]
#+end_src
** Xprompt Keymap
Emacs-like key bindings for xprompts.
@ -911,8 +893,8 @@ I am using the Xmonad.Util.EZConfig module which allows keybindings to be writte
| MODKEY + t | force floating window back into tiling |
#+BEGIN_SRC haskell
myKeys :: String -> [([Char], X ())]
myKeys home =
myKeys :: [(String, X ())]
myKeys =
-- Xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
@ -925,7 +907,6 @@ myKeys home =
-- Other Prompts
, ("M-p c", calcPrompt dtXPConfig' "qalc") -- calcPrompt
, ("M-p e", editPrompt home) -- editPrompt
, ("M-p m", manPrompt dtXPConfig) -- manPrompt
, ("M-p p", passPrompt dtXPConfig) -- passPrompt
, ("M-p g", passGeneratePrompt dtXPConfig) -- passGeneratePrompt
@ -1063,7 +1044,6 @@ This is the "main" of XMonad. This where everything in our configs comes togethe
#+BEGIN_SRC haskell
main :: IO ()
main = do
home <- getHomeDirectory
-- Launching three instances of xmobar on their monitors.
xmproc0 <- spawnPipe "xmobar -x 0 $HOME/.config/xmobar/xmobarrc0"
xmproc1 <- spawnPipe "xmobar -x 1 $HOME/.config/xmobar/xmobarrc2"
@ -1100,5 +1080,5 @@ main = do
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
}
} `additionalKeysP` myKeys home
} `additionalKeysP` myKeys
#+END_SRC

View File

@ -514,19 +514,6 @@ calcPrompt c ans =
trim = f . f
where f = reverse . dropWhile isSpace
editPrompt :: String -> X ()
editPrompt home = do
str <- inputPrompt cfg "EDIT: ~/"
case str of
Just s -> openInEditor s
Nothing -> pure ()
where
cfg = dtXPConfig { defaultText = "" }
openInEditor :: String -> X ()
openInEditor path =
safeSpawn "emacsclient" ["-c", "-a", "emacs", path]
dtXPKeymap :: M.Map (KeyMask,KeySym) (XP ())
dtXPKeymap = M.fromList $
map (first $ (,) controlMask) -- control + <key>
@ -748,8 +735,8 @@ myLogHook :: X ()
myLogHook = fadeInactiveLogHook fadeAmount
where fadeAmount = 1.0
myKeys :: String -> [([Char], X ())]
myKeys home =
myKeys :: [(String, X ())]
myKeys =
-- Xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
@ -762,7 +749,6 @@ myKeys home =
-- Other Prompts
, ("M-p c", calcPrompt dtXPConfig' "qalc") -- calcPrompt
, ("M-p e", editPrompt home) -- editPrompt
, ("M-p m", manPrompt dtXPConfig) -- manPrompt
, ("M-p p", passPrompt dtXPConfig) -- passPrompt
, ("M-p g", passGeneratePrompt dtXPConfig) -- passGeneratePrompt
@ -895,7 +881,6 @@ myKeys home =
main :: IO ()
main = do
home <- getHomeDirectory
-- Launching three instances of xmobar on their monitors.
xmproc0 <- spawnPipe "xmobar -x 0 $HOME/.config/xmobar/xmobarrc0"
xmproc1 <- spawnPipe "xmobar -x 1 $HOME/.config/xmobar/xmobarrc2"
@ -932,4 +917,4 @@ main = do
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
}
} `additionalKeysP` myKeys home
} `additionalKeysP` myKeys