diff --git a/files/sh/.config/bash/bashrc b/files/sh/.config/bash/bashrc index 022e466..d62f6e8 100644 --- a/files/sh/.config/bash/bashrc +++ b/files/sh/.config/bash/bashrc @@ -124,7 +124,7 @@ if ! shopt -oq posix; then source_readable /usr/share/bash-completion/bash_completion fi -unset newline ps1_symbol dircolor reset_color usercolor +unset newline ps1_symbol dircolor usercolor ## }}} ## {{{ Plugins if has zoxide; then diff --git a/files/sh/.config/sh/shrc b/files/sh/.config/sh/shrc index f9be870..4c1916f 100644 --- a/files/sh/.config/sh/shrc +++ b/files/sh/.config/sh/shrc @@ -111,7 +111,8 @@ has qubesctl && { alias qctlu="qctl --skip-dom0 --targets" qctlus(){ test -n "${2-}" || return 1 - qubesctl --skip-dom0 --targets "${1}" state.apply "${@}" + # shellcheck disable=SC3058 + qubesctl --skip-dom0 --targets "${1}" state.apply "${@#"${1}"}" } } has gpg && alias gpgs="gpg --show-keys" @@ -162,16 +163,19 @@ case "${TERM-}" in iterm|*-truecolor) export COLORTERM=truecolor; color_prompt=yes ;; - *-color|*-256color|linux*) + *-color|*-256color|linux*|vt100*|vt220*) color_prompt=yes ;; - ""|dumb|vt100*|vt220*) + ""|dumb) color_prompt=no ;; *) color_prompt=no ;; esac +if test -n "${NO_COLOR-}"; then + color_prompt=no +fi ## Colorise "ls" output. if test "${color_prompt-}" = "yes"; then diff --git a/files/sh/.config/zsh/.zshrc b/files/sh/.config/zsh/.zshrc index da7682e..cb8ce37 100644 --- a/files/sh/.config/zsh/.zshrc +++ b/files/sh/.config/zsh/.zshrc @@ -99,11 +99,11 @@ _set_title() { } case "${TERM-}" in - screen*) + screen*|tmux*) precmd() { _set_title "$@" if [ "${STY:-}" -o "${TMUX:-}" ]; then - # print -Pn "\033]1;\a\033]1;@%m\a" + print -Pn '\033]1;\a\033]1;@%m\a' print -Pn '\033k@\033\\' else print -Pn '\033k@%m\033\\' diff --git a/files/sh/.local/bin/resize-terminal b/files/sh/.local/bin/resize-terminal index 7ad40d8..31f6fe2 100755 --- a/files/sh/.local/bin/resize-terminal +++ b/files/sh/.local/bin/resize-terminal @@ -1,6 +1,6 @@ #!/bin/sh -## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. +## SPDX-FileCopyrightText: 2024 - 2025 Benjamin Grande M. S. ## ## SPDX-License-Identifier: GFDL-1.3-or-later ## @@ -46,6 +46,12 @@ if test "${#}" -eq 0; then unset term_file_active fi +sc="$(tput sc || printf '%b' '\0337')" +rc="$(tput rc || printf '%b' '\0338')" +cup="$(tput cup 99999 99999 || printf '%b' '\033[99999;99999H')" +csr="$(tput csr || printf '%b' '\033[r')" +gc="$(tput u7 || printf '%b' '\033[6n')" + ## POSIX compliant. # shellcheck disable=SC3045 if ! printf '%s\n' "R" | read -r -t 1 -sd R 2>/dev/null; then @@ -58,7 +64,7 @@ if ! printf '%s\n' "R" | read -r -t 1 -sd R 2>/dev/null; then ## Slow due to heavy stty calls. termios="$(stty -g)" stty raw -echo min 0 time 1 - printf '\0337\033[r\033[99999;99999H\033[6n\0338' >/dev/tty + printf '%s' "${sc}${csr}${cup}${gc}${rc}" >/dev/tty IFS='[;R' read -r _ rows cols _ /dev/tty +printf '%s' "${sc}${csr}${cup}${gc}${rc}" >/dev/tty # shellcheck disable=3045,SC2034 IFS='[;R' read -r -t 1 -s -d R _ rows cols _ &2 diff --git a/files/tmux/.config/tmux/tmux.conf b/files/tmux/.config/tmux/tmux.conf index 425a5d3..045fb28 100644 --- a/files/tmux/.config/tmux/tmux.conf +++ b/files/tmux/.config/tmux/tmux.conf @@ -17,8 +17,7 @@ set-option -g history-limit 10000 set-option -g repeat-time 2000 set-option -g escape-time 50 set-option -g status-position top -set-option -g default-terminal screen-256color -# set-option -g default-terminal tmux-256color # on newer ncurses +set-option -g default-terminal tmux-256color set-option -g display-panes-time 2000 set-option -g display-time 2000 set-option -g focus-events on diff --git a/files/x11/.config/x11/xprofile b/files/x11/.config/x11/xprofile index 75a8f7f..07a860b 100755 --- a/files/x11/.config/x11/xprofile +++ b/files/x11/.config/x11/xprofile @@ -48,12 +48,34 @@ desktop_autostart(){ for f in "${autostart_etc}"/*.desktop "${autostart_home}"/*.desktop; do test -r "${f}" || continue + ## TODO: check other conditions: (Not|Only)ShowIn # shellcheck disable=SC2091 + autostart_hidden="$(awk -F '=' -- '/^Hidden=/{print $2}' "${f}")" + if test "${autostart_hidden}" = "true"; then + continue + fi + autostart_tryexec="$(awk -F '=' -- '/^TryExec=/{print $2}' "${f}")" + if test -n "${autostart_tryexec}"; then + case "${autostart_tryexec}" in + /*) test -x "${autostart_tryexec}" || continue;; + *) command -v "${autostart_tryexec}" >/dev/null || continue;; + esac + fi + autostart_path="$(awk -F '=' -- '/^Path=/{print $2}' "${f}")" autostart_exec="$(awk -F '=' -- '/^Exec=/{print $2}' "${f}")" - command -v "${autostart_exec%% *}" >/dev/null || continue + case "${autostart_exec}" in + /*) test -x "${autostart_exec}" || continue;; + *) command -v "${autostart_exec}" >/dev/null || continue;; + esac + if test -n "${autostart_path}"; then + if ! test -d "${autostart_path}"; then + continue + fi + cd "${autostart_path}" || continue + fi ${autostart_exec} & done - unset f + unset f autostart_hidden autostart_tryexec autostart_exec autostart_path } ## Source Xorg profiles.