Commit graph

71 commits

Author SHA1 Message Date
Daniel Eklöf
03cbb6ad90
notify: break out desktop notifications from osc.c 2020-12-10 18:06:24 +01:00
Daniel Eklöf
21cc68d49e
osc: implement urxvt’s “OSC 777;notify”
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}’
2020-12-09 20:54:51 +01:00
Daniel Eklöf
360cc8e6de
term: remove read-only properties copied from the config
Use the config directly instead.
2020-11-26 18:08:28 +01:00
Daniel Eklöf
cad0ae957d
osc: use new uri_parse() to parse an OSC7 PWD URI 2020-10-28 19:11:22 +01:00
Daniel Eklöf
b507d3a55e
osc: change info logging to debug logging when changing the cursor color 2020-10-20 21:03:51 +02:00
Daniel Eklöf
edb904a187
osc: don’t explicitly call render_refresh() when changing the color palette
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
2020-09-29 10:05:52 +02:00
Daniel Eklöf
419bd87098
osc52: use first source that actually *has* data 2020-09-09 19:01:42 +02:00
Daniel Eklöf
776b831d89
osc52: unset (clear) selection when an invalid payload is received 2020-09-09 19:01:39 +02:00
Daniel Eklöf
d579c0e1e4
osc: explicitly refresh margins on a background color change 2020-09-01 07:34:41 +02:00
Daniel Eklöf
aa3985a298
Don't use "case X ... Y:", if possible/where it makes sense 2020-08-23 10:07:08 +02:00
Daniel Eklöf
3e1636c013
osc: dirty grids on *all* color modifying sequences
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.
2020-08-18 17:54:11 +02:00
Craig Barnes
104fe2fa55 Fix some spelling mistakes 2020-08-15 19:39:00 +01:00
Craig Barnes
7a77958ba2 Convert most dynamic allocations to use functions from xmalloc.h 2020-08-08 20:37:57 +01:00
Craig Barnes
11a1d99da7 Replace non-portable "\e" escape in string literals with "\033" 2020-08-02 23:54:04 +01:00
Daniel Eklöf
71584aed38
seat: use separate 'enter' serials for keyboard and mouse 2020-07-09 11:20:46 +02:00
Daniel Eklöf
11373a6561
multi-seat: re-enable OSC 52 support 2020-07-08 19:28:08 +02:00
Daniel Eklöf
c470825067
wip: multi-seat support
Compiles and runs, but mouse, clipboard and other things have been
disabled.
2020-07-08 16:45:26 +02:00
Daniel Eklöf
c94cbdeb64
osc: set color: update both grids, but exclude scrollback 2020-06-14 09:34:46 +02:00
Daniel Eklöf
957e482f45
osc: 'Set Color' now updates already rendered cells in current grid
Since we don't have the original palette index in already rendered
cells, we compare the color *value*. If it matches, we assume this was
the color index used, and updates the cell's color.

Note that for performance reasons, we only update the current
grid. This is of course wrong, strictly speaking.

However, it is expected that _Set Color_ is used by full-screen
applications using the alternate grid.
2020-06-11 17:13:32 +02:00
Daniel Eklöf
f72c982c89
osc: don't assert on \E]4 being followed by a ';'
This fixes a crash (in debug builds) that could be triggered by
e.g. cat:ing /dev/urandom.
2020-06-09 17:33:26 +02:00
Daniel Eklöf
ae7383189a
osc: fix scaling of RGB formatted color specifiers 2020-05-02 23:07:26 +02:00
Daniel Eklöf
9eda632c97
osc: OSC 12: mimic xterm - a color value of 0 means use inverted fg/bg 2020-05-02 23:00:21 +02:00
Daniel Eklöf
db9b99e8ac
osc: fix 'OSC 12 ?' to return the cursor color, not the cursor text color 2020-05-02 22:58:30 +02:00
Daniel Eklöf
ac58d05c6b
osc: fix scaling of legacy formatted color specifiers 2020-05-02 22:57:12 +02:00
Daniel Eklöf
5b67e97fc2
osc 104: handle multiple indices the same way we do in OSC 4 - use strtok() 2020-04-04 14:30:50 +02:00
Daniel Eklöf
ae1b235eaa
osc: 4: handle multiple idx;spec pairs 2020-04-04 14:27:44 +02:00
Daniel Eklöf
7466e87a31
osc: ignore OSC 7 when hostname doesn't match our own hostname 2020-04-03 20:15:54 +02:00
Daniel Eklöf
5d702e6fbf
osc: implement OSC 12 and OSC 112 (set/reset text cursor color) 2020-01-20 18:36:19 +01:00
Daniel Eklöf
c3a23cf5b7
osc: implement OSC 7 - set PWD
OSC 7 updates the terminal's view of the current working
directory. The format is OSC 7;URI ST

