Commit graph

6083 commits

Author SHA1 Message Date
Daniel Eklöf
bc8c2e0112
wayland: regression: use correct scaling factor when calling render_resize()
When an output property (such as scaling factor) has changed, we need
to call render_resize() to ensure the window surface is correct (for
example, we may have to change its scale).

The width/height parameters are in *logical* pixels (i.e. already
scaled). For render_resize() to work correctly when the scale is being
changed, it needs to be called with *current* logical size. This means
we need to scale our current width/height using the *old* scaling
factor.
2024-02-07 16:22:33 +01:00
Daniel Eklöf
ebbee61f14
input: remove debug logging 2024-02-06 14:04:59 +01:00
Daniel Eklöf
3b5d83a3ec
pgo: add missing stub for render_refresh_app_id() 2024-02-06 14:04:22 +01:00
Daniel Eklöf
af114f81a0
pgo: fix function prototype for stub function get_current_modifiers() 2024-02-06 14:03:07 +01:00
Daniel Eklöf
4b075bb075
osc: 176 (app-id): implement query+reply
Applications can now query for the current app-id with:

    \E] 176 ; ? \E\\

The reply is

    \E] 176 ; <title> \E\\
2024-02-06 13:55:30 +01:00
Daniel Eklöf
0b95e72073
Merge branch 'app-id' 2024-02-06 13:50:38 +01:00
Daniel Eklöf
22f04f6a84
changelog: OSC-176 - set app-id 2024-02-06 13:50:19 +01:00
delthas
6c56b04b3f
osc: add support for osc 176 (app ID)
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
2024-02-06 13:50:09 +01:00
Daniel Eklöf
4801d3a305
term: drop term->render.title.is_armed
This boolean isn't needed. The idea was probably to not re-program the
timer unnecessarily, or even to prevent it from being moved forward in
time indefinitely.

However, the logic has (probably) gone through some changes, that now
makes it irrelevant.

The timer isn't moved forward indefinitely; it is always set to 8ms
from the last title update. The closer we get to that point in time,
the smaller the timeout we set.

Now, is_armed _did_ prevent the timer from being re-programmed. But
that tiny performance tweak isn't really necessary, as the title
should, in normal cases, not be set that often anyway.
2024-02-06 13:41:09 +01:00
Daniel Eklöf
41dc259744
doc: foot-ctlseq: add OSC 133 C/D (command output start/end) 2024-02-06 13:38:08 +01:00
Daniel Eklöf
316136f428
term: ignore attempts to set a title that contains an invalid UTF-8 sequence
Setting the title ultimately leads to a call to
xdg_toplevel::set_title(). It is a protocol violation to try to set a
title that contains an invalid UTF-8 sequence:

    The string must be encoded in UTF-8.

Closes #1552
2024-02-06 13:10:35 +01:00
Daniel Eklöf
756da87346
changelog: smm+rmm 2024-02-06 12:38:31 +01:00
Daniel Eklöf
9f4eb13e9e
terminfo: smm: enable 8-bit Meta mode
To enable 8-bit meta mode, we need to:

* disable "send ESC when meta modifies a key" (private mode 1036)
* enable "8-bit meta mode" (private mode 1034)

rmm reverses the above.

