* 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>
st would hold on to a XrmDatabase reference for the lifetime of the
program due to how in resource_load the ret.addr of the database
would be referenced directly. This also meant that for every reload
st would be leaking another XrmDatabase reference.
This has been partially worked around by applying a strdup to make
a copy of the string in order to allow for the XrmDatabase to be
freed / destroyed. Consequently the char arrays / strings still
leak on reload.
We could pass *sdst to free beforehand, but that will only work if
that reference is guaranteed to be on the heap.
This fixes the following sixel issues:
- The HLS to RGB color conversion is broken.
Ref. d4ade1fe3c
- Not enough color registers have been allocated for 1024 colors.
Ref. 97f93e8436
This is used in the wild by systemd systemctl for example and st
misinterpreted it as "blink", because it didn't know "58", then saw "5"
as "blink", and then didn't know "245".
This should print "foo" as normal text:
printf '\e[58:5:245mfoo\n'
printf '\e[58:2:50💯200mfoo\n'
Ref.
https://git.suckless.org/st/commit/f114bcedd113017d907aad32031db92c050f4bf3.html
The kitty keyboard protocol docs recommend CSI ? u to query support for
that protocol, see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
For better or worse, fish shell uses this query to work around bugs
in other terminals triggered by requesting that protocol via CSI = 5 u.
Unfortunately, st interprets CSI ? u as DECRC (restore cursor
position). reproduce with 'printf "\x1b[?u"; cat'.
fish could work around this by switching to the alternate screen
before running this query; but that might cause tearing on terminals
that don't support Synchronized Output. I'm not sure.
In the meantime, let's correct our parser.
This adds a redundant else-after-return, for consistency with the
surrounding code.
ref. https://git.suckless.org/st/commit/98610fcd37f655d44586323dc86c1d013c2798ce.html
Signed-off-by: Laurent Cheylus <foxy@free.fr>
Some old clipboard managers, such as greenclip and parcellite,
constantly poll applications with SelectionRequest events, which breaks
the internal timer and blinking cursor. This fix prevents these events
from causing any disruption.
Fixes#172
* osc7: initial patch implementation
Closes#153
* osc7: avoid redundant use of realpath()
* osc7: fix styling
* Changing position of the OSC7_PATCH toggle in patches.def.h
---------
Co-authored-by: Bakkeby <bakkeby@gmail.com>
This fixes the current implementation, which does not delete an image if
an application first erases the image and then spawns a new transparent
image in its place. The reason it didn't work before was because the two
operations were handled at different stages in the rendering pipeline.