Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 21 Apr 2015, 22:02
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
JWM: How to quickly display 2 windows side-by-side
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 649
Location: Japan

PostPosted: Sun 01 Mar 2015, 00:43    Post_subject:  JWM: How to quickly display 2 windows side-by-side
Sub_title: Keyboard shortcuts to snap windows to screen edges
 

A user made a request to mimic the AeroSnap function of Windows 7 with JWM. I don't know if it is useful for anyone else, but I gave it a shot.
AeroSnap lets you quickly snap a window to any of the 4 screen edges, resizing it to half of screen size. This makes it easy to display 2 windows side-by-side.

The following steps will add 4 keyboard shortcuts Ctrl+Alt+Left/Top/Right/Down to JWM's configuration. The code requires wmctrl to be installed. Please note that the windows will be horizontally or vertically maximized. This allows to restore them (approximately!) to their previous size.

Step 1: Open file /root/.jwm/jwmrc-personal with an editor
Step 2: Insert following 4 red lines (If your browser shows more than 4 lines: copy the whole red section to your editor. This will eliminate any confusing line wraps and you should end up with only 4 lines)
Step 3: Save jwmrc-personal
Step 4: Restart JWM (Menu: Shutdown > Restart JWM or from Terminal: jwm -restart)

<Key keycode="236">exec:defaultbrowser</Key>
<Key keycode="111">exec:tas</Key>


<Key mask="AC" key="Left"> exec:SW=$(($(cat /tmp/pup_event_frontend_scrn_x)/2));wmctrl -r :ACTIVE: -e 0,0,-1,$SW,-1; wmctrl -r :ACTIVE: -b add,maximized_vert</Key>
<Key mask="AC" key="Right">exec:SW=$(($(cat /tmp/pup_event_frontend_scrn_x)/2));wmctrl -r :ACTIVE: -e 0,$SW,-1,$SW,-1;wmctrl -r :ACTIVE: -b add,maximized_vert</Key>
<Key mask="AC" key="Up"> exec:SH=$(($(cat /tmp/pup_event_frontend_scrn_y)/2));wmctrl -r :ACTIVE: -e 0,-1,0,-1,$SH; wmctrl -r :ACTIVE: -b add,maximized_horz</Key>
<Key mask="AC" key="Down"> exec:SH=$(($(cat /tmp/pup_event_frontend_scrn_y)/2));wmctrl -r :ACTIVE: -e 0,-1,$SH,-1,$SH;wmctrl -r :ACTIVE: -b add,maximized_horz</Key>

</JWM>

That's all.
puppy_aerosnap.png
 Description   
 Filesize   228.92 KB
 Viewed   410 Time(s)

puppy_aerosnap.png

Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2853
Location: www.eussenheim.de/

PostPosted: Sun 01 Mar 2015, 06:35    Post_subject: Re: JWM: How to quickly display 2 windows side-by-side
Sub_title: Keyboard shortcuts to snap windows to screen edges
 

Gave it a shot in Puppy Precise 5.7.1
Works like a charm.
Thank you.
side-by-side.png
 Description   
 Filesize   49.4 KB
 Viewed   371 Time(s)

side-by-side.png

Back to top
View user's profile Send_private_message 
recobayu


Joined: 15 Sep 2010
Posts: 141
Location: indonesia

PostPosted: Sun 01 Mar 2015, 13:55    Post_subject:  

Great! Finally, someone use this method. Thanks Mochi. Your script is very very simple. Ohya, in the new jwm like Tahrpup, the windows key is work nice. So we can change
Code:
<Key mask="AC" key="Left">

by
Code:
<Key mask="4" key="Left">

then we can control window position by win + arrow. Wink just like cinnamon and wdz10 did.
I'm so sorry about your personal jwmrc. Crying or Very sad
I think usually I install a new pet comes from this universe into a 'prefix = ram' puppy.
Back to top
View user's profile Send_private_message 
Puppus Dogfellow


Joined: 07 Jan 2013
Posts: 818
Location: nyc

PostPosted: Sun 01 Mar 2015, 23:29    Post_subject: Re: JWM: How to quickly display 2 windows side-by-side
Sub_title: Keyboard shortcuts to snap windows to screen edges
 

MochiMoppel wrote:
A user made a request to mimic the AeroSnap function of Windows 7 with JWM. I don't know if it is useful for anyone else, but I gave it a shot.
AeroSnap lets you quickly snap a window to any of the 4 screen edges, resizing it to half of screen size. This makes it easy to display 2 windows side-by-side.

