Commit graph

1250 commits

Author SHA1 Message Date
Daniel Eklöf
1dc922e5a4
changelog: add new 'unreleased' section 2025-01-01 09:23:33 +01:00
Daniel Eklöf
ded55b7276
changelog: prepare for 1.20.0 2025-01-01 09:21:26 +01:00
Daniel Eklöf
e851d44ac9
kitty kbd: don't generate release events for plain Enter+Tab+Backspace
From the specification:

    The Enter, Tab and Backspace keys will not have release events
    unless Report all keys as escape codes is also set, so that the
    user can still type reset at a shell prompt when a program that
    sets this mode ends without resetting it.

Closes #1892
2025-01-01 08:06:52 +01:00
Daniel Eklöf
e38ec79be1
osc: add option to disable OSC-52, partially or fully
Closes #1867
2024-12-22 07:16:12 +01:00
Daniel Eklöf
67bd5dd460
selection: fix crash when tripple clicking in a region containing NUL characters
If a cell contains a NUL character, it was incorrectly treated as a
quote, later triggering an assertion.

Patch by Johannes Altmanninger
2024-12-22 07:09:37 +01:00
Daniel Eklöf
d523e7a676
term: set_app_id() + set_window_title(): only allow printable characters 2024-12-17 11:01:17 +01:00
Daniel Eklöf
9a1b59adae
box-drawings: implement octants 2024-12-08 12:55:57 +01:00
Daniel Eklöf
d3cd4ad933
char32: use utf8proc_charwidth() instead of wcwidth(), when available
It appears to be slightly more up-to-date with recent Unicode
versions.

In particular, it handles the new "Symbols for Legacy Computing
Supplement" block, introduced in Unicode 16.

Closes #1865
2024-11-02 15:12:39 +01:00
Daniel Eklöf
f3e443ea47
osc: 9: ignore ConEmu/Windows Terminal sequences
OSC-9 sequences starting with "<number>;" are now ignored, as they are
ConEmu sequences, and not iTerm notifications.
2024-11-02 08:33:03 +01:00
Daniel Eklöf
ab3af2af37
unicode: update data files to 16.0
Yup, there's no _actual_ changes 🤷
2024-10-31 07:26:07 +01:00
Daniel Eklöf
4aae5222fe
changelog: osc-9/777 crash when body is empty 2024-10-31 07:03:12 +01:00
Daniel Eklöf
8edf273f6e
changelog: add new 'unreleased' section 2024-10-23 13:55:10 +02:00
Daniel Eklöf
6d11e93e2f
changelog: prepare for 1.19.0 2024-10-23 13:50:54 +02:00
Daniel Eklöf
d68da27a7f
uri: skip query/fragment parsing when dealing with file:// URIs
Also, ignore invalid query/fragments (i.e. if the fragment comes
before the query).

Closes #1840
2024-10-23 08:47:21 +02:00
Daniel Eklöf
511aad419b
config: add color.sixelN options
These options allows you to configure the default sixel color palette.
2024-10-23 08:35:30 +02:00
Daniel Eklöf
ce38f5b413
render: sixels: update damage region when rendering sixels
This fixes flickering when foot is forced to double-buffer (e.g when
running under KDE, or smithay based compositors).

Since the damage region isn't updated, the sixel images aren't
included in the memcpy that is done to transfer the last frame's
updated regions to the next frame.

As a result, every other frame will have the sixels, while the others
don't.

Closes #1851
2024-10-05 08:55:48 +02:00
Daniel Eklöf
4afb94687c
changelog: #1715: "ghost" lines when selecting text 2024-09-21 09:17:38 +02:00
Daniel Eklöf
e2aeb7f336
render: xcursor_is_valid(): don't crash when there's no theme loaded
When trying to set a custom cursor shape, we first validate it. This
is done by checking against known server-side names, and then trying
to load the cursor from the client side cursor theme.

But, if we're using server side names, there is no theme loaded, and
foot crashed.

Fix by checking if we have a theme loaded, and if not, fail the cursor
shape name validation.
2024-09-21 09:10:48 +02:00
Daniel Eklöf
76b58b5663
changelog: remove escape sequences we've reverted 2024-09-13 09:04:18 +02:00
Daniel Eklöf
97ec375c67
toplevel-icon: implement OSC-1, CSI 20/21/22/23 t
* The toplevel icon is now set to the app-id, unless "overridden" by
  OSC-1 or OSC-0.
