From a1f72d0eb387e121e694a0b47673878ead1d765f Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sun, 24 Dec 2017 00:47:28 +0100 Subject: [PATCH] Add brightness block --- .config/i3/blocks | 21 +++++++++++---------- .config/i3/config | 7 ++++++- .config/i3/scripts/brightness.sh | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100755 .config/i3/scripts/brightness.sh diff --git a/.config/i3/blocks b/.config/i3/blocks index 52d5bd8..5b69142 100644 --- a/.config/i3/blocks +++ b/.config/i3/blocks @@ -42,10 +42,21 @@ instance=Master interval=1 signal=10 +[brightness] +label= +command=$HOME/.config/i3/scripts/brightness.sh +interval=1 + # Network interface monitoring # # If the instance is not specified, use the interface used for default route. # The address can be forced to IPv4 or IPv6 with -4 or -6 switches. +[wifi] +label= +#instance=wlp3s0 +interval=10 +separator=true + [iface] label= #instance=wlan0 @@ -53,12 +64,6 @@ label= interval=10 separator=true -[wifi] -label= -#instance=wlp3s0 -interval=10 -separator=true - #[bandwidth] #instance=eth0 #interval=5 @@ -73,10 +78,6 @@ label= #instance=1 interval=30 -[load_average] -label= -interval=1 - # Date Time # [time] diff --git a/.config/i3/config b/.config/i3/config index 513c337..5d98bd2 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -189,6 +189,8 @@ client.urgent $bg-color-urgent $bg-color-urgent $text-color #00FF00 #Keybindings bindsym $mod+Mod1+l exec $HOME/.config/i3/scripts/lock.sh +bindsym $mod+F3 exec xbacklight -inc 10 # increase screen brightness +bindsym $mod+F2 exec xbacklight -dec 10 # increase screen brightness # Window appearance smart_gaps on @@ -198,7 +200,7 @@ hide_edge_borders both for_window [class=".*"] border pixel 2 # Application startup -exec_always --no-startup-id feh --bg-scale $HOME/Pictures/wallpaper.jpg +exec_always --no-startup-id feh --bg-fill $HOME/Pictures/wallpaper.jpg exec --no-startup-id firefox exec --no-startup-id urxvt exec --no-startup-id thunar --daemon @@ -206,3 +208,6 @@ exec --no-startup-id thunar # Reload Xresources # xrdb -load ~/.Xresources + +# Get window name +# xprop -> WM_CLASS diff --git a/.config/i3/scripts/brightness.sh b/.config/i3/scripts/brightness.sh new file mode 100755 index 0000000..beb6f7d --- /dev/null +++ b/.config/i3/scripts/brightness.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +case $BLOCK_BUTTON in + # right click + 3) xbacklight -set 30;; + + # scroll up + 4) xbacklight -inc 10 ;; + + # scroll down + 5) xbacklight -dec 10 ;; +esac + +printf "%.0f" "$(xbacklight -get)"