aboutsummaryrefslogtreecommitdiff
path: root/main.c (follow)
Commit message (Collapse)AuthorAgeLines
* server: sigusr1/2: update conf object with the "new" themeDaniel Eklöf2025-07-30-13/+23
| | | | | | | | When sending SIGUSR1/SIGUSR2 to a server process, all currently running client instances change their theme. But before this patch, all future instances used the original theme. With this patch, the server owned config object is updated with the selected theme, thus making new instances use the same theme as well.
* main: unregister SIGUSR2 on exitDaniel Eklöf2025-07-18-0/+1
|
* main: SIGUSR1 selects the first color theme, SIGUSR2 the secondDaniel Eklöf2025-07-18-5/+17
| | | | | | | | | | Before this patch, SIGUSR1 toggled between [colors] and [colors2]. Now, SIGUSR1 changes to [colors], regardless of what the current color theme is, and SIGUSR2 changes to [colors2]. Closes #2144
* main: do a theme toggle upon receiving SIGUSR1Daniel Eklöf2025-06-10-0/+17
| | | | Caveat: in server mode, *all* instances toggle their themes.
* main/client: simplify code for printing --version stringCraig Barnes2025-03-14-17/+2
|
* meson: require wayland-protocols >= 1.41Daniel Eklöf2025-03-13-4/+1
|
* fcft: require fcft >= 3.3.0, add support for new scaling-filtersDaniel Eklöf2025-03-12-1/+0
| | | | | | | | Update tweak.scaling-filter to recognize the new scaling filters added in fcft-3.3.0. Since fcft_set_scaling_filter() is deprecated in 3.3.0, don't use it anymore, and set the scaling filter via fcft_font_options instead.
* render: gamma-correct blendingDaniel Eklöf2025-03-05-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements gamma-correct blending, which mainly affects font rendering. The implementation requires compile-time availability of the new color-management protocol (available in wayland-protocols >= 1.41), and run-time support for the same in the compositor (specifically, the EXT_LINEAR TF function and sRGB primaries). How it works: all colors are decoded from sRGB to linear (using a lookup table, generated in the exact same way pixman generates it's internal conversion tables) before being used by pixman. The resulting image buffer is thus in decoded/linear format. We use the color-management protocol to inform the compositor of this, by tagging the wayland surfaces with the 'ext_linear' image attribute. Sixes: all colors are sRGB internally, and decoded to linear before being used in any sixels. Thus, the image buffers will contain linear colors. This is important, since otherwise there would be a decode/encode penalty every time a sixel is blended to the grid. Emojis: we require fcft >= 3.2, which adds support for sRGB decoding color glyphs. Meaning, the emoji pixman surfaces can be blended directly to the grid, just like sixels. Gamma-correct blending is enabled by default *when the compositor supports it*. There's a new option to explicitly enable/disable it: gamma-correct-blending=no|yes. If set to 'yes', and the compositor does not implement the required color-management features, warning logs are emitted. There's a loss of precision when storing linear pixels in 8-bit channels. For this reason, this patch also adds supports for 10-bit surfaces. For now, this is disabled by default since such surfaces only have 2 bits for alpha. It can be enabled with tweak.surface-bit-depth=10-bit. Perhaps, in the future, we can enable it by default if: * gamma-correct blending is enabled * the user has not enabled a transparent background
* fix infinite loop/oom when cwd longer then 1024camel-cdr2025-01-24-1/+1
| | | | | | The code reads cwd into a buffer, which is expanded while errno is ERANGE, with the intent of growing the buffer until the path fits. While getcwd will set errno on error, it will not reset it once the path fits into the buffer. So to not get an infinite loop once errno is ERANGE, we need to make sure to reset errno, such that the loop behaves as expected.
* features: add +/-system-bell to version outputDaniel Eklöf2025-01-17-1/+2
|
* main: include toplevel-icon support in --version outputDaniel Eklöf2024-09-13-1/+2
|
* main: spell out the most common reason for setlocale() to failDaniel Eklöf2024-08-13-1/+2
|
* main: invalid locale != non-UTF-8 localeDaniel Eklöf2024-08-13-18/+35
| | | | | | | | When doing locale fallback, and printing user notifications and log warnings, better separate the case "locale is invalid" from "locale is valid but not UTF-8". Closes #1798
* xmalloc: remove delim param from xstrjoin() and add separate xstrjoin3()Craig Barnes2024-08-03-7/+11
| | | | | | | | | | | 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
* Remove a number of unused includesDaniel Eklöf2024-08-02-3/+0
|
* osc: kitty notifications: cleanup and update to latest version of specDaniel Eklöf2024-08-02-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* main/config: replace some uses of xasprintf() with xstrjoin()Craig Barnes2024-03-16-4/+4
|
* Add support for opening an existing PTYAlyssa Ross2024-03-14-1/+18
| | | | | | | | | | | | | | | | | Virtual machine monitor programs (e.g. QEMU, Cloud Hypervisor) expose guest consoles as PTYs. With this patch, foot can access these guest consoles. Usually, the program used for accessing these PTYs is screen, but screen is barely developed, doesn't support resizing, and has a bunch of other unrelated stuff going on. It would be nice to have a terminal emulator that properly supported opening an existing PTY. The VMM controls the master end of the PTY, so to the other end (in this case foot), it just behaves like any application running in a directly-opened PTY, and all that's needed is to change foot's code to support opening an existing PTY rather than creating one. Co-authored-by: tanto <tanto@ccc.ac>
* Don't use fancy Unicode quotes, stick to ASCIIDaniel Eklöf2024-02-06-1/+1
|
* util: add streq() function and use in place of strcmp(...) == 0Craig Barnes2024-02-05-4/+4
|
* main: correct short option case in help output for disabling syslogJan Palus2023-10-27-1/+1
|
* Codespell fixesDaniel Eklöf2023-10-03-1/+1
|
* wayland: cursor-shape-v1 is now always availableDaniel Eklöf2023-08-07-2/+1
| | | | Since we're requiring wayland-protocols >= 1.32
* wayland: fractional-scale-v1 is now always availableDaniel Eklöf2023-08-07-2/+1
| | | | Since we're requiring wayland-protocols >= 1.32
* main: “title%s” -> “title=%s”Daniel Eklöf2023-08-05-1/+1
| | | | | | | | Fix regression of --title,-T option. This broken when command line parsing was switched to using overrides, in 0b4f1b4af20cea0afae39a2c1c4e42c22962dcde. Closes #1457
* main: translate command line options to overridesDaniel Eklöf2023-07-31-89/+18
| | | | | | | | | Instead of special casing configuration affecting command line options (like --font, --fullscreen, --maximized etc), translate them to overrides, and let the configuration system handle them. This also fixes an issue where -f,--font did not set csd.font, if csd.font were otherwise unset.
* main/client: add a version feature flag for cursor-shapeDaniel Eklöf2023-07-03-1/+2
|
* feature: add a feature flag (for --version) for fractional scalingDaniel Eklöf2023-06-29-1/+3
|
* Fix non UTF-8 locale complaintPhillip Susi2023-06-01-4/+6
| | | | | | | | | If the locale isn't UTF-8, foot tries to fall back to C.UTF-8 and prints a warning. The warning was garbled because the name of the original locale is no longer valid after calling setlocale() a second time. Use strdup to stash the original string. Closes #1362
* .desktop: remove StartupWMClass from server, use distinct StartupWMClass for foot and footclientjdevdevdev2023-05-22-1/+1
| | | | | | | | | | | | | | | For this to work, the default app-id of footclient has been changed from ‘foot’ to ‘footclient’. By using distinct StartupWMClasses, the compositor can connect a running foot/footclient instance to the correct .desktop-file. This ensures the correct icon is being used in e.g. docks, and that actions like “open another window” works correctly. Note that the user can override the app-id, either by setting app-id in foot.ini, or with the -a,--app-id command line option. Closes #1355
* main: Graceful fallback if user has configured an invalid localeJoakim Nohlgård2022-12-16-2/+7
|
* change default log level to WARNINGAntoine Beaupré2022-11-22-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default foot output looks like this, in Debian testing "bookworm" at the time of writing: anarcat@angela:pubpaste$ foot true info: main.c:421: version: 1.13.1 +pgo +ime +graphemes -assertions info: main.c:428: arch: Linux x86_64/64-bit info: main.c:440: locale: fr_CA.UTF-8 info: config.c:3003: loading configuration from /home/anarcat/.config/foot/foot.ini info: fcft.c:338: fcft: 3.1.5 +graphemes -runs +svg(nanosvg) -assertions info: fcft.c:377: fontconfig: 2.13.1, freetype: 2.12.1, harfbuzz: 5.2.0 info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=8.00pt/8px, dpi=75.00 info: wayland.c:1353: eDP-1: 2256x1504+0x0@60Hz 0x095F 13.32" scale=2 PPI=205x214 (physical) PPI=136x143 (logical), DPI=271.31 info: wayland.c:1509: requesting SSD decorations info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Bold.otf: size=24.00pt/32px, dpi=96.00 info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=24.00pt/32px, dpi=96.00 info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Bold.otf: size=24.00pt/32px, dpi=96.00 info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=24.00pt/32px, dpi=96.00 info: terminal.c:700: cell width=19, height=39 info: terminal.c:588: using 16 rendering threads info: wayland.c:859: using SSD decorations info: main.c:680: goodbye anarcat@angela:pubpaste$ That's 17 lines of output that are *mostly* useless for most use cases. I might understand having this output during the project's startup, when it's helpful for diagnostics, but now Foot just mostly works everywhere, and I've never had a use for any of that stuff in the (arguably short) time I've been using Foot so far. And if I do, there's the `--log-level` commandline option to tweak this. At first, I looked at tweaking the log level through the config file. But as explained in this issue: https://codeberg.org/dnkl/foot/issues/1142 ... there's a chicken and egg problem there that makes it hard to implement and possibly confusing for users as well. There's also the possibility for users to change the shortcut with which they start foot, for example a `.desktop` file so that menu systems that support those start foot properly. But that only works in that environment, and not through the so many things that will just call `foot` and hope it will do the right thing. In my case, I have `foot` hardcoded in a lot of places now, between sway and waybar, and this is only going to grow. Others have suggested adding the flag to a $TERMINAL global variable, but that won't help .desktop users. So, instead of playing whack-a-mole with the log levels, just make it so that, by default, foot is silent. This is actually one of the [basics of UNIX philosophy][1]: > Rule of Silence: When a program has nothing surprising to say, it > should say nothing. And yes, I am aware I am severely violating that principle by writing a way too long commit log for a one-line patch, but there you go, I figured it was good to document the why of this properly. [1]: https://web.archive.org/web/20031102053334/http://www.faqs.org/docs/artu/ch01s06.html
* main/client: use $PWD for cwd, when $PWD is validDaniel Eklöf2022-10-02-0/+22
| | | | | | | | | If $PWD is set, and its resolved path matches the *actual* working directory, use $PWD for cwd when instantiating the terminal. This makes a difference when $PWD refers to a symlink; before this patch, we’d instantiate the terminal in the *resolved* path. Now it’ll use the symlink instead.
* main: minor rewording of non-UTF8 locale warnings and errorsDaniel Eklöf2022-05-14-6/+6
|
* wayland: refactor: remove ‘struct config’ pointer from wayland structDaniel Eklöf2022-04-17-1/+4
| | | | | | | | | | | | | | The global config doesn’t necessarily reflect the correct configuration to use - we should *always* use the current terminal instance’s conf pointer. * Move selection override modifier mask to the key_binding_set struct * Always warn if XDG activation is unavailable, not just if bell.urgent is set (we no longer have access to this information) * Pass ‘bool presentation_timings’ as a parameter to wayl_init() * Remove ‘presentation_timings’ member from the ‘terminal’ struct Closes #932
* key-binding: new API, for handling sets of key bindingsDaniel Eklöf2022-04-17-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, our Wayland seats have been tracking key bindings. This makes sense, since the seat’s keymap determines how the key bindings are resolved. However, tying bindings to the seat/keymap alone isn’t enough, since we also depend on the current configuration (i.e. user settings) when resolving a key binding. This means configurations that doesn’t match the wayland object’s configuration, currently don’t resolve key bindings correctly. This applies to footclients where the user has overridden key bindings on the command line (e.g. --override key-bindings.foo=bar). Thus, to correctly resolve key bindings, each set of key bindings must be tied *both* to a seat/keymap, *and* a configuration. This patch introduces a key-binding manager, with an API to add/remove/lookup, and load/unload keymaps from sets of key bindings. In the API, sets are tied to a seat and terminal instance, since this makes the most sense (we need to instantiate, or incref a set whenever a new terminal instance is created). Internally, the set is tied to a seat and the terminal’s configuration. Sets are *added* when a new seat is added, and when a new terminal instance is created. Since there can only be one instance of each seat, sets are always removed when a seat is removed. Terminals on the other hand can re-use the same configuration (and typically do). Thus, sets ref-count the configuration. In other words, when instantiating a new terminal, we may not have to instantiate a new set of key bindings, but can often be incref:ed instead. Whenever the keymap changes on a seat, all key bindings sets associated with that seat reloads (re-resolves) their key bindings. Closes #931
* config: config_free(): pass conf struct by pointer, not by-valueDaniel Eklöf2022-04-12-3/+3
|
* client: add -E,--client-environmentDaniel Eklöf2022-04-12-1/+1
| | | | | | | | | | | | | | | | | When this option is used, the child process in the new terminal instance will inherit its environment from the footclient process, instead of the foot server’s. Implemented by sending (yet another) dynamic string list as part of the client -> server setup packet. When the new option is *not* used, the setup packet is now 2 bytes larger than before. On the server side, the slave process now uses execvpe() instead of execvp(). There’s plumbing to propagate a new ‘envp’ argument from term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we use ‘environ’ instead (thus matching the old behavior of execvp()). Closes #1004
* main: --server: don’t exit with code 0 on failureDaniel Eklöf2022-02-16-4/+4
| | | | | | | | | | | | | | | | | | 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
* Explicitly initialize sigaction::sa_mask members with sigemptyset(3)Craig Barnes2022-02-12-1/+2
| | | | | | | | | | | | | | | | | | | | 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
* main: remove debug loggingDaniel Eklöf2022-02-05-2/+0
|
* fcft: adapt to API changes in fcft-3.xDaniel Eklöf2022-02-05-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fcft no longer uses wchar_t, but plain uint32_t to represent codepoints. Since we do a fair amount of string operations in foot, it still makes sense to use something that actually _is_ a string (or character), rather than an array of uint32_t. For this reason, we switch out all wchar_t usage in foot to char32_t. We also verify, at compile-time, that char32_t used UTF-32 (which is what fcft expects). Unfortunately, there are no string functions for char32_t. To avoid having to re-implement all wcs*() functions, we add a small wrapper layer of c32*() functions. These wrapper functions take char32_t arguments, but then simply call the corresponding wcs*() function. For this to work, wcs*() must _also_ be UTF-32 compatible. We can check for the presence of the __STDC_ISO_10646__ macro. If set, wchar_t is at least 4 bytes and its internal representation is UTF-32. FreeBSD does *not* define this macro, because its internal wchar_t representation depends on the current locale. It _does_ use UTF-32 _if_ the current locale is UTF-8. Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is defined. Other fcft API changes: * fcft_glyph_rasterize() -> fcft_codepoint_rasterize() * font.space_advance has been removed * ‘tags’ have been removed from fcft_grapheme_rasterize() * ‘fcft_log_init()’ removed * ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
* main: reset signal mask and signal handlers at startupDaniel Eklöf2022-02-04-0/+16
| | | | | | | | This ensures processes spawned by us (e.g. the shell, new terminal instances etc) don’t inherit a flawed signal mask, or having signals unknowingly ignored. Closes #854
* main: log locale errors (in addition to adding a user notification)Daniel Eklöf2022-01-13-5/+7
|
* main: display warning only, when we succeed in enabling a fallback localeDaniel Eklöf2022-01-13-12/+21
|
* main: try to force an UTF-8 locale if user’s locale isn’t UTF-8Daniel Eklöf2022-01-13-0/+19
|
* main: present invalid locale errors as a user-notificationDaniel Eklöf2022-01-13-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Foot does not support running under non-UTF8 locales. If we detect a non-UTF8 locale, we log this and exit with an error. However, it appears a fairly common situation is this: user (knowingly or unknowingly) only configures his/hers locale in e.g. the shell RC files. These aren’t sourced when the compositor is started via a display manager. Thus, compositor key binds will fail to launch, and the user typically has no way of seeing foot’s output. So, the user proceeds to start another terminal, and from that one tries launching foot. And it works... (because the shell in the other terminal sourced the locale configuration). User is left confused and often don’t know how to debug. This patch is somewhat hackish; in addition to logging the locale error, it also pushes a user notification. For this to be visible, we need to actually start a terminal window. So, we ignore the configured shell, and we ignore any custom command line, and instead spawns “/bin/sh -c ‘’”. This allows us to get something running (that hopefully doesn’t produce too much output we can’t decode due to the non-UTF8 locale). But, it will exit immediately. So we also set the --hold flag. This works, and may be a good enough “solution”. However, it only works for standalone foot instances, not footclients.
* foot{,client}: handle argc == 0Daniel Eklöf2022-01-01-3/+5
| | | | | | | | | | | | | | Our getopt_long() based argument parser would (correctly) break out of the while loop immediately. However, we would then proceed and decrement ‘argc’ by 1, resulting in it being -1. This was then passed to the terminal constructor, which passed it on to the client application fork+exec logic. That finally resulted in an exec(3) failure: err: slave.c:339: SHELL=/bin/zsh: failed to execute: No such file or directory err: fdm.c:215: no such FD: 7 info: main.c:604: goodbye
* config: csd.border_width now always reflects the full/total widthDaniel Eklöf2021-12-22-1/+3
|
* main: ignore SIGPIPEDaniel Eklöf2021-12-11-2/+5
| | | | | | | | | | | We want to handle SIGPIPEs without crashing... One way to trigger this was to use e.g. pipe-visible=[cat /foo/bar] Control+Shift+q That is, pipe output to something that did not consume it. This led to a SIGPIPE when we tried to write the terminal contents to the pipe, and crashed the whole foot instance.
* main: improve handling of setlocale(3) return valueCraig Barnes2021-11-10-2/+6
| | | | | | | | | There's no need to call setlocale() twice, since the first call returns the same value as the second. We also handle a NULL return value explicitly and show a distinct error message for that case, since it typically indicates a misconfigured locale and not just a non-UTF8 locale.
* foot/client: implement xdga client activationRonan Pigott2021-11-01-1/+6
| | | | | | | | | | | This is an application of the xdg activation protocol that will allow compositors to associate new foot toplevels with the command that launched them. footclient receives an activation token from the launcher which the compositor can use to track application startup. It passes the token to the foot server, which then activates the new window with the token to complete the startup sequence.
* foot/client: version info: add +/- assertionsDaniel Eklöf2021-10-23-2/+3
|
* main/client: add no-op "-e" command-line optionCraig Barnes2021-09-18-2/+6
|
* main/client: replace some uses of printf() with puts() in print_usage()Craig Barnes2021-09-18-8/+8
| | | | | | FOOT_DEFAULT_TERM is a string literal passed as a -D argument to the compiler, so it can just be concatenated with the other string literals, instead of being formatted with printf().
* main: verify primary font is monospaced at startupDaniel Eklöf2021-08-31-0/+5
| | | | | | | | | | Load a couple of ASCII glyphs and check if their advance widths matches. If not, warn the user that the font is probably not monospaced. This can be disabled by setting tweak.font-monospace-warn=no. Closes #704.
* terminfo: install to $datadir/foot/terminfo by default, append to TERMINFO_DIRSDaniel Eklöf2021-08-17-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of 2021-07-31, ncurses ships its own version of foot’s terminfo. Since: * It doesn’t have the non-standard Sync,Tc,setrgbf,setrgbb capabilities. * It doesn’t set hs,fsl,dsl (statusbar). * We want to be able to update our termminfo without waiting for an ncurses release. * Foot should be installable and usable on Linux systems that doesn’t have the latest ncurses. we still want to ship our own version. We can however not install it to the default terminfo location (e.g. /usr/share/terminfo), since it will collide with the ncurses provided files. Our options are to either rename our terminfo to something else, or to keep the name, but install our terminfo files somewhere else. The first option would be the easy one. However, I think it makes sense to use the same name. For example, a user that SSH’s into a remote system that does *not* have our own version installed, but *does* have the ncurses one, will gracefully fall back to that one, which is better than manually having to set e.g. TERM=xterm-256color. Now, if we want to use the same name, we need to install it somewhere else. But where? And how do we ensure our version is preferred over the ncurses one? I opted to $datadir/foot/terminfo (e.g. /usr/share/foot/terminfo) by default. It makes it namespaced to foot (i.e. we’re not introducing a new “standard” terminfo location), thus guaranteeing it wont collide with ncurses. To enable applications to find it, we export TERMINFO_DIRS. This is a list of *additional* directories to search for terminfo files. If it’s already defined, we *append* to it. The nice thing with this is, if there’s no terminfo in that location (e.g. when you SSH into a remote), the default terminfo location is *also* searched. But only *after* having searched through TERMINFO_DIRS. In short: our version is preferred, but the ncurses one (or an older version of our terminfo package!) will be used if ours cannot be found. To enable packagers full control over the new behavior, the existing meson command line options have been modified, and a new option added: -Dterminfo=disabled|enabled|auto: *build* and *install* the terminfo files. -Dcustom-terminfo-install-location=<path>: *where* the terminfo files are expected to be found. This *needs* to be set *even* if -Dterminfo=disabled. For example, if the packaging script builds and packages the terminfo files separate from the regular foot build. The path is *relative to $prefix*, and defaults to $datadir/foot/terminfo. This is the value that will be appended to TERMINFO_DIRS. Note that you can set it to ‘no’, in which case foot will *not* set/modify TERMINFO_DIRS. Only do this if you don’t intend to package foot’s terminfo files at all (i.e. you plan on using the ncurses ones only). -Ddefault-terminfo=foot. Allows overriding the default TERM value. This should only be changed if the target platform doesn’t support terminfo files. Closes #671
* log: add LOG_CLASS_NONE and use as initializer for log_levelCraig Barnes2021-06-26-23/+26
| | | | | | | | | | | | This means that logging will be completely disabled until log_init() has been called, which is useful to prevent log spam when running UNITTEST{} blocks in debug builds. Note that this doesn't change the default log level at runtime, which was already being set to LOG_CLASS_INFO in main.c and client.c. The new log level is also exposed to the command-line interface as `--log-level=none`, which allows disabling logging entirely.
* foot: add +/-graphemes to version outputDaniel Eklöf2021-06-24-2/+3
|
* main: usage: add ‘=’ between --override and its valueDaniel Eklöf2021-06-23-1/+1
| | | | This is how all other long options are documented in the usage.
* config: don’t use tllist where it isn’t necessaryDaniel Eklöf2021-06-18-6/+11
| | | | | | | | | | | | | | | | tllists are great when dealing with dynamically changing lists. They are also very easy to use when building lists/arrays where the final size is unknown. However, this ease of use comes at a price: code size. tll-macros expand to a lot of code. Since things in the config are static, once the config has been loaded, using tllists for configuration data structures doesn’t make much sense. This patch replaces nearly all tllists used by the configuration, with dynamically allocated arrays.
* Override options from command lineRyan Farley2021-06-12-2/+12
| | | | | | | | | Allow any configuration option to be overridden with -o/--override 'section.key=value' arguments, as suggested in #554 update completitions for override slight refactoring to ease footclient support
* main/client: change exit codeDaniel Eklöf2021-05-04-1/+1
| | | | | | | | * foot exits with -26/230 * footclient exits with -36/220 This is to give each application a range of exit codes. Currently unused, but we may want to change this in the future.
* foot/footclient: use a custom exit code when foot/footclient fail to runDaniel Eklöf2021-05-04-9/+13
| | | | | | | | | | | | | | | | | | | Normally, foot and footclient uses the exit code from the client application (i.e. the shell). However, foot (or footclient) itself may fail to run; if run outside of a Wayland session, or no fonts are installed, or the client application/shell cannot be found (“foot lsdjfldsjf”) etc. Up until now, there has been no way to differentiate these kind of failures from the client application exiting with code 1. This patch changes foot’s failure exit code to -27/229, and footclient’s to -28/228. Note that footclient will exit with foot’s -27/229 if footclient ran successfully, but the foot server failed to instantiate a new window. Closes #466.
* main: explicitly cast log_colorize to enum fcft_log_colorizeDaniel Eklöf2021-04-17-2/+4
| | | | | | | | Fixes error in Clang builds: ../../foot/main.c:376:19: error: implicit conversion from enumeration type 'enum log_colorize' to different enumeration type 'enum fcft_log_colorize' [-Werror,-Wenum-conversion] fcft_log_init(log_colorize, as_server && log_syslog, log_level + 1); ~~~~~~~~~~~~~ ^~~~~~~~~~~~
* main: call fcft_log_init(). Note that this requires fcft >= 2.3.90Daniel Eklöf2021-04-17-0/+4
|
* features: --version now logs +/-pgoDaniel Eklöf2021-03-26-2/+4
| | | | That is, whether the binary was compiled with PGO or not.
* config: reuse HAVE_TERMINFO via DEFAULT_TERMChloe Kudryavtsev2021-02-26-2/+2
| | | | | add detection in --help output also make it more easily accessible for other locations to change
* main: initialize pseudo-random generatorDaniel Eklöf2021-02-21-0/+2
|
* main: -D,--working-directory: check path exists and is a directoryDaniel Eklöf2021-02-13-1/+7
|
* main/client: add -D,--working-directory=DIRDaniel Eklöf2021-02-12-8/+18
| | | | | This overrides the CWD the slave process chdir()’s into before exec:ing the client application.
* main/client: add missing short options to usage (--help output)Daniel Eklöf2021-02-12-6/+6
| | | | | | | | | | | | | | | | | | Initially, these options *did not* have short options. Then, in e81388336750a20a2da98a57e9726c8ba1b481e3, the short options were added to footclient’s getopt_long() call. This was in a sense incorrect. But instead of reverting it, the short options were made official in 8eaa1959904ecff0e7e75d152220344457912f76, by adding the short options to foot, documenting them in the man pages, and adding them to the shell completions. Though the commit message of 8eaa1959904ecff0e7e75d152220344457912f76 says the options have now been included in usage(), they were in fact *not* added to usage. This patch does just that.
* Merge branch 'log-level'Daniel Eklöf2021-02-11-20/+38
|\ | | | | | | Closes #337
| * main: client: factor out some common code for "--log-level" optionCraig Barnes2021-02-11-29/+8
| |
| * main: add -d,--log-level=[debug,info,warning,error]Daniel Eklöf2021-02-09-20/+59
| |
* | main: monitor SIGINT+SIGTERM using the FDMDaniel Eklöf2021-02-11-9/+10
|/
* main: include uname.sysname when logging host architectureDaniel Eklöf2021-02-07-1/+2
|
* main: correct header for mode macrosJan Beich2021-01-21-1/+1
| | | | | | | | | | | | | | | | | | main.c:13:10: fatal error: 'sys/sysinfo.h' file not found #include <sys/sysinfo.h> ^~~~~~~~~~~~~~~ main.c:122:28: error: use of undeclared identifier 'S_IRUSR' S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { ^ main.c:122:38: error: use of undeclared identifier 'S_IWUSR' S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { ^ main.c:122:48: error: use of undeclared identifier 'S_IRGRP' S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { ^ main.c:122:58: error: use of undeclared identifier 'S_IROTH' S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { ^
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-2/+2
|
* Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes2021-01-14-2/+3
|
* main: remove deprecated "--geometry" optionCraig Barnes2021-01-13-15/+3
| | | | Closes #287
* config_font_parse(): return fail/successDaniel Eklöf2020-12-15-2/+7
|
* features: include compile-time enable/disable state of features when printing versionDaniel Eklöf2020-12-07-2/+12
|
* config: replace union in config struct with simple width/height membersCraig Barnes2020-11-30-12/+2
|
* main: tag fdm loop with likely() and unlikely()Daniel Eklöf2020-11-26-2/+2
|
* foot/footclient: add short options to all command line optionsDaniel Eklöf2020-11-23-1/+1
| | | | | | | | | | | e81388336750a20a2da98a57e9726c8ba1b481e3 added “missing” short command line options to footclient. Except they weren’t missing; they were intentionally missing short options and only supported long options. This commit makes the new/missing short options “official”, by adding documentation, zsh completions and including them in usage().
* main: remove trailing ‘, ’ from arch log lineDaniel Eklöf2020-10-25-1/+1
|
* config: add font-bold, font-italic and font-bold-italic optionsDaniel Eklöf2020-10-20-4/+7
| | | | | | | | | | These options lets the user configure custom fonts and styles, to use with the bold and italic cell attributes. By default, they are unset, meaning we use the bold/italic variants of the regular font. Closes #169.
* main: configure locale *before* loading the configDaniel Eklöf2020-10-09-7/+7
| | | | | Without this, config_load() can’t use wide-character functions properly.
* config: add tweak.scaling-filterDaniel Eklöf2020-09-13-0/+2
| | | | | | | | Use the new fcft_set_scaling_filter() API to use a non-default scaling filter. By default, we use lanczo3, the ‘best’ filter. This overrides the default in fcft, which is ‘cubic’ filtering.
* Add -W,--window-size-chars, and foot.ini:initial-window-size-charsDaniel Eklöf2020-09-08-27/+68
| | | | | | | | | | | * Add -W,--window-size-chars command line option * Add initial-window-size-chars foot.ini option * Add -w,--window-size-pixels command line option * Add initial-window-size-pixels foot.ini option * Deprecate -g,--geometry command line option in favor of -w,--window-size-pixels * Deprecate geometry option in foot.ini in favor of initial-window-size-pixels
* main: usage: footrc -> foot.iniDaniel Eklöf2020-08-27-1/+1
|
* main: include our own bitness when logging the architectureDaniel Eklöf2020-08-11-1/+1
|
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-5/+6
|
* server/client: use $WAYLAND_DISPLAY instead of $XDG_SESSION_ID in default socket pathDaniel Eklöf2020-08-02-1/+1
| | | | | | | | | Foot is a Wayland client and cannot be run outside of a Wayland session. As such, it makes more sense to use $WAYLAND_SESSION instead of $XDG_SESSION_ID in the default socket path since this makes it clearer which Wayland session we belong to. Closes #55.
* main: update --help with correct default path for -s,--serverDaniel Eklöf2020-08-02-2/+2
| | | | I missed this in f3c301ee8b94c3354080695326ceedc7a3866321 when fixing
* config: configuration errors are no longer fatalDaniel Eklöf2020-07-31-1/+1
| | | | | Instead of refusing to start foot on configuration errors, we start and print a user-notification.
* main: add --check-config command line optionDaniel Eklöf2020-07-29-1/+13
|
* main: free 'cwd' at exitDaniel Eklöf2020-07-13-1/+2
| | | | | This fixes an issue where e.g. failing to initialize the Wayland backend would leave cwd un-free:d
* term: don't use deprecated fcft_size_adjust()Daniel Eklöf2020-07-07-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | When resizing the font on-the-fly, we now do a complete font-reload (this is basically what fcft_size_adjust() did anyway). To get the correct size, we maintain the current size ourselves. We get the initial size from the user-provided font pattern, by converting the string to an FcPattern, and using FcPatternGet() to retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These attributes are then removed from the pattern, and the pattern is converted back to a string. The terminal struct maintains a copy of the font sizes. These are initially set to the sizes from the config. When the user resizes the font, the terminal-local sizes are adjusted. To ensure the primary and user-configured fallback fonts are resizes equally much, convert any pixel sizes to point sizes at this point. When the font size is reset, we reload the font sizes from the config (thus once again returning actual pixel-sizes, if that's what the user has configured).