You are not logged in.
Hi folks
I've just seen this thread after writing something similar to the
above autogrid layout. The code below is a diff to add two new tiling
styles. The first is 'columns' which take an additional argument, the
number of columns to make, e.g.:
stiler columns 3
The second, 'fair', is just a special case of columns that attempts to
make all windows square, i.e. the number of columns is basically
sqrt(number of windows).
stiler fair
I'm using this with clusterssh and 20-30 xterms at a time and it is
working quite well.
If the number of windows is not a factor of the number of columns
there will be gaps at the bottom. I would welcome an elegant way to
address this.
I'm not a python hacker, so feel free to improve my style.
--- stiler 2010-03-06 00:51:57.000000000 -0500
+++ stiler_columns.py 2010-03-06 15:50:35.000000000 -0500
@@ -150,6 +150,36 @@
return layout
+
+def get_columns_tile(wincount, ncolumns):
+ ## 2nd term rounds up if num columns not a factor of
+ ## num windows; this leaves gaps at the bottom
+ nrows = (wincount/ncolumns) + int(bool(wincount%ncolumns))
+
+ layout = []
+ x = OrigX
+ y = OrigY
+
+ height = int(MaxHeight/nrows - WinTitle - WinBorder)
+ width = int(MaxWidth/ncolumns - 2*WinBorder)
+
+ for n in range(0,wincount):
+ column = n % ncolumns
+ row = n / ncolumns
+
+ x = OrigX + column * width
+ y = OrigY + (int((MaxHeight/nrows)*(row)))
+ layout.append((x,y,width,height))
+
+ return layout
+
+
+def get_fair_tile(wincount):
+ import math
+ ncolumns = int(math.ceil(math.sqrt(wincount)))
+ return get_columns_tile(wincount, ncolumns)
+
+
def get_max_all(wincount):
layout = []
x = OrigX
@@ -264,6 +294,22 @@
arrange(get_horiz_tile(len(winlist)),winlist)
+def columns(ncolumns):
+ winlist = create_win_list()
+ active = get_active_window()
+ winlist.remove(active)
+ winlist.insert(0,active)
+ arrange(get_columns_tile(len(winlist), ncolumns),winlist)
+
+
+def fair():
+ winlist = create_win_list()
+ active = get_active_window()
+ winlist.remove(active)
+ winlist.insert(0,active)
+ arrange(get_fair_tile(len(winlist)),winlist)
+
+
def cycle():
winlist = create_win_list()
winlist.insert(0,winlist[len(winlist)-1])
@@ -298,6 +344,10 @@
vertical()
elif sys.argv[1] == "horizontal":
horiz()
+elif sys.argv[1] == "columns":
+ columns(int(sys.argv[2]))
+elif sys.argv[1] == "fair":
+ fair()
elif sys.argv[1] == "swap":
swap()
elif sys.argv[1] == "cycle":
Offline
Hmmm, I've just noticed these two lines are redundant:
x = OrigX
y = OrigY
Offline
Thanks, stiler is great, I use it every day.
Do you think you could implement untiling of all windows?
I've also just experienced my first bug where - without identifyable cause - stiler wouldn't work anymore.
The traceback:
Traceback (most recent call last):
File "/usr/bin/stiler", line 102, in <module>
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
File "/usr/bin/stiler", line 52, in initialize
current = filter(lambda x: x.split()[1] == "*" , desk_output)[0].split()
IndexError: list index out of range
Yesterday i switched to Xorg 1.8. Do you think this is related?
I'll update here if i can solve the issue. Maybe it was just a one-time thing, though (update: it was).
Regards,
demian
Last edited by demian (2010-10-01 15:47:29)
no place like /home
github
Offline
I understand nothing. I install stiler from aur.
I have wmctrl and xdotool.
When I write in a console "style left" that is positioned to the left.
But as I do with other applications? Can i do this with the keyboard?
Please teach me
Offline
Yeah the idea is to bind those commands to hotkeys. There are many ways to do that. Search the net.
no place like /home
github
Offline
Stiler doesn't work with python 3 because the commands module has been removed. You get the following error whenever you try to run it:
File "/usr/bin/stiler", line 22, in <module>
import commands
ImportError: No module named commands
Offline
Stiler doesn't work with python 3 because the commands module has been removed. You get the following error whenever you try to run it:
File "/usr/bin/stiler", line 22, in <module> import commands ImportError: No module named commands
Just change the Shebang in /usr/bin/stiler from
#!/usr/bin/python
to
#!/usr/bin/python2
Offline
Hi,
I'm not using Arch, but I'm posting here because that's where I found this wonderful stiler script in the first place.
The short story is : upgrading to Fedora 15 caused stiler to stop working for me. That is because wmctrl returns incomplete window list for some reason. I guess that is due to some change to the Xlib or Openbox. Anyway, I thought it might be a good idea to completely get rid of wmctrl.
So I've used http://python-xlib.sourceforge.net/ to implement a small python module (xutils.py) that can provide a window list, active window and current desktop without using wmctrl. This actually fixed my bug so I can use stiler again. With the current code, stiler is still using wmctrl to resize/move windows, but it's just because I haven't had time to implement the window move/resize functionnality in python.
My modifications are available here: https://github.com/julienr/stiler/tree/python-xlib
So if anybody run into the same situation where wmctrl is broken, just grab this version and it might work.
Offline
who needs tiling WM's when you can have openbox with this - difficult to use gimp and chromium in awesome WM :-). exactly what I was looking for . In particular the 2monitor mod. ty so much
Last edited by Silicontoad (2011-07-16 13:29:56)
Offline
Don't know if soulfx still reads this thread, but I noticed a weird problem.
I'm using Openbox and the stiler-grid-git package from the AUR. "stiler simple" works perfectly for all applications except for LibreOffice... for some reason, the LibreOffice window ends up being placed 21 pixels (the exact height of my titlebar in .stilerrc) higher than where it should be, and the window is 1 pixel taller than it should be. I have no idea what's causing this... here's the output from running "stiler simple" on a terminal window when the only other window is LibreOffice - the output is the same as it is for two terminal windows, which tile perfectly:
[<...> ~]$ stiler simple -vv
DEBUG:Simple Window Tiler:corner widths: [0.33, 0.5, 0.67]
DEBUG:Simple Window Tiler:center widths: [0.34, 1.0]
DEBUG:Simple Window Tiler:0x1a00004 is type NORMAL, state Normal
DEBUG:Simple Window Tiler:0x1a00047 is type NORMAL, state Normal
DEBUG:Simple Window Tiler:moving window: 0x1a00004 to (0,30,864,849)
DEBUG:Simple Window Tiler:moving window: 0x1a00047 to (864,30,736,849)
I've used stiler on Xfce; Xfwm seemed to not have this issue.
Thanks for working on this project; it's really useful.
Last edited by thorion (2012-10-25 03:50:40)
Offline
Don't know if soulfx still reads this thread,
Considering that he hasn't posted since 2009, it seems unlikely. (You can get this information from the "User list" using the link at the top left side of your screen, or simply by clicking on his user name on one of his posts).
Last edited by 2ManyDogs (2012-10-25 03:59:15)
Offline
Good to know; I probably should've checked that. It also seems like the last commit to stiler on github <https://github.com/soulfx/stiler> was 3 years ago. I'll update this if I find a solution.
Offline
Good to know; I probably should've checked that. It also seems like the last commit to stiler on github <https://github.com/soulfx/stiler> was 3 years ago. I'll update this if I find a solution.
In case anyone else is having problems, I've implemented a really crude workaround. In the script (found at /usr/bin/stiler for this AUR package), I found the def move_window function and added this:
def move_window(windowid,PosX,PosY,Width,Height):
"""
Resizes and moves the given window to the given position and dimensions
"""
PosX = int(PosX)
PosY = int(PosY)
# beginning of my addition
"""
Workarounds for certain stubborn apps
"""
if commands.getoutput("xprop -id "+windowid+" | grep _NET_WM_NAME | grep LibreOffice") != "":
logging.debug("Detected LibreOffice window on "+windowid)
logging.debug(commands.getoutput("xprop -id "+windowid+" | grep _NET_WM_NAME | grep LibreOffice"))
PosY = PosY + WinTitle + 1
Height = Height - 1
if commands.getoutput("xprop -id "+windowid+" | grep _NET_WM_NAME | grep Wicd") != "":
logging.debug("Detected Wicd window on "+windowid)
logging.debug(commands.getoutput("xprop -id "+windowid+" | grep _NET_WM_NAME | grep Wicd"))
PosY = PosY + WinTitle - 32
# end of my addition
logging.debug("moving window: %s to (%s,%s,%s,%s) " % (windowid,PosX,PosY,Width,Height))
I should definitely grab the window by application instead of by window name, but that should be easy to change.
Last edited by thorion (2012-10-27 05:06:14)
Offline
This script is awesome. I modified it to allow re-sizing the current window to top half, bottom half, and top-left, top-right, bottom-left, and bottom-right. Let me know if anyone wants a copy. I don't know anything about using GIT so not sure how to get it on there...
Offline