Skip to content

Commit 4824648

Browse files
committed
release always-open-on-active-screen v2.5
1 parent 183916b commit 4824648

File tree

8 files changed

+65
-7
lines changed

8 files changed

+65
-7
lines changed

always-open-on-active-screen/CHANGELOG.bbcode

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[h2]v2.5[/h2]
2+
[list]
3+
[*] fix metadata not found
4+
[/list]
5+
16
[h2]v2.4[/h2]
27
[list]
38
[*] make script automatically enabled after install

always-open-on-active-screen/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v2.5
2+
- fix metadata not found
3+
14
## v2.4
25
- make script automatically enabled after install
36
- update package structure
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
- make script automatically enabled after install
2-
- update package structure
3-
- add install/uninstall scripts
4-
- add changelog in BB Code format
1+
- fix metadata not found
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
KWin Script Always Open on Active Screen
3+
(C) 2021 Natalie Clarius <[email protected]>
4+
GNU General Public License v3.0
5+
*/
6+
7+
// when a client is added
8+
workspace.clientAdded.connect(function(client) {
9+
activeScreen = workspace.activeScreen;
10+
// move client to active screen
11+
if (client == null || client.desktopWindow || client.dock) return;
12+
if (client.screen == activeScreen) return;
13+
console.debug("sending client", client.caption, "to active screen", activeScreen);
14+
workspace.sendClientToScreen(client, activeScreen);
15+
16+
// clip and move client into bounds of screen dimensions
17+
if (!(client.moveable && client.resizeable)) return;
18+
area = workspace.clientArea(KWin.MaximizeArea, client);
19+
// window width/height maximally screen width/height
20+
client.geometry.width = Math.min(client.width, area.width);
21+
client.geometry.height = Math.min(client.height, area.height);
22+
// left/top window edge between left and right/top and bottom screen edges
23+
client.geometry.x = Math.max(area.x, Math.min(area.x + area.width - client.width, client.x));
24+
client.geometry.y = Math.max(area.y, Math.min(area.y + area.height - client.height, client.y));
25+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
kpackagetool5 --type=KWin/Script --install package || kpackagetool5 --type=KWin/Script --upgrade package
2+
kpackagetool5 --type=KWin/Script --install . || kpackagetool5 --type=KWin/Script --upgrade .
33
qdbus org.kde.KWin /KWin reconfigure
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# KWin Script Always Open on Active Screen
2+
# (C) 2021 Natalie Clarius <[email protected]>
3+
# GNU General Public License v3.0
4+
5+
[Desktop Entry]
6+
Name=Always Open on Active Screen
7+
Name[de]=Immer auf aktivem Bildschirm öffnen
8+
Name[nl]=Altijd openen op actief scherm
9+
Comment=Always opens new windows on the monitor that has the mouse cursor
10+
Comment[de]=Öffnet neue Fenster immer auf dem Monitor mit dem Mauszeiger
11+
Comment[nl]=Opent nieuwe vensters altijd op het scherm met de cursor]
12+
Icon=preferences-system-windows
13+
14+
X-KDE-PluginInfo-Name=alwaysopenonactivescreen
15+
X-KDE-PluginInfo-Version=2.5
16+
X-KDE-PluginInfo-Author=Natalie Clarius
17+
X-KDE-PluginInfo-Email[email protected]
18+
X-KDE-PluginInfo-License=GPL v3.0
19+
X-KDE-PluginInfo-Website=https://store.kde.org/p/1617640/
20+
21+
Type=Service
22+
X-Plasma-API=javascript
23+
X-Plasma-MainScript=code/main.js
24+
X-KDE-ServiceTypes=KWin/Script,KCModule
25+
X-KDE-ConfigModule=kwin/effects/configs/kcm_kwin4_genericscripted
26+
X-KDE-PluginKeyword=alwaysopenonactivescreen
27+
X-KDE-ParentComponents=alwaysopenonactivescreen
28+
X-KDE-PluginInfo-EnabledByDefault=true

always-open-on-active-screen/package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# get plugin info
44
name=$(basename "$PWD")
5-
version=$(grep -oP '(?<=X-KDE-PluginInfo-Version=).*' package/metadata.desktop)
5+
version=$(grep -oP '(?<=X-KDE-PluginInfo-Version=).*' ./metadata.desktop)
66
echo "$name v$version"
77

88
# generate changelog in markdown format
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
2-
kpackagetool5 --type=KWin/Script --remove package
2+
kpackagetool5 --type=KWin/Script --remove .
33
qdbus org.kde.KWin /KWin reconfigure

0 commit comments

Comments
 (0)