Desktop commands | vasak-desktop
Commands vasak-desktop registers in tauri::generate_handler! that a new
desktop feature can invoke. They are grouped by what they do, not by file:
several modules expose commands on the same subject.
They all live in src-tauri/src/commands/ or in the module of the subject
(clipboard/, screen_time/, tray/) and are registered in
src-tauri/src/lib.rs.
Audio and microphone#
get_audio_volume()- The current output volumeset_audio_volume(volume: i64)- Set the output volumetoggle_audio_mute()- Toggle the output muteget_audio_devices()- List the audio devicesget_audio_outputs()- The available outputs: the sinks and each card’s outputs under another profileset_audio_output(sink_id: Option<String>, card: Option<String>, profile: Option<String>)- Pick an output by sink, or switch the card’s profile and pin itset_audio_device(device_id: String)- Switch the default outputget_microphone()- Volume and mute of the default microphoneset_microphone_volume(volume: i64)- Set the microphone volumetoggle_microphone_mute()- Toggle the microphone mute and return how it ended upget_audio_input_devices()- List the audio inputsset_audio_input_device(device_id: String)- Switch the default inputget_bluetooth_audio_profile(address: String)- The audio profile of Bluetooth headphones, by MAC
Equalizer#
equalizer_state()- The whole state: bands, preset and whether it is onequalizer_set_gain(band: u32, gain: f64)- Move a bandequalizer_set_preset(preset: String)- Pick a factory preset, orcustomto go back to your own valuesequalizer_set_enabled(enabled: bool)- Turn the filter on or off
Music (MPRIS)#
music_play_pause(player: String)- Play or pausemusic_next_track(player: String)- Skip to the next trackmusic_previous_track(player: String)- Go back to the previous trackmusic_now_playing()- The track playing nowmusic_stop(player: String)- Stop playbackmusic_raise(player: String)- Bring the player’s window to the frontmusic_set_position(player: String, position: i64)- Jump to a point in the track, in microsecondsmusic_set_volume(player: String, volume: f64)- Set the player’s volumemusic_set_shuffle(player: String, shuffle: bool)- Turn shuffle on or offmusic_set_loop(player: String, status: String)- The repeat modemusic_players()- The players present right now, so one can be chosenmusic_select_player(player: String)- Pick a player by hand; empty goes back to the automatic choicemusic_artwork(url: String)- The cover art bytes, which the WebView cannot read from disk
Notifications#
send_notify(summary: String, body: Option<String>, urgency: Option<String>)- Send a notificationclear_notifications()- Clear every notificationget_all_notifications()- The list of notificationsdelete_notification(id: u32)- Delete one notificationinvoke_notification_action(id: u32, action_key: String)- Run an action of a notificationget_do_not_disturb()- The «Do not disturb» stateset_do_not_disturb(enabled: bool)- Turn «Do not disturb» on or off and return the previous stateget_game_mode()- Whether game mode is onset_game_mode(enabled: bool)- Turn game mode on or off and return the previous state
Clipboard#
toggle_clipboard()- Open or close the history overlayhide_clipboard()- Hide the overlay without asking whether it is openclipboard_history()- The history, newest firstclipboard_pick(id: u64)- Put an entry back on the clipboardclipboard_clear()- Empty the history, without touching the live clipboard
Phones (Vasak Connect)#
toggle_connect_menu()- Show or hide the phone’s application listconnect_list_devices()- The phones connected right nowconnect_list_apps(serial: String, refresh: bool)- The apps installed on a phoneconnect_launch_app(serial: String, package: String)- Open a phone app in its own windowconnect_stop_app(serial: String, package: String)- Close a phone appconnect_list_running()- The phone windows open right nowconnect_list_cameras(serial: String, refresh: bool)- The cameras a phone hasconnect_start_webcam(serial: String, camera_id: String, size: String, fps: u32)- Start writing a phone camera into the loopback device and return its pathconnect_stop_webcam()- Stop the camera streamconnect_webcam_state()- What the camera bridge is doing and whether it can work
Network, radios and VPN#
get_airplane_mode()- The airplane mode state that is already knownset_airplane_mode(enabled: bool)- Turn airplane mode on or off and return the previous stateunblock_radios(kind: String)- Unblock the radios of one kind (wlanorbluetooth)twingate_info()- The state of the Twingate client and its resourcestwingate_authorize(resource: String)- Start the authorization of a blocked resource
Panel, menus and applets#
toggle_applet(applet: String, anchor: Option<AnchorRect>)- Open or close a panel applet, hanging from the button that asked for itdismiss_applet(applet: String)- Close an applet with its animationdismiss_popups()- Close whatever is open on a click on the desktoptoggle_menu(anchor: Option<AnchorRect>)- Open or close the menu, hanging from its panel buttonset_menu_button(side: String, anchor: AnchorRect)- Tell where the panel drew the menu buttonget_menu_items()- The applications in the menushow_panel()- Show the paneltoggle_control_center()- Open or close the control centerhide_control_center()- Hide the control center without asking whether it is openshow_osd(icon: String, value: f64, maximum: f64, label: String)- Show the on-screen indicator for volume, brightness or whatever elsetoggle_session_popup(action: String)- Open or close the session window (shut down, restart, suspend)
Desktop and windows#
get_windows()- The open windowstoggle_window(window_id: String)- Show or hide a windowpresent_window(window_id: String)- Bring a window to the front, without minimizing itopen_app(path: &str)- Open an application by its.desktopfileopen_settings()- Open Settingsopen_settings_section(section: String)- Open Settings at a sectionopen_calendar()- Open the calendarget_workspaces()- The workspaces of the focused screenswitch_workspace(index: u32)- Go to workspace numberindex, from zeroget_keyboard_layout()- The current keyboard layoutnext_keyboard_layout()- Switch to the next layout and return the one that remainedset_panel_input_region(rects: Vec<InputRect>)- Crop what the pointer receives on the panel to the pillsbatch_invoke(requests: Vec<BatchRequest>)- Ask for several commands in one call and get one answer per command
Session, power and lock#
logout(display_server: String)- Log outshutdown()- Shut the machine downreboot()- Restart the machinesuspend(display_server: String)- Suspend the machinedetect_display_server()- Say whether the session is Wayland, X11 or unknownlock_screen()- Lock the screen, with no confirmationlock_screen_available()- Whether the Lock button can do anythingget_keep_awake()- Whether «keep awake» is onset_keep_awake(enabled: bool)- Turn it on or off and return whether it was onget_night_light_state()- The night light stateset_night_light_enabled(enabled: bool)- Turn night light on or off with the saved settingsapply_night_light()- Apply the night light settings that were just savedbattery_exists()- Whether the machine has a batterybattery_fetch_info()- Read the battery from the system againget_battery_info()- The battery that is already knownsystem_stats()- CPU and memory usage, and the highest temperature
Wallpaper#
toggle_wallpaper_picker()- Open or close the wallpaper pickerhide_wallpaper_picker()- Hide it without asking whether it is openwallpaper_catalog(current: Option<String>, custom_folder: Option<String>)- The carousel row: the official wallpapers, the ones in your own folder and the current one, with their thumbnailsprepare_wallpaper(path: String)- Prepare a video to be used as wallpaper; an image comes back unchangedallow_wallpaper_asset(path: String)- Authorize a wallpaper file in the asset protocol and return its canonical pathwallpaper_pixels(path: String)- The wallpaper pixels, to derive the scheme colors
System tray#
init_sni_watcher()- Start the tray watcher; it does nothing if it was already runningget_tray_items()- The tray itemsget_launcher_entries()- Progress, counter and urgency of the applications that publish themtray_item_activate(service_name: String, x: i32, y: i32)- Activate a tray itemtray_item_secondary_activate(service_name: String, x: i32, y: i32)- The secondary activation of a tray itemget_tray_menu(service_name: String)- The menu of a tray itemtray_menu_item_click(service_name: String, menu_id: i32)- Click an entry of the tray menuopen_tray_popup(service_name: String, anchor: Option<AnchorRect>)- Open the menu window of an item, hanging from its buttonget_tray_popup_data()- What the menu window has to drawtray_popup_click(menu_id: i32)- Click an entry in the tray menu window
Calendar, screen time and weather#
calendar_occurrences(from: String, to: String)- The occurrences of the events that fall in the range, in RFC 3339calendar_tasks()- The unfinished tasks, for the tasks widgetcalendar_locations(events: Vec<EventRef>)- The place of a few eventsrequest_calendar_access_again()- Askvasak-permissionsto prompt for the calendar againscreen_time_range(from: String, to: String)- The days fromfromtoto(YYYY-MM-DD, both included)weather_cached()- The saved forecast, without touching the networkweather_claim()- «Is it my turn to ask?»: it says yes to one window per roundweather_place()- The coordinates already figured out, if some window found themweather_release()- Release the turn of a request that failed, so another window can tryweather_store(datos: Value, lugar: Option<Value>)- Save what the window that claimed the turn brought back and tell every window
Logs, privacy and diagnostics#
log_from_frontend(level: String, message: String)- Record a message from JavaScriptget_log_file_path()- The path of the current log fileread_log_file()- The contents of the log fileget_last_log_lines(lines: usize)- The last N lines of the logprivacy_in_use()- What is using the camera or the microphone right nowprivacy_stop_screen(session: String)- Stop a screen capture in progress
Search#
Global search is no longer part of vasak-desktop: it lives in the launcher,
vasak-prism
, a separate
application that stays resident. The global_search, execute_search_result
and toggle_search commands left the desktop with
vasak-desktop#104
and
can no longer be invoked from the frontend.
What the desktop keeps is a D-Bus forward: the OpenSearch and
ToggleSearch methods of the org.vasak.os.Desktop service still exist so
that a shortcut, script or configuration that still calls them does not go
dead. They do not run the search: they call the launcher’s Toggle method,
which shows or hides its window.
| Bus name | Object | Interface | Method | |
|---|---|---|---|---|
| Desktop (forwards) | org.vasak.os.Desktop | any | any | OpenSearch, ToggleSearch |
| Launcher (target) | ar.net.vasak.Prism | /ar/net/vasak/Prism | ar.net.vasak.Prism | Toggle |
| |
The desktop service handles everything addressed to its name without looking
at the object or the interface, so the path in the first example is a
convention, not a requirement. Since vasak-desktop 1.64.1 every method of the
service replies, so the call returns right away. What it replies depends on the
method:
ListWindowsreturns the window list as JSON.PresentWindow,OpenMenu,OpenControlCenter,OpenWallpaperPicker,PauseWallpaperandResumeWallpaperperform the action before replying: an empty return if it worked,org.vasak.os.Desktop.Errorwith the reason if not.OpenSearch,ToggleSearch,OpenSessionPopup,PowerButtonPressed,ClearScreenTimeandPresentAppkeep working in another task, so they reply with an empty return as soon as the request is dispatched. If something fails afterwards —for instance, the forward tovasak-prism— it is logged by the desktop, not reported in the reply.PresentWindowandPresentAppwithout the argument they expect returnorg.freedesktop.DBus.Error.InvalidArgs.- A name the service does not have returns
org.freedesktop.DBus.Error.UnknownMethod.
Callers that ask for no reply (--expect-reply=no in busctl, or dbus-send
without --print-reply) keep working the same: they get none. Before 1.64.1
almost no method replied, and a call without that flag hung until the D-Bus
timeout. The launcher installs a D-Bus activation file:
if it is not running, the bus starts it on that same call. If vasak-prism is
not installed, the forward fails and the desktop logs it without crashing. The
launcher also exposes Show and Hide on the same object.