VSCode icon is missing in app switcher on Ubuntu - linux

After I installed VSCode using the the "Snap Store" on Ubuntu Mate 20.04 (Using compiz).
When I do the app switching with ALT+TAB the icon of the VSCode icon is missing.
The original path for the icon is at /snap/code/43/meta/gui/com.visualstudio.code.png.
I encountered this issue only in the app switcher for VSCode.
Other snap apps works as they should.
The content of /var/lib/snapd/desktop/applications/code_code.desktop:
[Desktop Entry]
X-SnapInstanceName=code
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/code_code.desktop /snap/bin/code --force-user-env --no-sandbox --unity-launch %F
Icon=/snap/code/43/meta/gui/com.visualstudio.code.png
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;
Actions=new-empty-window;
Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/code_code.desktop /snap/bin/code --force-user-env --no-sandbox --new-window %F
Icon=/snap/code/43/meta/gui/com.visualstudio.code.png

If you install through snap, sometimes the *.desktop file does not update correctly.
You should change the Icon= path in the following file, which is the one the system uses:
/usr/share/applications/code_code.desktop
So for instance, I had to change /usr/share/applications/code_code.desktop attributes of [Desktop Entry] and [Desktop Action new-empty-window], with the correct path in Icon=, which I found in /var/lib/snapd/desktop/applications/code_code.desktop
Icon=/snap/code/85/meta/gui/com.visualstudio.code.png
instead of
Icon=/snap/code/64/meta/gui/com.visualstudio.code.png
I guess you can also do:
cat /var/lib/snapd/desktop/applications/code_code.desktop > /usr/share/applications/code_code.desktop

This is VSCode bug #71942 on github. Edit /var/lib/snapd/desktop/applications/code_code.desktop and change the Icon path to /snap/code/43/meta/gui/com.visualstudio.code.png

Related

How to add an icon of app that I have downloaded in Ubuntu?

I have downloaded Webstorm, but accidentally I did not see an icon. Then I just wrote a command "bash webstorm.sh" and then Webstorm run. But I really don't want to run WS with this method. Help me
just create a desktop file ( a file with desktop extension, for example my_app.desktop) and then move this file under "~/.local/share/applications" or under "/usr/share/applications" (if you are a member of sudoers and you can run a command with sudo).
your desktop file should be similar to this
[Desktop Entry]
Name=Webstorm
Comment=terminal app
Exec="bash webstorm.sh"
Terminal=false
Type=Application
Icon=path_to_icon
Categories=IDE;

How to associate a filetype to a desktop entry correctly

I'm try to associate my custom filetype with my app, which is an electron appimage. My filetype seems to be correctly registered, xdg-mime seems good, but xdg-open doesn't know how to open it.
I've created an MyApp-MyFile.xml, installed by doing:
$ xdg-mime installMyApp-MyExt.xml
When I query filetype of my file everything seems good:
$ xdg-mime query filetype foo.myext
application/x-myapp
$ xdg-mime query default application/x-myapp
appimagekit-myapp.desktop
The desktop file is automatically generated from electron build option, and automatically installed when the appimage is launched.
$ cat ~/.local/share/applications/appimagekit-myapp.desktop
[Desktop Entry]
Name=MyApp
Comment=MyApp main application
Exec="/home/full/path/MyApp.AppImage" %U
Terminal=false
Type=Application
Icon=appimagekit-myapp
StartupWMClass=MyApp
X-AppImage-Version=X.X.X
Version=1.0
MimeType=text/html;application/x-myapp;
Categories=Utility;
X-GNOME-Autostart-Delay=3
X-GNOME-Autostart-enabled=true
X-AppImage-BuildId=1Nj1YJAtgORaUJWan9BoWfD5r2q
X-Desktop-File-Install-Version=0.23
X-AppImage-Comment=Generated by /tmp/.mount_MyAppLXHZ7ue/AppRun
TryExec=/home/full/path/MyApp.AppImage
Despite all that xdg-open foo.myext doesn't found an app to opens the file.
I find out that mimeopen foo.myext open my app, but without passing args correctly. That's nice but I need to fix xdg-open
My OS is ubuntu 19.04.

run external application in linux using qprocess

I am creating an GUI application using QT creater in Raspbian. When I click a button I want to open an external application like terminal, or browser, etc.
I have tried many attempts
attempt 1
std::system("/usr/share/raspi-ui-overrides/applications/scratch.desktop&");
it says me permission denied
attempt 2
QDesktopServices::openUrl(QUrl("/usr/share/raspi-ui-overrides/applications/scratch.desktop"));
this one is working but its not opening the application but its opening in terminal:
QDesktopServices::openUrl(QUrl("/usr/share/raspi-ui-overrides/applications/scratch.desktop"));
I'm assuming the question is about Raspberry Pi and Raspbian.
In Raspbian, the scratch.desktop and other *.desktop files are not executables, but just text files that describe which application to run.
Example:
pi#raspberrypi:~ $ cat /usr/share/raspi-ui-overrides/applications/scratch.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
TryExec=scratch
Exec=scratch
Icon=scratch
Terminal=false
Name=Scratch
Comment= Programming system and content development tool
Categories=Application;Development;
MimeType=application/x-scratch-project
You need to use an actual binary to start the process. For scratch, it would be /usr/bin/scratch. For a browser, it's likely to be /usr/bin/epiphany-browser. Look at Exec= line in the *.desktop file to see the name of the executable, then use which in the terminal to see its location:
pi#raspberrypi:~ $ which epiphany-browser
/usr/bin/epiphany-browser
The .desktop files are not executable, but serve as shortcuts for the desktop system. Assuming that the scratch.desktop has the following:
scratch.desktop
[Desktop Entry]
Name=Scratch
Comment= Programming system and content development tool
Exec=scratch
Terminal=false
Type=Application
Icon=scratch
Categories=Development;
MimeType=application/x-scratch-project
Then the executable is /usr/bin/scratch, And you can run it with Qt:
QProcess::startDetached("/usr/bin/scratch");
Or:
QProcess::execute("/usr/bin/scratch");

How to create a desktop-entry in Gnome?

I have installed ProM 6.8 (a process mining tool, written in Java) and after executing the command ./ProM68.sh & in a terminal, the application starts without problems.
I tried to create both a desktop-entry in Gnome 3 (on Fedora 28) or a menu-item.
This is my desktop-entry:
[Desktop Entry]
Name=Prom
Exec=/home/bengbers/Programs/Prom/ProM68.sh %u
Type=Application
StartupNotify=true
Terminal=false
Categories=Development;Java;
After double-clicking this iscon, nothing happens.
I also tried adding an entry in the main-menu but this entry fails also.
How can I create a working desktop entry?
Ben
Prom needed a .ini file to start. After adding a path to the directory, everything worked fine.
Ben

Desktop shortcut gives error "KDEInit could not launch"

I am on Linux Mint KDE.
I created a c++ executable using Netbeans. Then I added the folder where the executable was to the path.
If I go to the terminal and run the executable it runs fine.
I next create a desktop file with the following
[Desktop Entry]
Categories=Application;
Comment[en_US]=
Comment=
Exec=myprog
GenericName[en_US]=
GenericName=
Icon=utilities-terminal
MimeType=
Name[en_US]=Test
Name=Test
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
I change the permission of this desktop file to executable. If I double click the desktop file, I get a message saying "KDEInit could not launch 'myprog':
Could not find 'myprog' executable."
I wish to create a desktop shortcut to my executable. What am I doing wrong? Do I need to specify the path again in the desktop file?

Resources