Coder Social home page Coder Social logo

crhbetz / lightson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dyskette/lightson

19.0 19.0 7.0 170 KB

Bash script managing screensaver and display power management (DPMS) on different conditions (fullscreen videos, specific applications, specific outputs).

Shell 100.00%

lightson's People

Contributors

airminer avatar dartkron avatar darvelo avatar dyskette avatar iye avatar jamincollins avatar kidlike avatar kodx avatar namtabmai avatar unhammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lightson's Issues

Make insisting on fullscreen / above states optional

Currently, we're able to delay when

  • an app is running in fullscreen (checkFullscreen and isAppRunning)
  • an app is running anywhere (checkDelayProgs)

There should be an option to trigger the delay when a window is merely active, but not necessarily in fullscreen or above state. I think there are use-cases for all of those three options.

One could accomplish this by making it a global option (insist_on_fullscreen=0|1) and put the fullscreen/above checks into a corresponding if-check.

Maybe it would be even greater to be able to toggle this on a per-app basis and/or to add another list as done with checkDelayProgs. I think it should be taken care not to add too many lists, toggles and individual options to the head of the script, though.

README is quite outdated

The README file is missing a lot of the supported browsers and not very clear in describing the function of the script in general.

I'll redo it when I'm done modifying one thing or another.

checkOutputs() disables and enables DPMS, X11 Screensaver in every loop

[19:18:18] -  Setting DPMS to Standby: 600, Suspend: 600, Off: 600
[19:18:18] -  Setting X11 Scrensaver Extension to Timeout: 600
[19:18:19] -  No screensaver detected
[19:18:19] -  checkDelayProgs()
[19:18:19] -  checkFullscreen()
[19:18:19] -  checkFullscreen(): Display: 0 isFullScreen=1
[19:18:19] -  checkFullscreen(): Display: 0 isAbove=0
[19:18:19] -  checkFullscreen(): Fullscreen detected
[19:18:19] -  isAppRunning()
[19:18:19] -  checkFullscreen(): the fullscreen app is unknown or not set to trigger the delay
[19:18:19] -  checkOutputs()
[19:18:19] -  checkOutputs(): Delaying because of output
[19:18:19] -  delayScreensaver(): trying to delay with xdg-screensaver...
[19:18:19] -  delayScrennsaver(): DPMS disabled
[19:18:19] -  delayScreensaver(): X11 Screensaver Extension disabled
[19:18:19] -  delayScreensaver(): resetting gnome session...
[19:18:19] -  sleeping for 10
[19:18:19] -  --------------- loop done! ---------------
[19:18:29] -  checkDelayProgs()
[19:18:29] -  checkFullscreen()
[19:18:29] -  checkFullscreen(): Display: 0 isFullScreen=1
[19:18:29] -  checkFullscreen(): Display: 0 isAbove=0
[19:18:29] -  checkFullscreen(): Fullscreen detected
[19:18:29] -  isAppRunning()
[19:18:29] -  checkFullscreen(): the fullscreen app is unknown or not set to trigger the delay
[19:18:29] -  checkFullscreen(): DPMS enabled
[19:18:29] -  checkFullscreen(): X11 Screensaver Extension enabled
[19:18:29] -  checkOutputs()
[19:18:29] -  checkOutputs(): Delaying because of output
[19:18:29] -  delayScreensaver(): trying to delay with xdg-screensaver...
[19:18:29] -  delayScrennsaver(): DPMS disabled
[19:18:29] -  delayScreensaver(): X11 Screensaver Extension disabled
[19:18:29] -  delayScreensaver(): resetting gnome session...
[19:18:29] -  sleeping for 10
[19:18:29] -  --------------- loop done! ---------------
[19:18:39] -  checkDelayProgs()
[19:18:39] -  checkFullscreen()
[19:18:39] -  checkFullscreen(): Display: 0 isFullScreen=1
[19:18:39] -  checkFullscreen(): Display: 0 isAbove=0
[19:18:39] -  checkFullscreen(): Fullscreen detected
[19:18:39] -  isAppRunning()
[19:18:39] -  checkFullscreen(): the fullscreen app is unknown or not set to trigger the delay
[19:18:39] -  checkFullscreen(): DPMS enabled
[19:18:39] -  checkFullscreen(): X11 Screensaver Extension enabled
[19:18:39] -  checkOutputs()
[19:18:39] -  checkOutputs(): Delaying because of output
[19:18:39] -  delayScreensaver(): trying to delay with xdg-screensaver...
[19:18:39] -  delayScrennsaver(): DPMS disabled
[19:18:39] -  delayScreensaver(): X11 Screensaver Extension disabled
[19:18:39] -  delayScreensaver(): resetting gnome session...
[19:18:39] -  sleeping for 10
[19:18:39] -  --------------- loop done! ---------------

Checks in isAppRunning look very repetitive - can this be shortened?

Example:

    # Check if user want to detect VLC fullscreen.
    if [ $vlc_detection == 1 ]; then
        if [[ "$activ_win_title" = *vlc* ]]; then
            # Check if VLC is running.
            if [ "$(pidof -s vlc)" ]; then
                log "isAppRunning(): vlc fullscreen detected"
                return 1
            fi
        fi
    fi

    # Check if user want to detect Minitube fullscreen.
    if [ $minitube_detection == 1 ]; then
        if [[ "$activ_win_title" = *minitube* ]]; then
            # Check if Minitube is running.
            if [ "$(pidof -s minitube)" ]; then
                log "isAppRunning(): minitube fullscreen detected"
                return 1
            fi
        fi
    fi

Take care though, some look slightly different (when involving flash).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.