From a59a8f45124744857f7bfe2f9dd7484e1969c02f Mon Sep 17 00:00:00 2001 From: Dolphin Oracle Date: Tue, 13 Aug 2024 21:35:31 -0400 Subject: [PATCH] add plasma discover tray utility autostart enable-disable --- defaultlook.cpp | 43 +++++++++++ defaultlook.h | 3 + defaultlook.ui | 141 +++++++++++++++++++----------------- translations/mx-tweak_en.ts | 94 +++++++++++++----------- 4 files changed, 170 insertions(+), 111 deletions(-) diff --git a/defaultlook.cpp b/defaultlook.cpp index a4284bf1..c9bc9e2a 100644 --- a/defaultlook.cpp +++ b/defaultlook.cpp @@ -1186,6 +1186,7 @@ void defaultlook::setuppanel() void defaultlook::setupPlasma() { + QString home_path = QDir::homePath(); //get panel ID plasmaPanelId = runCmd(QStringLiteral("grep --max-count 1 -B 8 panel $HOME/.config/plasma-org.kde.plasma.desktop-appletsrc |grep Containment")).output; QString panellocation = readPlasmaPanelConfig(QStringLiteral("location")); @@ -1206,6 +1207,18 @@ void defaultlook::setupPlasma() default: ui->comboPlasmaPanelLocation->setCurrentIndex(PanelIndex::Bottom); } + //setup plasma-discover autostart + if (QFile("/usr/lib/x86_64-linux-gnu/libexec/DiscoverNotifier").exists()){ + QString plasmadiscoverautostart = home_path + "/.config/autostart/org.kde.discover.notifier.desktop"; + if (runCmd("grep Hidden=true " + plasmadiscoverautostart).exitCode == 0 ){ + ui->checkBoxPlasmaDiscoverUpdater->setChecked(false); + } else { + ui->checkBoxPlasmaDiscoverUpdater->setChecked(true); + } + } else { + ui->checkBoxPlasmaDiscoverUpdater->hide(); + } + //setup singleclick QString singleclick = runCmd(QStringLiteral("kreadconfig5 --group KDE --key SingleClick")).output; ui->checkBoxPlasmaSingleClick->setChecked(singleclick != QLatin1String("false")); @@ -1228,6 +1241,7 @@ void defaultlook::setupPlasma() plasmasingleclickflag = false; plasmaresetflag = false; plasmasystrayiconsizeflag = false; + plasmadisoverautostartflag = false; } QString defaultlook::readTaskmanagerConfig(const QString &key) const @@ -3453,6 +3467,7 @@ void defaultlook::on_checkboxplasmaresetdock_clicked() void defaultlook::on_ButtonApplyPlasma_clicked() { + QString home_path = QDir::homePath(); if (plasmaresetflag) { plasmaplacementflag = false; plasmasingleclickflag = false; @@ -3492,6 +3507,26 @@ void defaultlook::on_ButtonApplyPlasma_clicked() writeTaskmanagerConfig(QStringLiteral("showOnlyCurrentDesktop"), value); } + //plasma-discover autostart + if (plasmadisoverautostartflag){ + QString plasmadiscoverautostart = home_path + "/.config/autostart/org.kde.discover.notifier.desktop"; + qDebug() << "discover autostart path is " << plasmadiscoverautostart; + if (ui->checkBoxPlasmaDiscoverUpdater->isChecked()){ + //delete any Hidden=true lines to make sure its processed by xdg autostart + runCmd("sed -i /Hidden=true/d " + plasmadiscoverautostart); + } else { + //copy if it doesn't exist already + if (!QFile(plasmadiscoverautostart).exists()){ + if (QFile("/etc/xdg/autostart/org.kde.discover.notifier.desktop").exists()){ + runCmd("cp /etc/xdg/autostart/org.kde.discover.notifier.desktop " + plasmadiscoverautostart); + } + } + //remove any previous Hidden= attribute, then add Hidden=true to make it not autostart + runCmd("sed -i /Hidden=*/d " + plasmadiscoverautostart); + runCmd("echo Hidden=true >> " + plasmadiscoverautostart); //this also creates file if the /etc/xdg version is missing + } + } + //time to reset kwin and plasmashell if (plasmaworkspacesflag || plasmasingleclickflag || plasmaplacementflag || plasmaresetflag || plasmasystrayiconsizeflag) { //restart kwin first @@ -3500,6 +3535,7 @@ void defaultlook::on_ButtonApplyPlasma_clicked() QString cmd =QStringLiteral("sleep 1; plasmashell --replace &"); system(cmd.toUtf8()); } + setupPlasma(); } @@ -4161,3 +4197,10 @@ void defaultlook::on_spinBoxPointerSize_valueChanged(int arg1) set_cursor_size(); } + +void defaultlook::on_checkBoxPlasmaDiscoverUpdater_clicked() +{ + plasmadisoverautostartflag = true; + ui->ButtonApplyPlasma->setEnabled(true); +} + diff --git a/defaultlook.h b/defaultlook.h index e52575c2..0770edc7 100644 --- a/defaultlook.h +++ b/defaultlook.h @@ -113,6 +113,7 @@ class defaultlook : public QDialog bool isKDE = false; bool liqKernelUpdateFlag = false; bool debianKernelUpdateFlag = false; + bool plasmadisoverautostartflag = false; @@ -312,6 +313,8 @@ private slots: void on_spinBoxPointerSize_valueChanged(int arg1); + void on_checkBoxPlasmaDiscoverUpdater_clicked(); + private: Ui::defaultlook *ui; }; diff --git a/defaultlook.ui b/defaultlook.ui index bc1de778..2d9c696b 100644 --- a/defaultlook.ui +++ b/defaultlook.ui @@ -265,7 +265,7 @@ QTabWidget::North - 1 + 6 @@ -1728,6 +1728,46 @@ QLayout::SetNoConstraint + + + + <html><head/><body><p><span style=" font-weight:600;">Reset Defaults</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Show windows from all workspaces in panel + + + @@ -1735,6 +1775,32 @@ + + + + Enable single-click + + + + + + + Reset KDE/Plasma defaults + + + + + + + + true + + + + Affects 1st panel + + + @@ -1762,19 +1828,19 @@ - - + + true - Affects 1st panel + Workspace - + @@ -1791,69 +1857,10 @@ - - - - - true - - - - Workspace - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Show windows from all workspaces in panel - - - - - - - Enable single-click - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Reset Defaults</span></p></body></html> - - - - - + + - Reset KDE/Plasma defaults + Autostart plasma-discover system tray update notification utility diff --git a/translations/mx-tweak_en.ts b/translations/mx-tweak_en.ts index 44b7ea1e..6751308c 100644 --- a/translations/mx-tweak_en.ts +++ b/translations/mx-tweak_en.ts @@ -201,13 +201,13 @@ - + Bottom - + Top @@ -224,7 +224,7 @@ - + Affects 1st panel acts on the first poanel found in Xfce panel xml fle @@ -266,13 +266,13 @@ - + Left - + Right @@ -296,9 +296,9 @@ - - - + + + Apply apply changes @@ -597,7 +597,7 @@ - + Show windows from all workspaces in panel @@ -692,7 +692,7 @@ - + Placement @@ -709,7 +709,7 @@ - + <html><head/><body><p><span style=" font-weight:600;">Reset Defaults</span></p></body></html> @@ -745,160 +745,166 @@ - + Workspace - + Enable single-click - + Reset KDE/Plasma defaults - + + Autostart plasma-discover system tray update notification utility + enable or disable autostartup of plasma-discover updater utility on login + + + + Super Key referring to the meta or Left Super Key - + <html><head/><body><p>Choose application</p></body></html> description of button action to launch file dialog to choose an application - + Xfce-superkey defaults indicates that xfce-superkey will select a command by its default logic - + <html><head/><body><p>Also known as the &quot;windows&quot; key</p></body></html> - + Command to run with Super (Meta) key label for the field to enter the command to use with super key - + Other - + Reset Lightdm (login screen) to system default theme - + put a hold or remove a hold on updates of Liquorix kernels toggle for apt hold action on update meta packages - + Enable Automatic Liquorix Kernel Updates (MX ahs repository) uses apt-mark to hold or unhold updates to kernel metapackages - + put a hold or remove a hold on updates of Debian kernels toggle for apt hold action on update meta packages - + Enable Automatic Debian Kernel Updates uses apt-mark to hold or unhold updates to kernel metapackages - + Password for administrative tasks: - + Enable mounting of internal drives by non-root users - + Root - + Enable kernel sandbox - + &User - + <html><head/><body><p>requires reboot</p></body></html> - + Enable Bluetooth Adapters on boot - + Apt installs additional "recommends" packages as dependencies - + Generate fluxbox All Apps menu after package installation, removal, and updates - + Use Client Side Decorations (CSD) on GTK3 applications that support them (requires session restart) - + Use intel driver instead of default "modesetting" driver (requires restart) - + NOTE: existing /etc/X11/xorg.conf.d/20-intel.conf will be backed up to home folder - + Use tearfree amdgpu option - + NOTE: existing /etc/X11/xorg.conf.d/20-amd.conf will be backed up to home folder - + Use tearfree radeon driver option - + NOTE: existing /etc/X11/xorg.conf.d/20-radeon.conf will be backed up to home folder @@ -978,17 +984,17 @@ - + settings - + Choose a theme set - + Select application to run will show in file dialog when selection an application to run