Active Window Position

Kwin Scripts kwin tiling

Source i (link to git-repo or to original if based on someone elses unmodified work):

https://github.com/GuannanHu/Active-Win-Position

Original
0
Become a Fan
5.0

Description:
# Move active window to a specified position

This is a Kwin script template to move the active window to a specified position with a keyboard shortcut.
KDE's default tilting function moves windows inside its current monitor but not the main monitor if you have more than one.
This script fixes the problem.


## Installation
Download the released package then run in terminal

```
kpackagetool5 --type=KWin/Script -i yourfoldname/releasedPackage.zip

```

Or simply extract it to a single folder and copy the folder to
```
~/.local/share/kwin/scripts/
```

## Usage
If you have a 4k in the middle horizontally and a 2k on each side vertically, Using the script as it is will move the active window as below:

```
"AWP Move Window to main Center", "Alt+Shift+S"
"AWP Move Window to main Bottom Left", "Alt+Shift+A"
"AWP Move Window to main Bottom Right", "Alt+Shift+D"
"AWP Move Window to Top Leftmost", "Alt+Shift+Q"
"AWP Move Window to Bottom Leftmost", "Alt+Shift+Z",
"AWP Move Window to Top Rightmost ", "Alt+Shift+E"
"AWP Move Window to Bottom Rightmost ", "Alt+Shift+C",
"AWP Move Window to main Top Left", ""
"AWP Move Window to main Top Right", "",
```
The above can be customized in `main.js` or in `systemsettting:shortcut:kwin`.

## Customize your monitor setup
If you have different monitor positions. Specify the left top coordinates in `main.js`
```
var MMTop_Left_x = 1440;
var MMTop_Left_y = 0; // coordinates of the left top point of the main monitor.
var MM_width = 4096;
var MM_height = 2160; // dimensions of the main monitor.

var LMTop_Left_x = 0;
var LMTop_Left_y = 0; // coordinates of the left top point of the Leftmost monitor.
var LM_height = 2560;
var LM_width = 1440; // dimensions of the Leftmost monitor.

var RMTop_Left_x = 5536;
var RMTop_Left_y = 0; // coordinates of the left top point of the Rightmost monitor.
var RM_height = 2560;
var RM_width = 1440; // dimensions of the Rightmost monitor.
```
## Customize the positions
You can change the position where the window will move to by changing the value of (x,y) in the following. The top left of your whole x11 screen is (0,0). If you move one pixel down vertically, you have (0,1).
```
client.geometry = {
x: MMTop_Left_x,
y: MMTop_Left_y + MM_height - client.height,
}
```
## Customize the size of the moved window.
Specify dimensions at `client.width` and `client.width` in `main.js`.

```
width: client.width,
height: client.height // the dimensions active window moves into

```
## Uninstall
To remove this script's keybinding entries from systemsettings:shortcut, find the lines containing `AWP` in
```
~/.config/kglobalshortcutsrc
```
Delete those lines and save `kglobalshortcutsrc`. Next time you login they are gone in systemsettings. Do not `kwin_x11 --replace`, which will restart kwin and restore the shortcuts from systemsettings to `kglobalshortcutsrc`.

Ratings & Comments

0 Comments

Be the first to comment
Pling
0 Affiliates
Details
license GPLv3
version 0.1
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

Other Kwin Scripts:

Snap To Deco
thomas12777
last update date: 11 years ago

Score 5.0

Unminimize windows w/o taskbar entry
thomas12777
last update date: 11 years ago

Score 5.0

MiniStack
faho
last update date: 11 years ago

Score 5.0

Debug Clients
thomas12777
last update date: 11 years ago

Score 5.0

TIL3R
causa-prima
last update date: 11 years ago

Score 5.7

Spam Transients
thomas12777
last update date: 10 years ago

Score 5.0



System Tags