Beispiel #1
0
	def write_items(self, items):
		our_ext = ".kfcom"

		def make_obj_filename(lname, id_):
			id_ = id_.replace("/", "_")
			return "%s (%s)%s" % (lname, id_, our_ext)

		written_now = set()
		for obj in items:
			obj = AppLeaf(obj)
			action = objects.Launch()
			composed = compose.ComposedLeaf(obj, action)
			lname = kupferstring.tolocale(unicode(obj))
			basename = make_obj_filename(lname, obj.get_id())
			filename = os.path.join(DOCKDIR, basename)
			written_now.add(basename)
			if os.path.exists(filename):
				#debug_log("exists:", filename)
				continue
			debug_log("creating:", filename)
			tmpname = "%s.%d" % (basename, os.getpid())
			execfile.save_to_file(composed, tmpname)
			execfile.update_icon(obj, tmpname)
			gio.File(tmpname).move(gio.File(filename),
			                       flags=gio.FILE_COPY_OVERWRITE)

		for fname in os.listdir(DOCKDIR):
			if fname.endswith(our_ext) and fname not in written_now:
				filepath = os.path.join(DOCKDIR, fname)
				if os.access(filepath, os.W_OK):
					debug_log("remove:", fname)
					gio.File(os.path.join(DOCKDIR, fname)).delete(None)
Beispiel #2
0
	def get_items(self):
		# If we set proper desktop environment
		# We get exactly the apps shown in the menu,
		# as well as the preference panes
		desktop_type = __kupfer_settings__["desktop_type"]
		desktop_app_info_set_desktop_env(desktop_type)
		# Add this to the default
		whitelist = set([
			# if you set/reset default handler for folders it is useful
			"nautilus-folder-handler.desktop",
			# we think that these are useful to show
			"eog.desktop",
			"evince.desktop",
			"gnome-about.desktop",
			"gstreamer-properties.desktop",
			"notification-properties.desktop",
			])
		blacklist = set([
			"nautilus-home.desktop",
		])

		for item in app_info_get_all():
			id_ = item.get_id()
			if id_ in whitelist or (item.should_show() and not id_ in blacklist):
				yield AppLeaf(item)
Beispiel #3
0
    def get_items(self):
        use_filter = __kupfer_settings__["desktop_filter"]
        desktop_type = __kupfer_settings__["desktop_type"]

        # Add this to the default

        for item in Gio.app_info_get_all():
            id_ = item.get_id()
            if id_ in WHITELIST_IDS or (self.should_show(
                    item, desktop_type, use_filter)
                                        and not id_ in BLACKLIST_IDS):
                yield AppLeaf(item)
Beispiel #4
0
    def get_items(self):
        use_filter = __kupfer_settings__["desktop_filter"]
        desktop_type = __kupfer_settings__["desktop_type"]

        # Get all apps; this includes those only configured for
        # opening files with.
        for item in Gio.AppInfo.get_all():
            if AppSource.should_show(item, desktop_type, use_filter):
                continue
            if not item.supports_uris() and not item.supports_files():
                continue
            yield AppLeaf(item)
Beispiel #5
0
	def get_items(self):
		for data_dir in config.get_data_dirs("sendto", package="Thunar"):
			for filename in os.listdir(data_dir):
				if not filename.endswith('.desktop'):
					continue
				file_path = os.path.join(data_dir, filename)
				if not os.path.isfile(file_path):
					continue
				try:
					yield AppLeaf(init_path=file_path, require_x=False)
				except InvalidDataError:
					pass
Beispiel #6
0
 def _activate(self, app_leaf, paths, ctx):
     opti_app_leaf_obj = gio.AppInfo("optirun "+app_leaf.object.get_commandline(),
                                     app_leaf.object.get_name())
     opti_app_leaf = AppLeaf(item=opti_app_leaf_obj)
     opti_app_leaf.launch(paths=paths, ctx=ctx)
Beispiel #7
0
 def get_items(self):
     is_running = launch.application_is_running
     return (AppLeaf(ai) for ai in self.all_apps if is_running(ai))