控制面板设置永不进入屏保一分钟后 显示透明窗口

This commit is contained in:
liudun 2024-04-10 10:59:14 +08:00
parent e242263810
commit 86c098af7b
4 changed files with 16 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#define KEY_THEMES "themes"
#define KEY_IDLE_ACTIVATION_ENABLED "idle-activation-enabled"
#define KEY_LOCK_ENABLED "lock-enabled"
#define KEY_IDLE_DELAY "idle-delay"
#define KEY_IMAGE_TRANSITION_EFFECT "image-transition-effect"
#define KEY_IMAGE_SWITCH_INTERVAL "image-switch-interval"
#define KEY_BACKGROUND "background"
@ -51,6 +52,7 @@ Configuration::Configuration(QObject *parent) : QObject(parent)
themes = gsettings->get(KEY_THEMES).toStringList();
idleActivationEnabled = gsettings->get(
KEY_IDLE_ACTIVATION_ENABLED).toBool();
idleDelay = gsettings->get(KEY_IDLE_DELAY).toInt();
lockEnabled = gsettings->get(KEY_LOCK_ENABLED).toBool();
imageSwitchInterval = gsettings->get(KEY_IMAGE_SWITCH_INTERVAL).toInt();
imageTSEffect = gsettings->get(KEY_IMAGE_TRANSITION_EFFECT).toInt();
@ -115,6 +117,9 @@ void Configuration::onConfigurationChanged(QString key)
imageTSEffect = gsettings->get(KEY_IMAGE_TRANSITION_EFFECT).toInt();
else if(key == KEY_IMAGE_SWITCH_INTERVAL)
imageSwitchInterval = gsettings->get(KEY_IMAGE_SWITCH_INTERVAL).toInt();
else if (key == KEY_IDLE_DELAY) {
idleDelay = gsettings->get(KEY_IDLE_DELAY).toInt();
}
}
/*
@ -204,7 +209,10 @@ QString Configuration::getBackground()
bool Configuration::xscreensaverActivatedWhenIdle()
{
return idleActivationEnabled;
if (idleDelay <= 0)
return false;
else
return idleActivationEnabled;
}
bool Configuration::lockWhenXScreensaverActivated()

View File

@ -56,6 +56,7 @@ private:
QString background;
bool idleActivationEnabled;
bool lockEnabled;
int idleDelay;
int imageTSEffect;
int imageSwitchInterval;
static Configuration *instance_;

View File

@ -680,7 +680,7 @@ int FullBackgroundWidget::onSessionStatusChanged(uint status)
showScreensaver();
#else
if(configuration->xscreensaverActivatedWhenIdle() &&
configuration->lockWhenXScreensaverActivated())
configuration->lockWhenXScreensaverActivated() && idleDelay != -1)
{
//显示锁屏和屏保
showLockWidget();
@ -929,6 +929,7 @@ void FullBackgroundWidget::onConfigurationDelayChanged(QString key)
{
if(key == KEY_IDLE_DELAY){
idleDelay = settings_delay->get("idle-delay").toInt();
qDebug()<<"idleDelay="<<idleDelay;
}
}

View File

@ -238,8 +238,10 @@ int main(int argc, char *argv[])
if(parser.isSet(sessionIdleOption))
{
if(window->onSessionStatusChanged(SESSION_IDLE) == -1)
return 0;
if(window->onSessionStatusChanged(SESSION_IDLE) == -1) {
window->close();
return 0;
}
}
if(parser.isSet(lscreensaverOption))