def prefs_get_all(self, url_params):
     logger.info('API call /get/all')
     return {
         'show_indicator_icon':
         self.settings.get_property('show-indicator-icon'),
         'hotkey_show_app':
         self.get_app_hotkey(),
         'autostart_allowed':
         self.autostart_pref.is_allowed(),
         'autostart_enabled':
         self.autostart_pref.is_on(),
         'show_recent_apps':
         self.settings.get_property('show-recent-apps'),
         'clear_previous_query':
         self.settings.get_property('clear-previous-query'),
         'blacklisted_desktop_dirs':
         self.settings.get_property('blacklisted-desktop-dirs'),
         'available_themes':
         self._get_available_themes(),
         'theme_name':
         Theme.get_current().get_name(),
         'is_wayland':
         is_wayland(),
         'env': {
             'version': get_version(),
             'user_home': os.path.expanduser('~')
         }
     }
예제 #2
0
 def check_compatibility(self):
     app_version = get_version()
     # only API version 1 is supported for now
     if self.get_api_version() != '1':
         raise VersionIncompatibilityError(
             'Extension "%s" is not compatible with Ulauncher v%s' %
             (self.extension_id, app_version))
예제 #3
0
파일: main.py 프로젝트: lakedai/Ulauncher
def main():
    """
    Main function that starts everything
    """

    # start DBus loop
    DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()
    instance = bus.request_name(DBUS_SERVICE)

    if instance != dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER:
        print(
            "DBus name already taken. Ulauncher is probably backgrounded. Did you mean `ulauncher-toggle`?",
            file=sys.stderr)
        toggle_window = dbus.SessionBus().get_object(
            DBUS_SERVICE, DBUS_PATH).get_dbus_method("toggle_window")
        toggle_window()
        return

    _create_dirs()

    options = get_options()
    setup_logging(options)
    logger = logging.getLogger('ulauncher')
    logger.info('Ulauncher version %s', get_version())
    logger.info('Extension API version %s', api_version)
    logger.info("GTK+ %s.%s.%s", Gtk.get_major_version(),
                Gtk.get_minor_version(), Gtk.get_micro_version())
    logger.info("Is Wayland: %s", is_wayland())
    logger.info("Wayland compatibility: %s",
                ('on' if is_wayland_compatibility_on() else 'off'))

    # log uncaught exceptions
    def except_hook(exctype, value, tb):
        logger.error("Uncaught exception", exc_info=(exctype, value, tb))

    sys.excepthook = except_hook

    window = UlauncherWindow.get_instance()
    UlauncherDbusService(window)
    if not options.hide_window:
        window.show()

    if Settings.get_instance().get_property('show-indicator-icon'):
        AppIndicator.get_instance().show()

    # workaround to make Ctrl+C quitting the app
    signal_handler = SignalHandler(window)
    gtk_thread = run_async(Gtk.main)()
    try:
        while gtk_thread.is_alive() and not signal_handler.killed():
            time.sleep(0.5)
    except KeyboardInterrupt:
        logger.warning('On KeyboardInterrupt')
    finally:
        Gtk.main_quit()
 def prefs_get_all(self, url_params):
     logger.info('API call /get/all')
     return {
         'show_indicator_icon': self.settings.get_property('show-indicator-icon'),
         'hotkey_show_app': self.get_app_hotkey(),
         'autostart_allowed': self.autostart_pref.is_allowed(),
         'autostart_enabled': self.autostart_pref.is_on(),
         'show_recent_apps': self.settings.get_property('show-recent-apps'),
         'clear_previous_query': self.settings.get_property('clear-previous-query'),
         'blacklisted_desktop_dirs': self.settings.get_property('blacklisted-desktop-dirs'),
         'available_themes': self._get_available_themes(),
         'theme_name': Theme.get_current().get_name(),
         'is_wayland': is_wayland(),
         'env': {
             'version': get_version(),
             'user_home': os.path.expanduser('~')
         }
     }
예제 #5
0
 def check_compatibility(self):
     app_version = get_version()
     if self.get_required_api_version() != '1':
         raise VersionIncompatibilityError('Extension "%s" is not compatible with Ulauncher v%s' %
                                           (self.extension_id, app_version))