Save Nemo tabs in Linux Mint
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.
linux-mint nemo
add a comment |
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.
linux-mint nemo
add a comment |
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.
linux-mint nemo
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.
linux-mint nemo
linux-mint nemo
asked Oct 24 '15 at 10:14
Antti
1372
1372
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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])
try:
arg = sys.argv[1]
except:
arg = ""
try:
pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
run("nemo "+arg)
else:
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")
time.sleep(0.2)
run("xdotool type "+arg)
time.sleep(0.01*len(arg))
run("xdotool key Return")
else:
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:
#!/bin/bash
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
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f238347%2fsave-nemo-tabs-in-linux-mint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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])
try:
arg = sys.argv[1]
except:
arg = ""
try:
pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
run("nemo "+arg)
else:
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")
time.sleep(0.2)
run("xdotool type "+arg)
time.sleep(0.01*len(arg))
run("xdotool key Return")
else:
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:
#!/bin/bash
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
add a comment |
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])
try:
arg = sys.argv[1]
except:
arg = ""
try:
pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
run("nemo "+arg)
else:
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")
time.sleep(0.2)
run("xdotool type "+arg)
time.sleep(0.01*len(arg))
run("xdotool key Return")
else:
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:
#!/bin/bash
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
add a comment |
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])
try:
arg = sys.argv[1]
except:
arg = ""
try:
pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
run("nemo "+arg)
else:
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")
time.sleep(0.2)
run("xdotool type "+arg)
time.sleep(0.01*len(arg))
run("xdotool key Return")
else:
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:
#!/bin/bash
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
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])
try:
arg = sys.argv[1]
except:
arg = ""
try:
pid = get("pidof nemo").strip()
except subprocess.CalledProcessError:
run("nemo "+arg)
else:
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")
time.sleep(0.2)
run("xdotool type "+arg)
time.sleep(0.01*len(arg))
run("xdotool key Return")
else:
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:
#!/bin/bash
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
edited Apr 13 '17 at 12:22
Community♦
1
1
answered Oct 24 '15 at 11:16
shivams
2,89111425
2,89111425
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f238347%2fsave-nemo-tabs-in-linux-mint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown