How can I open a dialog box as below from a terminal?
7 Answers
Install the X11 keyboard/mouse input simulator xdotool
and run xdotool key Alt+F2
.
You can add this alias to your ~/.bashrc
file to make typing easier:
alias rd="xdotool key Alt+F2"
Now all you need to do is type rd
.
Hacky, but works.
Two options:
- Install gmrun from Software Center or with
sudo apt-get install gmrun
then use commandgmrun
from the terminal - Compile gnome-run from source and run
gnome-run
from the terminal. Instructions here. [Editor's note: instruction page contains dead links.]
Unfortunately this is harder than it should be.
I found another way to do it:
- Install the xautomation package
- Run this command:
xte 'keydown Alt_L' 'key F2' 'keyup Alt_L'
Thanks htorque for the hint "keyboard/mouse input"
gnome-panel-control --run-dialog
-
3
bash -c "$(zenity --entry --title 'Enter a Command' --text '' --width 400)"
-
1That will result in an error if the dialogue is cancelled. It would be better to capture the output of
zenity
and only proceed if it returned successfully:cmd="$(zenity --entry --title 'Enter a Command' --text '' --width 400)" && bash -c "$cmd"
or evenzenity --entry --title 'Enter a Command' --text '' --width 400 | bash
. Mar 22, 2018 at 19:29 -
On Ubuntu 18.04 the original command runs without error. Tested dialogue cancel, providing valid command, providing invalid command, and providing no command. Not sure why our systems are behaving differently. Mar 23, 2018 at 20:25