Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-11-12 01:38:47

korakios
Member
Registered: 2018-11-12
Posts: 1

Prevent creating new window if already exists

Hi,
Is it possible to avoid multiple windows in thunar if there is already another one showing the same location?
For example if I download something I choose open file location ,a window pops up showing the downloads.
Now if I choose to open file location again a new window will be created sad
I'd prefer showing the previous window instead of opening a new one.

Is there a setting,script,plugin or something ??

Offline

#2 2018-11-12 03:06:21

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

Re: Prevent creating new window if already exists

Hello and welcome.

Try this (I think I got most of the use cases - some outside ones still exist). Create the file as /usr/local/bin/thunar with the following content:

#!/bin/bash

if [ "$#" -lt 2 ]; then

	if [ "$#" -eq 1 ]; then
		LAS="$(basename $1) "
	else
		LAS="$(basename $PWD) "
	fi

	LOC=$(wmctrl -lx | grep "Thunar.Thunar" | grep -i thunar | grep -i "$LAS" | head -1)

	if [ "$LOC" != "" ]; then
		WIN=$(wmctrl -lx | grep "Thunar.Thunar" | grep -i "$LAS" | grep -i thunar | head -1 | awk '{print $1}')
		wmctrl -i -a "$WIN"
	else
		/usr/bin/thunar $@
	fi

else 
	/usr/bin/thunar $@
fi

exit 0

...and make the file executable. Requires wmctrl.

Note: doesn't work with exo-open - you must use the Thunar menu items.
Edit: typo

Last edited by ToZ (2018-11-12 03:11:02)


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

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

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 522.98 KiB (Peak: 531.93 KiB) ]