Portal
Object Hierarchy:
Description:
Context for portal calls.
The XdpPortal object provides the main context object for the portal operations of libportal.
Typically, an application will create a single XdpPortal object with [ctor@Portal.new] and use it throughout its lifetime.
Namespace: Xdp
Package: libportal
Content:
Static methods:
- public static bool running_under_flatpak ()
Detects if running inside of a Flatpak or WebKit sandbox.
- public static bool running_under_sandbox ()
This function tries to determine if the current process is running under a sandbox that requires the use of portals.
- public static bool running_under_snap () throws Error
Detects if you are running inside of a Snap sandbox.
Creation methods:
- public Portal ()
Creates a new [class@Portal] object.
- public Portal.initable_new () throws Error
Creates a new [class@Portal] object.
Methods:
- public async bool access_camera (Parent? parent, CameraFlags flags, Cancellable? cancellable) throws Error
Request access to a camera.
- public async bool add_notification (string id, Variant notification, NotificationFlags flags, Cancellable? cancellable) throws Error
Sends a desktop notification.
- public async bool compose_email (Parent? parent, string[]? addresses, string[]? cc, string[]? bcc, string? subject, string? body, string[]? attachments, EmailFlags flags, Cancellable? cancellable) throws Error
Presents a window that lets the user compose an email, with some pre-filled information.
- public async Session create_remote_desktop_session (DeviceType devices, OutputType outputs, RemoteDesktopFlags flags, CursorMode cursor_mode, Cancellable? cancellable) throws Error
Creates a session for remote desktop.
- public async Session create_screencast_session (OutputType outputs, ScreencastFlags flags, CursorMode cursor_mode, PersistMode persist_mode, string? restore_token, Cancellable? cancellable) throws Error
Creates a session for a screencast.
- public string dynamic_launcher_get_desktop_entry (string desktop_file_id) throws Error
This function gets the contents of a .
- public Variant dynamic_launcher_get_icon (string desktop_file_id, string? out_icon_format, uint? out_icon_size) throws Error
This function gets the icon associated with a .
- public bool dynamic_launcher_install (string token, string desktop_file_id, string desktop_entry) throws Error
This function completes installation of a launcher so that the icon and name given in previous method calls will show up in the desktop environment's menu.
- public bool dynamic_launcher_launch (string desktop_file_id, string activation_token) throws Error
- public async Variant dynamic_launcher_prepare_install (Parent? parent, string name, Variant icon_v, LauncherType launcher_type, string? target, bool editable_name, bool editable_icon, Cancellable? cancellable) throws Error
Presents a dialog to the user so they can confirm they want to install a launcher to their desktop.
- public string dynamic_launcher_request_install_token (string name, Variant icon_v) throws Error
Requests a token which can be passed to [method@Portal.
- public bool dynamic_launcher_uninstall (string desktop_file_id) throws Error
This function uninstalls a launcher that was previously installed using the dynamic launcher portal, resulting in the .
- public async Variant get_user_information (Parent? parent, string? reason, UserInformationFlags flags, Cancellable? cancellable) throws Error
Gets information about the user.
- public bool is_camera_present ()
Returns whether any camera are present.
- public async bool location_monitor_start (Parent? parent, uint distance_threshold, uint time_threshold, LocationAccuracy accuracy, LocationMonitorFlags flags, Cancellable? cancellable) throws Error
Makes `XdpPortal` start monitoring location changes.
- public void location_monitor_stop ()
Stops location monitoring that was started with [method@Portal.
- public async bool open_directory (Parent parent, string uri, OpenUriFlags flags, Cancellable? cancellable) throws Error
Opens the directory containing the file specified by the
uri
. - public async Variant open_file (Parent? parent, string title, Variant? filters, Variant? current_filter, Variant? choices, OpenFileFlags flags, Cancellable? cancellable) throws Error
Asks the user to open one or more files.
- public int open_pipewire_remote_for_camera ()
Opens a file descriptor to the pipewire remote where the camera nodes are available.
- public async bool open_uri (Parent parent, string uri, OpenUriFlags flags, Cancellable? cancellable) throws Error
Opens
uri
with an external handler. - public async Variant pick_color (Parent? parent, Cancellable? cancellable) throws Error
Lets the user pick a color from the screen.
- public async Variant prepare_print (Parent? parent, string title, Variant? settings, Variant? page_setup, PrintFlags flags, Cancellable? cancellable) throws Error
Presents a print dialog to the user and returns print settings and page setup.
- public async bool print_file (Parent? parent, string title, uint token, string file, PrintFlags flags, Cancellable? cancellable) throws Error
Prints a file.
- public void remove_notification (string id)
Withdraws a desktop notification.
- public async bool request_background (Parent? parent, string? reason, owned GenericArray<unowned string> commandline, BackgroundFlags flags, Cancellable? cancellable) throws Error
Requests background permissions.
- public async Variant save_file (Parent? parent, string title, string? current_name, string? current_folder, string? current_file, Variant? filters, Variant? current_filter, Variant? choices, SaveFileFlags flags, Cancellable? cancellable) throws Error
Asks the user for a location to save a file.
- public async Variant save_files (Parent? parent, string title, string? current_name, string? current_folder, Variant files, Variant? choices, SaveFileFlags flags, Cancellable? cancellable) throws Error
Asks for a folder as a location to save one or more files.
- public async int session_inhibit (Parent? parent, string? reason, InhibitFlags flags, Cancellable? cancellable) throws Error
Inhibits various session status changes.
- public void session_monitor_query_end_response ()
This method should be called within one second of receiving a [ signal@Portal:
XdpPortal:session-state-changed
] signal with the 'Query End' state, to acknowledge that they have handled the state change. - public async bool session_monitor_start (Parent? parent, SessionMonitorFlags flags, Cancellable? cancellable) throws Error
Makes [class@Portal] start monitoring the login session state.
- public void session_monitor_stop ()
Stops session state monitoring that was started with [method@Portal.
- public void session_uninhibit (int id)
Removes an inhibitor that was created by a call to [method@Portal.
- public async bool set_background_status (string? status_message, Cancellable? cancellable) throws Error
Sets the status information of the application, for when it's running in background.
- public async bool set_wallpaper (Parent? parent, string uri, WallpaperFlags flags, Cancellable? cancellable) throws Error
Sets a desktop background image, given by a uri.
- public async int spawn (string cwd, string[] argv, int[]? fds, int[]? map_to, string[]? env, SpawnFlags flags, string[]? sandbox_expose, string[]? sandbox_expose_ro, Cancellable? cancellable) throws Error
Creates a new copy of the applications sandbox, and runs a process in, with the given arguments.
- public void spawn_signal (int pid, int @signal, bool to_process_group)
Sends a Unix signal to a process that has been spawned by [method@Portal.
- public async string? take_screenshot (Parent? parent, ScreenshotFlags flags, Cancellable? cancellable) throws Error
Takes a screenshot.
- public async bool trash_file (string path, Cancellable? cancellable) throws Error
Sends the file at
path
to the trash can. - public async bool update_install (Parent parent, UpdateInstallFlags flags, Cancellable? cancellable) throws Error
Installs an available software update.
- public async bool update_monitor_start (UpdateMonitorFlags flags, Cancellable? cancellable) throws Error
Makes `XdpPortal` start monitoring for available software updates.
- public void update_monitor_stop ()
Stops update monitoring that was started with [method@Portal.
Signals:
- public signal void location_updated (double latitude, double longitude, double altitude, double accuracy, double speed, double heading, string description, int64 timestamp_s, int64 timestamp_ms)
Emitted when location monitoring is enabled and the location changes.
- public signal void notification_action_invoked (string id, string action, Variant? parameter)
Emitted when a non-exported action is activated on a notification.
- public signal void session_state_changed (bool screensaver_active, LoginSessionState session_state)
Emitted when session state monitoring is enabled and the state of the login session changes or the screensaver is activated or deactivated.
- public signal void spawn_exited (uint pid, uint exit_status)
Emitted when a process that was spawned with [method@Portal.
- public signal void update_available (string running_commit, string local_commit, string remote_commit)
Emitted when updates monitoring is enabled and a new update is available.
- public signal void update_progress (uint n_ops, uint op, uint progress, UpdateStatus status, string error, string error_message)
Emitted to indicate progress of an update installation.
Inherited Members:
All known members inherited from class GLib.Object
All known members inherited from interface GLib.Initable