jwm 2.3.6 aerosnap

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

jwm 2.3.6 aerosnap

#1 Post by rufwoof »

As of jwm 2.3.6 aerosnap is supported. Add something like

Code: Select all

    <Group>
        <Option>tiled</Option>
        <Option>aerosnap</Option>
    </Group>
to ~/.jwmrc and when you drag a window title to the top of the screen it will resize to full screen. Or drag to the side of screen and it will resize to half screen. (Handy for quickly getting two spreadsheets nicely side by size for comparing cells in the two spreadsheets).

Looks like it is still being refined by Joe and 2.3.7 is planned to have better support for multiple-monitors.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#2 Post by rockedge »

Thanks!! that is really cool.....works great on my Tahr 6.0.6 systems....

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#3 Post by rufwoof »

Just remember in Puppy you should be editing /etc/xdg/templates/_root_.jwmrc and not ~/.jwmrc (there is a note in the top of that file indicating such IIRC).

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#4 Post by rockedge »

Yes, thanks I modified /etc/xdg/templates/_root_.jwmrc
I use the aerosnap in some setups now, works well!

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#5 Post by rufwoof »

rockedge wrote:Thanks!! that is really cool.....works great on my Tahr 6.0.6 systems....
I see that its already coded into Tahr 6.0.6 ... Menu, Desktop, JWMDesk Manager ... Window Tab, Snap subsection (Aero Snap tickbox)
Attachments
s.png
(74.48 KiB) Downloaded 936 times

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#6 Post by rockedge »

wow your right! that is even cooler....thanks for this tip!

stemsee

#7 Post by stemsee »

Here is pseudo aerosnap should work for all window managers. It uses wmctrl. I use it with sven multimedia keyboard daemon, using win+arrow-keys.
1. Win+Arrow-up toggles full width top half screen, full width bottom half and fill screen (maximise).
2. Win+Arrow-left toggles left-top-quarter/left-bottom-quarter/left-full-height.
3. Win+Arrow-right toggles right-top-quarter / right-bottom-quarter/right-full-height.
4. Win+Arrow-down minimises.
alt+tab to re-maximise

All together nine 9 positions on screen affecting active window.

I named script aerosnap. needs to be run at startup to export functions. call functions like this

Code: Select all

bash -c MTH
bash -c MBH
bash -c ML
bash -c MR

Code: Select all

#!/bin/sh
# uses mctrl for pseudo aerosnap
# by stemsee (C) 2017 Marcos Contant
# use with sven multimedia keyboard daemon
# run aerosnap on Startup to export functions
# win+arrow key, command: bash -c MR|ML|MTH|MBH
#
function MTH () {         # toggles full-width: fill screen  / top half horizontal /bottom half horizontal
res=`xrandr | cut -f8,9,10 -d' ' | cut -f1 -d',' | head -1 | sed 's/ //g'`
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
YY=$((YY / 2 ))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/MTH && ! -e /tmp/MBH ]]; then
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/MTH
elif [[ -e /tmp/MTH ]]; then
	XX=`echo $res | cut -f1 -d'x'`
	YY=`echo $res | cut -f2 -d'x'`
	rm /tmp/MTH
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/MBH
elif [[ -e /tmp/MBH ]]; then
	wmctrl -r :ACTIVE: -e 0,0,$YY,$XX,$YY
	rm /tmp/MBH
fi
}
export -f MTH

function MBH () {      # minimizes
	res=`xrandr | cut -f8,9,10 -d' ' | cut -f1 -d',' | head -1 | sed 's/ //g'`
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
YY=$((YY / 2))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
wmctrl -r :ACTIVE: -b toggle,hidden
}
export -f MBH

function ML () {      # Toggles, Left - top quarter/ bottom quarter/ full-height
	res=`xrandr | cut -f8,9,10 -d' ' | cut -f1 -d',' | head -1 | sed 's/ //g'`
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
XX=$((XX / 2))
YY=$((YY))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/ML && ! -e /tmp/LM ]]; then
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/ML
elif [[ -e /tmp/ML ]]; then
	YY=$((YY / 2))
	rm /tmp/ML
	wmctrl -r :ACTIVE: -e 0,0,$YY,$XX,$YY
	touch /tmp/LM
