<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=1174501&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / XFCE - Positionnement des fenêtres]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1174501</link>
		<description><![CDATA[Les sujets les plus récents dans XFCE - Positionnement des fenêtres.]]></description>
		<lastBuildDate>Mon, 21 Jan 2013 18:10:48 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  XFCE - Positionnement des fenêtres]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12292261#p12292261</link>
			<description><![CDATA[<p><a href="apt://wmctrl">wmctrl</a> est sur les dépôts.</p>]]></description>
			<author><![CDATA[dummy@example.com (The Uploader)]]></author>
			<pubDate>Mon, 21 Jan 2013 18:10:48 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12292261#p12292261</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  XFCE - Positionnement des fenêtres]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12292211#p12292211</link>
			<description><![CDATA[<p>Bonjour,</p><p>Tu as un autre programme ici : <a href="http://ssokolow.com/quicktile/">http://ssokolow.com/quicktile/</a></p><p>Je ne l&#039;ai pas essayé.</p><p>styler.py semble nécessiter &quot;wmctrl&quot; pour fonctionner.</p>]]></description>
			<author><![CDATA[dummy@example.com (adjoint)]]></author>
			<pubDate>Mon, 21 Jan 2013 18:08:24 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12292211#p12292211</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  XFCE - Positionnement des fenêtres]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12290721#p12290721</link>
			<description><![CDATA[<p>Salut</p><p>Quelle version de Linux Mint était-ce exactement ?</p><p>Cela ne semble pas être supporté par xfwm4. Un addon existe cependant :&#160; <a href="http://askubuntu.com/questions/122674/is-there-a-shortcut-to-tile-windows-to-left-or-right-side-of-the-screen">http://askubuntu.com/questions/122674/i … the-screen</a></p><p>C&#039;est un script python, fourni sous forme de <a href="http://doc.ubuntu-fr.org/ppa">PPA</a> installable. <a href="https://launchpad.net/~serge-hallyn/+archive/stiler">https://launchpad.net/~serge-hallyn/+archive/stiler</a></p><p>Ensuite, j&#039;imagine qu&#039;il te reste à lui attribuer des raccourcis claviers dans le gestionnaire de paramètres =&gt; Clavier =&gt; Raccourcis d&#039;applications comme montré en exemple sur la page.</p><p>Dommage de ne pas pouvoir trouver juste le script python, plutôt que d&#039;avoir à installer forcément un PPA. Voici le contenu du paquet pour Precise (donc le script seul) ci-dessous :</p><div class="codebox"><pre class="vscroll"><code>#!/usr/bin/python

############################################################################
# Copyright (c) 2009   unohu &lt;unohu0@gmail.com&gt;                            #
#                                                                          #
# Permission to use, copy, modify, and/or distribute this software for any #
# purpose with or without fee is hereby granted, provided that the above   #
# copyright notice and this permission notice appear in all copies.        #
#                                                                          #
# THE SOFTWARE IS PROVIDED &quot;AS IS&quot; AND THE AUTHOR DISCLAIMS ALL WARRANTIES #
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         #
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  #
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   #
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    #
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  #
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           #
#                                                                          #
############################################################################

import sys
import os
import commands
import pickle
import ConfigParser

def initconfig():
    rcfile=os.getenv(&#039;HOME&#039;)+&quot;/.stilerrc&quot;
    if not os.path.exists(rcfile):
        cfg=open(rcfile,&#039;w&#039;)
        cfg.write(&quot;&quot;&quot;#Tweak these values 
[default]
BottomPadding = 0
TopPadding = 0
LeftPadding = 0
RightPadding = 0
WinTitle = 21
WinBorder = 1
MwFactor = 0.65
TempFile = /tmp/tile_winlist
&quot;&quot;&quot;)
        cfg.close()

    config=ConfigParser.RawConfigParser()
    config.read(rcfile)
    return config

def get_screen_size():
    s = commands.getoutput(&#039;&#039;&#039;xdpyinfo | grep &#039;dimension&#039; | awk -F: &#039;{ print $2 }&#039; | awk &#039;{ print $1 }&#039; &#039;&#039;&#039;)
    (x,y) = s.split(&#039;x&#039;)
    return (int(x), int(y))

(resx, resy) = get_screen_size()

def initialize():
    desk_output = commands.getoutput(&quot;wmctrl -d&quot;).split(&quot;\n&quot;)
    desk_list = [line.split()[0] for line in desk_output]

    current =  filter(lambda x: x.split()[1] == &quot;*&quot; , desk_output)[0].split()

    desktop = current[0]
    width =  current[8].split(&quot;x&quot;)[0]
    height =  current[8].split(&quot;x&quot;)[1]
    orig_x =  current[7].split(&quot;,&quot;)[0]
    orig_y =  current[7].split(&quot;,&quot;)[1]
    (resx, resy) = get_screen_size()

    win_output = commands.getoutput(&quot;wmctrl -lG&quot;).split(&quot;\n&quot;)
    win_list = {}

    win_filtered = []
    for win in win_output:
	w = win.split()
	x = int(w[2])
	y = int(w[3])
	if x &lt; 0 or x &gt;= resx:
		continue
	if y &lt; 0 or y &gt;= resy:
		continue
	if w[7] == &#039;&lt;unknown&gt;&#039;:
		continue
	if w[6] == &#039;N/A&#039;:
		continue
	if w[7] == &#039;x-nautilus-desktop&#039;:
		continue
	win_filtered.append(win)

    for desk in desk_list:
        win_list[desk] = map(lambda y: hex(int(y.split()[0],16)) , filter(lambda x: x.split()[1] == desk, win_filtered ))

    return (desktop,orig_x,orig_y,width,height,win_list)

def get_active_window():
    return str(hex(int(commands.getoutput(&quot;xdotool getactivewindow 2&gt;/dev/null&quot;).split()[0])))
    

def store(object,file):
    with open(file, &#039;w&#039;) as f:
        pickle.dump(object,f)
    f.close()


def retrieve(file):
    try:
        with open(file,&#039;r+&#039;) as f:
            obj = pickle.load(f)
        f.close()
        return(obj)
    except:
        f = open(file,&#039;w&#039;)
        f.close
        dict = {}
        return (dict)


# Get all global variables
Config = initconfig()
BottomPadding = Config.getint(&quot;default&quot;,&quot;BottomPadding&quot;)
TopPadding = Config.getint(&quot;default&quot;,&quot;TopPadding&quot;)
LeftPadding = Config.getint(&quot;default&quot;,&quot;LeftPadding&quot;)
RightPadding = Config.getint(&quot;default&quot;,&quot;RightPadding&quot;)
WinTitle = Config.getint(&quot;default&quot;,&quot;WinTitle&quot;)
WinBorder = Config.getint(&quot;default&quot;,&quot;WinBorder&quot;)
MwFactor = Config.getfloat(&quot;default&quot;,&quot;MwFactor&quot;)
TempFile = Config.get(&quot;default&quot;,&quot;TempFile&quot;)
(Desktop,OrigXstr,OrigYstr,MaxWidthStr,MaxHeightStr,WinList) = initialize()
MaxWidth = int(MaxWidthStr) - LeftPadding - RightPadding
MaxHeight = int(MaxHeightStr) - TopPadding - BottomPadding
OrigX = int(OrigXstr) + LeftPadding
OrigY = int(OrigYstr) + TopPadding 
OldWinList = retrieve(TempFile)

def get_simple_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))

    x=OrigX + int((MaxWidth*MwFactor)+(2*WinBorder))
    width=int((MaxWidth*(1-MwFactor))-2*WinBorder)
    height=int(MaxHeight/rows - WinTitle-WinBorder)
    
    for n in range(0,rows):
        y= OrigY+int((MaxHeight/rows)*(n))
        layout.append((x,y,width,height))

    return layout


def get_vertical_tile(wincount):
    layout = [] 
    y = OrigY
    width = int(MaxWidth/wincount)
    height = MaxHeight - WinTitle - WinBorder
    for n in range(0,wincount):
        x= OrigX + n * width
        layout.append((x,y,width,height))

    return layout


def get_horiz_tile(wincount):
    layout = [] 
    x = OrigX
    height = int(MaxHeight/wincount - WinTitle - WinBorder)
    width = MaxWidth
    for n in range(0,wincount):
        y= OrigY + int((MaxHeight/wincount)*(n))
        layout.append((x,y,width,height))

    return layout

def get_max_all(wincount):
    layout = [] 
    x = OrigX
    y = OrigY 
    height = MaxHeight - WinTitle - WinBorder
    width = MaxWidth
    for n in range(0,wincount):
        layout.append((x,y,width,height))

    return layout



def move_active(PosX,PosY,Width,Height):
    command =  &quot; wmctrl -r :ACTIVE: -e 0,&quot; + str(PosX) + &quot;,&quot; + str(PosY)+ &quot;,&quot; + str(Width) + &quot;,&quot; + str(Height)
    os.system(command)


def unmaximize_one(windowid):
    command =  &quot; wmctrl -i -r &quot; + windowid +  &quot; -bremove,maximized_vert,maximized_horz&quot;
    os.system(command)


def maximize_one(windowid):
    command =  &quot; wmctrl -i -r &quot; + windowid +  &quot; -badd,maximized_vert,maximized_horz&quot;
    os.system(command)


def move_window(windowid,PosX,PosY,Width,Height):
    # Unmaximize window
    unmaximize_one(windowid)
    # Now move it
    command =  &quot; wmctrl -i -r &quot; + windowid +  &quot; -e 0,&quot; + str(PosX) + &quot;,&quot; + str(PosY)+ &quot;,&quot; + str(Width) + &quot;,&quot; + str(Height)
    os.system(command)
    command = &quot;wmctrl -i -r &quot; + windowid + &quot; -b remove,hidden,shaded&quot;
    os.system(command)


def raise_window(windowid):
    if windowid == &quot;:ACTIVE:&quot;:
        command = &quot;wmctrl -a :ACTIVE: &quot;
    else:
        command = &quot;wmctrl -i -a &quot; + windowid
    
    os.system(command)


def left():
    Width=MaxWidth/2-1
    Height=MaxHeight - WinTitle -WinBorder
    PosX=LeftPadding
    PosY=TopPadding
    move_active(PosX,PosY,Width,Height)
    raise_window(&quot;:ACTIVE:&quot;)


def right():
    Width=MaxWidth/2-1
    Height=MaxHeight - WinTitle - WinBorder 
    PosX=MaxWidth/2
    PosY=TopPadding
    move_active(PosX,PosY,Width,Height)
    raise_window(&quot;:ACTIVE:&quot;)
    

def compare_win_list(newlist,oldlist):
    templist = []
    for window in oldlist:
        if newlist.count(window) != 0:
            templist.append(window)
    for window in newlist:
        if oldlist.count(window) == 0: 
            templist.append(window)
    return templist


def create_win_list():
    Windows = WinList[Desktop]

    if OldWinList == {}:
        pass
    else:
        OldWindows = OldWinList[Desktop]
        if Windows == OldWindows:
            pass
        else:
            Windows = compare_win_list(Windows,OldWindows)

    return Windows


def arrange(layout,windows):
    for win , lay  in zip(windows,layout):
        move_window(win,lay[0],lay[1],lay[2],lay[3])
    WinList[Desktop]=windows
    store(WinList,TempFile)


def simple():
    Windows = create_win_list()
    arrange(get_simple_tile(len(Windows)),Windows)
   

def swap():
    winlist = create_win_list()
    if len(winlist) == 1:
        # only one window, maximize it
        maximize_active()
        return
    active = get_active_window()
    winlist.remove(active)
    winlist.insert(0,active)
    arrange(get_simple_tile(len(winlist)),winlist)


def vertical():
    winlist = create_win_list()
    active = get_active_window()
    winlist.remove(active)
    winlist.insert(0,active)
    arrange(get_vertical_tile(len(winlist)),winlist)


def horiz():
    winlist = create_win_list()
    active = get_active_window()
    winlist.remove(active)
    winlist.insert(0,active)
    arrange(get_horiz_tile(len(winlist)),winlist)


def cycle():
    winlist = create_win_list()
    winlist.insert(0,winlist[len(winlist)-1])
    winlist = winlist[:-1]
    arrange(get_simple_tile(len(winlist)),winlist)

def focus_next():
    Windows = create_win_list()
    # we need to find which window is the active one
    # then pick the next one
    # for now just pick the second window always
    active = get_active_window()
    found = 0
    for win in Windows:
	    if found == 1:
		    raise_window(win)
		    return
	    if win == active:
		    found = 1
    raise_window(Windows[0])

def focus_prev():
    Windows = create_win_list()
    active = get_active_window()
    prev = Windows[len(Windows)-1]
    for win in Windows:
	    if win == active:
		    raise_window(prev)
            prev = win


def maximize_active():
    os.system(&quot;wmctrl -r :ACTIVE: -badd,maximized_vert,maximized_horz&quot;)


def maximize():
    Width=MaxWidth
    Height=MaxHeight - WinTitle -WinBorder
    PosX=LeftPadding
    PosY=TopPadding
    move_active(PosX,PosY,Width,Height)
    raise_window(&quot;:ACTIVE:&quot;)

def old_max_all():
    winlist = create_win_list()
    active = get_active_window()
    winlist.remove(active)
    winlist.insert(0,active)
    arrange(get_max_all(len(winlist)),winlist)

# new max_all(), use real &#039;maximize&#039;
# this way unity can remove the title bar
def max_all():
    winlist = create_win_list()
    for win in winlist:
        maximize_one(win)

if sys.argv[1] == &quot;left&quot;:
    left()
elif sys.argv[1] == &quot;right&quot;:
    right()
elif sys.argv[1] == &quot;simple&quot;:
    simple()
elif sys.argv[1] == &quot;vertical&quot;:
    vertical()
elif sys.argv[1] == &quot;horizontal&quot;:
    horiz()
elif sys.argv[1] == &quot;swap&quot;:
    swap()
elif sys.argv[1] == &quot;cycle&quot;:
    cycle()
elif sys.argv[1] == &quot;maximize&quot;:
    maximize()
elif sys.argv[1] == &quot;next&quot;:
    focus_next()
elif sys.argv[1] == &quot;prev&quot;:
    focus_prev()
elif sys.argv[1] == &quot;max_all&quot;:
    max_all()</code></pre></div><p>Nom du script : styler.py</p><p><img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (The Uploader)]]></author>
			<pubDate>Mon, 21 Jan 2013 16:31:39 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12290721#p12290721</guid>
		</item>
		<item>
			<title><![CDATA[XFCE - Positionnement des fenêtres]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12288331#p12288331</link>
			<description><![CDATA[<p>Bonjour,</p><p>Je viens d&#039;une distribution Linux Mint avec laquelle j&#039;avais la possibilité de bloquer les fenêtres avec les raccourcis claviers suivant: &lt;ctrl&gt;&lt;alt&gt;&lt;1&gt; - &lt;ctrl&gt;&lt;alt&gt;&lt;2&gt; ... - &lt;ctrl&gt;&lt;alt&gt;&lt;9&gt;, permettant donc de bloquer respectivement les fenetres, en bas à gauche - en bas sur toute la largeur... - bloquer en haut à droite. Et tout le pavé numérique était utile pour la mise en place de mes fenetres dans les positions souhaitées.<br />C&#039;est raccourcis étaient vraiment pratiques... J&#039;ai décidé de passer sur Xubuntu que je préfère nettement grâce à sa légèreté mais qui en natif ne propose pas les mêmes raccourcis. <br />Pensez-vous qu&#039;il soit possible de configurer le même type de comportement ? Si oui, comment ? Car c&#039;était à peu près la seule chose que j&#039;appréciais vraiment avec Mint et qui me manque maintenant.</p><p>Merci d&#039;avance de vos réponses,<br />Sined79</p>]]></description>
			<author><![CDATA[dummy@example.com (sined79)]]></author>
			<pubDate>Mon, 21 Jan 2013 13:36:27 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12288331#p12288331</guid>
		</item>
	</channel>
</rss>
