summaryrefslogtreecommitdiff
path: root/src/compiz-icon.py
blob: 6ce3b81e5bc987e129a070056bcb7d362678bf45 (plain)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
#!/usr/bin/python
# Author(s): Keeguon
import ConfigParser
import gobject
import pygtk
pygtk.require('2.0')
import gtk
from commands import getoutput
from os import system, popen
from os.path import exists
from subprocess import Popen

# Defining functions
def installed(app):
	global app_is_installed
	return app in app_is_installed

def default_gl_decorator():
	global decorator
	if installed('kde-window-decorator') and dcop == 1 and gnome_session == 0:
		decorator = 'kde-window-decorator'
	if installed('gtk-window-decorator') and gnome_session == 1 and dcop == 0:
		decorator = 'gtk-window-decorator'
	if  installed('emerald') and dcop == gnome_session == 0:
		decorator = 'emerald'
	if  installed('emerald') and dcop == gnome_session == 1:
		decorator = 'emerald'

def fallback_wm():
	configuration = ConfigParser.ConfigParser()
	configuration.read(config_file)
	if installed('kwin') and dcop == 1 and gnome_session == 0:
		configuration.set('window_manager', 'set_active_wm', 'kwin')
	if installed('metacity') and gnome_session == 1 and dcop == 0:
		configuration.set('window_manager', 'set_active_wm', 'metacity')

def create_config_file():
	default_config = open(config_file, 'w')
	default_config.write('# Config file for compiz-trayicon (generated with python)\n')
	default_config.write('\n')
	default_config.write('[window_manager]\n')
	default_config.write('set_active_wm = compiz\n')
	default_config.write('wm_replace = --replace\n')
	default_config.write('\n')
	default_config.write('[default_compiz_options]\n')
	default_config.write('sm_disable = --sm-disable\n')
	default_config.write('\n')
	default_config.write('[compiz_options]\n')
	default_config.write('fast_filter = \n')
	default_config.write('indirect_rendering = --indirect-rendering\n')
	default_config.write('loose_binding = --loose-binding\n')
	default_config.write('\n')
	default_config.write('[compiz_backend]\n')
	default_config.write('set_backend = ccp\n')
	default_config.write('\n')
	default_config.write('[decorator]\n')
	default_config.write('set_active_decorator = ' + decorator + '\n')
	default_config.write('decorator_replace= --replace')
	default_config.close()

