Xmonad: when moving a window, moving or resizing

I prefer to use the keyboard for swimming or lowering windows. Unfortunately, when swimming, the windows do not move or change, so there are few visual signs that they are not tiled yet. Ideally, when switching to a floating layer, I would move them to the center of the screen and / or resize.

A better solution will work along with the function below (or something similar) that I call with keybind - I would like the floating mouse click to continue working fine.

toggleFloat = withFocused (\windowId -> do { floats <- gets (W.floating . windowset); if windowId `M.member` floats then withFocused $ windows . W.sink else float windowId }) 

(The code is stolen, I still do not understand Haskell: c)

Edit: keyMoveWindowTo in the modified code below can actually replace the "float windowId", which makes it unnecessary.

+6
source share
1 answer

I assume you have xmonad-contrib installed. Then you should take a look at XMonad.Actions.FloatKeys

I assume that the modified function will be:

 ... import XMonad.Actions.FloatKeys ... toggleFloat = withFocused (\windowId -> do { floats <- gets (W.floating . windowset); if windowId `M.member` floats then withFocused $ windows . W.sink else do keysMoveWindowTo (x, y) (gx1, gy1) windowId keysResizeWindow (dx, dy) (gx2, gy2) windowId } ) 

where x , y , dx , dy , gx1 , gy1 , gx2 , gy2 are your settings.
The % operator specified in the documents is in Data.Ratio ; a % b means a rational number with numerator a and denominator b . You need to import if you want to use it:

 import Data.Ratio ((%)) 
+6
source

Source: https://habr.com/ru/post/907751/


All Articles