Est-il possible de toujours charger un ensemble spécifique d'onglets de navigateur de fichiers (Nemo) dans Linux Mint ? J'aimerais avoir cinq emplacements de dossier ouverts par défaut à chaque fois que je démarre Nemo.
Réponse acceptée :
Oui c'est tout à fait possible. J'utilise un script python pour cette tâche pour mon caja
navigateur. Je reproduis ici le script en remplaçant caja
avec nemo
. Espérons que cela fonctionnera directement avec nemo
sans autre modification.
#!/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)
Enregistrez ce script sous nemo-tab.py
dans votre ~/bin
répertoire ou tout autre répertoire que vous avez dans votre chemin. Rendez-le exécutable. Ensuite, lorsque vous exécuterez ce script, il ouvrira un nouvel onglet dans n'importe quel nemo
en cours d'exécution navigateur ou démarrez un nouveau navigateur si aucune instance n'est en cours d'exécution. Vous l'exécutez comme suit :
nemo-tab.py "~/Documents"
Maintenant, pour votre cas, vous pouvez émettre la commande cinq fois dans un script bash pour charger un nemo
instance avec 5 onglets initiaux :
#!/bin/bash
nemo-tab.py "~/Documents"
nemo-tab.py "~/Desktop"
nemo-tab.py "~/media/data"
nemo-tab.py "~/Videos"
nemo-tab.py "~/Pictures"
Notez que vous devrez installer xdotool
et wmctrl
:
sudo apt-get install xdotool wmctrl
Source du script Python :https://askubuntu.com/questions/628084/what-is-the-command-to-open-a-specific-directory-in-a-new-tab-in-nautilus