[terminal.sh] Instructions about terminal window title setting
This commit is contained in:
parent
0c5e2dce04
commit
afa8bcc437
1 changed files with 9 additions and 4 deletions
|
@ -1,5 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If a window with a path in its title is focused, open a terminal with that
|
||||||
|
# location as working directory. Like this, terminals are opened in the same
|
||||||
|
# directory as the currently focused one.
|
||||||
|
#
|
||||||
|
# Your shell should set the window title correctly, of course. In most common
|
||||||
|
# terminals this can be achieved with
|
||||||
|
# printf '\033]2;%s@%s:%s\007' "${USER}" "${HOSTNAME%%.*}" "${PWD}"
|
||||||
|
# In bash, you can put this printf in your PROMPT_COMMAND.
|
||||||
|
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
# A failure in this script should not prevent the terminal from opening
|
# A failure in this script should not prevent the terminal from opening
|
||||||
set +e
|
set +e
|
||||||
|
@ -11,10 +20,6 @@ else
|
||||||
CMD=xfce4-terminal
|
CMD=xfce4-terminal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If a window with a path in its title is focused, open a terminal with that
|
|
||||||
# location as working directory. Like this, terminals are opened in the same
|
|
||||||
# directory as the currently focused one.
|
|
||||||
|
|
||||||
focused_window_title() {
|
focused_window_title() {
|
||||||
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
|
||||||
lswt -j | jq -r '.toplevels | map(select(.activated?))[0].title'
|
lswt -j | jq -r '.toplevels | map(select(.activated?))[0].title'
|
||||||
|
|
Loading…
Reference in a new issue