Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetf committed Feb 20, 2017
1 parent 4448da6 commit b5400f3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
51 changes: 51 additions & 0 deletions contents/code/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
var savedDesktops = {};
function handler(client, full, user) {
if (full) {
savedDesktops[client.windowId] = client.desktop;

var next = workspace.desktops + 1;
workspace.desktops = next;
client.desktop = next;
workspace.currentDesktop = next;
workspace.activateClient = client;
} else {
var saved = savedDesktops[client.windowId];
if (saved === undefined) {
print("Old info not found");
} else {
print("Resotre client desktop to " + saved);
client.desktop = saved;
workspace.currentDesktop = saved;
workspace.activateClient = client;

workspace.desktops -= 1;
}
}
}
workspace.clientFullScreenSet.connect(handler)
registerUserActionsMenu(function(client){
print("Registering menu for client " + client.caption);
return {
text: "Maximize helper",
items: [
{
text: "Uninstall",
checkable: false,
checked: false,
triggered: function(act) {
workspace.clientFullScreenSet.disconnect(handler);
print("Handler cleared");
}
}, {
text: "Install",
checkable: false,
checked: false,
triggered: function(act) {
workspace.clientFullScreenSet.connect(handler);
print("Handler installed");
}
}
]
};
});
print("Done");
19 changes: 19 additions & 0 deletions metadata.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Desktop Entry]
Name=Maxmize To New Virtual Desktop
Comment=Automatically move fullscreened window to a new virtual desktop.
Icon=preferences-system-windows-script-test
Type=Service

X-Plasma-API=javascript
X-Plasma-MainScript=code/main.js

X-KDE-PluginInfo-Author=Aetf
X-KDE-PluginInfo-Email[email protected]
X-KDE-PluginInfo-Name=max2NewVirtualDesktop
X-KDE-PluginInfo-Version=0.0.1
X-KDE-PluginInfo-EnabledByDefault=true

X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=MIT
X-KDE-ServiceTypes=KWin/Script
X-KDE-PluginKeyword=max2NewVirtualDesktop

0 comments on commit b5400f3

Please sign in to comment.