Is it possible to always load a specific set of file browser (Nemo) tabs in Linux Mint? I would like to have five folder locations opened by default every time I start Nemo.


Yes this is very much possible. I use a python script for this task for my caja browser. I am reproducing the script here by replacing caja with nemo. Hopefully, it will directly work with nemo without any further changes.

#!/usr/bin/env python3
import subprocess
import time
import sys

get = lambda cmd: subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8")
def run(cmd):
    subprocess.call(["/bin/bash", "-c", cmd])

    arg = sys.argv[1]
    arg = ""

    pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
    run("nemo "+arg)
    w = [l.split() for l in get("wmctrl -lp").splitlines() if pid in l][-1]
    w_id = w[0]   
    if len( [l for l in get("xprop -id "+w_id).splitlines() if all(
        ["_NET_WM_WINDOW_TYPE(ATOM)" in l, "_TYPE_NORMAL" in l])]) != 0:
        run("wmctrl -ia "+w[0])
        run("xdotool key Control_L+t")
        if arg != "":
            run("xdotool key Control_L+l")
            run("xdotool type "+arg)
            run("xdotool key Return")
        run("nemo "+arg)

Save this script as nemo-tab.py in your ~/bin directory or any other directory which you have in your path. Make it executable. Then, when you run this script it will open up a new tab in any current running nemo browser or start a new browser if no instance is running. You run it as following:

nemo-tab.py "~/Documents"

Now, for your case, you can issue the command five times in a bash script to load a nemo instance with 5 initial tabs:

nemo-tab.py "~/Documents"
nemo-tab.py "~/Desktop"
nemo-tab.py "~/media/data"
nemo-tab.py "~/Videos"
nemo-tab.py "~/Pictures"

Note that you will need to install xdotool and wmctrl:

sudo apt-get install xdotool wmctrl

Source of Python script: https://askubuntu.com/questions/628084/what-is-the-command-to-open-a-specific-directory-in-a-new-tab-in-nautilus

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.