Commit graph

35 commits

Author SHA1 Message Date
Craig Barnes
e813883367 client: add missing options to getopt_long(3) optstring argument 2020-11-21 20:34:49 +00:00
Daniel Eklöf
997c6a4ae3
client: we added argv lengths twice 2020-11-21 20:46:08 +01:00
Daniel Eklöf
0b3a84bd9c
client: avoid doing a signed vs. unsigned comparison 2020-11-21 20:29:47 +01:00
Daniel Eklöf
fc81f413c0
client/server: simplify setup packet handling
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.
2020-11-21 20:21:18 +01:00
Daniel Eklöf
c9de30e2bc
client: let getopt_long(3) print error messages
Closes #191
2020-11-10 19:04:20 +01:00
Craig Barnes
7a77958ba2 Convert most dynamic allocations to use functions from xmalloc.h 2020-08-08 20:37:57 +01:00
Daniel Eklöf
5e26d3ef47
server/client: use $WAYLAND_DISPLAY instead of $XDG_SESSION_ID in default socket path
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.
2020-08-02 13:10:31 +02:00
Daniel Eklöf
f3c301ee8b
doc: foot.1: fix default path in -s,--server
The documentation incorrectly stated that the default path is
$XDG_RUNTIME_DIR/foot.sock.

The correct default path is

* $XDG_RUNTIME_DIR/foot-$XDG_SESSION_ID.sock
* $XDG_RUNTIME_DIR/foot-no-session.sock
* /tmp/foot.sock

Depending on whether XDG_RUNTIME_DIR and XDG_SESSION_ID has been set
or not.

This also removes the '<>' from the default when XDG_SESSION_ID is not
set.

Closes #53.
2020-08-02 12:32:10 +02:00
Daniel Eklöf
3943cad7ed
client/server: implement '--hold' in footclient 2020-05-26 20:11:38 +02:00
Daniel Eklöf
5b70f94827
main/client: be POSIXLY_CORRECT when parsing command line
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
2020-05-08 18:43:03 +02:00
Daniel Eklöf
ec7a768487
conf: add 'title' conf option and --title command line option 2020-04-01 19:59:47 +02:00
Daniel Eklöf
4d52a870b4
conf: add app-id config option and --app-id command line option 2020-04-01 18:40:51 +02:00
Daniel Eklöf
758fd9fd58
client: add --maximized and --fullscreen
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.
2020-03-27 21:14:49 +01:00
Daniel Eklöf
9049488acc
client: log path we actually tried to connect to (and failed) 2020-03-10 18:06:10 +01:00
Daniel Eklöf
1c42fadcf7
client: update --server-socket usage to mention XDG_SESSION_ID 2020-03-10 18:06:10 +01:00
Daniel Eklöf
25792a7e8c
server/client: add XDG_SESSION_ID to the default socket path
This allows multiple foot servers to run in multiple sessions.
2020-03-09 18:47:10 +01:00
Daniel Eklöf
54fbfb6405
client: make sure 'cwd' is in scope of all goto's 2020-02-20 20:21:34 +01:00
Daniel Eklöf
e751227dc6
client: allocate current working directory buffer dynamically 2020-02-20 18:45:42 +01:00
Daniel Eklöf
b5efe984bb
slave: prefix argv[0] with a '-' when spawning a login-shell 2020-02-20 18:36:09 +01:00
Daniel Eklöf
8dee9bf942
client: add --login-shell command line option 2020-02-20 18:34:51 +01:00
Daniel Eklöf
82b8853f17
main: add --print-pid=FILE|FD
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.
2020-02-05 19:54:16 +01:00
Daniel Eklöf
277735db65
client/server: client sends its CWD to server 2019-12-21 19:56:37 +01:00
Daniel Eklöf
a0fcec3a3d
log: caller can control syslog level 2019-12-17 19:07:28 +01:00
Daniel Eklöf
c186f3dc0e
client: strncpy() size limit must be less than destination size 2019-12-14 13:14:24 +01:00
Daniel Eklöf
b2f72d470a
client: add missing break after handling -t,--term 2019-12-14 13:07:33 +01:00
Daniel Eklöf
4102f9d478
client: add 's:' to the list of recognized short options 2019-12-14 13:07:19 +01:00
Daniel Eklöf
c0a9cf7767
client: initialize/deinitialize the logging system 2019-12-14 13:01:21 +01:00
Daniel Eklöf
c5875bf97c
client: add -s,--server-socket command line option
This allows the user to override the default
path (XDG_RUNTIME_DIR/foot.sock) we try to connect to.
2019-12-14 13:00:48 +01:00
Daniel Eklöf
9abc5ca971
server/client: harden reading of initialization data, and make async
* 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.
2019-11-05 10:08:30 +01:00
Daniel Eklöf
17024b4431
client: bug: verify argv was sent correctly
We checked we had written 2 bytes (sizeof(len)), not <len> bytes.
2019-11-02 00:01:16 +01:00
Daniel Eklöf
570b3ac25a
client: add debug logging of argc/argv 2019-11-02 00:01:08 +01:00
Daniel Eklöf
2544e93c0e
client: register signal handler for SIGTERM too 2019-11-01 21:13:37 +01:00
Daniel Eklöf
438d6eaff0
client/server: add -t,--term to footclient 2019-11-01 21:10:47 +01:00
Daniel Eklöf
77ea7fc61c
client: add long options for --verbose and --help 2019-11-01 20:50:00 +01:00
Daniel Eklöf
6637c8aeda
client: a standalone binary that connects to a foot --server 2019-11-01 20:39:34 +01:00