How to switch to a virtual monitor other than clicking on the pager?

I was wondering if there’s a way of switching to a particular virtual desktop, eg in a 3x3 layout, other than clicking on the pager? I have a script that does tasks on various virtual desktops which switches from desktop to desktop by clicking on the pager with xdotool… but that only works 100% of the time if I set the pager to “Always on top” because otherwise a random window might be covering the pager and intercept the click… and I’d like to avoid having the pager set to “StaysOnTop”, mostly so when I play a movie fullscreen the pager won’t be visible.

This is my simple function (which works under ksh, I think it’d work under BASH too) that calculates the position to click based on the coordinates of the middle of the top left virtual desktop and the distances between desktops on the pager:

[code]# PAGER SETTINGS

pager11Xposition=1765 # horizontal position on the screen of the centre of the top left virtual desktop on the pager
pager11Yposition=30 # vertical position on the screen of the centre of the top left virtual desktop on the pager
pagerXoffset=56 # horizontal distance between the centres of the virtual desktops on the pager
pagerYoffset=30 # vertical distance between the centres of virtual desktops on the pager

windowswitch function

windowswitch () {
xdotool mousemove $(($pager11Xposition+$pagerXoffset*($1-1))) $(($pager11Yposition+$pagerYoffset*($2-1)))
xdotool click 1
}[/code]
Then I call the function with-
windowswitch number number
eg-
windowswitch 1 2
-would change to the first virtual desktop across, second virtual desktop down.

So I’d just like to get that functionality more elegantly than using xdotool + pager StaysOnTop.
Thanks

I suppose that what you call a “monitor” is a “desktop” or “page”. Yes there are ways:
you can place an entry in a menu
you can define a keystroke (for instance ctrl-n to go the nth desktop)
you can define a fvwmCommand script to go to the nth desktop from the command line

I actually implemented all of those although I use them very seldom (for some of them I had to look in my docs),
See the page sax.iasf-milano.inaf.it/~lucio/W … indow.html and the link “For the curious this is the .fvwm2rc”

Thankyou, I’ve changed the terminology in OP from “monitor” to “desktop”.

Well, I’m sorry to say that the code in 90% of any .fvwm2rc file I’ve ever looked at is beyond me (actually I’m using OpenBSD and its default installed version of fvwm that OpenBSD loads if you log on for the first time and type “startx”, which uses .fvwmrc, although I have played around with an up to date version of fvwm and example configs of .fvwm2rc.). I would be interested in how to define such a-

-if you could give me a hint in the right direction, or to the right lines in your .fvwm2rc scripts (there are three of them on your page).
Cheers.

Well, sorry, as Euclid said to Ptolomeus, there is no Royal Way but reading the man page of fvwm and playing around with .fvwmrc (making a backup, changing one item at a time, restarting fvwn after each change and seeing how it looks).

In my page look at the LAST (latest) .fvwmrc.

The section which defines Menu windowops and submenu windowsend and sub/submenu windowwspmenu is the way to move a single window from the current desktop to another desk via its menu (I confess I use it seldom, usually I Stick the window, change desktop and unStick it).

The section which defines Menu WORK_MENU_popup contains the GotoDesk commands to change desktop from the root menu.

There is also a section on FvwnTaskBar which demonstrates yet another way to change desktop which I did not mention.

In the section “key bindings” there are “accelerators to move across desktops” (the control-n stuff)

The way you indicate, i.e. fvwmDesk n to go to desktop n from the command line is actually not a script but an alias (tcsh alias, I use tcsh) : alias fvwmDesk 'FvwmCommand "GotoDesk 0 \!*"' but that requires that FvwmCommand is enabled to receive, which I forgot how to do, but is surely hidden somewhere in .fvwmrc.

I do these sort of things very seldom (and then stick to the frozen config) that I do not remember all the details of what I did ! :mrgreen: