Change color of wayland decoration according to theme

This commit is contained in:
Ilya Fedin 2020-04-25 08:43:19 +04:00 committed by John Preston
parent 46d4b03d49
commit 161e51757c
7 changed files with 111 additions and 11 deletions

View File

@ -471,6 +471,18 @@ jobs:
cd $LibrariesPath
sudo cp -R qt-cache/. /
- name: Material Decoration.
run: |
cd $LibrariesPath
git clone --depth=1 $GIT/desktop-app/materialdecoration.git
cd materialdecoration
$QT_PREFIX/bin/qmake CONFIG+=static
make -j$(nproc)
sudo make install
cd ..
rm -rf materialdecoration
- name: Breakpad cache.
id: cache-breakpad
uses: actions/cache@v1

View File

@ -456,6 +456,11 @@ void MainWindow::initHook() {
LOG(("Not using Unity launcher counter."));
}
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
style::PaletteChanged(
) | rpl::start_with_next([=] {
updateWaylandDecorationColors();
}, lifetime());
}
bool MainWindow::hasTrayIcon() const {
@ -676,6 +681,13 @@ void MainWindow::updateIconCounters() {
}
}
void MainWindow::updateWaylandDecorationColors() {
windowHandle()->setProperty("__material_decoration_backgroundColor", st::titleBgActive->c);
windowHandle()->setProperty("__material_decoration_foregroundColor", st::titleFgActive->c);
windowHandle()->setProperty("__material_decoration_backgroundInactiveColor", st::titleBg->c);
windowHandle()->setProperty("__material_decoration_foregroundInactiveColor", st::titleFg->c);
}
void MainWindow::LibsLoaded() {
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
qDBusRegisterMetaType<ToolTip>();

View File

@ -94,6 +94,7 @@ private:
Ui::PopupMenu *_trayIconMenuXEmbed = nullptr;
void updateIconCounters();
void updateWaylandDecorationColors();
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
StatusNotifierItem *_sniTrayIcon = nullptr;

View File

@ -634,7 +634,14 @@ void start() {
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());
if(IsStaticBinary()
if(IsStaticBinary()
|| InAppImage()
|| InSandbox()
|| InSnap()) {
qputenv("QT_WAYLAND_DECORATION", "material");
}
if(IsStaticBinary()
|| InAppImage()
|| InSnap()
|| IsGtkFileDialogForced()) {

View File

@ -30,6 +30,7 @@ Q_IMPORT_PLUGIN(QWaylandXdgShellV5IntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandXdgShellV6IntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin)
Q_IMPORT_PLUGIN(QWaylandMaterialDecorationPlugin)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin)
Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin)

View File

@ -275,6 +275,13 @@ Go to ***BuildPath*** and run
sudo make install
cd ..
git clone --depth=1 https://github.com/desktop-app/materialdecoration.git
cd materialdecoration
/usr/local/desktop-app/Qt-5.12.8/bin/qmake CONFIG+=static
make $MAKE_THREADS_CNT
sudo make install
cd ..
git clone https://chromium.googlesource.com/external/gyp
cd gyp
git checkout 9f2a7bb1

View File

@ -141,7 +141,13 @@ parts:
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
cat << EOF > "$SNAPCRAFT_STAGE/qt.conf"
install -d "$SNAPCRAFT_PART_INSTALL/usr/include/$SNAPCRAFT_ARCH_TRIPLET"
cp -a $KF5_DIR/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5 "$SNAPCRAFT_PART_INSTALL/usr/include/$SNAPCRAFT_ARCH_TRIPLET"
install -d "$SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET"
cp -a $KF5_DIR/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5 "$SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET"
cat << EOF > "$SNAPCRAFT_PART_INSTALL/qt.conf"
[Paths]
Prefix=$KF5_DIR/usr
ArchData=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5
@ -149,9 +155,9 @@ parts:
Data=share/qt5
Documentation=share/qt5/doc
Examples=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/examples
Headers=include/$SNAPCRAFT_ARCH_TRIPLET/qt5
Headers=$SNAPCRAFT_STAGE/usr/include/$SNAPCRAFT_ARCH_TRIPLET/qt5
HostBinaries=lib/qt5/bin
HostData=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5
HostData=$SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5
HostLibraries=lib/$SNAPCRAFT_ARCH_TRIPLET
Imports=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/imports
Libraries=lib/$SNAPCRAFT_ARCH_TRIPLET
@ -161,6 +167,10 @@ parts:
Settings=/etc/xdg
Translations=share/qt5/translations
EOF
stage:
- -usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqwayland*
- -usr/lib/x86_64-linux-gnu/qt5/plugins/wayland*
- -usr/lib/x86_64-linux-gnu/qt5/qml/QtWayland
prime: [-./*]
cmake:
@ -195,7 +205,7 @@ parts:
override-build: |
./autogen.sh
./configure --prefix=
make
make -j$(nproc)
install -d "$SNAPCRAFT_PART_INSTALL/bin"
install nasm "$SNAPCRAFT_PART_INSTALL/bin/nasm"
install ndisasm "$SNAPCRAFT_PART_INSTALL/bin/ndisasm"
@ -379,6 +389,28 @@ parts:
- -./lib/cmake
- -./lib/pkgconfig
materialdecoration:
source: https://github.com/desktop-app/materialdecoration.git
source-depth: 1
plugin: dump
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make -j$(nproc)
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL"
rm -r "$SNAPCRAFT_PART_INSTALL/tmp"
after:
- qtconf
- qtwayland
openal:
source: https://github.com/kcat/openal-soft.git
source-depth: 1
@ -434,10 +466,14 @@ parts:
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make sub-theme-all
install -D "$SNAPCRAFT_PART_BUILD/theme/libqgnomeplatform.so" "$SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platformthemes/libqgnomeplatform.so"
make -j$(nproc)
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL"
rm -r "$SNAPCRAFT_PART_INSTALL/tmp"
after:
- qtconf
- qtwayland
qtimageformats:
source: https://github.com/qt/qtimageformats.git
@ -453,14 +489,38 @@ parts:
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL" install
make -j$(nproc)
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install
mv "$SNAPCRAFT_PART_INSTALL/$KF5_DIR/usr" "$SNAPCRAFT_PART_INSTALL/usr"
rmdir "$SNAPCRAFT_PART_INSTALL/$KF5_DIR"
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL"
rm -r "$SNAPCRAFT_PART_INSTALL/tmp"
after:
- qtconf
qtwayland:
source: https://github.com/qt/qtwayland.git
source-depth: 1
source-tag: v5.12.3
plugin: dump
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make -j$(nproc)
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL/tmp" install
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$KF5_DIR/." "$SNAPCRAFT_PART_INSTALL"
cp -a "$SNAPCRAFT_PART_INSTALL/tmp/$SNAPCRAFT_STAGE/." "$SNAPCRAFT_PART_INSTALL"
rm -r "$SNAPCRAFT_PART_INSTALL/tmp"
after:
- qtconf
prime: [-./*]
xxhash:
source: https://github.com/Cyan4973/xxHash.git
source-depth: 1