• kwin wayland turn off screen (xset dpms force off)

    From inkbottle@21:1/5 to All on Thu May 6 01:40:02 2021
    Hi,

    I'm looking for a way to "turn off screen" from command line, with wayland. Obviously `xset dpms force off` won't work.

    Ultimately or optimally, it would IMO be nice the "turn off screen" timer to be shortened when the screen is locked.

    I've found "PowerDevilDPMSAction.cpp" is related to that (even the wayland case), but I haven't found how to make use of those actions through `qdbus`.

    The following line does work, but it seems awkward, and after it is executed the terminal scrolls as if you were continuously pressing enter key (not
    always though):

    qdbus org.kde.kglobalaccel /component/org_kde_powerdevil invokeShortcut "Turn Off Screen"

    And yes, I could define a shortcut, but I don't know which to choose which would be convenient, wouldn't interfere with other shortcuts, and anyway, the correct shortcut should be the one I already use to lock the screen `Ctrl-Alt- l`.

    Knowing how to cause the screen to turn off from command line would be nice.

    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.

    Thanks,
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Grzegorz Szymaszek@21:1/5 to inkbottle on Thu May 6 10:10:01 2021
    (Reposting to the list, sorry inkbottle!)

    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>.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEZT55kPBhnB69hD4ZeE9lGUIcpz4FAmCTmy4ACgkQeE9lGUIc pz7VtA//dtANpCBS6rsVikqww13PmyPsHmoymcNmfQA6v9y8xgU9WyNtD960cb+d nFi2X92Qh563yqKyUccHLfc3+LOMq1zq2Zxj3xmcGBvtOM0Jtj/YdPWXHHo9Fyo0 5uXUC+Zgc2lln73H933UHH/6sBtWyEpOPlq7Pkuf8qWRb4b/r/GuGaUqrk84ecwy uhLZOjdXRqgvI6h1hMDTxeAy4cV2MMUCErfOCHpfU4265z2iA5fu0HDEro52Mdrp WyWHvt1fy9EVI5qVisHgtAhEiqMxEyr37F4Z0ZmMTFqDuJ/V5qksYD5f8MMRjBW8 Nvk5ARFOgFBBB0c15Q06MB8M6pRfGLNBcHjZniBTcWDovS16X6B4l4EZOlmAbaOP 0ULrMj0GotzHg+nk9pPlGj5swMESPifQ/Tel/q/OfZcVlLoy4z/j6p5vjIMOJyjt fJEIgeAIoR5ojQepXQfOxItpbB4fU800zqJTJTRtU5KVP/xAzy8F+G9kyMw/4Klw zCeuW9Cd9xvovyWLCuRAdegPd+lrJgwjIBEwcVti+FpIIc3x8tcGwT2H2u4uBr9H 4QUFTLf0USAyHTpn2a7m2es4wsmsS2gIvymJfCanwhdmnyerm/ywLyW0rU69HBgW 4/oawIF6qfPJ9QRbN7vB10unxOZNpFwzt6tcnlqFQXLcoPbWhjE=
    =kg5q
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Fri May 7 00:10:03 2021
    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-wayland/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Sun May 9 02:30:03 2021
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Tue May 11 02:50:01 2021
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Thu May 20 15:30:04 2021
    On Tuesday, May 11, 2021 2:45:51 AM CEST you wrote:
    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-an
    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-i n-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


    Using systemsetting GUI, I removed a `key`:

    [AC][DimDisplay]
    idleTime=540000

    Also, my kde-plasma-framework... might be more up to date.

    Who knows. In any case the above script, which leaves much to be desired, is now working.

    So, with it running in a terminal, you can do: Ctrl-Alt-L, and ta-da, the screen turns of a few seconds later.
    And when you unlock, the default behavior is restored.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Norbert Preining@21:1/5 to inkbottle on Thu May 20 22:20:02 2021
    On Thu, 20 May 2021, inkbottle wrote:
    So, with it running in a terminal, you can do: Ctrl-Alt-L, and ta-da, the screen turns of a few seconds later.
    And when you unlock, the default behavior is restored.

    I submitted a patch to the kernel that fixes this on the kernel side ;-)
    No extra scripts needed.
    It is not perfect and seems to not work in all circumstances, but this
    is what I am running (but I run self-compiled kernels).

    https://gitlab.freedesktop.org/drm/amd/-/issues/662#note_909333

    Best

    Norbert

    --
    PREINING Norbert https://www.preining.info
    Fujitsu Research + IFMGA Guide + TU Wien + TeX Live + Debian Dev
    GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Fri May 21 14:00:01 2021
    On Thursday, May 20, 2021 10:10:03 PM CEST Norbert Preining wrote:
    On Thu, 20 May 2021, inkbottle wrote:
    So, with it running in a terminal, you can do: Ctrl-Alt-L, and ta-da, the screen turns of a few seconds later.
    And when you unlock, the default behavior is restored.

    I submitted a patch to the kernel that fixes this on the kernel side ;-)
    No extra scripts needed.
    It is not perfect and seems to not work in all circumstances, but this
    is what I am running (but I run self-compiled kernels).

    https://gitlab.freedesktop.org/drm/amd/-/issues/662#note_909333

    Yes indeed.

    But I understand my scripting is addressing a different purpose in the "turn off
    screen" arena. It is not addressing a hardware related issue preventing altogether things from working. It is more like, assuming lower level things are well behaved, "can we shorten the dpms OffTime timer when the screen is locked?" And in that "user experience" concern, actually, and contrary to my first feeling about it, it is doing pretty well, or so it seems, after several days of using it. It even seems reliable.

    For the present, with my "systemsettings", my hardware, wayland, "unstable", Plasma 5.21.5, framework 5.82, the script found in the previous post, and verifying that nothing is obviously interfering with `dbus-monitor --session "type='signal',interface='org.freedesktop.PowerManagement.Inhibit'"`, things have been fool proof for days.

    So far, very satisfactory.

    Thanks,
    Chris



    Best

    Norbert

    --
    PREINING Norbert https://www.preining.info Fujitsu Research + IFMGA Guide + TU Wien + TeX Live + Debian Dev
    GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From inkbottle@21:1/5 to All on Sun May 30 14:30:02 2021
    On Friday, May 21, 2021 1:50:19 PM CEST inkbottle wrote:
    On Thursday, May 20, 2021 10:10:03 PM CEST Norbert Preining wrote:
    On Thu, 20 May 2021, inkbottle wrote:
    So, with it running in a terminal, you can do: Ctrl-Alt-L, and ta-da,
    the
    screen turns of a few seconds later.
    And when you unlock, the default behavior is restored.

    I submitted a patch to the kernel that fixes this on the kernel side ;-)
    No extra scripts needed.
    It is not perfect and seems to not work in all circumstances, but this
    is what I am running (but I run self-compiled kernels).

    https://gitlab.freedesktop.org/drm/amd/-/issues/662#note_909333

    Yes indeed.

    But I understand my scripting is addressing a different purpose in the "turn off screen" arena. It is not addressing a hardware related issue preventing altogether things from working. It is more like, assuming lower level
    things are well behaved, "can we shorten the dpms OffTime timer when the screen is locked?" And in that "user experience" concern, actually, and contrary to my first feeling about it, it is doing pretty well, or so it seems, after several days of using it. It even seems reliable.

    For the present, with my "systemsettings", my hardware, wayland, "unstable", Plasma 5.21.5, framework 5.82, the script found in the previous post, and verifying that nothing is obviously interfering with `dbus-monitor
    --session "type='signal',interface='org.freedesktop.PowerManagement.Inhibit'"`,
    things have been fool proof for days.

    So far, very satisfactory.

    In some circumstances, that I haven't been able to identify at all, but which could be related to opened Firefox, but I have really no evidence at all of that, the script is defeated, and it's a huge PITA!

    The screen turns back on at some point, and it's easy to see that it is not turning off again, because of the timer being set to 30 sec.

    $ dbus-monitor --session "type='signal',interface='org.freedesktop.PowerManagement.Inhibit'"

    dbus-monitor is giving no clues of something happening it'd be aware of.

    Thanks,
    Chris


    Thanks,
    Chris

    Best

    Norbert

    --
    PREINING Norbert https://www.preining.info Fujitsu Research + IFMGA Guide + TU Wien + TeX Live + Debian Dev GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)