blob: 20b1e77bdb85955e88859ee232417cbc060607f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash
if command -v xgetres >/dev/null 2>&1; then
declare BG FG
BG="$(xgetres background)"
FG="$(xgetres foreground)"
for i in {0..15}; do
# shellcheck disable=SC2140
declare "COLOR_${i}"="$(xgetres color"${i}")"
done
declare SEQ=
for i in {0..15}; do
COLOR="COLOR_${i}"
SEQ+="\\e]4;${i};${!COLOR}\\e\\\\"
unset "COLOR_${i}"
done
SEQ+="\\e]10;${FG}\\e\\\\"
SEQ+="\\e]11;${BG}\\e\\\\"
SEQ+="\\e]708;${BG}\\e\\\\"
SEQ+="\\e]12;${FG}\\e\\\\"
unset BG FG
shopt -s extglob
for i in /dev/pts/*[0-9]; do
if [ -w "${i}" ]; then
printf %b "${SEQ}" >"${i}"
fi
done
unset SEQ
fi
|