Commit graph

5352 commits

Author SHA1 Message Date
Max Gautier
522f4e522e Install notes regarding systemd unit files 2022-02-26 16:10:12 +01:00
Max Gautier
0b7f06bad4 Socket activation changelog entry 2022-02-26 16:09:52 +01:00
Max Gautier
4ec172a4ad Document socket activation feature
- Particular mention to included systemd user units
2022-02-26 16:09:30 +01:00
Max Gautier
1783f69cbd Adding systemd unit files for socket activation
- Support for multiples concurrent instances, templated on
  WAYLAND_DISPLAY
- Use standard input for the socket file descriptor (inetd style)
- Always use the socket provided by systemd with the systemd user
  service
- wayland-instance@.target is intended to be a special target a bit like
  graphical-session.target.
2022-02-26 16:09:30 +01:00
Max Gautier
88a0f7397c Make foot able to receive a socket from its parent
If the argument to --server is parsed as a number, consider it to be a
file descriptor, and use that as a socket.
This is necessary to be able to use socket activation with the server
mode of foot.
2022-02-26 16:09:30 +01:00
Daniel Eklöf
bd5576825f
Merge branch 'scrollback-home-and-end' 2022-02-24 19:23:07 +01:00
Daniel Eklöf
f869ca4546
config/input: add scrollback-home|end key bindings (unbound by default) 2022-02-23 19:03:54 +01:00
Daniel Eklöf
cb43c58150
commands: refactor scrollback up/down
When moving the viewport in the scrollback (i.e. “scrolling”), we need
to ensure the viewport is not moved past the beginning, or end, of the
scrollback.

This was previously accomplish by first limiting the number of lines
to scroll to the number of visible rows (i.e the viewport _size_), and
by adjusting the viewport after moving it, to ensure it doesn’t point
into an uninitialized scrollback area etc.

I.e. the implementation was _reactive_.

This patch rewrites the logic to be _proactive_; we now calculate
_where_ the beginning (or end) of the scrollback is, and then how many
lines there is from there, to the viewport. This is our _maximum_
number of lines to scroll.

When done correctly (which I hope this patch does), this allows us to
remove _all_ checks after moving the viewport - we already _know_ it’s
correct, and valid.

As a bonus, we can remove the old limit, where scrolling was only
allowed to be at most a single page.
2022-02-23 19:03:35 +01:00
Daniel Eklöf
f76c9e77f1
Merge branch 'custom-input-escapes'
Closes #325
2022-02-18 18:40:19 +01:00
Daniel Eklöf
bd9041fdb5
doc: foot.ini: document the new [text-bindings] section 2022-02-16 23:02:27 +01:00
Daniel Eklöf
4e69c1d178
foot.ini: move [text-bindings] section, and update example
Use Super+c -> Ctrl+c as example
2022-02-16 23:02:27 +01:00
Daniel Eklöf
8379b48a9e
changelog: remapping input to custom escape sequences 2022-02-16 23:02:27 +01:00
Daniel Eklöf
cff097197f
config: do key binding collision handling in overrides
This ensures we detect, and handle, collisions also for key-bindings
specified as overrides.
2022-02-16 23:02:25 +01:00
Daniel Eklöf
0018e570d4
tests: config: initial tests for text-bindings 2022-02-16 23:02:07 +01:00
Daniel Eklöf
422d94fb46
wip: map key combos to custom text strings (including escapes)
With this, it is now possible to map key combos to custom escapes. The
new bindings are defined in a new section, “text-bindings”, on the
form “string=key combo”.

