Biont / sway-launcher-desktop

TUI Application launcher with Desktop Entry support. Made for SwayWM, but runs anywhere
GNU General Public License v3.0
613 stars 29 forks source link

Launching some programs opens extra terminal #25

Closed NullSense closed 3 years ago

NullSense commented 4 years ago

e.g. https://Obsidian.md, if you launch it, it opens an extra terminal with debug output. I suppose an easy fix would be to simply launch the program, instead of opening a new terminal and then launching it.

itspngu commented 3 years ago

Hey!

TL;DR: You might be missing some packages related to desktop stuff.

I was experiencing the same and wanted to look into it, but after taking a look at the script and comparing .desktop files I got sidetracked by the debug output yelling at me about missing cursors and the like, which led to me installing a bunch of stuff and properly setting up my GTK theme - not getting the hand cursor when hovering links hasn't really bothered me enough to look into it up intil now. I'm running Sway on Ubuntu 20.10 and installed https://github.com/jnsh/arc-theme from source, as the packaged version seems to be broken.

What can I say, after doing that, the extra terminals are gone. Poof. It's also finding flatpak apps, which it didn't before, and it's displaying the cute small rockets in the launcher menu. Alas, I can't fix it now because it fixed itself (I love not knowing why stuff suddently works, it's even worse than not knowing why stuff doesn't work), and as such I'm not sure what the exact problem was. It seems unlikely that it wasn't finding flatpaks due to a missing cursor so I'm suspecting I was actually missing some package that came along with the build dependencies of the above theme.

I suggest you take a look at your GTK/Gnome/QT5/whatever setup and the debug output from those pesky console windows. If you're still using this launcher and having this problem, that is.

Cheers

boredland commented 3 years ago

While I didn't solve the problem I just realized sth when running inkscape:

  1. when I check out this repo and start the script, the desktop entry for inkscape is shown alongside the cmd
  2. when I run it from /usr/bin/sway-launcher-desktop only the cmd is shown (and opening with the additional terminal window)
  3. when I run the checked out script using sudo, the result is identical to 2.

    I checked the diff for the checked-out version and they are identical

boredland commented 3 years ago

this is driving me a bit crazy. removed my os (arch) package for sway-launcher desktop. I copied the script to /usr/bin/sway-launcher-desktop.sh - everything works as it should.

itspngu commented 3 years ago

I can't replicate any of that. It works fine no matter the filename, it works fine when invoked through a symlink I have pointing from $HOME/.local/bin/sway-launcher to $HOME/git/sway-launcher-desktop/sway-launcher-desktop.sh, it works when invoked with sudo. I'm afraid I can't be more helpful than referring to my experiences described above, it's most likely related to you having done a very barebones install (as I have, though on Ubuntu because... idk) and missing some desktop stuff.

You can make the script very verbose by enabling debug output, maybe that contains any clues.

Cheers

boredland commented 3 years ago

soo. while I can't reproduce what I posted earlier I found sth.

Inkscape (from the arch repo) has a .desktop file like the follows:

# SPDX-License-Identifier: GPL-2.0-or-later
[Desktop Entry]
Version=1.0
Name=Inkscape
Comment=Create and edit Scalable Vector Graphics images
Keywords=image;editor;vector;drawing;
Type=Application
Categories=Graphics;VectorGraphics;GTK;
MimeType=image/svg+xml;image/svg+xml-compressed;application/vnd.corel-draw;application/pdf;application/postscript;image/x-eps;application/illustrator;image/cgm;image/x-wmf;application/x-xccx;application/x-xcgm;application/x-xcdt;application/x-xsk1;application/x-xcmx;image/x-xcdr;application/visio;application/x-visio;application/vnd.visio;application/visio.drawing;application/vsd;application/x-vsd;image/x-vsd;
Exec=inkscape %F
TryExec=inkscape
Terminal=false
StartupNotify=true
Icon=org.inkscape.Inkscape
X-Ayatana-Desktop-Shortcuts=Drawing

[X-Drawing Shortcut Group]
Name=New Drawing
Exec=inkscape
TargetEnvironment=Unity

the awk expression used will use the last "Name=", because [X-*] is not a matching group for "actions" (in contrast to [Desktop Action * ]).

I don't know if you want to support that kind of actions. So far I did not succeed in finding out why inkscape uses this different type (or, to that extent, if this even is still in the freedesktop specification).