Skip to content

Commit

Permalink
added x-backlight-persist get
Browse files Browse the repository at this point in the history
  • Loading branch information
rileyrg committed Jan 3, 2021
1 parent 827134c commit 4ac405c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,18 @@ Save and restore backlight values
save() {
l=$(xbacklight -get);
echo $l > ~/.x-backlight-persist
echo $l
}

get() {
echo $(xbacklight -get);
}

restore() {
b=100
[[ -f ~/.x-backlight-persist ]] && read b < ~/.x-backlight-persist
xbacklight -set $b
unset b
echo $b
}

case "$1" in
Expand All @@ -297,6 +302,9 @@ case "$1" in
restore)
restore
;;
get)
get
;;
*)
save
;;
Expand Down Expand Up @@ -1214,7 +1222,7 @@ bindsym $mod+Shift+e exec emacs-same-frame
bindsym $mod+Shift+f exec google-chrome
bindsym $mod+Control+t exec "notify-send -t 2000 'Opening NEW Terminator instance' && terminator -e tmux"
bindsym $mod+Control+l exec (sleep 1 && xset dpms force standby) #triggers xss-lock
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle && x-backlight-persist restore
bindsym $mod+Control+g exec x-lock-utils lock_gpg_clear
bindsym $mod+Control+f exec thunar
bindsym $mod+g exec "goldendict \\"`xclip -o -selection clipboard`\\""
Expand Down
10 changes: 9 additions & 1 deletion directories/bin/x-backlight-persist
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
save() {
l=$(xbacklight -get);
echo $l > ~/.x-backlight-persist
echo $l
}

get() {
echo $(xbacklight -get);
}

restore() {
b=100
[[ -f ~/.x-backlight-persist ]] && read b < ~/.x-backlight-persist
xbacklight -set $b
unset b
echo $b
}

case "$1" in
Expand All @@ -21,6 +26,9 @@ case "$1" in
restore)
restore
;;
get)
get
;;
*)
save
;;
Expand Down
2 changes: 1 addition & 1 deletion dot-config/i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ bindsym $mod+Shift+e exec emacs-same-frame
bindsym $mod+Shift+f exec google-chrome
bindsym $mod+Control+t exec "notify-send -t 2000 'Opening NEW Terminator instance' && terminator -e tmux"
bindsym $mod+Control+l exec (sleep 1 && xset dpms force standby) #triggers xss-lock
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle && x-backlight-persist restore
bindsym $mod+Control+g exec x-lock-utils lock_gpg_clear
bindsym $mod+Control+f exec thunar
bindsym $mod+g exec "goldendict \\"`xclip -o -selection clipboard`\\""
Expand Down
12 changes: 10 additions & 2 deletions linux-init-files.org
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,18 @@
save() {
l=$(xbacklight -get);
echo $l > ~/.x-backlight-persist
echo $l
}

get() {
echo $(xbacklight -get);
}

restore() {
b=100
[[ -f ~/.x-backlight-persist ]] && read b < ~/.x-backlight-persist
xbacklight -set $b
unset b
echo $b
}

case "$1" in
Expand All @@ -321,6 +326,9 @@
restore)
restore
;;
get)
get
;;
,*)
save
;;
Expand Down Expand Up @@ -1175,7 +1183,7 @@
bindsym $mod+Shift+f exec google-chrome
bindsym $mod+Control+t exec "notify-send -t 2000 'Opening NEW Terminator instance' && terminator -e tmux"
bindsym $mod+Control+l exec (sleep 1 && xset dpms force standby) #triggers xss-lock
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle
bindsym $mod+Control+o exec xmg-neo-rgb-kbd-lights toggle && x-backlight-persist restore
bindsym $mod+Control+g exec x-lock-utils lock_gpg_clear
bindsym $mod+Control+f exec thunar
bindsym $mod+g exec "goldendict \\"`xclip -o -selection clipboard`\\""
Expand Down

0 comments on commit 4ac405c

Please sign in to comment.