XFCE thunar double-view workaround for non snapped windows

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

XFCE thunar double-view workaround for non snapped windows

Post by secureIT » Sun Jul 28, 2019 10:05 am

XFCE Thunar double-view workaround for non snapped windows
renamed from original headline : XFCE Thunar split-view workaround

edit: only for thunar-windows that are not snapped on the screen edges

Note : it is only for configs like those, who shows apllication-windows in the middle of the screen
(For explanation : long time ago i found it frustrating, that every application window - also browser-window opens up with snap on the screen edges. So i decided to fix that, like many other xfce-users within the fine tuning of : smallest size for intelligent window placement : slide up to the end of big.
So the application windows all open up in middle of the screen.)
This Script is for them that does their config like me (i think most of us).
For other configs like snapped windows it might be mess up something, as you can read in next posts of this thread. (thanks to Flemur, who pointed it in his posts)

As thunar has no integrated split-view and the split-view patch doesnt work any more, i created a workaround within a script.
Might be helpful for somebody. :)

Script works with xdotool

Code: Select all

apt install xdotool

Code: Select all

#!/bin/bash
# woraround for split-view of thunar tested with screen-resolution of 1280x800
# for other screen-resolutions play around with the numbers in windowsize and windowmove
# name : thunar-doubleview.sh
#
# script needs xdotool - apt install xdotool
#
# configure how left window shows up:
#
# comment or uncomment next commandlines for xconf :
# without side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set void
# with side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set ThunarShortcutsPane
#
# starting the left window of thunar
thunar
xdotool getwindowfocus windowsize 600 600 windowmove 40 100
#
# configure how right window shows up:
#
# comment or uncomment next commandlines for xconf :
# without side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set void
# with side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set ThunarShortcutsPane
#
# starting the right window of thunar
thunar
xdotool getwindowfocus windowsize 600 600 windowmove 650 100
#
#configure how thunar will show up when started next time without split-view :
#
# comment or uncomment next commandlines for xconf:
# without side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set void
# with side-pane :
#xfconf-query --channel thunar --property /last-side-pane --set ThunarShortcutsPane

Copy script into a .txt file ,rename it to thunar-doubleview.sh and move it to ~/bin
After that open thunar, right-click on the file and choose <properties>
In the properties-window choose <access rights>
and mark : <file may be started as a program>

Now you can create a launcher with command :

Code: Select all

bash -c thunar-doubleview.sh
Last edited by secureIT on Tue Jul 30, 2019 5:09 pm, edited 9 times in total.
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

User avatar
Flemur
Level 17
Level 17
Posts: 7086
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: XFCE thunar split-view workaround

Post by Flemur » Sun Jul 28, 2019 11:43 am

secureIT wrote:
Sun Jul 28, 2019 10:05 am

Code: Select all

thunar
xdotool getwindowfocus windowsize 600 600 windowmove 40 100

thunar
xdotool getwindowfocus windowsize 600 600 windowmove 650 100
Everything else is commented out ...

Copy script into a .txt file ,rename it to thunarsplitview.sh and move it to ~/bin
After that open thunar, right-click on the file and choose <properties>
In the properties-window choose <access rights>
and mark : <file may be started as a program>

Now you can create a launcher with command :

Code: Select all

bash -c thunarsplitview.sh
Doesn't the file require some un-commenting?

Running it as-is, I just get two consecutive thunar windows.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

Re: XFCE thunar split-view workaround

Post by secureIT » Sun Jul 28, 2019 11:56 am

Hi Flemur,
did you install xdotool ?
xdotool will place the windows one beside the other and thats like a split view
When you leave the script as it is, two instances of thunar will open left and right.
It is only a workaround ..... not a real split view into one instance with one window.
edit:
But it will work like a real split view ..... copy and paste - or drag and drop ..... and so on ...
end of edit
Thunar will open at its last state (also with side-pane - or not)
Commenting or uncommenting xconf-queries will have the effect to overwrite last settings in :

Code: Select all

~/.conf/xfce4/xfconf/xfce-perchannel-xml/thunar.xml
... so that you are able to start this split-view-like thing with or without side-panes optionally per window left/right .........
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

Re: XFCE thunar split-view workaround

Post by secureIT » Mon Jul 29, 2019 3:50 pm

In addition to the script here is one to close both opened windows at once :

Code: Select all

#!/bin/bash
# close the 2 instances of thunar at once (that were opened with split-view)
# to install : wmctrl
# name: thunardoubleview-close.sh
for P in {1..2}
do
wmctrl -c File Manager
sleep 0.5
done
exit
The script needs to install wmctrl

Code: Select all

apt install wmctrl
install the script like in post # 1

command for a launcher is :

Code: Select all

bash -c thunardoubleview-close.sh
see both scripts in action in this vid :

https://streamable.com/ksvsu
Last edited by secureIT on Tue Jul 30, 2019 1:37 pm, edited 2 times in total.
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

User avatar
Flemur
Level 17
Level 17
Posts: 7086
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: XFCE thunar split-view workaround

Post by Flemur » Mon Jul 29, 2019 5:02 pm

secureIT wrote:
Sun Jul 28, 2019 11:56 am
Hi Flemur,
did you install xdotool ?
Of course.

When I run the script you posted (which consists of 4 uncommented lines), I get an instance of thunar. When I close that instance of thunar, the terminal I opened it in jumps to a different location and I get another instance of thunar. Both have one view, as usual. When I close that 2nd instance of thunar, this firefox window that I'm typing in, shrinks from full-screen [Edit: almost full screen] to maybe 400 pixels or so.