def activate_config_ini():
	# Retrieve configuration from the INI file
	configuration = ConfigParser.ConfigParser()
	configuration.read(config_file)
	# Window Manager
	active_wm = configuration.get('window_manager', 'set_active_wm')
	if active_wm == 'compiz':
		# Compiz Options
		wm_replace = configuration.get('window_manager', 'wm_replace')
		sm_disable = configuration.get('default_compiz_options', 'sm_disable')
		fast_filter = configuration.get('compiz_options', 'fast_filter')
		indirect_rendering = configuration.get('compiz_options', 'indirect_rendering')
		loose_binding = configuration.get('compiz_options', 'loose_binding')
		backend = configuration.get('compiz_backend', 'set_backend')
		# GL Decorator
		set_active_decorator = configuration.get('decorator', 'set_active_decorator')
		decorator_replace = configuration.get('decorator', 'decorator_replace')
		# Start Compiz WM
		Popen(['killall' , 'compiz.real' , 'metacity' , 'kwin'])
		Popen(['compiz.real' , wm_replace , sm_disable , fast_filter , indirect_rendering , loose_binding , backend])
		# Start GL Decorator
		Popen(['killall' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald'])
		Popen([set_active_decorator , decorator_replace])
	if active_wm == 'metacity':
		wm_replace = configuration.get('window_manager', 'wm_replace')
		# Start Metacity WM
		Popen(['killall' , 'compiz.real' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
		Popen(['metacity' , wm_replace])
	if active_wm == 'kwin':
		wm_replace = configuration.get('window_manager', 'wm_replace')
		# Start Kwin WM
		Popen(['killall' , 'compiz.real' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
		Popen(['kwin' , wm_replace])

def activate_compiz_manager():
	if installed('compiz.real'):
		activate_config_ini()
	else:
		fallback_wm()
		activate_config_ini()

# Compiz-Manager Menu Functions
def popup_menu(widget, button, time, data = None):
	if button == 3:
		if data:
			data.show_all()
			data.popup(None, None, None, 3, time)
	pass

def configure_menu_activate(widget):
	gobject.spawn_async(['ccsm'], flags=gobject.SPAWN_SEARCH_PATH)

def etm_menu_activate(widget):
	Popen(['emerald-theme-manager'])

def start_wm(widget):
	if installed('compiz'):
		activate_config_ini()
	else:
		fallback_wm()
		activate_config_ini()

def compiz_menu_activate(widget):
	# Set compiz wm
	configuration.set('window_manager', 'set_active_wm', 'compiz')
	configuration.write(open(config_file, 'w'))
	# Get compiz wm
	set_active_wm = configuration.get('window_manager', 'set_active_wm')
	wm_replace = configuration.get('window_manager', 'wm_replace')
	# Get compiz options
	sm_disable = configuration.get('default_compiz_options', 'sm_disable')
	fast_filter = configuration.get('compiz_options', 'fast_filter')
	indirect_rendering = configuration.get('compiz_options', 'indirect_rendering')
	loose_binding = configuration.get('compiz_options', 'loose_binding')
	backend = configuration.get('compiz_backend', 'set_backend')
	# Get gl decorator
	set_active_decorator = configuration.get('decorator', 'set_active_decorator')
	decorator_replace = configuration.get('decorator', 'decorator_replace')
	# Run compiz
	Popen(['killall' , 'compiz.real' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen(['compiz.real' , wm_replace , sm_disable , fast_filter , indirect_rendering , loose_binding , backend])
	Popen([set_active_decorator , decorator_replace])

def kwin_menu_activate(widget):
	# Set kwin wm
	configuration.set('window_manager', 'set_active_wm', 'kwin')
	configuration.write(open(config_file, 'w'))
	# Get kwin wm
	set_active_wm = configuration.get('window_manager', 'set_active_wm')
	wm_replace = configuration.get('window_manager', 'wm_replace')
	# Run kwin
	Popen(['killall' , 'compiz.real' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_wm , wm_replace])

def metacity_menu_activate(widget):
	# Set metacity wm
	configuration.set('window_manager', 'set_active_wm', 'metacity')
	configuration.write(open(config_file, 'w'))
	# Get metacity wm
	set_active_wm = configuration.get('window_manager', 'set_active_wm')
	wm_replace = configuration.get('window_manager', 'wm_replace')
	# Run metacity
	Popen(['killall' , 'compiz.real' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_wm , wm_replace])

def backend_ccp_activate(widget):
	# Set ccp backend
	configuration.set('compiz_backend', 'set_backend', 'ccp')
	configuration.write(open(config_file, 'w'))

def backend_gconf_activate(widget):
	configuration.set('compiz_backend', 'set_backend', 'gconf')
	configuration.write(open(config_file, 'w'))

def option_ff_activate(widget):
	# Set/Unset ff option
	if option_ff.get_active() == True:
		configuration.set('compiz_options', 'fast_filter', '--fast-filter')
		configuration.write(open(config_file, 'w'))
	else:
		configuration.set('compiz_options', 'fast_filter', '')
		configuration.write(open(config_file, 'w'))

def option_ir_activate(widget):
	# Set/Unset ir option
	if option_ir.get_active() == True:
		configuration.set('compiz_options', 'indirect_rendering', '--indirect-rendering')
		configuration.write(open(config_file, 'w'))
	else:
		configuration.set('compiz_options', 'indirect_rendering', '')
		configuration.write(open(config_file, 'w'))

def option_lb_activate(widget):
	# Set/Unset lb option
	if option_lb.get_active() == True:
		configuration.set('compiz_options', 'loose_binding', '--loose-binding')
		configuration.write(open(config_file, 'w'))
	else:
		configuration.set('compiz_options', 'loose_binding', '')
		configuration.write(open(config_file, 'w'))

def start_decorator(widget):
	# Get gl decorator
	set_active_decorator = configuration.get('decorator', 'set_active_decorator')
	decorator_replace = configuration.get('decorator', 'decorator_replace')
	# Run gl decorator
	Popen(['killall' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_decorator , decorator_replace])

def emerald_menu_activate(widget):
	# Set emerald decorator
	configuration.set('decorator', 'set_active_decorator', 'emerald')
	configuration.write(open(config_file, 'w'))
	# Get emerald decorator
	set_active_decorator = configuration.get('decorator', 'set_active_decorator')
	decorator_replace = configuration.get('decorator', 'decorator_replace')
	# Run emerald
	Popen(['killall' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_decorator , decorator_replace])

def kwd_menu_activate(widget):
	# Set kwd decorator
	configuration.set('decorator', 'set_active_decorator', 'kde-window-decorator')
	configuration.write(open(config_file, 'w'))
	# Get kwd decorator
	set_active_decorator = configuration.get('decorator', 'set_active_decorator')
	decorator_replace = configuration.get('decorator', 'decorator_replace')
	# Run kwd
	Popen(['killall' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_decorator , decorator_replace])

def gwd_menu_activate(widget):
	# Set gwd decorator
	configuration.set('decorator', 'set_active_decorator', 'gtk-window-decorator')
	configuration.write(open(config_file, 'w'))
	# Get gwd decorator
	set_active_decorator = configuration.get('decorator', 'set_active_decorator')
	decorator_replace = configuration.get('decorator', 'decorator_replace')
	# Run gwd
	Popen(['killall' , 'gtk-window-decorator' , 'kde-window-decorator' , 'emerald' , 'metacity' , 'kwin'])
	Popen([set_active_decorator , decorator_replace])

def about_window(widget):
	# About Window
	about_window = gtk.Window(type=gtk.WINDOW_TOPLEVEL)
	about_window.set_title('About - Compiz Manager')
	about_window.set_default_size(400, 227)
	about_window.set_position(gtk.WIN_POS_CENTER)

	# Vbox
	vbox = gtk.VBox(False, 0)
	about_window.add(vbox)

	# Compiz Logo
	compiz_logo = gtk.Image()
	compiz_logo.set_from_file(pixmap_dir + 'about.png')

	# Title Text
	title_text = gtk.Label()
	title_text.set_markup(
	'<span size="xx-large"><b>Compiz Manager v0.6</b></span>'
	)
	title_text.set_justify(gtk.JUSTIFY_CENTER)

	# Undertitle Text
	undertitle_text = gtk.Label()
	undertitle_text.set_markup(
	'User friendly launcher for Compiz/CompComm\n'
	)
	undertitle_text.set_justify(gtk.JUSTIFY_CENTER)

	# Author Text
	author_text = gtk.Label()
	author_text.set_markup(
	'<small>Copyleft - 2007 - F. Bellanger</small>'
	)
	undertitle_text.set_justify(gtk.JUSTIFY_CENTER)

	# Buttons
	hbox_buttons = gtk.HBox(False, 0)

	credits_button = gtk.Button(' _Credits', use_underline=True)
	credits_image = gtk.Image()
	credits_image.set_from_stock(gtk.STOCK_ABOUT, gtk.ICON_SIZE_BUTTON)
	credits_button.set_image(credits_image)
	credits_button.connect("clicked", credits_window)
	quit_button = gtk.Button(stock=gtk.STOCK_CLOSE)
	quit_button.connect("clicked", lambda x: about_window.destroy())
	quit_alignment = gtk.Alignment(1, 0, 0, 0)
	quit_alignment.add(quit_button)

	hbox_buttons.pack_start(credits_button, False, False, 5)
	hbox_buttons.pack_start(quit_alignment, True, True, 5)

	# Adding elements to the Vbox
	vbox.pack_start(compiz_logo, False, False, 5)
	vbox.pack_start(title_text, False, False, 5)
	vbox.pack_start(undertitle_text, False, False, 5)
	vbox.pack_start(author_text, False, False, 5)
	vbox.pack_start(hbox_buttons, False, False, 5)

	about_window.show_all()

def credits_window(widget):
	# Credits Window
	credits_window = gtk.Window(type=gtk.WINDOW_TOPLEVEL)
	credits_window.set_title('Credits - Compiz Manager')
	credits_window.set_default_size(350, 275)
	credits_window.set_position(gtk.WIN_POS_CENTER)

	# Vbox for Credits Window
	vbox_credits = gtk.VBox(False, 0)
	credits_window.add(vbox_credits)

	# Written by tab
	writtenby_frame = gtk.Frame()
	writtenby_frame.set_shadow_type(gtk.SHADOW_OUT)
	writtenby_textarea = gtk.TextView()
	writtenby_textarea.set_editable(False)
	writtenby_textarea.set_size_request(0, 185)
	writtenby_buffer = writtenby_textarea.get_buffer()
	writtenby_buffer.set_text('Felix Bellanger <keeguon@gmail.com>')
	activate_scroll = gtk.ScrolledWindow()
	activate_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
	activate_scroll.add(writtenby_textarea)
	writtenby_frame.add(activate_scroll)

	# Set Tab box
	writtenby_label = gtk.Label('Written by')
	tab_box = gtk.Notebook()
	tab_box.append_page(writtenby_frame, tab_label=writtenby_label)

	# Close button
	close_button = gtk.Button(stock=gtk.STOCK_CLOSE)
	close_button.connect("clicked", lambda x: credits_window.destroy())
	close_alignment = gtk.Alignment(1, 0, 0, 0)
	close_alignment.add(close_button)

	# Append elements to Credits Window via Vbox
	vbox_credits.pack_start(tab_box, False, True, 10)
	vbox_credits.pack_start(close_alignment, False, True, 0)

	# Show Credits Window
	credits_window.show_all()

def quit_menu_activate(widget):
	gtk.main_quit()

# Read list of running processes
processes = popen('ps -A').readlines()

# Check wether GNOME or KDE running
dcop = gnome_session = 0
for line in processes:
	if 'dcop' in line.strip():
		dcop = 1
		gnome_session = 0
	if 'gnome-session' in line.strip():
		dcop = 0
		gnome_session = 1

# Get installed application
app_is_installed = []
apps = ('compiz.real', 'ccsm' , 'gtk-window-decorator', 'kde-window-decorator', 'emerald' , 'metacity' , 'kwin') 
for application in apps:
	if system("which " + application) == 0:
		app_is_installed.append(application)

# Get default GL Decorator
default_gl_decorator()

# Variables
user = getoutput("whoami")
home_directory = '/home/' + user + '/.compiz-trayicon'
config_file = home_directory + '/config.ini'
pixmap_dir = '/usr/share/pixmaps/compiz-trayicon/'

# Home directory related stuffs
if exists(home_directory) == False:
	# Create home directory
	Popen(['mkdir' , home_directory])
	# Create and Write the default config_file
	create_config_file()
if exists(home_directory) == True and exists(config_file) == False:
	# Create and Write the default config_file
	create_config_file()

# Retrieve config from INI File
configuration = ConfigParser.ConfigParser()
configuration.read(config_file)
# WM
set_active_wm = configuration.get('window_manager', 'set_active_wm')
# Decorator
set_active_decorator = configuration.get('decorator', 'set_active_decorator')
# Backend
backend = configuration.get('compiz_backend', 'set_backend')
# Options
fast_filter = configuration.get('compiz_options', 'fast_filter')
indirect_rendering = configuration.get('compiz_options', 'indirect_rendering')
loose_binding = configuration.get('compiz_options', 'loose_binding')

# Window Manager
wm_menu = gtk.Menu()
if installed('compiz.real'):
	compiz_wm = gtk.RadioMenuItem(label=" Compiz")
	compiz_wm.connect("activate", compiz_menu_activate)
	if set_active_wm == 'compiz':
		compiz_wm.set_active(True)
	wm_menu.append(compiz_wm)
if installed('kwin'):
	kwin_wm = gtk.RadioMenuItem(label=" Kwin")
	kwin_wm.set_group(compiz_wm)
	kwin_wm.connect("activate", kwin_menu_activate)
	if set_active_wm == 'kwin':
		kwin_wm.set_active(True)
	wm_menu.append(kwin_wm)
if installed('metacity'):
	metacity_wm = gtk.RadioMenuItem(label=" Metacity")
	metacity_wm.set_group(compiz_wm)
	metacity_wm.connect("activate", metacity_menu_activate)
	if set_active_wm == 'metacity':
		metacity_wm.set_active(True)
	wm_menu.append(metacity_wm)

# Compiz Backend
backend_menu = gtk.Menu()
backend_ccp = gtk.RadioMenuItem(label=" CCP Backend")
backend_ccp.connect("activate", backend_ccp_activate)
if backend == 'ccp':
	backend_ccp.set_active(True)
backend_menu.append(backend_ccp)
backend_gconf = gtk.RadioMenuItem(label=" Gconf Backend")
backend_gconf.connect("activate", backend_gconf_activate)
if backend == 'gconf':
	backend_gconf.set_active(True)
backend_menu.append(backend_gconf)

# Compiz Options
options_menu = gtk.Menu()
option_ff = gtk.CheckMenuItem(label=" Fast Filter")
option_ff.connect("activate", option_ff_activate)
if fast_filter == '--fast-filter':
	option_ff.set_active(True)
options_menu.append(option_ff)
option_ir = gtk.CheckMenuItem(label=" Indirect Rendering")
option_ir.connect("activate", option_ir_activate)
if indirect_rendering == '--indirect-rendering':
	option_ir.set_active(True)
options_menu.append(option_ir)
option_lb = gtk.CheckMenuItem(label=" Loose Binding")
option_lb.connect("activate", option_lb_activate)
if loose_binding == '--loose-binding':
	option_lb.set_active(True)
options_menu.append(option_lb)

# Window Decorator
decorator_menu = gtk.Menu()
if installed('emerald'):
	emerald_decorator = gtk.RadioMenuItem(label=" Emerald")
	emerald_decorator.connect("activate", emerald_menu_activate)
	if set_active_decorator == 'emerald':
		emerald_decorator.set_active(True)
	decorator_menu.append(emerald_decorator)
if installed('kde-window-decorator'):
	kwd_decorator = gtk.RadioMenuItem(label=" KDE Window Decorator")
	kwd_decorator.set_group(emerald_decorator)
	kwd_decorator.connect("activate", kwd_menu_activate)
	if set_active_decorator == 'kde-window-decorator':
		kwd_decorator.set_active(True)
	decorator_menu.append(kwd_decorator)
if installed('gtk-window-decorator'):
	gwd_decorator = gtk.RadioMenuItem(label=" GTK Window Decorator")
	gwd_decorator.set_group(emerald_decorator)
	gwd_decorator.connect("activate", gwd_menu_activate)
	if set_active_decorator == 'gtk-window-decorator':
		gwd_decorator.set_active(True)
	decorator_menu.append(gwd_decorator)

# Compiz-Manager Tray Menu		
menu = gtk.Menu()
item = gtk.ImageMenuItem(stock_id=gtk.STOCK_PREFERENCES)
item.connect("activate", configure_menu_activate)
menu.append(item)
item = gtk.ImageMenuItem('Emerald Theme Manager')
if installed('emerald'):
	item.set_sensitive(True)
else:
	item.set_sensitive(False)
item.connect("activate", etm_menu_activate)
img_etm = gtk.Image()
img_etm.set_from_icon_name("emerald-theme-manager-icon", gtk.ICON_SIZE_MENU)
item.set_image(img_etm)
menu.append(item)
item = gtk.SeparatorMenuItem()
menu.append(item)
# Window Manager Options
item = gtk.ImageMenuItem("Start/Reload Window Manager")
item.connect("activate", start_wm)
img_refresh = gtk.Image()
img_refresh.set_from_stock("gtk-refresh", gtk.ICON_SIZE_MENU)
item.set_image(img_refresh)
menu.append(item)
item = gtk.ImageMenuItem("Select Window Manager")
gtk.MenuItem.set_submenu(item, wm_menu)
img_wm = gtk.Image()
img_wm.set_from_file(pixmap_dir + 'wm-select.png')
item.set_image(img_wm)
menu.append(item)
item = gtk.MenuItem("Compiz Backend")
gtk.MenuItem.set_submenu(item, backend_menu)
menu.append(item)
item = gtk.ImageMenuItem("Compiz Options")
gtk.MenuItem.set_submenu(item, options_menu)
img_options = gtk.Image()
img_options.set_from_stock("gtk-properties", gtk.ICON_SIZE_MENU)
item.set_image(img_options)
menu.append(item)
item = gtk.SeparatorMenuItem()
menu.append(item)
# Window Decorator Options
item = gtk.ImageMenuItem("Start/Reload Decorator")
item.connect("activate", start_decorator)
img_refresh = gtk.Image()
img_refresh.set_from_stock("gtk-refresh", gtk.ICON_SIZE_MENU)
item.set_image(img_refresh)
menu.append(item)
item = gtk.ImageMenuItem("Select Window Decorator")
gtk.MenuItem.set_submenu(item, decorator_menu)
img_wd = gtk.Image()
img_wd.set_from_file(pixmap_dir + 'wd-select.png')
item.set_image(img_wd)
menu.append(item)
item = gtk.SeparatorMenuItem()
menu.append(item)
# Compiz-Manager About and Quit
item = gtk.ImageMenuItem(stock_id=gtk.STOCK_ABOUT)
item.connect("activate", about_window)
menu.append(item)
item = gtk.ImageMenuItem(stock_id=gtk.STOCK_QUIT)
item.connect("activate", quit_menu_activate)
menu.append(item)
menu.show_all()

# Compiz-Manager Tray Icon
pixbuf = gtk.gdk.pixbuf_new_from_file(pixmap_dir + 'tray-icon.svg')
tray = gtk.StatusIcon()
tray.set_from_pixbuf(pixbuf)
tray.set_tooltip("Compiz Manager")
tray.connect("popup-menu", popup_menu, menu)

# Start Compiz
activate_compiz_manager()

# Compiz-Manager Main
gtk.main()