2

The Windows-R command in Windows 7/8/10 brings up the Run prompt where one may enter:

  • A folder name (e.g. c:\temp\docs) and have that folder opened in the file manager (i.e. explorer).
  • A command name (e.g. putty.exe, notepad.exe c:\newdoc.txt) and have that command executed if it is found in the path (or the full path may be specified).
  • A document name (e.g. d:\docs\readme.txt) and have it opened in the associated editor.

Is there any inbuilt linux functionality or utility that can provide this unified functionality?

It basically just needs to be a window that accepts a command and if that command is a directory or non-executable file, then call xdg-open on it, otherwise execute the command.

The application finder is not adequate as it simply filters the setup launchers. I can't type a directory location, or vi ~/mydoc.txt for example.

To open a named directory, I could use the file manager shortcut, but Thunar opens without focus on the file location bar and so then requires and additional Ctrl-L. Does Thunar have any command line option to set focus to the location bar on open? The man page shows none.

I can use the open terminal shortcut to run a command (e.g. vi ~/mydoc.txt, mousepad ~/the.conf), but then I'm left with an open terminal window.

I'm hoping I've overlooked something or that there's a simple utility out there that someone might helpfully point me towards.

5
  • Alt+F2 is what it used to be on desktop Debian/Ubuntu systems, FWIR. It's been a while since I used desktop Linux though. However, this is only for Gnome, not XFCE. With XFCE you need to map a shortcut to XFRUN4 and make sure the helper program is running. See here: ubuntuforums.org/showthread.php?t=1773019 Aug 8, 2018 at 17:15
  • Alt+F2 launches the Application Finder, which is similar to the box you type in on the Windows start menu (although that one also looks at recently opened folders/docs). It simply filters launchers from the menu. This is very different functionality compared with the run command, per my description in the question.
    – pwrex
    Aug 8, 2018 at 17:19
  • This thread seems to indicate all you need to do is customize the commands in the application finder: askubuntu.com/questions/492876/… with: xfce4-terminal -x bash -ic "%s ; bash" Aug 8, 2018 at 17:23
  • You are correct! I had tested using home folder paths i.e. ~/ and so missed the / custom action mapping. Please put this down as an answer and I'll accept it. The ! command prefix is a bit clunky, but I guess that's the cost of combining fuzzy launcher search with the run command.
    – pwrex
    Aug 8, 2018 at 17:32
  • Thanks. Updated, and edited and put all the back and forth into the final answer. Glad to have helped. :) Aug 8, 2018 at 17:53

2 Answers 2

2

You can accomplish this with F2 in Gnome. With XFCE you can mostly do it, but you need to map a shortcut to xfrun4 and make sure that xfce4-settings-helper is running, then create a custom action in Application Finder. The downside here is that you need to remember to run the command with a prefix to get it to execute properly.

Set the shortcut through: Settings > Xfce 4 Settings Manager > Keyboard > Application Shortcuts.

After that's setup you need to configure a custom action within Application Finder. The following will run whatever you type in the Run window in bash:

xfce4-terminal -x bash -ic "%s ; bash"

For additional details see the following two threads: Configure Shortcut: https://ubuntuforums.org/showthread.php?t=1773019

Configure command to execute: https://askubuntu.com/questions/492876/xfce4-alt-f2-xfrun4-command-impotent-in-14-04-trusty

1

It might be worth considering using a dedicated tool designed to offer standalone, powerful launching of ad-hoc commands/files. It's not necessarily necessary to use something built into a Desktop Environment.... An advantage of this is that you're not tied to a specific DE in case you decide to switch.

For example, take a look at Interrobang, dmenu, or the general variety of Application Launchers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .