29

This is standard behaviour of all desktop messengers (Skype, Viber, Telegram, ..). All of them minimizes itself in system tray when Alt+F4 or close button is activated and they are running in background (instead of closing completely).

How can I force Signal messenger to behave the same way?

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Jiří Doubravský
  • 1,877
  • 5
  • 23
  • 34
  • 1
    If you're trying to do the same thing on Windows, check out *Super User*'s [How do I minimize Signal to the system tray on Windows?](https://superuser.com/questions/1562696/how-do-i-minimize-signal-to-the-system-tray-on-windows) (adding this pointer because this question is ranking high for Windows search queries). – Caspar Jun 21 '20 at 17:24
  • I wonder why none of the answers are accepted by the OP. Are they all crap? – kanehekili Jan 12 '23 at 23:12

6 Answers6

48

Jiří Doubravský solution worked for Gnome on Ubuntu 19.04.

Add --use-tray-icon option inside the Exec line in /usr/share/applications/signal-desktop.desktop from:

Exec=/opt/Signal/signal-desktop --no-sandbox %U

To:

Exec=/opt/Signal/signal-desktop --use-tray-icon --no-sandbox %U

Restarted Signal a couple times and the tray icon shows up. Strange that this isn't enabled by default.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
brakus
  • 581
  • 4
  • 4
  • I'm using a different Linux (Peppermint 10), but I thought I'd tell people that this doesn't work for me. "Cannot read property 'isVisible' of undefined" – Stefan Reich Mar 27 '20 at 09:48
  • Thanks this works but signal tray icon disappears after the laptop is resumed from sleep. Is there a way to not make it disappear ? – Abiral Jun 07 '20 at 05:09
  • 5
    Works for me on Ubuntu 20.04, as well. Thanks! – BR123 Oct 18 '20 at 18:46
  • 1
    Isn't `--no-sandbox` a bad option to put there? (exploitation easier?) – Edw590 Mar 21 '21 at 14:47
  • 1
    This did not work for me, but `--start-in-tray` did. – Marcin Orlowski May 23 '21 at 11:09
  • Works on Ubuntu 21.04 but for some reason you have to logout and log back in for it to work. – SlimDeluxe Sep 29 '21 at 18:00
  • 1
    Instead of editing the desktop file installed by the package, which will get overwritten with updates, I copy the file from `/usr/share/applications` to `~/.local/share/applications`, edit it there and run `kbuildsycoca5` (to refresh the list or programs in KDE Plasma). – piit79 Sep 04 '22 at 20:35
  • Works great in Kubuntu (KDE) 22.04. I didn't even need to restart anything. Just closed the instance which was running and when I started the Signal again it added its icon in notification area. Window close now doesn't stop the messenger, but only hides the main window. – Victor Yarema Feb 21 '23 at 12:16
20

You can use optional arguments to start the application

--start-in-tray and/or --use-tray-icon

Startup launcher: Add both arguments.

Desktop launcher icon: Add just the second one argument. In menulibre, search for "Signal" and change command from "/opt/Signal/signal-desktop" %U to "/opt/Signal/signal-desktop" --use-tray-icon %U

source: https://github.com/signalapp/Signal-Desktop/issues/2911#issuecomment-439545459

Jiří Doubravský
  • 1,877
  • 5
  • 23
  • 34
2

A one-liner. Personally I have this saved on my desktop since Signal updates seem to to remove it.

sudo sed -i 's/signal-desktop --no-sandbox %U/signal-desktop --use-tray-icon --no-sandbox %U/g' /usr/share/applications/signal-desktop.desktop

sed is find and replace matching signal-desktop --no-sandbox %U and replacing with signal-desktop --use-tray-icon --no-sandbox %U

robmsmt
  • 391
  • 3
  • 6
  • I use `~/.local/share/applications/` location for `.desktop` files, as this allows using Activites overview for launching modified apps. – qba-dev Sep 01 '23 at 20:04
2

I propose building onto robmsmt's one-liner to account for different launch options I've encountered in the wild (without --no-sandbox, with lowercase %u, and 'empty' option --), probably depending on Signal version and/or distro used.

sed -i '/^Exec/ {/--use-tray-icon/ !s/$/ --use-tray-icon/}' /usr/share/applications/signal-desktop.desktop (Needs sudo)

This will match a line starting with Exec and appending --use-tray-icon to the end of that line unless the line already contains --use-tray-icon.

I previously suggested using incron to automatically run such script when the desktop file is modified, but sadly upon closer inspection it didn't actually work as the files are not really modified but completely replaced during an upgrade. I didn't manage to get incron to work with that, but you might want to take a look if you're interested and more savvy. It should be safe though to run that script as a good 'ol cron job as root (sudo crontab -e) e.g. at reboot (adding @reboot script.sh to the table). It obviously doesn't take effect immediately after Signal upgrade, but will have to suffice until I figure out what's up with incron.

demiaus
  • 21
  • 4
1

Instead of editing a root owned file that gets overwritten when the package manager installs a new version of signal-desktop, I recommend to create a custom .desktop file in your home folder, and add the --use-tray-icon flag there. The local user-specific .desktop files should automatically take precedence over the system-wide file.

mkdir -p ~/.local/share/applications/
cp /usr/share/applications/signal-desktop.desktop ~/.local/share/applications/signal-desktop.desktop
sed -i 's/Exec=signal-desktop /Exec=signal-desktop --use-tray-icon /' ~/.local/share/applications/signal-desktop.desktop
Hokascha
  • 103
  • 3
1

To do this for the flatpak version of Signal use flatseal. With flatseal you can easily edit this flatpaks environment variables:

  • SIGNAL_START_IN_TRAY
  • SIGNAL_USE_TRAY_ICON

Set them to 1 to accomplish setting of above mentioned flags. Editing the flatpaks desktop file did not work for me.

neun24
  • 1,339
  • 1
  • 11
  • 14