elif [[ -e /tmp/LM ]]; then
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
XX=$((XX / 2))
YY=$((YY / 2))
wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
rm /tmp/LM
fi
}
export -f ML

function MR () {      # Toggles, Right - top quarter / bottom quarter / full-height
	res=`xrandr | cut -f8,9,10 -d' ' | cut -f1 -d',' | head -1 | sed 's/ //g'`
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
XX=$((XX / 2))
YY=$((YY))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/MR && ! -e /tmp/RM ]]; then
	wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY
	touch /tmp/MR
elif [[ -e /tmp/MR ]]; then
	YY=$((YY / 2))
	rm -f /tmp/MR
	wmctrl -r :ACTIVE: -e 0,$XX,$YY,$XX,$YY
	touch /tmp/RM
elif [[ -e /tmp/RM ]]; then
	XX=`echo $res | cut -f1 -d'x'`
	YY=`echo $res | cut -f2 -d'x'`
	XX=$((XX / 2))
	YY=$((YY / 2))
	wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY
	rm /tmp/RM
fi
}
export -f MR
Code needs tweaking to accomodate decoration on openbox at least. Still better than nothing!
Attachments
xscreenshot-20171027T131706.png
(213.14 KiB) Downloaded 351 times
xscreenshot-20171027T131831.png
(251.63 KiB) Downloaded 342 times
xscreenshot-20171027T131850.png
(148.11 KiB) Downloaded 325 times
xscreenshot-20171027T131908.png
(250 KiB) Downloaded 332 times
xscreenshot-20171027T132002.png
(91.17 KiB) Downloaded 257 times
Last edited by stemsee on Wed 08 Nov 2017, 11:38, edited 7 times in total.

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

#8 Post by recobayu »

Hi Stemsee. I try that code. I make a script file: aerosnap in /usr/bin then I copy all of your code. Then I link symbolic to /root/Startup. After that I restart x win. Then I open terminal and type: bash -c MR. But the text "bash: MR: command not found" appear. How to run that?

I also make a stickyjwm like this in here:
http://murga-linux.com/puppy/viewtopic. ... 550#910550
That also use wmctrl.
:D

stemsee

#9 Post by stemsee »

make the script executable

Code: Select all

chmod 755 /usr/bin/aerosnap
Also install wmctrl package from repository

stemsee

#10 Post by stemsee »

On windows aerosnap provides a central adjuster bar down the middle of the screen. When the cursor grips the bar and is dragged left or right, the affected window narrows accordingly, and after that the remaining window re-maximises to its resized area. I wonder how to do that?

stemsee

#11 Post by stemsee »

My version works best when each function is its own script.
each script provides top, bottom, full-length, either, right, left and full width of screen.
MR

Code: Select all

#!/bin/sh
res=`xwininfo -root | grep -e 'Height' -e 'Width'  | awk '{print $2}'`
XX=`echo $res | awk '{print $1}'` 
YY=`echo $res | awk '{print $2}'`
XX=$((XX / 2))
YY=$((YY))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/MR && ! -e /tmp/RM ]]; then
	wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY
	touch /tmp/MR
elif [[ -e /tmp/MR ]]; then
	YY=$((YY / 2 ))
	rm -f /tmp/MR
	wmctrl -r :ACTIVE: -e 0,$XX,$YY,$XX,$YY
	touch /tmp/RM
elif [[ -e /tmp/RM ]]; then
	XX=`echo $res | awk '{print $1}'` 
	YY=`echo $res | awk '{print $2}'`
	XX=$((XX / 2))
	YY=$((YY / 2))
	wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY
	rm /tmp/RM
fi
ML

Code: Select all

