Jump to content

Window controller: Difference between revisions

From LinuxMCE
No edit summary
 
No edit summary
Line 4: Line 4:
==== Generalities ====
==== Generalities ====


Only 2 desktops are used:
Only 2 desktops are used:
- desktop 0 is the main desktop, and should be the only one active, at every moment in time
- desktop 0 is the main desktop, and should be the only one active, at every moment in time
- desktop 1 is used only as a hidden desktop, it should never be active
- desktop 1 is used only as a "hidden" desktop, it should never be active


A wrapper for wmctrl was created, and wmctrl commands are used directly in our code.
A wrapper for wmctrl was created, and wmctrl commands are used directly in our code.
The wmctrl command-line application is not used, but it can be used for debugging purposes.
The wmctrl command-line application is not used, but it can be used for debugging purposes.


==== Legend (symbols) ====
==== Legend (symbols) ====
Below, the corresponding command-line options are shown for each action.
Below, the corresponding command-line options are shown for each action.
'*>' is the symbol for corresponding command-line action.


'-x' options for wmctrl means to use the class-name to identify the windows
'*>' is the symbol for corresponding command-line action.
 
'-x' options for wmctrl means to use the class-name to identify the windows


==== Window-Controller actions ====
==== Window-Controller actions ====


Action: hide/show a window
;Action - hide/show window
windows are not really hidden, they are moved to the desktop 1
        windows are not really hidden, they are moved to the desktop 1
*> wmctrl -x -r xcalc -t 1
        *> wmctrl -x -r xcalc -t 1
windows are shown by moving them to the desktop 0
        windows are shown by moving them to the desktop 0
*> wmctrl -x -r xcalc -t 0
        *> wmctrl -x -r xcalc -t 0
   reason:
   reason:
when a hide-window command is sent to the wm, the wm unmaps that window,
        when a hide-window command is sent to the wm, the wm unmaps that window,
and this cause problems with GUI applications that expects their windows to be in a mapped state
        and this cause problems with GUI applications that expects their windows to be in a mapped state


Action: changing a window layer (similar, but not always as the same Z-order)
;Action - changing a window layer (similar, but not always as the same Z-order)
we use 3 layers: above, below, normal
        we use 3 layers: above, below, normal
wmctrl accepts the following layers: above, below
        wmctrl accepts the following layers: above, below
These layers are actually properties added for a window.
        These layers are actually properties added for a window.


layer normal: neither of the above and below properties is active
        layer normal: neither of the "above" and "below" properties is active
*> wmctrl -x -r xcalc -b remove,below
        *> wmctrl -x -r xcalc -b remove,below
*> wmctrl -x -r xcalc -b remove,above
        *> wmctrl -x -r xcalc -b remove,above
layer above: only the above property should be set
        layer above: only the "above" property should be set
*> wmctrl -x -r xcalc -b remove,below
        *> wmctrl -x -r xcalc -b remove,below
*> wmctrl -x -r xcalc -b add,above
        *> wmctrl -x -r xcalc -b add,above
layer below: only the below property should be set
        layer below: only the "below" property should be set
*> wmctrl -x -r xcalc -b remove,above
        *> wmctrl -x -r xcalc -b remove,above
*> wmctrl -x -r xcalc -b add,below
        *> wmctrl -x -r xcalc -b add,below


Action: changing a window position and size
;Action - changing a window position and size
*> wmctrl -x- r xcalc -e 0,100,200,300,400
        *> wmctrl -x- r xcalc -e 0,100,200,300,400
(x,y,width,height) = (100,200,300,400)
        (x,y,width,height) = (100,200,300,400)
   note:
   note:
the window must not be maximized, neither in the fullscreen state
        the window must not be maximized, neither in the fullscreen state
otherwise the command may not succeed
        otherwise the command may not succeed


Action: changing the fullscreen state
;Action - changing the fullscreen state
In the fullscreen state, the window client area occupy the whole screen.
        In the fullscreen state, the window client area occupy the whole screen.
*> wmctrl -x -r xcalc -b add,fullscreen
        *> wmctrl -x -r xcalc -b add,fullscreen
*> wmctrl -x -r xcalc -b remove,fullscreen
        *> wmctrl -x -r xcalc -b remove,fullscreen


Action: changing the maximized state
;Action - changing the maximized state
In the fullscreen state, the window area, including the borders and the title, will occupy the whole screen.
        In the fullscreen state, the window area, including the borders and the title, will occupy the whole screen.
*> wmctrl -x -r xcalc -b add,maximized_horz,maximized_vert
        *> wmctrl -x -r xcalc -b add,maximized_horz,maximized_vert
*> wmctrl -x -r xcalc -b remove,maximized_horz,maximized_vert
        *> wmctrl -x -r xcalc -b remove,maximized_horz,maximized_vert


Action: activating a window
;Action - activating a window
That window will be above the other windows which belong to the same layer.
        That window will be above the other windows which belong to the same layer.
That window will have the focus.
        That window will have the focus.
If necessary, the window will be moved to the current desktop.
        If necessary, the window will be moved to the current desktop.
*> wmctrl -x -R xcalc
        *> wmctrl -x -R xcalc


Action: list windows
;Action - list windows
*> wmctrl -x -p -l -G
        *> wmctrl -x -p -l -G


==== Window-Controller Enhancements ====
==== Window-Controller Enhancements ====


When enhancements were added to wmctrl, the compiled executable was renamed to 'xctrl'
When enhancements were added to wmctrl, the compiled executable was renamed to 'xctrl'.
 
This will allow both application to coexist, without the need put them in separate directories.
This will allow both application to coexist, without the need put them in separate directories.
These enhancements does not affect the standard wmctrl commands.
These enhancements does not affect the standard wmctrl commands.


New -L option:
;New -L option:
list all the properties for every window,
        list all the properties for every window,
and will also list extra properties,
        and will also list extra properties,
including the layer for every window, as seen by the window-manager
        including the layer for every window, as seen by the window-manager
*> xctrl -L
        *> xctrl -L


A new -O option:
;New -O option:
         recursively change the override_redirect property for a window,
         recursively change the override_redirect property for a window,
up to the latest parent before the root window
        up to the latest parent before the root window
-O requires a numeric argument, 0 or 1
        -O requires a numeric argument, 0 or 1
*> xctrl -x -O 0 -r xcalc
        *> xctrl -x -O 0 -r xcalc
*> xctrl -x -O 1 -r xcalc
        *> xctrl -x -O 1 -r xcalc


== Original Document ==
== Original Document ==
http://svn.plutohome.com/pluto/trunk/src/utilities/linux/window_manager/WINDOW_CONTROLLER.txt
http://svn.plutohome.com/pluto/trunk/src/utilities/linux/window_manager/WINDOW_CONTROLLER.txt

Revision as of 14:04, 14 September 2006

This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.

Window Controller

Generalities

Only 2 desktops are used:
- desktop 0 is the main desktop, and should be the only one active, at every moment in time
- desktop 1 is used only as a "hidden" desktop, it should never be active

A wrapper for wmctrl was created, and wmctrl commands are used directly in our code.

The wmctrl command-line application is not used, but it can be used for debugging purposes.

Legend (symbols)

Below, the corresponding command-line options are shown for each action.

'*>' is the symbol for corresponding command-line action.
'-x' options for wmctrl means to use the class-name to identify the windows

Window-Controller actions

Action - hide/show window
       windows are not really hidden, they are moved to the desktop 1
       *> wmctrl -x -r xcalc -t 1
       windows are shown by moving them to the desktop 0
       *> wmctrl -x -r xcalc -t 0
 reason:
       when a hide-window command is sent to the wm, the wm unmaps that window,
       and this cause problems with GUI applications that expects their windows to be in a mapped state
Action - changing a window layer (similar, but not always as the same Z-order)
       we use 3 layers: above, below, normal
       wmctrl accepts the following layers: above, below
       These layers are actually properties added for a window.
       layer normal: neither of the "above" and "below" properties is active
       *> wmctrl -x -r xcalc -b remove,below
       *> wmctrl -x -r xcalc -b remove,above
       layer above: only the "above" property should be set
       *> wmctrl -x -r xcalc -b remove,below
       *> wmctrl -x -r xcalc -b add,above
       layer below: only the "below" property should be set
       *> wmctrl -x -r xcalc -b remove,above
       *> wmctrl -x -r xcalc -b add,below
Action - changing a window position and size
       *> wmctrl -x- r xcalc -e 0,100,200,300,400
       (x,y,width,height) = (100,200,300,400)
 note:
       the window must not be maximized, neither in the fullscreen state
       otherwise the command may not succeed
Action - changing the fullscreen state
       In the fullscreen state, the window client area occupy the whole screen.
       *> wmctrl -x -r xcalc -b add,fullscreen
       *> wmctrl -x -r xcalc -b remove,fullscreen
Action - changing the maximized state
       In the fullscreen state, the window area, including the borders and the title, will occupy the whole screen.
       *> wmctrl -x -r xcalc -b add,maximized_horz,maximized_vert
       *> wmctrl -x -r xcalc -b remove,maximized_horz,maximized_vert
Action - activating a window
       That window will be above the other windows which belong to the same layer.
       That window will have the focus.
       If necessary, the window will be moved to the current desktop.
       *> wmctrl -x -R xcalc
Action - list windows
       *> wmctrl -x -p -l -G

Window-Controller Enhancements

When enhancements were added to wmctrl, the compiled executable was renamed to 'xctrl'.

This will allow both application to coexist, without the need put them in separate directories.

These enhancements does not affect the standard wmctrl commands.

New -L option
       list all the properties for every window,
       and will also list extra properties,
       including the layer for every window, as seen by the window-manager
       *> xctrl -L
New -O option
       recursively change the override_redirect property for a window,
       up to the latest parent before the root window
       -O requires a numeric argument, 0 or 1
       *> xctrl -x -O 0 -r xcalc
       *> xctrl -x -O 1 -r xcalc

Original Document

http://svn.plutohome.com/pluto/trunk/src/utilities/linux/window_manager/WINDOW_CONTROLLER.txt