Add new shortcut to center the currently focused window
This commit is contained in:
parent
b04bc2b679
commit
c2aca9ce98
2 changed files with 16 additions and 1 deletions
|
@ -24,6 +24,7 @@ import qualified Nord as N
|
||||||
import qualified Scratchpad as R
|
import qualified Scratchpad as R
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
|
|
||||||
-- Custom (in libs)
|
-- Custom (in libs)
|
||||||
import Password (passPrompt)
|
import Password (passPrompt)
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ modify conf = conf
|
||||||
, ("M-p n", switchProjectPrompt promptConfig)
|
, ("M-p n", switchProjectPrompt promptConfig)
|
||||||
, ("M-p r", renameProjectPrompt promptConfig)
|
, ("M-p r", renameProjectPrompt promptConfig)
|
||||||
, ("M-p s", shellPrompt promptConfig)
|
, ("M-p s", shellPrompt promptConfig)
|
||||||
|
, ("M-p c", withFocused centerWindow)
|
||||||
, ("M-d", passPrompt promptConfig)
|
, ("M-d", passPrompt promptConfig)
|
||||||
-- Scratchpads
|
-- Scratchpads
|
||||||
, ("M-p p", namedScratchpadAction R.pads "htop")
|
, ("M-p p", namedScratchpadAction R.pads "htop")
|
||||||
|
@ -72,6 +74,14 @@ viewProject id = do
|
||||||
Just p -> switchProject p
|
Just p -> switchProject p
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
|
|
||||||
|
-- Borrowed from https://www.reddit.com/r/xmonad/comments/gzq316/how_can_i_centre_a_floating_window_without/fthtx29/
|
||||||
|
centerWindow :: Window -> X ()
|
||||||
|
centerWindow win = do
|
||||||
|
(_, W.RationalRect x y w h) <- floatLocation win
|
||||||
|
windows $ W.float win (W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h)
|
||||||
|
return ()
|
||||||
|
--, ( modm .|. xK_a ), withFocused centerWindow)
|
||||||
|
|
||||||
promptConfig = def
|
promptConfig = def
|
||||||
{ position = Bottom
|
{ position = Bottom
|
||||||
, alwaysHighlight = True
|
, alwaysHighlight = True
|
||||||
|
|
|
@ -36,7 +36,12 @@ projects =
|
||||||
, singleAppWithName "wire" "wire-desktop"
|
, singleAppWithName "wire" "wire-desktop"
|
||||||
, singleTermAppWithName "email" "neomutt"
|
, singleTermAppWithName "email" "neomutt"
|
||||||
, Project { projectName = "admin"
|
, Project { projectName = "admin"
|
||||||
, projectDirectory = "~/admin"
|
, projectDirectory = "~/admin/nixos-config"
|
||||||
|
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||||
|
safeSpawnProg term
|
||||||
|
}
|
||||||
|
, Project { projectName = "cdc-config"
|
||||||
|
, projectDirectory = "~/admin/cdc-config"
|
||||||
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
, projectStartHook = Just $ do safeSpawn "vim" ["-g"]
|
||||||
safeSpawnProg term
|
safeSpawnProg term
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue