[terminal.sh] Use lswt instead of swaymsg
to support all compositors that support either ext-foreign-toplevel-list-v1 or wlr-foreign-toplevel-management-unstable-v1
This commit is contained in:
parent
cf073c7e92
commit
936ab71626
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue