Skip to content

Commit

Permalink
remove inappropriate configuration module entry in metadata; add deb…
Browse files Browse the repository at this point in the history
…ug info refactor
  • Loading branch information
nclarius committed Mar 2, 2022
1 parent 5491cee commit 372173f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
File renamed without changes
6 changes: 6 additions & 0 deletions always-open-on-focused-screen/CHANGELOG.bbcode
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[h2]v2.7[/h2]
[list]\n[*] remove inappropriate configuration module entry in metadata
[*] add debug info
[*] refactor
[/list]

[h2]v2.6[/h2]
[list]
[*] fix metadata not found
Expand Down
5 changes: 5 additions & 0 deletions always-open-on-focused-screen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v2.7
- remove inappropriate configuration module entry in metadata
- add debug info
- refactor

## v2.6
- fix metadata not found

Expand Down
2 changes: 2 additions & 0 deletions always-open-on-focused-screen/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- remove inappropriate configuration module entry in metadata
- add debug info
- refactor
21 changes: 16 additions & 5 deletions always-open-on-focused-screen/contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@ KWin Script Always Open on Focused Screen
GNU General Public License v3.0
*/

// when a client is activated
// initialization
const debugMode = readConfig("debugMode", true);
function debug(...args) {if (debugMode)
console.debug("alwaysopenonfocusedscreen:", ...args);}
debug("initializing");

// when a client is activated, update focused screen to screen client is on
focusedScreen = workspace.activeScreen;
workspace.clientActivated.connect(function(client) {
workspace.clientActivated.connect(client => {
if (!client || client.resourceClass == "plasmashell") return;
// update focused screen to screen client is on
focusedScreen = client.screen;
debug("focused screen", activeScreen);
});

// when a client is added
workspace.clientAdded.connect(function(client) {
workspace.clientAdded.connect(client => {
debug("client", JSON.stringify(client, undefined, 2));

// abort if client is null or not a normal window
if (!client || client.resourceClass == "plasmashell") return;

// abort if client is already on the right screen
if (client.screen == focusedScreen) return;

// move client to focused screen
console.debug("sending client", client.caption, "to focused screen", focusedScreen);
debug("sending client", client.caption, "to focused screen", focusedScreen);
workspace.sendClientToScreen(client, focusedScreen);

// clip and move client into bounds of screen dimensions
Expand Down
2 changes: 1 addition & 1 deletion always-open-on-focused-screen/metadata.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Comment[nl]=Open nieuwe vensters altijd op het scherm met een gefocust venster
Icon=preferences-system-windows

X-KDE-PluginInfo-Name=alwaysopenonfocusedscreen
X-KDE-PluginInfo-Version=2.6
X-KDE-PluginInfo-Version=2.7
X-KDE-PluginInfo-Author=Natalie Clarius
X-KDE-PluginInfo-Email=natalie_clarius@yahoo.de
X-KDE-PluginInfo-License=GPL v3.0
Expand Down

0 comments on commit 372173f

Please sign in to comment.