Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systray support #98

Open
jvoisin opened this issue May 13, 2017 · 102 comments
Open

Systray support #98

jvoisin opened this issue May 13, 2017 · 102 comments
Labels
feature request Request to add a new feature to Dino

Comments

@jvoisin
Copy link

jvoisin commented May 13, 2017

It would be super-nice to be able to minimize dino to the systray :)

Not everyone is using GNOME3.
But if dino is willing to only target GNOME3, it should be specified somewhere.

Copy link
Member

May 13, 2017

@jvoisin Dino definitely does not only target Gnome 3.

@NicoHood
Copy link

Also elementary OS exposes this tray if i am not wrong. It really handy to have some notification. Because currently there is none at all. See #70

@elouin
Copy link

elouin commented Jun 21, 2017

Id love to see that feature too.

@mase76
Copy link

mase76 commented Sep 24, 2017

This is a needed feature for me. I use XFCE. Also starting mininized to tray would be welcome

@theScrabi
Copy link

Same here, I'm using Cinnamon, and I desperately ned that in order to be able to use dino.

@theScrabi
Copy link

I've send Michal Čihař form weblate a mail, he has admin rights.

@benrob0329
Copy link

benrob0329 commented Apr 1, 2018

Do any other environments have persistent notifications? If so that would be good as well/instead.

I would also like to note that you can minimize it normally, you will get notifications for new messages :-)

@theScrabi
Copy link

you will get notifications for new messages

That is right, but sometimes you exigently close it, and you always have an open task in your taskbar.

@benrob0329
Copy link

I suppose its the difference of always having a task open in your systray vs always having one open in your taskbar.

@theScrabi
Copy link

Yes.

Copy link

I don't understand what this has to do with GNOME. I run the latest version of GNOME in Debian Buster (testing) and can't find a persistent Dino icon.

@theScrabi
Copy link

Its for people who are not using gnome, but for example cinnamon.

Copy link

@theScrabi: I didn't write clear enough, sorry. This ticket suggests that this should not be an issue on GNOME. But on my system (with GNOME) I have the problem that dino is in my taskbar all the time.

I did some research and found out how this is supposed to work on GNOME 3.

Every application should always have a primary window and this window should always be raised when the application is launched.

So I guess GNOME wants me to hide windows by putting them on a different workspace?

But I just realized that I'm using GNOME classic mode and I guess that behaves more like "old-school" DEs anyway.

@theScrabi
Copy link

Yes, I guess this is how it should work on gnome.

@theScrabi
Copy link

I think this is a questionable design decision by gnome, but it makes kind of sense. However this behavior should defiantly be something you should be able to switch off, so dino can be used on other desktop evironments.

@benrob0329
Copy link

I mean, you can use it fine on other desktop environments. I don't understand why not having a systemtray icon makes it only usable on GNOME, lots of applications don't have a systemtray icon.

We have other ways to hide windows, such as multiple workspaces, and minimizing. Anything more advanced than TWM has those, even WIndows nowadays. While yes, having a systemtray icon would be nice, I think saying its required is a stretch to say the least.

@theScrabi
Copy link

Well I can say that I am one who quickly presses the x butten if I want to have a window out of sight... It makes sense on desktop environments where its "normal" to x a window if you dont want to see it anymore. So i don't see a reason to first check if its "dino" im trying to close and then make an exception in my brain, that not I exidently close it. -> Broken UI consistency.

I can't speak for others but for me that is super annoying and yes, a reason to turn away from dino.

I don't want to sound harsch, but i think its a little egoistic thinking to make an app only blend in well into one specific desktop environment. Maybe adding this feature might come in handy since you could get more satisfied users from other DEs ;D

@benrob0329
Copy link

As someone who has used almost everything from AwesomeWM to XFCE I've never had a "hit X to hide" mentality, and honestly I find it very odd that you see the button who's default behavior is to quit the app as a means to hide a window (non destructively). To each his own, but I wouldn't exactly call it "sane defaults" to assume every app would do that.

@theScrabi
Copy link

