diff options
author | Peter Cai | 2019-01-29 17:29:20 +0800 |
---|---|---|
committer | Peter Cai | 2019-01-29 17:29:20 +0800 |
commit | d2315d3b418e7d7cc3fc4a56120e6cdb1e0005e7 (patch) | |
tree | 26cca0e589e3ceb926b0503e549e54743635a223 | |
download | aur-d2315d3b418e7d7cc3fc4a56120e6cdb1e0005e7.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | PKGBUILD | 43 | ||||
-rw-r--r-- | kwin-aurorae-optional-titlebar.patch | 100 | ||||
-rw-r--r-- | kwin-aurorae-optional-titlebar.sh | 1 |
5 files changed, 166 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2e44c8e75f26 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = kwin-aurorae-optional-titlebar + pkgdesc = A hacked version of the KWin theme engine Aurorae that allows skipping title bars for a user-defined set of applications + pkgver = 5.14.5_1 + pkgrel = 1 + url = https://git.angry.im/PeterCxy/kwin-aurorae-optional-titlebar + arch = x86_64 + license = LGPL + makedepends = extra-cmake-modules + makedepends = qt5-tools + depends = kwin>=5.14.5 + source = https://download.kde.org/stable/plasma/5.14.5/kwin-5.14.5.tar.xz + source = kwin-aurorae-optional-titlebar.patch + source = kwin-aurorae-optional-titlebar.sh + md5sums = 996d3477d0016e999d6d517ec072e983 + md5sums = b314f47c73308e1440344288a75f7c93 + md5sums = 854459e61a223321d674299a97ec082e + +pkgname = kwin-aurorae-optional-titlebar + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..17f05b8bc9fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.xz +pkg +src diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..7054782039db --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: Peter Cai <peter@typeblog.net> + +_pkgname=kwin +_pkgver=5.14.5 +pkgname=kwin-aurorae-optional-titlebar +pkgver=${_pkgver}_1 +pkgrel=1 +pkgdesc='A hacked version of the KWin theme engine Aurorae that allows skipping title bars for a user-defined set of applications' +arch=(x86_64) +url='https://git.angry.im/PeterCxy/kwin-aurorae-optional-titlebar' +license=(LGPL) +depends=("kwin>=$_pkgver") +makedepends=(extra-cmake-modules qt5-tools) +source=( + "https://download.kde.org/stable/plasma/$_pkgver/$_pkgname-$_pkgver.tar.xz" + "kwin-aurorae-optional-titlebar.patch" + "kwin-aurorae-optional-titlebar.sh" +) +md5sums=('996d3477d0016e999d6d517ec072e983' + 'b314f47c73308e1440344288a75f7c93' + '854459e61a223321d674299a97ec082e') + +prepare() { + mkdir -p build + cd $_pkgname-$_pkgver + patch -p1 < ../kwin-aurorae-optional-titlebar.patch +} + +build() { + cd build + cmake ../$_pkgname-$_pkgver + make kwin5_aurorae +} + +package() { + dstdir=$pkgdir/usr/lib/kwin-aurorae-optional-titlebar/org.kde.kdecoration2 + mkdir -p $dstdir + cp build/bin/org.kde.kdecoration2/kwin5_aurorae.so $dstdir + profdir=$pkgdir/etc/profile.d + mkdir -p $profdir + cp kwin-aurorae-optional-titlebar.sh $profdir +} + diff --git a/kwin-aurorae-optional-titlebar.patch b/kwin-aurorae-optional-titlebar.patch new file mode 100644 index 000000000000..a8b6c2127027 --- /dev/null +++ b/kwin-aurorae-optional-titlebar.patch @@ -0,0 +1,100 @@ +diff --git a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp +index ba8554fe5..889b4120a 100644 +--- a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp ++++ b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp +@@ -24,9 +24,14 @@ + #include <QDebug> + #include <QHash> + #include <QStandardPaths> ++#include <QDir> ++#include <QFile> + // KDE + #include <KConfig> + #include <KConfigGroup> ++#include <KDecoration2/Decoration> ++#include <KDecoration2/DecoratedClient> ++#include <KWindowInfo> + + Q_LOGGING_CATEGORY(AURORAE, "aurorae", QtCriticalMsg) + +@@ -87,6 +92,24 @@ AuroraeTheme::AuroraeTheme(QObject* parent) + { + connect(this, SIGNAL(themeChanged()), SIGNAL(borderSizesChanged())); + connect(this, SIGNAL(buttonSizesChanged()), SIGNAL(borderSizesChanged())); ++ ++ // HACK: Hide title bar for windows whose classes are specified in ~/.aurorae_notitle ++ QFile hideTitleConf(QDir::homePath() + "/.aurorae_notitle"); ++ if (hideTitleConf.open(QFile::ReadOnly | QFile::Text)) { ++ QString classes = "\n" + QTextStream(&hideTitleConf).readAll() + "\n"; ++ KDecoration2::Decoration* decoration = (KDecoration2::Decoration*) parent; ++ auto client = decoration->client().data(); ++ KWindowInfo info(client->windowId(), nullptr, NET::WM2WindowClass); ++ QString window_className(QString::fromUtf8(info.windowClassName())); ++ QString window_classClass(QString::fromUtf8(info.windowClassClass())); ++ ++ if ((!window_className.isEmpty() ++ && classes.contains("\n" + window_className + "\n")) ++ || (!window_classClass.isEmpty() ++ && classes.contains("\n" + window_classClass + "\n"))) { ++ this->hideTitleBar = true; ++ } ++ } + } + + AuroraeTheme::~AuroraeTheme() +@@ -185,7 +208,7 @@ void AuroraeTheme::borders(int& left, int& top, int& right, int& bottom, bool ma + d->themeConfig.buttonHeight()*buttonSizeFactor() + + d->themeConfig.buttonMarginTop()); + if (maximized) { +- const qreal title = titleHeight + d->themeConfig.titleEdgeTopMaximized() + d->themeConfig.titleEdgeBottomMaximized(); ++ const qreal title = hideTitleBar ? 0 : (titleHeight + d->themeConfig.titleEdgeTopMaximized() + d->themeConfig.titleEdgeBottomMaximized()); + switch ((DecorationPosition)d->themeConfig.decorationPosition()) { + case DecorationTop: + left = right = bottom = 0; +@@ -240,29 +263,29 @@ void AuroraeTheme::borders(int& left, int& top, int& right, int& bottom, bool ma + default: + left = right = bottom = top = 0; + } +- const qreal title = titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom(); ++ const qreal title = hideTitleBar ? 0 : (titleHeight + d->themeConfig.titleEdgeTop() + d->themeConfig.titleEdgeBottom()); + switch ((DecorationPosition)d->themeConfig.decorationPosition()) { + case DecorationTop: + left += d->themeConfig.borderLeft(); + right += d->themeConfig.borderRight(); + bottom += d->themeConfig.borderBottom(); +- top = title; ++ top = title == 0 ? d->themeConfig.borderBottom() : title; + break; + case DecorationBottom: + left += d->themeConfig.borderLeft(); + right += d->themeConfig.borderRight(); +- bottom = title; ++ bottom = title == 0 ? d->themeConfig.borderTop() : title; + top += d->themeConfig.borderTop(); + break; + case DecorationLeft: +- left = title; ++ left = title == 0 ? d->themeConfig.borderRight() : title; + right += d->themeConfig.borderRight(); + bottom += d->themeConfig.borderBottom(); + top += d->themeConfig.borderTop(); + break; + case DecorationRight: + left += d->themeConfig.borderLeft(); +- right = title; ++ right = title == 0 ? d->themeConfig.borderLeft() : title; + bottom += d->themeConfig.borderBottom(); + top += d->themeConfig.borderTop(); + break; +diff --git a/plugins/kdecorations/aurorae/src/lib/auroraetheme.h b/plugins/kdecorations/aurorae/src/lib/auroraetheme.h +index f3f7b9943..cb46754e1 100644 +--- a/plugins/kdecorations/aurorae/src/lib/auroraetheme.h ++++ b/plugins/kdecorations/aurorae/src/lib/auroraetheme.h +@@ -222,6 +222,7 @@ private: + void padding(int &left, int &top, int &right, int &bottom) const; + + AuroraeThemePrivate* const d; ++ bool hideTitleBar = false; + }; + + } // namespace diff --git a/kwin-aurorae-optional-titlebar.sh b/kwin-aurorae-optional-titlebar.sh new file mode 100644 index 000000000000..405ec862d4a2 --- /dev/null +++ b/kwin-aurorae-optional-titlebar.sh @@ -0,0 +1 @@ +export QT_PLUGIN_PATH=/usr/lib/kwin-aurorae-optional-titlebar:/usr/lib/qt/plugins:$QT_PLUGIN_PATH |