[Ubuntu 10.10] Aerosnap

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Dag iedereen,

Voor school draai ik een virtuele Ubuntu-machine. Thuis werk ik met Windows 7 en maak ik erg veel gebruik van de Aero-snap functie. Deze mis ik in Ubuntu, Kubuntu heeft deze dan weer wel.

Na wat opzoekingswerk vond ik deze tutorial: http://www.clickonf5.org/...dows7-feature-ubuntu/6956

Na deze gevolgd te hebben en alle stappen succesvol hebben uitgevoerd, werkt het nog altijd niet.

Hebben jullie enig idee aan wat dit kan liggen?

Alvast bedankt.

Acties:
  • 0 Henk 'm!

  • CAPSLOCK2000
  • Registratie: Februari 2003
  • Laatst online: 21:28

CAPSLOCK2000

zie teletekst pagina 888

Krijg je ergens foutmeldingen?

Je zou die 3 lange commando's een los vanuit een terminal moeten uitvoeren. Hopelijk krijg je dan wat feedback.

This post is warranted for the full amount you paid me for it.


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
student@student-desktop:~$ WIDTH=`xdpyinfo | grep ‘dimensions:’ | cut -f 2 -d ‘:’ | cut -f 1 -d ‘x’` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
cut: the delimiter must be a single character
Try `cut --help' for more information.
cut: the delimiter must be a single character
Try `cut --help' for more information.
student@student-desktop:~$ WIDTH=`xdpyinfo | grep ‘dimensions:’ | cut -f 2 -d ‘:’ | cut -f 1 -d ‘x’` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
cut: the delimiter must be a single character
Try `cut --help' for more information.
cut: the delimiter must be a single character
Try `cut --help' for more information.


De eerste 2 commands geven fouten terug, het laatste commando niet.

Acties:
  • 0 Henk 'm!

  • Scheeve
  • Registratie: Maart 2006
  • Laatst online: 23:04
Je moet de single quotes even vervangen, deze zijn door de html mark-up verknoeid ;)
Bijvoorbeeld na het woordje grep

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Commando 1:
WIDTH=`xdpyinfo | grep "dimensions:" | cut -f 2 -d ":" | cut -f 1 -d "x"" && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
cut: the delimiter must be a single character
Try `cut --help' for more information.
cut: the delimiter must be a single character
Try `cut --help' for more information.


Commando 2:
WIDTH=`xdpyinfo | grep "dimensions:" | cut -f 2 -d ":" | cut -f 1 -d "x" && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$HALF,-1
cut: the delimiter must be a single character
Try `cut --help' for more information.
cut: the delimiter must be a single character
Try `cut --help' for more information.


Commando 3:
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz

Acties:
  • 0 Henk 'm!

  • blaataaps
  • Registratie: Juli 2001
  • Niet online
Lees je de uitkomst/foutmeldingen ook voor je ze hier paste?

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
blaataaps schreef op woensdag 01 december 2010 @ 17:48:
Lees je de uitkomst/foutmeldingen ook voor je ze hier paste?
Ja, maar ik veronderstel dat als ze het doen in de tutorial, ze het bij mij ook zouden moeten doen, niet?

Acties:
  • 0 Henk 'm!

  • wagenveld
  • Registratie: Februari 2002
  • Niet online
Weet niet wat voor rare cut&paste jij doet maar die van mij ziet er anders uit ;)

Met single quotes dus.

code:
1
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x'` && HALF=$(($WIDTH/2)) && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1

