ddterm / gnome-shell-extension-ddterm

Another drop down terminal extension for GNOME Shell. With tabs. Works on Wayland natively
https://extensions.gnome.org/extension/3780/ddterm/
GNU General Public License v3.0
298 stars 26 forks source link

Add an icon to ddterm #123

Closed pesader closed 1 year ago

pesader commented 2 years ago
When ddterm is configured to show up in the Overview and Panel, it shows up with the default cog app icon: Overview Panel
image image
Icon in the Overview Symbolic icon in the panel

I took a look at how you setup the nice window title ("Drop Down Terminal") and found this snippet here:

GLib.set_prgname('com.github.amezin.ddterm');
GLib.set_application_name('Drop Down Terminal');
Gdk.set_allowed_backends('x11');

But it doesn't look there's anything similar in GLib to setup app icons. In any case, I think it would be really nice to have a terminal icon for ddterm (perhaps there's a way to have a full blown .desktop file for it, like GSConnect has?).

PS: thanks a lot for coming back to ddterm, it is my favourite GNOME Extension :rocket::heart:

pesader commented 2 years ago

For some reason, using the Papirus icon theme and forcing the XWayland backend gives ddterm a somewhat blurry terminal icon (compare it with GNOME Terminal's icon to notice the difference in sharpness):

Overview Panel
image image

Talk about mysterious!

amezin commented 2 years ago

As far as I know, the only way to make GNOME Shell show a custom icon on Wayland is to install a .desktop file.

And I can't include the .desktop file in the extension package without hacks - it won't be installed to the correct location automatically. I'd have to add code that installs it on the first run... I thought the icon wasn't that important. Also, copying files to arbitrary locations should raise questions during review on extensions.gnome.org.

Maybe installing it when the extension is being enabled and uninstalling it when the extension is being disabled will be fine though. But, again, not sure if the icon is worth it.

pesader commented 2 years ago

It looks like the GSConnect has a .desktop file, that is hidden. It is not removed when the extension is disabled but it removed once the extension is uninstalled.

This way, it does not show up on the Applications Grid but has a nice icon once the user accesses its Preferences window. I took a look at their .desktop file and the Exec line invokes gapplication launch to start the window but it doesn't seem ddterm can use that.

How is ddterm's window started? Is it a binary file somewhere? If I understand that I can contribute with a desktop file (and updated installation and removal scripts), if you think it is worthwhile :)

amezin commented 2 years ago

How is ddterm's window started? Is it a binary file somewhere?

https://github.com/amezin/gnome-shell-extension-ddterm#toggle-the-terminal-through-d-bus

ddterm must be started from the Gnome Shell process, otherwise, some features won't work. So the only way is the D-Bus call.

pesader commented 2 years ago

Hey! I wrote the desktop and it seems to be working just fine :smile:. It does not appear on the app grid nor in the search, but it adds an icon to ddterm (both on the top bar and in the overview). Here's the file:

[Desktop Entry]
Version=1.1
Type=Application
Name=Drop Down Terminal
NoDisplay=true
Comment=Another drop down terminal extension for GNOME Shell. With tabs. Works on Wayland natively.
Icon=Terminal
Exec=gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/ddterm --method com.github.amezin.ddterm.Extension.Toggle
Actions=
Categories=Utility;
StartupWMClass=com.github.amezin.ddterm

For the install script, I will take a look at how GSConnect does things! This part seems to be the gist of it.

amezin commented 2 years ago

When you install extensions from extensions.gnome.org, nothing is installed outside of ~/.local/share/gnome-shell/extensions/<extension-uuid> As far as I know, this directory isn't among the locations where Gnome Shell looks for *.desktop files

amezin commented 2 years ago

If you could write the code that installs and removes the desktop file, I'll accept the pull request.

Arcitec commented 2 years ago

@pesader Thanks for making that desktop file.

Edit: I just realized that this is a non-issue. DDTerm doesn't show up in the overview by default. Why would I want my dropdown terminal in the overview? But of course, it would be nice to fix it with that desktop file and the GSConnect desktop-file installation-method that was mentioned.

pesader commented 2 years ago

Hey sorry for disappearing! School got tougher suddenly and I had to leave this for later. I still do plan to contribute though :)

pesader commented 1 year ago

Hey, I took a look at the GSConnect source code and it seems it doesn't delete its own desktop file when it is uninstalled by the user since there's no "uninstall hook" for GNOME Shell Extensions. Take a look.

It is a hidden desktop file (NoDisplay=true), so it doesn't appear on menus, only makes the app look good on the Application Menu and the Activities view. Maybe for that reason, it was approved by extensions.gnome.org.

If you could write the code that installs and removes the desktop file

So it looks like removing is not feasible :/

I can still contribute with code that installs the desktop file but, if that's not interesting for you, I'll close this issue.

amezin commented 1 year ago

Yes, there is no 'uninstall' hook, but what about creating the file in enable() and removing in disable()?