* Implemented OSC-1
* OSC-0 extended to also set the icon
* Implemented CSI 20 t - report window icon
* Implemented CSI 21 t - report window title
* Implemented CSI 22 ; 1 t - push window icon
* Implemented CS 23 ; 1 t - pop window icon
* Extended CSI 22/23 ; 0 t to also push/pop the icon
* Verify app-id set by OSC-176 is valid UTF-8
* Verify icon set by OSC-0/1 is valid UTF-8
2024-09-13 09:04:17 +02:00
Daniel Eklöf
3f8a1fc85b
changelog: xdg-toplevel-icon-v1 2024-09-13 09:04:17 +02:00
Daniel Eklöf
1925593a37
render: resize(): don't overflow the number of scrollback lines
The config system allows setting the scrollback lines to
2**32-1.

However, the total number of grid lines is the scrollback lines plus
the window size, and then rounded *up* to the nearest power of two.

Furthermore, the number of rows is represented with a plain 'int'
throughout the code base.

The largest positive integer that fits in an int is 2**31-1. That
however, is not a power of two.

The largest positive integer, that also is a power of two, that fits
in an int is 2**30, or 1073741824.

Ideally, we'd just cast the line count to a 64-bit integer, and call
__builtin_clzl{,l}() on it, and then take the smallest value of that,
or 2**30. But, for some reason, __builtin_clzl(), and
__builtin_clzll() appears to ignore bits above 32, despite they being
typed to long and long long. Bug?

Instead, ensure we never call __builtin_clz() on anything larger than
2**30.

Closes #1828
2024-09-09 06:58:52 +02:00
Daniel Eklöf
c8185aec1d
desktop: rename to foot{,client,-server}.desktop
That is, skip the reverse DNS naming scheme suggested by the .desktop
specification, and directly match our app-ids ("foot", and
"footclient").

This simplifies .desktop -> window instance mapping, allowing DEs to
match the filenames directly, without having to look at the
StartupWMClass key in the .desktop files.

These are the original names of the .desktop files. There were
renamed (to use the reverse DNS syntax) to please the flathub people,
who *required* this scheme to accept the foot package.

But, since:

* We don't package foot ourselves
* We don't go out of our way to support non-distro packaging schemes
* Flathub still hasn't merged the foot PR (it's now 2 years old)
* There are no know issues in any known DE that prevents a non-reverse
  DNS .desktop filename from working
* There are plenty of other applications that doesn't use reverse DNS
  names (a very clear majority, in my case)

Let's just revert back to the simpler naming scheme.

Closes #1607
2024-09-08 13:06:27 +02:00
Daniel Eklöf
c41f55c3a0
sixel: default bg color is now taken from the sixel palette, not the ANSI bg color
The wording in the original VT340 documentation is vague:

    Pixel positions specified as 0 are set to the current background
    color.

What does that mean? We _thought_ it meant the current ANSI background
color, as set with e.g. CSI 4x m.

It's still all a bit vague, but seeing that we have separate palettes
for text and graphic (should we?), it doesn't make sense to use the
ANSI background color as the default sixel background color.

So, use entry 0 from the sixel palette instead.
2024-09-05 07:33:05 +02:00
Daniel Eklöf
c5bb1fb2ed
notifications: BEL and OSC-777 now focuses the window on notification activation
Or put more propertly; if the notification daemon, and the
notification helper used by foot has been configured
properly (i.e. they both support XDG activation tokens), notifications
generated by BEL and OSC-777 will now raise/focus the window when the
default action of the notification is activated - typically by
clicking the notification.

Closes #1822
2024-09-05 07:16:15 +02:00
Daniel Eklöf
c15ebbfa2e
changelog: strikeout-thickness 2024-08-26 19:36:26 +02:00
Daniel Eklöf
01fa59b6b7
changelog: mbsntoc32() failure checks 2024-08-20 07:17:58 +02:00
Daniel Eklöf
be13788a4f
changelog: resize-keep-grid 2024-08-20 07:12:19 +02:00
Daniel Eklöf
b3fd994fd3
changelog: add missing reference to #1787 2024-08-20 07:12:09 +02:00
tokyo4j
a2fc2a986e
render: follow cursor.unfocused-style regardless of cursor.style
Before this commit, cursor.unfocused-style was effective only with
cursor.style=block
2024-08-20 06:59:33 +02:00
Daniel Eklöf
dc5ff7db28
changelog: add new 'unreleased' section 2024-08-14 12:02:56 +02:00
Daniel Eklöf
447b02b530
changelog: prepare for 1.18.1 2024-08-14 12:00:08 +02:00
Daniel Eklöf
2896c18981
osc: regression: fix OSC-111 handling of alpha changes
When the background alpha changes from fully opaque, to transparent,
or vice versa, we need to do more than just repaint the affected
cells.

