aboutsummaryrefslogtreecommitdiff
path: root/main.c (follow)
Commit message (Collapse)AuthorAgeLines
* 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).
* main: log architecture at startupDaniel Eklöf2020-06-09-0/+9
|
* term: don't double fork new terminal windowsDaniel Eklöf2020-05-21-2/+2
| | | | | Instead, register their PIDs with the new reaper module and let it handle them.
* reaper: new module, uses a signalfd to wait() on child processesDaniel Eklöf2020-05-21-0/+6
| | | | | | | | Use a signalfd to listen for SIGCHLD signals. When we receive a SIGCHLD over the signalfd, reap all dead children by looping over all registered child PIDs and call waitpid(WNOHANG) on them.
* main/client: be POSIXLY_CORRECT when parsing command lineDaniel Eklöf2020-05-08-3/+3
| | | | | | | | | | | | | | | | | | | | This means command line parsing stops when it encounters the first nonoption argument. The result is that one no longer need to use '--' to ensure arguments are passed to the shell/command, instead of parsed by foot. That is, instead of foot -- sh -c true one can now do foot sh -c true Arguments to foot *must* go before the command: foot --fullscreen sh -c true
* main: only set LC_CTYPEDaniel Eklöf2020-04-29-1/+1
| | | | | | This is the only locale variable we need. This ensures LC_NUMERIC in particular remains as "C", which is needed by fcft when instantiating new fonts.
* main: log localeDaniel Eklöf2020-04-21-0/+1
|
* conf: add 'title' conf option and --title command line optionDaniel Eklöf2020-04-01-0/+11
|
* conf: add app-id config option and --app-id command line optionDaniel Eklöf2020-04-01-1/+12
|
* Merge branch 'master' into scroll-damage-performanceDaniel Eklöf2020-03-27-2/+21
|\
| * client: add --maximized and --fullscreenDaniel Eklöf2020-03-27-2/+1
| | | | | | | | | | | | | | | | | | We now create a copy of the config for each client, and updates it with the values passed from the client. Since we're not actually cloning it (and e.g. strdup() all strings etc) we can't call conf_destroy() to free it, but need to free just the strings we've replaced.
| * foot: add --maximized and --fullscreen command line optionsDaniel Eklöf2020-03-26-0/+20
| |
* | shm: make max pool size user configurable (via a 'tweak' setting)Daniel Eklöf2020-03-25-0/+2
|/
* main: log version at startupDaniel Eklöf2020-03-15-0/+2
|
* main: free config if we fail to load the configDaniel Eklöf2020-03-09-1/+3
|
* main: check return value of getcwd()Daniel Eklöf2020-02-20-1/+5
|
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-1/+2
|
* config: add 'login-shell' optionDaniel Eklöf2020-02-20-0/+2
|
* main: add --login-shell command line optionDaniel Eklöf2020-02-20-1/+8
|
* main: bug: -t requires an argumentDaniel Eklöf2020-02-15-1/+1
|
* main: add --print-pid=FILE|FDDaniel Eklöf2020-02-05-2/+26
| | | | | When specified, our PID is written to the specified file (or FD), after we've successfully started up.
* main: add --print-pid=FILE|FDDaniel Eklöf2020-02-05-10/+65
| | | | | | | When specified, our PID is written to the specified file (or FD), after we've successfully started up. Only applicable in server mode.
* Implement --holdDaniel Eklöf2020-02-03-0/+8
| | | | When specified, we don't exit when the slave/client process exits.
* render: trigger terminal refreshes in an FDM hookDaniel Eklöf2020-01-04-0/+6
| | | | | | | | | | | | | | | | | | | | | | In some cases, we end up calling render_refresh() multiple times in the same FDM iteration. This means will render the first update immediately, and then set the 'pending' flag, causing the updated content to be rendered in the next frame. This can cause flicker, or flashes, since we're presenting one or more intermediate frames until the final content is shown. Not to mention that it is inefficient to render multiple frames like this. Fix by: * render_refresh() only sets a flag in the terminal * install an FDM hook; this hook loops all terminals and executes what render_refresh() _used_ to do (that is, render immediately if we're not waiting for a frame callback, otherwise set 'pending' flag). for all terminals that have the 'refresh_needed' flag set.
* wayland: only bind to 'presentation' interface if -p,--presentation-timingsDaniel Eklöf2019-12-31-1/+1
|
* wayland: optionally use the presentation time protocol to measure input lagDaniel Eklöf2019-12-31-9/+16
| | | | | | | | | | | | | | | | | | | This adds a flag, -p,--presentation-timings, that enables input lag measuring using the presentation time Wayland protocol. When enabled, we store a timestamp when we *send* a key to the slave. Then, when we commit a frame for rendering to the compositor, we request presentation feedback. We also store a timestamp for when the frame was committed. The 'presented' callback then looks at the input and commit timestamps, and compares it with the presented timestamp. The delay is logged at INFO when the delay was less than one frame interval, at WARN when it was one frame interval, and at ERR when it was two or more frame intervals. We also update statistic counters that we log when foot is shut down.
* main: let getopt_long() print error messageDaniel Eklöf2019-12-29-6/+1
|
* main: third member in "struct option" is a pointerDaniel Eklöf2019-12-29-8/+8
|
* main: use a single printf() when printing usageDaniel Eklöf2019-12-29-11/+13
|
* term: term_init: add 'cwd' argumentDaniel Eklöf2019-12-21-2/+16
| | | | | | | | | | This is used when spawning the slave, to set its current working directory just before we exec() the client. In a regular foot instance, we set the cwd from getcwd(). In a foot server instance, each connecting client sends its cwd to the server, and we use that.
* term: term_spawn_new: always spawn foot/footclient from PATHDaniel Eklöf2019-12-21-1/+1
|
* term: term_spawn_new(): new function, spawns a new foot/footclient processDaniel Eklöf2019-12-21-2/+3
| | | | Bind ctrl+shift+return to it
* main: verify locale is UTF-8Daniel Eklöf2019-12-19-2/+23
|
* config: enable user to specify path to configuration fileDaniel Eklöf2019-12-17-21/+44
|
* main: remove unused macrosDaniel Eklöf2019-12-17-3/+0
|
* log: caller can control syslog levelDaniel Eklöf2019-12-17-2/+2
|
* main: allow server socket path to be set on the command lineDaniel Eklöf2019-12-14-3/+9
| | | | | This adds an optional argument to -s,--server that allows the user to override the default socket path (XDG_RUNTIME_DIR/foot.sock).
* main: stop initializing a default set of fontsDaniel Eklöf2019-12-04-25/+0
|
* fcft: font_from_name() no longer accepts a tllistDaniel Eklöf2019-12-01-13/+10
|
* fcft: include <fcft/fcft.h>, and use fcft/stride.h instead of local copyDaniel Eklöf2019-12-01-1/+1
|
* fcft: use fcft instead of local copy of font.c/font.hDaniel Eklöf2019-12-01-1/+2
|
* font: pass dpi=96 to fontconfigDaniel Eklöf2019-11-26-4/+4
| | | | TODO: use actual output PPI. Question is *which* output...
* log: set syslog facility to LOG_DAEMON when run in server modeDaniel Eklöf2019-11-20-0/+3
|
* main: mention why we initialize a font setDaniel Eklöf2019-11-20-0/+1
| | | | | | | | | | | | Since fonts are destroyed and removed from the font cache when the last instance is destroyed, closing the "last" terminal window in server mode would destroy the fonts, and their glyph caches. By instantiating the set in main, we ensure the fonts, and the glyph caches, remain. This makes launching new terminals (much) faster. Note that in "normal" (non-server) mode, this isn't really necessary, but also doesn't have any penalty.
* fonts: use 'weight' and 'slant', not 'style' when loading fontsDaniel Eklöf2019-11-19-3/+3
|
* scan-build: fix a couple of minor warnings from a scan-build runDaniel Eklöf2019-11-05-0/+1
|
* main: destroy cached SHM buffers *after* terminals have been destroyedDaniel Eklöf2019-11-05-2/+2
|
* main: usage for --server now hints about 'footclient'Daniel Eklöf2019-11-03-1/+1
|
* slave: restore signals before calling exec()Daniel Eklöf2019-11-03-0/+1
|
* main: ignore SIGHUP in master processDaniel Eklöf2019-11-03-0/+5
|
* main: pre-allocate fontsDaniel Eklöf2019-11-02-1/+28
| | | | | | | | Since fonts are cached, this adds no additional memory. However, it makes the first terminal window in --server mode start much faster, since the (primary) fonts have already been loaded. Fallback fonts are still loaded on-demand.
* term_init(): initialize slave TERM from term_init() argumentDaniel Eklöf2019-11-01-1/+1
|
* slave: set TERM environment variable in slave processDaniel Eklöf2019-11-01-1/+0
|
* server: implement a --server modeDaniel Eklöf2019-11-01-2/+14
| | | | | | | | | | | In this mode, foot listens on a UNIX socket and creates terminal windows when clients connect. A connecting client sends argc/argv to the server, and the server instantiates a new terminal window. When the terminal window is closed, the exit code is sent back to the client.
* main: register signal handlers for SIGINT and SIGTERMDaniel Eklöf2019-11-01-0/+15
|
* terminal: call user-defined callback when destroying terminalDaniel Eklöf2019-11-01-10/+23
| | | | main uses this to get the exit code of the terminal.
* render: call wl_display_flush() after renderingDaniel Eklöf2019-11-01-1/+0
| | | | This allows us to remove that call from the main event loop.
* main: get exit value from wayland structDaniel Eklöf2019-10-30-2/+3
|