Previous: , Up: Workspaces   [Contents][Index]


12.4 EdgeActions

EdgeActions is a centralized way to control the behaviour of the screen-borders and -corners, which offers high customizability.

It consists of the following modules: sawfish.wm.edge.subrs -, which contains the C-subroutines, sawfish.wm.edge.utils - a set of utility functions, sawfish.wm.edge.conf - configuration infrastructure, sawfish.wm.edge.actions - functionality infrastucture module, sawfish.wm.edge.flip - viewport/workspace fliping functions, sawfish.wm.edge.hot-spots - hot-spot/hot-move functions, sawfish.wm.edge.tile - simple, but functional tiling funtion and sawfish.wm.edge.viewport-drag - functions for dragging the viewport.

12.5 EdgeAction Internals

C-Subroutines (sawfish.wm.edge.subrs):

Function: create-flippers

Create the flipper-window, which is -to put it plainly- your screen-border. Actions are performed when the flipper-window is activated. Technically it’s one window, but from users point of view it consists of 8 parts (4 borders plus 4 corners).

Function: destroy-flippers

Destroy the flipper-window.

Function: recreate-flippers

Recreate the flipper-window, this is done automatically, when the resolution changes, to ensure EdgeActions stays working properly.

HOOK: enter-flipper-hook

This hook is called when the flipper-window is entered.

HOOK: leave-flipper-hook

This hook is called when the flipper-window is left.

Utils (sawfish.wm.edge.utils):

Function: activate-flippers t

A wrapper-functions around recreate-flippers and destroy-flippers, which additionally adds (respectively removes) the required hook-functions.

Function: get-active-corner

This function returns the corner of the flipper-window which was entered, or nil.

Function: get-active-border

This function returns the border of the flipper-window which was entered, or nil.

Configuration infrastructure (sawfish.wm.edge.conf):

HOOK: before-edge-action-hook

This hook is called before an edge-action is performed. Passes func, edge and while-moving to the functions invoked.

HOOK: after-edge-action-hook

This hook is called after an edge-action is performed. Passes func, edge and while-moving to the functions invoked.

Customizable: edge-actions-enabled nil

Global configuration, whether to enable or disable EdgeActions.

Customizable: left-right-edge-action 'none/hot-spot

Action to perform for the left and right screen-edges when they are hit by the pointer, either flip-workspace, flip-viewport, viewport-drag or none/hot-spot.

Customizable: left-right-edge-move-action 'none/hot-move

Action to perform for the left and right screen-edges when a window is dragged over them, either flip-workspace, flip-viewport, viewport-drag or none/hot-move.

Customizable: top-bottom-edge-action 'none/hot-spot

Action to perform for the top and buttom screen-edges when they are hit by the pointer, either flip-workspace, flip-viewport, viewport-drag or none/hot-spot.

Customizable: top-bottom-edge-move-action 'none/hot-move

Action to perform for the top and bottom screen-edges when a window is dragged over them, either flip-workspace, flip-viewport, viewport-drag or none/hot-move.

Customizable: edge-flip-delay 250

"Delay (in milliseconds) of flipping of viewport / workspace."

Customizable: hot-spot-delay 150

Delay (in milliseconds) before activating a hot-spot.

Customizable: hot-spots-corner-length 50

Length in px (in both x and y direction) wich is used for the hot-spot corners. All remaining pixels represent the borders.

Customizable: viewport-drag-distance 64

Amount to drag the viewport (in pixel) each time the pointer hits the screen edge.

Customizable: viewport-drag-cursor-distance 32

"Amount to pull back the cursor (in pixel) after dragging the viewport." Recommended is half of viewport-drag-distance.

Functionality infrastructure (sawfish.wm.edge.actions):

Function: activate-edges t

This function calls activate-flippers and adds the required hook-functions to be able to perform user-actions on the edges.

Function: activate-edges-after-set

This function is used by the edge-actions-enabled customizable to make (de-)activating EdgeActions from SawfishConfig and resource-file work.

Function: edge-action-call func edge while-moving

This function calls the desired user-action func for the screen-edge edge. while-moving to distinguish whether a window is dragged or not.

Function: edge-action-hook-func

This hook-function is responsible to either call hot-spot-invoke (if a corner was activated) or to call edge-action-call to perform an action, when the edge was activated using the pointer.

Function: edge-action-move-hook-func

This hook-function is responsible to either call hot-move-invoke or to call edge-action-call to perfom an action, if the edge was activated while dragging a window over it.

EdgeFlip (sawfish.wm.edge.flip):

This is the traditional EdgeFlip. When a window or the pointer hits the screen-edge, the screen is shifted by either one Viewport or one Workspace in that direction. The pointer is warped accordingly (to keep in logical position).

Function: edge-flip-invoke edge type while-moving

This function invokes edge-fliping. edge (a symbol) is the screen-edge that is active (left, right, top, bottom), type is either flip-workspace or flip-viewport. while-moving is used to distinguish whether a window is dragged or not.