The following steps will add 4 keyboard shortcuts Ctrl+Alt+Left/Top/Right/Down to JWM's configuration. The code requires wmctrl to be installed. Please note that the windows will be horizontally or vertically maximized. This allows to restore them (approximately!) to their previous size.

Step 1: Open file /root/.jwm/jwmrc-personal with an editor
Step 2: Insert following 4 red lines (If your browser shows more than 4 lines: copy the whole red section to your editor. This will eliminate any confusing line wraps and you should end up with only 4 lines)
Step 3: Save jwmrc-personal
Step 4: Restart JWM (Menu: Shutdown > Restart JWM or from Terminal: jwm -restart)

<Key keycode="236">exec:defaultbrowser</Key>
<Key keycode="111">exec:tas</Key>


<Key mask="AC" key="Left"> exec:SW=$(($(cat /tmp/pup_event_frontend_scrn_x)/2));wmctrl -r :ACTIVE: -e 0,0,-1,$SW,-1; wmctrl -r :ACTIVE: -b add,maximized_vert</Key>
<Key mask="AC" key="Right">exec:SW=$(($(cat /tmp/pup_event_frontend_scrn_x)/2));wmctrl -r :ACTIVE: -e 0,$SW,-1,$SW,-1;wmctrl -r :ACTIVE: -b add,maximized_vert</Key>
<Key mask="AC" key="Up"> exec:SH=$(($(cat /tmp/pup_event_frontend_scrn_y)/2));wmctrl -r :ACTIVE: -e 0,-1,0,-1,$SH; wmctrl -r :ACTIVE: -b add,maximized_horz</Key>
<Key mask="AC" key="Down"> exec:SH=$(($(cat /tmp/pup_event_frontend_scrn_y)/2));wmctrl -r :ACTIVE: -e 0,-1,$SH,-1,$SH;wmctrl -r :ACTIVE: -b add,maximized_horz</Key>

</JWM>

That's all.


this is potentially much nicer, neater, and more convenient than what i have, that i already have it notwithstanding.
Very Happy

Mochi, how can i get wmctrl to work on a specific screen/monitor, or more directly to the point, how can your code be adapted to work on the second, or third (etc) monitor? i can't find the part of puppy that identifies each screen as an individual entity--i thought your "pup_event_frontend_scrn_y" might be the clue i needed, but--if it is, i still don't get it.
Confused


and not something i'm interested in, but since it's come up before--do you know what would make a dragged window snap to a given edge like the OP was requesting? i know ETP had something like that--is it a mouse thing or a move onto script thing or... just curious and in case it comes up again.

also, thanks in advance and thanks once again for the nearly countless tweaks you've helped me make to my setups.
Back to top
View user's profile Send_private_message 
step

Joined: 04 May 2012
Posts: 290

PostPosted: Wed 04 Mar 2015, 16:25    Post_subject:  

On Windows I'm addicted to a autohotkey script that uses a clever combination of keys to resize and position the active window: CAPS LOCK followed by a letter key. I don't know, I'm asking now: can linux use CAPS+letter instead of Ctrl/Win/Shift/Alt combinations?

If you're curious, the autohotkey script is pretty smart. CAPSLOCK+a resizes the active window to half screen width and snaps it to the left edge of the screen. CAPSLOCK+d does the same to the right edge. CAPSLOCK+d followed again by CAPSLOCK+d reduces to 1/4 screen width and snaps to right edge. CAPSLOCK+w snaps to top. CAPS+x to bottom. CAPS+s to screen center. Repeatedly pressing the same key combo cycles through predefined sizes: 1/2, 1/4, 3/4. And letters a,d,w,x, and s form a cross by the CAPS key. Very visual, easy to remember.

_________________
Fatdog64-700|+Packages|Fatdog64-631|Blue Pup 4|DebianDog+OpenMediaVault
Back to top
View user's profile Send_private_message 
greengeek

Joined: 20 Jul 2010
Posts: 3013
Location: New Zealand

PostPosted: Thu 05 Mar 2015, 03:11    Post_subject:  

step wrote:
And letters a,d,w,x, and s form a cross by the CAPS key. Very visual, easy to remember.
If anyone gets this going I'd love to see it using caps+arrows rather than caps+letter.

The arrow functions would be more visual for me than adwsx (which is admittedly visual but easily forgotten by my brain...
Back to top
View user's profile Send_private_message 
hapless_user

Joined: 20 Feb 2015
Posts: 10

PostPosted: Mon 30 Mar 2015, 12:58    Post_subject:  

Thanks,MochiMoppel! Simply solves the annoyance of windows overlap!
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0741s ][ Queries: 12 (0.0041s) ][ GZIP on ]