Center floating window
This commit is contained in:
parent
6f4d2c30c5
commit
d51ced34d5
1 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,7 @@ modify conf = conf
|
||||||
, ("M-s t", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
|
, ("M-s t", spawn "/run/current-system/sw/bin/scrot /tmp/screen.png")
|
||||||
-- Workspace and tasks
|
-- Workspace and tasks
|
||||||
, ("M-b", switchProjectPrompt promptConfig)
|
, ("M-b", switchProjectPrompt promptConfig)
|
||||||
|
, ("M-p c", withFocused centerWindow)
|
||||||
, ("M-p m", shiftToProjectPrompt promptConfig)
|
, ("M-p m", shiftToProjectPrompt promptConfig)
|
||||||
, ("M-p n", switchProjectPrompt promptConfig)
|
, ("M-p n", switchProjectPrompt promptConfig)
|
||||||
, ("M-p r", renameProjectPrompt promptConfig)
|
, ("M-p r", renameProjectPrompt promptConfig)
|
||||||
|
@ -69,6 +70,14 @@ modify conf = conf
|
||||||
, ("M-c", workspacePrompt promptConfig (\name -> windows $ copy name))
|
, ("M-c", workspacePrompt promptConfig (\name -> windows $ copy name))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
-- 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 ()
|
||||||
|
|
||||||
viewProject :: WorkspaceId -> X ()
|
viewProject :: WorkspaceId -> X ()
|
||||||
viewProject id = do
|
viewProject id = do
|
||||||
project <- lookupProject id
|
project <- lookupProject id
|
||||||
|
|
Loading…
Reference in a new issue