mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-09-19 20:37:34 +03:00
ignore/float windows by matching title string
* dumb substring match on window title * implements user suggested feature (#23)
This commit is contained in:
parent
7282e32073
commit
1129b6a6e6
@ -253,7 +253,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="ignoreLabel">
|
||||
<property name="text">
|
||||
<string>Ignore (Window Class)</string>
|
||||
<string>Ignore Windows</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
@ -261,17 +261,93 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="kcfg_ignoreClass"/>
|
||||
<layout class="QGridLayout" name="ignoreLayout">
|
||||
<property name="leftMargin">
|
||||
<number>40</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="kcfg_ignoreClass">
|
||||
<property name="statusTip">
|
||||
<string>Comma-separated list of window classes to be ignored by Krohnkite</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Comma-separated list of window classes to be ignored by Krohnkite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ignoreClassLabel">
|
||||
<property name="text">
|
||||
<string>Class</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="ignoreTitleLabel">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="kcfg_ignoreTitle">
|
||||
<property name="whatsThis">
|
||||
<string>Comma-separated list of title text to be ignored by Krohnkite</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Comma-separated list of title text to be ignored by Krohnkite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="floatingLabel">
|
||||
<property name="text">
|
||||
<string>Set Float (Window Class)</string>
|
||||
<string>Float Windows</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="kcfg_floatingClass"/>
|
||||
<layout class="QGridLayout" name="floatLayout">
|
||||
<property name="leftMargin">
|
||||
<number>40</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="kcfg_floatingClass">
|
||||
<property name="whatsThis">
|
||||
<string>Comma-separated list of window classes which will be floated automatically by Krohnkite</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Comma-separated list of window classes which will be floated automatically by Krohnkite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="floatingClassLabel">
|
||||
<property name="text">
|
||||
<string>Class</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="floatingTitleLabel">
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="kcfg_floatingTitle">
|
||||
<property name="accessibleName">
|
||||
<string>Comma-separated list of title text which will be floated automatically by Krohnkite</string>
|
||||
</property>
|
||||
<property name="accessibleDescription">
|
||||
<string>Comma-separated list of title text which will be floated automatically by Krohnkite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_floatUtility">
|
||||
|
@ -41,11 +41,21 @@
|
||||
<default>krunner,yakuake,spectacle,kded5</default>
|
||||
</entry>
|
||||
|
||||
<entry name="ignoreTitle" type="String">
|
||||
<label>Ignore windows with certain string in title(comma-separated list)</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
|
||||
<entry name="floatingClass" type="String">
|
||||
<label>Float windows with certain classes(comma-separated list)</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
|
||||
<entry name="floatingTitle" type="String">
|
||||
<label>Float windows with certain string in title(comma-separated list)</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
|
||||
<entry name="floatUtility" type="Bool">
|
||||
<label>Automatically float utility windows (Dialog, Splash, Utility)</label>
|
||||
<default>true</default>
|
||||
|
@ -111,3 +111,11 @@ function slide(value: number, step: number): number {
|
||||
return value;
|
||||
return Math.floor(value / step + 1.000001) * step;
|
||||
}
|
||||
|
||||
function matchWords(str: string, words: string[]): number {
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
if (str.indexOf(words[i]) >= 0)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ class Config {
|
||||
public static tileLayoutGap: number;
|
||||
|
||||
public static floatingClass: string[];
|
||||
public static floatingTitle: string[];
|
||||
public static ignoreClass: string[];
|
||||
public static ignoreTitle: string[];
|
||||
|
||||
public static load() {
|
||||
function commanSeparate(str: string): string[] {
|
||||
@ -73,9 +75,13 @@ class Config {
|
||||
load("tileLayoutGap", 0);
|
||||
|
||||
Config.floatingClass = commanSeparate(KWin.readConfig("floatingClass", ""));
|
||||
Config.floatingTitle = commanSeparate(KWin.readConfig("floatingTitle", ""));
|
||||
Config.ignoreTitle = commanSeparate(KWin.readConfig("ignoreTitle", ""));
|
||||
Config.ignoreClass = commanSeparate(KWin.readConfig("ignoreClass",
|
||||
"krunner,yakuake,spectacle,kded5"));
|
||||
debug(() => "floatingClass: " + Config.floatingClass);
|
||||
debug(() => "floatingTitle: " + Config.floatingTitle);
|
||||
debug(() => "ignoreClass: " + Config.ignoreClass);
|
||||
debug(() => "ignoreTitle: " + Config.ignoreTitle);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,10 @@ class TilingEngine {
|
||||
return;
|
||||
|
||||
const className = tile.class;
|
||||
const ignore = (Config.ignoreClass.indexOf(className) >= 0);
|
||||
const ignore = (
|
||||
(Config.ignoreClass.indexOf(className) >= 0)
|
||||
|| (matchWords(tile.title, Config.ignoreTitle) >= 0)
|
||||
);
|
||||
if (ignore) return;
|
||||
|
||||
tile.managed = true;
|
||||
@ -115,6 +118,7 @@ class TilingEngine {
|
||||
(Config.floatingClass.indexOf(className) >= 0)
|
||||
|| (Config.floatUtility && tile.utility)
|
||||
|| tile.modal
|
||||
|| (matchWords(tile.title, Config.floatingTitle) >= 0)
|
||||
);
|
||||
if (floating)
|
||||
tile.float = true;
|
||||
|
@ -52,6 +52,7 @@ class Tile {
|
||||
public get class(): string { return String(this.client.resourceClass); }
|
||||
public get fullScreen(): boolean { return this.client.fullScreen; }
|
||||
public get modal(): boolean { return this.client.modal; }
|
||||
public get title(): string { return String(this.client.caption); }
|
||||
|
||||
public get special(): boolean {
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user