aboutsummaryrefslogtreecommitdiff
path: root/osc.c (follow)
Commit message (Collapse)AuthorAgeLines
* osc: color reset: read default color from currently active themeDaniel Eklöf2025-07-22-14/+51
|
* osc: 52: clear selection if the payload is the empty stringDaniel Eklöf2025-06-10-5/+8
|
* render: refactor to allow setting only selection bg or fgDaniel Eklöf2025-05-05-4/+0
| | | | | | | | | | | | 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
* osc: restore configured alpha if OSC-11 has no alpha valueDaniel Eklöf2025-05-02-7/+12
| | | | | | 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.
* config: move cursor.color to colors.cursorDaniel Eklöf2025-04-26-2/+8
|
* osc: text-size: disable optimizationDaniel Eklöf2025-02-06-0/+2
| | | | | | The optimization prevents the forced-width to be set on the new combining character, causing issues when followed by more zero-width codepoints.
* osc: text-sizing: implement w=0, plus optimize single-codepoint casesDaniel Eklöf2025-02-06-4/+51
| | | | | | | | | | If there's a single codepoint in the text portion of the OSC sequence, and its calculated width matches the forced width, print it directly to the grid instead of emitting a combining character. When w=0, we split up the text string "as we normally would". Since we don't support any other text-sizing parameters, this means simply printing each codepoint to the grid.
* term+vt: refactor: move "utf8" char processing to term_process_and_print_non_ascii()Daniel Eklöf2025-02-06-1/+4
| | | | | | | | | | | This function "prints" any non-ascii character (i.e. any character that ends up in the action_utf8_print() function in vt.c) to the grid. This includes grapheme cluster processing etc. action_utf8_print() now simply calls this function. This allows us to re-use the same functionality from other places (like the text-sizing protocol).
* osc: wip: kitty text size protocolDaniel Eklöf2025-02-06-1/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings initial support for the new kitty text-sizing protocol. Note hat only the width-parameter ('w') is supported. That is, no font scaling, and no multi-line cells. For now, only explicit widths are supported. That is, w=0 does not yet work. There are a couple of changes to the renderer, to handle e.g. OSC 66 ; w=6 ; foobar ST There are two ways this can get rendered, depending on whether grapheme shaping has been enabled. We either shape it, and get an array of glyphs back that we render. Or, we rasterize each codepoint ourselves, and render each resulting glyph. The two cases ends up in two different renderer loops, that worked somewhat different. In particular, the first case has probably never been tested/used at all... With this patch, both are changed, and now uses some heuristic to differentiate between multi-cell text strings (like in the example above), or single-cell combining characters. The difference is mainly in which offset to use for the secondary glyphs. In a multi-cell string, each glyph is mapped to its own cell, while in the combining case, we try to map all glyphs to the same cell.
* osc: ignore 'OSC 176 ?' - report app IDDaniel Eklöf2025-01-07-0/+4
| | | | | It's not widely used (don't know _any_ application that uses it), and can be used to trick users to run unwanted commands.
* osc: disable debug loggingDaniel Eklöf2025-01-02-1/+1
|
* osc: add option to disable OSC-52, partially or fullyDaniel Eklöf2024-12-22-1/+16
| | | | Closes #1867
* osc: 9: ignore ConEmu/Windows Terminal sequencesDaniel Eklöf2024-11-02-1/+13
| | | | | OSC-9 sequences starting with "<number>;" are now ignored, as they are ConEmu sequences, and not iTerm notifications.
* osc: notify: fix crash with no messageJack Wilsdon2024-10-31-1/+5
| | | | Closes #1866
* osc: OSC-1 does not set the icon, it sets the icon _label_Daniel Eklöf2024-09-13-2/+0
| | | | | | | | | | In fact, there appears there *is* no escape sequence to set the icon. Keep most of the logic in place, but in practice, we'll always set the icon to the app-id. That is, at startup, we set it to the configured app-id (either from config, or the command line). OSC-176, which sets the app-id, also updates the icon (to the app-id).
* toplevel-icon: implement OSC-1, CSI 20/21/22/23 tDaniel Eklöf2024-09-13-3/+12
| | | | | | | | | | | | | | * 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
* xsnprintf: various improvements related to xvsnprintf() and xsnprintf()Craig Barnes2024-09-13-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary of changes: * Make xvsnprintf() static * restrict-qualify pointer arguments (as done by the libc equivalents) * Make comments and spec references more thorough * Remove pointless `n <= INT_MAX` assertion (see comment) * Use FATAL_ERROR() instead of xassert() (since the assertion is inside a shared util function but the caller is responsible for ensuring the condition holds true) * Change some callers to use size_t instead of int for the return value (negative returns are impossible and all subsequent uses are size_t) The updated comments and code were taken (and adapted) from: https://gitlab.com/craigbarnes/dte/-/blob/49260bb154bca0434462a41c061e512540ec2e49/src/util/xsnprintf.c#L6-50 This work was entirely authored by me and I hereby license this contribution under the MIT license (stated explicitly, so that there's no ambiguity w.r.t. the original license).
* notifications: BEL and OSC-777 now focuses the window on notification activationDaniel Eklöf2024-09-05-2/+3
| | | | | | | | | | | 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
* osc: notify: fix bad check for invalid UTF-8Daniel Eklöf2024-08-20-2/+2
| | | | mbsntoc32() returns (size_t)-1 on failure, not (char32_t)-1.
* osc: regression: fix OSC-111 handling of alpha changesDaniel Eklöf2024-08-14-1/+10
| | | | | | | | | | | | | | 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
* osc: kitty: update 's' to the latest specDaniel Eklöf2024-08-09-1/+17
| | | | | | | * The spec now defines a couple of "standard" names. Translate these to the freedesktop compliant names. * The query response no longer contains 'xdg-names', but instead list the supported standard names.
* osc: kitty notifications: add support for XDG sound namesDaniel Eklöf2024-08-04-1/+10
|
* osc: kitty notifications: implement s=silentDaniel Eklöf2024-08-04-4/+25
| | | | | | | | This implements part of the new 's' (sound) parameter; the 'silent' value. When s=silent, we set the ${muted} template argument to "true". It is intended to set the 'suppress-sound' hint: notify-send --hint BOOLEAN:suppress-sound:${muted}
* Merge branch 'xstrjoin3'Craig Barnes2024-08-03-4/+4
|\
| * xmalloc: remove delim param from xstrjoin() and add separate xstrjoin3()Craig Barnes2024-08-03-4/+4
| | | | | | | | | | | | | | | | | | | | | | This avoids the need for an unused third argument for most xstrjoin() calls and replaces the cases where it's needed with a more flexible function. Code generation is the same in both cases, when there are 2 string params and a compile-time known delimiter. This commit also converts 4 uses of xasprintf() to use xstrjoin*(). See also: https://godbolt.org/z/xsjrhv9b6
* | osc: kitty notifications: ignore invalid IDsDaniel Eklöf2024-08-03-3/+33
|/ | | | | | | | | | | | | Notification IDs must only use characters from [a-zA-Z0-9_-+.] Terminals **must** sanitize ids received from client programs before sending them back in responses, to mitigate input injection based attacks. That is, they must either reject ids containing characters not from the above set, or remove bad characters when reading ids sent to them. Foot implements the first: reject IDs containing characters not from the above set.
* osc: kitty notifications: cleanup and update to latest version of specDaniel Eklöf2024-08-02-111/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* osc: kitty notifications: buttons, icons, app-name, categories etcDaniel Eklöf2024-07-31-7/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, icons have been finalized in the specification. There were only three things we needed to adjust: * symbolic names are base64 encoded * there are a couple of OSC-99 defined symbolic names that need to be translated to the corresponding XDG icon name. * allow in-band icons without a cache ID (that is, allow applications to use p=icon without having to cache the icon first). Second, add support for the following new additions to the protocol: * 'f': custom app-name, overrides the terminal's app-id * 't': categories * 'p=alive': lets applications poll for currently active notifications * 'id' is now 'unset' by default, rather than "0" * 'w': expire time (i.e. notification timeout) * "buttons": aka actions. This lets applications add additional (to the terminal defined "default" action) actions. The 'activated' event has been updated to report which button/action was used to activate the notification. To support button/actions, desktop-notifications.command had to be reworked a bit. There's now a new config option: desktop-notifications.command-action-arg. It has two template arguments ${action-name} and ${action-label}. command-action-arg gets expanded for *each* action. ${action-name} and ${action-label} has been replaced by ${action-arg} in command. This is a somewhat special template, in that it gets replaced by *all* instances of the expanded actions.
* notify: close notification by sending SIGINT to helperDaniel Eklöf2024-07-26-0/+1
| | | | | | | | | | | | | If the user hasn't configured a custom 'desktop-notifications.close' command, try to close the notification by sending SIGINT to the notification helper. This is best-effort: * If there's no helper running, we do nothing (except warn) * We don't verify, in any way, the notification is actually closed * We don't send any other signals, under any circumstances. That is, no SIGTERM, no SIGKILL. Ever.
* osc: kitty notifications: implement the 'close' requestDaniel Eklöf2024-07-25-9/+20
| | | | | | | | | | | | | | | | 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\\'
* osc: kitty notification: implement 'close' eventsDaniel Eklöf2024-07-25-5/+19
| | | | | | Application can now request to receive a 'close' event when the notification is closed (but not necessarily activated), by adding 'c=1' to the notification request.
* notify: rename 'report' -> 'report_activated'Daniel Eklöf2024-07-25-2/+2
|
* osc+notify: strcmp() -> streq()Daniel Eklöf2024-07-24-10/+10
|
* osc: kitty notifications: don't include '?' in the query replyDaniel Eklöf2024-07-24-1/+1
| | | | No need to say we support queries, in the query reply...
* osc: kitty notifications: implement queryDaniel Eklöf2024-07-23-6/+27
|
* osc: remove unused includesDaniel Eklöf2024-07-23-3/+0
|
* osc: cleanupDaniel Eklöf2024-07-23-16/+3
|
* notify: separate active notifications from unfinished kitty notificationsDaniel Eklöf2024-07-23-12/+13
| | | | | | | | | | | | | | | | | | | | | This fixes an issue where it wasn't possible to trigger multiple notifications with the same kitty notification ID. This is something that works in kitty, and there's no reason why it shouldn't work. The issue was that we track stdout, and the notification helper's PID in the notification struct. Thus, when a notification is being displayed, we can't re-use the same notification struct instance for another notification. This patch fixes this by adding a new notification list, 'active_notifications'. Whenever we detect that we need to track the helper (notification want's to either focus the window on activation, or send an event to the application), we add a copy of the notification to the 'active' list. The notification can then be removed from the 'kitty' list, allowing kitty notifications to re-use the same ID over and over again, even if old notifications are still being displayed.
* osc: kitty notifications: updated support for iconsDaniel Eklöf2024-07-23-36/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the suggested protocol discussed in https://github.com/kovidgoyal/kitty/issues/7657. Icons are handled by loading a cache. Both in-band PNG data, and symbolic names are allowed. Applications use a graphical ID to reference the icon both when loading the cache, and when showing a notification. * 'g' is the graphical ID * 'n' is optional, and assigns a symbolic name to the icon * 'p=icon' - the payload is icon PNG data. It needs to be base64 encoded, but this is *not* implied. I.e. the application *must* use e=1 explicitly. To load an icon (in-band PNG data): printf '\e]99;g=123:p=icon;<base64-encoded-png-data>\e\\' or (symbolic name) printf '\e]99;g=123:n=firefox:p=icon;\e\\' Of course, we can combine the two, assigning *both* a symbolic name, *and* PNG data: printf '\e]99;g=123:n=firefox:p=icon;<base64-encoded-png>\e\\' Then, to use the icon in a notification: printf '\e]99;g=123;this is a notification\e\\' Foot also allows a *symbolic* icon to be defined and used at the same time: printf '\e]99;g=123:n=firefox;this is a notification\e\\' This obviously won't work with PNG data, since it uses the payload portion of the escape sequence.
* osc: kitty notifications: use xstrjoin() instead of xasprintf()Daniel Eklöf2024-07-23-8/+6
|
* osc: kitty notifications: implement focus|reportDaniel Eklöf2024-07-23-55/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for window focusing, and sending events back to the client application when a notification is closed. * Refactor notification related configuration options: - add desktop-notifications sub-section - deprecate 'notify' in favor of 'desktop-notifications.command' - deprecate 'notify-focus-inhibit' in favor of 'desktop-notifications.inhibit-when-focused' * Refactor: rename 'struct kitty_notification' to 'struct notification' * Pass a 'struct notification' to notify_notify(), instead of many arguments. * notify_notify() now registers a reaper callback. When the notifier process has terminated, the notification is considered closed, and we either try to focus (activate) the window, or send an event to the client application, depending on the notification setting. * For the window activation, we need an XDG activation token. For now, assume *everything* written on stdout is part of the token. * Refactor: remove much of the warnings from OSC-99; we don't typically log anything when an OSC/CSI has invalid values. * Add icon support to OSC-99. This isn't part of the upstream spec. Foot's implementation: - uses the 'I' parameter - the value is expected to be a symbolic icon name - a quick check for absolute paths is done, and such icon requests are ignored. * Added ${icon} to the 'desktop-notifications.command' template. Uses the icon specified in the notification, or ${app-id} if not set.
* osc: kitty notifications: use body as title, if no title is setDaniel Eklöf2024-07-23-2/+2
| | | | | This mirrors kitty's behavior; if the user didn't set a title, but did set the body/text, use the body as title instead.
* osc/notify: add support for OSC-99, kitty desktop notificationsDaniel Eklöf2024-07-23-1/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | 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/
* osc: extend damage-cells-by-color to default fg/bg as wellDaniel Eklöf2024-07-03-49/+7
| | | | | | | | | | | | | | | When changing part of the color palette, through either OSC-4, or OSC-10 and OSC-11 (and the corresponding reset OSCs: 104, 110 and 111), only dirty affected cells. We've always done this, but only for OSC-4. This patch breaks out that logic, and extends it to handle default fg/bg too. It also fixes a bug where cells with colored underlines were not dirtied if the underline was the only part of the cell that was affected by a OSC-4 change.
* osc: 10/11/12/17/19: don't apply overly much damageDaniel Eklöf2024-07-03-2/+5
|
* osc: merge OSC 10/11/12/17/19 handlingDaniel Eklöf2024-07-03-44/+23
| | | | | | | | | | 10/11/17/19 were already merged, so this patch just stops special casing 12 (cursor color). In preparation for XTPUSHCOLORS/XTPOPCOLORS, the cursor colors are moved from their own struct, into the 'colors' struct. Also fix a bug where OSC 17/19 queries returned OSC-11 data.
* osc: 52: treat OSC-52 replies as paste data (after all, they are)Daniel Eklöf2024-06-09-8/+31
| | | | | | | | | | | | | | | | | This fixes an issue where other data (such as replies to other requests) being interleaved with the OSC-52 reply. The patch piggy backs on the already existing mechanism for handling regular pastes, where other data is queued up until the paste is done. There's one corner case that won't work; if the user *just* did a normal paste (i.e. at virtually the same time the application requested OSC-52 data), the OSC-52 request will return an empty reply. Likewise, if there are multiple OSC-52 requests at the same time, only the first will return data. Closes #1734
* osc: reject notifications with invalid UTF-8 stringsDaniel Eklöf2024-04-15-0/+13
|
* osc: 176 (app-id): implement query+replyDaniel Eklöf2024-02-06-0/+12
| | | | | | | | | | Applications can now query for the current app-id with: \E] 176 ; ? \E\\ The reply is \E] 176 ; <title> \E\\
* osc: add support for osc 176 (app ID)delthas2024-02-06-0/+4
| | | | | | | | | | This adds support for a new OSC escape sequence: OSC 176, that lets terminal programs tell the terminal the name of the app that is running. foot then sets the app ID of the toplevel to that ID, which lets the compositor know which app is running, and typically sets the appropriate icon, window grouping, ... See: https://gist.github.com/delthas/d451e2cc1573bb2364839849c7117239
* Don't use fancy Unicode quotes, stick to ASCIIDaniel Eklöf2024-02-06-3/+3
|
* osc: store column of FTCS_COMMAND_{EXECUTED,FINISHED} in row structDaniel Eklöf2024-02-06-2/+8
|
* term: move row->prompt_marker into new struct, row->shell_integrationDaniel Eklöf2024-02-06-1/+1
|
* util: add streq() function and use in place of strcmp(...) == 0Craig Barnes2024-02-05-2/+2
|
* osc: update font subpixel mode, and window opaque compositor hint, on alpha changesDaniel Eklöf2023-05-26-1/+8
| | | | | | | | | | | | | | | | | | | | | When background alpha is changed at runtime (using OSC-11), we (may) have to update the opaque hint we send to the compositor. We must also update the subpixel mode used when rendering font glyphs. Why? When the window is fully opaque, we use wl_surface_set_opaque_region() on the entire surface, to hint to the compositor that it doesn’t have to blend the window content with whatever is behind the window. Obviously, if alpha is changed from opaque, to transparent (or semi-transparent), that hint must be removed. Sub-pixel mode is harder to explain, but in short, we can’t do subpixel hinting with a (semi-)transparent background. Thus, similar to the opaque hint, subpixel antialiasing must be enabled/disabled when background alpha is changed.
* osc: add support for OSC 133;A (prompt markers)Daniel Eklöf2022-06-16-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the OSC-133;A sequence, introduced by FinalTerm and implemented by iTerm2, Kitty and more. See https://iterm2.com/documentation-one-page.html#documentation-escape-codes.html. The shell emits the OSC just before printing the prompt. This lets the terminal know where, in the scrollback, there are prompts. We implement this using a simple boolean in the row struct ("this row has a prompt"). The prompt marker must be reflowed along with the text on window resizes. In an ideal world, erasing, or overwriting the cell where the OSC was emitted, would remove the prompt mark. Since we don't store this information in the cell struct, we can't do that. The best we can do is reset it in erase_line(). This works well enough in the "normal" screen, when used with a "normal" shell. It doesn't really work in fullscreen apps, on the alt screen. But that doesn't matter since we don't support jumping between prompts on the alt screen anyway. To be able to jump between prompts, two new key bindings have been added: prompt-prev and prompt-next, bound to ctrl+shift+z and ctrl+shift+x respectively. prompt-prev will jump to the previous, not currently visible, prompt, by moving the viewport, ensuring the prompt is at the top of the screen. prompt-next jumps to the next prompt, visible or not. Again, by moving the viewport to ensure the prompt is at the top of the screen. If we're at the bottom of the scrollback, the viewport is instead moved as far down as possible. Closes #30
* osc: avoid unnecessary calls to strlen(3)Craig Barnes2022-04-06-5/+5
| | | | | | | | | | | | | | | | | Checking for specific strings of length 0 or 1 can be done with e.g.: if (str[0] == '\0') {...} if (str[0] == '?' && str[1] == '\0') {...} Doing it this way instead of using strlen(3) means we avoid the function call overhead and also avoid scanning through more of the string than is neceessary. A compiler could perhaps optimize away calls to strlen(3) when the result is compared to a small constant, but GCC 11.2 only seems to actually do this[1] for lengths of 0. [1]: https://godbolt.org/z/qxoW8qqW6
* osc: use four digits in OSC-4 and OSC-11 rgb:r/g/b repliesDaniel Eklöf2022-03-13-4/+6
| | | | Closes #971
* osc: grow OSC buffer exponentially instead of by fixed increments of 128Craig Barnes2022-03-02-3/+13
| | | | | | With fixed increments of 128 bytes, an OSC 52 copy operation could end up doing thousands or tens of thousands of realloc(3) calls just to copy a few MB.
* osc: don’t damage the entire view on a single color palette updateDaniel Eklöf2022-02-10-1/+41
| | | | | Instead, loop the viewport and dirty only those cells that are affected by the palette change.
* osc: implement OSC-22 - set xcursor pointerDaniel Eklöf2022-02-07-0/+4
|
* csi: store color index, not actual color, in cell’s fg/bg attributesDaniel Eklöf2021-12-26-60/+4
| | | | | | | | | | | | | | | | | | When using indexed colors (i.e. SGR 30/40/90/100), store the index into the cell’s fg/bg attributes, not the actual color value. This has a couple of consequences: Color table lookup is now done when rendering. This means a rendered cell will always reflect the *current* color table, not the color table that was in use when the cell was printed to. This simplifies the OSC-4/104 logic, since we no longer need to update the grid - we just have to damage it to trigger rendering. Furthermore, this change simplifies the VT parsing, since we no longer need to do any memory loads (except loading the SGR parameter values), only writes.
* osc-4: don’t update the color of cells with RGB fg/bg colorsDaniel Eklöf2021-12-01-11/+11
| | | | | | | | | | | | | | | | | | | | OSC 4/104 changes the 256-color palette. We also run a pass over the visible cells, and update their colors. This was previously done by comparing the actual color of the cell, with the “old” color in the palette. If they matched, the cell was updated. This meant that cells with an RGB color (i.e. not a palette based color) was also updated, _if_ its color matched the palette color. Now that each cell tracks its color *source*, we can ignore all non-palette based cells. Note that this still isn’t perfect: if the palette contains multiple entries with the same color, we’ll end up updating the “wrong” cells. Closes #678
* term: track cell color sourceDaniel Eklöf2021-11-20-3/+3
| | | | | | | | | | | | | Each cell now tracks it’s current color source: * default fg/bg * base16 fg/bg (maps to *both* the regular and bright colors) * base256 fg/bg * RGB Note that we don’t have enough bits to separate the regular from the bright colors. These _shouldn’t_ be the same, so we ought to be fine...
* Merge branch 'parse-rgb-strlen'Daniel Eklöf2021-10-20-4/+3
|\
| * osc: use STRLEN() macro to make parse_rgb() more self-documentingCraig Barnes2021-10-20-4/+3
| | | | | | | | | | The empty literals in the macro are to ensure the argument itself is a string literal, so it can't be used on anything else.
* | osc: use BEL terminator in OSC replies to BEL-terminated OSC queriesCraig Barnes2021-10-20-6/+17
|/ | | | | | | | | This matches the documented (and observed) behavior in xterm: > XTerm accepts either BEL or ST for terminating OSC sequences, and > when returning information, uses the same terminator used in a query -- https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
* osc: fix typo in LOG_DBG() messageCraig Barnes2021-07-24-1/+1
|
* osc: implement iTerm2’s OSC-9 - desktop notificationsDaniel Eklöf2021-06-04-1/+6
|
* osc: implement OSC 17+19: change selection background/foreground colorsDaniel Eklöf2021-04-08-3/+31
| | | | | And of course, we also implement the corresponding reset sequences, OSC 117+119.
* osc: reset background alpha when resetting the background colorDaniel Eklöf2021-04-08-0/+1
|
* osc: parse_legacy_color(): the alpha component is not a floating point numberDaniel Eklöf2021-04-08-8/+7
| | | | | | When using the urxvt extension of the XParseColor format, the alpha component is not a floating point number, but a decimal number in the range 0-100.
* osc: parse_rgb(): ensure ‘alpha’ has been initializedDaniel Eklöf2021-04-08-1/+1
|
* osc: add support for URxvt extension to include alpha in OSC-11Daniel Eklöf2021-04-08-24/+100
| | | | | | | There are two variants, either using a ‘[percent]’ prefix for legacy colors, or using ‘rgba:r/g/b/a’ instead of ‘rgb:r/g/b’. Closes #436
* config/terminal: refactor: remove “default_*” color members from terminal structDaniel Eklöf2021-04-07-8/+8
| | | | Access the original colors in the configuration instead.
* osc: verify OSC 4/104 color index is validDaniel Eklöf2021-04-05-1/+11
| | | | Closes #434
* osc-8: fix thinko: can’t use the ID parameters *address* as actual IDDaniel Eklöf2021-02-21-4/+4
| | | | | | | Doing so means the next OSC-8 URL emitted by the client application, with the same ID, will get a *new* id internally. Instead, hash the string and use that as ID.
* term: add ‘id’ parameter to term_osc8_open()Daniel Eklöf2021-02-21-1/+1
| | | | | The current OSC-8 URL’s ID is now tracked along with the URI itself, and its starting point.
* osc: 8: parse params, and the ‘id’ parameter specificallyDaniel Eklöf2021-02-21-1/+22
| | | | | | | | | | | | | | | | | | | Applications can assign an ID to the URL. This is used to associate the parts of a split up URL with each other: ╔═ file1 ════╗ ║ ╔═ file2 ═══╗ ║http://exa║Lorem ipsum║ ║le.com ║ dolor sit ║ ║ ║amet, conse║ ╚══════════║ctetur adip║ ╚═══════════╝ In the example above, ‘http://exa’ and ‘le.com’ are part of the same URL, but by necessity split up into two OSC-8 URLs. If the application sets the same ID for those two OSC-8 URLs, the terminal can ensure they are handled as one.
* osc: parse OSC-8, by calling term_osc8_{open,close} as appropriateDaniel Eklöf2021-02-21-0/+43
|
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-11/+11
|
* Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes2021-01-14-6/+7
|
* notify: break out desktop notifications from osc.cDaniel Eklöf2020-12-10-91/+2
|
* osc: implement urxvt’s “OSC 777;notify”Daniel Eklöf2020-12-09-12/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSC 777 is URxvt’s generic escape to send commands to its perl extensions. The first parameter is the name of the extension, followed by its arguments. OSC 777;notify is a, if not well established, at least a fairly well known escape sequence to request a (desktop) notification. The syntax is: \e]777;notify;<title>;<body>\e\\ Neither title nor body is escaped in any way, meaning they should not contain a ‘;’. Foot will split title from body at the *first* ‘;’. Any remaining ‘;’ characters are treated as part of ‘body’. Instead of adding built-in support for the freedesktop notification specification (which would require us to link against at least dbus), add a new config option to foot.ini: ‘notify’. This option specifies the command to execute when a notification is received. ‘${title}’ and ‘${body}’ can be used anywhere, in any combination, and as many times as you want, in any of the command arguments. The default value is ‘notify-send -a foot -i foot ${title} ${body}’
* term: remove read-only properties copied from the configDaniel Eklöf2020-11-26-2/+3
| | | | Use the config directly instead.
* osc: use new uri_parse() to parse an OSC7 PWD URIDaniel Eklöf2020-10-28-75/+13
|
* osc: change info logging to debug logging when changing the cursor colorDaniel Eklöf2020-10-20-1/+1
|
* osc: don’t explicitly call render_refresh() when changing the color paletteDaniel Eklöf2020-09-29-9/+5
| | | | | | | | | | | | | | | | | | Doing so will schedule the renderer “as soon as possible”. I.e we’re by-passing the regular scheduler, and thus we’re by-passing the user’s setting of the delayed-render-* timers. The fact that we’re scheduling “as soon as possible” also means we’re much more likely to trigger flickering, or color flashes, if the application is changing colors which are on the screen. To handle changes to the cursor color(s), use the new term_damage_cursor() instead of render_refresh(). To handle background color changes, which affect the margins, use the new term_damage_margins() instead of render_refresh_margins(), Closes #141
* osc52: use first source that actually *has* dataDaniel Eklöf2020-09-09-20/+32
|
* osc52: unset (clear) selection when an invalid payload is receivedDaniel Eklöf2020-09-09-11/+16
|
* osc: explicitly refresh margins on a background color changeDaniel Eklöf2020-09-01-0/+2
|
* Don't use "case X ... Y:", if possible/where it makes senseDaniel Eklöf2020-08-23-3/+9
|
* osc: dirty grids on *all* color modifying sequencesDaniel Eklöf2020-08-18-47/+63
| | | | | | | We only updated the grid for OSC 4 - Set color <idx>. But we did *not* do it for 104 (reset color <idx>), 10 - set default foreground, 11 - set default background, 110 - reset default foreground, or 111 - reset default background.
* Fix some spelling mistakesCraig Barnes2020-08-15-1/+1
|
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-7/+12
|
* Replace non-portable "\e" escape in string literals with "\033"Craig Barnes2020-08-02-1/+1
|
* seat: use separate 'enter' serials for keyboard and mouseDaniel Eklöf2020-07-09-4/+3
|
* multi-seat: re-enable OSC 52 supportDaniel Eklöf2020-07-08-15/+38
|
* wip: multi-seat supportDaniel Eklöf2020-07-08-3/+10
| | | | | Compiles and runs, but mouse, clipboard and other things have been disabled.
* osc: set color: update both grids, but exclude scrollbackDaniel Eklöf2020-06-14-18/+22
|