diff --git a/i3/terminal.sh b/i3/terminal.sh index 2c404d3..39248f5 100755 --- a/i3/terminal.sh +++ b/i3/terminal.sh @@ -15,11 +15,15 @@ fi # location as working directory. Like this, terminals are opened in the same # directory as the currently focused one. -sway_focused_window() { - swaymsg -t get_tree | jq -r '.. | select(.focused?) | .name' +focused_window_title() { + if [ -n "${WAYLAND_DISPLAY:-}" ]; then + lswt -j | jq -r '.toplevels | map(select(.activated?))[0] | .title' + else + xtitle + fi } -title="$(sway_focused_window || xtitle)" +title="$(focused_window_title)" path="" if [[ $title =~ (in|^.*@$(hostname):)(~?)(/.*) ]]; then