You are not logged in.
Hello everyone,
I've forked the stiler grid branch into my github account. The fork will allow everyone to get to my updates a little quicker and make it easier on both me and u_no_hu to keep track of the code changes. If I had known it was this easy to fork I would have done it a while ago.
The latest commit has a new swap_grid option, improved window filtering, and no longer depends on xdotools. The swap_grid option swaps the size and positions of the active and the largest window. The window filtering code performance has been improved to where I think its safe to re-enable it by default (its sorta needed by the swap_grid option). See the commit log for a complete list of changes.
soulfx's fork of the grid branch: http://github.com/soulfx/stiler/tree/grid
Offline
Just wanted to post back to this forum because I've added some code for cascading. I'm just posting the modules that actually do the cascading. I'm using this with OpenBox and its nice feature to have. I'm not a python coder so this is just copy modify of some of the pre-existing modules. do what you like with it.
CParticle
def get_simple_cascade_tile(wincount):
rows = wincount - 1
layout = []
if rows == 0:
layout.append((OrigX,OrigY,MaxWidth,MaxHeight-WinTitle-WinBorder))
return layout
else:
layout.append((OrigX,OrigY,int(MaxWidth*MwFactor),MaxHeight-WinTitle-WinBorder))
if wincount > 10:
cascade_num = 10
else:
cascade_num = wincount
shifted_x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder))
if Monitors == 1:
width=int(((MaxWidth*(1-MwFactor))-2*WinBorder) - (cascade_num * (WinTitle + WinBorder)))
else:
width = int(MaxWidth - (cascade_num * (WinTitle + WinBorder)))
height = int(MaxHeight - (cascade_num * (WinTitle + WinBorder)))
k = 0
for n in range(0,rows):
x= shifted_x + k * (WinTitle + WinBorder)
y= OrigY + k * (WinTitle + WinBorder)
layout.append((x,y,width,height))
if k == 9:
k = 0
else:
k += 1
return layout
def get_cascade_tile(wincount):
layout = []
y = OrigY
x = OrigX
if wincount > 10:
cascade_num = 10
else:
cascade_num = wincount
width = int(MaxWidth - (cascade_num * (WinTitle + WinBorder)))
height = int(MaxHeight - (cascade_num * (WinTitle + WinBorder)))
k = 0
for n in range(0,wincount):
x= OrigX + k * (WinTitle + WinBorder)
y= OrigY + k * (WinTitle + WinBorder)
layout.append((x,y,width,height))
if k == 9:
k = 0
else:
k += 1
return layout
def arrange_cascade(layout,windows):
for win , lay in zip(windows,layout):
move_window(win,lay[0],lay[1],lay[2],lay[3])
raise_window(win)
WinList[Desktop]=windows
store(WinList,TempFile)
def simple_cascade():
winlist = create_win_list()
active = get_active_window()
winlist.remove(active)
winlist.insert(0,active)
arrange_cascade(get_simple_cascade_tile(len(winlist)),winlist)
raise_window(active)
def cascade():
winlist = create_win_list()
active = get_active_window()
winlist.remove(active)
winlist.append(active)
arrange_cascade(get_cascade_tile(len(winlist)),winlist)
Offline
Thanks... I will add this after testing
Offline
For me 'WinBorder =' doesn't work, it only adjusts the border below the windows not at the left and right, so my window borders overlap each-other. Using xfce.
Last edited by 9mqk$fhn (2009-07-01 10:01:42)
Offline
maybe this is a feature request. maybe i'm just dumb. maybe i'm misusing stiler.
anyhow, i'm trying to get openbox to do smart placement the way that fluxbox did on my old machine: four identically-sized terminals in a two-by-two grid, snug up against one another.
ob won't do it on its own.
can stiler?
if so, how?
if not, please?
thanx!
Last edited by kludge (2009-07-01 23:29:36)
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
@kludge.. See soulfx's fork. It does grid layout which can do that and much more...
And if you are looking exactly for a 4x4 layout it will be pretty easy to do. Have a look at get_horiz_tile and get_vertical_tile...combine both...replacing wincount with 4... Will be pretty simple to do even if you dont know python.
I will be quite busy for a week with uni admission + moving... will try to add this and the cascade layout after that.
Offline
Set gridwidths = 0.50 in .stilerrc for an exact 4x4 arrangement in the grid fork.
Offline
awesome script, but is there anyway to prevent it from tiling cairo-dock?
Offline
If you haven't already, try the grid fork it may detect that cairo-dock is a utility window and not tile it. If the grid fork doesn't detect it yet, a clause can be added to the is_valid_window() function to specifically ignore the cairo-dock.
Last edited by soulfx (2009-07-12 20:03:17)
Offline
If you haven't already, try the grid fork it may detect that cairo-dock is a utility window and not tile it. If the grid fork doesn't detect it yet, a clause can be added to the is_valid_window() function to specifically ignore the cairo-dock.
thanks soulfx! I had to add:
window_type == "DOCK"
to the is_valid_window() portion to prevent it from trying to tile cairo-dock.
Offline
I wrote an addon that changes the width factor in .stilerrc by a percentage. Useful for something like Mod4+h and Mod4+l in Awesome.
#! /usr/bin/python import os, sys, ConfigParser, commands rcfile = os.getenv('HOME')+"/.stilerrc" config = ConfigParser.RawConfigParser() config.read(rcfile) MwFactor = config.getfloat("default","MwFactor") MwFactor += float(sys.argv[1]) *.01 config.set("default","MwFactor",MwFactor) cfg = open(rcfile,'w') config.write(cfg) cfg.close() commands.getoutput("stiler swap")
It just takes a positive or negative percent as an argument. Note that this changes your width factor on every desktop.
Hi, I would find this very useful, could you tell me how to use it? Do I add it into the existing script or is it a separate script? I tried running it separately but I don't know how to actually use it to re-size the windows. Thanks!
Offline
Change the last line in the script to the command you use to normally run stiler (I had to change it to "stiler.py swap") and check the ~/.stilerrc file to see if its using [default] or [DEFAULT] and modify the code that josomebody provided if needed. The script is to be run as a separate script with a single numerical argument to control the width used by the simple tile layout.
Offline
Just wanted to post back to this forum because I've added some code for cascading. I'm just posting the modules that actually do the cascading.
I'd like to try the "cascade" option, but how should I integrate those lines into the main script?
Offline
I'd just like to pop in to say "thank you!":
Thank you!
I'm using PekWM and was missing a tiling extension. Now this is just perfect! No problems here (even though I'd prefer a graceful message when calling the script without arguments, as well as a "-h/--help" switch).
musician & coder
http://elephly.net
http://github.com/rekado
Offline
Hi rekado,
I'm glad you are finding stiler useful. The grid branch has some extra features you may find helpful (like providing help when no arguments are given). You can check the grid branch out at: http://github.com/soulfx/stiler/tree/grid
Offline
Hi soulfx,
I just installed the forked version. Good job! The usage instructions make the program appear much more professional (and they don't force me to open the source all the time to see the options).
It does seem to me, though, that the script runs noticably slower than before. Is just just my own perception or is there really a difference in performance compared to the original version?
I checked out the source and I have to say that I like the refactored style very much.
musician & coder
http://elephly.net
http://github.com/rekado
Offline
Hi rekado,
The grid branch does perform some extra work that slows it down in comparison to the original. There are some things you can try to gain back a little speed.
1. Comment out lines 733 - 735 to disable the required program checking. If the stiler works for you then this check isn't needed. In the future I plan to add some logic that will automatically disable the required program checking after a successful run.
2. Disable the window filters by adding the line "windowfilter = off" to the ~/.stilerrc file.
Offline
Hello,
I just tried your script under openbox and must say that I love it. It's exactly the mix of floating and tiling that I have always wanted. Thank you!
But especially with XFCE-programs like xfce4-terminal or thunar it doesn't work absolutely accurate like you can see hear:
http://i35.tinypic.com/e0aj9.png
Here another one with 3 xterms, which works better, but there are still gaps:
http://i37.tinypic.com/2w7gy38.png
I already tried to deactivate the window decorations, but that doesn't change anything.
Of course it's no big deal, but if there is a solution to this, please let me know.
q0tsa
edit:
I switched to another openbox theme and set the winborder and wintitle options in my .stilerrc adequate. So now it works at least form most windows pixel accurate. Only terminal emulators always leave gaps between each other. (I tried xfce-terminal, urxvt, xterm, lxterminal)
Last edited by q0tsa (2009-10-03 08:33:31)
Offline
It is a really great tool! Thank you!
Offline
anyhow, i'm trying to get openbox to do smart placement the way that fluxbox did on my old machine: four identically-sized terminals in a two-by-two grid, snug up against one another.
@kludge.. See soulfx's fork. It does grid layout which can do that and much more...
And if you are looking exactly for a 4x4 layout it will be pretty easy to do. Have a look at get_horiz_tile and get_vertical_tile...combine both...replacing wincount with 4... Will be pretty simple to do even if you dont know python.
Set gridwidths = 0.50 in .stilerrc for an exact 4x4 arrangement in the grid fork.
got it! not very slick, but when i invoke stiler with my own 'grid_four' i get four terminals at their default size in snug square:
def get_grid_four(wincount):
layout = []
winlist = create_win_list()
x = OrigX
y = OrigY
width = int(get_window_width_height(winlist[0])[0])
height = int(get_window_width_height(winlist[0])[1])
for n in range(0,wincount):
if ((x + width) < MaxWidth):
layout.append((x,y,width,height))
x = x + width
else:
x = OrigX
y = y + height
layout.append((x,y,width,height))
x = x + width
return layout
...
def grid_four_option():
"""
My Own 4x4 grid
"""
winlist = create_win_list()
active = get_active_window()
winlist.remove(active)
winlist.insert(0,active)
arrange(get_grid_four(len(winlist)),winlist)
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
no one of the top scripts for me with dualhead and openbox
the version from soulfx brings all windows to the left display an the version from u_no_hu shows the same error like jelly
the life is like a action-adventure, cool graphic but a crap story
Offline
Hi, been using stiler with openbox (LXDE) and there is one minor irritant. I prefer to have the panel at the top of the screen instead of the bottom. With this setup swap works fine but every other layout leaves space at the bottom of the screen for the panel and sticks the top part of the window underneath the panel (a pain with no decorations). I've tried all kidns of different values and combinations in the stillerrc file and nothing changes. Is there somethign I am missing here? Does stiler assume the panel is on the bottom if present?
Offline
Umm, actualy stiler maximize works ok too. But only swap and maximize are recognizing the proper panel placement.
edit: actually maximize doesn't work properly of used after another tiling command like swap. It's ok if no other stiler comamnd is used though.
Last edited by NevarMaor (2009-11-16 20:11:06)
Offline
Wow! Excellent work, thanks a lot. I love it.
There is some minor issue with the temporary winlist file:
If e.g. different users on the system belong to different (unix) groups they come in trouble with write permissions.
Therefore I changed the global variable TempFile to
TempFile = Config.get("default", "TempFile") + "-" + os.environ.get("USER")
[ os.getlogin() won't work ]
Offline
Great! So far i used fluxbox's integrated "ArrangeWindows" command. But it doesnt filter out any windows, so my beloved nautilus desktop will get tiled too....
I wrote some lines to mimic the behaviour of fluxbox. It arranges the windows in a grid, if you have say 4 windows. you'll get a 2x2 grid, if you have 5 you get one row of 3 and one row of 2 and so on. Works for any number of windows.
def get_autogrid_tile(wincount):
layout = []
rows = int( math.floor(math.sqrt(wincount)) )
rowheight = int( MaxHeight / rows )
windowsleft = wincount
for row in range(rows):
cols = min(int(math.ceil(float(wincount)/rows)),windowsleft)
windowsleft -= cols
colwidth = MaxWidth/cols
for col in range(cols):
layout.append( (OrigX+colwidth*col, OrigY+row*rowheight, colwidth, rowheight-WinTitle-WinBorder) )
return layout[:wincount]
def autogrid_option():
"""
Automatic Grid Arranging
"""
winlist = create_win_list()
active = get_active_window()
winlist.remove(active)
winlist.insert(0,active)
arrange( get_autogrid_tile(len(winlist)),winlist)
Have Fun. Feel free to do with this code whatever you want
Thx for the tool!
Offline