ViewportDrag (sawfish.wm.edge.viewport-drag):

iViewportDrag (formerly Infinite-Desktop) is a mechanic, that shifts the Viewport accordingly to which screen edge was activated. This way the Viewport becomes virtually "infinite", regardless of the physical size (thus the old name).

Function: viewport-drag edge while-moving

This function invokes viewport-dragging. edge is the screen-edge that is active (left, right, top, bottom) (a symbol). while-moving is used to distinguish whether a window is dragged or not.

Tile (sawfish.wm.edge.tile):

Tiling is a mechanic to re-arrange windows in a non-overlapping way. Tiling as such means to "organization of the screen into mutually non-overlapping frames, as opposed to the more popular approach of coordinate-based stacking of overlapping objects".

This simple approach Sawfish provides may also be known as "Expose" or "Mosaic".

Sawfish does not tile all windows visible. It filters by given rules:

- only current head (xinerama) - only current workspace - only current visible viewport - exclude iconified windows - exclude ignored windows - exclude windows with never-expose matcher

Function: tile-windows

Interactive command to manually tile windows.

Function: tile-windows-core edge while-moving

Internal function to tile windows when activating an edge.

Function: window-never-expose-p w

Returns whether window should be tiled or not.

HotSpots (sawfish.wm.edge.hot-spots):

HotSpots is a mechanic, which allows for practically everything to be done when a screen edge or a corner is activated. the corners are defined via hot-spots-corner-length. Only HotSpots responds to the corners.

HotMove is HotSpots’ companion, which allows for practically everything to be done when a screen edge is actived by dragging a window over it. HotMove doesn’t know about corners, it only sees for edges.

That way your screen-edge is actually split into 12: 4 corners, two times 4 edges (as explained above actions are split for when while moving a window and for when activating the edges using the pointer). Corners are not recognized for for while moving a window.

HotSpots only allows functions to be used as actions, though practically everything can be done this way. If the arguement is not a function, an error is thrown, to in form the user.

Customizable: left-edge-function nil

The function launched when hitting the left-edge.

Customizable: top-left-corner-function nil

The function launched when hitting the top-left-corner.

Customizable: top-edge-function nil

The function launched when hitting the top-edge.

Customizable: top-right-corner-function nil

The function launched when hitting the top-right-corner.

Customizable: right-edge-function nil

The function launched when hitting the bottom-edge.

Customizable: bottom-right-corner-function nil

The function launched when hitting the bottom-right-corner.

Customizable: bottom-edge-function nil

The function launched when hitting the bottom-edge.

Customizable: top-left-corner-function nil

The function launched when hitting the bottom-left-corner.

Variable: Customizable left-edge-move-function nil

The function launched when dragging a window over the left-edge.

Variable: Customizable top-edge-move-function nil

The function launched when dragging a window over the top-edge.

Variable: Customizable right-edge-move-function nil

The function launched when dragging a window over the right-edge.

Variable: Customizable bottom-edge-move-function nil

The function launched when dragging a window over the bottom-edge.

Function: hot-spot-invoke spot

This function invokes the hot-spot. spot (a symbol) is either left, top-left, top, top-right, right, bottom-right, bottom or bottom-left.

Function: hot-move-invoke spot

This function invokes the hot-spot while moving. spot (a symbol) is either left, top, right, or bottom.

Example configuration (~/.sawfishrc):

Note: this is just an example, not all functions in it may be availabe on your system.

;; Timers
( defvar-setq edge-flip-delay 250 )
( defvar-setq hot-spot-delay 125 )

;; Activate screen edges
( activate-edges t )

;; HotSpots
( defvar-setq top-left-corner-function
  ( lambda () ( tile-windows ) ) )

( defvar-setq top-right-corner-function
  ( lambda () ( pager-unhide ) ) )

( defvar-setq  bottom-right-corner-function
  ( lambda () ( show-desktop ) ) )

( defvar-setq bottom-left-corner-function
  ( lambda () ( raise-window ( get-window-by-role "panel_" #:regex t ) ) ) )

( defvar-setq top-edge-function
  ( lambda () ( jump-or-exec "Konsole" "konsole" #:match-class t ) ) )

( defvar-setq bottom-edge-function
  ( lambda () ( jump-or-exec "Dolphin" "dolphin" #:match-class t ) ) )

;; HotMove
( defvar-setq top-edge-move-function
  ( lambda ( win ) ( maximize-window win ) ) )

( defvar-setq bottom-edge-move-function
  ( lambda ( win ) ( delete-window win ) ) )

;; actions when pointer hits edge
( defvar-setq left-right-edge-action 'flip-viewport )
( defvar-setq top-bottom-edge-action 'none/hot-spot )

;; actions while moving window hits edge
( defvar-setq left-right-edge-move-action 'flip-workspace )
( defvar-setq top-bottom-edge-move-action 'none )

Previous: , Up: Workspaces   [Contents][Index]