#!/bin/sh
res=`xwininfo -root | grep -e 'Height' -e 'Width'  | awk '{print $2}'`
XX=`echo $res | awk '{print $1}'` 
YY=`echo $res | awk '{print $2}'`
XX=$((XX / 2))
YY=$((YY))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/ML && ! -e /tmp/LM ]]; then
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/ML
elif [[ -e /tmp/ML ]]; then
	YY=$((YY / 2))
	rm /tmp/ML
	wmctrl -r :ACTIVE: -e 0,0,$YY,$XX,$YY
	touch /tmp/LM
elif [[ -e /tmp/LM ]]; then
	XX=`echo $res | awk '{print $1}'` 
	YY=`echo $res | awk '{print $2}'`
	XX=$((XX / 2))
	YY=$((YY / 2))
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	rm /tmp/LM
fi
MTH

Code: Select all

#!/bin/sh
res=`xwininfo -root | grep -e 'Height' -e 'Width'  | awk '{print $2}'`
XX=`echo $res | awk '{print $1}'` 
YY=`echo $res | awk '{print $2}'`
YY=$((YY / 2))
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
if [[ ! -e /tmp/MTH && ! -e /tmp/MBH ]]; then
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/MTH
elif [[ -e /tmp/MTH ]]; then
	XX=`echo $res | awk '{print $1}'` 
	YY=`echo $res | awk '{print $2}'`
	rm /tmp/MTH
	wmctrl -r :ACTIVE: -e 0,0,0,$XX,$YY
	touch /tmp/MBH
elif [[ -e /tmp/MBH ]]; then
	wmctrl -r :ACTIVE: -e 0,0,$YY,$XX,$YY
	rm /tmp/MBH
fi
MM

Code: Select all

#!/bin/sh 
res=`xwininfo -root | grep -e 'Height' -e 'Width'  | awk '{print $2}'` 
XX=`echo $res | awk '{print $1}'` 
YY=`echo $res | awk '{print $2}'` 
XX=$((XX / 3)) 
YY=$((YY)) 
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert 
if [[ ! -e /tmp/MR && ! -e /tmp/RM ]]; then 
   wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY 
   touch /tmp/MR 
elif [[ -e /tmp/MR ]]; then 
   YY=$((YY / 3)) 
   rm -f /tmp/MR 
   wmctrl -r :ACTIVE: -e 0,$XX,$YY,$XX,$YY 
   touch /tmp/RM 
elif [[ -e /tmp/RM ]]; then 
        XX=`echo $res | awk '{print $1}'` 
        YY=`echo $res | awk '{print $2}'` 
   XX=$((XX / 3)) 
   YY=$((YY / 3)) 
   wmctrl -r :ACTIVE: -e 0,$XX,0,$XX,$YY 
   rm /tmp/RM 
fi 
MBH

Code: Select all

#!/bin/sh
#mnimise to tray
wmctrl -r :ACTIVE: -b remove,maximized_horz,maximized_vert
wmctrl -r :ACTIVE: -b toggle,hidden
Attachments
out_2018-01-12_104110.gif
(187.32 KiB) Downloaded 581 times
Last edited by stemsee on Sun 14 Jan 2018, 14:18, edited 1 time in total.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#12 Post by tallboy »

Cool! Thank you stemsee.
When I used fvwm as a WM in RedHat and Debian, I made custom buttons in the title line to perform similar moves. The buttons had a graphical layout made to show the expected position and size of the window when clicked.
True freedom is a live Puppy on a multisession CD/DVD.

stemsee

#13 Post by stemsee »

Hi Tallboy

I use winkey+(right_arrow|left_arrow|up_arrow) for MR ML MTH respectively in sven multimedia keyboard daemon. Press one keycombo for thrie for three layouts. Top|Full length|Bottom ; Right|Ful-width|Left etc

Then only need to position the mouse to activate chosen window.

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

#14 Post by musher0 »

Good work,stemsee.

I suppose this is the closest thing to tiling you can get from within a cascading
window manager, such as icewm, jwm, waimea or pekwm.

To state the obvious, to get your windows really tiled side by side on your desktop,
one needs a real tiling window manager, such as echinus or dwm.

I did test your functions in echinus, a tiling window manager, and they work fine.

