From fcf8d0c0246b353f255eb5173cd8cd3748f8da3b Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Thu, 1 Jan 1970 03:00:00 +0300 Subject: chore: init --- pts-reload | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 pts-reload (limited to 'pts-reload') diff --git a/pts-reload b/pts-reload new file mode 100755 index 0000000..20b1e77 --- /dev/null +++ b/pts-reload @@ -0,0 +1,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 -- cgit 1.4.1