commit ee76de246ca9ccd01f141c50c06410398a7d936e
parent 594f553092031bf2a4941cd1eb8165cbe5867359
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sun, 16 Dec 2018 19:31:49 +0100
Change many i3 bindings
Diffstat:
5 files changed, 139 insertions(+), 76 deletions(-)
diff --git a/links/.config/i3/config b/links/.config/i3/config
@@ -1,77 +1,102 @@
-# Super as modifier
-set $mod Mod4
-set $alt Mod1
-
-# Alt as modifier
-#set $mod Mod1
-#set $alt Control
+for_window [class="^.*"] border pixel 2
-font xft:PragmataPro 9
+set $gaps_inner 15
+set $gaps_outer 10
-gaps inner 10
-gaps outer 0
+set $term --no-startup-id st
+set $mod Mod4
+set $stoprec --no-startup-id dmenurecord kill
+set $shutdown sudo -A shutdown -h now
+set $reboot sudo -A reboot
+set $netrefresh --no-startup-id sudo -A systemctl restart NetworkManager
-# Window style
-# normal: default border, window title
-# 1pixel: 1 pixel border, no window title
-# none: no border, no window title
-#new_window 1pixel
-for_window [class="^.*"] border pixel 2
+font xft:PragmataPro 9
-# color class border backgr. text indicator
-client.focused #232323 #6a6a6a #fdf6e3 #268bd2
-client.focused_inactive #3d3d3d #3d3d3d #839496 #073642
-client.unfocused #232323 #232323 #839496 #073642
-client.urgent #002b36 #dc322f #fdf6e3 #002b36
+gaps inner $gaps_inner
+gaps outer $gaps_outer
+
+# floating tmux session, later bound to mod+u.
+# for_window [instance="tmuxdd"] floating enable
+# for_window [instance="tmuxdd"] resize set 625 450
+# for_window [instance="tmuxdd"] move scratchpad
+# for_window [instance="tmuxdd"] border pixel 3
+# for_window [instance="tmuxdd"] sticky enable
+
+# Set Xresources colors:
+set_from_resource $darkblack color0 #000000
+set_from_resource $black color8 #000000
+set_from_resource $darkred color1 #000000
+set_from_resource $red color9 #000000
+set_from_resource $darkgreen color2 #000000
+set_from_resource $green color10 #000000
+set_from_resource $darkyellow color3 #000000
+set_from_resource $yellow color11 #000000
+set_from_resource $darkblue color4 #000000
+set_from_resource $blue color12 #000000
+set_from_resource $darkmagenta color5 #000000
+set_from_resource $magenta color13 #000000
+set_from_resource $darkcyan color6 #000000
+set_from_resource $cyan color14 #000000
+set_from_resource $darkwhite color7 #000000
+set_from_resource $white color15 #000000
+set $transparent #00000000
+
+# color class border backgr. text indicator
+client.focused $red $red $magenta $darkmagenta $darkblue
+client.unfocused $transparent $blue $white $darkblue $darkblack
+client.focused_inactive $transparent $blue $white $darkblue $darkblack
+client.urgent $darkred $darkred $black $darkred $darkred
+client.background $black
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
-bindsym $mod+Return exec st -e tmux
-bindsym $mod+Shift+Return exec st
+bindsym $mod+Return exec $term
+bindsym $mod+Shift+Return exec $term -e tmux
# other application launchers
+bindsym $mod+m exec $term -e tmux
+bindsym $mod+w exec $term -e nmtui
+bindsym $mod+i exec $term -e htop
bindsym $mod+b exec firefox
-bindsym $mod+t exec tor-browser
+bindsym $mod+Shift+b exec tor-browser
bindsym $mod+p exec zathura
bindsym Mod1+Mod4+l exec --no-startup-id ~/bin/keyboard-layout-switch.sh && notify-send `cat ~/.kbd-layout` && pkill -RTMIN+3 i3blocks
-bindsym $mod+n exec st -e ranger
+bindsym $mod+n exec $term -e ranger
# volume control with alsamixer
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master 3%+ unmute && pkill -RTMIN+4 i3blocks
bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master 3%- unmute && pkill -RTMIN+4 i3blocks
bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle && pkill -RTMIN+4 i3blocks
bindsym XF86AudioMicMute exec --no-startup-id amixer set 'Mic Mute' toggle && pkill -RTMIN+4 i3blocks
-# bindsym $mod+Shift+i exec --no-startup-id amixer set Master 3%+ unmute && pkill -RTMIN+4 i3blocks
-# bindsym $mod+Shift+o exec --no-startup-id amixer set Master 3%- unmute && pkill -RTMIN+4 i3blocks
-# bindsym $mod+Shift+m exec --no-startup-id amixer set Master toggle && pkill -RTMIN+4 i3blocks
# interactive dialogs
-bindsym $mod+u exec --no-startup-id /home/ad/bin/dmenuunicode
-bindsym $mod+m exec --no-startup-id /home/ad/bin/dmenumount
-bindsym $mod+Shift+m exec --no-startup-id /home/ad/bin/dmenuumount
+bindsym $mod+grave exec --no-startup-id dmenuunicode
+bindsym $mod+F9 exec --no-startup-id dmenumount
+bindsym $mod+F10 exec --no-startup-id dmenuumount
# keyboard backlight
bindsym XF86KbdBrightnessDown exec --no-startup-id /home/ad/bin/kbd_backlight.sh down
bindsym XF86KbdBrightnessUp exec --no-startup-id /home/ad/bin/kbd_backlight.sh up
# mpd control
-bindsym Control+Shift+p exec --no-startup-id mpc -h localhost toggle && pkill -RTMIN+14 i3blocks
-bindsym Control+Shift+n exec --no-startup-id mpc -h localhost next && pkill -RTMIN+14 i3blocks
-bindsym Control+Shift+b exec --no-startup-id mpc -h localhost prev && pkill -RTMIN+14 i3blocks
-bindsym Control+Shift+s exec --no-startup-id mpc -h localhost stop && pkill -RTMIN+14 i3blocks
+bindsym Control+Shift+p exec --no-startup-id mpc toggle && pkill -RTMIN+14 i3blocks
+bindsym Control+Shift+n exec --no-startup-id mpc next && pkill -RTMIN+14 i3blocks
+bindsym Control+Shift+b exec --no-startup-id mpc prev && pkill -RTMIN+14 i3blocks
+bindsym Control+Shift+s exec --no-startup-id mpc stop && pkill -RTMIN+14 i3blocks
# configure displays
-bindsym $mod+Shift+d exec --no-startup-id bash /home/ad/code/dotfiles/bin/xrandr-auto.sh
+#bindsym $mod+Shift+d exec --no-startup-id bash /home/ad/code/dotfiles/bin/xrandr-auto.sh
bindsym XF86Display exec --no-startup-id bash /home/ad/code/dotfiles/bin/xrandr-auto.sh
bindsym $mod+Shift+a exec --no-startup-id bash /home/ad/bin/wallpaper.sh && xrandr --auto
bindsym XF86Launch1 exec --no-startup-id bash /home/ad/bin/wallpaper.sh && xrandr --auto
# screen lock
-bindsym $mod+z exec /home/ad/bin/zzz
-bindsym $mod+x exec /home/ad/bin/xlock
+#bindsym $mod+z exec /home/ad/bin/zzz
+#bindsym $mod+x exec /home/ad/bin/xlock
bindsym XF86ScreenSaver exec /home/ad/bin/xlock
+bindsym XF86Sleep exec /home/ad/bin/zzz
# kill focused window
bindsym $mod+Shift+q kill
@@ -92,19 +117,17 @@ bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# split in horizontal orientation
+bindsym $mod+t split toggle
bindsym $mod+Control+l split h
-
-# split in vertical orientation
-#bindsym $alt+j split v
bindsym $mod+Control+j split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen
# change container layout (stacked, tabbed, toggle split)
-bindsym $mod+s layout stacking
-bindsym $mod+w layout tabbed
-bindsym $mod+e layout toggle split
+#bindsym $mod+s layout stacking
+#bindsym $mod+w layout tabbed
+#bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+f floating toggle
@@ -149,19 +172,24 @@ bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
+# configure gap spacing
+bindsym $mod+s gaps inner current plus 5
+bindsym $mod+Shift+s gaps inner current minus 5
+bindsym $mod+Shift+d gaps inner current set 0; gaps outer current set 0
+bindsym $mod+z gaps outer current plus 5
+bindsym $mod+Shift+z gaps outer current minus 5
+bindsym $mod+Shift+t gaps inner current set $gaps_inner; gaps outer current set $gaps_outer
+
+#bindsym $mod+u exec --no-startup-id ddspawn tmuxdd
+bindsym $mod+o sticky toggle
+
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
- bindsym h resize shrink width 10 px or 10 ppt
- bindsym j resize grow height 10 px or 10 ppt
- bindsym k resize shrink height 10 px or 10 ppt
- bindsym l resize grow width 10 px or 10 ppt
-
- # same bindings, but for the arrow keys
- bindsym Left resize shrink width 10 px or 10 ppt
- bindsym Down resize grow height 10 px or 10 ppt
- bindsym Up resize shrink height 10 px or 10 ppt
- bindsym Right resize grow width 10 px or 10 ppt
+ bindsym h resize shrink width 5 px or 5 ppt
+ bindsym j resize grow height 5 px or 5 ppt
+ bindsym k resize shrink height 5 px or 5 ppt
+ bindsym l resize grow width 5 px or 5 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
@@ -170,35 +198,35 @@ mode "resize" {
bindsym $mod+r mode "resize"
-# Start i3bar to display a workspace bar (plus the system information i3blocks
-# finds out, if available)
bar {
status_command i3blocks -c ~/.config/i3/i3blocks
- #status_command conky -c ~/.config/i3/conkyrc
- #position top
- position bottom
+ position top
+ #position bottom
mode dock
- #mode hide
workspace_buttons yes
- #tray_output none
- #tray_output primary
colors {
- # colorclass <border> <backgr.> <text>
- background #111111
- statusline #ffffff
- separator #333333
- focused_workspace #4c7899 #285577 #ffffff
- active_workspace #333333 #5f676a #ffffff
- inactive_workspace #333333 #222222 #888888
- urgent_workspace #2f343a #900000 #ffffff
+ background $darkblack
+ statusline $darkwhite
+ separator $cyan
+ # colorclass <border> <backgr.> <text>
+ focused_workspace $blue $darkblue $darkblack
+ active_workspace $blue $blue $darkwhite
+ inactive_workspace $darkblack $darkblack $white
+ urgent_workspace $darkblack $darkblack $white
}
}
+bindsym $mod+F5 exec --no-startup-id $netrefresh
+bindsym $mod+Shift+F5 exec $term -e nmtui
+#bindsym XF86WLAN exec $term -e nmtui
+
# auto-start programs
+exec --no-startup-id mpd ~/.mpd/mpd.conf
+exec --no-startup-id eval "$(gpg-agent)"
+exec --no-startup-id eval "$(ssh-agent)"
+exec --no-startup-id eval "ssh-add"
exec --no-startup-id unclutter
#exec --no-startup-id xcompmgr
-exec --no-startup-id nm-applet
-exec --no-startup-id i3-msg 'workspace 2; exec firefox; layout tabbed'
-exec --no-startup-id i3-msg 'workspace 1; exec st -e tmux-utility.sh'
+exec --no-startup-id i3-msg 'workspace 2; exec firefox; sleep 2; layout tabbed; workspace 1; exec st -e tmux-utility.sh'
diff --git a/links/.config/i3/i3blocks b/links/.config/i3/i3blocks
@@ -120,6 +120,6 @@ signal=15
interval=30
[time]
-command=date '+%Y-%m-%d %H:%M:%S'
+command=date '+%Y-%m-%d %H:%M:%S '
interval=5
signal=13
diff --git a/links/.profile b/links/.profile
@@ -3,6 +3,7 @@ export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export MAILDIR=~/mail
[ "$(hostname)" = "idkfa" ] && export TERMINAL=st
+export BROWSER=firefox
# shellcheck source=/dev/null
[ -f ~/.secret_env_vars ] && . ~/.secret_env_vars
diff --git a/links/.tmux.conf b/links/.tmux.conf
@@ -45,7 +45,8 @@ set -g status-left ""
# Right section of status bar
#if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//' | cut -c 1-22) #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%R\""
if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//') #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%F #[fg=#bababa]%R\""
-if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(acpi|sed 's/Battery//; s/0://; s/Discharging//; s/Full, //; s/remaining//; s/ , //; s/Charging, /+/; s/ until charged/ /; s/, / /; s/Unknown //; s/ $//;') #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\""
+
+if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(~/bin/battery-linux) #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\""
# Scaling of status-bar sections
set -g status-right-length 40
diff --git a/links/bin/battery-linux b/links/bin/battery-linux
@@ -1,2 +1,35 @@
#!/bin/sh
-acpi | sed 's/Battery//; s/0://; s/Discharging//; s/Full, //; s/remaining//; s/ , //; s/Charging, /+/; s/ until charged/ /; s/, / /; s/Unknown //; s/ $//;'
+# Give a battery name (e.g. BAT0) as an optional argument.
+battery=${1:-BAT0}
+
+case $BLOCK_BUTTON in
+ 3) pgrep -x dunst >/dev/null && notify-send "<b>🔋 Battery module:</b>
+🔋: discharging
+♻: stagnant charge
+🔌: charging
+⚡: charged
+❗: battery very low!
+- Text color reflects charge left" ;;
+esac
+
+capacity=$(cat /sys/class/power_supply/"$battery"/capacity) || exit
+status=$(cat /sys/class/power_supply/"$battery"/status)
+
+if [ "$capacity" -ge 80 ]; then
+ color="#b8bb26"
+elif [ "$capacity" -ge 60 ]; then
+ color="#ebdbb2"
+elif [ "$capacity" -ge 40 ]; then
+ color="#fabd2f"
+elif [ "$capacity" -ge 20 ]; then
+ color="#fe8019"
+else
+ color="#fb4934"
+ warn="❗"
+fi
+
+[ -z $warn ] && warn=" "
+
+[ "$status" = "Charging" ] && color="#FFF"
+
+printf "%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"