remove brightness script in favor of 'light'
This commit is contained in:
parent
12aa87c340
commit
21514b42d1
106
bin/brightne.sh
106
bin/brightne.sh
|
@ -1,106 +0,0 @@
|
|||
#!/bin/sh
|
||||
# brightne.sh
|
||||
|
||||
# changes my backlight brightness, for use with nvidiabl
|
||||
# possibly the ugliest bash script ever
|
||||
|
||||
# Requires /sys/class/backlight/nvidia_backlight/
|
||||
|
||||
E_NOARGS=75
|
||||
|
||||
backlight_path=`echo /sys/class/backlight/*_backlight`
|
||||
|
||||
usage() {
|
||||
echo "Usage: brightne.sh [set|fix|up|down] arg between 0 and 1000"
|
||||
}
|
||||
|
||||
get_raw_maximum() {
|
||||
return `cat $backlight_path/max_brightness`
|
||||
}
|
||||
|
||||
get_raw_current() {
|
||||
return `cat $backlight_path/brightness`
|
||||
}
|
||||
|
||||
set_raw() {
|
||||
echo $1 > $backlight_path/brightness
|
||||
}
|
||||
|
||||
# from 0-1000 to 0-max
|
||||
scale_to_bl() {
|
||||
get_raw_maximum
|
||||
max=$?
|
||||
scale_from_to $1 $max
|
||||
}
|
||||
|
||||
scale_from_to() {
|
||||
echo "$2 * $1 / 1000" | bc
|
||||
}
|
||||
|
||||
# from 0-max to 0-1000
|
||||
scale_from_bl() {
|
||||
get_raw_maximum
|
||||
max=$?
|
||||
echo "1000 * $1 / $max" | bc
|
||||
}
|
||||
|
||||
off() {
|
||||
set_raw 0;
|
||||
}
|
||||
|
||||
max() {
|
||||
get_raw_maximum
|
||||
raw_current=$?
|
||||
set_raw $raw_current
|
||||
}
|
||||
|
||||
set_bl() {
|
||||
set_raw $(scale_to_bl $1)
|
||||
}
|
||||
|
||||
get() {
|
||||
get_raw_current
|
||||
echo $(scale_from_bl $?)
|
||||
}
|
||||
|
||||
fix() {
|
||||
get_raw_current
|
||||
set_raw $?
|
||||
}
|
||||
|
||||
up() {
|
||||
local addvalue=$1
|
||||
if [ -z $1 ]
|
||||
then
|
||||
addvalue=10
|
||||
fi
|
||||
set_bl $(echo "$(get) + $addvalue" | bc)
|
||||
}
|
||||
|
||||
down() {
|
||||
local addvalue=$1
|
||||
if [ -z $1 ]
|
||||
then
|
||||
addvalue=10
|
||||
fi
|
||||
set_bl $(echo "$(get) - $addvalue" | bc)
|
||||
}
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
usage
|
||||
exit $E_NOARGS
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"up" ) up $2;;
|
||||
"set" ) set_bl $2;;
|
||||
"down" ) down $2;;
|
||||
"fix" ) fix;;
|
||||
"get" ) get;;
|
||||
"off" ) off ;;
|
||||
"max" ) max ;;
|
||||
* ) usage;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -13,8 +13,6 @@ let
|
|||
in lib.mapAttrs (k: f: f k) {
|
||||
backup = compileShell ./backup.sh
|
||||
(with pkgs; [utillinux duplicity]);
|
||||
brightness = compileShell ./brightne.sh
|
||||
(with pkgs; [bc]);
|
||||
screenshot_public = compileShell ./screenshot_public.sh
|
||||
(with pkgs; [scrot xclip rsync]);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ let
|
|||
inherit (pkgs) lib;
|
||||
bin = pkgs.callPackage ./bin/default.nix {};
|
||||
i3 = with_lock: pkgs.callPackage ./i3/i3.nix {
|
||||
inherit (bin) brightness screenshot_public;
|
||||
inherit (bin) screenshot_public;
|
||||
inherit with_lock;
|
||||
};
|
||||
in lib.mapAttrs (k: paths:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{writeTextDir, writeScript, lib,
|
||||
rofi, xss-lock, nitrogen, compton-git, i3status, i3-gaps
|
||||
, i3lock-fancy, xset, alsaUtils, brightness, screenshot_public, xorg,
|
||||
, i3lock-fancy, xset, alsaUtils, light, screenshot_public, xorg,
|
||||
with_lock ? true}:
|
||||
|
||||
let
|
||||
|
@ -176,8 +176,8 @@ exec --no-startup-id ${xss-lock}/bin/xss-lock -l -- ${locker}
|
|||
|
||||
'') + ''
|
||||
|
||||
bindsym XF86MonBrightnessUp exec ${brightness}/bin/brightness up 20
|
||||
bindsym XF86MonBrightnessDown exec ${brightness}/bin/brightness down 20
|
||||
bindsym XF86MonBrightnessUp exec ${light}/bin/light -A 5
|
||||
bindsym XF86MonBrightnessDown exec ${light}/bin/light -U 5
|
||||
bindsym XF86AudioLowerVolume exec ${alsaUtils}/bin/amixer set Master 1%-
|
||||
bindsym XF86AudioRaiseVolume exec ${alsaUtils}/bin/amixer set Master 1%+
|
||||
bindsym XF86AudioMute exec ${alsaUtils}/bin/amixer set Master toggle
|
||||
|
|
|
@ -92,10 +92,10 @@
|
|||
xorg.xrandr
|
||||
pavucontrol
|
||||
];
|
||||
scripts = mkEnv "y-scripts" ([
|
||||
scripts = mkEnv "y-scripts" [
|
||||
peageprint
|
||||
weiightminder
|
||||
] ++ (with yscripts; [brightness]));
|
||||
];
|
||||
|
||||
apps = mkEnv "y-apps" [
|
||||
gajim
|
||||
|
|
Loading…
Reference in a new issue