You are not logged in.

#126 2009-05-12 03:31:39

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

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. tongue

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

#127 2009-06-30 15:02:57

cparticle
Member
Registered: 2009-06-30
Posts: 1

Re: Poor man's Tiling Window manager

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

#128 2009-06-30 15:18:50

u_no_hu
Member
Registered: 2008-06-15
Posts: 453

Re: Poor man's Tiling Window manager

Thanks... I will add this after testing smile


Don't be a HELP VAMPIRE. Please search before you ask.

Subscribe to The Arch Daily News.

Offline

#129 2009-07-01 10:01:13

9mqk$fhn
Member
Registered: 2009-06-25
Posts: 10

Re: Poor man's Tiling Window manager

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

#130 2009-07-01 23:25:28

kludge
Member
Registered: 2008-08-03
Posts: 294

Re: Poor man's Tiling Window manager

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

#131 2009-07-02 03:51:42

u_no_hu
Member
Registered: 2008-06-15
Posts: 453

Re: Poor man's Tiling Window manager

@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.


Don't be a HELP VAMPIRE. Please search before you ask.

Subscribe to The Arch Daily News.

Offline

#132 2009-07-02 13:03:11

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

Set gridwidths = 0.50 in .stilerrc for an exact 4x4 arrangement in the grid fork.

Offline

#133 2009-07-11 21:30:43

wankel
Member
From: Iowa, USA
Registered: 2008-05-30
Posts: 218
Website

Re: Poor man's Tiling Window manager

awesome script, but is there anyway to prevent it from tiling cairo-dock?

Offline

#134 2009-07-12 20:03:01

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

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

#135 2009-07-12 21:10:30

wankel
Member
From: Iowa, USA
Registered: 2008-05-30
Posts: 218
Website

Re: Poor man's Tiling Window manager

soulfx wrote:

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

#136 2009-08-15 23:17:47

wankel
Member
From: Iowa, USA
Registered: 2008-05-30
Posts: 218
Website

Re: Poor man's Tiling Window manager

josomebody wrote:

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

#137 2009-08-18 05:51:02

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

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

#138 2009-08-21 21:10:03

daneel971
Member
Registered: 2008-03-28
Posts: 177

Re: Poor man's Tiling Window manager

cparticle wrote:

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

#139 2009-09-12 15:39:04

rekado
Member
From: Shanghai, China
Registered: 2009-01-13
Posts: 98
Website

Re: Poor man's Tiling Window manager

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).

Offline

#140 2009-09-12 15:47:07

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

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

#141 2009-09-15 15:58:50

rekado
Member
From: Shanghai, China
Registered: 2009-01-13
Posts: 98
Website

Re: Poor man's Tiling Window manager

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.

Offline

#142 2009-09-15 23:14:18

soulfx
Member
Registered: 2009-04-01
Posts: 11

Re: Poor man's Tiling Window manager

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

#143 2009-10-02 17:35:00

q0tsa
Member
Registered: 2009-07-20
Posts: 39

Re: Poor man's Tiling Window manager

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

#144 2009-10-07 10:38:17

barchan
Member
Registered: 2007-07-04
Posts: 2

Re: Poor man's Tiling Window manager

It is a really great tool! Thank you!

Offline

#145 2009-10-27 03:45:53

kludge
Member
Registered: 2008-08-03
Posts: 294

Re: Poor man's Tiling Window manager

kludge wrote:

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.

u_no_hu wrote:

@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.

soulfx wrote:

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

#146 2009-11-12 12:44:52

pugnacity
Member
From: Berlin
Registered: 2004-05-22
Posts: 11
Website

Re: Poor man's Tiling Window manager

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

#147 2009-11-16 15:32:36

NevarMaor
Member
Registered: 2009-04-22
Posts: 29

Re: Poor man's Tiling Window manager

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

#148 2009-11-16 15:34:24

NevarMaor
Member
Registered: 2009-04-22
Posts: 29

Re: Poor man's Tiling Window manager

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

#149 2009-12-29 13:35:56

minipunk
Member
Registered: 2009-12-29
Posts: 1

Re: Poor man's Tiling Window manager

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

#150 2010-01-10 21:59:16

luki
Member
Registered: 2010-01-10
Posts: 1

Re: Poor man's Tiling Window manager

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 cool
Thx for the tool!

Offline

Board footer

Powered by FluxBB