From c695f6b304d93210b82cba8b41d4d7df7688620e Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 6 Dec 2017 09:49:56 -0500 Subject: [PATCH 1/5] Add kryptonite install --- install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.sh b/install.sh index e48487e..5f2993d 100755 --- a/install.sh +++ b/install.sh @@ -15,6 +15,9 @@ mkdir -p ~/apps ### install packages sudo apt-get install -y -f python-pip python-dev powerline +## install kryptonite +curl https://krypt.co/kr | sh + #vim backup folders mkdir -p ~/.vim/{backup_files,swap_files,undo_files} #install vundle From a7c4c0c31eee020e15257b48e208d15194b01041 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 11 Dec 2017 23:57:35 -0500 Subject: [PATCH 2/5] Add key backlight --- .i3/config | 7 +++++-- install.sh | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.i3/config b/.i3/config index e510f2a..6c66af9 100755 --- a/.i3/config +++ b/.i3/config @@ -67,8 +67,11 @@ bindsym $mod+XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # m ## requires xbacklight -bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness -bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness +#bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness +#bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness +# increase/decrease keyboard brightness +bindsym XF86KbdBrightnessUp exec keybrightness up +bindsym XF86KbdBrightnessDown exec keybrightness down ## Keyboard Backlighting #/sys/devices/platform/asus-nb-wmi/leds/asus\:\:kbd_backlight/brightness diff --git a/install.sh b/install.sh index 5f2993d..19177e6 100755 --- a/install.sh +++ b/install.sh @@ -33,7 +33,8 @@ ln -sfv ~/.vim/bundle/vimspectr/shell ~/.vimspectr-shell ln -sfv "$DOTFILES_DIR/run/.profile" ~ ln -sfv "$DOTFILES_DIR/run/.xprofile" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ -ln -sfv "$DOTFILES_DIR/system/.bruise" ~/apps/bruise +ln -sfv "$DOTFILES_DIR/system/.bruise" ~/bin/bruise +ln -sfv "$DOTFILE_DIR/system/.keybrightness" ~/bin/keybrightness ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~ From 832897a82d605fefb51655dd9c29995c39137535 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 11 Dec 2017 23:57:35 -0500 Subject: [PATCH 3/5] Add key backlight --- .i3/config | 7 ++- install.sh | 3 +- system/.keybrightness | 107 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 system/.keybrightness diff --git a/.i3/config b/.i3/config index e510f2a..6c66af9 100755 --- a/.i3/config +++ b/.i3/config @@ -67,8 +67,11 @@ bindsym $mod+XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # m ## requires xbacklight -bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness -bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness +#bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness +#bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness +# increase/decrease keyboard brightness +bindsym XF86KbdBrightnessUp exec keybrightness up +bindsym XF86KbdBrightnessDown exec keybrightness down ## Keyboard Backlighting #/sys/devices/platform/asus-nb-wmi/leds/asus\:\:kbd_backlight/brightness diff --git a/install.sh b/install.sh index 5f2993d..19177e6 100755 --- a/install.sh +++ b/install.sh @@ -33,7 +33,8 @@ ln -sfv ~/.vim/bundle/vimspectr/shell ~/.vimspectr-shell ln -sfv "$DOTFILES_DIR/run/.profile" ~ ln -sfv "$DOTFILES_DIR/run/.xprofile" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ -ln -sfv "$DOTFILES_DIR/system/.bruise" ~/apps/bruise +ln -sfv "$DOTFILES_DIR/system/.bruise" ~/bin/bruise +ln -sfv "$DOTFILE_DIR/system/.keybrightness" ~/bin/keybrightness ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~ diff --git a/system/.keybrightness b/system/.keybrightness new file mode 100644 index 0000000..a4ccdf7 --- /dev/null +++ b/system/.keybrightness @@ -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 From 84951b7f5325cfb345bdbfb1950a64669bfc1f3c Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 12 Dec 2017 00:07:44 -0500 Subject: [PATCH 4/5] Fix symlink and make it executable --- install.sh | 2 +- system/.keybrightness | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 system/.keybrightness diff --git a/install.sh b/install.sh index 19177e6..a120ce0 100755 --- a/install.sh +++ b/install.sh @@ -34,7 +34,7 @@ ln -sfv "$DOTFILES_DIR/run/.profile" ~ ln -sfv "$DOTFILES_DIR/run/.xprofile" ~ ln -sfv "$DOTFILES_DIR/run/.bashrc" ~ ln -sfv "$DOTFILES_DIR/system/.bruise" ~/bin/bruise -ln -sfv "$DOTFILE_DIR/system/.keybrightness" ~/bin/keybrightness +ln -sfv "$DOTFILES_DIR/system/.keybrightness" ~/bin/keybrightness ln -sfv "$DOTFILES_DIR/git/.gitconfig" ~ ln -sfv "$DOTFILES_DIR/system/.vimrc" ~ ln -sfv "$DOTFILES_DIR/system/.dir_colors" ~ diff --git a/system/.keybrightness b/system/.keybrightness old mode 100644 new mode 100755 From bf32658cfc01aaecbc473d001e956b882288815b Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 12 Dec 2017 00:59:03 -0500 Subject: [PATCH 5/5] Uncomment screen backlight --- .i3/config | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.i3/config b/.i3/config index 6c66af9..c638dd9 100755 --- a/.i3/config +++ b/.i3/config @@ -67,14 +67,12 @@ bindsym $mod+XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # m ## requires xbacklight -#bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness -#bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness -# increase/decrease keyboard brightness -bindsym XF86KbdBrightnessUp exec keybrightness up -bindsym XF86KbdBrightnessDown exec keybrightness down +bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness +bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness ## 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 bindsym $mod+h focus left