st-flexipatch/patch
step 9edb8d86fb
Add xresources-xdefaults patch (#195)
* Add xresources-xdefaults patch

This patch adds the ability to configure st via Xdefaults, in addition
to Xresources, like the rxvt-unicode terminal. At startup, st will read
and apply the system and user's local Xdefault files, the XServer's
Xresources, and the screen and per-host Xdefaults. This patch depends
on XRESOURCES_PATCH and is compatible with XRESOURCES_RELOAD_PATCH.

I used the following script to stress test this patch. You can also use
the script to demo what the patch does. To be simple, it only tests
the user's .Xdefaults and .Xresources files, without throwing in the
system and per-host files. The script cycles st's background through
red, green and blue indefinitely.

BACKUP YOUR ~/.Xdefaults and ~/.Xresources FILES BEFORE TESTING.

```sh

unset pid
if [ -n "$1" ]; then
	pid=$1
elif pid=$(pgrep -f ^valgrind) && [ -n "$pid" ]; then
	:
else
	pid=$(pgrep -n ^st$)
fi
if [ -z "$pid" -o "x$pid" = "x-h" -o "x$pid" = "x--help" ]; then
	echo "usage: $0 [pid]
	If pid is omitted valgrind's is used falling back to st's.
	---------------------------------------------------------------
	BACKUP YOUR ~/.Xdefaults and ~/.Xresources FILES BEFORE TESTING
	---------------------------------------------------------------"
	exit 0
fi
printf "Attaching pid=%d\n\t%s\n" "$pid" "$(ps -h -ocmd "$pid")" >&2

seconds=0.25 red='#800000' green='#008000' blue='#000080'
echo "St.background: $red" >> $HOME/.Xdefaults
while true; do
	sed -i "\$s/$red/$green/" $HOME/.Xdefaults
	kill -USR1 $pid
	sleep $seconds
	sed -i "\$s/$green/$red/" $HOME/.Xdefaults
	kill -USR1 $pid
	sleep $seconds

	echo "St.background: $blue" >> $HOME/.Xresources
	xrdb -load $HOME/.Xresources
	kill -USR1 $pid
	sleep $seconds
	sed -i '$d' $HOME/.Xresources
	xrdb -load $HOME/.Xresources
	kill -USR1 $pid
	sleep $seconds
done
```

* Minor refactoring and freeing / destroying the Xrm database with XrmDestroyDatabase

---------

Co-authored-by: Bakkeby <bakkeby@gmail.com>
2026-01-30 08:59:28 +01:00
..
alpha.c alpha: remove debug print statements from changealpha 2022-10-01 08:37:17 +02:00
alpha.h Add function for changing alpha (#47) 2022-09-24 11:04:38 +02:00
background_image_x.c Adding background image reload patch ref. pull request #62 2022-04-11 16:04:58 +02:00
background_image_x.h Adding background image reload patch ref. pull request #62 2022-04-11 16:04:58 +02:00
boxdraw.c Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
boxdraw.h Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
copyurl.c copyurl: upgrading to support non-ascii URLs ref. #21 2021-05-09 08:08:51 +02:00
copyurl.h Adding copyurl and disable-fonts patch 2019-09-16 10:40:16 +02:00
drag-n-drop.c Adding drag-n-drop patch 2025-02-20 10:18:17 +01:00
drag-n-drop.h Adding drag-n-drop patch 2025-02-20 10:18:17 +01:00
externalpipe.c Refactoring sigchld ref. #156 (#159) 2024-11-25 20:48:52 +01:00
externalpipe.h [st][PATCH] externalpipe and externalpipein 2020-04-20 13:06:39 +02:00
fixkeyboardinput.c dedup XK_Z in fixkeyboardinput.c (#87) 2022-10-15 15:40:39 +02:00
font2.c font2: adding use XftFontMatch patch compatibility 2022-08-29 09:50:47 +02:00
font2.h Adding font2 patch as per request #3 2020-03-21 16:41:43 +01:00
fullscreen_x.c Adding fullscreen patch ref. #88 2022-10-24 11:27:51 +02:00
fullscreen_x.h Adding fullscreen patch ref. #88 2022-10-24 11:27:51 +02:00
invert.c Adding invert patch 2020-03-29 15:38:16 +02:00
invert.h Adding invert patch 2020-03-29 15:38:16 +02:00
iso14755.c Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
iso14755.h Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
keyboardselect_reflow.txt Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_reflow_st.c Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_reflow_st.h Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_reflow_x.c Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_reflow_x.h Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_st.c Fixed a glitch when using using the keyboardselect and scrollback patches. (#48) 2022-10-17 13:39:34 +02:00
keyboardselect_st.h Adding note about flexipatch-finalizer 2019-10-16 12:05:53 +02:00
keyboardselect_x.c Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
keyboardselect_x.h Adding note about flexipatch-finalizer 2019-10-16 12:05:53 +02:00
netwmicon.c netwmicon: upgrading patch and adding farbfeld variant (#121) 2024-03-13 10:35:17 +01:00
netwmicon.h netwmicon: upgrading patch and adding farbfeld variant (#121) 2024-03-13 10:35:17 +01:00
netwmicon_ff.c netwmicon_ff - increase buffer size to 16 2024-03-13 11:56:11 +01:00
netwmicon_icon.h netwmicon: upgrading patch and adding farbfeld variant (#121) 2024-03-13 10:35:17 +01:00
netwmicon_legacy.c netwmicon: upgrading patch and adding farbfeld variant (#121) 2024-03-13 10:35:17 +01:00
newterm.c Refactoring sigchld ref. #156 (#159) 2024-11-25 20:48:52 +01:00
newterm.h osc7: initial patch implementation (#154) 2024-10-15 09:54:45 +02:00
opencopied.c Adding fixime, newterm and opencopied patches 2019-09-16 12:40:07 +02:00
opencopied.h Adding fixime, newterm and opencopied patches 2019-09-16 12:40:07 +02:00
openselectedtext.c Adding open selected text patch 2025-02-20 22:36:51 +01:00
openselectedtext.h Adding open selected text patch 2025-02-20 22:36:51 +01:00
openurlonclick.c Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
openurlonclick.h openurlonclick: using posix_spawnp instead of system ref. comments in #76 2022-08-11 15:04:44 +02:00
osc7.c osc7: initial patch implementation (#154) 2024-10-15 09:54:45 +02:00
osc7.h osc7: initial patch implementation (#154) 2024-10-15 09:54:45 +02:00
osc133.c osc133 - changing default configuration options to Ctrl + PgUp/PgDown 2024-10-01 21:39:50 +02:00
osc133.h osc133: initial patch implementation (#127) 2024-10-01 21:35:30 +02:00
reflow.c reflow: addressing selection clearing bug when selection includes the prompt ref. #166 2025-02-26 21:23:09 +01:00
reflow.h Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
rightclicktoplumb_st.c Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
rightclicktoplumb_st.h Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
rightclicktoplumb_x.c Refactoring sigchld ref. #156 (#159) 2024-11-25 20:48:52 +01:00
rightclicktoplumb_x.h Adding relativeborder, fix-keyboard-input, iso14755, visualbell, rightclicktoplumb, boxdraw and keyboard-select patches 2019-09-17 15:16:22 +02:00
scrollback.c Add scrollback support to the openurlonclick patch 2022-08-10 21:32:44 +03:00
scrollback.h Adding universcroll patch ref. #21 2021-05-08 17:49:04 +02:00
st_embedder_x.c Adding st embedder patch 2020-01-07 14:05:53 +01:00
st_embedder_x.h Adding st embedder patch 2020-01-07 14:05:53 +01:00
st_include.c osc7: initial patch implementation (#154) 2024-10-15 09:54:45 +02:00
st_include.h osc7: initial patch implementation (#154) 2024-10-15 09:54:45 +02:00
sync.c Adding sync patch ref. #21 2021-05-09 09:25:22 +02:00
sync.h Adding sync patch ref. #21 2021-05-09 09:25:22 +02:00
x_include.c Adding open selected text patch 2025-02-20 22:36:51 +01:00
x_include.h Adding open selected text patch 2025-02-20 22:36:51 +01:00
xresources.c Add xresources-xdefaults patch (#195) 2026-01-30 08:59:28 +01:00
xresources.h Add xresources-xdefaults patch (#195) 2026-01-30 08:59:28 +01:00