Skip to content

Commit 0b26e5d

Browse files
committed
release always-open-on-active-screen v2.4
1 parent 0683bee commit 0b26e5d

File tree

13 files changed

+121
-24
lines changed

13 files changed

+121
-24
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[h2]v2.4[/h2]
2+
[list]
3+
[*] make script automatically enabled after install
4+
[*] update package structure
5+
[*] add install/uninstall scripts
6+
[*] add changelog in BB Code format
7+
[/list]
8+
9+
[h2]v2.3[/h2]
10+
[list]
11+
[*] fix incorrect geometry computation
12+
[/list]
13+
14+
[h2]v2.2[/h2]
15+
[list]
16+
[*] ensure adjusting window to screen dimensions is possible
17+
[/list]
18+
19+
[h2]v2.1[/h2]
20+
[list]
21+
[*] fix an error with fit window on screen
22+
[*] add Dutch and German translations of metadata
23+
24+
[h1]v2.0[/h1]
25+
[list]
26+
[*] adjust window dimensions to fit on screen (credits to @joedefen)
27+
[/list]
28+
29+
[h1]v1.0[/h1]
30+
[list]
31+
[*] initial release
32+
[/list]

always-open-on-active-screen/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v2.4
2+
- make script automatically enabled after install
3+
- update package structure
4+
- add install/uninstall scripts
5+
- add changelog in BB Code format
6+
17
## v2.3
28

39
- fix incorrect geometry computation
@@ -18,4 +24,3 @@
1824
# v1.0
1925

2026
- initial release
21-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- make script automatically enabled after install
2+
- update package structure
3+
- add install/uninstall scripts
4+
- add changelog in BB Code format

always-open-on-active-screen/README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,37 @@ Extension for KDE’s window manager to make new windows always open on the moni
1111

1212
### Dependencies
1313

14-
`kwin` (tested with v5.22 - v5.23 on X11).
14+
`kwin` (tested with v5.22 - v5.24 on X11).
1515

16-
### Method 1: via graphical interface
16+
### Installation via graphical interface
1717

18-
1. Install the script via *System Settings* > *Window Management* > *KWin Scripts* > *Get New Scripts …* > search for *Always Open on Active Screen* > *Install*.
19-
2. Activate the script by selecting the checkbox in the respective entry.
18+
*System Settings* > *Window Management* > *KWin Scripts* > *Get New Scripts …* > search for *Always Open on Active Screen* > *Install*.
2019

21-
### Method 2: via command line
20+
### Installation via command line
2221

2322
```bash
2423
git clone https://github.com/nclarius/KWin-window-positioning-scripts.git
25-
plasmapkg2 --type kwinscript -i KWin-window-positioning-scripts/always-open-on-active-screen
26-
kwriteconfig5 --file kwinrc --group Plugins --key alwaysopenonactivescreenEnabled true
27-
qdbus org.kde.KWin /KWin reconfigure
24+
cd KWin-window-positioning-scripts/always-open-on-active-screen
25+
./install.sh
2826
```
2927

3028

3129

3230
## Set-up
3331

34-
- In order for the script to work, you need to have *Active screen follows mouse* set to enabled:
35-
- Via graphical interface:
36-
*System Settings* > *Window Management* > *Window Behavior* > *Focus* > *Multiscreen Behavor* > *Active screen follows mouse* (the option shows only when multiple monitors are currently connected).
37-
- Or by editing the config file:
38-
`~/.config/kwinrc`:
39-
```
40-
[Windows]
41-
ActiveMouseScreen=true
42-
```
32+
In order for the script to work, you need to have *Active screen follows mouse* set to enabled.
33+
34+
### Set-up via graphical interface
35+
36+
*System Settings* > *Window Management* > *Window Behavior* > *Focus* > *Multiscreen Behavor* > *Active screen follows mouse* (the option shows only when multiple monitors are currently connected).
37+
38+
### Set-up via command line
39+
40+
```bash
41+
kwriteconfig5 --file kwinrc --group Windows --key ActiveMouseScreen true
42+
ActiveMouseScreen=true
43+
qdbus org.kde.KWin /KWin reconfigure
44+
```
4345

4446