The string can consist of printable characters, or \xNN style hex
digits:

  [text-bindings]
  abcd = Control+a
  \x1b[A = Control+b Control+c Control+d  # map ctrl+b/c/d to UP
2022-02-16 23:02:07 +01:00
Daniel Eklöf
8fa16f616c
main: --server: don’t exit with code 0 on failure
A foot --server instance would exit with code 0, even on failure, if
the number of currently open terminal instances were 0.

This is because ‘ret’ assumed failure, and then tried to set it to
‘success’ after the even loop had terminated, basted on the server’s
current state.

Fix by:

* set ‘ret’ to success just before entering the event loop
* set ‘ret’ to failure when we detect an FDM failure
* don’t try to second-guess success/failure after having exited the
  event loop

Closes #943
2022-02-16 22:44:42 +01:00
Craig Barnes
6940d2047e Merge branch 'terminfo-sync-2026' 2022-02-16 19:50:30 +00:00
Craig Barnes
f066f28026 csi: fix case label typo in decrqm()
The other functions that deal with private modes all use 1070 for
term->sixel.use_private_palette. The xterm docs[1] also list this
param as 1070:

> Ps = 1 0 7 0  ⇒  use private color registers for each graphic

Using 1079 seems to have been a mistake in commit 4aa980a6a2.
2022-02-16 17:31:09 +00:00
Craig Barnes
f8262f2125 doc: ctlseq: recommend using DECSET 2026 for synchronized updates
Instead of the somewhat problematic[1] DCS-based equivalent.

[1]: https://codeberg.org/dnkl/foot/issues/459
2022-02-16 14:48:10 +00:00
Craig Barnes
b6ea9d2dbc terminfo: use DECSET 2026 instead of DCS sequences for Sync capability
Even though it makes little difference to foot which is used in the
terminfo entry, DECSET 2026 has some advantages[1] over the DCS
sequences and we should probably promote the better of the 2 where
possible.

Note: the terminfo string was taken from Nicholas Marriott's
suggestion[2] in the terminal-wg discussion.

[1]: https://codeberg.org/dnkl/foot/issues/459
[2]: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2#note_973680
2022-02-16 14:08:22 +00:00
Craig Barnes
9db416ccdc doc: ctlseq: tweak formatting of OSC 22 sequence slightly, for clarity
Having 3 separately underlined words made it look a bit like 3 separate
parameters, at a glance.
2022-02-15 15:39:35 +00:00
Craig Barnes
3d3ee2274f doc: ctlseq: make OSC 8 formatting consistent with other sequences 2022-02-15 15:35:04 +00:00
Craig Barnes
23cf80667a Explicitly initialize sigaction::sa_mask members with sigemptyset(3)
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

> Applications shall call either sigemptyset() or sigfillset() at least
> once for each object of type sigset_t prior to any other use of that
> object. If such an object is not initialized in this way, but is
> nonetheless supplied as an argument to any of pthread_sigmask(),
> sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
> sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
> sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
2022-02-12 12:26:42 +00:00
Daniel Eklöf
d34c8007f1
osc: don’t damage the entire view on a single color palette update
Instead, loop the viewport and dirty only those cells that are
affected by the palette change.
2022-02-10 20:09:11 +01:00
Craig Barnes
3c232bec28 Merge branch 'remove-decset-27127' 2022-02-09 20:59:36 +00:00
Craig Barnes
e32707ffc0 csi/input: remove private mode 27127
This effectively reverts commit 31c73f0cf0.
2022-02-09 20:50:20 +00:00
Daniel Eklöf
990a15250a
meson: fcft-3.0.0 is buggy, require 3.0.1
Fcft-3.0.0 is known to cause crashes. We don’t want anyone ever
compiling foot against it.

Closes #935
2022-02-09 21:48:34 +01:00
Daniel Eklöf
ee840a308a
Merge branch 'refactor-key-bindings' 2022-02-09 17:52:37 +01:00
Daniel Eklöf
757768dbe5
config: rename csd.color.close -> quit
This fixes a compilation error on FreeBSD:

../../foot/render.c:2055:45: error: no member named 'epoll_shim_close' in 'struct config::(anonymous at ../../foot/config.h:254:9)'
        conf_color = &term->conf->csd.color.close;
                      ~~~~~~~~~~~~~~~~~~~~~ ^

/usr/local/include/libepoll-shim/epoll-shim/detail/common.h:8:15:
note: expanded from macro 'close': #define close epoll_shim_close
2022-02-09 17:51:05 +01:00
Daniel Eklöf
fed90646d3
input/search/url: pass pointer-to key-binding struct to execute() 2022-02-09 17:51:05 +01:00
Daniel Eklöf
e5c5cd5478
config: ‘pipe’ is now optional ‘aux’ data in the key-binding struct
This allows us to add helper functions that e.g. compare bindings’ aux
data in a generic way.
2022-02-09 17:51:05 +01:00
Daniel Eklöf
9814d96206
config: rename enum config_key_binding_type -> key_binding_type 2022-02-09 17:51:05 +01:00
Daniel Eklöf
56b948ca20
input: call wayl_bindings_reset() when receiving a new keymap 2022-02-09 17:51:05 +01:00
Daniel Eklöf
026785b777
wayland: add wayl_bindings_reset()
This function resets (clears) all key- and mouse-bindings associated
with the seat.
2022-02-09 17:51:05 +01:00
Daniel Eklöf
e1a4b5c5a8
wayland: use key_bindings_destroy() to destroy the mouse bindings 2022-02-09 17:51:05 +01:00
Daniel Eklöf
dcd79065c8
wayland: unify key- and mouse-binding structs 2022-02-09 17:51:04 +01:00
Daniel Eklöf
d04bc6ab10
config: move structs and enums used by config from terminal.h -> config.h 2022-02-09 17:51:04 +01:00
Johannes Altmanninger
cbae14f0c5
foot.ini: add modeline so vim uses # comments instead of ;
Editors like Vim and Kakoune ship filetypes dosini and ini
respectively. Both use ";" as comment character, which is used for
example by Vim's "gq" command which wraps lines while preserving
comment prefixes.

foot only accepts # comments. I think it's desirable to stick to
a single commenting style (easier to diff configs).

Make Vim accept that by adding modeline to use the "conf"
filetype, which is for "generic Unix config files".  We already
have an Emacs modeline at the top, but Vim seems to ignore it.
Kakoune doesn't have that filetype, but a patch has been
proposed to use # whenever it already occurs in the file, see
https://github.com/mawww/kakoune/pull/4537
2022-02-09 17:48:44 +01:00
Daniel Eklöf
c9da1dc152
Merge branch 'fallback-mouse-cursor'
Closes #738
2022-02-07 18:07:35 +01:00
Ashish SHUKLA
5631f16a62
changelog: fallback xcursor 2022-02-07 22:17:31 +05:30
Ashish SHUKLA
4df73585e7
Specify a fallback mouse cursor
`text' cursor is not available in lots of cursor themes, but `xterm'
is, so specify `xterm' as a fallback cursor name.
2022-02-07 22:15:47 +05:30
Ashish SHUKLA
91559fe480
pgo: add stub for render_xcursor_is_valid 2022-02-07 22:15:07 +05:30
Daniel Eklöf
f718af4c1b
doc: ctlseq: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
448a0f2833
changelog: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
6cdaa4fd0a
osc: implement OSC-22 - set xcursor pointer 2022-02-07 17:28:37 +01:00
Daniel Eklöf
0bf92fff05
term: add term_set_user_mouse_cursor()
This function allows setting a custom mouse cursor.

This is done by adding a ‘char*’ member to the term struct. When it is
non-NULL, we *always* use that pointer (the exception being when the
pointer is hidden), while the pointer is over the grid. This is
instead of the hand/beam pointers we otherwise would use.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
e4f9dc7d58
render: add render_xcursor_is_valid()
Returns true if the provided cursor name is non-NULL, and exist in the
currently loaded xcursor theme.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
92ebe00927
render: call wl_cursor_theme_get_cursor() earlier
Before this patch, wl_cursor_theme_get_cursor() was called in the FDM
hook, just before we’re about to update the mouse cursor “for real”.

This relies on seat->pointer.xcursor still being valid. This is true
as long as we’re only using our compiled-in static xcursor names, but
not otherwise.

Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At
this point, we *know* seat->pointer.xcursor is valid.

There is a slight chance of added overhead here, if the client
application is switching mouse grabbing on/off rapidly. Before, the
calls to wl_cursor_theme_get_cursor() would automatically be
throttled.

However, the main point of delaying the actual pointer update to the FDM
hook is to throttle the *Wayland* calls. And this is still happening:
wl_cursor_theme_get_cursor() is client-side only.
2022-02-07 17:28:28 +01:00
Daniel Eklöf
22307565ac
Merge branch 'pipe-scrollback-crash'
Closes #926
2022-02-07 15:13:31 +01:00
Daniel Eklöf
91be6d2e6e
changelog: crash in pipe-scrollback 2022-02-07 15:12:46 +01:00