awesomewm-vim-tmux-navigator/tmux_focus.sh

19 lines
613 B
Bash
Raw Normal View History

2020-03-22 23:19:52 +01:00
#!/bin/bash
dir=$1
wm_focus() {
awesome-client 'require("awful.client").focus.global_bydirection("'"$dir"'")'
}
case "$dir" in
"left")
if [ "$(tmux display-message -p '#{pane_at_left}')" -ne 1 ]; then tmux select-pane -L; else wm_focus; fi ;;
"right")
if [ "$(tmux display-message -p '#{pane_at_right}')" -ne 1 ]; then tmux select-pane -R; else wm_focus; fi ;;
"up")
if [ "$(tmux display-message -p '#{pane_at_top}')" -ne 1 ]; then tmux select-pane -U; else wm_focus; fi ;;
"down")
if [ "$(tmux display-message -p '#{pane_at_bottom}')" -ne 1 ]; then tmux select-pane -D; else wm_focus; fi ;;
esac