Skip to content

Conversation

friday
Copy link
Member

@friday friday commented Mar 9, 2022

Alternative implementation of #987, using Gtk.Application for the main loop. This handles stuff we had to do manually before with dbus, so we can remove the python-dbus dependency.

I also removed gi.require_version('GLib', '2.0') because I recently learned it's not needed

As a nice side effect, this seems to get rid of the race condition issue with ulaucher-toggle. Previously I ran into that a lot on Wayland, but now I removed the sleep 0.03 bit completely and it works every time (still need wmctrl though).

I kept things in the same file mostly because I wanted to keep the changes minimal. This PR is just the first part and there' s so much more this opens up for:

  • Move the UlauncherApp to it's own singleton module
  • Moving logic from the window to the app so we can create a new window for each time (this way we won't need wmctrl in ulauncher-toggle)
  • Use the application to send desktop notifications (removing the libnotify dependency).
  • Move the argparse logic to the UlauncherApp.setup method instead of handling it in two places.

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)

…r command launch faster like ulauncher-toggle
@friday friday mentioned this pull request Mar 9, 2022
1 task
@friday friday added this to the 6.0.0 milestone Mar 9, 2022
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.

I'm really liking it, and it didn't really require as much changes as you might have thought! Seems to work great for me (once I updated my workaround shortcut to point to the right place)


def do_command_line(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Should this message signature just be def do_command_line(self, appcl): or similar? Looks like according to doc that is all that will be passed in.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I did originally, but then I get these linting errors locally (my pylint is way more recent than the docker image one though):

ulauncher/main.py:47:4: W0221: Number of parameters was 3 in 'Application.do_command_line' and is now 2 in overridden 'UlauncherApp.do_command_line' method (arguments-differ)
ulauncher/main.py:47:4: W0221: Variadics removed in overridden 'UlauncherApp.do_command_line' method (arguments-differ)

Same for do_activate().

@friday
Copy link
Member Author

friday commented Mar 10, 2022

Pushed some more fixes. I was surprised after doing some tests that the wmctrl workaround just wasn't needed any more at all. When I implemented it it wasn't working to set the focus without it, but now it is (and yes, I'm still on wayland).

So we can remove it after all, and no need to create a new window each time fore that 🎊

Also removed the toggle behavior in favor of always showing. It never really made sense to me have the the hotkey hide the window if it's showing. At least I think it's better to have the behavior consistent, and the new behavior is much better.

Might want to add wmctrl back as an optional dependency for #979 though (if we decide we want to pick up from that PR). I also considered other reasons to use wmctrl more. But in this PR it's not used, so it could be removed.

@friday
Copy link
Member Author

friday commented Mar 13, 2022

Merging. We can always tweak the details later.

@friday friday merged commit fd0c381 into v6 Mar 13, 2022
@friday friday deleted the simplify-toggle-application branch March 13, 2022 16:50
@friday friday mentioned this pull request Mar 29, 2022
@DADA30000
Copy link

Pushed some more fixes. I was surprised after doing some tests that the wmctrl workaround just wasn't needed any more at all. When I implemented it it wasn't working to set the focus without it, but now it is (and yes, I'm still on wayland).

So we can remove it after all, and no need to create a new window each time fore that 🎊

Also removed the toggle behavior in favor of always showing. It never really made sense to me have the the hotkey hide the window if it's showing. At least I think it's better to have the behavior consistent, and the new behavior is much better.

Might want to add wmctrl back as an optional dependency for #979 though (if we decide we want to pick up from that PR). I also considered other reasons to use wmctrl more. But in this PR it's not used, so it could be removed.

can I somehow redo the toggle behavior like it was before? I just have issues with v5, and v6 is working fine, but not having ability to toggle normally is just annoying and I have to workaround that, and also there why launcher is not disappearing after I open application? It;'s just strange and weird for me, other launchers close by default...

@friday
Copy link
Member Author

friday commented Apr 24, 2024

but not having ability to toggle normally is just annoying and I have to workaround that

It's definitely not more "normal" than how we do it now, and it's not coming back. Just press Esc to close. It's standard for windows like this.

and also there why launcher is not disappearing after I open application? It;'s just strange and weird for me, other launchers close by default...

This was fixed and released two days ago: https://github.com/Ulauncher/Ulauncher/releases/tag/v6.0.0-beta10

If you have more feedback for this, please use https://github.com/Ulauncher/Ulauncher/discussions

@Ulauncher Ulauncher locked as resolved and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants