stockholm/tv/5pkgs/simple/xtoggledpms.nix

17 lines
284 B
Nix
Raw Normal View History

2021-06-23 23:12:24 +00:00
{ pkgs }:
let
grep = "${pkgs.gnugrep}/bin/grep";
xset = "${pkgs.xorg.xset}/bin/xset";
in
pkgs.writeDashBin "xtoggledpms" ''
# usage: xtoggledpms
set -efu
if ${xset} q | ${grep} -qF 'DPMS is Disabled'; then
${xset} dpms force off
else
${xset} s off -dpms
fi
''