Commit 5477cb98 authored by nightreveller's avatar nightreveller Committed by Sander Boom

Initial commit

parents
Pipeline #335 failed with stages
in 49 seconds
*.kwinscript
# KWin script: Move Window and Focus to Desktop
> KWin script that creates shortcuts for moving a window and the focus to a certain desktop.
## Install:
### GUI:
- Go to `System Settings > Window Management > KWin Scripts`
- Click `Get New Scripts`
- Search for 'Move Window and Focus to Desktop'
### Command line:
- Clone this repo
- `zip -r movewindowandfocustodesktop.kwinscript contents/ metadata.desktop README.md`
- `plasmapkg2 -i /path/to/movewindowandfocustodesktop.kwinscript`
## Setup shortcuts
Configure the global shortcuts at `System Settings > Shortcuts > Global Shortcuts > KWin`.
Installation of the plugin will set the following shortcuts as default:
- Desktop 1: `Meta+Shift+1` aka `Meta+!`,
- Desktop 2: `Meta+Shift+2` aka `Meta+@`,
- Desktop 3: `Meta+Shift+3` aka `Meta+#`,
- Desktop 4: `Meta+Shift+4` aka `Meta+$`,
- Desktop 5: `Meta+Shift+5` aka `Meta+%`,
- Desktop 6: `Meta+Shift+6` aka `Meta+^`,
- Desktop 7: `Meta+Shift+7` aka `Meta+&`,
- Desktop 8: `Meta+Shift+8` aka `Meta+*`,
- Desktop 9: `Meta+Shift+9` aka `Meta+(`,
- Desktop 10: `Meta+Shift+10` aka `Meta+)`,
/**
* KWin script that creates shortcuts for moving a window and the focus to a certain desktop.
*/
var defaultShortcuts = [
'Meta+!',
'Meta+@',
'Meta+#',
'Meta+$',
'Meta+%',
'Meta+^',
'Meta+&',
'Meta+*',
'Meta+(',
'Meta+)'
];
registerShortcut('MoveWindowAndFocusToDesktop1', 'Move Window and Focus to Desktop 1', defaultShortcuts[0], function() { moveToDesktopAndActivate(1);});
registerShortcut('MoveWindowAndFocusToDesktop2', 'Move Window and Focus to Desktop 2', defaultShortcuts[1], function() { moveToDesktopAndActivate(2);});
registerShortcut('MoveWindowAndFocusToDesktop3', 'Move Window and Focus to Desktop 3', defaultShortcuts[2], function() { moveToDesktopAndActivate(3);});
registerShortcut('MoveWindowAndFocusToDesktop4', 'Move Window and Focus to Desktop 4', defaultShortcuts[3], function() { moveToDesktopAndActivate(4);});
registerShortcut('MoveWindowAndFocusToDesktop5', 'Move Window and Focus to Desktop 5', defaultShortcuts[4], function() { moveToDesktopAndActivate(5);});
registerShortcut('MoveWindowAndFocusToDesktop6', 'Move Window and Focus to Desktop 6', defaultShortcuts[5], function() { moveToDesktopAndActivate(6);});
registerShortcut('MoveWindowAndFocusToDesktop7', 'Move Window and Focus to Desktop 7', defaultShortcuts[6], function() { moveToDesktopAndActivate(7);});
registerShortcut('MoveWindowAndFocusToDesktop8', 'Move Window and Focus to Desktop 8', defaultShortcuts[7], function() { moveToDesktopAndActivate(8);});
registerShortcut('MoveWindowAndFocusToDesktop9', 'Move Window and Focus to Desktop 9', defaultShortcuts[8], function() { moveToDesktopAndActivate(9);});
registerShortcut('MoveWindowAndFocusToDesktop10', 'Move Window and Focus to Desktop 10', defaultShortcuts[9], function() { moveToDesktopAndActivate(10);});
function moveToDesktopAndActivate(targetDesktopNr) {
var client = workspace.activeClient;
if (client.moveable) {
client.desktop = targetDesktopNr;
workspace.activeClient = client;
}
}
[Desktop Entry]
Name=Move Window and Focus to Desktop
Comment=Moves window and focus to a desktop.
Icon=preferences-system-windows-script-test
X-Plasma-API=javascript
X-Plasma-MainScript=code/main.js
X-KDE-PluginInfo-Author=Night Reveller
X-KDE-PluginInfo-Email=nightreveller@protonmail.com
X-KDE-PluginInfo-Name=movewindowandfocustodesktop
X-KDE-PluginInfo-Version=0.1.0
X-KDE-PluginInfo-EnabledByDefault=false
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-ServiceTypes=KWin/Script
Type=Service
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment