summaryrefslogtreecommitdiffstats
path: root/pkgs/simple/xtoggledpms.nix
blob: d164ad7128c395638a4c2a4770cc86a2c7670d28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{ 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
''