Add Cinnamon support for notification actions and improve support for more types of email clients (e.g.: web apps)#6
Open
victor-marino wants to merge 2 commits intotikank:masterfrom
Conversation
…t support when launching email clients.
Author
|
@tikank just pinging you about this. Did you get a chance to take a look at the PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
This very simple PR improves support for notification actions when an email is received, as partially reported in #5. It only affects the
libnotifyplugin.pyfile.1. Add Cinnamon as a supported desktop environment for notification actions
Right now, the notifications plugin is hard-coded to only enable notification actions if the
_is_gnome_environment()function detects Gnome as the current desktop environment.Given the actions are equally supported in Cinnamon, I've simply added the
cinnamonstring to the values that returntrue, and renamed the relevant functions to reflect this. E.g.:_is_gnome_environment()->_is_supported_environment().Also extracted the supported environments as a list at the beginning of the file for easier readability and expandability if ever needed.
2. Launch email client properly by using
Gio.AppInfo.launch()instead ofstart_subprocess()For some reason, the current code is fetching the name of the executable that launches the email client with
Gio.AppInfo.get_executable(app_info), then trying to launch that executable through the low level functionstart_subprocess(mailclient). Not only is this completely unnecessary, but is also a very fragile implementation and breaks compatibility with any email client that isn't a native app.For instance, I'm using a Fastmail web app as my default email client (Mint's built-in web apps feature is awesome). This means the launch command associated with it is:
sh -c 'XAPP_FORCE_GTKWINDOW_ICON="web-fastmail" firefox --class WebApp-Fastmail3699 --name WebApp-Fastmail3699 --profile /home/MyUser/.local/share/ice/firefox/Fastmail3699 "https://betaapp.fastmail.com"'With the current implementation, the "executable" that is fetched by the plugin is
sh, which obviously means nothing happens when I click the notification.By changing the code to use the more robust
Gio.AppInfo.launch(AppInfo)function directly, the email client is launched correctly regardless of the app type. And as a bonus, we get to delete some code and remove an import 😬I think it should be fairly straightforward to merge, but let me know if I should make any changes!