#!/bin/bash ############################################################### ## Opentab.sh by Sven (admin@ganz-sicher.net) ## # Opens nautilus folders in the same window/a new Tab # # => Only one instance of Nautilus will be running. # # Dependencies: nautilus, xdotool # # # ################# USAGE: ./Opentab.sh [path/to/startfolder] ################# # (if you don't add a startpath, your home dir will be opened) # # # # TIPS: Don't forget to chmod +x the script # # You could also copy it to /usr/bin/tabnautilus to start it with the cmd tabnautilus # # # # NOTE: If you're experience conflicts with some charaters in your argument-sting # # please check if you set the right keyboard layout in you xorg.conf, e.g.: # # Option "XkbLayout" "de" #for German keyboard layout # # or run e.g. 'setxkbmap de' before this script! # # # # Please also note that this might not work if nautilus handles the desktop. # # # # Have a lot of phun! =) # ################################################################################################# # search for open nautilus window window="$(xdotool search --onlyvisible --class nautilus | head -1)" # check if opened nautilus was found if [ "$window" = "" ]; then echo "Nautilus not found. Starting new instance of it..." nautilus $* 2>&1 > /dev/null & exit else # nautilus is already open :] # select the window xdotool windowfocus --sync $window # add tab and focus adress field xdotool key --clearmodifiers ctrl+t+l+BackSpace # wait some time to avoid problems sleep 0.2 # custom path if [ $# -gt "0" ]; then xdotool type $* else # no script arguments xdotool type /home/$(whoami)/ fi xdotool key Return+Escape xdotool windowactivate --sync $window fi