Skip to content

Conversation

friday
Copy link
Member

@friday friday commented Mar 6, 2022

The title is a bit misleading, because ulauncher already does this, but it doesn't do it well.

This PR does four things:

  1. Moves the part of the main scripts that checks for already running instances to the top, and avoid loading all the heavy dependencies until after this check. This makes the command ulauncher about as fast as ulauncher-toggle.
  2. Check if it was invoked with --no-window (if it was, don't show the window of the running Ulauncher instance).
  3. Removes the previous warning "DBus name already taken. Ulauncher is probably backgrounded. Did you mean ulauncher-toggle".
  4. Remove --no-window from the desktop entry. I think it's better if the desktop entry follows the experience of a regular "app", that you can "launch", while the systemd service file has --no-window, because it should run in the background.

What's missing for this to be a perfect solution is the Wayland focus stealing fix from ulauncher-toggle, but that fix is unreliable anyway and I would want to replace it with something better (#986). I think we should keep ulauncher-toggle around for a while anyway because people have that in their DE configs.

Checklist

  • Verify that the test command ./ul test is passing (the CI server will check this if you don't)
  • Update the documentation according to your changes (when applicable)
  • Write unit tests for your changes (when applicable)

@friday friday added this to the 6.0.0 milestone Mar 6, 2022
@friday friday force-pushed the simplify-toggle branch from ad1c54c to 7468e67 Compare March 6, 2022 01:24
Copy link
Member

@troycurtisjr troycurtisjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly a whole lot faster!

Perhaps the dbus stuff could go into a dedicated module, and the actual logic could be in a function which could get called at the bottom of the module automatically at import time. That way at the top of this file it can be just an import, still needing to be called before the heavy weight modules of course. Having a separate module which does a bunch of actual work at import time, including potentially exiting, can be a little odd for sure, but in this case it seems like a reasonable trade off for a cleaner header and nicer division of responsibility. Since we don't need the bus or instance objects later, if they get put into a function then they'd go away automatically as well.

@friday friday force-pushed the simplify-toggle branch 2 times, most recently from 8ee3fad to 54b6bc4 Compare March 8, 2022 10:31
@friday
Copy link
Member Author

friday commented Mar 8, 2022

Certainly a whole lot faster!

👍

Perhaps the dbus stuff could go into a dedicated module, and the actual logic could be in a function which could get called at the bottom of the module automatically at import time. That way at the top of this file it can be just an import, still needing to be called before the heavy weight modules of course. Having a separate module which does a bunch of actual work at import time, including potentially exiting, can be a little odd for sure, but in this case it seems like a reasonable trade off for a cleaner header and nicer division of responsibility. Since we don't need the bus or instance objects later, if they get put into a function then they'd go away automatically as well.

Good idea. I didn't think about this. It sort of hides some important implementation details, but I think it's better also. Especially since we already do a similar thing with ulauncher.utils.xinit.

I didn't implement it exactly like you suggested, but moved the UlauncherDbusService there too (kind of ugly considering how deeply it integrates with the window, but it shares the same dependencies as the other dbus code, so I think this looks cleaner.

@friday friday force-pushed the simplify-toggle branch from 54b6bc4 to af7193a Compare March 8, 2022 10:51
@friday
Copy link
Member Author

friday commented Mar 9, 2022

Closing in favor of #988 (unless that one is rejected for some reason, then we can reevaluate this solution)

@friday friday closed this Mar 9, 2022
@friday friday deleted the simplify-toggle branch March 13, 2022 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants