[TAG] Virtual Desktops with individual folders
Thomas Adam
thomas at edulinux.homeunix.org
Sun Jul 15 23:47:33 MSD 2007
On Sun, Jul 15, 2007 at 02:38:46PM -0400, Ben Okopnik wrote:
> I was hoping you'd step up, since you're as close as we can get to an
> in-house FVWM expert. For all I know, other WMs can do the same thing as
> well, but since you've spent so much time writing up the features of
> FVWM, that's what comes up in my mind when somebody mentions an
> easily-programmable WM. So it's all your fault no matter how you look at
> it. :)
Heh. I spend more time with it than I ought to.
> (I wonder if the OP would be satisfied with launching all the apps that
> he wants open and having them minimized on a given desktop? That sounds
> like all-WM territory.)
Yes, it is. It's a two-stage process with FVWM. First of all you'd have to
set some style lines for those applications:
``
Style programA StartsOnPage 0 1, StartIconic, SkipMapping
Style programB StartsOnDesk 1, StartIconic, SkipMapping
''
Note that I've used StartsOnPage for programA, and StartsOnDesk for
programB. SkipMapping tells the window manager not to switch to the page
the program appears on when it is mapped (displayed, if you will) to the
screen. This is useful if you want to continue doing stuff without being
disturbed.
There is a difference between a desk and a page. A Desk contains N number of
pages (at least one -- there's no choice in that). A Page is simply one
"window" within that desk. The numbers of those desks are dependant on the
layout of the DesktopSize. So for instance, I have this in my
~/.fvwm/config file:
``
DesktopSize 3x3
''
That means that for each desk I define, I have nine pages, and they'd look
like this:
``
+------+------+------+
| | | |
| 0 0 | 1 0 | 2 0 |
| B | | |
+------+------+------+
| | | |
| 0 1 | 1 1 | 2 1 |
| A | | |
+------+------+------+
| | | |
| 0 2 | 1 2 | 2 2 |
| | | |
+------+------+------+
''
I've put the numbers in for reference. In the case of programA above
starting in page 0 1, it would place it in square 'A'.
programB is a bit different though in that it's being told to start in a
specific desk. Desk 1, in fact. Naming desks is a way of defining them,
starting at 0 (which FVWM will take as being the default desk anyway),
hence:
``
DesktopName 0 Main
DesktopName 1 Games
DesktopName 2 Work
''
Because all we've said is for programB to startup on desk 2, it will default
to placing that window on page 0 0. What gets even more interesting though
is that the StartsOnPage command can accept three arguments as well as one.
So you could use this to specify not only the desk programB is to start up
onm but the page also (the first number is the desk):
``
Style programB StartsOnPage 1 2 2
''
I said this was a two-stage process. You now have to tell FVWM to launch
your programs. You do this from the StartFunction:
``
DestroyFunc StartFunction
AddToFunc StartFunction
+ I Exec exec programA
+ I Exec exec programB
''
As an example. StartFunction is special in FVWM in that it is always read
across startups (what we call 'Init), and restarts of FVWM. This would mean
that across restarts of FVWM both programA and programB would get started
again. Limiting this to just init is done like this:
``
DestroyFunc StartFunction
AddToFunc StartFunction
+ I Test (Init) Exec exec programA
+ I Test (Init) Exec exec programB
''
> Actually, having played with "idesk" quite a bit, I can suggest an
> approach in that direction:
>
> 1) Make up multiple versions of the "~/.idesk" subdirectory - say,
> "~/.idesk1", "~/.idesk2", etc.
>
> 2) As you switch desktops, have the WM fire off a script that does an
> "ln -sf ~/.idesk$DESKTOP_NUM ~/.idesk".
This is why I rambled on about desks and pages earlier -- the act of switch
from page to page, or desk to desk, are two separate operations. Confining
this to either having just one desk with nine pages (as per my example) is
easier, eince you can then do this:
``
DestroyModuleConfig FE-idesk
*FE-idesk: Cmd Function
*FE-idesk: new_page RestartIdesk
AddToFunc StartFunction I Module FvwmEvent FE-idesk
''
Which just sets up an FvwmEvent alias and tells it that each time we switch
a page, we're going to be calling some function called RestartIdesk. Here's
what that would look like:
``
DestroyFunc RestartIdesk
AddToFunc RestartIdesk
+ I PipeRead `case "$[page.nx] $[page.ny]" in \
"0 0") ln -sf "~/.idesk$[page.nx]$[page.ny]" ~/.idesk && \
doWhateverYouDoToRestartIDesk ;; \
"0 1") ln -sf "~/.idesk$[page.nx]$[page.ny]" ~/.idesk && \
doWhateverYouDoToRestartIDesk ;; \
esac`
''
But then you don't need to check which page you're on. So we can simplify
this more:
``
DestroyFunc RestartIdesk
AddToFunc RestartIdesk
+ I PipeRead `[ -d "$HOME/.idesk$[page.nx]$[page.ny]" ] || echo "Break"`
+ I PipeRead `ln -sf "$HOME/.idesk$[page.nx]$[page.ny]" $HOME/.idesk && \
doWhateverYouDoToRestartIDesk`
''
We instead break (end running this function) if the directory we're trying
to link to for the page we're on doesn't exist. I have no idea what you
need to do to restart idesk, so I will leave "doWhateverYouDoToRestartIDesk"
to someone who knows.
-- Thomas Adam
--
"He wants you back, he screams into the night air, like a fireman going
through a window that has no fire." -- Mike Myers, "This Poem Sucks".
More information about the TAG
mailing list