On a system with systray that is default behavior for almost all chat aplications.

@IeP4nieF
Copy link

Any progress in systray implementation?

systray implementation would be very nice!

@mar-v-in
Copy link
Member

mar-v-in commented Aug 9, 2019

I'd like to have some clarification on the desired feature here. I see various, largely independent features requested here:

  1. Display an icon in the "systray" additional to the taskbar on platform supporting it.
  2. When closing a window (by pressing the X), don't close it but minimize it.
  3. When minimizing a window, hide the taskbar entry and only stick with the "systray" icon.

Dino is not targeting GNOME3, but also not targeting Linux either (although right now, that's the most popular platform among Dino users).There is no common understanding of the term "systray" across operating systems and desktop environments:

  • Windows 7 and before have a "notification area" (docs). One of the use cases of "notification area" envisioned by Microsoft is "Minimized single-instance application", which is what best describes Dino, however this usecase asks that "Doing so is optional and users must opt in.", so it shouldn't be default. This usage is also no longer recommended for Windows 7 (instead one should minimize to taskbar). Also Microsoft asks that such icons are also be used to display status and to pop up notifications.
  • Windows 10 deprecated the old "notification area" that is typically referred to as "systray". Instead one should use Toasts (docs) for notifications and if running in the background should be mostly invisible.
  • GNOME doesn't have a "systray" anymore, instead they are using the notification panel for displaying notifications and apps always have a running window or use an independent background service that doesn't have a window and that is only usable from within a window of the actual application.
  • macOS can display arbitrary menu icons in the top right of the menu bar for background services. These icons are supposed to display a menu with various program related options and should also display status when it makes sense. Applications can be started without having a window and the fact an app is running is indicated in the Dock. The dock can also display an unread message count and bounce to raise awareness, thus most apps should use a dock icon and display a notification using the notification center instead of using a menu bar icon.

So I wonder, what actually is the desired functionality here. Do we need a "systray" icon when closing the window will only minimize and not close it? If closing the window doesn't close it anymore, but minimizes, how do I close it?

I can imagine to add a "Keep Dino running when closing its window" setting, but the correct behavior of that setting isn't clear to me and most likely differs between platforms. "Systray support", as the issue is named, severely simplifies the underlying feature request, probably targeting towards a very specific usecase on a certain platform/desktop environment.

@theScrabi
Copy link

theScrabi commented Aug 10, 2019

  1. The problem is that not everyone is using gnome. Desktops like xfce, or cinnamon dont use fancy notifications, as gnome has. Those users either always see the window and need to think "better nit click that x" or just don't use dinno. So you baiscly log out non gnome users.
  2. Even on gnome i don't want to have a window up and running, that would take away at leas one desktop, if I wanted to see no window. So there at least running as a background service should be implemented.
  3. The question what happens when you click X should be left over to the settings.

Don't take this as on offence I still like this Project :)

@IeP4nieF
Copy link

"systray support" means for me:

  1. Display a icon in the systray, while dino is running.
  2. Hide the taskbar icon, during the time dino is minized to the systray.

Like riot (desktop) or gajim does.

Otherwise there are to much tasbar icons, if you are using multiple messengers.

@mar-v-in
Copy link
Member

@theScrabi

Desktops like xfce, or cinnamon dont use fancy notifications, as gnome has. Those users either always see the window and need to think "better nit click that x" or just don't use dino.

I don't understand what you're saying here. Last time I checked, both xfce and cinnamon have support for the freedesktop.org notifcation-spec and thus get notifications from Dino displayed. I also don't understand how this is related to the meaning of the window's close button.

Even on gnome i don't want to have a window up and running, that would take away at leas one desktop, if I wanted to see no window.

If you don't want to see the window you should just minimize it.

The question what happens when you click X should be left over to the settings.

When you click close button it should close the window and not minimize it. If you click the minimize button it should minimize it to the taskbar and not close it. That is the operating system default on every operating system.

We are now talking about adding a background service that is not bound to the window, so the window can be closed without loosing the connectivity to the network.

Additional settings increase the complexity of using an application, just because you could do something doesn't mean you should.

@theScrabi
Copy link

In short i wanted to say what @IeP4nieF said.

@marmistrz
Copy link

Which API should be used to implement this? There's the deprecated Gtk.StatusIcon, there's also libappindicator

@mar-v-in
Copy link
Member

mar-v-in commented Aug 17, 2019

GtkStatusIcon is not only deprecated in GTK 3, it is also already removed from preview versions of GTK 4, so it wouldn't be a clever move to start using it now.

libappindicator is basically deprecated as well. It was developed and used for Unity desktop that was abandoned by Canonical/Ubuntu. It is compatible with KStatusNotifierItem (supported by KDE and Unity and others via plugin) and includes a fallback to GtkStatusIcon (for all other desktops and platforms), thus also relies on that deprecated, soon-to-be-removed functionality of GTK.

Copy link

image

@2561024
Copy link
Contributor

2561024 commented Dec 17, 2021

i think patch do not apply...

@simonkrauter
Copy link

@WKG I can't figure out how to apply your patch file. It says it could find the files to patch.
Would be nice, if you could provide the changes as a fork/PR.

@Quix0r
Copy link

Quix0r commented Jan 5, 2022

I cannot upload it here, "Something went really wrong" comes here. But I can link it to my server.

@2561024
Copy link
Contributor

2561024 commented Jan 5, 2022

@WKG I can't figure out how to apply your patch file. It says it could find the files to patch. Would be nice, if you could provide the changes as a fork/PR.

I tried PR... but the maintainers want SNI.

https://github.com/wkg/dino/tree/trayicon

@Junker
Copy link

Junker commented Feb 4, 2022

what do you think about using this lib: https://github.com/SkyMaverick/statusnotifier ?
It has vapi for vala, can be easily integrated to Dino.

Copy link

@WKG your patch doesn't seem to work with a wayland-sway-waybar's tray.

Does it use xembed, not SNI?

Have you considered using libappindicator?

@emildekeyser
Copy link

i will start right now working on this

@phragment
Copy link

i will start right now working on this

Maybe my implementation can help you as starting point:
phragment@674fe70

I'm not really into the "minimize to systray" functionality, but I implemented a trayicon using libindicator which simply changes for unread messages, since I like this as unobstrusive notifications (as opposed to notifyd toasts).

@emildekeyser
Copy link

what do you think about using this lib: https://github.com/SkyMaverick/statusnotifier ? It has vapi for vala, can be easily integrated to Dino.

Ok guys little status update: I have done some R&D and I figured out why SNI was not working on multiple diffrent machines of mine (Cinnamon and polybar don't support it properly). But nothing unovercomable. So I am ready to implement trayicon with the statusnotifier library mentioned by Junker. Is that alright for you guys or do I need to do a full implemenation of SNI in vala in the Dino codebase ? If I can use the mentioned statusnotifier lib, I assume I sould fully add it to the Dino codebase right ? On arch I have it from the aur but on other distro's it might be a hassle to install it as a build dependancy separatly from Dino I guess.

@2561024
Copy link
Contributor

2561024 commented Mar 8, 2022

what do you think about using this lib: https://github.com/SkyMaverick/statusnotifier ? It has vapi for vala, can be easily integrated to Dino.

Ok guys little status update: I have done some R&D and I figured out why SNI was not working on multiple diffrent machines of mine (Cinnamon and polybar don't support it properly). But nothing unovercomable. So I am ready to implement trayicon with the statusnotifier library mentioned by Junker. Is that alright for you guys or do I need to do a full implemenation of SNI in vala in the Dino codebase ? If I can use the mentioned statusnotifier lib, I assume I sould fully add it to the Dino codebase right ? On arch I have it from the aur but on other distro's it might be a hassle to install it as a build dependancy separatly from Dino I guess.

can you give a patch or branch?

@emildekeyser
Copy link

Contributor

@wkg ** wkg ** commented 17 hours ago

#1209

@ThomasAH
Copy link

Just a quick +1 from me for this feature: One of our users wants to switch from a different Jabber client to Dino, but this feature is important for him.

@TriggerDingus
Copy link

Related request/issue: #299 (comment)

@Quix0r
Copy link

Quix0r commented Feb 24, 2023

My patch is longer fitting with the newer version:

diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala
index 97ea5482..0c3317f2 100644
--- a/libdino/src/entity/settings.vala
+++ b/libdino/src/entity/settings.vala
@@ -12,6 +12,7 @@ public class Settings : Object {
         notifications_ = col_to_bool_or_default("notifications", true);
         convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true);
         check_spelling = col_to_bool_or_default("check_spelling", true);
+        trayicon = col_to_bool_or_default("trayicon", true);
     }
 
     private bool col_to_bool_or_default(string key, bool def) {
@@ -78,6 +79,17 @@ public class Settings : Object {
             check_spelling_ = value;
         }
     }
+    private bool trayicon_;
+    public bool trayicon {
+        get { return trayicon_; }
+        set {
+            db.settings.upsert()
+                .value(db.settings.key, "trayicon", true)
+                .value(db.settings.value, value.to_string())
+                .perform();
+            trayicon_ = value;
+        }
+    }
 }
 
 }
