Skip to content

Commit 372173f

Browse files
committed
remove inappropriate configuration module entry in metadata; add debug info refactor
1 parent 5491cee commit 372173f

File tree

7 files changed

+30
-6
lines changed

7 files changed

+30
-6
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[h2]v2.7[/h2]
2+
[list]\n[*] remove inappropriate configuration module entry in metadata
3+
[*] add debug info
4+
[*] refactor
5+
[/list]
6+
17
[h2]v2.6[/h2]
28
[list]
39
[*] fix metadata not found

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v2.7
2+
- remove inappropriate configuration module entry in metadata
3+
- add debug info
4+
- refactor
5+
16
## v2.6
27
- fix metadata not found
38

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
- remove inappropriate configuration module entry in metadata
2+
- add debug info
3+
- refactor

always-open-on-focused-screen/contents/code/main.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,32 @@ KWin Script Always Open on Focused Screen
44
GNU General Public License v3.0
55
*/
66

7-
// when a client is activated
7+
// initialization
8+
const debugMode = readConfig("debugMode", true);
9+
function debug(...args) {if (debugMode)
10+
console.debug("alwaysopenonfocusedscreen:", ...args);}
11+
debug("initializing");
12+
13+
// when a client is activated, update focused screen to screen client is on
814
focusedScreen = workspace.activeScreen;
9-
workspace.clientActivated.connect(function(client) {
15+
workspace.clientActivated.connect(client => {
1016
if (!client || client.resourceClass == "plasmashell") return;
11-
// update focused screen to screen client is on
1217
focusedScreen = client.screen;
18+
debug("focused screen", activeScreen);
1319
});
1420

1521
// when a client is added
16-
workspace.clientAdded.connect(function(client) {
22+
workspace.clientAdded.connect(client => {
23+
debug("client", JSON.stringify(client, undefined, 2));
24+
25+
// abort if client is null or not a normal window
1726
if (!client || client.resourceClass == "plasmashell") return;
27+
28+
// abort if client is already on the right screen
1829
if (client.screen == focusedScreen) return;
1930

2031
// move client to focused screen
21-
console.debug("sending client", client.caption, "to focused screen", focusedScreen);
32+
debug("sending client", client.caption, "to focused screen", focusedScreen);
2233
workspace.sendClientToScreen(client, focusedScreen);
2334

2435
// clip and move client into bounds of screen dimensions

always-open-on-focused-screen/metadata.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Comment[nl]=Open nieuwe vensters altijd op het scherm met een gefocust venster
1212
Icon=preferences-system-windows
1313

1414
X-KDE-PluginInfo-Name=alwaysopenonfocusedscreen
15-
X-KDE-PluginInfo-Version=2.6
15+
X-KDE-PluginInfo-Version=2.7
1616
X-KDE-PluginInfo-Author=Natalie Clarius
1717
X-KDE-PluginInfo-Email[email protected]
1818
X-KDE-PluginInfo-License=GPL v3.0

0 commit comments

Comments
 (0)