diff --git a/catapult/plugins/apps.py b/catapult/plugins/apps.py index 3481fc2..8bcba87 100644 --- a/catapult/plugins/apps.py +++ b/catapult/plugins/apps.py @@ -18,13 +18,38 @@ import re from catapult.api import Plugin +from catapult.api import PreferencesItem from catapult.api import SearchResult from catapult.i18n import _ from gi.repository import Gio +from gi.repository import Gtk + + +class AppsPluginPrefs(PreferencesItem): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.label = Gtk.Label(label=_("Ignore OnlyShowIn Attr")) + self.widget = Gtk.Switch() + self.widget.connect("notify::active", self._on_widget_notify_active) + + def _on_widget_notify_active(self, *args, **kwargs): + return + + def dump(self, window): + value = self.conf.ignore_only_show_in + self.widget.set_active(value) + + def load(self, window): + value = self.widget.get_active() + self.conf.ignore_only_show_in = value + class AppsPlugin(Plugin): title = _("Apps") + conf_defaults = {"ignore_only_show_in": False} + preferences_items = [AppsPluginPrefs] def __init__(self): super().__init__() @@ -54,7 +79,8 @@ def launch(self, window, id): def _list_apps(self): key = lambda x: x.get_filename().lower() for app in sorted(Gio.AppInfo.get_all(), key=key): - if not app.should_show(): continue + if not self.conf.ignore_only_show_in: + if not app.should_show(): continue id = app.get_id() if id == "io.otsaloma.catapult.desktop": continue yield id, app