JWM: How to avoid overlapping windows

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

JWM: How to avoid overlapping windows

#1 Post by MochiMoppel »

When opening a new window in JWM, chances are that it overlaps existing windows. Extemely annoying when creating new ROX windows. Though it is possible in JWM's Group settings to set a tiled option for specific programs, there is no obvious setting to apply a Group option globally for all programs.

To tile every new window (provided it fits into a free space), add following setting to the file /root/.jwm/jwmrc-personal:

Code: Select all

<Group>
	<Name>.*</Name>
	<Option>tiled</Option>
</Group>
EDIT 2015-03-11
In my original post I proposed to create 5 individual <Name> entries, each containing a vowel of the alphabet. This works reasonably, but would not match names without a vowel and also would be case sensitive. Above new setting matches every possible name.

EDIT 2017-01-21
It appears that with a misspelled <Name> or <Class> tag (they are case sensitive!) JWM applies the settings to every window. And if JWM doesn't recognize misspelled tags we might as well omit them. Of course that's an undocumented behavior, so no guarantees here. This is what works for me in JWM 2.2 to tile every window:

Code: Select all

<Group>
	<Option>tiled</Option>
</Group>
 
 
Attachments
Tiled_windows.png
(180.81 KiB) Downloaded 1294 times
Last edited by MochiMoppel on Sat 21 Jan 2017, 07:56, edited 3 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Thanks for this trick Mochi.

Of course you could use instead the echinus window manager, which does
tiling OR cascading on the touch of a couple of keyboard keys.

Did you do anything to your illustration, or do you have a new type of monitor?
(I mean the upward rectangle shape.)

Bye for now.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#3 Post by greengeek »

Hmmm, doesn't seem to work for me. (Slacko 5.6 derivative). I restarted jwm after making the change but windows still overlap. My version as follows:

Code: Select all

# jwm -v
JWM vgit-895
Any suggestions what I can try as troubleshooting steps? Here is my /root/.jwm/jwmrc-personal

EDIT : Actually it does partially work for me. If there is room for the whole window it will tile it, but if the window is too big it will plonk it anywhere on top of others. Also, some windows (regardless of size -eg: rubix cube) want to sit on top.
Still useful though - it gives most windows more daylight so I can access them better. Time for me to get a widescreen like ETP and Q5sys have :twisted:

Code: Select all

<!-- Personally configurable options for JWM: these override default settings and theme settings -->

<JWM>

<!-- Number of virtual desktops -->
<Desktops width="3" height="1"/>

<!-- Double click speed (in milliseconds) -->
<DoubleClickSpeed>400</DoubleClickSpeed>

<!-- Double click delta (in pixels) -->
<DoubleClickDelta>3</DoubleClickDelta>

<!-- The focus model (sloppy or click) -->
<FocusModel>click</FocusModel>

<!-- The snap mode (none, screen, or border) -->
<SnapMode distance="10">none</SnapMode>

<!-- The move mode (outline or opaque) -->
<MoveMode>outline</MoveMode>

<!-- The resize mode (outline or opaque) -->
<ResizeMode>outline</ResizeMode>

<WindowStyle>
  <Height>22</Height>
</WindowStyle>

<Group>
   <Name>a</Name>
   <Name>i</Name>
   <Name>u</Name>
   <Name>e</Name>
   <Name>o</Name>
   <Option>tiled</Option>
</Group>

<!-- Key bindings -->
<Key key="Up">up</Key>
<Key key="Down">down</Key>
<Key key="Right">right</Key>
<Key key="Left">left</Key>
<Key key="h">left</Key>
<Key key="j">down</Key>
<Key key="k">up</Key>
<Key key="l">right</Key>
<Key key="Return">select</Key>
<Key key="Escape">escape</Key>	
<Key key="F12">root:3</Key>

<Key mask="A" key="Tab">next</Key>
<Key mask="A" key="F4">close</Key>
<Key mask="A" key="F10">maximize</Key>
<Key mask="A" key="F6">minimize</Key>
<Key mask="A" key="#">desktop#</Key>
<Key mask="A" key="F1">root:3</Key>
<Key mask="A" key="F2">window</Key>
<Key mask="CS" key="c">exec:xclip -o|xclip -sel clip</Key>