diff --git a/main/data/settings_dialog.ui b/main/data/settings_dialog.ui
index d5b7ac92..5956c46d 100644
--- a/main/data/settings_dialog.ui
+++ b/main/data/settings_dialog.ui
@@ -77,6 +77,18 @@
                                 <property name="height">1</property>
                             </packing>
                         </child>
+                        <child>
+                            <object class="GtkCheckButton" id="trayicon_checkbutton">
+                                <property name="label" translatable="yes">Tray icon</property>
+                                <property name="visible">True</property>
+                            </object>
+                            <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">5</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                            </packing>
+                        </child>
                     </object>
                 </child>
             </object>
diff --git a/main/src/main.vala b/main/src/main.vala
index afa1f52b..393d833a 100644
--- a/main/src/main.vala
+++ b/main/src/main.vala
@@ -1,8 +1,10 @@
+using Gtk;
 using Dino.Entities;
 using Dino.Ui;
 
 extern const string GETTEXT_PACKAGE;
 extern const string LOCALE_INSTALL_DIR;
+StatusIcon trayicon;
 
 namespace Dino {
 
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index ecbea85e..362a8230 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -20,8 +20,45 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
     public StreamInteractor stream_interactor { get; set; }
     public Plugins.Registry plugin_registry { get; set; default = new Plugins.Registry(); }
     public SearchPathGenerator? search_path_generator { get; set; }
-
+    private Gtk.Menu menuSystem;
+    public bool mactive = false;
     internal static bool print_version = false;
+
+    private void menuSystem_popup(uint button, uint time) {
+	mactive = window.is_active;
+        menuSystem.popup(null, null, null, button, time);
+    }
+
+    private void tray_clicked_left() {
+	tray_clicked(false);
+    }
+    private void tray_clicked_menu() {
+	tray_clicked(true);
+    }
+    private void tray_clicked(bool from_menu) {
+         if (window == null) {
+                controller = new MainWindowController(this, stream_interactor, db);
+                config = new Config(db);
+                window = new MainWindow(this, stream_interactor, db, config);
+                controller.set_window(window);
+	        window.present();
+        }
+	window.delete_event.connect((event) => {
+		window.hide();
+		return true;
+	});
+	if(from_menu==false) mactive = window.is_active;
+	if(window.visible==false) {
+		window.show();
+	} else {
+		if(mactive==false) {
+			window.present();
+		} else {
+			window.hide();
+		}
+	}
+    }
+
     private const OptionEntry[] options = {
         { "version", 0, 0, OptionArg.NONE, ref print_version, "Display version number", null },
         { null }
@@ -40,6 +77,57 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
         create_actions();
         add_main_option_entries(options);
 
+	if(settings.trayicon) {
+	        trayicon = new StatusIcon.from_icon_name("im.dino.Dino");
+		trayicon.set_tooltip_text ("Dino");
+	        trayicon.set_visible(true);
+	        trayicon.activate.connect(tray_clicked_left);
+
+		menuSystem = new Gtk.Menu();
+
+	        var box = new Box (Orientation.HORIZONTAL, 6);
+	        var label = new Label ("Show/Hide Dino");
+	        var menuItem = new Gtk.MenuItem();
+	        box.add (label);
+	        menuItem.add (box);
+	        menuItem.activate.connect(tray_clicked_menu);
+	        menuSystem.append(menuItem);
+
+	        box = new Box (Orientation.HORIZONTAL, 6);
+	        label = new Label ("Accounts");
+	        menuItem = new Gtk.MenuItem();
+	        box.add (label);
+	        menuItem.add (box);
+	        menuItem.activate.connect(show_accounts_window);
+	        menuSystem.append(menuItem);
+
+	        box = new Box (Orientation.HORIZONTAL, 6);
+	        label = new Label ("Settings");
+	        menuItem = new Gtk.MenuItem();
+	        box.add (label);
+	        menuItem.add (box);
+	        menuItem.activate.connect(show_settings_window);
+	        menuSystem.append(menuItem);
+
+	        box = new Box (Orientation.HORIZONTAL, 6);
+	        label = new Label ("About");
+	        menuItem = new Gtk.MenuItem();
+	        box.add (label);
+	        menuItem.add (box);
+	        menuItem.activate.connect(show_about_window);
+	        menuSystem.append(menuItem);
+	
+	        box = new Box (Orientation.HORIZONTAL, 6);
+	        label = new Label ("Quit");
+	        menuItem = new Gtk.MenuItem();
+	        box.add (label);
+	        menuItem.add (box);
+	        menuItem.activate.connect(quit);
+	        menuSystem.append(menuItem);
+	        menuSystem.show_all();
+	        trayicon.popup_menu.connect(menuSystem_popup);
+	}
+
         startup.connect(() => {
             if (print_version) {
                 print(@"Dino $(Dino.VERSION)\n");
@@ -53,6 +141,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
                 notification_events.register_notification_provider(free_desktop_notifier);
             }
             notification_events.notify_content_item.connect((content_item, conversation) => {
+		trayicon.set_from_icon_name("dino-emoticon-symbolic");
                 // Set urgency hint also if (normal) notifications are disabled
                 // Don't set urgency hint in GNOME, produces "Window is active" notification
                 var desktop_env = Environment.get_variable("XDG_CURRENT_DESKTOP");
@@ -70,7 +159,10 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
                 config = new Config(db);
                 window = new MainWindow(this, stream_interactor, db, config);
                 controller.set_window(window);
-                if ((get_flags() & ApplicationFlags.IS_SERVICE) == ApplicationFlags.IS_SERVICE) window.delete_event.connect(window.hide_on_delete);
+                if ((get_flags() & ApplicationFlags.IS_SERVICE) == ApplicationFlags.IS_SERVICE || settings.trayicon) window.delete_event.connect((event) => {
+			window.hide();
+			return true;
+		});
             }
             window.present();
         });
diff --git a/main/src/ui/main_window_controller.vala b/main/src/ui/main_window_controller.vala
index dceb4094..1c3ba6d2 100644
--- a/main/src/ui/main_window_controller.vala
+++ b/main/src/ui/main_window_controller.vala
@@ -72,6 +72,7 @@ public class MainWindowController : Object {
             return false;
         });
         window.focus_in_event.connect(() => {
+            trayicon.set_from_icon_name("im.dino.Dino");
             stream_interactor.get_module(ChatInteraction.IDENTITY).on_window_focus_in(conversation);
             window.urgency_hint = false;
             return false;
diff --git a/main/src/ui/settings_dialog.vala b/main/src/ui/settings_dialog.vala
index e994e00c..687bffef 100644
--- a/main/src/ui/settings_dialog.vala
+++ b/main/src/ui/settings_dialog.vala
@@ -10,6 +10,7 @@ class SettingsDialog : Dialog {
     [GtkChild] private unowned CheckButton notification_checkbutton;
     [GtkChild] private unowned CheckButton emoji_checkbutton;
     [GtkChild] private unowned CheckButton check_spelling_checkbutton;
+    [GtkChild] private unowned CheckButton trayicon_checkbutton;
 
     Dino.Entities.Settings settings = Dino.Application.get_default().settings;
 
@@ -21,12 +22,14 @@ class SettingsDialog : Dialog {
         notification_checkbutton.active = settings.notifications;
         emoji_checkbutton.active = settings.convert_utf8_smileys;
         check_spelling_checkbutton.active = settings.check_spelling;
+        trayicon_checkbutton.active = settings.trayicon;
 
         typing_checkbutton.toggled.connect(() => { settings.send_typing = typing_checkbutton.active; } );
         marker_checkbutton.toggled.connect(() => { settings.send_marker = marker_checkbutton.active; } );
         notification_checkbutton.toggled.connect(() => { settings.notifications = notification_checkbutton.active; } );
         emoji_checkbutton.toggled.connect(() => { settings.convert_utf8_smileys = emoji_checkbutton.active; });
         check_spelling_checkbutton.toggled.connect(() => { settings.check_spelling = check_spelling_checkbutton.active; });
+        trayicon_checkbutton.toggled.connect(() => { settings.trayicon = trayicon_checkbutton.active; });
     }
 }

Can someone please try to upgrade it? I don't know Vala.

@barbara-sturbo
Copy link

Hi everyone I've been looking forward to this for 2+ years now. Any chance this will get any traction?
Regards.

@Asquator
Copy link

Anyone here? I think it's the most important feature to be added to Dino as soon as possible

@afranke
Copy link

afranke commented May 25, 2023

@Asquator looking forward to your pull request as soon as possible.

@Jieiku
Copy link

Jieiku commented Dec 25, 2023

This is a hard requirement for me.

Unfortunately until this can be resolved will just have to stick with pidgin.

@3615pipou
Copy link

Any news for this basic feature ?

@TriggerDingus
Copy link

Any news for this basic feature ?

A developer above mentioned "awaiting your pull request as soon as possible", so I think that sums it up. The developers seem to disagree with their potential user community on this feature and so it isn't likely to happen. It's disappointing to me but I have no right to complain - it would be like complaining about the confusing design decisions GNOME have about their desktop when, in the end, it's their sandbox and their toys. I appreciate the option Dino provided me and my best wishes to the team.

@emildekeyser
Copy link

emildekeyser commented Jan 28, 2024 via email

@TriggerDingus
Copy link

Unfortunatly I do not have enough time/will to finish my patch. It was actually a bit stupid of me to not communicate this earlier because I think that the patch was mergable already, the open points on it could have easily been migrated to another open issue. I do really want to finish it but it is simply not a high priority for me atm. Although I am in the process of rebuilding my personal xmpp infrastructure. So maybe the priority will be bumped at some point (if I get annoyed enough with using my old forks XD). Also I found that having to work with glib and dbus and making a custom SNI implemenations instead of using a systray library really slowed me down. As I have no experience with these things. So I am also not really fondly looking forward to the work to be done. But I do believe it is important work.

On 24/01/26 08:03, TriggerDingus wrote: > Any news for this basic feature ? A developer above mentioned "awaiting your pull request as soon as possible", so I think that sums it up. The developers seem to disagree with their potential user community on this feature and so it isn't likely to happen. It's disappointing to me but I have no right to complain - it would be like complaining about the confusing design decisions GNOME have about their desktop when, in the end, it's their sandbox and their toys. I appreciate the option Dino provided me and my best wishes to the team. -- Reply to this email directly or view it on GitHub: #98 (comment) You are receiving this because you commented. Message ID: @.***>

I truly appreciate your contributions and the sincere and conscientious response. Thanks for your work and your professional response.

@HunterBoy344
Copy link

why is this still not a thing. it has literally been 7 years

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request to add a new feature to Dino
Projects
None yet
Development

No branches or pull requests