I'd like to be able to run my aliases from my .bashrc in the "Run Application" dialog that comes up when you hit Alt+F2 in Ubuntu/Gnome.
Does anyone know how to do this?
There is a very simple solution for Linux Mint and Ubuntu (I did not check it on other distros):
mkdir ~/bin #actually, need to run this line just once
cd ~/bin
ln -s /bin/any/your/application.sh YOUR_ALIAS_NAME
For example, I like to run calc
from Alt+F2 menu, so my script is:
mkdir ~/bin
cd ~/bin
ln -s /usr/bin/gnome-calculator calc
If you want to pass any parameters, you could create a short shell script in ~/bin
:
#create the file:
echo '#!/bin/sh
firefox --private-window' > ~/bin/pfx
#make my script executable:
chmod 755 ~/bin/pfx
The solution based on the fact, that there is a file named .profile
in home dir out of the box. I hope, your already know, what is .profile
file. As part of its job, this file appends ~/bin
to the $PATH
(if bin
exists).
I thought, bin
in home is not secure, but this article recommends to follow described way: https://help.ubuntu.com/community/HomeFolder#Installing_Software_Into_The_Home_Directory
http://www.freedesktop.org/wiki/Specifications is probably a good place to start. I find these quite hard to follow most of the time, but sometimes you can figure it out. Specifically, the "Desktop Entry Specification".
Also, I don't think you'll be able to use any aliases from .bashrc
, at least not without writing some kind of wrapper script. I think it needs to be an executable file. Of course, you could just use the good old symlinks- to- same + what's- my- name trick...
(Which, for reference, goes like this:
Some casual investigation reveals that creating these is fairly simple if you use Nautilus, (at least the version I have):
xterm -e 'bash -c "unzip -l %f; sleep 5"'
rm -rf
)~/.local/share/applications/
called xterm-usercreated.desktop
Here at least, I get the follow file:
[Desktop Entry]
Encoding=UTF-8
Name=xterm
MimeType=application/zip;
Exec=xterm -e 'bash -c "unzip -l %f; sleep 5"' %f
Type=Application
Terminal=false
NoDisplay=true
4: Looking at the system xterm .desktop I find this:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=XTerm
GenericName=
Comment=XTerm: terminal emulator for X
Icon=/usr/share/pixmaps/xterm-color_32x32.xpm
Exec=xterm
Terminal=false
Categories=X-Debian-Applications-Terminal-Emulators;
5: Editing the .usercreated.desktop file to this:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=xtermz
Exec=xterm -e 'bash -c "unzip -l %f; sleep 5"' %f
Terminal=false
Categories=X-Local-WTF
6: Run xdg-desktop-menu forceupdate --mode user
7: "xtermz" now shows up in the list... Success!
8: Yuck! This also makes it appear in the main menu, under "Other". Weird!
xdg-desktop-menu
and friends (notably xdg-icon-resource
) live in the xdg-utils
package..desktop
file from scratch..desktop
file using xdg-desktop-menu install
blah blahYou can just add a symbolic link to /usr/bin: ln -s <YOUR_ALIAS_PATCH> <ALIAS_NAME>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With