add black/whitelist config to videowall

REVIEW: 125410
BUG: 353153
FIXED-IN: 5.5
This commit is contained in:
Thomas Lübking 2015-09-26 17:42:34 +02:00
parent d61e6cd445
commit 121d59ee28
4 changed files with 194 additions and 18 deletions

View file

@ -17,27 +17,28 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
var applyTo = readConfig("ApplyTo", true);
var whitelist = readConfig("Whitelist", "vlc, xv, vdpau, smplayer, dragon, xine, ffplay, mplayer").toString().toLowerCase().split(",");
for (i = 0; i < whitelist.length; ++i)
whitelist[i] = whitelist[i].trim();
var ignore = readConfig("Ignore", false);
var blacklist = readConfig("Blacklist", "").toString().toLowerCase().split(",");
for (i = 0; i < blacklist.length; ++i)
blacklist[i] = blacklist[i].trim();
function isVideoPlayer(client) {
if (client.resourceName == "vlc") {
return true;
}
if (client.resourceName == "smplayer") {
return true;
}
if (client.resourceName == "dragon") {
return true;
}
if (client.resourceName == "xv") { //mplayer
return true;
}
if (client.resourceName == "ffplay") {
return true;
}
return false;
if (applyTo == true && whitelist.indexOf(client.resourceClass.toString()) < 0)
return false; // required whitelist match failed
if (ignore == true && blacklist.indexOf(client.resourceClass.toString()) > -1)
return false; // required blacklist match hit
return true;
}
var videowall = function(client, set) {
if (isVideoPlayer(client) && set) {
if (set && isVideoPlayer(client)) {
client.geometry = workspace.clientArea(KWin.FullArea, 0, 1);
}
};

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="">
<entry name="ApplyTo" type="bool">
<default>true</default>
</entry>
<entry name="Whitelist" type="string">
<default>vlc, xv, vdpau, smplayer, dragon, xine, ffplay, mplayer</default>
</entry>
<entry name="Ignore" type="bool">
<default>false</default>
</entry>
<entry name="Blacklist" type="string">
<default></default>
</entry>
</group>
</kcfg>

View file

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KWin::VideoWallConfigForm</class>
<widget class="QWidget" name="KWin::VideoWallConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>59</height>
</rect>
</property>
<property name="windowTitle">
<string>Video Wall</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="kcfg_ApplyTo">
<property name="text">
<string>Apply to</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="kcfg_Whitelist">
<property name="text">
<string>vlc, xv, vdpau, smplayer, dragon, xine, ffplay</string>
</property>
<property name="placeholderText">
<string>Comma separated list of window classes</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="applyLabel">
<property name="visible">
<bool>false</bool>
</property>
<property name="text">
<string>All</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="kcfg_Ignore">
<property name="text">
<string>Ignore</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="kcfg_Blacklist">
<property name="visible">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>Comma separated list of window classes</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ignoreLabel">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>kcfg_ApplyTo</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_Whitelist</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>41</x>
<y>9</y>
</hint>
<hint type="destinationlabel">
<x>143</x>
<y>13</y>
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_ApplyTo</sender>
<signal>toggled(bool)</signal>
<receiver>applyLabel</receiver>
<slot>setHidden(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>28</x>
<y>15</y>
</hint>
<hint type="destinationlabel">
<x>330</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_Ignore</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_Blacklist</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>33</x>
<y>44</y>
</hint>
<hint type="destinationlabel">
<x>111</x>
<y>45</y>
</hint>
</hints>
</connection>
<connection>
<sender>kcfg_Ignore</sender>
<signal>toggled(bool)</signal>
<receiver>ignoreLabel</receiver>
<slot>setHidden(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>51</x>
<y>33</y>
</hint>
<hint type="destinationlabel">
<x>327</x>
<y>42</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -101,5 +101,10 @@ X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-ServiceTypes=KWin/Script
X-KDE-ServiceTypes=KWin/Script,KCModule
X-KDE-Library=kwin/effects/configs/kcm_kwin4_genericscripted
X-KDE-PluginKeyword=videowall
X-KDE-ParentComponents=videowall
Type=Service