how to create a clickable link to an executable in the terminal
My goal is to create a clickable link in the terminal that opens an executable. I'm trying to do this using thefile:
URI. For example, I want to open Blender whose executable is /usr/bin/blender
. If I enter the following in a terminal, it creates a clickable link that is recognized by the terminal. However, nothing happens when I click or Ctrl+click on it.
$ echo file:///usr/bin/blender
file:///usr/bin/blender
However, this technique does work for other file types, such as text files. For example, the following creates a clickable link to file.txt
that opens with the default program to open txt files.
$ echo file:///home/trevor/file.txt
file:///home/trevor/file.txt
I can open /usr/bin/blender
if I open a file browser, navigate to /usr/bin/
, and double-click the blender icon.
Note: I am using Gnome and have tried this using several terminals (kgx, gnome-terminal, konsole).
1 answer
The following users marked this post as Works for me:
User | Comment | Date |
---|---|---|
Trevor | (no comment) | Dec 4, 2024 at 01:46 |
Since you are using GNOME, these links are probably handled by gio (as opposed to xdg-open or exo-open). GIO and xdg-open use ~/.config/mimeapps.list
to figure out how to open a certain link. The file /usr/bin/blender
has MIME type application/x-executable
and you likely don't have a handler registered for it. If you want to run Blender by clicking on its link, add this file to ~/.local/share/applications/exec.desktop
:
[Desktop Entry]
Version=1.0
Name=Exec handler
Comment=Executes its first argument
Exec=
Type=Application
Terminal=false
Then run gio mime application/x-executable exec.desktop
0 comment threads