Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-11-14 12:21:21

Vasiliy Pogoreliy
Member
Registered: 2020-11-14
Posts: 3

I suggest adding a small script

Hello everybody!
I suggest that you automatically add a small script to the startup when installing.

#!/bin/sh

trap "(xscreensaver -no-splash &); xset +dpms; exit;" 1 2 3 8 9 14 15;

function FULLSCREEN(){
    SCRN_SVR_PID="$(ps aux | grep -P 'xscreensaver\ -no-splash' | awk '{print $2}')";
    if xset -q | grep -Pq 'DPMS is Enabled'; then
        if [[ "a$SCRN_SVR_PID" != "a" ]]; then kill -9 $SCRN_SVR_PID; fi
        xset -dpms;
    fi
}

function NOT_FULLSCREEN(){
    if xset -q | grep -Pq 'DPMS is Disabled'; then
        (xscreensaver -no-splash &);
        xset +dpms;
    fi
}

while true; do
    FS_STATUS="false";
    win_id_list=`xprop -root _NET_CLIENT_LIST | sed -e 's/.*\#//g' | sed 's/\,/ /g'`;
    for win_id in $win_id_list; do
        WinFullScreen=`DISPLAY=:0 xprop -id $win_id | grep _NET_WM_STATE_FULLSCREEN`;
        if [[ "$WinFullScreen" = *NET_WM_STATE_FULLSCREEN* ]]; then FS_STATUS="true"; fi
    done
    if [[ "a$FS_STATUS" == "atrue" ]]; then
        FULLSCREEN;
    else
        NOT_FULLSCREEN;
    fi
    sleep 5;
done

Please forgive for my bad English =)

Last edited by Vasiliy Pogoreliy (2020-11-14 12:24:39)

Offline

#2 2020-11-16 07:37:09

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: I suggest adding a small script

Can you please shortly describe what the script is supposed to do?

Offline

#3 2020-11-16 17:39:59

Vasiliy Pogoreliy
Member
Registered: 2020-11-14
Posts: 3

Re: I suggest adding a small script

Signy wrote:

Can you please shortly describe what the script is supposed to do?

Thank you for your comment. This script disable screensaver (i use xscreensaver) when application opened in fullscreen mode and running screensaver when application opened in window mode.

Last edited by Vasiliy Pogoreliy (2020-11-16 17:44:31)

Offline

#4 2021-04-05 09:58:11

jarnos
Member
From: Finland
Registered: 2009-03-22
Posts: 50
Website

Re: I suggest adding a small script

You should not kill xscreensaver by `kill -9`. Manual page of `xscreensaver-command` tells so: "Warning: never use kill -9 with xscreensaver while the screensaver is active.  If you are using  a  virtual root  window manager, that can leave things in an inconsistent state, and you may need to restart your window manager to repair the damage." Use `xscreensaver-command -exit`, instead. And you can test, if the daemon is running by `xscreensaver-command -version`.

Not everybody is using xscreensaver. I think it is better to use `xdg-screensaver suspend` and `xdg-screensaver resume` to control running screensaver.
Note also that latest versions of xscreensaver have `xscreensaver-systemd` that is able to inhibit screensaver in some cases:
https://www.jwz.org/xscreensaver/changelog.html
https://github.com/Zygo/xscreensaver/bl … -systemd.c

Offline

#5 2021-04-05 12:47:15

Vasiliy Pogoreliy
Member
Registered: 2020-11-14
Posts: 3

Re: I suggest adding a small script

The topic is outdated, perhaps no longer relevant.

I have an offer to add this to the distribution. I own English badly, but I hope I managed to convey my idea with the code.

I hope you understand me =).

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 8 queries executed - Memory usage: 545.71 KiB (Peak: 546.55 KiB) ]