<Key keycode="160">exec:amixer sset Master toggle</Key>
<Key keycode="176">exec:amixer sset Master 1+,1+</Key>
<Key keycode="174">exec:amixer sset Master 1-,1-</Key>
<Key keycode="178">exec:defaultbrowser</Key>
<Key keycode="236">exec:defaultbrowser</Key>
<Key keycode="111">exec:tas</Key>

</JWM>
Attachments
tiling.jpg
(58.68 KiB) Downloaded 1134 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hi, greengeek.

Your illustration "speaks" more than Mochi's, to me anyway. Mochi's is
indeed a nice trick, but why one would want to turn jwm into a tiling
WM beats me! :) jwm is ok as it is, faults and all! :)

(I never thought that I'd ever say that "jwm is ok as it is": I always
said that I hated that animal! I must be coming down with a flu...) :twisted:

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Jasper

#5 Post by Jasper »

Hi MochiMoppel et al,

Well, I often open two or three windows (nowadays, rarely four or more) so I don't actually need it, but, indubitably, it's ingenuity which confirms MochiMoppel as a JWM Master and a great Puppy contributor.

MochiMoppel, thank you for your other recent JWM tips and also for your ppm innovations which you published just before last Christmas.

My regards

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#6 Post by L18L »

Though I do have 12 windows open at the moment:

+1 :D

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#7 Post by greengeek »

I think this function could be enhanced even further if there was a way to control the geometry of each window being opened - for example Geany has a tendency to open a window that is over half the width of my screen, which means a second session of geany can't be tiled and sits pretty much on top of the first - maybe I could make a wrapper script telling Geany to open with max width of "less_than_half_screen_width" which would allow the tiling to do its job more easily.

The tiling idea does make it so much easier to pick up the correct window rather than having to hunt through minimised tabs at the bottom of screen.

(side note: I wonder if there is a way to alter the degree of overlapping of windows - ie rather than having full edge-to-edge tiling instead allow an overlap of say a third of the window? Normal Rox behaviour overlaps 95% of the window and leaves the title bar exposed/offset but tiling overlaps 0%. Maybe there is a way to get somewhere in between if screen size is insufficient to make the best use of tiling?)

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#8 Post by L18L »

greengeek wrote:Normal Rox behaviour overlaps 95% of the window and leaves the title bar exposed/offset but tiling overlaps 0%.
Normal user behaviour is to choose Maximum Windowsize in rox Options .
Try 50% please :wink:

I was just guessing this Maximum Windowsize as with me it is translated Maximale Fenstergröße.

Hope that helps

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#9 Post by MochiMoppel »

greengeek wrote:I think this function could be enhanced even further if there was a way to control the geometry of each window being opened - for example Geany has a tendency to open a window that is over half the width of my screen
This is strange. Geany remembers its last window size and saves it to its config file (e.g. geometry=0;19;452;356;0; ), so you decide how it opens. This also applies to additional instances.

BTW: Rubix tiles here as any other window.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#10 Post by greengeek »

MochiMoppel wrote:This is strange. Geany remembers its last window size and saves it to its config file (e.g. geometry=0;19;452;356;0; ), so you decide how it opens. This also applies to additional instances.
Thanks, I had not previously noticed that Geany does that - however it only does it on my system after I have saved a file and closed that instance of geany (there is no pre-existing geany config file because each of my sessions is 'live' with no savefile retention)
BTW: Rubix tiles here as any other window.
Yes, I see now that it seems to tile correctly - although if you try to open multiple instances it will eventually revert to standard rox behaviour and 'offset down' by the height of the title bar.
L18L wrote:Normal user behaviour is to choose Maximum Windowsize in rox Options .
Try 50% please
That seems to work for Filer windows only - not any others. Thanks for the tip though - this will still be beneficial to help me make better use of screen space.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#11 Post by MochiMoppel »

