Results 1 to 4 of 4

Thread: Thunar Custom Action to Change folder View Style?

  1. #1
    Join Date
    Oct 2009
    Beans
    155
    Distro
    Xubuntu 12.04 Precise Pangolin

    Thunar Custom Action to Change folder View Style?

    On Thunar if I change a view to icons, it is a global change. Can anyone suggest a method to write a custom action to fix the view in just the one folder and make it stay that way for just the one folder.

    As we go back and forth switching views between folders that need a list view (large files) or ones that we would like icons, it gets a bit old. Doable, but old.

    Maybe it's not possible, because I see nothing in Ubuntu forum history and Google.

    Thought one of you programmer types out there would crack it with a Custom Action.

    Thank you

  2. #2
    Join Date
    Oct 2009
    Beans
    155
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Thunar Custom Action to Change folder View Style?

    No answer? Is the solution too complex for the result?

  3. #3
    Join Date
    Jul 2012
    Beans
    315
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Thunar Custom Action to Change folder View Style?

    This might have some mileage, although is still two clicks to get there.

    Install xdotool, then setup a custom action just for directories with this command:

    for IconView:

    Code:
    xdotool key CTRL+1 %d
    (and set appearance conditions to directories only)

    Now when you right click on a directory you will be offered IconView and it changes to that. You can also right click in blank space to change the view. It's still global, but with a bit more scripting, and if only specific directories require a specific view, it should be possible to improve on this.

    For example, you could use this code in the custom action so that only Pictures will change to IconView.
    Code:
    if [ %n = Pictures ]; then xdotool key CTRL+1 %d;fi
    It's still global though

    CTRL+2 gives DetailsView and CTRL+3 give CompactView so you could write additional custom actions for these as well

    Separate windows of thunar will use different views

    Alternatively, you could setup a shortcut on your desktop to open thunar at a particular directory you want in a particular view, and write a scipt that changes the contents of ~/.config/Thunar.thunarrc "LastView" before opening a thunar window. Just as an example:

    Code:
    #!/bin/bash
    #opens thunar to a directory in IconView
    
    
    if (grep -Fxq "DefaultView=void" ~/.config/Thunar/thunarrc); then
    
    sed -ie 's/DefaultView=ThunarDetailsView/DefaultView=ThunarIconView/g' /home/user/.config/Thunar/thunarrc
    
    fi
    
    
    if (grep -Fxq "DefaultView=ThunarDetailsView" ~/.config/Thunar/thunarrc); then
    
    sed -ie 's/DefaultView=ThunarDetailsView/DefaultView=ThunarIconView/g' /home/user/.config/Thunar/thunarrc
    
    fi
    
    
    if (grep -Fxq "DefaultView=ThunarCompactView" ~/.config/Thunar/thunarrc); then
    
    sed -ie 's/DefaultView=ThunarDetailsView/DefaultView=ThunarIconView/g' /home/user/.config/Thunar/thunarrc
    
    fi
    
    thunar ~/Pictures
    Last edited by Merrattic; October 10th, 2012 at 03:03 PM.
    The best things in life are free, so what are we paying for?

  4. #4
    Join Date
    Oct 2009
    Beans
    155
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Thunar Custom Action to Change folder View Style?

    I'll play around with that tonight, thanks for the ideas!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •