Recently, in the Linux distro I use, I switched from the Fluxbox desktop environment to XFCE, because XFCE provides some unique and nice features for me like the ability to re-order taskbar buttons. In Fluxbox, I had set up all windows to open at the center of the screen with a hack. XFCE also comes with the ability to center new windows out of the box, however, it fails for me from time to time. Here is how to get rid of the issue so windows are centered properly.
Advertisеment
How to center new windows in XFCE
The XFCE desktop environment comes with its own window manager called xfwm4. It has the appropriate options to place new windows at the center of the screen. To get it working, you need to go to Settings -> Windows Manager tweaks and adjust the Placement slider to the right position as shown below:
That is everything you need to do.
Why window centering does not work and how to fix it
After reboot, I noticed that new windows stopped opening at the center of the screen. Instead, they appeared at the top left corner of the screen:
This is caused by the theme. I switched from the default xfwm4 theme to the Linux Mint theme called "Blue Menta". The issue never happens with the default XFCE themes, but in case of Blue Menta, it was overriding the slider mentioned above with a lower value, so window placement does not work properly.
To fix it, go to the folder of the theme you are using and find the file there called "themerc". It must be in the xfwm4 subfolder. Per-user themes are located in the /home/your_user_name/.themes directory, and system-wide themes are usually located at /usr/shared/themes/.
In my case, I should edit the following file:
/home/hb860/.themes/BlueMenta/xfwm4/themerc
Comment out the "placement_ratio" line as shown below:
Re-apply your theme in Settings -> Window Manager -> Style. Now window placement will work properly and new windows will be opened at the center of the screen.
That's it. Initially, I thought this must be a bug in xfwm4 and even reported it, but thanks to Olivier Fourdan, the creator of XCFE, it is clear now that it is an issue with the theme.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!
Advertisеment
Many thanks, it really solved my problem with Adwaita-X-dark and spared me from a couple of hours trying to figure this out ;)
You are welcome. I spent a bunch of time on this issue, so I should share this tip.
Thanks so much for taking the time to post this – I really like Mint and was so happy to find a solution to the windows centering problem.