Integrate i3 and Emacs
Super shared KBDs between i3wm and Emacs for: - focusing windows (i.e. M-{h,j,k,l}) - deleting windows (i.e. M-q) More support may be needed, but this is good DWIM behavior for now.
This commit is contained in:
parent
0c012554b9
commit
e6c5065b5b
2 changed files with 63 additions and 10 deletions
|
@ -12,8 +12,17 @@ gaps inner 20
|
||||||
gaps outer 0
|
gaps outer 0
|
||||||
smart_gaps on
|
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
|
# 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
|
# start a terminal
|
||||||
bindsym $mod+Return exec terminator
|
bindsym $mod+Return exec terminator
|
||||||
|
@ -25,16 +34,16 @@ for_window [class="^.*"] border pixel 0
|
||||||
focus_follows_mouse no
|
focus_follows_mouse no
|
||||||
|
|
||||||
# kill focused window
|
# kill focused window
|
||||||
bindsym $mod+q kill
|
bindsym $mod+q exec ~/.config/i3/i3-navigate-emacs quit
|
||||||
|
|
||||||
# start dmenu (a program launcher)
|
# 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
|
# change focus
|
||||||
bindsym $mod+h focus left
|
bindsym $mod+h exec ~/.config/i3/i3-navigate-emacs left
|
||||||
bindsym $mod+j focus down
|
bindsym $mod+j exec ~/.config/i3/i3-navigate-emacs down
|
||||||
bindsym $mod+k focus up
|
bindsym $mod+k exec ~/.config/i3/i3-navigate-emacs up
|
||||||
bindsym $mod+l focus right
|
bindsym $mod+l exec ~/.config/i3/i3-navigate-emacs right
|
||||||
|
|
||||||
# move focused window
|
# move focused window
|
||||||
bindsym $mod+Shift+h move left
|
bindsym $mod+Shift+h move left
|
||||||
|
@ -44,6 +53,11 @@ bindsym $mod+Shift+l move right
|
||||||
|
|
||||||
# split in vertical orientation
|
# split in vertical orientation
|
||||||
bindsym $mod+v split v
|
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
|
# enter fullscreen mode for the focused container
|
||||||
bindsym $mod+z fullscreen toggle
|
bindsym $mod+z fullscreen toggle
|
||||||
|
@ -121,10 +135,8 @@ mode "resize" {
|
||||||
|
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
|
|
||||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
|
||||||
# finds out, if available)
|
|
||||||
bar {
|
bar {
|
||||||
status_command i3status
|
status_command i3status
|
||||||
position top
|
position top
|
||||||
font pango:monospace 14
|
font pango:monospace 12
|
||||||
}
|
}
|
||||||
|
|
41
configs/linux/misc/.config/i3/i3-navigate-emacs
Executable file
41
configs/linux/misc/.config/i3/i3-navigate-emacs
Executable file
|
@ -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
|
Loading…
Reference in a new issue