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