Exemplo n.º 1
0
	def __init__(self, parent=None):
		QtCore.QObject.__init__(self, parent)
		# Qt sucks (I'm aware this breaks if prefix != /usr...)
		self.Tray = QtGui.QSystemTrayIcon(QtGui.QIcon('/usr/share/icons/hicolor/22x22/apps/fusion-icon.png'))
		self.Tray.setToolTip('Compiz Fusion Icon')
		self.Tray.managerMenu = QtGui.QMenu()
		self.Tray.optionsMenu = QtGui.QMenu()
		self.Tray.decoratorMenu = QtGui.QMenu()
		self.groupManager = QtGui.QActionGroup(self.Tray.managerMenu)
		self.groupDecorator = QtGui.QActionGroup(self.Tray.decoratorMenu)
		for wm in wms.ordered_list:
			actionWM = self.groupManager.addAction(self.Tray.managerMenu.addAction(wms[wm].label, lambda val=wm : self.toggleWM(val)))
			actionWM.setCheckable(True)
			if wms.active == wm:
				actionWM.setChecked(True)
		for option in options:
			actionOP = self.Tray.optionsMenu.addAction(options[option].label, lambda val=option: self.toggleOP(val))
			actionOP.setCheckable(True)
			if not options[option].sensitive:
				actionOP.setEnabled(False)
			actionOP.setChecked(options[option].enabled)
		for decorator in decorators:
			actionWD = self.groupDecorator.addAction(self.Tray.decoratorMenu.addAction(decorators[decorator].label, lambda val=decorator: self.toggleWD(val)))
			actionWD.setCheckable(True)
			if decorators.active == decorator:
				actionWD.setChecked(True)
		self.Tray.menu = QtGui.QMenu()
		if 'ccsm' in apps:
			self.Tray.menu.addAction(apps['ccsm'].label, lambda: run(['ccsm']))
		if 'emerald theme manager' in apps:
			self.Tray.menu.addAction(apps['emerald theme manager'].label, lambda: run(apps['emerald theme manager'].command))
		if 'ccsm' in apps or 'emerald theme manager' in apps:
			self.Tray.menu.addSeparator()
		self.Tray.menu.addAction("Reload Window Manager", self.reload_wm)
		self.Tray.menu.addAction("Select Window Manager").setMenu(self.Tray.managerMenu)
		self.Tray.menu.addAction("Compiz Options").setMenu(self.Tray.optionsMenu)
		self.Tray.menu.addAction("Select Window Decorator").setMenu(self.Tray.decoratorMenu)
		self.Tray.menu.addSeparator()
		self.Tray.menu.addAction("Quit", self.quit)
		self.Tray.setContextMenu(self.Tray.menu)
		self.Tray.show()
		init()
Exemplo n.º 2
0
	def activate(self, widget):
		if widget.get_active():
			decorators[self.decorator].kill_others()
			time.sleep(0.5)
			decorators.active = self.decorator

class CompizDecoratorMenu(gtk.Menu):

	def __init__(self):
		gtk.Menu.__init__(self)

		first = True
		for decorator in decorators:
			if first:
				first_item = CompizDecoratorItem(decorator)
				self.append(first_item)
				first = False
			else:
				item = CompizDecoratorItem(decorator, first_item)
				self.append(item)

icon = gtk.status_icon_new_from_icon_name('fusion-icon')
icon.set_tooltip('Compiz Fusion Icon')
menu = TrayMenu()
icon.connect('popup-menu', menu.show_menu)

# active wm (possibly) starts here
init()
gtk.main()

Exemplo n.º 3
0
		if decorators.active == decorator:
			self.set_active(True)
		self.connect('activate', self.activate)

	def activate(self, widget):
		if widget.get_active():
			decorators[self.decorator].kill_others()
			time.sleep(0.5)
			decorators.active = self.decorator

class CompizDecoratorMenu(Gtk.Menu):

	def __init__(self):
		Gtk.Menu.__init__(self)

		prev = None
		for decorator in decorators:
			item = CompizDecoratorItem(decorator, prev)
			item.set_name(str(decorator))
			self.append(item)
			prev = item

icon = Gtk.StatusIcon.new_from_icon_name('fusion-icon')
icon.set_tooltip_text('Compiz Fusion Icon')
menu = TrayMenu()
icon.connect('popup-menu', menu.show_menu)

# active wm (possibly) starts here
init()
Gtk.main()