For example, we need to create new surfaces with the correct pixel
format.

OSC-11 (set background color) already does this, but the same alpha
checking logic was missing in OSC-111 (reset background color).

Fixes #1801
2024-08-14 08:53:45 +02:00
Daniel Eklöf
7ec9ca2b95
input: CSD buttons are now triggered when releasing the mouse button
This is how most UIs work.

Note that we (at least on River) don't get any surface enter/leave
events while a button is held. This means we can't detect if the user
pressed the mouse button while on a CSD button, but then moves the
mouse outside. Releasing the mouse button will still activate the CSD
button.

Closes #1787
2024-08-09 08:20:36 +02:00
Daniel Eklöf
fb74a2df27
changelog: osc-99: sound support 2024-08-04 15:23:33 +02:00
Daniel Eklöf
62b0b65d47
changelog: add new 'unreleased' section 2024-08-02 14:33:26 +02:00
Daniel Eklöf
1272632f3b
changelog: prepare for 1.18.0 2024-08-02 14:27:57 +02:00
Daniel Eklöf
901daefd96
changelog: more template parameters we've added to desktop-notifications 2024-08-02 10:18:59 +02:00
Daniel Eklöf
ea2f0e7c3f
osc: kitty notifications: cleanup and update to latest version of spec
* Don't store a list of unfinished notifications. Use a single one. If
  the notification ID of the 'current' notification doesn't match the
  previous, unfinished one, the 'current' notification replaces the
  previous one, instead of updating it.

* Update xstrjoin() to take an optional delimiter (for example ','),
  and use that when joining categories and 'alive IDs'.

* Rename ${action-arg} to ${action-argument}

* Update handling of the 'n' parameter (symbolic icon name); the spec
  allows it to be used multiple times, and the terminal is supposed to
  pick the first one it can resolve. Foot can't resolve icons at all,
  neither can 'notify-send' or 'fyi' (which is what foot typically
  executes to display a notification); it's the notification daemon that
  resolves icons.

  The spec _could_ be interpreted to mean the terminal should lookup
  .desktop files, and use the value of the 'Icon' key from the first
  matching .desktop files. But foot doesn't read .desktop files, and I
  don't intend to implement XDG directory scanning and parsing of
  .desktop files just to figure out which icon to use.

  Instead, use a simple heuristics; use the *shortest* symbolic
  names. The idea is pretty simple: plain icon names are typically
  shorter than .desktop file IDs.
2024-08-02 08:07:13 +02:00
Daniel Eklöf
c4d9f8a8ff
osc: kitty notifications: implement the 'close' request
Add a new config option, desktop-notifications.close, defining what to
execute to close a notification. It has a single template parameter,
${id}, that is expanded to the external notification ID foot may have
picked up from the notification helper.

notify-send does not support closing notifications, and it appears
impossible to pass an *unsigned* integer as argument to gdbus. Hence
no default value for the new 'close' option.

Example:

    printf '\e]99;i=123;this is a notification\e\\'
    printf '\e]99;i=123:p=close;\e\\'
2024-07-25 19:24:28 +02:00
Daniel Eklöf
ecbec57a47
notify: split up the ${action} template parameter
Split it up into two, ${action-name} and ${action-label}.

Dunstify, for example, has a different syntax compared to notify-send:

notify-send: default=foobar
dunstify: default,foobar
2024-07-23 19:08:21 +02:00
Daniel Eklöf
045ead985c
notify: don't focus/report on notification dismissal
Only do it when the notification was activated.

Here, activated means the 'click to activate' notification action was
triggered.

How do we tie everything together?

First, we add a new template parameter, ${action}. It's intended to be
used with e.g. notify-send's --action option.

When the action is triggered, notify-send prints its name on stdout,
on a separate line. Look for this in stdout. Only if we've seen it do
we focus/report the notification.
2024-07-23 16:41:52 +02:00
Daniel Eklöf
0209458cc0
changelog: new desktop-notifications config section 2024-07-23 07:17:21 +02:00
Daniel Eklöf
b0bf8ca5f7
osc/notify: add support for OSC-99, kitty desktop notifications
This adds limited support for OSC-99, kitty desktop notifications[^1]. We
support everything defined by the "protocol", except:

