Created
July 18, 2020 04:13
-
-
Save aeghn/1ddf7941f9ed19135479e20a074651e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Aeghn | |
# Jump between Emacs and i3wm | |
WM_CLASS_STRING=$(xprop -id $(xdotool getwindowfocus) WM_CLASS) | |
WM_CLASS_STRING=${WM_CLASS_STRING##* } | |
emacsclient=~/.local/bin/emacsclient | |
# get_side_window() { | |
# echo "(select-window (let ((window nil)) | |
# (while (window-in-direction '${1} window) | |
# (setq window (window-in-direction '${1} window))) | |
# window))" | |
# } | |
case $1 in | |
i) [ "${WM_CLASS_STRING}" == '"Emacs"' ] &&\ | |
$emacsclient -e "(windmove-left)" ||\ | |
i3-msg 'focus left' | |
;; | |
o) [ "${WM_CLASS_STRING}" == '"Emacs"' ] &&\ | |
$emacsclient -e "(windmove-right)" ||\ | |
i3-msg 'focus right' | |
;; | |
p) [ "${WM_CLASS_STRING}" == '"Emacs"' ] &&\ | |
$emacsclient -e "(windmove-up)" ||\ | |
i3-msg 'focus up' | |
;; | |
n) [ "${WM_CLASS_STRING}" == '"Emacs"' ] &&\ | |
$emacsclient -e "(windmove-down)" ||\ | |
i3-msg 'focus down' | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment