You are not logged in.

#1 2016-05-23 09:13:13

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Wrapper for vlc to disable dpms

Following script does what the title of this post says:

#!/bin/bash

# This script is a wrapper around /usr/bin/vlc
# It disables dpms and passes all arguments unchanged to the
# 'real' vlc

# Note:
# The script does not handle launching several instances of vlc
# concurrently. It is the users responsability to not launch
# more than 1 vlc instance at any time. When 2 instances run
# concurrently, the first one that finishes will turn dpms on again.

dpms() {
    # $1: on or off
    test $1 == on && switch='true' || switch='false'
    xfconf-query -c xfce4-power-manager \
                 -p /xfce4-power-manager/dpms-enabled \
                 -s "$switch"
}

dpms off
# Make sure dpms is enabled again at exit
trap 'dpms on' EXIT
# Pass all arguments on to the 'real' vlc
# Don't uses 'exec' here if you want the 'trap' command to work.
/usr/bin/vlc "$@"

Put it in a direcTory in your PATH so that it masks the 'real' vlc, and make it executable.
You will always be able to find the latest version of the script in my github repo.

Offline

#2 2016-05-23 09:16:39

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: Wrapper for vlc to disable dpms

Here is an alternative implementation to the one posted by Damo.

Offline

#3 2016-05-23 17:11:02

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Wrapper for vlc to disable dpms

The good thing about this, is that you can with some easy modification, change it work for other programs as well.  Thanks xaos!


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

Board footer

Powered by FluxBB