Xfce Forum

Sub domains
 

You are not logged in.

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

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

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: 35

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: 2

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

Board footer

Powered by FluxBB