greengeek wrote: it only does it on my system after I have saved a file and closed that instance of geany (there is no pre-existing geany config file because each of my sessions is 'live' with no savefile retention)
Another mystery? I bet that there is a pre-existing geany.conf. All distributions I know have one. This has nothing to do with savefiles. Initial settings differ: In Slacko a Geany window out-of-the-box is 921px wide, in Lucid 676. If you remove the config file completely a Geany window is set to 900x625. If this is all too big for you you can try to open Geany with an alternate config folder (geany --config <folderpath> )and your preferred settings
if you try to open multiple instances it will eventually revert to standard rox behaviour and 'offset down' by the height of the title bar.
Hmm..I still don't understand what you expect. They tile if there is enough space, they don't if there is not. Additional windows have to go somewhere. And that they offset instead of piling up in one place is a very clever concept..

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#12 Post by recobayu »

What is 'a, i, u, e, o' mean in the group you write?
Or the important thing is the 'tiled'?

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#13 Post by greengeek »

MochiMoppel wrote:Another mystery? I bet that there is a pre-existing geany.conf. All distributions I know have one.
You are correct. I am at a loss to explain why I thought the previous behaviour was the progressive offsetting that jwm normally does. I see now that the previous behaviour was that all geany instances opened up with the geometry specified in that config file. Except that the position of new geany windows does change after I first change the current window position and save whatever text file i was working on.
Hmm..I still don't understand what you expect. They tile if there is enough space, they don't if there is not. Additional windows have to go somewhere. And that they offset instead of piling up in one place is a very clever concept..
I was just confused by the fact that your pic did not show any overlapping windows at all, yet when I first ran rubix it failed to tile even though my eye judged that there was enough room for it to do so (there actually wasn't quite enough room). The tiling is a handy feature and I compliment you on such a simple solution.

I think the best way for me to use the tiling is to also limit RoxFiler windows using the max size option mentioned by L18L, and limit geany and leafpad window size to something more tileable.
.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#14 Post by MochiMoppel »

@recobaya: 'a, i, u, e, o' are all vowels (in Japanese alphabet order). Order is not important, their presence is.

@greengeek: I'm relieved that we sorted this out :lol: I found one application that can't be tiled: Xsoldier space war (in Slacko menu). This window has no WM_CLASS property, so no name. None of JWM's Group settings would work.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#15 Post by greengeek »

MochiMoppel wrote:@greengeek: I'm relieved that we sorted this out :lol:
Yeah, thanks for your patience :-)
Just one more annoying question - can you think of any way I can alter the geany config file so i can specify the default height and width without specifying the x and y position in the geometry spec? I'd like to leave the x,y up to rox so it doesnt keep opening at the same position.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#16 Post by MochiMoppel »

greengeek wrote: can you think of any way I can alter the geany config file so i can specify the default height and width without specifying the x and y position in the geometry spec?

Code: Select all

#!/bin/sh
#Start geany with fixed dimension
WIDTH=600
HEIGHT=400
sed -i "s/^geometry=\([0-9]*;[0-9]*\).*\(;[0-9]*;\)$/geometry=\1;$WIDTH;$HEIGHT\2/" /root/.config/geany/geany.conf
exec geany

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#17 Post by greengeek »

MochiMoppel wrote:#Start geany with fixed dimension
Wow, thanks - that's very clever. I can tailor that to help me with several different uses.

