You are not logged in.

#1 2017-08-07 20:12:34

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Openbox window tiling - with a single-click

Openbox window tiling

The script, keybinds and icons, and some other goodies, are included in the github Release: Openbox Window Tiling

The script will tile open windows on the current desktop, and can restore them to their original positions.

  • Arrange up to 4 windows in a grid. A fifth window will be centered, and any others won't be affected

  • Arrange up to 3 windows vertically or horizontally. A fourth window will be centered, and any others won't be affected

  • If an action is repeated, or a different one is made, then the windows will be restored to their original positions

  • If the script is run with no argument, then the windows will be tiled in a grid, and original positions are not stored.

I decided to use keybind actions set in rc.xml, because it is a lot simpler to make placements without having to deal with the minutiae of window frames and decorations, as otherwise required by wmctrl and xdotool. xdotool can simulate keypresses, which makes the job much easier.

The provided keybinds for rc.xml aren't particularly useable in normal operation, but they are meant to only be used by xdotool in the script. They could be pretty much anything you like, as long as they don't clash with existing keybinds.

xdotool has a problem with numpad keys, so that is why there are no "KP_num" keys used.

Tile windows with commands...

ob-tile.sh [ -G | --grid | -V | --vert | -H | --horiz ]

...or by clicking on icons in  tint2...

Tile windows with a mouse-click

youtube demo

The icing on the cake - use Tint2 Buttons to tile grid/vertical/horizontal and toggle the original positions smile
[NB: a recent version of Tint2 is needed (v0.14). Either get the BL backports Tint2, or compile from gitlab ]
obtile-buttons.png

Add this to your tint2rc, in the buttons section:

# Window Tiling
# Grid
button = new
button_icon = tile-grid.png
button_text =
button_tooltip = Tile Grid
button_lclick_command = ob-tile.sh -G
button_rclick_command =
button_mclick_command =
button_uwheel_command =
button_dwheel_command =
button_font_color = #ffffff 100
button_padding = 2 2
button_background_id = 1
button_centered = 1
button_max_icon_size = 24

# Vertical
button = new
button_icon = tile-vert.png
button_text =
button_tooltip = Tile Vertical
button_lclick_command = ob-tile.sh -V
button_rclick_command =
button_mclick_command =
button_uwheel_command =
button_dwheel_command =
button_font_color = #ffffff 100
button_padding = 2 2
button_background_id = 1
button_centered = 1
button_max_icon_size = 24

# Horizontal
button = new
button_icon = tile-horiz.png
button_text =
button_tooltip = Tile Horizontal
button_lclick_command = ob-tile.sh -H
button_rclick_command =
button_mclick_command =
button_uwheel_command =
button_dwheel_command =
button_font_color = #ffffff 100
button_padding = 2 2
button_background_id = 1
button_centered = 1
button_max_icon_size = 24

Edit the panel items to include the buttons, "P".

panel_items = TS:C:PPP

If the icons are copied to ~/.icons, then Tint2 should pick them up, otherwise the full filepath is needed.

To Do
  • Sometimes a window "sticks" and doesn't tile. This is may be due to something wrong with xdotool --sync. Repeating the action usually makes the window behave

  • Tiling windows, then moving to another desktop and repeating tiling there, may cause unwanted behaviour sad


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2017-08-07 20:42:57

malm
jgmenu developer
Registered: 2016-10-13
Posts: 735
Website

Re: Openbox window tiling - with a single-click

That's beautiful. I like it :-)

Offline

#3 2017-08-08 23:33:46

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Openbox window tiling - with a single-click

Great work, damo.  Thank you very much.

Offline

#4 2017-08-13 21:56:34

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: Openbox window tiling - with a single-click

Nice to see those buttons put to good use smile

Offline

#5 2017-08-13 23:53:26

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: Openbox window tiling - with a single-click

Still, no cascade feature as in Windows 3.1 sad tongue (ducks)

editeur-de-configuration-systeme-windows-3.1.png

win31.png

Last edited by o9000 (2017-08-13 23:54:11)

Offline

#6 2017-08-14 06:04:17

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: Openbox window tiling - with a single-click

Please excuse my bad jokes. Seriously speaking, I would find useful another button that simply maximizes (and stacks) all windows. There are some apps that sometimes start unmaximized for unclear reasons, and I don't like that.

But not cascading, it is useless.

Offline

#7 2017-08-14 06:22:43

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,063
Website

Re: Openbox window tiling - with a single-click

^ & ^^

