What is the “run command console” (Alt+F2) in GNOME?
Solution 1:
Yes, 'r' is one of the internal commands in the run dialog. They're documented at https://wiki.gnome.org/Projects/GnomeShell/CheatSheet#Developer_tools.
- 'r' or 'restart': restart the shell
- 'rt': reload the shell theme (very useful when writing/modifying a theme)
- 'lg': open Looking Glass, which is the gnome-shell equivalent of DevTools in your browser
- 'debugexit': exits gnome-shell with an error exit code; probably only useful if you're doing development on the shell itself
For the second part, we need see exactly what the _run()
function does in https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/runDialog.js.
First, it handles the internal commands listed above.
Next, it parses the input with GLib.shell_parse_argv()
, which just splits it into words like /bin/sh and doesn't do any kinds of expansion. It then tries to run the result directly with GLib.spawn_async()
. This will search for the program in $PATH
, which is why something like "firefox" works as you'd expect.
If that fails, it takes your whole input, expands '~' to your home directory, and tries opening it as a file.