Subject: FVWM: How to place a window in more than 1 desk

From: Srivathsa Rao U <[email-masked]>
Date: Thu, 17 Feb 2005 14:10:31 +0530

Hi,
    I am using fvwm 2.5.10. I need a window to occupy some of my desktops
which I specify.. How can do it. With the "Stick" a window will occupied
in all the desks, but I need it in some of my desks not in all.

Eg: Assume I have desks from 1 to 7, And I want a perticular terminal to 
be occupied into desks 3,4,5 . If I stick option terminal will occupy 
all the desks from 1 to 7.

Could you pls. help me to do this.

If you can give the set of code to be placed in .fvwm2rc then it will be 
great.

Thanx & Rgds,
Srivathsa

--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Thomas Adam <[email-masked]>
Date: Thu, 17 Feb 2005 12:55:57 +0000

On Thu, Feb 17, 2005 at 02:10:31PM +0530, Srivathsa Rao U wrote:
> Hi,
>    I am using fvwm 2.5.10. I need a window to occupy some of my
> desktops which I specify.. How can do it. With the "Stick" a window
> will occupied in all the desks, but I need it in some of my desks not
> in all.
>
> Eg: Assume I have desks from 1 to 7, And I want a perticular terminal
> to be occupied into desks 3,4,5 . If I stick option terminal will
> occupy all the desks from 1 to 7.

You can use FvwmEvent to do this.  I.e. you can get FvwmEvent to listen
for a "change of desk" command, hence:

DestroyModuleConfig FvwmEvent-cd: *
*FvwmEvent-cd: Cmd  Function
*FvwmEvent-cd: new_desk  FvwmFuncTestDesk

Then you can define the function 'FvwmFuncTestDesk' to be something
like:

DestroyFunc FvwmFuncTestDesk
AddToFunc   FvwmFuncTestDesk
+ I PipeRead 'test $[desk.n] -eq 3 || test $[desk.n] -eq 4 || \
    test $[desk.n] -eq 5 && echo "Function ChangeStyle" || echo \
    "RestoreStyle"'

AddToFunc RestoreStyle
+ I All (CurrentDesk AcceptsFocus) ThisWindow \
  ("some_window_name") WindowStyle !Sticky
+ I UpdateStyles

DestroyFunc  ChangeStyle
AddToFunc ChangeStyle
+ I All (CurrentDesk AcceptsFocus)  ThisWindow \
  ("some_window_name") WindowStyle Sticky
+ I UpdateStyles

Here what is happening, is that FvwmFuncTestDesk tests to see which desk
number we're on.  If it matches either 3, 4, or 5, then the function
'ChangeStyle' is run.

ChangeStyle then looks for all the windows on the current desk and for a
window called "some_window_name" (you'll have to change this).  If it
matches, it then toggles the window to sticky.

RestoreStyle works in much the same way, but negates the expression so
that for any other desk you change to, the window is never made sticky.

There are a few things you should note -- the window you're wanting to
match should be a unique name, otherwise you might get unexpected
results.

To kick the whole thing off, you will have to ensure that you place the
following line in your 'StartFunction' definition:

+ I Module FvwmEvent FvwmEvent-cd

I haven't tested this, so let me know if it works.

HTH,

-- Thomas Adam

-- 
I know nothing, and understand even less.

---

From: Thomas Adam <[email-masked]>
Date: Thu, 17 Feb 2005 13:17:37 +0000

On Thu, Feb 17, 2005 at 06:43:04PM +0530, Srivathsa Rao U wrote:
> Thomas,

Hello - 

> One more small query. You have mentioned ("some_window_name") is the
> code. Is that mean this will work only for some kind of windows, What
> needs to be done for any window I choose ?

You replace "some_window_name" with the name of whatever window you want
to change.  So for example, let's say I have an rxvt window called
"rxvta" that I always want sticky on desks 3,4,5.  I would change the
example I gace you to be:

+ I All (CurrentDesk AcceptsFocus) ThisWindow \ 
  ("rxvta") WindowStyle !Sticky     

In both the functions where it is defined.

Does that make sense?

-- Thomas Adam