Xfce Forum

Sub domains
 

You are not logged in.

#1 2021-09-26 20:20:39

Xfcelan06
Member
Registered: 2021-09-26
Posts: 12

Add View menu to thunar action

I found the relevant command (bash script)f or cycle between Icon
#!/bin/bash

case $(xfconf-query -c thunar -p /last-view) in
    ThunarIconView) xdotool key Ctrl+2 ;;
    ThunarDetailsView) xdotool key Ctrl+3 ;;
    ThunarCompactView) xdotool key Ctrl+1 ;;
esac

But it is not executed properly, only the last line is executed " ThunarCompactView) xdotool key Ctrl+1 ;;"
Don't work icon view and details view
Does anyone know where the problem comes from?
Thanks

Offline

#2 2021-09-26 21:51:59

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Add View menu to thunar action

If "Remember view settings for each folder" is selected, then that xfconf property isn't use. Thunar grabs the view settings from the folder's metdata:

gio info FODLERNAME | grep thunar-view-type

That xfconf property then serves as the default view as specified in the Preferences dialog.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2021-09-27 06:16:31

Xfcelan06
Member
Registered: 2021-09-26
Posts: 12

Re: Add View menu to thunar action

Thank you for reply

ToZ wrote:
gio info FODLERNAME | grep thunar-view-type

.

Where should I replace this command?

I'm the beginner user.
How should I change the above script to work properly?

Last edited by Xfcelan06 (2021-09-27 06:21:47)

Offline

#4 2021-09-27 12:52:55

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Add View menu to thunar action

Try this:

#!/bin/bash 
# $1 is %f in UCA

LAST=$(gio info "$1" | grep thunar-view-type | awk '{print $2}')

if [ -z "$LAST" ]; then
   LAST=$(xfconf-query -c thunar -p /last-view)
fi

case $LAST in
   ThunarIconView) xdotool key Ctrl+2 ;;
   ThunarDetailsView) xdotool key Ctrl+3 ;;
   ThunarCompactView) xdotool key Ctrl+1 ;;
esac

On the Appearance tab, you need to select only "Directories".

There is one issue though, it won't change the view if you click on a sub-folder in thunar (e.g. the Documents folder when viewing your home directory) - it will only work if you click on the background in the thunar view for the current folder in thunar. Unfortunately, there is no way to work around this.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2021-09-27 14:15:35

Xfcelan06
Member
Registered: 2021-09-26
Posts: 12

Re: Add View menu to thunar action

Thank you
It works very well

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 8 queries executed - Memory usage: 545.95 KiB (Peak: 546.8 KiB) ]