Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
added new option for keeping tiled windows below and changed some def…
Browse files Browse the repository at this point in the history
…aults
  • Loading branch information
zeroxoneafour committed Mar 24, 2023
1 parent 76afe08 commit c180725
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = autotile
VERSION = 1.0.1
VERSION = 1.1.0

PKGFILE = $(NAME).kwinscript
PKGDIR = pkg
Expand Down
Binary file modified autotile.kwinscript
Binary file not shown.
39 changes: 31 additions & 8 deletions res/config.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>335</width>
<height>154</height>
<height>182</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -19,10 +19,20 @@
<x>10</x>
<y>10</y>
<width>311</width>
<height>130</height>
<height>161</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Changes apply only after restarting KWin!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand All @@ -44,7 +54,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Blacklist, do not tile these windows (becomes whitelist if whitelist is checked)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>krunner,yakuake</string>
<string>krunner, yakuake, kded, polkit</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -104,20 +114,33 @@
<property name="text">
<string>Invert insertion</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_Debug">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Spams your user journal&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<widget class="QCheckBox" name="kcfg_KeepTiledBelow">
<property name="text">
<string>Debug Mode</string>
<string>Keep tiled below</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_Debug">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Spams your user journal&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Debug Mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down
5 changes: 3 additions & 2 deletions res/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<kcfgfile name=""/>
<group name="">
<entry name="UseWhitelist" type="bool"><default>false</default></entry>
<entry name="Blacklist" type="string"><default>krunner,yakuake</default></entry>
<entry name="Blacklist" type="string"><default>krunner, yakuake, kded, polkit</default></entry>
<entry name="TilePopups" type="bool"><default>false</default></entry>
<entry name="Debug" type="bool"><default>false</default></entry>
<entry name="Borders" type="int"><default>1</default></entry>
<entry name="InvertInsertion" type="bool"><default>false</default></entry>
<entry name="InvertInsertion" type="bool"><default>true</default></entry>
<entry name="KeepTiledBelow" type="bool"><default>true</default></entry>
</group>
</kcfg>
26 changes: 18 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let blacklist;
let tilePopups;
let borders;
let invertInsertion;
let keepTiledBelow
let blacklistCache;

function printDebug(str, isError) {
Expand All @@ -17,17 +18,19 @@ function printDebug(str, isError) {
let updateConfig = function() {
debug = readConfig("Debug", false);
useWhitelist = readConfig("UseWhitelist", false);
blacklist = readConfig("Blacklist", "krunner,yakuake").split(',').map(x => x.trim());
blacklist = readConfig("Blacklist", "krunner, yakuake, kded, polkit").split(',').map(x => x.trim());
tilePopups = readConfig("TilePopups", false);
borders = readConfig("Borders", 1);
invertInsertion = readConfig("InvertInsertion", false);
keepTiledBelow = readConfig("KeepTiledBelow", true);
blacklistCache = new Set();
printDebug("Config Updated", false)
printDebug("useWhitelist == " + useWhitelist, false);
printDebug("blacklist == " + blacklist, false);
printDebug("tilePopups == " + tilePopups, false);
printDebug("borders == " + borders, false);
printDebug("invertInsertion == " + invertInsertion, false);
printDebug("keepTiledBelow == " + keepTiledBelow, false);
}

updateConfig();
Expand Down Expand Up @@ -79,8 +82,10 @@ function setTile(client, tile) {
client.tile = tile;
client.oldTile = tile;
client.wasTiled = true;
client.keepBelow = true;
client.oldDesktop = client.desktop;
if (keepTiledBelow) {
client.keepBelow = true;
}
if (borders == 1 || borders == 2) {
client.noBorder = true;
}
Expand Down Expand Up @@ -169,7 +174,9 @@ function untileClient(client) {
client.oldDesktop = client.desktop;
client.wasTiled = false;
client.tile = null;
client.keepBelow = false;
if (keepTiledBelow) {
client.keepBelow = false;
}
if (borders == 1 || borders == 2) {
client.noBorder = false;
}
Expand Down Expand Up @@ -329,15 +336,18 @@ let clientUnminimized = function(client) {

// special stuff to untile fullscreen clients
let clientFullScreen = function(client, fullscreen, _user) {
if (fullscreen) {
client.keepBelow = false;
client.keepAbove = true;
} else {
if (!fullscreen && client.wasTiled) {
client.keepAbove = false;
if (client.wasTiled) {
if (keepTiledBelow) {
client.keepBelow = true;
}
}
if (fullscreen && client.wasTiled) {
if (keepTiledBelow) {
client.keepBelow = false;
}
client.keepAbove = true;
}
}

workspace.clientAdded.connect(addClient);
Expand Down

0 comments on commit c180725

Please sign in to comment.