aboutsummaryrefslogtreecommitdiff
path: root/server.c (follow)
Commit message (Collapse)AuthorAgeLines
* foot/client: implement xdga client activationRonan Pigott2021-11-01-1/+12
| | | | | | | | | | | 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.
* server: no need to clone the config to handle -N,--no-waitDaniel Eklöf2021-09-05-6/+2
|
* server: verify primary font is monospacedDaniel Eklöf2021-08-31-0/+6
| | | | | | ... unless we’re re-using the main conf as-is, in which case we will already have done this (and the conf’s user-notification list will already contain a warning).
* term: consolidate shutdown related state into an anonymous structDaniel Eklöf2021-07-31-2/+4
|
* server: the terminal now purges SHM pixmaps on its ownDaniel Eklöf2021-07-11-7/+0
|
* server: make sure ‘overrides’ have been initialized in all error pathsDaniel Eklöf2021-06-23-1/+1
|
* server: avoid “member access within misaligned address” ASAN warningDaniel Eklöf2021-06-23-7/+6
|
* client: send overrides for everything that is publicly visible in the confDaniel Eklöf2021-06-23-63/+17
| | | | | | | | | Send a generic “overrides” list to the server, containing options in text, on the format “section.key=value”. This reduces the size of the base client/server protocol packet, as well as opens up for a generic -o,--override command line option (not yet implemented).
* server: use config_clone() + config_override_apply()Daniel Eklöf2021-06-23-22/+50
| | | | | | | | | When the connecting client overrides config options, clone the server’s configuration, and then convert the overridden options to config overrides, and apply them using config_override_apply(). When destroying the client, free the cloned config using the regular config_free().
* server: don’t clone the config unless we’re going to modify itDaniel Eklöf2021-06-17-28/+50
|
* main/client: change exit codeDaniel Eklöf2021-05-04-2/+2
| | | | | | | | * 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-2/+2
| | | | | | | | | | | | | | | | | | | 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.
* fix code style issues and memory leakFelipe Trzaskowski2021-03-13-13/+8
|
* add option to detach the client process from the terminal instanceFelipe Trzaskowski2021-03-13-41/+101
|
* server: send exit-code -1 when we fail to instantiate a new terminalDaniel Eklöf2021-02-12-0/+1
|
* client/server: switch to POSIX header for sockaddr_unJan Beich2021-01-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | client.c:13:10: fatal error: 'linux/un.h' file not found #include <linux/un.h> ^~~~~~~~~~~~ client.c:195:24: error: variable has incomplete type 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^ client.c:195:12: note: forward declaration of 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^ server.c:11:10: fatal error: 'linux/un.h' file not found #include <linux/un.h> ^~~~~~~~~~~~ server.c:307:24: error: variable has incomplete type 'struct sockaddr_un' struct sockaddr_un addr; ^ server.c:307:12: note: forward declaration of 'struct sockaddr_un' struct sockaddr_un addr; ^ server.c:347:24: error: variable has incomplete type 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^ server.c:347:12: note: forward declaration of 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^ server.c:394:24: error: variable has incomplete type 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^ server.c:394:12: note: forward declaration of 'struct sockaddr_un' struct sockaddr_un addr = {.sun_family = AF_UNIX}; ^
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-4/+4
|
* config: replace union in config struct with simple width/height membersCraig Barnes2020-11-30-12/+2
|
* client: add "--window-size-pixels" and "--window-size-chars" optionsCraig Barnes2020-11-22-0/+16
|
* server: avoid doing unaligned struct accessesDaniel Eklöf2020-11-21-28/+31
|
* server: verify strings are NULL terminatedDaniel Eklöf2020-11-21-5/+14
|
* client/server: simplify setup packet handlingDaniel Eklöf2020-11-21-92/+27
| | | | | | Instead of writing (and logging errors for) every parameter, one at a time, send all fixed size data in a single struct, followed by all the variable length data.
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-6/+12
|
* client/server: implement '--hold' in footclientDaniel Eklöf2020-05-26-0/+4
|
* term: don't double fork new terminal windowsDaniel Eklöf2020-05-21-2/+5
| | | | | Instead, register their PIDs with the new reaper module and let it handle them.
* server: don't do misaligned loadsDaniel Eklöf2020-04-18-11/+23
|
* Fix clang warningsDaniel Eklöf2020-04-12-5/+5
| | | | | | | | All are printf() formatter related. Even if a variable is e.g. a 'short', when used in an expression like '<variable> - 1' it is promoted to an 'int'. Closes #16
* conf: add 'title' conf option and --title command line optionDaniel Eklöf2020-04-01-0/+16
|
* conf: add app-id config option and --app-id command line optionDaniel Eklöf2020-04-01-0/+16
|
* client: add --maximized and --fullscreenDaniel Eklöf2020-03-27-2/+23
| | | | | | | | | 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.
* server: purge *all* buffers when a terminal shuts downDaniel Eklöf2020-03-18-2/+7
| | | | | Previously we only purged the main grid buffers. Now we also purge the search buffers and the CSD buffers.
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-1/+4
|
* Revert "server: use edge-triggered FDM handler for the client connections"Daniel Eklöf2020-01-10-13/+13
| | | | This reverts commit 9141b8a6573f973f97aa1615a8cc0c488cfd77e7.
* server: use edge-triggered FDM handler for the client connectionsDaniel Eklöf2020-01-10-13/+13
|
* server: be more resilient against bad behaving clientsDaniel Eklöf2020-01-10-3/+16
| | | | | | | | | | | | | | | Make both the server listening socket and the connecting client sockets non-blocking. Then, when reading the initial length of the setup packet, handle read errors from partial reads separately. Assume the client writes all four bytes of the 'length' field at once, and bail out if we are unable to read those 4 bytes. Limit the maximum setup packet size to 128K. This is to prevent clients from pretending the setup packet is insanely large, causing us to fail to malloc.
* server: verify CWD string length matches the indicated lengthDaniel Eklöf2019-12-21-0/+6
|
* server: move forward the indicated number of TERM bytesDaniel Eklöf2019-12-21-1/+1
|
* server: bug: move forward 2 bytes, not whatever the client sentDaniel Eklöf2019-12-21-1/+1
|
* term: term_init: add 'cwd' argumentDaniel Eklöf2019-12-21-1/+1
| | | | | | | | | | 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.
* client/server: client sends its CWD to serverDaniel Eklöf2019-12-21-1/+8
|
* 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-1/+1
| | | | Bind ctrl+shift+return to it
* server: use socket-path from configDaniel Eklöf2019-12-14-19/+2
|
* server: log socket packetDaniel Eklöf2019-12-13-1/+3
|
* Add missing includesDaniel Eklöf2019-12-01-0/+1
|
* tllist: is now an external "library", so use <> includesDaniel Eklöf2019-11-17-1/+2
|
* server: disable debug outputDaniel Eklöf2019-11-05-1/+1
|
* server/client: harden reading of initialization data, and make asyncDaniel Eklöf2019-11-05-31/+90
| | | | | | | | | | | | | | | | | | | | * Client terminal initialization data is now received asynchronously. To facilitate this, a couple of minor changes to the protocol was made: - The client now starts with sending a 4-byte unsigned integer with the *total* size of the initialization data (*not* including the size field itself. - Strings (TERM variable + argv) are now sent NULL-terminated * The server allocates a single buffer, and fills it asynchronously. When full (as indicated by the initial 'total size' integer), we parse it (taking care not to read outside boundaries etc, and verifies the lengths (of the TERM variable and argv array) indicated by the client matches the actual lengths of the strings received. * The server now ignores 'unexpected' data received from the client, after the terminal has been instantiated.
* server: workaround evil clientsDaniel Eklöf2019-11-05-0/+6
| | | | | If the clients attempt to send more data after we've instantiated the terminal, just consume the data but ignore it.
* server: don't cache argc/argv in client contextDaniel Eklöf2019-11-05-17/+18
|
* Remove unneeded includeDaniel Eklöf2019-11-03-1/+0
|
* server: set CLOEXEC | NONBLOCK directly in socket() callDaniel Eklöf2019-11-03-17/+2
|
* Merge branch 'master' into async-ptmxDaniel Eklöf2019-11-03-1/+1
|\
| * server: FD_CLOEXEC is a file descriptor flag, not a file status flagDaniel Eklöf2019-11-03-1/+1
| |
* | misc: fdm already logs failuresDaniel Eklöf2019-11-02-4/+1
|/
* server: server_destroy(): unlink UNIX socketDaniel Eklöf2019-11-02-0/+2
|
* server: use a non-blocking socket when trying to connectDaniel Eklöf2019-11-02-4/+23
| | | | | | | | | | | | | | When checking of a 'foot --server' instance is already running, we try to connect to the UNIX socket we're planning on listening on. In most cases, this will fail hard and fast. But under certain circumstances, we can get stuck in connect() waiting for a connection timeout. Since it should be possible to establish a connection immediately *if* there's someone actually listening on the socket, rely on the fact that connect() will fail with a EINPROGRESS if a connection can *not* be established immediately (and thus no one is listening on it).
* server: don't get stuck in read() if TERM length is 0Daniel Eklöf2019-11-02-2/+4
|
* server: don't get stuck in read() if length of argv argument is 0Daniel Eklöf2019-11-02-0/+3
|
* server: purge shm buffers when terminal is destroyedDaniel Eklöf2019-11-01-0/+6
|
* server: add debug logging of client argc/argvDaniel Eklöf2019-11-01-0/+4
|
* client/server: add -t,--term to footclientDaniel Eklöf2019-11-01-1/+15
|
* term_init(): initialize slave TERM from term_init() argumentDaniel Eklöf2019-11-01-2/+2
|
* server: implement a --server modeDaniel Eklöf2019-11-01-0/+310
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.