Is there a way to use different folders views each folder ? Some folders i like to see as icons and others is better to see as list.
Ubuntu – How to set specific folders to list- or icon view in nautilus
nautilus
Related Question
- Ubuntu – How to expand all folders while in the list view
- Ubuntu – How to set a custom icon for a folder
- Ubuntu – How to make 33% “list view” in Nautilus be the default view for the system
- Ubuntu – How to don’t “list folders before files” on Nautilus Trash and Downloads folders
- Ubuntu – How to reenable alternating grey lines in Nautilus/Files 3.6+ list view
- Ubuntu – Distance between folders inside “Icon view” mode (Nautilus)
- Ubuntu – Nemo / Nautilus folder icon size
Best Answer
Since
nautilus
does not have a command line option to switch between list- and icon view, nor has the option to set view prferences per folder, there is no clean way to do that.Started as an experiment, the option below was to see if it could be done anyway in a reasonably functional way.
As mentioned in a comment, the solution is as dirty as it gets, but it turned out to be fully functional, and in the hours that I tested it, I did not run into issues. The decision to use it or not is yours.
The scripts and what they do
The solution consists of two scripts; one to be run from a shortcut key to add the active (nautilus) window to a list. Listed windows will be automatically set to list view, other windows are in icon view by default. Of course you can set it vice versa, depending on what view type you'd like to set as default
The switch from / to list view is done by simulating either Ctrl+1 or Ctrl+2, which are the shortcuts in
nautilus
to set list- or icon view.How it works in practice
Running the first script in the background, the default view for nautilus windows is icon view.
If you want to set list view for a specific folder, you navigate to the folder (open it), with the folder's window opened and frontmost, press (e.g. Ctrl+Alt+A)
This will add the window's name to a list (kept in a hidden file in your home directory). The next time you open the folder, it will automatically switch to list view, and back to icon view when you navigate tyo another folder.
To remove the folder from the list, press Ctrl+Alt+R with the folder in question in front.
How to set up
The scripts need both
wmctrl
andxdotool
:Copy the script below into an empty file, save it as
add_folder.py
This is the script to add or remove the window to/from list view.Test run the script by the command:
A hidden file should be created in
~/home
, named.window_list.txt
. You will need to press Ctrl+H to make it visible (files with a name, starting wit a '.' are invisible by default)If it works fine, add both commands:
to a shortcut key combination (I used Ctrl+Alt+R and Ctrl+Alt+A): choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command(s)
Copy the script below into an empty file, save it as
set_view.py
This is the background script to change the window's view to either list view or icon view.Test run it by running from a terminal window:
Navigate through your folders and add / remove folders to the list-view list as described in
2.
(remember, the list view will be activated the next time you open the folder)That's it!
Note
Since the script does not see if the listed folders still exist in your directories, the file
~/.window_list.txt
might include some outdated entries over time if you delete listed folders.You can prevent dat by either use the shortcut you set to do so, or simply walk through the file every once and a while.