[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kwin wayland turn off screen (xset dpms force off)



On Sunday, May 9, 2021 2:27:32 AM CEST inkbottle wrote:
> On Friday, May 7, 2021 12:06:52 AM CEST inkbottle wrote:
> > On Thursday, May 6, 2021 9:30:54 AM CEST Grzegorz Szymaszek wrote:
> > > On Thu 06 May 2021 01:34:15 CEST, inkbottle wrote:
> > > > Also, the expected behavior would IMO the change the duration of the
> > > > screen off timer when the screen is locked. Like setting the timer to
> > > > 40
> > > > sec.
> > > 
> > > FWIW, <https://bugs.kde.org/show_bug.cgi?id=348529>.
> > 
> > Thanks.
> > Someone says <https://bugs.kde.org/show_bug.cgi?id=405344> must be
> > addressed first.
> > Things might be different, with wayland.
> > <https://blog.martin-graesslin.com/blog/2015/09/comparing-dpms-on-x11-and-> > wa yland/>
> 
> The following line does succeed in conveniently setting `dpms` timer.
> 
> `kwriteconfig5 --file powermanagementprofilesrc --group AC --group
> DPMSControl -- key idleTime 60; qdbus org.kde.Solid.PowerManagement
> /org/kde/Solid/ PowerManagement
> org.kde.Solid.PowerManagement.refreshStatus`
> 
> And again, kwin-wayland seems more consistent than its x11 counterpart in
> the matter of turning the screen off, so, so far, the whole operation is
> far less painful than it was with x11 version.
> 
> See: https://bugs.kde.org/show_bug.cgi?id=340342
> for the command line.

I'm trying running the following in a terminal, and then locking the screen 
with Ctrl+Alt+L:

#! /bin/bash

# https://unix.stackexchange.com/questions/353998/run-script-on-screen-lock-in-kde

dbus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" 
|
  while read x; do
    case "$x" in
      *"boolean true"*) 
        echo SCREEN_LOCKED;
        kwriteconfig5 --file powermanagementprofilesrc --group AC --group 
DPMSControl --key idleTime 60;
        qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement 
org.kde.Solid.PowerManagement.refreshStatus
        ;;              
      *"boolean false"*)
        echo SCREEN_UNLOCKED;
        kwriteconfig5 --file powermanagementprofilesrc --group AC --group 
DPMSControl --key idleTime 600;
        qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement 
org.kde.Solid.PowerManagement.refreshStatus
        ;;              
    esac
  done
  






Reply to: