mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:37:35 +00:00
Launcher: Provide launcher details to LibDesktop
This allows applications to get additional information, such as name or icons, for each launch handler.
This commit is contained in:
parent
7498024805
commit
535113bac4
7 changed files with 208 additions and 26 deletions
|
@ -27,13 +27,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace Desktop {
|
||||
|
||||
class Launcher {
|
||||
public:
|
||||
enum class LauncherType {
|
||||
Default = 0,
|
||||
UserPreferred,
|
||||
UserDefault
|
||||
};
|
||||
|
||||
struct Details: public RefCounted<Details> {
|
||||
|
||||
String name;
|
||||
String executable;
|
||||
HashMap<String, String> icons;
|
||||
LauncherType launcher_type { LauncherType::Default };
|
||||
|
||||
static NonnullRefPtr<Details> from_details_str(const String&);
|
||||
};
|
||||
|
||||
static bool open(const URL&, const String& handler_name = {});
|
||||
static bool open(const URL&, const Details& details);
|
||||
static Vector<String> get_handlers_for_url(const URL&);
|
||||
static NonnullRefPtrVector<Details> get_handlers_with_details_for_url(const URL&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue