legacy-wiki
Desktop switching compiz
Recovered from the older tannerjc.net wiki snapshot dated January 23, 2016.
One of the things that has annoyed me with compiz compared to metacity as a window manager is the inability to easily set a keyboard shortcut to switch directly to a specific desktop. I set F1-F7 to go directly to desktops 1-7. In compiz you can’t do this easily. However it looks like it’s possible with CompizConfig Settings Manager
# yum install ccsm
You also need ‘wmctrl’
[jbrier@jb ~]$ wmctrl
wmctrl 1.07
Usage: wmctrl [OPTION]...
Actions:
-m Show information about the window manager and
about the environment.
-l List windows managed by the window manager.
-d List desktops. The current desktop is marked
with an asterisk.
-s DESK Switch to the specified desktop.
-a WIN Activate the window by switching to its desktop and
raising it.
-c WIN Close the window gracefully.
-R WIN Move the window to the current desktop and
activate it.
-r WIN -t DESK Move the window to the specified desktop.
-r WIN -e MVARG Resize and move the window around the desktop.
The format of the MVARG argument is described below.
-r WIN -b STARG Change the state of the window. Using this option it's
possible for example to make the window maximized,
minimized or fullscreen. The format of the STARG
argument and list of possible states is given below.
-r WIN -N STR Set the name (long title) of the window.
-r WIN -I STR Set the icon name (short title) of the window.
-r WIN -T STR Set both the name and the icon name of the window.
-k (on|off) Activate or deactivate window manager's
showing the desktop mode. Many window managers
do not implement this mode.
-o X,Y Change the viewport for the current desktop.
The X and Y values are separated with a comma.
They define the top left corner of the viewport.
The window manager may ignore the request.
-n NUM Change number of desktops.
The window manager may ignore the request.
-g W,H Change geometry (common size) of all desktops.
The window manager may ignore the request.
-h Print help.
Options:
-i Interpret WIN as a numerical window ID.
-p Include PIDs in the window list. Very few
X applications support this feature.
-G Include geometry in the window list.
-x Include WM_CLASS in the window list or
interpret WIN as the WM_CLASS name.
-u Override auto-detection and force UTF-8 mode.
-F Modifies the behavior of the window title matching
algorithm. It will match only the full window title
instead of a substring, when this option is used.
Furthermore it makes the matching case sensitive.
-v Be verbose. Useful for debugging.
-w WA Use a workaround. The option may appear multiple
times. List of available workarounds is given below.
Arguments:
WIN This argument specifies the window. By default it's
interpreted as a string. The string is matched
against the window titles and the first matching
window is used. The matching isn't case sensitive
and the string may appear in any position
of the title.
The -i option may be used to interpret the argument
as a numerical window ID represented as a decimal
number. If it starts with 0x, then
it will be interpreted as a hexadecimal number.
The -x option may be used to interpret the argument
as a string, which is matched against the window's
class name (WM_CLASS property). Th first matching
window is used. The matching isn't case sensitive
and the string may appear in any position
of the class name. So it's recommended to always use
the -F option in conjunction with the -x option.
The special string :SELECT: (without the quotes)
may be used to instruct wmctrl to let you select the
window by clicking on it.
The special string :ACTIVE: (without the quotes)
may be used to instruct wmctrl to use the currently
active window for the action.
DESK A desktop number. Desktops are counted from zero.
MVARG Specifies a change to the position and size
of the window. The format of the argument is:
G,X,Y,W,H
G: Gravity specified as a number. The numbers are
defined in the EWMH specification. The value of
zero is particularly useful, it means use the
default gravity of the window.
X,Y: Coordinates of new position of the window.
W,H: New width and height of the window.
The value of -1 may appear in place of
any of the X, Y, W and H properties
to left the property unchanged.
STARG Specifies a change to the state of the window
by the means of _NET_WM_STATE request.
This option allows two properties to be changed
simultaneously, specifically to allow both
horizontal and vertical maximization to be
altered together.
The format of the argument is:
(remove|add|toggle),PROP1[,PROP2]
The EWMH specification defines the
following properties:
modal, sticky, maximized_vert, maximized_horz,
shaded, skip_taskbar, skip_pager, hidden,
fullscreen, above, below
Workarounds:
DESKTOP_TITLES_INVALID_UTF8 Print non-ASCII desktop titles correctly
when using Window Maker.
The format of the window list:
window ID desktop ID client machine window title
The format of the desktop list:
desktop ID [-*] geometry viewport workarea title
Author, current maintainer: Tomas Styblo tripie@cpan.org
Released under the GNU General Public License.
Copyright (C) 2003
[jbrier@jb ~]$ wmctrl -s 2
[jbrier@jb ~]$ wmctrl -s Workspace 2
[jbrier@jb ~]$ wmctrl -s Workspace
^C
[jbrier@jb ~]$ wmctrl -s
wmctrl: option requires an argument -- 's'
[jbrier@jb ~]$ wmctrl -l
0x06200030 0 jb.usersys.redhat.com boten anna (dj micro spankin c by Basshunter
0x0140001e -1 jb.usersys.redhat.com x-nautilus-desktop
0x04a00156 0 jb.usersys.redhat.com About trianglebeats.com | TriangleBeats.com - Google Chrome
0x01000003 -1 jb.usersys.redhat.com Top Panel
0x01000028 -1 jb.usersys.redhat.com Bottom Panel
0x0640009d 0 jb.usersys.redhat.com *Unsaved Document 1 - gedit
0x06800003 0 jb.usersys.redhat.com jbrier@jb:~
0x05200003 0 jb.usersys.redhat.com jbrier@jb:~
0x06600003 0 jb.usersys.redhat.com jbrier@jb:/data/sxarchive/ereports/00367952/2010-11-08-dumps
0x01e00084 0 jb.usersys.redhat.com Inbox - jbrier@redhat.com zimbra - Mozilla Thunderbird
0x06000003 0 jb.usersys.redhat.com jbrier@jb:~/.weechat/logs
0x04c00003 0 jb.usersys.redhat.com [screen 0: weechat 0.3.2] weechat 0.3.2
0x05400003 0 jb.usersys.redhat.com jbrier@jb:~
0x04e00084 0 jb.usersys.redhat.com wmctrl - Wikipedia, the free encyclopedia - Mozilla Firefox
0x05600003 0 jb.usersys.redhat.com jbrier@jb:~
0x00e00003 0 jb.usersys.redhat.com CompizConfig Settings Manager
[jbrier@jb ~]$ wmctrl -d
0 * DG: 10240x1024 VP: 0,0 WA: 0,51 2560x973 Workspace 1
[jbrier@jb ~]$ wmctrl -l
0x06200030 0 jb.usersys.redhat.com boten anna (dj micro spankin c by Basshunter
0x0140001e -1 jb.usersys.redhat.com x-nautilus-desktop
0x04a00156 0 jb.usersys.redhat.com About trianglebeats.com | TriangleBeats.com - Google Chrome
0x01000003 -1 jb.usersys.redhat.com Top Panel
0x01000028 -1 jb.usersys.redhat.com Bottom Panel
0x0640009d 0 jb.usersys.redhat.com *Unsaved Document 1 - gedit
0x06800003 0 jb.usersys.redhat.com jbrier@jb:~
0x05200003 0 jb.usersys.redhat.com jbrier@jb:~
0x06600003 0 jb.usersys.redhat.com jbrier@jb:/data/sxarchive/ereports/00367952/2010-11-08-dumps
0x01e00084 0 jb.usersys.redhat.com Inbox - jbrier@redhat.com zimbra - Mozilla Thunderbird
0x06000003 0 jb.usersys.redhat.com jbrier@jb:~/.weechat/logs
0x04c00003 0 jb.usersys.redhat.com [screen 0: weechat 0.3.2] weechat 0.3.2
0x05400003 0 jb.usersys.redhat.com jbrier@jb:~
0x04e00084 0 jb.usersys.redhat.com wmctrl - Wikipedia, the free encyclopedia - Mozilla Firefox
0x05600003 0 jb.usersys.redhat.com jbrier@jb:~
0x00e00003 0 jb.usersys.redhat.com CompizConfig Settings Manager
[jbrier@jb ~]$ wmctrl -d
0 * DG: 10240x1024 VP: 2560,0 WA: 0,51 2560x973 Workspace 1
[jbrier@jb ~]$ wmctrl -n 2
[jbrier@jb ~]$ wmctrl -d
0 * DG: 10240x1024 VP: 0,0 WA: 0,51 2560x973 Workspace 1
1 - DG: 10240x1024 VP: 0,0 WA: 0,51 2560x973 Workspace 2
[jbrier@jb ~]$ wmctrl -n 4
[jbrier@jb ~]$ wmctrl -s 2
[jbrier@jb ~]$ wmctrl -s 1
[jbrier@jb ~]$ wmctrl -d
0 * DG: 2560x1024 VP: 0,0 WA: 0,51 2560x973 Workspace 1
1 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 2
2 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 3
3 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 4
4 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 5
5 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 6
6 - DG: 2560x1024 VP: N/A WA: 0,51 2560x973 Workspace 7
[jbrier@jb ~]$ wmctrl -s 2
Then in CompizConfig Settings Manager (ccsm) go to General Commands set Key Bindings for all the Function keys, then in Commands set ‘wmctrl -s #’ (I think starting at 0) for all your equivalent Key Bindings/desktops.
I haven’t tested this yet but it should work.