Desktop commands | vasak-desktop

Commands implemented in vasak-desktop that new desktop features can use

Audio#

  • get_audio_volume() - Get the current volume
  • set_audio_volume(volume: u32) - Set the volume
  • toggle_audio_mute() - Toggle mute
  • get_audio_devices() - List audio devices
  • set_audio_device(device_id: String) - Switch device
  • toggle_audio_applet() - Show/hide the audio applet

Brightness#

  • get_brightness_info() - Current brightness information
  • set_brightness_info(brightness: u32) - Set the brightness

Notifications#

  • send_notify(notification: NotificationData) - Send a notification
  • clear_notifications() - Clear all notifications
  • get_all_notifications() - Get the list of notifications
  • delete_notification(id: String) - Delete a specific notification
  • invoke_notification_action(id: String, action: String) - Run an action

Network#

  • toggle_network_applet() - Show/hide the network applet

Bluetooth#

  • toggle_bluetooth_applet() - Show/hide the Bluetooth applet

Music (MPRIS)#

  • music_play_pause() - Play/Pause
  • music_next_track() - Next track
  • music_previous_track() - Previous track
  • music_now_playing() - Current track information

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 nameObjectInterfaceMethod
Desktop (forwards)org.vasak.os.DesktopanyanyOpenSearch, ToggleSearch
Launcher (target)ar.net.vasak.Prism/ar/net/vasak/Prismar.net.vasak.PrismToggle
1
2
3
4
5
6
7
# Still works, for compatibility: goes through the desktop
busctl --user call org.vasak.os.Desktop /org/vasak/os/Desktop \
  org.vasak.os.Desktop ToggleSearch

# What new code should use: straight to the launcher
busctl --user call 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:

  • ListWindows returns the window list as JSON.
  • PresentWindow, OpenMenu, OpenControlCenter, OpenWallpaperPicker, PauseWallpaper and ResumeWallpaper perform the action before replying: an empty return if it worked, org.vasak.os.Desktop.Error with the reason if not.
  • OpenSearch, ToggleSearch, OpenSessionPopup, PowerButtonPressed, ClearScreenTime and PresentApp keep 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 to vasak-prism— it is logged by the desktop, not reported in the reply.
  • PresentWindow and PresentApp without the argument they expect return org.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.

Keyboard Shortcuts#

  • get_shortcuts() - Get all shortcuts
  • update_shortcut(id: String, new_keys: Vec<String>) - Update a shortcut
  • add_custom_shortcut(shortcut: CustomShortcut) - Add a custom shortcut
  • delete_shortcut(id: String) - Delete a shortcut
  • execute_shortcut(command: String) - Run a shortcut command
  • check_shortcut_conflicts(keys: Vec<String>) - Check for conflicts

System#

  • get_system_info() - System information
  • get_cpu_usage_only() - CPU usage
  • get_memory_usage_only() - Memory usage
  • get_system_config() - System configuration
  • set_system_config(config: SystemConfig) - Set the configuration
  • get_current_system_state() - Current system state

Theme#

  • toggle_system_theme() - Toggle dark/light theme
  • get_gtk_themes() - List the available GTK themes
  • get_cursor_themes() - List the cursor themes
  • get_icon_packs() - List the icon packs

Session#

  • logout() - Log out
  • shutdown() - Shut down the system
  • reboot() - Reboot the system
  • suspend() - Suspend the system
  • detect_display_server() - Detect X11/Wayland

Location: All of these commands are defined in src-tauri/src/commands/ and registered in src-tauri/src/lib.rs.