4547

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
kpackagetool5 --type=KWin/Script --install package || kpackagetool5 --type=KWin/Script --upgrade package
3+
qdbus org.kde.KWin /KWin reconfigure
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#/bin/bash
2+
3+
# get plugin info
4+
name=$(basename "$PWD")
5+
version=$(grep -oP '(?<=X-KDE-PluginInfo-Version=).*' package/metadata.desktop)
6+
echo "$name v$version"
7+
8+
# generate changelog in markdown format
9+
heading_md=$([[ $version == *.0 ]] && echo "#" || echo "##")
10+
caption_md="${heading_md} v${version}"
11+
changes_md=$(cat CHANGELOG.txt)
12+
echo "$caption_md"$'\n'"$changes_md"$'\n\n'"$(cat CHANGELOG.md)" > "CHANGELOG.md"
13+
echo "generated changelog markdown"
14+
15+
# generate changelog in bbcode format
16+
heading_bb=$([[ $version == *.0 ]] && echo "h1" || echo "h2")
17+
caption_bb="[$heading_bb]v$version[/$heading_bb]"
18+
changes_bb=$'[list]\n'"$(cat CHANGELOG.txt | sed "s/- /[*] /g")"$'\n[/list]'
19+
echo "$caption_bb"$'\n'"$changes_bb"$'\n\n'"$(cat CHANGELOG.bbcode)" > "CHANGELOG.bbcode"
20+
echo "generated changelog bbcode"
21+
22+
# generate GitHub release
23+
gh release create "${name}_v${version}" -F CHANGELOG.txt
24+
echo "generated GitHub release"
25+
26+
# generate KDE store release
27+
find . -name "*.kwinscript" -type f -delete
28+
zip -rq "${name}_v${version}.kwinscript" \
29+
package \
30+
install.sh \
31+
uninstall.sh \
32+
README.md \
33+
README.bbcode \
34+
CHANGELOG.md \
35+
CHANGELOG.bbcode \
36+
LICENSE
37+
echo "generated KDE Store release"
38+
39+
# commit changes to GitHub
40+
git add *
41+
git commit -q -m "release $name v$version"
42+
git push -q
43+
echo "commited changes to git"
44+
45+
echo "done"

always-open-on-active-screen/contents/code/main.js renamed to always-open-on-active-screen/package/contents/code/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ GNU General Public License v3.0
66

77
// when a client is added
88
workspace.clientAdded.connect(function(client) {
9+
activeScreen = workspace.activeScreen;
910
// move client to active screen
1011
if (client == null || client.desktopWindow || client.dock) return;
11-
workspace.sendClientToScreen(client, workspace.activeScreen);
12+
if (client.screen == activeScreen) return;
13+
console.debug("sending client", client.caption, "to active screen", activeScreen);
14+
workspace.sendClientToScreen(client, activeScreen);
1215

1316
// clip and move client into bounds of screen dimensions
14-
if (! (client.moveable && client.resizeable)) return;
17+
if (!(client.moveable && client.resizeable)) return;
1518
area = workspace.clientArea(KWin.MaximizeArea, client);
1619
// window width/height maximally screen width/height
1720
client.geometry.width = Math.min(client.width, area.width);

always-open-on-active-screen/metadata.desktop renamed to always-open-on-active-screen/package/metadata.desktop

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ Comment[nl]=Opent nieuwe vensters altijd op het scherm met de cursor]
1212
Icon=preferences-system-windows
1313

1414
X-KDE-PluginInfo-Name=alwaysopenonactivescreen
15-
X-KDE-PluginInfo-Version=2.3
15+
X-KDE-PluginInfo-Version=2.4
1616
X-KDE-PluginInfo-Author=Natalie Clarius
1717
X-KDE-PluginInfo-Email[email protected]
1818
X-KDE-PluginInfo-License=GPL v3.0
1919
X-KDE-PluginInfo-Website=https://store.kde.org/p/1617640/
2020

2121
Type=Service
22-
X-KDE-ServiceTypes=KWin/Script,KCModule
2322
X-Plasma-API=javascript
2423
X-Plasma-MainScript=code/main.js
25-
26-
X-KDE-Library=kwin/effects/configs/kcm_kwin4_genericscripted
24+
X-KDE-ServiceTypes=KWin/Script,KCModule
25+
X-KDE-ConfigModule=kwin/effects/configs/kcm_kwin4_genericscripted
2726
X-KDE-PluginKeyword=alwaysopenonactivescreen
2827
X-KDE-ParentComponents=alwaysopenonactivescreen
28+
X-KDE-PluginInfo-EnabledByDefault=true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
kpackagetool5 --type=KWin/Script --remove package
3+
qdbus org.kde.KWin /KWin reconfigure

0 commit comments

Comments
 (0)