fvwm 窗口移动和放置
楚良平
2023-12-01
31.3. Window Movement and Placement
31.3.1. AnimatedMove
AnimatedMove x y [Warp]
Move a window in an animated fashion. Similar to Move command. The options are the same, except they are required, since it doesn't make sense to have a user move the window interactively and animatedly. If the optional argument Warp is specified the pointer is warped with the window.
31.3.2. HideGeometryWindow
HideGeometryWindow [ Never | Move | Resize ]
Hides the position or size window that is usually shown when a window is moved or resized interactively. To switch it off only for move or resize operations the optional parameters Move and Resize can be used respectively. To switch both on again use the Never option.
31.3.3. Layer
Layer [arg1 arg2] | [default]
Puts the current window in a new layer. If arg1 is non zero then the next layer is the current layer number plus arg1. If arg1 is zero then the new layer is arg2.
As a special case, default puts the window in its default layer, i.e. the layer it was initially in. The same happens if no or invalid arguments are specified.
31.3.4. Lower
Lower
Allows the user to lower a window. Note that this lowers a window only in its layer. To bring a window to the absolute bottom, use
AddToFunc lower-to-bottom
+ I Layer 0 0
+ I Lower
31.3.5. Move
Move [[screen screen] [ w | m ]x[ p | w ]... [ w | m ]y[ p | w ]... [Warp]] | [pointer]
Allows the user to move a window. If called from somewhere in a window or its border, then that window is moved. If called from the root window then the user is allowed to select the target window.
If the literal option screen followed by a screen argument is specified, the coordinates are interpreted as relative to the given screen. The width and height of the screen are used for the calculations instead of the display dimensions. The screen as interpreted as in the MoveToScreen command. If the optional argument Warp is specified the pointer is warped with the window. If the single argument pointer is given, the top left corner of the window is moved to the pointer position before starting the operation; this is mainly intended for internal use by modules like FvwmPager.
The operation can be aborted with Escape or any mouse button not set to place the window. By default mouse button 2 is set to cancel the move operation. To change this you may use the Mouse command with special context 'P' for Placement.
The window condition PlacedByButton can be used to check if a specific button was pressed to place the window (see Current command).
If the optional arguments x and y are provided, then the window is moved immediately without user interaction. Each argument can specify an absolute or relative position from either the left/top or right/bottom of the screen. By default, the numeric value given is interpreted as a percentage of the screen width/height, but a trailing 'p' changes the interpretation to mean pixels, while a trailing 'w' means precent of the window width/height. To move the window relative to its current position, add the 'w' (for "window") prefix before the x and/or y value. To move the window to a position relative to the current location of the pointer, add the 'm' (for "mouse") prefix. To leave either coordinate unchanged, "keep" can be specified in place of x or y.
For advanced uses, the arguments x and y can be used multiple times, but without the prefix 'm' or 'w'. (See complex examples below).
Simple Examples:
# Interactive move
Mouse 1 T A Move
# Move window to top left is at (10%,10%)
Mouse 2 T A Move 10 10
# Move top left to (10pixels,10pixels)
Mouse 3 T A Move 10p 10p
More complex examples (these can be bound as actions to keystrokes, etc.; only the command is shown, though):
# Move window so bottom right is at bottom
# right of screen
Move -0 -0
# Move window so top left corner is 10 pixels
# off the top left screen edge
Move +-10 +-10
# Move window 5% to the right, and to the
# middle vertically
Move w+5 50
# Move window up 10 pixels, and so left edge
# is at x=40 pixels
Move 40p w-10p
# Move window to the mouse pointer location
Move m+0 m+0
# Move window to center of screen (50% of screen
# poition minus 50% of widow size).
Move 50-50w 50-50w
Note: In order to obtain moving windows which do not snap to screen, with interactive move, hold down Alt whilst moving the window to disable snap attraction if it's defined.
See also the AnimatedMove command.
31.3.6. MoveToDesk
MoveToDesk [ prev | arg1 [arg2] [min max] ]
Moves the selected window to another desktop. The arguments are the same as for the GotoDesk command. Without any arguments, the window is moved to the current desk. MoveToDesk is a replacement for the obsolete WindowsDesk command, which can no longer be used.
31.3.7. MoveThreshold
MoveThreshold [pixels]
When the user presses a mouse button upon an object fvwm waits to see if the action is a click or a drag. If the mouse moves by more than pixels pixels it is assumed to be a drag.
Previous versions of fvwm hardwired pixels to 3, which is now the default value. If pixels is negative or omitted the default value (which might be increased when 16000x9000 pixel displays become affordable) is restored.
31.3.8. MoveToPage
MoveToPage [options] [ x[ p | w ] y[ p | w ] ] | [prev]
Moves the selected window to another page (x,y). The upper left page is (0,0), the upper right is (M,0), where M is one less than the current number of horizontal pages specified in the DesktopSize command. Similarly the lower left page is (0,N), and the lower right page is (M,N). Negative page numbers refer to pages from the rightmost/lowest page. If x and y are not given, the window is moved to the current page (a window that has the focus but is off-screen can be retrieved with this). Moving windows to a page relative to the current page can be achieved by adding a trailing 'p' after any or both numerical arguments. To move the window relative to its current location, add a trailing 'w'. To move a window to the previous page use prev as the single argument.
Windows are usually not moved beyond desk boundaries.
Possible options are wrapx and wrapy to wrap around the x or y coordinate when the window is moved beyond the border of the desktop. For example, with wrapx, when the window moves past the right edge of the desktop, it reappears on the left edge. The options nodesklimitx and nodesklimity allow moving windows beyond the desk boundaries in x and y direction (disabling the wrapx and wrapy options).
Examples:
# Move window to page (2,3)
MoveToPage 2 3
# Move window to lowest and rightmost page
MoveToPage -1 -1
# Move window to last page visited
MoveToPage prev
# Move window two pages to the right and one
# page up, wrap at desk boundaries
MoveToPage wrapx wrapy +2p -1p
31.3.9. MoveToScreen
MoveToScreen [screen]
Moves the selected window to another Xinerama screen. The screen argument can be 'p' for the primary screen, 'c' for the current screen (containing the mouse pointer), 'w' for the screen containing the center of +the the context window, 'g' for the global screen or the screen number itself (counting from zero).
31.3.10. OpaqueMoveSize
OpaqueMoveSize [percentage]
Tells fvwm the maximum size window with which opaque window movement should be used. The percentage is percent of the total screen area (may be greater than 100). With
OpaqueMoveSize 0
all windows are moved using the traditional rubber-band outline. With
OpaqueMoveSize unlimited
or if a negative percentage is given all windows are moved as solid windows. The default is
OpaqueMoveSize 5
which allows small windows to be moved in an opaque manner but large windows are moved as rubber-bands. If percentage is omitted or invalid the default value is set. To resize windows in an opaque manner you can use the ResizeOpaque style. See the Style command.
31.3.11. PlaceAgain
PlaceAgain [Anim] [Icon]
Causes the current window's position to be re-computed using the initial window placement logic. The window is moved to where it would have been if it were a new window that had just appeared. Most useful with Smart or Clever (ReallySmart) placement. With the optional argument Anim an animated move is used to place the window in its new position. With the additional option Icon, the icon is placed again instead.
31.3.12. Raise
Raise
Allows the user to raise a window. Note that this raises a window only in its layer. To bring a window to the absolute top, use
AddToFunc raise-to-top
+ I Layer 0 ontop
+ I Raise
where ontop is the highest layer used in your setup.
31.3.13. RaiseLower
RaiseLower
Alternately raises and lowers a window. The window is raised if it is obscured by any window (except for its own transients when RaiseTransient style is used; see the Style command) otherwise it is lowered.
31.3.14. Resize
Resize [[frame] [direction dir [warptoborder]] [fixeddirection] [w]width[ p | c ] [w]height[ p | c ] ]
Allows for resizing a window. If called from somewhere in a window or its border, then that window is resized. If called from the root window then the user is allowed to select the target window.
The operation can be aborted with Escape or by pressing any mouse button (except button 1 which confirms it).
If the optional arguments width and height are provided, then the window is resized so that its dimensions are width by height. The units of width and height are percent-of-screen, unless a letter 'p' is appended to one or both coordinates, in which case the location is specified in pixels. With a 'c' suffix the unit defined by the client application (hence the c) is used. So you can say
Resize 80c 24c
to make a terminal window just big enough for 80x24 characters.
If the width or height is prefixed with the letter 'w' the size is not taken as an absolute value but added to the current size of the window. Example:
# Enlarge window by one line
Resize keep w+1c
Both, width and height can be negative. In this case the new size is the screen size minus the given value. If either value is "keep", the corresponding dimension of the window is left untouched. The new size is the size of the client window, thus
Resize 100 100
may make the window bigger than the screen. To base the new size on the size of the whole fvwm window, add the frame option after the command. The options fixeddirection, direction and warptoborder are only used in interactive move operations. With fixeddirection the same border is moved even if the pointer moves past the opposite border. The direction option must be followed by a direction name such as "NorthWest", "South" or "East" (you get the idea). Resizing is started immediately, even if the pointer is not on a border. The warptoborder option changes the behaviour of the direction option so that the pointer is automatically warped to the border in the given direction before starting to resize. Also, if resizing is started by clicking on the window border, the pointer is warped to the outer edge of the border.
AddToFunc ResizeSE I Resize Direction SE
Mouse 3 A M ResizeSE
Resize [ bottomright | br x y ]
An alternate syntax is used if the keyword bottomright or in short br follows the command name. In this case, the arguments x and y specify the desired position of the bottom right corner of the window. They are interpreted exactly like the x and y arguments of the Move command. Actually, any of the options accepted by the Move command can be used.
31.3.15. ResizeMaximize
ResizeMaximize [resize-arguments]
Combines the effects of Resize and Maximize in a single command. When used on a maximized window, the window is resized and is still in the maximized state afterwards. When used on an unmaximized window, the window is resized and put into the maximized state afterwards. This is useful if the user wants to resize the window temporarily and then return to the original geometry. The resize-arguments are the same as for the Resize command.
31.3.16. ResizeMove
ResizeMove resize-arguments move-arguments
This command does the same as the Resize and Move commands, but in a single call which is less visually disturbing. The resize-arguments are exactly the same arguments as for the Resize command and the move-arguments are exactly the same arguments as for the Move command except the pointer option which is not supported by the ResizeMove command.
Examples:
# Move window to top left corner and cover
# most of the screen
ResizeMove -10p -20p 0 0
# Grow the focused window towards the top of screen
Current Resize keep w+$[w.y]p keep 0
Note: Fvwm may not be able to parse the command properly if the option bottomright of the Resize command is used.
31.3.17. ResizeMoveMaximize
ResizeMoveMaximize resize-arguments move-arguments
Combines the effects of ResizeMove and Maximize in a single command. When used on a maximized window, the window is resized and moved and is still in the maximized state afterwards. When used on an unmaximized window, the window is resized and put into the maximized state afterwards. This is useful if the user wants to resize the window temporarily and then return to the original geometry. The resize-arguments and move-arguments are the same as for the ResizeMove command.
31.3.18. RestackTransients
RestackTransients
This command regroups the transients of a window close to it in the stacking order as if the window had just been lowered and then raised. The position of the window itself is not altered. Only windows that use either the RaiseTransient or LowerTransient style are affected at all. When RestackTransients is used on a transient window with the StackTransientParent style set, it is redirected to the parent window.
31.3.19. SetAnimation
SetAnimation milliseconds-delay [fractions-to-move-list]
Sets the time between frames and the list of fractional offsets to customize the animated moves of the AnimatedMove command and the animation of menus (if the menu style is set to animated; see MenuStyle command). If the fractions-to-move-list is omitted, only the time between frames is altered. The fractions-to-move-list specifies how far the window should be offset at each successive frame as a fraction of the difference between the starting location and the ending location. e.g.:
SetAnimation 10 -.01 0 .01 .03 .08 .18 .3 \
.45 .6 .75 .85 .90 .94 .97 .99 1.0
Sets the delay between frames to 10 milliseconds, and sets the positions of the 16 frames of the animation motion. Negative values are allowed, and in particular can be used to make the motion appear more cartoonish, by briefly moving slightly in the opposite direction of the main motion. The above settings are the default.
31.3.20. SnapAttraction
SnapAttraction [proximity [behaviour] [Screen]]
The SnapAttraction command is obsolete. It has been replaced by the Style command option SnapAttraction.
31.3.21. SnapGrid
SnapGrid [x-grid-size y-grid-size]
The SnapGrid command is obsolete. It has been replaced by the Style command option SnapGrid.
31.3.22. WindowsDesk
WindowsDesk arg1 [arg2]
Moves the selected window to another desktop.
This command has been removed and must be replaced by MoveToDesk, the arguments for which are the same as for the GotoDesk command.
Important
You cannot simply change the name of the command: the syntax has changed. If you used:
WindowsDesk n
to move a window to desk n, you have to change it to:
MoveToDesk 0 n
31.3.23. XorPixmap
XorPixmap [pixmap]
Selects the pixmap with which bits are xor'ed when doing rubber-band window moving or resizing. This has a better chance of making the rubber-band visible if XorValue does not give good results. An example pixmap resize.rainbow.xpm is provided with the icon distribution. To turn the XorPixmap off again use the XorValue command or omit the pixmap argument.
31.3.24. XorValue
XorValue [number]
Changes the value with which bits are xor'ed when doing rubber-band window moving or resizing. Valid values range from zero to the maximum value of an unsigned long integer on your system. Setting this value is a trial-and-error process. The default value 0 tries to find a value that gives a good contrast to black and white. The default value is used if the given number is omitted or invalid.