Skip to content

Latest commit

 

History

History

always-open-on-primary-screen

Always Open on Primary Screen

Extension for KDE’s window manager to make new windows always open on the monitor that is set as primary in System Settings > Display and Monitor > Display Configuration > checkbox Primary.

The windows to be affected can be filtered by application.

logo

Installation

Dependencies

kwin (tested with the current version).

Installation via graphical interface

  1. Install the script via System Settings > Window Management > KWin Scripts > Get New Scripts … > search for Always Open on Primary Screen > Install.
  2. Enable the script by activating its checkbox, and apply the settings.

Please make sure to select the most recent version.

A bug in Discover cauases a wrong version to be installed, so using System Settings instead is recommended.

Installation via command line

git clone https://github.com/nclarius/KWin-window-positioning-scripts.git
cd KWin-window-positioning-scripts/always-open-on-primary-screen
./install.sh

Configuration

System Settings > Window Management > KWin Scripts > configuration button in the Always Open on Primary Screen entry.

You may need to uncheck the checkbox for the script, apply the settings, recheck, and reapply in order for the changes to take effect.

In Plasma versions < 5.24, a bug in the KWin scripting system [1] [2] may cause the configuration not to be found. To fix this, please execute the following commands in a terminal:

sed -i 's/ConfigModule/Library/g' ~/.local/share/kwin/scripts/alwaysopenonprimaryscreen/metadata.json
mkdir -p ~/.local/share/kservices5/
ln -sf ~/.local/share/kwin/scripts/alwaysopenonprimaryscreen/metadata.json ~/.local/share/kservices5/alwaysopenonprimaryscreen.json
qdbus org.kde.KWin /KWin reconfigure

Window class

To find the window class name of an application: Right-click on the titlebar of a window of the application > More Actions > Configure Special Application Settings... > the pre-filled entry in Window class (application) (if it consists of two words, only the second part) is the window class to put in the script configuration.

Troubleshooting and known issues

  • On X11: If KDE applications open on the wrong screen, consider disabling applications requesting their own window geometry: System Settings > Window Management > Window Behavior > Advanced > Window placement > Allow apps to remember the positions of their own windows, if they support it.
  • On Wayland: Some XWayland applications may attempt to remember their window position; this can be prevented with a window rule: System Settings > Window Management > Window Rules > Add New... > enter the window class of the application and possibly restrict the window type to normal windows > Add Property.. > Ignore requested geometry > Force, Yes > Apply.
  • It has been suggested that the script might not work for snap applications; if this appears to be the case for you, consider using the native packages instead.
  • For notifications to appear on the primary screen, make sure you have the notification applet present and enabled on your primary screen, and not present or disabled on any secondary screens.
  • If some applications still open on the wrong screen despite these workarounds, please report it, even more so if you have an idea what the problem might be or how to fix it.

Small Print

© 2021-2022 Natalie Clarius <[email protected]>

with contributions by Joe Defenderfer and Tamim Baschour.

This work is licensed under the GNU General Public License v3.0.
This program comes with absolutely no warranty.
This is free software, and you are welcome to redistribute and/or modify it under certain conditions.

If you would like to thank me, you can always make me happy with a review or a cup of coffee: