How to Easily Open Multiple Files with SpaceFM in Linux

Spacefm Graphics Menu Featured

If you work with many types of graphics files each day, you probably also use different graphics apps to open and edit them. And you’re probably wasting a lot of time without even realizing it. Theoretically, you can select multiple files, right-click on them and select the program you want from the “Open with” option in the context menu. This doesn’t work every time, as the application you want to use doesn’t always show up as the “default” programs.

If you’re using a customizable file manager like SpaceFM, you can add a menu to its toolbar that allows you to quickly open multiple files with the application you want in a single click.

Although we focus on graphics, that doesn’t mean you’re limited to this type of application. You can follow the steps below, but for example, replace the graphics software with your favorite media players, creating a menu that will allow you to open your favorite video files in different ways.

Installation

If it is not already available, find and install SpaceFM in your Linux distribution through its app store/software center. If you are using a Debian / Ubuntu-based distribution, you can install it with the command:

Once installed, SpaceFM will be accessible from the main Application menu. Run it and resize its window so that you can see the full contents of its main toolbar.

Spacefm Graphics Menu Installation And First Run

Add a new submenu

1. Right-click an empty spot on its toolbar and select from the popup menu that appears in the “New -> Submenu” entry. This will allow you to add a menu to the toolbar where you’ll group your primary graphics apps.

Spacefm Graphics Menu New Blank Menu

2. Continue by giving a name to your menu in the window that appears. We are using “Graphics” in this case.

Spacefm Graphics Menu Naming

3. SpaceFM doesn’t like empty menus. Thus, it will have already placed a “blank” command in the menu you just created. Select it to display a window through which you will be able to modify it.

Spacefm Graphics Menu Empty Command

4. Enter a name for your command in the almost identical window that appears. Since our goal is to be able to easily open one or more graphics files with an application we choose in a single move, each command will “map” to a single application. It would probably be best if you just used the name of each application as the button’s/command’s name. For our first command, we used the name “Inkscape.”

Spacefm Graphics Menu Commands

5. The following window shows a similar edit space where you can structure your command but also a handy list of codes. You can splice those codes in any typical BASH command (you enter in the edit space) to “feed” to it any selected files and folders.

Usually, when you want “to open files with applications that support doing that with a command” (that happens to be the majority of apps in Linux land), what you need are just the first three shortcodes. Most of your “commands” will consist of the application’s name followed by either “%F,” “%f” (notice it’s lowercase) or “%d.”

Spacefm Graphics Menu Codes

The first one, %F, acts on all selected files (if the app supports batch-loading). Use %f to act on a single file (works with most apps that support opening files). %d corresponds to the active directory (rare but useful when, for example, mass-converting files between formats).

Since we want to be able to open all selected files in Inkscape for this first button of ours, we structured the command as:

This command translates to “inkscape selected-file-1 selected-file-2” etc. With this option, all the selected files will open in the specified application – in this case, inkscape.

6. Each new entry in the SpaceFM toolbar uses the same default icon. If you add only one button or submenu, you will have no problem recognizing it. For more than one, it is better to set a different icon for each entry, making them easier to identify at a glance.

For this, go to the “Menu Item” tab. You can click on the Choose button to see a list of all the icons the app has recognized as available. As there are a ton of icons in the list, it is best to directly type the name of an application into the entry field next to “Icon:”

Spacefm Graphics Menu Icons

In our case, before we even finished typing “Inkscape,” its icon had already been detected and displayed on the Choose button. This button also acts as a preview, with any chosen icon presented “on top” of it, as it will be in the final button/menu.

Spacefm Graphics Menu More Commands

Repeat the previous steps to add more commands to your menu, matching them to your favorite applications. Soon you will have a menu like the one you see in our picture, allowing instant opening of any selected file(s) or folder(s) in your app of choice with a single click.