Closes #1584
2024-02-06 12:38:19 +01:00
Daniel Eklöf
7999975016
Don't use fancy Unicode quotes, stick to ASCII 2024-02-06 12:36:45 +01:00
Daniel Eklöf
d6939dd634
readme: shell integration: fix wiki link 2024-02-06 12:26:00 +01:00
Daniel Eklöf
84e681f028
readme: add "Piping last command's output" to index 2024-02-06 12:14:48 +01:00
Daniel Eklöf
0a302265ec
Merge branch 'pipe-command-output' 2024-02-06 12:13:27 +01:00
Daniel Eklöf
231e6eb3f1
grid: resize with reflow: reflow FTCS_COMMAND_{EXECUTED,FINISHED} 2024-02-06 12:13:09 +01:00
Daniel Eklöf
110a6dd6f0
grid: resize without reflow: truncate shell_integration.cmd_{start,end}
This ensures the cmd start/end columns are valid in the new grid.
2024-02-06 12:13:09 +01:00
Daniel Eklöf
d5308a0493
term: command_output_to_text(): don’t skip FTCS_COMMAND_FINISHED on last row 2024-02-06 12:13:09 +01:00
Daniel Eklöf
1393942de3
readme, doc/foot.1: document shell-integration:command-output tracking 2024-02-06 12:13:09 +01:00
Daniel Eklöf
d7dbb91e65
changelog: pipe-command-output 2024-02-06 12:13:08 +01:00
Daniel Eklöf
0fed2451ea
doc: foot.ini: document pipe-command-output 2024-02-06 12:12:57 +01:00
Daniel Eklöf
f2a8368759
foot.ini: add pipe-command-output key binding 2024-02-06 12:12:57 +01:00
Daniel Eklöf
1c70a84fde
config: add pipe-command-output key-binding 2024-02-06 12:12:57 +01:00
Daniel Eklöf
e9607de5ae
osc: store column of FTCS_COMMAND_{EXECUTED,FINISHED} in row struct 2024-02-06 12:12:57 +01:00
Daniel Eklöf
f8e875a7cd
term: move row->prompt_marker into new struct, row->shell_integration 2024-02-06 12:12:56 +01:00
Daniel Eklöf
0f10c4fd6c
Merge branch 'modifiers'
Closes #1348
2024-02-06 12:11:51 +01:00
Daniel Eklöf
1685f38ee6
changelog: custom modifiers in key bindings 2024-02-06 11:10:36 +01:00
Daniel Eklöf
0aefc2c65d
input: remove the concept of "significant" modifiers
For the purpose of matching key bindings, "significant" modifiers are
no more.

We're really only interested in filtering out "locked"
modifiers. We're already doing this, so there's no need to *also*
match against a set of "significant" modifiers.

Furthermore, we *never* want to consider locked keys (e.g. when
emitting escapes to the client application), thus we can filter those
out already when retrieving the set of active modifiers.

The exception is the kitty keyboard protocol, which has support for
CapsLock and NumLock. Since we're already re-retrieving the "consumed"
modifiers (using the GTK style, rather than normal "XKB" style, to
better match the kitty terminal), we might as well re-retrieve the
effective modifiers as well.
2024-02-06 11:08:42 +01:00
Daniel Eklöf
4730ff8d08
input/config: support *all* modifier names
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.

This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).

Instead, we keep the modifier *names* in a list, in the key binding
struct.

When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.

We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.

Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.

Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
2024-02-06 11:05:20 +01:00
Andrew J. Hesford
21a8d832ce
feature: add resize-by-cells option to constrain window sizes...
...to multiples of the cell size, and preserve grid size when changing
fonts or display scales in floating windows.
2024-02-05 12:14:53 +01:00
Craig Barnes
e0f3703ae6
util: add streq() function and use in place of strcmp(...) == 0 2024-02-05 12:09:52 +01:00
Craig Barnes
44c0cf594b
csi: simplify handling of Set/Reset Mode (SM/RM) sequences 2024-01-27 08:43:32 +01:00
Craig Barnes
91b22ae21a Replace unchecked allocations with calls to xmalloc.h functions 2024-01-25 07:03:50 +00:00
Daniel Eklöf
43e27a8843
wayland: 'mode' is unused when LOG_ENABLE_DBG is not set 2024-01-24 20:00:18 +01:00
Leonardo Hernández Hernández
7e3da3007b
wayland: use wl_compositor version 6 when available 2024-01-24 20:00:18 +01:00
Daniel Eklöf
4ee4f47065
input: kitty: update to latest version of the spec
Starting with kitty 0.32.0, the modifier bits during modifier key
events behave differently, compared to before. Or, rather, they have
now been spec:ed; before, behavior was different on e.g. MacOS, and
Linux.

The new behavior is this:

On key press, the modifier bits in the kitty key event *includes* the
pressed modifier key.

On key release, the modifier bits in the kitty key event does *not*
include the released modifier key.

In other words, The modifier bits reflects the state *after* the key
event.

This is the exact opposite of what foot did before this patch.

The patch is really pretty small: in order to include the key in the
modifier set, we simulate a key press to update the XKB state, using
xkb_state_uppate_key(). For key pressed, we simulate an XKB_KEY_DOWN
event, and for key releases we simulate an XKB_KEY_UP event.

Then we re-retrieve the modifers, both the full set, and the consumed
set.

Closes #1561
2024-01-24 19:57:32 +01:00
Craig Barnes
6ed1c28d2c terminal: simplify some string-related code in reload_fonts() 2024-01-23 22:04:41 +00:00
Artturin
8073ad352b slave: fix typo
```
../slave.c: In function 'slave_spawn':
../slave.c:441:21: error: 'custom_envp' undeclared (first use in this function); did you mean 'custom_env'?
  441 |         add_to_env(&custom_envp, "TERMINFO", FOOT_TERMINFO_PATH);
      |                     ^~~~~~~~~~~
      |                     custom_env
../slave.c:441:21: note: each undeclared identifier is reported only once for each function it appears in
```
2024-01-16 22:40:35 +02:00
Daniel Eklöf
9da7152f83
slave: don't skip setting environment variables when using a custom environment
When launching footclient with -E,--client-environment the environment
variables that should be set by foot, wasn't.

Those variables are:

* TERM
* COLORTERM
* PWD
* SHELL

and all variables defined by the user in the [environment] section in
foot.ini.

In the same way, we did not *unset* TERM_PROGRAM and
TERM_PROGRAM_VERSION.

This patch fixes it by "cloning" the custom environment, making it
mutable, and then adding/removing the variables above from it.

Instead of calling setenv()/unsetenv() directly, we add the wrapper
functions add_to_env() and del_from_env().

When *not* using a custom environment, they simply call
setenv()/unsetenv().

When we *are* using a custom environment, add_to_env() first loops all
existing variables, looking for a match. If a match is found, it's
updated with the new value. If it's not found, a new entry is added.

del_from_env() loops all entries, and removes it when a match is
found. If no match is found, nothing is done.

The mutable environment is allocated on the heap, but never free:d. We
don't need to free it, since it's only allocated after forking, in the
child process.

Closes #1568
2024-01-11 16:37:17 +01:00
Daniel Eklöf
208008d717
config: fix cloning of env_vars tllist
When cloning a config struct, the env_vars tllist wasn't correctly
copied. We did correctly iterate and duplicate all old entries, but we
did *not* reset the list in the cloned struct before doing so.

This meant the list contained entries shared with the original list,
causing double free:s in --server mode.
2024-01-10 16:41:03 +01:00
Daniel Eklöf
a2283c8229
wayland: surface_scale_explicit_width_height(): dont assert width/height are valid for scale, take 2
764248bb0d modified
wayl_surface_scale_explicit_width_height() to not assert the surface
size is valid for the given scaling factor. This, since that function
is only used when scaling a mouse pointer surface.

However, that commit only updated the code path run when fractional
scaling is available (i.e. when the compositor implements the
fractional-scale-v1 protocol).

The legacy code path, that does integer scaling, was still asserting
the surface width/height were divisible with the scaling factor.

For the same reasons this isn't true with fractional scaling
available, it's not true with integer scaling. Fix by skipping the
assertions.

This patch also converts the assertions to more verbose BUG() calls,
that prints more information on the numbers involved.

Closes #1573
2024-01-09 16:47:41 +01:00
Daniel Eklöf
0ca4633898
slave: ignore return value of chdir()
It's not critical.

Fixes

    ../slave.c: In function ‘slave_spawn’:
    ../slave.c:410:9: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
      410 |         chdir("/");
          |         ^~~~~~~~~~
2024-01-05 08:12:32 +01:00
Daniel Eklöf
66f25bb434
slave: chdir to / after spawning the client application
With this patch, the terminal process now changes PWD to / after
spawning the client application.

This ensures the terminal process itself does not "lock" a
directory. For example, we may keep a mount point from being
unmounted.

Closes #1528
2024-01-03 14:07:15 +01:00
LmbMaxim
14472cdbd9
Add poimandres theme 2024-01-03 13:33:31 +01:00
Daniel Eklöf
e5f5a74e81
changelog: formatting 2024-01-03 13:31:35 +01:00
Sivecano
05e6fd969a
support numpad in unicode mode 2024-01-03 13:30:51 +01:00
Craig Barnes
3b3477d657 appstream: update releases list 2023-12-06 16:23:18 +00:00
eugenrh
242767d373 theme: electrophoretic
A theme for grayscale electrophoretic displays (e-ink), which aims
to maximize the contrast between the text and the white background.
2023-11-14 18:30:28 +00:00