I am a bit disappointed that your scripts can not automatically tile, say, four apps,
two side by side at the top and two side by side at the bottom, on the same desktop.
Only one app at a time, eh?

But as you say, this type of tiling "is better than nothing"! Plus you have these
resizing functions "on call", with your win-arrow system.

One nice thing about your scripts is that they can be incorporated in waimea's and
pekwm's "window menus".

Good continuation! :) BFN.

~~~~~~~~~~~~~~
PS -- For the record, MochiMopei did similar work in 2015:
http://murga-linux.com/puppy/viewtopic. ... 42&t=97950
Also forum member recobayu:
http://murga-linux.com/puppy/viewtopic. ... ost#825303
Attachments
your-MR-script-added-to-waimea.jpg
(52.86 KiB) Downloaded 503 times
tiling-in-echinus-WM.jpg
(By comparison)
(78.94 KiB) Downloaded 551 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

stemsee

#15 Post by stemsee »

Hi Musher0

Thanks for testing, and providing feedback and a priori scripts by real programmers whose scripts seem tied to jwm. I use this in openbox and jwm.

I think i should be easy to auto-tile 2/4/5/6/7/8/9/10+ windows with two arrow keys combo. The maths is simple and the arrangements could auto divide the screen into columns and rows according to how many windows are open. However I don't need it. Three columns instead of two interests me, along with three rows. Also auto quad and auto halves would be most useful for 1080p desktop.

I have a 4k tv display at hand, so 16nths (4x4) might be useful at some point (video montage)! Also Qemu multi-seat for 4.

I also like that MochiMopel's script remembers original size and position and can restore it.
Feel free to adapt the scripts as suits you. There is also one other script which minimises with win+down_arrow, but then alt+tab to call it back!

stemsee

#16 Post by stemsee »

So I was trying to script quads and halves but there seems to be no reliable way to count open windows.

for counting open windows I got

Code: Select all

wmctrl -l | wc -l
for terms

Code: Select all

who | awk 'END{print NR - 1}'
Problem is that Geany is counted in both cases. But terms are counted only in the later case. So use code and exclude term in window manipulations, or include geany in both manipulation strategies? One for non-terms and one for terms.

Any ideas?

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

#17 Post by musher0 »

Hehe. My wmctrl counts terms just fine. But it's also counting each and every Conky configuration !!!
wmctrl -l
0x00c0000a 0 puppypc# sam. 13 jan. 18
0x00e00005 0 puppypc # xload
0x02600001 -1 puppypc # Conky (puppypc #)
0x02800001 -1 puppypc # Conky (puppypc #)
0x02a00001 -1 puppypc # Conky (puppypc #)
0x02c00001 -1 puppypc # Conky (puppypc #)
0x01e00002 -1 N/A N/A
0x01c00015 0 puppypc # Puppy Linux Discussion Forum :: View topic - jwm 2.3.6 aerosnap - Opera
0x02400001 -1 puppypc # Conky (puppypc #)
0x03200006 2 puppypc # Console1
My formula has to be:

Code: Select all

wmctrl -l | grep -v Conky | wc -l
5
Don't ask me what that sticky "N/A" program is !!! Hm. It has to be
bmpanel2. I have no merit, xwininfo sort of told me!!!

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

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

#18 Post by MochiMoppel »

stemsee wrote:

Code: Select all

who | awk 'END{print NR - 1}'
who?

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

#19 Post by musher0 »

I have never heard of this person!!! :lol: ;)

~~~~~~~~~
Seriously, back to the formula, this one is much better, in that it skips all the stickies:

Code: Select all

wmctrl -l | grep -v "\-1"
BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

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

#20 Post by MochiMoppel »

stemsee wrote:My version works best when each function is its own script.
Your version would work even better than best if it would get the screen dimension right :wink:
I remember a discusion with SFR about this problem (see here).

I also strongly recommend not to use xrandr for the job. In my private collection of code snippets that calculate screen dimension (28 by last count :lol: ) those using xrandr are the slowest.

Post Reply