So, as far as I can tell, your script does some minor bad stuff and doesn't do anything useful.
Last edited by Flemur on Mon Jul 29, 2019 5:37 pm, edited 2 times in total.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
Flemur
Level 17
Level 17
Posts: 7086
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: XFCE thunar split-view workaround

Post by Flemur » Mon Jul 29, 2019 5:08 pm

secureIT wrote:
Sun Jul 28, 2019 11:56 am
xdotool will place the windows one beside the other and thats like a split view
You should've made that clearer: that it just opens two thunar windows next to each other and you don't get a split view.

Except that it doesn't open two windows next to each other, it just consecutively opens two instances of thunar, and messes up some other windows.

A script like this:

Code: Select all

thunar 
thunar 
would do the same thing but with less damage.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

Re: XFCE thunar split-view workaround

Post by secureIT » Tue Jul 30, 2019 8:36 am

Hi Flemur,

As I said before, this is a workaround to get the same benefits as working with a real splitview.
Opening two instances of thunar does not affect my system.
I do not know why that's the case with you.
In my installation, this will not affect any running or underneath window.
Also it dont messes up anything into the system.
May be the dimensions of your screen are smaller than positions that are called by the script.
Read the script :
# ……… tested with screen-resolution of 1280x800
# for other screen-resolutions play around with the numbers in windowsize and windowmove

But I think it's more because you run the script in the terminal.
the terminal I opened it in jumps to a different location and I get another instance of thunar.
Who said you should run the script in the terminal ?
So, as far as I can tell, your script does some minor bad stuff and doesn't do anything useful.
You dont know really what it does …. right ?

If one wants to work with Thunar like in a split-view or as with Double Commander, (drag and drop e.g.) he would have to manually open two instances and place them side by side.
It may also be necessary to change the size of the windows beforehand so that they also fit next to each other. That depends on how the size of the window was before the last closing of thunar.

All of that does the script with one click.
And more : if you uncomment some lines it will start the windows with or without side-pane-view.
And at the end of the script you can decide how thunar will look when you open it again in one instance (after closing the 2-Window-view) – with or without side-pane-view.

And with the additional script it closes the two windows.


If it is not helpful for you : dont use it.
A script like this:
thunar
thunar
would do the same thing but with less damage.
No it would not ….. it would place two thunar windows with same size (also two instances) one about the other … and you will have to do all things manually ........
edit :
But see that vid - first sequence is open 2 instances of thunar without script- second sequence is with script :

https://streamable.com/nxjws
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

Re: XFCE thunar split-view workaround

Post by secureIT » Tue Jul 30, 2019 11:20 am

One more thing i tested in the last 2 hours :

Instead of using launcher control, it is also possible to call the script as a custom action directly from thunar.

I know, that then a total of 3 instances of thunar are open.

But that did not mess up my system in any way..........

See Vid :

https://streamable.com/iwn07
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

User avatar
Flemur
Level 17
Level 17
Posts: 7086
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: XFCE thunar split-view workaround

Post by Flemur » Tue Jul 30, 2019 11:42 am

secureIT wrote:
Tue Jul 30, 2019 8:36 am
Who said you should run the script in the terminal ?
Who said I shouldn't? Who writes scripts which don't work in a terminal?
You dont know really what it does …. right ?
Of course I do because I ran it.
A script like this:
thunar
thunar
would do the same thing but with less damage.
No it would not ….. it would place two thunar windows with same size (also two instances) one about the other … and you will
Like I said, my two-line script is better than your script, because your script also doesn't place two instances of thunar next to each other and your script messes with other windows.

Anyone wanting dual-pane in thunar should just try pcmanfm. It's very similar to thunar and has that function built in.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
secureIT
Level 3
Level 3
Posts: 150
Joined: Wed Dec 05, 2018 1:26 pm

Re: XFCE thunar split-view workaround

Post by secureIT » Tue Jul 30, 2019 12:33 pm

Tested now on 3 different systems with 3 different screen-resolutions: script runs :)
snippets of the script for :
1280x800

Code: Select all

thunar
xdotool getwindowfocus windowsize 600 600 windowmove 40 100
thunar
xdotool getwindowfocus windowsize 600 600 windowmove 650 100
1680x1050

Code: Select all

thunar
xdotool getwindowfocus windowsize 800 800 windowmove 20 100
thunar
xdotool getwindowfocus windowsize 800 800 windowmove 830 100
1920x1080

Code: Select all

thunar
xdotool getwindowfocus windowsize 800 800 windowmove 150 100
thunar
xdotool getwindowfocus windowsize 800 800 windowmove 955 100
@ Flemur :
so if you think your script is better then please: run it for yourself.

I've been thinking about why your script works for you, but not for me - and vice versa :
It just has to do with the fine adjustments of the window management :
As my thunar is placed in the middle of the screen :
Smallest size for intelligent window placement : slide up to the end of big -
yours snap on the screen edges .
So for you :
thunar
thunar
works
…. but not for me.
With thunar in middle of the screen it will not work ……
So : for you its really better , to do it your way.

edit: fixed first post with that headline:
XFCE thunar double-view workaround for non snapped windows
and in text :
only for thunar-windows that are not snapped on the screen edges
and: renamed the scripts
In der Ruhe liegt die Kraft ! .......... The strenght is to be found in serenity !

Post Reply

Return to “Tutorials”