[ Voor 102% gewijzigd door wagenveld op 01-12-2010 17:57 ]


Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Dit werkt in ieder geval al (wanneer ik dit paste in de terminal). Kan je die van de rechterkant hier ook nog eens plaatsen a.u.b?
Wanneer ik het echter doe op de manier die moet, het scherm tegen de linkerkant duwen, gebeurt er nog altijd niets :(

Acties:
  • 0 Henk 'm!

  • WiebeV
  • Registratie: Juni 2007
  • Laatst online: 23-08 21:20
Heb zelf ook die methode van die tutorial gebruikt, vond ik alleen niet handig werken en wou ook margins e.d. kunnen instellen.

Tweaker dat ik ben heb ik zelf een python scriptje geschreven. :7

Even een pakketje installeren
code:
1
sudo apt-get install python-wnck


Je kan hem als commando invullen @ Compiz.
Vind het zelf niet handig werken via compiz dus ik heb er zelf keyboard shortcuts van gemaakt.
ALT + links / rechts / omhoog / naar beneden.
  • Ga naar System > Preferences > Keyboard Shortcuts
  • Klik op Add
  • Vul als naam Snap window to the left (of welke naam je er aan wil geven).
  • Vul bij command python /pad/naar/wmsplit.py -l in.
  • Klik op Apply
  • Aan de rechterkant kun je de shortcut instellen.
  • Doe dit ook voor rechts, omhoog en omlaag verander dan in het command de -l in -r -u en -d.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
"""
    Wmsplit
    
    This program and documentation is free software; you can redistribute 
    it under the terms of the  GNU General Public License as published by
    the  Free Software Foundation;  either version 2  of the License,  or
    (at your option) any later version.
    
    This  program  is  distributed  in  the hope that it will be useful,
    but  WITHOUT ANY WARRANTY;  without  even  the  implied  warranty of
    MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE.  See  the
    GNU General Public License for more details.

    You  should  have  received a copy of the GNU General Public License
    along  with  this  program;  if  not,  write  to  the  Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    
"""

# Libraries we need
import wnck
import time
from optparse import OptionParser

# Margins
margin = {
    'left':     0,
    'right':    0,
    'middle':   0,
    'top':      0,
    'bottom':   0
}

vert_maximize = True

# Main
def main (margin, vert_maximize):

    # Parse command line options
    parser = OptionParser(version="%prog 2.0")
    parser.add_option(
        '-l', 
        '--left', 
        action = 'store_true',
        dest = 'left',
        help = 'place active window to the left side of you\'re screen',
        default = False
    )

    parser.add_option(
        '-r', 
        '--right', 
        action = 'store_true',
        dest = 'right',
        help = 'place active window to the right side of you\'re screen',
        default = False
    )

    parser.add_option(
        '-u', 
        '--up', 
        action = 'store_true',
        dest = 'up',
        help = 'maximize the active window',
        default = False
    )

    parser.add_option(
        '-d', 
        '--down', 
        action = 'store_true',
        dest = 'down',
        help = 'unmaximize the active window',
        default = False
    )

    (options, args) = parser.parse_args()
    
    if options.up == False and options.down == False and options.left == False and options.right == False:
        print('use --help to learn how to use this');
        return False
            
    # Get screen
    screen = wnck.screen_get_default()
    screen.force_update()
        
    # Window information
    window = screen.get_active_window()
    type = window.get_window_type()
    
    # Supported window type ?
    if type != wnck.WINDOW_NORMAL:
        print('Unsupported window type active: "' + str(type) + '"')
        return True
    
    # Maximize window ?
    if options.up == True and vert_maximize == True:
        
        if window.is_maximized() != True:
            window.maximize()
        else:
            print('Window is already maximized')
        
        return True
    
    
    # Unmaximize window ?
    if options.down == True:
        
        if window.is_maximized() == True:
            window.unmaximize()
        else:
            print('Window is already unmaximized')
        
        return True
    
    # Unmaximize if nessecary ?
    if options.left == True or options.right == True:
        if window.is_maximized() == True:
            window.unmaximize()         
        
    # Screen information
    screen_width = screen.get_width()
    screen_height = screen.get_height()
            
    # Calculate the new dimensions
    half_x  = int(int(screen_width) / 2)
    size_x  = half_x - ((margin['left'] + margin['right'] + margin['middle']) / 2)
    size_y  = int(screen_height) - (margin['top'] + margin['bottom'])

    # Calculate the offset
    yp = margin['top']
    
    # Up ?
    if options.up == True:
        size_x = int(screen_width) - (margin['left'] + margin['right'])
    
    # Left ?
    if options.left == True or options.up == True:
        xp = margin['left']
        
    # Right ?
    elif options.right == True:
        xp = size_x + (margin['left'] + margin['middle'])
        
    print(str(xp) + ' ' + str(yp) + ' ' + str(size_x) + ' ' + str(size_y))
        
    # Change window geometry
    gravity = wnck.WINDOW_GRAVITY_NORTHWEST
    flags = 15  
    window.set_geometry(gravity, flags, xp, yp, size_x, size_y)
    
    return True
        
if __name__ == '__main__':
    main(margin, vert_maximize)


Heb hem ook @ Google code staan maar nog niet deze nieuwe versie.
En ik moet het nog een keer documenteren |:(

Als je nog vragen hebt moet je het maar zeggen :)

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
_/-\o_ HELD! _/-\o_

Acties:
  • 0 Henk 'm!

  • WiebeV
  • Registratie: Juni 2007
  • Laatst online: 23-08 21:20
Oja, je moet waarschijnlijk nog even apt-get install python-wnck doen maar daar was je mischien al achter :P
Zou ook moeten werken met XFCE / KDE volgens mij maar nog niet geprobeerd eigenlijk.

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Nee hoor, werkte gewoon out of the box!
Pagina: 1