4

I made a custom .desktop file to start my favourite terminal, Tilix, with my preferred session. The file is identical to the default, except for the Exec and DBusActivatable lines.

~/.local/share/applications/com.gexperts.Tilix.desktop (i18n lines omitted):

[Desktop Entry]
Version=1.0
Name=Tilix
Comment=A tiling terminal for Gnome
Keywords=shell;prompt;command;commandline;cmd;
Exec=tilix -s /home/phydeaux/.tilix/Default.json
Terminal=false
Type=Application
StartupNotify=true
Categories=System;TerminalEmulator;X-GNOME-Utilities;
Icon=com.gexperts.Tilix
DBusActivatable=false
Actions=new-window;new-session;

[Desktop Action new-window]
Name=New Window
Exec=tilix --action=app-new-window

[Desktop Action new-session]
Name=New Session
Exec=tilix --action=app-new-session

I then added this shortcut to the dock by searching for it and using "Add to Favourites".

This worked fine (on 16.04 and 17.04, both GNOME) until I upgraded to 17.10. Clicking the shortcut in the dock now opens Tilix without my session (i.e. the default behaviour).

When I search for "Tilix" in Activities and click that shortcut, or when I navigate to ~/.local/share/applications/ in Nautilus and double-click the .desktop file, Tilix runs with my session as it always has. It is only when I add the shortcut to favourites that the unwanted behaviour occurs.

What could cause this to happen, and how can I fix it?


Update 1: Changing the Exec line to the absolute path doesn't help, and nor does using a custom shell script.

Update 2: I changed the Exec line for both my custom file (in ~/.local/...) and the original in /usr/... to Exec=gedit, to see what would happen. Running either file from Nautilus or from search opens Gedit as expected, but the version in the dock still opens Tilix! How can it possibly know to do this?

Update 3: I added a brand new file: ~/.local/.../com.phydeaux.Tlx.desktop, identical contents to the above except with Name=Tlx. Running this from the dock opens Tilix with my session as desired, so this suffices as a (stupid) workaround. However, if I change from Name=Tlx to Name=Tilix, the unwanted behaviour returns, and persists even if I subsequently change the name back to Tlx. Is the shortcut file somehow becoming 'associated' with Tilix-the-application when I do this? Does GNOME think it knows the 'proper' way to run that application? Is any of this to do with D-Bus?

Update 4: Still an issue in 18.04. Deleting the service file for Tilix from /usr/share/dbus-1/services/ doesn't help.

Phydeaux
  • 220
  • @pomsky it's the same one that works correctly when I click it – Phydeaux Apr 14 '18 at 22:45
  • @pomsky Yep! I've also uninstalled/reinstalled Tilix. No matter what I do, running the shortcut from anywhere other than the dock obeys whatever I put in the Exec line (still set to gedit currently), whereas running the same shortcut from the dock tries to open Tilix (and does nothing if it isn't installed) – Phydeaux Apr 14 '18 at 23:43
  • @pomsky I had a similar-ish problem when I first wrote this file (i.e. Exec line being bypassed), but that was resolved by setting DBusActivatable=false which obviously isn't helping here – Phydeaux Apr 14 '18 at 23:45
  • Please remove "Update 3" from the question and post that as an answer, sounds like a good workaround. – pomsky Apr 15 '18 at 02:47
  • @pomsky it's not exactly ideal, it (apparently) can't have the proper name, and opens a window under a separate icon in the dock. Not to mention that it doesn't explain why this happens. I can post the workaround as an answer, but I won't mark it accepted. – Phydeaux Apr 15 '18 at 02:53
  • 1
    Try this for double icon issue. – pomsky Apr 15 '18 at 03:02

1 Answers1

2

Adding a completely new shortcut file ~/.local/share/applications/com.phydeaux.Tlx.desktop with identical contents to the original except for Name=Tlx, then adding that shortcut to the dock achieves close to the desired behaviour for me.

This successfully opens Tilix with my session, though it opens a window under a different icon in the dock, and appears under a different name (changing the name to Tilix causes a relapse to the unwanted behaviour).

Phydeaux
  • 220