Commit Graph

32 Commits

Author SHA1 Message Date
Itamar
72ba072768 LibDesktop: Rename LaunchServerConnection=>ConnectionToLaunchServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar
d88da82e28 Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Sam Atkins
8260135d4d LibCore+Everywhere: Return ErrorOr from ConfigFile factory methods
I've attempted to handle the errors gracefully where it was clear how to
do so, and simple, but a lot of this was just adding
`release_value_but_fixme_should_propagate_errors()` in places.
2022-02-16 19:49:41 -05:00
Maciej
07cf2218cb LibDesktop: Add Launcher::ensure_connection()
This can be use force connection at startup and not to leave 'unix'
pledge all the time.
2022-01-21 13:44:36 +01:00
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
Andreas Kling
b6f49924be LibDesktop: Make allowlist APIs return ErrorOr<void>
This makes it very smooth to use TRY() when setting up these lists,
as you can see in the rest of this commit. :^)
2021-11-24 00:25:23 +01:00
Andreas Kling
587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
779316d468 Userland: Use Core::Process::spawn() instead of posix_spawn() in places
This replaces a bunch of very basic uses of posix_spawn() with the new
Core::Process::spawn().
2021-08-06 01:06:42 +02:00
Jelle Raaijmakers
1a4b1ecd04 LibDesktop: Add support for IconPath in AppFile
With `IconPath`, you can override the icon used for the application
shortcut. This currently only supports resolving the icon through
`GUI::FileIconProvider`, the implementation for pointing to actual
image files is left as an exercise for the reader.
2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
0ec39aafb6 LibDesktop: Collapse if-else in AppFile 2021-08-04 13:54:08 +01:00
Andreas Kling
89ab55b44b LibDesktop: Add an optional "Description" field to .af files 2021-07-26 00:39:10 +02:00
Linus Groh
4983a972b0 LibDesktop: Add a RunInTerminal boolean field to app files
This is common enough to warrant its own setting by now - but it's also
partially a workaround. Since app files currently only support a single
executable path with no arguments, we resort to generating wrapper
scripts for port launchers with arguments - and then the executable is
that shell script. We also moved from manually specifying icon files to
embedding them in executables. As shell scripts can't have icons
embedded in them, a different solution is needed - this one solves the
common case of running a CLI program in a terminal, and still allows
embedding of icons in the executable itself as no shell script is
needed, meaning it will be shown in the taskbar and system menu.

The second use case of actually passing arguments to the executable
itself (and not just "Terminal -e ...") is not covered by this and still
requires an external script (meaning no icon for now), but I think that
can easily be solved by adding something like an "Arguments" field to
app files. :^)
2021-07-20 00:58:26 +01:00
Spencer Dixon
ae20c178b9 LibDesktop: Add spawn() to AppFiles
This adds a convenience utility to AppFiles for quickly launching the
apps backed by the AppFile.
2021-06-28 16:29:02 +02:00
Spencer Dixon
66c13edb98 Userland: Add new app called Assistant
'Assistant' is similar to macOS spotlight where you can quickly open a
text input, start typing, and hit 'enter' to launch apps or open
directories.
2021-06-28 16:29:02 +02:00
Gunnar Beutner
ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Andreas Kling
a345a1f4a1 Userland: Mark subclasses of IPC::{Client,Server}Connection final 2021-05-23 09:53:55 +02:00
Andreas Kling
c1c252ddb2 LibIPC: Remove unnecessary IPC::ServerConnection::handshake()
This is no longer used by any of our IPC pairs.
2021-05-23 09:53:55 +02:00
Andreas Kling
e7fc46879e LaunchServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Gunnar Beutner
8a6db55e79 Userland: Add try_* IPC handlers
This enables calling auto-generated IPC methods in a way that doesn't
crash the client if the peer disconnects.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
9e22e9ce88 Userland: Use snake case names in .ipc files
This updates all .ipc files to have snake case names for IPC methods.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
eb21aa65d1 Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's
return value directly - instead of the response struct - for IPC
methods which only have a single return value.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
5bb79ea0a7 Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
2021-05-03 21:14:40 +02:00
Gunnar Beutner
065040872f Userland: Change IPC funcs to use plain arguments instead of a struct
Instead of having a single overloaded handle method each method gets
its own unique method name now.
2021-05-03 21:14:06 +02:00
Andreas Kling
7ae7170d61 Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
Andreas Kling
b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
Linus Groh
ebdeed087c Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Idan Horowitz
a2b34b7e6b LibDesktop: Fail gracefully on allowlist failures instead of asserting
IPC::Connection::send_sync asserts that a response was received, so the
current gracefull fail check was useless, as LibIPC would always assert
before reaching it.
2021-04-20 10:10:15 +02:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
1ce03f4f34 LibIPC: Stop sending client ID to clients
The client ID is not useful to normal clients anymore, so stop telling
everyone what their ID is.
2021-02-01 11:32:00 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00