Overview
To find the metadata for a folder you need to use the command gvfs-info foldername
for example gvfs-info /home/homefolder/Desktop
In the list that returns you will see the attribute metadata::nautilus-default-view
which describes the default view.
You can change this attribute using the command gvfs-set_attribute foldername attribute newvalue
for example:
gvfs-set-attribute /home/homefolder/Desktop "metadata::nautilus-default-view" "OAFIID:Nautilus_File_Manager_Icon_View"
Script
Now I have to admit my bash scripting skills aren't the best, but here you go - my script below will allow you to reset all the views below the folder-name given.
Syntax:
folderreset [OPTION] full_base_directory_name
for example this will reset to compact view all folders below /home/homefolder/Desktop
folderreset -c /home/homefolder/Desktop
use folderreset -h
for the syntax.
Feel free to tinker and amend.
#!/bin/bash
#Licensed under the standard MIT license:
#Copyright 2013 fossfreedom.
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
################################ USAGE #######################################
usage=$(
cat <<EOF
Usage:
$0 [OPTION] base_full_directory_name
-h, --help display this help
-l, --list set to list view
-i, --icon set to icon view
-c, --compact set to compact view
for example
$0 -i /home/myhome/Desktop
This will reset all directories BELOW /home/myhome/Desktop
EOF
)
########################### OPTIONS PARSING #################################
#parse options
TMP=`getopt --name=$0 -a --longoptions=list,icon,compact,help -o l,i,c,h -- $@`
if [[ $? == 1 ]]
then
echo
echo "$usage"
exit
fi
eval set -- $TMP
#default values
META=OAFIID:Nautilus_File_Manager_List_View
until [[ $1 == -- ]]; do
case $1 in
-l|--list)
META=OAFIID:Nautilus_File_Manager_List_View
;;
-i|--icon)
META=OAFIID:Nautilus_File_Manager_Icon_View
;;
-c|--compact)
META=OAFIID:Nautilus_File_Manager_Compact_View
;;
-h|--help)
echo "$usage"
exit
;;
esac
shift # move the arg list to the next option or '--'
done
shift # remove the '--', now $1 positioned at first argument if any
if [ ! -d "$1" ]
then
echo "Directory does not exist!"
exit 4
fi
find "$1"/* -type d | while read "D"; do gvfs-set-attribute "$D" "metadata::nautilus-default-view" "$META" &>/dev/null; done
GUI wrapper
Here is a simple GUI wrapper script that could be used to set the view mode right from the Nautilus scripts context menu:
#!/bin/bash
# Licensed under the standard MIT license
# (c) 2013 Glutanimate (http://askubuntu.com/users/81372/)
FOLDERRESET="./folderreset.sh"
WMICON=nautilus
THUMBICON=nautilus
WMCLASS="folderviewsetter"
TITLE="Set folder view"
DIR="$1"
checkifdir(){
if [[ -d "$DIR" ]]
then
echo "$DIR is a directory"
else
yad --title="$TITLE" \
--image=dialog-error \
--window-icon=dialog-error \
--class="$WMCLASS" \
--text="Error: no directory selected." \
--button="Ok":0
exit
fi
}
setviewtype (){
VIEWTYPE=$(yad \
--width 300 --entry --title "$TITLE" \
--image=nautilus \
--button="ok:2" --button="cancel" \
--text "Select view mode:" \
--entry-text \
"list" "icon" "compact")
if [ -z "$VIEWTYPE" ]
then
exit
fi
}
checkifdir
setviewtype
"$FOLDERRESET" --"$VIEWTYPE" "$DIR"
The script depends on the zenity fork yad
which can be installed from this PPA. Make sure to point FOLDERRESET=
to the location of the folderreset
script on your system.
Type this command:
gsettings set org.gnome.nautilus.window-state start-with-sidebar false
It will change default nautilus configuration to doesn't show the sidebar.
If you want to come back to default behavior (nautilus with sidebar) you can simply set the previous setting to true
:
gsettings set org.gnome.nautilus.window-state start-with-sidebar true
If you want more information on gsettings
command you can read the manual:
man gsettings
I hope this could help you.
Best Answer
Install Nemo file manager in Ubuntu (Unity)
Warning: do not use this PPA if you're using Linux Mint or if you use Cinnamon in Ubuntu! Also, if you've added any Cinnamon PPAs, remove them before using the WebUpd8 Nemo PPA even if you didn't install Cinnamon, or else the Nemo version in the WebUpd8 Nemo PPA might be overwritten.
Update: the PPA now provides Nemo 2.8 for Ubuntu 15.10, 15.04 and 14.04.
Add the PPA and install the latest Nemo with Unity tweaks/fixes by using the commands below:
To launch Nemo, search for "Nemo" in Dash - no application called "Nemo" will show up but instead an application called files should be displayed - that's the app you need to launch. Don't search for "Files" because that will also find Nautilus (which is also called "Files").
Why use Nemo? Well, Nemo comes with a huge number of features that no longer exist in Nautilus (including treeview sidebar option). To see other tips like make Nemo your default file manager, etc. go to:
http://www.webupd8.org/2013/10/install-nemo-with-unity-patches-and.html