Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-04-18 23:18:38

s3idani
Member
Registered: 2023-04-17
Posts: 6

Thunar center geometry

Is there a way to make Thunar runs always on the center of screen?

Last edited by s3idani (2023-04-18 23:19:03)

Offline

#2 2023-04-19 01:00:59

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,436

Re: Thunar center geometry

You can easily set all windows to open center screen via Settings Manager > Window Manager Tweaks > Placement. However, assuming that you are looking to just center thunar, there is not built-in way to do this as smart placement puts the thunar window in an empty space on the screen if center placement is not selected.

It might be possible using a tool like xdotool or devilspie. But it depends on how you start thunar.

For example, if starting from the command line, you could:

thunar && xdotool getactivewindow windowmove 480 280

...adjust 480 and 280 to be the top-left x,y coordinates of the window as it centers on your screen.

If starting from the thunar menu item, you would need to change the Exec= line in the thunar.desktop file to something like:

Exec=sh -c "thunar %U && xdotool getactivewindow windowmove 480 280"

If starting via Ctrl+N from an existing window, its not possible using xdotool.

devilspie works a little differently in that it looks for windows as they load by, for example, class name, and applies rules to the window, including centering it. This would handle all the different instances noted above with one solution and no need to change .desktop files.


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-04-19 02:30:59

s3idani
Member
Registered: 2023-04-17
Posts: 6

Re: Thunar center geometry

Thank you for replying. I'll take a look at devilspie and give a feedback.

Offline

#4 2023-04-19 12:33:19

robson75
Member
From: Poland
Registered: 2023-03-30
Posts: 13

Re: Thunar center geometry

The easiest way is to go to window manager improvement > position and set it to large, this way you will disable smart window placement.

Przechwycenie-obrazu-ekranu-2023-04-19-14-24-53.png


Arch Linux Xfce - 64Bit Linux User #621110 GitHub

Offline

#5 2025-12-19 20:00:27

dbaser
Member
From: Toronto, Canada
Registered: 2025-02-09
Posts: 44
LinuxFirefox 146.0

Re: Thunar center geometry

ToZ wrote:

If starting from the thunar menu item, you would need to change the Exec= line in the thunar.desktop file to something like:

Exec=sh -c "thunar %U && xdotool getactivewindow windowmove 480 280"

OMG! Sorry for the necro but I'm on desktop with dual monitors and have just been putting up with Thunar windows opening on the wrong monitor ever since I installed this distro.

This solution ALMOST works for me when launching from terminal:

thunar && xdotool getactivewindow windowmove 480 280

But it seems that 'getactivewindow' detects the TERMINAL window as the active one (the one I'm using to execute the command) and so the Thunar window still opens on the wrong monitor.

I typically use "Super+e" command to open a new Thunar window and after altering the .desktop file the window still opens on the second monitor. I'm thinking it's a focus issue so I unchecked the "Automatically give new windows focus" box but still no change. Any other focus settings I'm forgetting?


Linux Mint 22.1 XFCE 4.18

Offline

#6 2025-12-19 23:22:16

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,436
LinuxFirefox 146.0

Re: Thunar center geometry

This solution ALMOST works for me when launching from terminal:

thunar && xdotool getactivewindow windowmove 480 280

But it seems that 'getactivewindow' detects the TERMINAL window as the active one (the one I'm using to execute the command) and so the Thunar window still opens on the wrong monitor.

If you are running on a slower computer, you may need to grant some time for the computer to open the application. You can consider adding a short sleep command to the command to allow the window to open:

thunar & sleep 1.0 && xdotool getactivewindow windowmove 480 280

Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2025-12-20 06:32:13

dbaser
Member
From: Toronto, Canada
Registered: 2025-02-09
Posts: 44
LinuxFirefox 146.0

Re: Thunar center geometry

ToZ wrote:

If you are running on a slower computer, you may need to grant some time for the computer to open the application. You can consider adding a short sleep command to the command to allow the window to open:

thunar & sleep 1.0 && xdotool getactivewindow windowmove 480 280

CPU is a 5800X3D and GPU is a 6750XT

With that command, the same thing happens but it gives this result:

$ thunar & sleep 1.0 && xdotool getactivewindow windowmove 480 280
[1] 3218887
[1]+  Done                    thunar

I'm guessing the number is a PID?


Linux Mint 22.1 XFCE 4.18

Offline

#8 2025-12-20 11:14:01

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,436
LinuxFirefox 146.0

Re: Thunar center geometry

Yeah, thats just the shell spitting out the PID when you send an app to the background.

What if you set the sleep time to 2.0? Does the thunar window move then?


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2025-12-20 19:47:38

PackRat
Member
Registered: 2024-09-24
Posts: 37
LinuxFirefox 146.0

Re: Thunar center geometry

dbaser wrote:

OMG! Sorry for the necro but I'm on desktop with dual monitors and have just been putting up with Thunar windows opening on the wrong monitor ever since I installed this distro.

I had this issue a while back.

As I recall, I used the Settings -> Display to set/reset the primary monitor and fixed the problem.

Offline

#10 2025-12-21 00:25:55

dbaser
Member
From: Toronto, Canada
Registered: 2025-02-09
Posts: 44
LinuxFirefox 146.0

Re: Thunar center geometry

PackRat wrote:

As I recall, I used the Settings -> Display to set/reset the primary monitor and fixed the problem.

Wow! So I checked in Display and monitor 1 was already set as Primary Display. Just for fun, I turned off the toggle then turned it back on and hit Apply.

Now it works with sleep value 1.0 or even 0.5. Thanks!

Although wtf? How is my CPU of 5800X3D and a 6750XT GPU in my newly built PC "slow"??? The more I learn about XFCE and Linux the less I understand lol

Added later 01 min 32 s:

ToZ wrote:

Yeah, thats just the shell spitting out the PID when you send an app to the background.

What if you set the sleep time to 2.0? Does the thunar window move then?

I had Primary Display toggle on correctly, but I turned it off and back on again and then hit Apply and now it works. It also works with sleep value of 0.5. I still don't get why my computer is running Mint XFCE slowly with my current hardware? I thought XFCE was lightweight? Still doesn't work with the .desktop file though so I can't bind it to a hotkey.

Last edited by dbaser (2025-12-21 00:29:30)


Linux Mint 22.1 XFCE 4.18

Offline

#11 2025-12-21 00:33:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,436
LinuxFirefox 140.0

Re: Thunar center geometry

I had Primary Display toggle on correctly, but I turned it off and back on again and then hit Apply and now it works. It also works with sleep value of 0.5. I still don't get why my computer is running Mint XFCE slowly with my current hardware? I thought XFCE was lightweight? Still doesn't work with the .desktop file though so I can't bind it to a hotkey.

Is the thunar daemon process running?

Try removing the sleep command now - perhaps its not needed.

thunar & xdotool getactivewindow windowmove 480 280

What might be happening is that the second command (xdotool) is executing before the thunar window is mapped. Adding a small sleep amount just delays the second command briefly from running giving the thunar window time to map itself.

Last edited by ToZ (2025-12-21 00:33:54)


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- 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.017 seconds, 7 queries executed - Memory usage: 590.09 KiB (Peak: 607.51 KiB) ]