简体   繁体   中英

Move and resize XMonad window - RationalRect call compiler error

to send the focused window to the center of the screen I have the following configuration

main = do
xmonad $ docks def
  { manageHook = myManageHook <+> manageHook def
  , layoutHook = avoidStruts  $  layoutHook def
  , logHook = dynamicLogWithPP xmobarPP
  , terminal    = myTerminal
  } `additionalKeys`
  [ ((myModkey , xK_space), spawn myTerminal )
  , ((myModkey , xK_0), withFocused (keysMoveWindowTo (512,384) (0, 0)))
  ]

I would remove the call to keysMoveWindowTo because it does not allow to set the window size ( ... ) but only specify dx and dy ; than I would like to use:

((myModkey, xK_0), withFocused (doRectFloat (RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))))

but the compiler says:

xmonad.hs:87:58: error:
  Data constructor not in scope:
    RationalRect
      :: Ratio a0
    87 |, ((myModkey , xK_0), withFocused (doRectFloat (RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))))

What is the correct way to bind keys with doRectFloat function?

Thanks

Nello

doRectFloat does not provide an X operation needed by withFocused .

Enhancing your previous solution, you could add keysResizeWindow to do the resizing, eg

, ((myModkey , xK_0), withFocused (
    keysMoveWindowTo (512,384) (1%2, 1%2) >> keysResizeWindow (512, 384) (1%2, 1%2)
  ))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM