Commit graph

6738 commits

Author SHA1 Message Date
Daniel Eklöf
33eefa7b45
term+input: refactor: move theme switching into term_theme_* functions 2025-06-10 07:11:45 +02:00
Daniel Eklöf
7347f4beb1
quirks: remove subsurface unmap quirk for Sway
Sway used to have an issue where unmapping a subsurface did not damage
the surface below (https://github.com/swaywm/sway/issues/6960).

This has been fixed for quite some time now, so let's remove the
quirk.
2025-06-09 07:08:24 +02:00
tokyo4j
eeaecba723 wayland: fix global listener for xdg_toplevel_icon_manager_v1 2025-05-24 19:06:29 +09:00
Daniel Eklöf
5a84f8d841
conf: pad: add center-when-fullscreen and center-when-maximized-and-fullscreen
Before this patch, the grid content was *always* centered when the
window was maximized or fullscreened, regardless of how the user had
configured padding.

Now, the behavior is controlled by the 'pad' option. Before this
patch, the syntax was

    pad MxN [center]

Now it is

    pad MxN [center|center-when-fullscreen|center-when-maximized-and-fullscreen]

The default is "pad 0x0 center-when-maximized-and-fullscreen", to
match current behavior.

Closes #2111
2025-05-24 09:56:16 +02:00
Daniel Eklöf
5621829bb0
cursor-shape: map "dnd-move" to WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_MOVE 2025-05-23 13:31:53 +02:00
Daniel Eklöf
664cdcc65c
cursor-shape: add 'dnd-ask' and 'all-resize'
These (non-css) cursor shapes were added to the cursor-shape-v1
protocol in wayland-protocols 1.42.

We don't need (or use them at all) internally, but add them to the
list we use to translate from shape names to shape enums. This allows
users to set a custom shape (via OSC-22), while still using server
side cursors (i.e. no need to fallback to client-side cursors).

If we try to set a shape not implemented by the server, we get a
protocol error and foot exits. This is bad.

So, make sure we don't do that:

1. First, we need to explicitly bind v2 if implemented by the server
2. Track the bound version number in the wayland struct
3. When matching shape enum, skip shapes not supported in the
   currently bound version of the cursor-shape protocol
2025-05-22 06:59:33 +02:00
Daniel Eklöf
d266599881
wayland: configure: don't commit if we have a pending refresh
Currently, if the following occurs:

1. foot has AxB size
2. Compositor sends CxD size
3. foot detects a resize, acks and saves CxD, but doesn't redraw immediately
4. Compositor sends CxD size again (due to a toplevel state array
   change, for example)

Then foot will detect no resize occurred, and will do an "empty"
commit immediately.

In this particular case that's wrong, since we're effectively
acking+committing the initial AxB size.

Fix by only doing the immediate commit if there's no size
change **and** there's no pending refresh.

Note: normally, we'd resize and refresh+commit immediately, but if
we're waiting for a frame callback, then the refresh+commit will be
delayed (i.e. scheduled). This is what we're checking here.

Closes #2105
2025-05-21 13:07:49 +02:00
Kirill Primak
456ac5d79f
render: improve CSD button positioning
This commit fixes titlebar button positioning when maximization isn't
available but minimization is.
2025-05-21 07:39:35 +02:00
Daniel Eklöf
3e1e3ea38c
libxkbcommon: don't require 1.8.0
The version bump was done since we now use XKB_VMOD_NAME_*; macros
added in libxkbcommon 1.8.0.

Not all distros have updated libxkbcommon yet (read: Debian). Since
it's fairly easy to work around, let's do that.

Closes #2103
2025-05-18 11:36:57 +02:00
Daniel Eklöf
8bd39b32cd
Revert "xkbcommon: require libxkbcommon >= 1.8.0"
This reverts commit 34d3f4664b.
2025-05-18 11:29:50 +02:00
Daniel Eklöf
ebd1614316
csi: when REP:ing a "combining" character, use correct width
Before this patch, we just called c32width(), which only works on
actual codepoints. If the last printed character is a "combining"
character, i.e. a key into our lookup table for multi-codepoint
graphemes, we need to lookup the grapheme and pick the width from
there.

See https://gitlab.com/AutumnMeowMeow/jexer/-/issues/119#note_2499712901
2025-05-16 18:46:26 +02:00
Daniel Eklöf
9b0d5e7c96
term: unittest: auto-scroll timer FD is created on-demand nowadays 2025-05-08 10:22:45 +02:00
Daniel Eklöf
073b637d45
render: refactor to allow setting only selection bg or fg
Before this, we only applied custom selection colors, if *both* the
selection bg and fg had been set.

Since the options are already split up into two separate options, and
since it makes sense to at least be able to keep the foreground colors
unchanged (i.e. only setting the selection background), let's allow
only having one of the selection colors set.

Closes #1846
2025-05-05 13:02:32 +02:00
Daniel Eklöf
c037836bbd
doc: foot.ini: fix description of dark/light themes 2025-05-05 13:02:04 +02:00
Chen Mulong
c6db0bed42
Update catppuccin themes
From https://github.com/catppuccin/foot
Without the 'cursor.color', those themes have problems with cursor
display problems in the zsh vi normal mode.
2025-05-05 07:21:26 +02:00
Daniel Eklöf
970e13db8d
config: tweak.surface-bit-depth: add support for 16-bit surfaces
This adds supports for 16-bit surfaces, using the new
PIXMAN_a16b16g16r16 buffer format. This maps to
WL_SHM_FORMAT_ABGR16161616 (little-endian).

Use the new 16-bit surfaces by default, when
gamma-correct-blending=yes.
2025-05-03 09:04:15 +02:00
Daniel Eklöf
7354b94f73
osc: restore configured alpha if OSC-11 has no alpha value
When parsing an OSC-11 without an alpha value (i.e. standard OSC-11,
not rxvt's extended variant), restore the alpha value from the
configuration, rather than keeping whatever the current alpha is.
2025-05-02 18:54:03 +02:00
Daniel Eklöf
5080e271c2
wayland: attempt to log protocol errors on failure to flush
When failing to flush, and the error is EPIPE, attempt to read and
dispatch events. This ensures protocol errors are logged.
2025-05-02 13:46:18 +02:00
Daniel Eklöf
237db6e771
wayland: always call wl_display_dispatch_pending() at least once, after reading
This fixes an issue where protocol errors aren't reported. I'm
guessing the read succeeds, but that prepare_read() _also_ succeeds
immediately, since there aren't any events to dispatch (only log the
protocol error).

By calling dispatch unconditionally, we ensure any error messages are
printed. Then we proceed to loop prepare_read() + dispatch_pending()
until the queue is empty.
2025-05-02 13:43:59 +02:00
Ryan Roden-Corrent
0ea572dc63
Paste URL/regex selection to prompt if key is uppercase.
In copy-regex/show-urls-copy mode, if the last input character was
uppercase, copy the selection to the clipboard _and_ paste it. This is
useful for taking a file path from a command output:(log, git, test
failure, etc.) and using it in another command.

This is inspired by the behavior of copy mode in wezterm:
https://wezterm.org/quickselect.html

I could have made it check every character in the hint, but it seemed
fine to assume that if the last character was uppercase, the user
wanted this behavior.

Closes #1975.
2025-05-01 13:53:11 +02:00
Daniel Eklöf
183fd96aba
Merge branch 'releases/1.22' 2025-05-01 10:25:53 +02:00
Daniel Eklöf
85c81042d2
meson: bump version to 1.22.3 2025-05-01 10:20:38 +02:00
Daniel Eklöf
acea863fbe
changelog: prepare for 1.22.3 2025-05-01 10:20:22 +02:00
Daniel Eklöf
2a8948a3f3
config: tweak.surface-bit-depth now defaults to 'auto'
When set to 'auto', use 10-bit surfaces if gamma-correct blending is
enabled, and 8-bit surfaces otherwise.

Note that we may still fallback to 8-bit surfaces (without disabling
gamma-correct blending) if the compositor does not support 10-bit
surfaces.

Closes #2082
2025-05-01 10:19:35 +02:00
Daniel Eklöf
7ced397089
config: gamma-correct-blending: disable by default 2025-05-01 10:18:14 +02:00
Daniel Eklöf
9ff0151055
changelog: add new 'unreleased' section 2025-05-01 10:17:20 +02:00
Daniel Eklöf
e5a0755451
config: tweak.surface-bit-depth now defaults to 'auto'
When set to 'auto', use 10-bit surfaces if gamma-correct blending is
enabled, and 8-bit surfaces otherwise.

Note that we may still fallback to 8-bit surfaces (without disabling
gamma-correct blending) if the compositor does not support 10-bit
surfaces.

Closes #2082
2025-05-01 08:54:30 +02:00
Daniel Eklöf
b07ce56321
config: gamma-correct-blending: disable by default 2025-05-01 08:09:08 +02:00
Daniel Eklöf
1dc8354534
readme: add liberapay donation button 2025-04-30 11:46:20 +02:00
Daniel Eklöf
99954534e1
Merge branch 'releases/1.22' 2025-04-30 10:30:57 +02:00
Daniel Eklöf
513e91c33a
meson: bump version to 1.22.2 2025-04-30 10:23:51 +02:00
Daniel Eklöf
fc293bad5e
changelog: prepare 1.22.2 2025-04-30 10:23:20 +02:00
Daniel Eklöf
172f67a8df
doc: foot.ini: gamma-correct: tweak wording of 8- vs. 10-bit surfaces 2025-04-30 10:21:00 +02:00
Daniel Eklöf
ce424e0990
scripts: srgb: use 2.2 gamma TF instead of piece-wise sRGB TF 2025-04-30 10:20:52 +02:00
Daniel Eklöf
1ea20b1b70
changelog: add new 'unreleased' section 2025-04-30 10:19:47 +02:00
Daniel Eklöf
eb79a27900
readme: donations: add liberapay 2025-04-30 09:28:35 +02:00
Daniel Eklöf
d7b48d3924
doc: foot.ini: gamma-correct: tweak wording of 8- vs. 10-bit surfaces 2025-04-28 12:32:40 +02:00
Daniel Eklöf
97910a5cba
scripts: srgb: use 2.2 gamma TF instead of piece-wise sRGB TF 2025-04-28 11:55:43 +02:00
Daniel Eklöf
d20fbc6807
config: parse_color_theme(): make NOINLINE 2025-04-27 07:46:09 +02:00
Daniel Eklöf
4d70bb7b42
changelog: mention the new combined dark/light theme files 2025-04-26 18:15:31 +02:00
Daniel Eklöf
8273514d3c
themes: paper-color: add dark/light combined theme file 2025-04-26 15:26:36 +02:00
Daniel Eklöf
d3e45791bd
themes: nvim: add dark/light combined theme file 2025-04-26 15:26:31 +02:00
Daniel Eklöf
6a1c3b89c2
themes: gruvbox: add dark/light combined theme file 2025-04-26 15:26:22 +02:00
Daniel Eklöf
1dc14a3001
themes: selenized: add dark/light combined theme file 2025-04-26 15:26:14 +02:00
Daniel Eklöf
537092e643
themes: solarized: add dark/light combined theme file
These themes uses the 'colors' section to define the dark variant, and
'colors2' to define the light variant.
2025-04-26 15:26:05 +02:00
Daniel Eklöf
bc5b716668
config: add initial-color-theme=1|2
This option selects which color theme to use by default. I.e. at
startup, and after a reset.

This is useful with combined theme files, where a single file defines
e.g. both a dark and light version of the theme.
2025-04-26 14:43:42 +02:00
Daniel Eklöf
10e7f29149
csi: implement private mode 2031 (dark/light mode detection)
* Recognize 'CSI ? 996 n', and respond with
  - 'CSI ? 997 ; 1 n' if the primary theme is active
  - 'CSI ? 997 ; 2 n' if the alternative theme is actice
* Implement private mode 2031, where changing the color
  theme (currently only possible via key bindings) causes the terminal
  to send the same CSI sequences as above.

In this context, foot's primary theme is considered dark, and the
alternative theme light (since the default theme is dark).

Closes #2025
2025-04-26 14:23:34 +02:00
Daniel Eklöf
6bc91b5e28
key-bindings: add bindings to switch between color themes
* color-theme-switch-1: select the primary color theme
* color-theme-switch-2: select the alternative color theme
* color-theme-toggle: toggle between the primary and alternative color themes
2025-04-26 14:20:58 +02:00
Daniel Eklöf
1423babc35
config: add new section 'colors2'
This section defines an alternative color theme. The keys are the same
as in the 'colors' section, as are the default values.

Values are *not* inherited from 'colors'. That is, if you set a value
in 'colors', but not in 'colors2', it is *not* inherited by 'colors2'.
2025-04-26 14:20:58 +02:00
Daniel Eklöf
01c43f1644
config: refactor: break out color theme parsing to a separate function 2025-04-26 14:20:57 +02:00