Skip to content

Commit

Permalink
Merge pull request #21 from sauntor/master
Browse files Browse the repository at this point in the history
Fixed #4,  and avoid switching to new desktop on login and logout
  • Loading branch information
Aetf authored Jul 18, 2023
2 parents 27e546a + a779b2e commit 495ef3b
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const NewDesktopPositionValue = {
NextToCurrent: 1,
NextToApp: 2,
};
/**
* Clients that should skipped always
*/
const GlobalSkippedClients = ['ksmserver-logout-greeter', 'plasmashell'];

function Config() {
}
Expand Down Expand Up @@ -83,7 +87,11 @@ State.prototype.isKnownClient = function(client) {
}

State.prototype.isSkippedClient = function (client) {
var idx = this.cachedConfig.blockWMClass.indexOf(client.resourceClass.toString());
const resourceClass = client.resourceClass.toString();
if (GlobalSkippedClients.indexOf(resourceClass) != -1) {
return true;
}
var idx = this.cachedConfig.blockWMClass.indexOf();
return idx != -1;
}

Expand Down Expand Up @@ -179,6 +187,35 @@ function Main() {
log('handle maximize done');
},

added: function(client) {
log('handle added');
var area = workspace.clientArea(KWin.MaximizeArea, client);

// const clause = {
// resourceClass: client.resourceClass.toString(),
// clientArea: {
// width: client.width,
// height: client.height
// },
// maximizeArea: {
// width: area.width,
// height: area.height
// }
// };
// log('clause = ' + JSON.stringify(clause));

// There may be a 1-pixel gap on some display/screen
var isMaximized = client.width + 1 >= area.width && client.height + 1 >= area.height;

if (isMaximized) {
self.handlers.maximize(client, true, true);
// } else {
// log('not maximized, skip');
}
log('handle added done');
//if (!(!isMaximized || state.isSkippedClient(client) || state.isSkippedName(client))) {main.moveToNewDesktop(client);};
},

closed: function(client) {
log('handle remove');
self.state.debugDump();
Expand Down Expand Up @@ -367,12 +404,14 @@ Main.prototype.moveBack = function(client, removed) {
Main.prototype.install = function() {
workspace.clientFullScreenSet.connect(this.handlers.fullscreen);
workspace.clientMaximizeSet.connect(this.handlers.maximize);
workspace.clientAdded.connect(this.handlers.added);
log("Handler installed");
}

Main.prototype.uninstall = function() {
workspace.clientFullScreenSet.disconnect(this.handlers.fullscreen);
workspace.clientMaximizeSet.disconnect(this.handlers.maximize);
workspace.clientAdded.disconnect(this.handlers.added);
log("Handler cleared");
}

Expand Down

0 comments on commit 495ef3b

Please sign in to comment.