* 'a': action to perform on notification activation. Since we don't
  trigger the notification ourselves (over D-Bus), we don't know a)
  which ID the notification got, or b) when it is clicked.
* ... and that's it. Everything else is supported

To be explicit, we *do* support:

* Chunked notifications (d=0|1), allowing the application to append
  data to a notification in chunks, before it's finally displayed.
* Plain UTF-8, or base64-encoded UTF-8 payload (e=0|1).
* Notification identifier (i=xyz).
* Payload type (p=title|body).
* When to honor the notification (o=always|unfocused|invisible), with
  the following quirks:
    - we don't know when the window is invisible, thus it's treated as
      'unfocused'.
    - the foot option 'notify-focus-inhibit' overrides 'always'
* Urgency (u=0|1|2)

[^1]: https://sw.kovidgoyal.net/kitty/desktop-notifications/
2024-07-23 07:17:21 +02:00
Daniel Eklöf
45c7cd3f74
input: allow mouse selections to start inside the margins
Before this, margins were special cased:

* The mouse cursor was always a pointer, and never an I-beam (thus
  signaling selections cannot be made).
* The internal mouse coords where set to -1 when the cursor was inside
  the margins, causing:
    - text selections from being made
    - mouse events being passed to mouse grabbing applications

In particular, even with a one-pixel margin, making selections was
unnecessarily hard in e.g. fullscreen mode, where you'd expect to be
able to throw the cursor into the corner of the screen and then start
a selection.

With this patch, the cursor is treated as if it was in the first/last
column/row, when inside the margin(s).

An unintended side-effect of this, initially, was that auto-scrolling
selections where way too easy to trigger, since part of its logic is
checking if the cursor is inside the margins.

That problem has been reduced by two things:

* auto-scrolling does not occur unless a selection has been
  started. That is, just holding down the mouse in the margins and
  moving up/down doesn't cause scrolling. You have to first select at
  least one cell in the visible viewport.
* A selection isn't fully started (i.e. a cell is actually selected)
  unless the cursor is inside the actual grid, and *not* in the
  margins.

What does the last point mean? We now allow a selection to be
_started_ when clicking in the margin. What this means internally is
we set a start coordinate for a selection, but *not* and end
coordinate. At this point, we don't have an actual selection. Nothing
is selected, and no cells are highlighted, graphically.

This happens when we set an end coordinate. Without the last bullet
point, that would happen as soon as the cursor was _moved_, even if
still inside the margins. Now, we require the cursor to leave the
margins and touch an actual cell before we set an end coordinate.

Closes #1702
2024-07-19 06:55:28 +02:00
Daniel Eklöf
38461eef6f
csi: in-band window resize notifications, private mode 2048
This implements
https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83,
in-band window resize notifications.

When user enables private mode 2048 (in-band resize
notifications), *always* send current size, even if the mode is
already active.

This ensures applications can rely on getting a reply from the
terminal.
2024-07-19 06:54:32 +02:00
Daniel Eklöf
36e4435bbf
log: respect the NO_COLOR environment variable
http://no-color.org/

Closes #1771
2024-07-18 08:44:30 +02:00
abs3nt
1fd4076082
themes: catppuccin: replace with updated flavors
Pulled from https://github.com/catppuccin/foot
2024-07-18 08:21:14 +02:00
Daniel Eklöf
1136108c97
input: don't map wheel events to BTN_{BACK,FORWARD}
BTN_BACK and BTN_FORWARD are separate buttons. The scroll wheel don't
have any button mappings in libinput/wayland, so make up our own
defines.

This allows us to map them in mouse bindings.

Also expose BTN_WHEEL_{LEFT,RIGHT}. These were already defined, and
used, internally, to handle wheel tilt events. With this, they can
also be used in mouse bindings.

Finally, fix encoding used for BTN_{BACK,FORWARD} when sending mouse
button events to the client application. Before this, they were mapped
to buttons 4/5. But, button 4/5 are for the scroll wheel, and as
mentioned above, BTN_{BACK,FORWARD} are not the same as scroll wheel
"buttons".

Closes #1763
2024-07-13 10:41:10 +02:00
Daniel Eklöf
15c0078c2d
changelog: remove entry for change that hasn't yet been merged 2024-07-13 10:40:37 +02:00