about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--configs/linux/misc/.config/i3/config32
-rwxr-xr-xconfigs/linux/misc/.config/i3/i3-navigate-emacs41
2 files changed, 63 insertions, 10 deletions
diff --git a/configs/linux/misc/.config/i3/config b/configs/linux/misc/.config/i3/config
index 92b1d0728ac3..e4a241677d1f 100644
--- a/configs/linux/misc/.config/i3/config
+++ b/configs/linux/misc/.config/i3/config
@@ -12,8 +12,17 @@ gaps inner 20
 gaps outer 0
 smart_gaps on
 
+# audio controls
+bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5%
+bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5%
+bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle
+
+# screen brightness controls
+bindsym XF86MonBrightnessUp exec xbacklight -inc 20
+bindsym XF86MonBrightnessDown exec xbacklight -dec 20
+
 # ensure wallpaper
-exec --no-startup-id feh --bg-scale ~/pictures/soft-gradient.jpg
+exec --no-startup-id feh --bg-scale ~/pictures/blurred.jpg
 
 # start a terminal
 bindsym $mod+Return exec terminator
@@ -25,16 +34,16 @@ for_window [class="^.*"] border pixel 0
 focus_follows_mouse no
 
 # kill focused window
-bindsym $mod+q kill
+bindsym $mod+q exec ~/.config/i3/i3-navigate-emacs quit
 
 # start dmenu (a program launcher)
-bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu='rofi -i -dmenu -width 40 -lines 8'
+bindsym Mod4+space exec --no-startup-id i3-dmenu-desktop --dmenu='rofi -i -dmenu -width 40 -lines 8'
 
 # change focus
-bindsym $mod+h focus left
-bindsym $mod+j focus down
-bindsym $mod+k focus up
-bindsym $mod+l focus right
+bindsym $mod+h exec ~/.config/i3/i3-navigate-emacs left
+bindsym $mod+j exec ~/.config/i3/i3-navigate-emacs down
+bindsym $mod+k exec ~/.config/i3/i3-navigate-emacs up
+bindsym $mod+l exec ~/.config/i3/i3-navigate-emacs right
 
 # move focused window
 bindsym $mod+Shift+h move left
@@ -44,6 +53,11 @@ bindsym $mod+Shift+l move right
 
 # split in vertical orientation
 bindsym $mod+v split v
+bindsym $mod+Shift+v split h
+
+# enable duplicating the current window vertically or horizontally
+# bindsym $mod+- split v exec terminator
+# bindsym $mod+\ split h exec terminator
 
 # enter fullscreen mode for the focused container
 bindsym $mod+z fullscreen toggle
@@ -121,10 +135,8 @@ mode "resize" {
 
 bindsym $mod+r mode "resize"
 
-# Start i3bar to display a workspace bar (plus the system information i3status
-# finds out, if available)
 bar {
         status_command i3status
         position top
-        font pango:monospace 14
+        font pango:monospace 12
 }
diff --git a/configs/linux/misc/.config/i3/i3-navigate-emacs b/configs/linux/misc/.config/i3/i3-navigate-emacs
new file mode 100755
index 000000000000..f973c6667f74
--- /dev/null
+++ b/configs/linux/misc/.config/i3/i3-navigate-emacs
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+# Heavily inspired by this blog post:
+# https://bl.ocks.org/mijoharas/b9d09daed9654ca8d0d081015209ecd0
+
+get_focused_window() {
+  i3-msg -t get_tree | jq -r ".. | select(.focused? == true).window_properties.class"
+}
+
+perform_close() {
+  if [ "$(get_focused_window)" = "Emacs" ]; then
+    emacsclient -e "(delete-window)"
+  else
+    i3-msg kill
+  fi
+}
+
+perform_move() {
+  if [ "$(get_focused_window)" = "Emacs" ]; then
+    emacsclient -e "(evil-window-$1 1)"
+    result=$?
+    if [ $result -ne 0 ]; then
+      i3-msg focus "$1"
+    fi
+  else
+    i3-msg focus "$1"
+  fi
+}
+
+case "$1" in
+  left)  ;&
+  right) ;&
+  up)    ;&
+  down)
+    perform_move "$1"
+    ;;
+  quit)
+    perform_close
+    ;;
+  *) echo "command not found" ;;
+esac