We decode the URI and updates the term structs 'cwd' member.

This is then used when spawning a new terminal instance.
2019-12-21 19:42:59 +01:00
Daniel Eklöf
d6065ef659
osc: spell "#if 0" correctly 2019-12-19 19:55:52 +01:00
Daniel Eklöf
e7abd6ce97
osc: commented out beginning of OSC 777
I haven't decided if I want to support this
2019-12-19 07:28:10 +01:00
Daniel Eklöf
616896e2a5
csi/ocs/vt: log unhandled/unrecognized sequences as debug messages
Having them as error messages was nice when we where still missing
lots of sequences.

Now we don't anymore, and these just spam stdout as well as syslog
when e.g. cat:ing binary data.
2019-11-29 23:59:24 +01:00
Daniel Eklöf
b58fd1c205
osc 52: default to 'clipboard' if no source/target has been specified 2019-11-28 20:56:55 +01:00
Daniel Eklöf
1980345618
osc: copy to/from clipboard: alias 's' to 'p'
'p' means 'primary', while 's' means 'selection'. Thus, a client can
now request 'selection' clipboard data and will receive it from the
primary selection.
2019-11-19 14:05:31 +01:00
Daniel Eklöf
b15032d223
selection: text_from_{clipboard,primary}: add 'done' callback
This callback is *always* called, including when there has been an
error.

This is in preparation for making text_from_{clipboard,primary}
asynchronous.
2019-11-05 08:49:32 +01:00
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave() 2019-11-03 00:52:24 +01:00
Daniel Eklöf
1adab32906
term: wayland struct is now not a part of the terminal struct
We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
2019-10-27 18:51:14 +01:00
Daniel Eklöf
9f0b1f94c2
wayland: change all wayland callbacks to take a wayland pointer
Instead of passing the terminal to the wayland callbacks, pass a
'struct wayland' pointer.
2019-10-27 18:43:07 +01:00
Daniel Eklöf
f1e94aef2c
osc: xparsecolor: parse 'legacy' colors 2019-08-28 17:29:03 +02:00
Daniel Eklöf
675504308a
osc: add debug logs when colors are changed and reset 2019-08-21 18:54:12 +02:00
Daniel Eklöf
d8fb80ea32
term: rename colors256 -> table 2019-08-21 18:50:24 +02:00
Daniel Eklöf
631e0c0870
term: use colors256 array for *all* colors
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
2019-08-21 18:47:48 +02:00
Daniel Eklöf
65e4b93a03
osc: fix indexing into 'bright' color array 2019-08-21 18:02:18 +02:00
Daniel Eklöf
52ece3592c
osc: implement "change color" commands
This implements OSC 4, 10, 11 - change <color>/foreground/background,
and their corresponding 'query' variant (which was already implemented
for OSC 10/11).

It also implements OSC 104, 110, 111 - reset
<color>/foreground/background.

Set corresponding terminfo entries to signal this support to clients.
2019-08-21 17:57:02 +02:00
Daniel Eklöf
15afd26716
osc: implement copy/paste to/from primary 2019-08-09 21:27:51 +02:00
Daniel Eklöf
e2229c7e2e
osc: bug: uneven clipboard bytes where not buffered correctly
When responding to a OSC 52 clipboard request, we need to base64
encode the clipboard data.

This is done in, potentially, several calls. Since we need at least 3
bytes to be able to produce any base64 output, we may have to buffer
up to 2 bytes between the callback calls with clipboard data.

This was being done incorrectly, where both bytes were written to
index 0 in the buffer.
2019-08-03 21:30:06 +02:00
Daniel Eklöf
6e233f8272
osc: remove TODO 2019-08-03 15:53:13 +02:00
Daniel Eklöf
0d1ba1ffb2
osc: reduce flash interval to 50ms 2019-07-30 22:08:58 +02:00
Daniel Eklöf
e3dc184882
term: break out 'flash' to a separate 'term' function 2019-07-30 22:06:02 +02:00
Daniel Eklöf
8acc3b891d
vt: remove almost all abort() calls
Replace with generic error log messages that simply says the
ESC/CSI/OSC sequence is unhandled. This can mean either invalid or
unimplemented, depending on the context.
2019-07-30 21:42:46 +02:00