xorg: add XTerm configs

This commit is contained in:
Protesilaos Stavrou 2021-09-25 11:31:26 +03:00
parent 91722ef1bd
commit cf055674bc
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
5 changed files with 213 additions and 0 deletions

100
xorg/.Xresources Normal file
View file

@ -0,0 +1,100 @@
!
! ~/.Xresources
!
! Description
! ===========
!
! This file is part of my dotfiles and is meant to work with the rest of
! my custom desktop session: https://gitlab.com/protesilaos/dotfiles
! Font settings (for programs that do not support fontconfig)
! ===========================================================
Xft*antialias: 1
Xft*rgba: rgb
Xft*autohint: 0
Xft*hinting: 1
Xft*hintstyle: hintslight
Xft*lcdfilter: lcddefault
! xterm
! =====
! Basic settings
xterm*termName: xterm-256color
xterm*locale: true
xterm*utf8: 1
xterm*utf8Fonts: always
xterm*dynamicColors: true
! UI components
xterm*toolBar: false
xterm*scrollBar: false
xterm*geometry: 80x24
xterm*internalBorder: 0
! Cursor
! Allowing the cursor to use the reverse colour of the background or
! foreground avoids circumstances, such as in Vim, where the cursor can
! be virtually impossible to see. Note that this does not work when the
! cursor is not a block character (cursorUnderLine: true).
xterm*cursorColor: reverse
xterm*cursorBlink: true
xterm*cursorOffTime: 300
xterm*cursorOnTime: 800
xterm*cursorUnderLine: false
xterm*pointerShape: XTerm
! Bell
xterm*bellIsUrgent: false
xterm*bellSupressTime: 100
xterm*marginBell: false
xterm*visualBell: true
! Text highlighting
xterm*highlightColor: XtDefaultForeground
xterm*highlightReverse: true
xterm*highlightSelection: true
xterm*highlightTextColor: XtDefaultBackground
! Font settings
xterm*faceName: Monospace
xterm*faceSize: 9
xterm*renderFont: true
xterm*boldColors: false
xterm*faceSize1: 9.5
xterm*faceSize2: 12
xterm*faceSize3: 15
xterm*faceSize4: 18.25
xterm*faceSize5: 20.5
xterm*faceSize6: 25.5
xterm*forceBoxChars: false
xterm*limitFontsets: 5
xterm*scaleHeight: 1.0
! Scroll and output
xterm*jumpScroll: true
xterm*multiScroll: true
xterm*saveLines: 9999
xterm*scrollKey: true
xterm*scrollTtyKeypress: true
xterm*scrollTtyOutput: false
! Backspace behaviour
xterm*backarrowKey: false
xterm*metaSendsEscape: true
xterm*ttyModes: erase ^?
! Key bindings. Use C-S-{c,v} to copy/paste as in GNOME terminal. The
! keys "Prior" and "Next" represent PgUp and PgDown respectively.
xterm*selectToClipboard: true
xterm*translations: #override \n\
Ctrl Shift <KeyPress>C: select-end(SELECT, CLIPBOARD) \n\
Ctrl Shift <KeyPress>V: insert-selection(SELECT, CLIPBOARD) \n\
Ctrl Shift <KeyPress>Next: smaller-vt-font() \n\
Ctrl Shift <KeyPress>Prior: larger-vt-font() \n\
Ctrl Shift <KeyPress>Home: set-vt-font(d)
! DO NOT EDIT THIS. IT IS CONTROLLED PROGRAMMATICALLY.
#include ".config/xterm/xterm_active_theme"

View file

@ -0,0 +1,21 @@
! Theme: modus-operandi
! Description: XTerm port of modus-operandi (Modus themes for Emacs)
! Author: Protesilaos Stavrou, <https://protesilaos.com>
xterm*background: #ffffff
xterm*foreground: #000000
xterm*color0: #000000
xterm*color1: #a60000
xterm*color2: #005e00
xterm*color3: #813e00
xterm*color4: #0031a9
xterm*color5: #721045
xterm*color6: #00538b
xterm*color7: #bfbfbf
xterm*color8: #595959
xterm*color9: #972500
xterm*color10: #315b00
xterm*color11: #70480f
xterm*color12: #2544bb
xterm*color13: #5317ac
xterm*color14: #005a5f
xterm*color15: #ffffff

View file

@ -0,0 +1,21 @@
! Theme: modus-vivendi
! Description: XTerm port of modus-vivendi (Modus themes for Emacs)
! Author: Protesilaos Stavrou, <https://protesilaos.com>
xterm*background: #000000
xterm*foreground: #ffffff
xterm*color0: #000000
xterm*color1: #ff8059
xterm*color2: #44bc44
xterm*color3: #d0bc00
xterm*color4: #2fafff
xterm*color5: #feacd0
xterm*color6: #00d3d0
xterm*color7: #bfbfbf
xterm*color8: #595959
xterm*color9: #ef8b50
xterm*color10: #70b900
xterm*color11: #c0c530
xterm*color12: #79a8ff
xterm*color13: #b6a0ff
xterm*color14: #6ae4b9
xterm*color15: #ffffff

View file

@ -0,0 +1,5 @@
! Part of my dotfiles: <https://gitlab.com/protesilaos/dotfiles>.
!
! IMPORTANT do not edit manually!!! All themes are changed by a single
! script: delight.
#include "modus_operandi.Xcolors"

66
xorg/bin/repaint_terminals Executable file
View file

@ -0,0 +1,66 @@
#!/bin/bash
# repaint_terminals --- Live update term colours using ANSI escape sequences.
#
# Copyright (c) 2019-2021 Protesilaos Stavrou <info@protesilaos.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
## Description
#
# Use ANSI codes to apply theme change to all active terminals. This is
# particularly useful for programs that source their colours at startup,
# requiring a restart to apply a new theme. All terminals I have tested
# respond to the live theme change. Tried with xterm, rxvt-unicode,
# {gnome,mate,xfce4}-terminal, kitty, tilix.
#
# The ANSI escape sequences are defined in this document
# http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#XTerm_Operating_System_Commands
xrdb_col="$(xrdb -query -all | sed '/*color\|foreground\|background*/!d')"
[ -n "$xrdb_col" ] || { echo "ERROR: no xrdb colours."; exit 1; }
# Extract only the colour value of the item passed as an argument.
#
# Normally each line looks like:
# xterm*color10: #315b00
# It becomes:
# #315b00
# NOTE we pass `-w` to `grep` to make sure it matches only whole words.
# Otherwise a 'foreground' would also capture 'foregroundalt'.
_get_hex_value() {
echo "$xrdb_col" | grep -w "$1" | sed 's,.*\(#[a-zA-Z0-9]*\),\1,'
}
# Define ANSI sequences as an empty string (to be incremented). We will
# be creating the sequence and then pass it to all running terminals, to
# update their corresponding colours.
ansi_sequences=""
# Prepare ANSI sequences for colors 0-15.
for i in {0..15}; do
ansi_sequences+="\\033]4;${i};$(_get_hex_value color"${i}")\\007"
done
# Update base values (outside the 16-colour palette). This covers the
# foreground, background, and cursor.
ansi_sequences+="\\033]10;$(_get_hex_value foreground)\\007"
ansi_sequences+="\\033]11;$(_get_hex_value background)\\007"
ansi_sequences+="\\033]17;$(_get_hex_value foreground)\\007"
# Apply ANSI sequences to running terminals.
for term in /dev/pts/[0-9]*; do
printf "%b" "$ansi_sequences" > "$term" &
done