I was not clear enough in my request though - what I meant is that I find the tiling does not work for geany if there is a /root/.config/geany/geany.conf present. If that file is present the geometry spec determines where new instances of geany are placed. I wondered if it was possible to make jwm ignore the x,y portion of that geometry and go ahead with the tiling. Or is geany one of those programmes that does not permit tiling? (It does seem to tile if I delete the /root/.config/geany directory - but only the once - and of course it then opens in it's default size which compromises the tiling of the next programme windows that are started...)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#18 Post by MochiMoppel »

3 possible solutions. Take your pick:

Solution 1

Code: Select all

#!/bin/sh 
#Start geany with fixed dimension but without fixed location
WIDTH=600 
HEIGHT=400
sed -i "s/^geometry=.*$/geometry=-1;-1;$WIDTH;$HEIGHT;0;/" /root/.config/geany/geany.conf 
exec geany
Solution 2

If you don't care about window size and only want geany to tile, there is an easier solution:
  • Edit -> Preferences -> General -> untick [ ] Save window position and geometry
At startup geany will completely ignore the geometry setting and start with its default size.

Solution 3 (probably the best!)

Forget everything above and add another group:
  • <Group>
    <Name>geany</Name>
    <Option>pignore</Option>
    </Group>
pignore: Ignore program-specified initial position
I tried to add pignore option to the tiled group, but this can be too radical. Windows that are supposed to be centered now appear wherever there is space. Tiles everywhere....looks like Win 8 :cry:

.
Last edited by MochiMoppel on Fri 06 Mar 2015, 11:32, edited 1 time in total.

Jasper

#19 Post by Jasper »

Though (1) not quite on topic (2) perhaps not more generally applicable (42) please see the screen shot.
Attachments
Shot=42.png
(50.17 KiB) Downloaded 702 times

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#20 Post by greengeek »

.
Thank you very much for these options Mochi!!
MochiMoppel wrote:Solution 3
Forget everything above and add another group:
  • <Group>
    <Name>geany</Name>
    <Option>pignore</Option>
    </Group>
Maybe i was doing something wrong but I could not get this to work.
Solution 2If you don't care about window size and only want geany to tile, there is an easier solution:
  • Edit -> Preferences -> General -> untick [ ] Save window position and geometry
At startup geany will completely ignore the geometry setting and start with its default size.
Easy solution but unsatisfactory for me as my screen real estate is inadequate to allow geany to adopt its default size and still tile.
Solution 1

Code: Select all

#!/bin/sh 
#Start geany with fixed dimension but without fixed location
WIDTH=600 
HEIGHT=400
sed -i "s/^geometry=.*$/geometry=-1;-1;$WIDTH;$HEIGHT;0;/" /root/.config/geany/geany.conf 
exec geany
This is almost perfect for my needs. I have used this as the basis of a "geanystart" script and have also included a method used by SFR to set window width and height relative to actual screen size. Here is my resulting script:

Code: Select all

#!/bin/sh
#Start geany with fixed dimension but without fixed location (so as to permit tiling to occur)
#Requires Mochi's mod to allow tiling to occur.
#Thread here: http://murga-linux.com/puppy/viewtopic.php?p=831585#831585
#Method ex MochiMoppel 2015_March_3 with screen resolution determination using an
#SFR method, and calculating slightly less than half width as the new X for geany.
#greengeek 2015_March_8

#==============================================================================
#This section not currently in use. Ignore it.
#Uncomment as required.
#Only pay attention to this section if you want to try setting geany size to
#specific percentages of screen width and height. (taken from xvkbd starter script)
#SFR's method of placing xvkbd window, combined with greengeek mod for reference +/- from vertical centreline
#W_PERCENT=50			# XVKBD width (percent of total screen width)
#H_PERCENT=20			# XVKBD height (percent of total sceent height)
#OFFSET_FROM_CENTRE=-10	# XVKBD offset from the vertical centreline of the screen (negative values acceptable)
#OFFSET_FROM_BOTTOM=53	# XVKBD offset from the bottom edge of the screen
# =============================================================================


#Determine screen size before deciding how big to make geany 
read MAXX MAXY <<< `xwininfo -root | awk 'NR>=8&&NR<=9 {print $2}'`

#Geany width calculation:
#Calculate how wide geany should be:

#NEWX=proposed width of geany window. You can choose a percentage calculation: 
#NEWX=$((($MAXX*$W_PERCENT)/100))

#Or you can calculate some other way (like half available resolution):
# Halve the screenwidth then subtract extra 5 pixels:
#(aiming for two geany instances side by side)
NEWX=$((($MAXX/2)-5))

#or set an integer value:
#NEWX=300
echo $NEWX

#Geany height calculation:
#Calculate how high geany should be:

#NEWY=proposed height of geany window. You can choose a percentage calculation: 
#Y=$((($MAXY*$H_PERCENT)/100))

#Or calculate some other way (like half available resolution):
#Y=$((($MAXY/2)-5))

#or set an integer value
#I'm just going to set a specific height for now:
NEWY=250
echo $NEWY

#Mochi method of changing geany .config file:
sed -i "s/^geometry=.*$/geometry=-1;-1;$NEWX;$NEWY;0;/" /root/.config/geany/geany.conf

exec geany
Attachments
TileFinal.jpg
(63.94 KiB) Downloaded 594 times

Post Reply