Skip to content

Improve autostarts #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lxqt-config-input/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ lxqt_translate_ts(QM_FILES
)

lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME})
lxqt_translate_desktop(DESKTOP_FILES SOURCES ${PROJECT_NAME}.desktop.in USE_YAML)
lxqt_translate_desktop(DESKTOP_FILES
SOURCES
${PROJECT_NAME}.desktop.in
resources/lxqt-config-touchpad-autostart.desktop.in
USE_YAML
)

#************************************************

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Exec=lxqt-config-input --load-touchpad
OnlyShowIn=LXQt;
Type=Application
Version=1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoDisplay=true is needed IMO otherwise it will show up in the menu(s).


#TRANSLATIONS_DIR=translations
30 changes: 26 additions & 4 deletions lxqt-config-input/touchpadconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@
#include "touchpaddevice.h"

#include <cmath>

#include <QDebug>
#include <QFile>
#include <QString>
#include <QUrl>

#include <XdgDirs>

#include <LXQt/AutostartEntry>
#include <LXQt/Settings>

using namespace Qt::Literals::StringLiterals;

TouchpadConfig::TouchpadConfig(LXQt::Settings* _settings, QWidget* parent):
QWidget(parent),
settings(_settings)
Expand Down Expand Up @@ -136,10 +145,23 @@ void TouchpadConfig::accept()
device.saveSettings(settings);
}

LXQt::AutostartEntry autoStart(QStringLiteral("lxqt-config-touchpad-autostart.desktop"));
XdgDesktopFile desktopFile(XdgDesktopFile::ApplicationType, QStringLiteral("lxqt-config-touchpad-autostart"), QStringLiteral("lxqt-config-input --load-touchpad"));
desktopFile.setValue(QStringLiteral("OnlyShowIn"), QStringLiteral("LXQt"));
desktopFile.setValue(QStringLiteral("Comment"), QStringLiteral("Autostart touchpad settings for lxqt-config-input"));
LXQt::AutostartEntry autoStart;
XdgDesktopFile desktopFile;

const QStringList dirs = XdgDirs::dataDirs();
auto it = dirs.cbegin();
for ( ;it != dirs.cend(); ++it) {
const QString fn = *it + "/applications/lxqt-config-touchpad-autostart.desktop"_L1;
if (QFile::exists(fn))
if (desktopFile.load(fn)) {
autoStart.setFile(desktopFile);
autoStart.commit();
break;
}
}
if (it == dirs.cend()) {
qWarning() << " TouchpadConfig::accept(): LXQt Config Touchpad autostart file not found";
}
autoStart.setFile(desktopFile);
autoStart.commit();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Desktop Entry/Name: LXQt Touchpad Settings Loader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, but I see that this applies also to acceleration and natural scroll settings of the mouse, so maybe "Mouse and Touchpad Settings" ?

Desktop Entry/Comment: Autostart touchpad settings for lxqt-config-input
7 changes: 6 additions & 1 deletion lxqt-config-monitor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ lxqt_translate_ts(QM_FILES
)

lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME})
lxqt_translate_desktop(DESKTOP_FILES SOURCES "resources/${PROJECT_NAME}.desktop.in" USE_YAML)
lxqt_translate_desktop(DESKTOP_FILES
SOURCES
"resources/${PROJECT_NAME}.desktop.in"
"resources/lxqt-config-monitor-autostart.desktop.in"
USE_YAML
)

#************************************************

Expand Down
29 changes: 22 additions & 7 deletions lxqt-config-monitor/monitorsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QDateTime>
#include <QDebug>
#include <QString>
#include <lxqtautostartentry.h>

#include <XdgDirs>

using namespace Qt::Literals::StringLiterals;

MonitorSettingsDialog::MonitorSettingsDialog() :
QDialog(nullptr, Qt::WindowFlags())
{
Expand Down Expand Up @@ -219,13 +225,22 @@ void MonitorSettingsDialog::saveConfiguration(KScreen::ConfigPtr config)
qDebug() << "[ MonitorSettingsDialog::saveConfiguration] # monitors Write:" << monitors.size();
settings.endGroup();

LXQt::AutostartEntry autoStart(QStringLiteral("lxqt-config-monitor-autostart.desktop"));
XdgDesktopFile desktopFile(XdgDesktopFile::ApplicationType, QStringLiteral("lxqt-config-monitor-autostart"), QStringLiteral("lxqt-config-monitor -l"));
//desktopFile.setValue("OnlyShowIn", QString(qgetenv("XDG_CURRENT_DESKTOP")));
desktopFile.setValue(QStringLiteral("OnlyShowIn"), QStringLiteral("LXQt"));
desktopFile.setValue(QStringLiteral("Comment"), QStringLiteral("Autostart monitor settings for LXQt-config-monitor"));
autoStart.setFile(desktopFile);
autoStart.commit();
LXQt::AutostartEntry autoStart;
XdgDesktopFile desktopFile;
const QStringList dirs = XdgDirs::dataDirs();
auto it = dirs.cbegin();
for ( ;it != dirs.cend(); ++it) {
const QString fn = *it + "/applications/lxqt-config-monitor-autostart.desktop"_L1;
if (QFile::exists(fn))
if (desktopFile.load(fn)) {
autoStart.setFile(desktopFile);
autoStart.commit();
break;
}
}
if (it == dirs.cend()) {
qWarning() << "[ MonitorSettingsDialog::saveConfiguration] # LXQt Config Monitor autostart file not found";
}
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Exec=lxqt-config-monitor -l
OnlyShowIn=LXQt;
Type=Application
Version=1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoDisplay=true here too.


#TRANSLATIONS_DIR=translations
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Desktop Entry/Name: LXQt Monitor Settings Loader
Copy link
Member

@stefonarch stefonarch May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is too long and "Loader" will probably hard to translate.
What about using just "Monitor Settings"? Items show up under "LXQt Autostart" so it's clear in the context.

Desktop Entry/Comment: Autostart monitor settings for lxqt-config-monitor