From 1ff8c906539715ebe3fc1e9ef80b72adfee2de69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Mon, 15 Jul 2019 20:52:19 +0100 Subject: [PATCH] add xidlehook --- lock.sh | 16 ++++++++++++++++ nixos/home.nix | 2 +- nixos/polybar.nix | 8 ++++---- nixos/user-xsession.nix | 3 ++- 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 lock.sh diff --git a/lock.sh b/lock.sh new file mode 100755 index 00000000..00df0da7 --- /dev/null +++ b/lock.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')" + +xidlehook \ + --not-when-fullscreen \ + --not-when-audio \ + --timer normal 60 \ + 'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \ + 'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \ + --timer primary 10 \ + 'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; physlock -d' \ + '' \ + --timer normal 600 \ + 'systemctl suspend' \ + '' diff --git a/nixos/home.nix b/nixos/home.nix index 4cd22297..a53b42c0 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -13,7 +13,7 @@ in }; }; home.packages = with pkgs; [ - wirelesstools ranger xpdf apvlv + wirelesstools ranger xpdf apvlv unstable.xidlehook keepass fontconfig nodejs rustup gcc gdb binutils xclip pkgconfig veracrypt gitAndTools.diff-so-fancy openjdk11 gimp restic glxinfo discord diff --git a/nixos/polybar.nix b/nixos/polybar.nix index 140fe21e..cd0f4fc2 100644 --- a/nixos/polybar.nix +++ b/nixos/polybar.nix @@ -63,8 +63,8 @@ battery = "BAT0"; adapter = "AC"; poll-interval = "5"; - format-discharging = "BAT0: "; - label-discharging = "%percentage%%|%time%"; + format-discharging = ""; + label-discharging = "%time%"; }; "module/battery1" = { @@ -72,8 +72,8 @@ battery = "BAT1"; adapter = "AC"; poll-interval = "5"; - format-discharging = "BAT1: "; - label-discharging = "%percentage%%|%time%"; + format-discharging = ""; + label-discharging = "%time%"; }; }; diff --git a/nixos/user-xsession.nix b/nixos/user-xsession.nix index e7f1b955..165e22b7 100644 --- a/nixos/user-xsession.nix +++ b/nixos/user-xsession.nix @@ -14,7 +14,8 @@ in package = pkgs.i3-gaps; config = { startup = [ - { command = "exec i3-sensible-terminal"; always = true; notification = false; } + { command = "exec i3-sensible-terminal"; always = false; notification = false; } + { command = "exec $HOME/dev/dotfiles/lock.sh"; always = false; notification = false; } ]; window = { hideEdgeBorders = "horizontal";