Ejemplo n.º 1
0
	def generate(self, menuhandler):
		rv = []
		for p in menuhandler.config['recent_profiles']:
			filename = find_profile(p)
			if filename:
				menuitem = MenuItem("generated", p)
				menuitem.filename = filename
				menuitem.callback = ProfileListMenuGenerator.callback
				rv.append(menuitem)
			if len(rv) >= self.rows:
				break
		return rv
Ejemplo n.º 2
0
	def generate(self, menuhandler):
		rv = []
		for p in menuhandler.config['recent_profiles']:
			filename = find_profile(p)
			if filename:
				menuitem = MenuItem("generated", p)
				menuitem.filename = filename
				menuitem.callback = ProfileListMenuGenerator.callback
				rv.append(menuitem)
			if len(rv) >= self.rows:
				break
		return rv
Ejemplo n.º 3
0
	def generate(self, menuhandler):
		if GameListMenuGenerator._games is None:
			GameListMenuGenerator._games = []
			id = 0
			for x in Gio.AppInfo.get_all():
				if x.get_categories():
					if "Game" in x.get_categories().split(";"):
						menuitem = MenuItem(str(id), x.get_display_name(),
							icon = x.get_icon())
						menuitem.callback = GameListMenuGenerator.callback
						menuitem._desktop_file = x
						GameListMenuGenerator._games.append(menuitem)
		return GameListMenuGenerator._games
Ejemplo n.º 4
0
	def generate(self, menuhandler):
		if GameListMenuGenerator._games is None:
			GameListMenuGenerator._games = []
			id = 0
			for x in Gio.AppInfo.get_all():
				if x.get_categories():
					if "Game" in x.get_categories().split(";"):
						menuitem = MenuItem(str(id), x.get_display_name(),
							icon = x.get_icon())
						menuitem.callback = GameListMenuGenerator.callback
						menuitem._desktop_file = x
						GameListMenuGenerator._games.append(menuitem)
		return GameListMenuGenerator._games
Ejemplo n.º 5
0
	def generate(self, menuhandler):
		# TODO: Cannot load directory content asynchronously here and I'm
		# TODO: not happy about it
		rv, all_profiles = [], {}
		for d in (get_default_profiles_path(), get_profiles_path()):
			for x in os.listdir(d):
				if x.endswith(".sccprofile") and not x.startswith("."):
					all_profiles[x] = os.path.join(d, x)
		for p in sorted(all_profiles, key=lambda s: s.lower()):
			menuitem = MenuItem("generated", p[0:-11])	# strips ".sccprofile"
			menuitem.filename = all_profiles[p]
			menuitem.callback = self.callback
			rv.append(menuitem)
		return rv
Ejemplo n.º 6
0
	def generate(self, menuhandler):
		# TODO: Cannot load directory content asynchronously here and I'm
		# TODO: not happy about it
		rv, all_profiles = [], {}
		for d in (get_default_profiles_path(), get_profiles_path()):
			for x in os.listdir(d):
				if x.endswith(".sccprofile") and not x.startswith("."):
					all_profiles[x] = os.path.join(d, x)
		for p in sorted(all_profiles, key=lambda s: s.lower()):
			menuitem = MenuItem("generated", p[0:-11])	# strips ".sccprofile"
			menuitem.filename = all_profiles[p]
			menuitem.callback = self.callback
			rv.append(menuitem)
		return rv
Ejemplo n.º 7
0
	def generate(self, menuhandler):
		rv = []
		dpy = X.Display(hash(GdkX11.x11_get_default_xdisplay()))	# Magic
		root = X.get_default_root_window(dpy)
		
		count, wlist = X.get_window_prop(dpy, root, "_NET_CLIENT_LIST", 1024)
		skip_taskbar = X.intern_atom(dpy, "_NET_WM_STATE_SKIP_TASKBAR", True)
		wlist = cast(wlist, POINTER(X.XID))[0:count]
		for win in wlist:
			if not skip_taskbar in X.get_wm_state(dpy, win):
				title = X.get_window_title(dpy, win)[0:self.MAX_LENGHT]
				menuitem = MenuItem(str(win), title)
				menuitem.callback = WindowListMenuGenerator.callback
				rv.append(menuitem)
		return rv
Ejemplo n.º 8
0
	def generate(self, menuhandler):
		rv = []
		dpy = X.Display(hash(GdkX11.x11_get_default_xdisplay()))	# Magic
		root = X.get_default_root_window(dpy)
		
		count, wlist = X.get_window_prop(dpy, root, "_NET_CLIENT_LIST", 1024)
		skip_taskbar = X.intern_atom(dpy, "_NET_WM_STATE_SKIP_TASKBAR", True)
		wlist = cast(wlist, POINTER(X.XID))[0:count]
		for win in wlist:
			if not skip_taskbar in X.get_wm_state(dpy, win):
				title = X.get_window_title(dpy, win)[0:self.MAX_LENGHT]
				menuitem = MenuItem(str(win), title)
				menuitem.callback = WindowListMenuGenerator.callback
				rv.append(menuitem)
		return rv