function win_cascade {
	get_workspace
	get_visible_window_ids

	(( ${#WDOWS[@]} < 1 )) && return;

	x=0; y=0; commands=""
	for window in ${WDOWS[@]} ; do
		wmctrl -i -r $window -b remove,maximized_vert,maximized_horz

		commands="$commands windowsize $window 640 480"
		commands="$commands windowmove $window $x $y"

		x=`expr $x + 22`
	  y=`expr $y + 22`
	done

	echo "$commands" | xdotool -
}

https://forum.xfce.org/viewtopic.php?id=6841

big_smile

(Sorry for the OT, OP)

EDIT: for clarity: that script isn't mine.

Last edited by Head_on_a_Stick (2017-08-14 06:24:52)

Offline

#8 2017-08-14 07:55:41

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Openbox window tiling - with a single-click

I'll have a go smile

Seriously though, Win3.1 had some excellent features regarding the file manager and window management.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2017-08-14 10:30:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Openbox window tiling - with a single-click

Script to ToggleMaximize all windows on current desktop. Icon added to github
maxwin-icon.png

#!/bin/bash
##
## maxwin.sh    Toggle Maximize all windows on current desktop
#
#rc.xml:
#       <keybind key="W-Up">
#           <action name="ToggleMaximize"/>
#       </keybind>
#
########################################################################

KBIND="super+Up"    # rc.xml keybind for ToggleMaximize"
TMP_WIN_LIST=$(mktemp --tmpdir winlist.XXXX)    # stores window ID's

# get window list, save to tempfile
wmctrl -lp > "$TMP_WIN_LIST"

# read window list, get window ID's on current desktop
CURRDTOP=$(xprop -root _NET_CURRENT_DESKTOP | tail -c -2) # desktop number

declare -a arrWIN_ID

# loop through windows, add to windows array
i=0
while read -r line;do
    if grep -Eq -v "(Conky|Tint2)" "$TMP_WIN_LIST" &>/dev/null ;then
        if [[ $(echo "$line" | awk '{print $2}') == $CURRDTOP ]] &>/dev/null;then
            arrWIN_ID[$i]=$(echo "$line" | awk '{print $1}')
            ((i+=1))
        fi
    fi
done < "$TMP_WIN_LIST"

arrL=${#arrWIN_ID[@]}
i=0

# send Openbox keybind to each window
for (( i=0; i < $arrL; i++ ));do
    xdotool windowfocus --sync "${arrWIN_ID[$i]}"
    xdotool key --clearmodifiers "$KBIND" 
    #sleep 0.1
done

rm "$TMP_WIN_LIST"
exit 0

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#10 2017-08-14 22:29:45

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Openbox window tiling - with a single-click

^ First scrot...is that KDE?   yikes

I wonder how difficult it would be for the Openbox and/or Tint2 dev(s) to incorporate or recreate that functionality in the(ir) code.  I haven't tried it out, but that looks like some slick coding work.

o9000 wrote:

Still, no cascade feature as in Windows 3.1 sad tongue (ducks)

lol

Last edited by KrunchTime (2017-08-14 22:41:38)

Offline

#11 2017-08-14 22:35:44

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Openbox window tiling - with a single-click

KrunchTime wrote:

^ First scrot...is that KDE?   yikes
....

My scrots? Certainly not - Tint2 + Openbox, running on BL-Helium-dev  O:)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#12 2017-08-14 22:38:40

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Openbox window tiling - with a single-click

^ Reminds me of KDE.  How did you get the current date to show under the current time?

Last edited by KrunchTime (2017-08-14 22:39:41)

Offline

#13 2017-08-14 22:44:02

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Openbox window tiling - with a single-click

KrunchTime wrote:

^ Reminds me of KDE.  How did you get the current date to show under the current time?

# Clock
time1_format = %H:%M:%S
time2_format = %a %d %b
$ tint2 -v
tint2 version 0.14.6

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#14 2017-08-14 22:53:08

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Openbox window tiling - with a single-click

^ Just checked the tint2rc file under BL-Hydrogen and there's a line for the date that is commented out.  Woo hoo...I learned something new today!  Thank you!

Edit:  Just uncommented the lines for the date and restarted Tint2...sweet!

Edit2:  Amazing how many times I've edited that file and never noticed the date option.  roll

Last edited by KrunchTime (2017-08-14 23:20:21)

Offline

#15 2017-08-15 06:21:14

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,063
Website

Re: Openbox window tiling - with a single-click

Fully commented .tint2rc here:

https://github.com/Head-on-a-Stick/conf … nt2rc.phle

(Version 0.11, needs updating)

Offline

#16 2017-08-15 07:42:59

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Openbox window tiling - with a single-click

^ Actually, my tint2rc is fairly well commented.  Perhaps the time2 label threw me.  I will take a look at what you have provided in the link.

Offline

#17 2017-08-15 08:22:06

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Openbox window tiling - with a single-click

@o9000's Tint2 wiki is superb, and a great example for other developers to follow.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#18 2017-08-16 02:54:33

p9000
Member
Registered: 2017-05-28
Posts: 22

Re: Openbox window tiling - with a single-click

Thanks! Tbh I hate writing in general, but I like documenting non-trivial technical stuff that I find interesting.

Did you mean the actual wiki or the man page?

Offline

#19 2017-08-16 05:42:02

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Openbox window tiling - with a single-click

o9000 - p9000 - what? I'm confused.

p9000, there's actually a user called o9000, are you that same user IRL?

Offline

#20 2017-08-16 07:46:04

o9000
tint2 developer
From: Network Neighborhood
Registered: 2015-10-24
Posts: 417
Website

Re: Openbox window tiling - with a single-click

Yes, you got me. In real life all 9,000 of us are one and the same. That is (was) my secret.

I just created that account on my phone when I couldn't remember my password. It's probably going to die off, because now I can't remember my password to my e-mail account on my phone, and looks like I cannot reset it... (note: I don't see myself as technologically illiterate, although it might appear that way sometimes; I blame the software and the computers for all such problems)

Side note: looks like I might have been banned from using the forum from the phone. Possibly due to a spamming filter. Not my best couple of days!

By the way, good question, don't take anything seriously if any other *9000 account pops up unless I confirm it.

Sorry for all the confusion I caused.

Last edited by o9000 (2017-08-16 07:51:22)

Offline

Board footer

Powered by FluxBB