Merge branch 'master' of ssh://gitlab.ahoskingit.com:9022/ahosking/dotfiles

This commit is contained in:
Alexander Hosking 2018-05-29 00:13:20 -04:00
commit 67bbd5b9f6
3 changed files with 114 additions and 2 deletions

View File

@ -71,7 +71,8 @@ bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness
bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
## Keyboard Backlighting ## Keyboard Backlighting
#/sys/devices/platform/asus-nb-wmi/leds/asus\:\:kbd_backlight/brightness bindsym XF86KbdBrightnessUp exec keybrightness up
bindsym XF86KbdBrightnessDown exec keybrightness down
# change focus # change focus
bindsym $mod+h focus left bindsym $mod+h focus left

View File

@ -15,6 +15,9 @@ mkdir -p ~/apps
### install packages ### install packages
sudo apt-get install -y -f python-pip python-dev powerline sudo apt-get install -y -f python-pip python-dev powerline
## install kryptonite
curl https://krypt.co/kr | sh
#vim backup folders #vim backup folders
mkdir -p ~/.vim/{backup_files,swap_files,undo_files} mkdir -p ~/.vim/{backup_files,swap_files,undo_files}
#install vundle #install vundle
@ -30,7 +33,8 @@ ln -sfv ~/.vim/bundle/vimspectr/shell ~/.vimspectr-shell
ln -sfv "$DOTFILES_DIR/run/.profile" ~ ln -sfv "$DOTFILES_DIR/run/.profile" ~
ln -sfv "$DOTFILES_DIR/run/.xprofile" ~ ln -sfv "$DOTFILES_DIR/run/.xprofile" ~
ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~
ln -sfv "$DOTFILES_DIR/system/.bruise" ~/apps/bruise ln -sfv "$DOTFILES_DIR/system/.bruise" ~/bin/bruise
ln -sfv "$DOTFILES_DIR/system/.keybrightness" ~/bin/keybrightness
ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~
ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~
ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~

107
system/.keybrightness Executable file
View File

@ -0,0 +1,107 @@
#!/bin/sh
# By Giorgos Keramidas
# From: https://unix.stackexchange.com/questions/260409/set-bindings-in-i3-to-control-keyboard-backlight
# backlight_get
# Print current keyboard brightness from UPower to stdout.
backlight_get()
{
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.GetBrightness' \
| awk '{print $2}'
}
# backlight_get_max
# Print the maximum keyboard brightness from UPower to stdout.
backlight_get_max()
{
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.GetMaxBrightness' \
| awk '{print $2}'
}
# backlight_set NUMBER
# Set the current backlight brighness to NUMBER, through UPower
backlight_set()
{
value="$1"
if test -z "${value}" ; then
echo "Invalid backlight value ${value}"
fi
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.SetBrightness' \
"int32:${value}}"
}
# backlight_change [ UP | DOWN | NUMBER ]
# Change the current backlight value upwards or downwards, or
# set it to a specific numeric value.
backlight_change()
{
change="$1"
if test -z "${change}" ; then
echo "Invalid backlight change ${change}." \
"Should be 'up' or 'down'." >&2
return 1
fi
case ${change} in
[1234567890]|[[1234567890][[1234567890])
current=$( backlight_get )
max=$( backlight_get_max )
value=$( expr ${change} + 0 )
if test ${value} -lt 0 || test ${value} -gt ${max} ; then
echo "Invalid backlight value ${value}." \
"Should be a number between 0 .. ${max}" >&2
return 1
else
backlight_set "${value}"
notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
[uU][pP])
current=$( backlight_get )
max=$( backlight_get_max )
if test "${current}" -lt "${max}" ; then
value=$(( ${current} + 1 ))
backlight_set "${value}"
notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
[dD][oO][wW][nN])
current=$( backlight_get )
if test "${current}" -gt 0 ; then
value=$(( ${current} - 1 ))
backlight_set "${value}"
notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
*)
echo "Invalid backlight change ${change}." >&2
echo "Should be 'up' or 'down' or a number between" \
"1 .. $( backlight_get_max )" >&2
return 1
;;
esac
}
if test $# -eq 0 ; then
current_brightness=$( backlight_get )
notify-send -t 800 "Keyboard brightness is ${current_brightness}"
else
# Handle multiple backlight changes, e.g.:
# backlight.sh up up down down up
for change in "$@" ; do
backlight_change "${change}"
done
fi