4 comments

  1. “This doesn’t work every time, as the application you want to use doesn’t always show up as the “default” programs.”
    Every file manager I have used so far allows for selecting “other” application to be used to open files. In fact, while it may be inefficient, I leave all my file associations blank so that I always pick the app I want, not the app the distro developer thinks should be used. In every file manager I have used, File Association menu under Settings is where the applications to open particular file type are defined. There is no need to create special sub-menus. IIRC, SpaceFM does use File Association setting in its “Open with/other” menu.

    “If you work with many types of graphics files each day, you probably also use different graphics apps to open and edit them.”
    However, even using SpaceFM, you cannot pick multiple applications to open multiple file types in one execution. You still have to use a separate action to open each different file type.

    1. You are right in that most applications are accesible through the right-click menu. But I did point out, just before the line you quoted, that this approach, if you do it repeatedly each and every day, ends up “wasting a lot of time”. For if the programs don’t appear among the default ones, you have to hunt them down from a list of everything installed. Each and every time. If you’re opening batches of similar files again and again throughout the day, this adds up.

      Setting filetype defaults also doesn’t help in that regard because, as you might have noticed, we have a menu with three apps and ALL three of them can open, say, JPEG files. The point isn’t in “making it easy to select the correct app for each type of file” but having all apps related to a workflow bundled together in a little convenient menu. For example, when I’m sketching, I might do it in Krita and export the result as a JPG. Then I might open that file in GIMP to add some filters, impose a sketch over a background blah-blah. OR I might import it in InkScape to turn it into proper line art. Hence the three specific programs in the menu – where we could also add image converters, viewers, even a shortcut to PhotoShop ran through WINE if demanded by some of our projects and part of our workflow.

      As for opening multiple files with multiple applications, yes, that’s a tough one. It’s possible to open the same bunch of files with more than one program, by using a command like..:

      krita %F & gimp %F && fg

      …but the problem is that the contents between them can’t be “synced”. As in, if you do some changes in the loaded files and then jump to another program where they’re loaded, the changes won’t have “been reflected” there. But it *could* be useful in a case where, for example, you’re editing 20 files at once in GIMP: its interface ain’t the best for swapping between files, especially if they don’t have distinctive names. With two monitors, you could *also* load all of them in an image viewer, throw its window on the second monitor and use it to go back and forth between files to check what’s what.

      As I said in the piece though, it doesn’t *have* to do with graphics, nor *only* with the batch-loading of files. You could create a “media” menu with your media players, allowing the playing of different video files with different players. Or structure the command in such a way that it first ran an automatic subtitle downloader tool for the selected file, *then* launched the actual player, to have the subtitles ready-to-load.

      1. The bottom line is that we set things up the way they feel comfortable to us. If you feel that setting up a ‘media’ menu and a ‘graphics’ menu and a test’ menu, etc works for you, go for it. I don’t find that kind of setup any more efficient than right-clicking. One still has to go through multiple clicks.

        Besides, the incessant pursuit of ‘more efficiency’ and ‘more productivity’ rankles me. I thought we got away from sweatshops.

        1. Absolutely true. As I said, this has meaning if you do the same “moves” multiple times per day. To understand what I’m talking about, and since I *did*… er… actually use a stopwatch to check the difference (really!), launching a program through a menu like the one we create here takes from 1 to 2.x seconds, finding and launching it through the “other apps” menu can take up to 9 seconds until the list is populated and you’ve found the actual app you want.

          Those seconds are insignificant for the casual user who’ll do this once or twice, but if you’re repeating the same actions multiple times per day, they add up.

          Yeah, it’s about “being more efficient” and “more productive” indeed, but you’re looking at it the wrong way: being more productive or doing things more effectively doesn’t necessarily mean you’re working in a sweatshop like a slave. It means doing things in an easier, quicker way. It allows you to save time for other, more important things – like catching up with That Episode In Your Queue. Thing is, as you said, the “easier, quicker way” is not global, applying to everyone. Some people *might* find this useful – and probably create different menus with different apps. Many won’t.

          Here’s a more global “productivity tip” I’m ranting about to everyone I meet, that doesn’t warrant a full tutorial, and has changed the way I’m using my computers (with both Linux *and* Windows): if your mouse has two “thumb” buttons, say, for “back & forward”, map “Esc” and “Enter” to them instead. Why? Because those *also* “translate” to “cancel / accept”, respectively, in most graphic environments. Since most of the time, when not typing, we’re using our computers with one hand on our mouse and one on our keyboard, this way you won’t have to move “your keyboard hand to reach enter or escape”, nor “your mouse hand to point at a cancel / OK button”. You just rock your thumb back or forth.

          You wouldn’t believe how much tips like those have helped with my tendinitis :-)

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.