Question about remember the normal size of window

I use an example to express my question:
The normal size of a window, say firefox, is 800x600.
I quit it after maximized.

Then I run the program again, and found that the window’s normal size is set as large as the maximized size.

How can I start the program in maximized states and still keep the window’s original normal size?

I know that use the resize and maximize command in FvwmEvent can do this, but it will cause a flash of the window at startup.

Something like this?

edulinux.homeunix.org/fvwm/fvwmc … q.html#WP2

– Thomas Adam

Not really.
What I want is not only remember the maximized state of a window, but also the origin normal size of the window.

It means (an example):
A window’s normal size is 820x500.
Set it in maximized state the window size change to 1024x768.
quit and run it again:
the window is set to maximized state.
Set it in normal state, the size of the window will back to 820x500.

Right. You can’t get around this directly, other than to do:

Style foo !UsePPosition, UseUSPosition, FixedSize

– Thomas Adam

I don’t understand why you use FixedSize here. Even a window is in the FixedSize style, set it in maximized state and then restart it, the window size will still be set as the size of maximized.

Any method to set a window’s normal state size, but not set it to normal state at once?

Here is the code:

AddToFunc StartFunction
+ I Module FvwmEvent

DestroyModuleConfig FvwmEvent: *
*FvwmEvent: Cmd
*FvwmEvent: add_window FuncAW
*FvwmEvent: destroy_window FuncDW

DestroyFunc FuncAW
AddToFunc   FuncAW
+ I ThisWindow PipeRead `if [ '$[w.width]' -gt 1000 ] && [ '$[w.height]' -gt 750 ]; \
	then echo 'ThisWindow Maximize True';\
	if [ -f '$[HOME]/.fvwm/winpos/$[w.class]' ];\
	then read ax ay aw ah <'$[HOME]/.fvwm/winpos/$[w.class]';\
	else ax=110;ay=60;aw=800;ah=600;\
	fi;\
	echo SetEnv x-$[w.id] $ax;\
	echo SetEnv y-$[w.id] $ay;\
	echo SetEnv w-$[w.id] $aw;\
	echo SetEnv h-$[w.id] $ah;\
	fi`
+ I ThisWindow (Iconic) IconifyAndRearrange

DestroyFunc FuncDW
AddToFunc   FuncDW
+ I ThisWindow Test (EnvIsSet x-$[w.id], EnvIsSet w-$[w.id], EnvIsSet y-$[w.id], EnvIsSet h-$[w.id])\
	PipeRead `echo PipeRead\
	\\"echo \\'\\$\\[x-$[w.id]\\] \\$\\[y-$[w.id]\\] \\$\\[w-$[w.id]\\] \\$\\[h-$[w.id]\\]\\'\
	\\>"$[HOME]/.fvwm/winpos/$[w.id]"\\;\
	mv "$[HOME]/.fvwm/winpos/$[w.id]" \\'$[HOME]/.fvwm/winpos/$[w.class]\\'\\"`
+ I ThisWindow PipeRead `echo -e "UnsetEnv x-$[w.id]\\nUnsetEnv y-$[w.id]\\nUnsetEnv w-$[w.id]\\nUnsetEnv h-$[w.id]"`

DestroyFunc CustomMaximize
AddToFunc   CustomMaximize
+ I ThisWindow (Maximized) PipeRead "echo ResizeMove \\$\\[w-$[w.id]\\]p \\$\\[h-$[w.id]\\]p \\$\\[x-$[w.id]\\]p \\$\\[y-$[w.id]\\]p"
+ I TestRc (Match) Break
+ I ThisWindow SetEnv w-$[w.id] $[w.width]
+ I ThisWindow SetEnv h-$[w.id] $[w.height]
+ I ThisWindow SetEnv x-$[w.id] $[w.x]
+ I ThisWindow SetEnv y-$[w.id] $[w.y]
+ I Maximize $*

use the CustomMaximize instead of Maximize

Good god! That’s not pretty – especially not with all the SetEnvs. What you really want to do is use a Session Manager - or at least understand how --geometry settings work.

– Thomas Adam

To prove a point, really. Nothing more.

No – since Firefox and Mozilla take delight in breaking the ICCCM. You should be complaining to them about it. Essentially you’re under the impression that the window has a normal state of size other than when it were maximized. This just isn’t true with apps such as Firefox and Mozilla who will remember their size no matter what.

That’s why you should get FVWM to ignore PPosition and to use UseUSPosition. This will then allow to use -width and -height attributes of Firefox. Although it really ought to be accepting -geometry strings. It’s just broken, and needs fixing upstream. You could go down the complex scripting route, but it needs redefining as the use of setenvs is appauling. You’ll be polluting the environment for every new instance of Firefox or whatever you happen to run each time. In the scripts you have posted, you don’t have any “UnSetEnv” lines which I strongly suggest you consider using if you are going to go down that horrible route.

– Thomas.

I do not like complaining, and I don’t care whether the session manager or the window manager to manager the initial geometry of a window too. My code’s work is to keep a window’s “normal size” if the window is started in fullscreen size – It will still start in fullscreen size, while keeping the normal size before it quit. I am not idea whether the --geometry can do this work.

What I cannot understand is,
Why a window cannot have a normal size while it keep in maximized?
Why a window quit it should loss the information about the normal size?
Why a window whould loss the maximized state when it quit?
Why these information can be kept in gNOME or KDE?
Why a window will be set to Maximized state (but not fullscreen size) if it is quited in gNOME with Maximized state?

FVWM cannot do as I hope, of cause I can extend its function.

I hope 100 Windows with 100*4=400 environment variables won’t be too many to FVWM. Of cause I do not know the strength of FVWM. Luckly, I usually will open up less then 15 windows, and the FVWM seems that can manage these 60 environment variables, and my code works very well until now.
Maybe the environment variables would be passed down to the subsessions started by fvwm in some case, and this may do harm to the subsession. But this have not happened yet.

At last I hope you read my codes carefully before posting a reply,

In fact

I think this line

+ I ThisWindow PipeRead `echo -e "UnsetEnv x-$[w.id]\\nUnsetEnv y-$[w.id]\\nUnsetEnv w-$[w.id]\\nUnsetEnv h-$[w.id]"`

can unset the enviroments.

Most windows do – it’s just certain applications that decide remembering its size, is a good idea, whilst breaking ICCCM guidelines.

This is the because developers of certain EWMH apps delight in being assholes when it comes to compatability. You can pretty much attribute this as an answer to the rest of your questions. :stuck_out_tongue:

Thomas.