Rust dbus and dconf gnome api bindings
A friendly API for interacting with gnome shell, freedesktop and other D-Bus services and settings available on Ubuntu gnome.
This project is thought to be used in Sittly a tauri based app, you will see this trending in the examples.
Disclaimer: I'm not a Rust expert, I'm learning Rust and I'm using this project to learn it. If you see something that can be improved, please open an issue or a PR.
Usage
System apps
This app struct is thought to be used in a GUI to display all the apps installed in the system.
Because of that app.icon is a png image that can be encoded in base64 using app.get_base64_icon() and displayed in a GUI.
use Apps;
// Init gtk global instance to use gtk related functions
// If you already have a gtk instance running you must skip this step
init.unwrap;
async
Screen
use screen;
async
async
async
async
async
Night light
use nightlight;
Screenshot
use screenshot;
async
Power
use power;
async
async
async
Peripherals
use peripherals;
Battery
use battery;
async
async
Gnome extensions
use extensions;
async
async
async
async
async
Features
-
Power management
- Power off
- Reboot
- Suspend
-
Locales
- Get x11 layout
-
Gnome extensions
- Get extensions
- Enable extension
- Disable extension
- Uninstall extension
-
Gnome shell screenshot
- Pick color
-
Settings
- Night light
- Get night light status
- Set night light status
- Get night light temperature
- Set night light temperature
- Night light
-
Gsettings Dconf (https://crates.io/crates/dconf_rs/0.3.0)
-
- org.gnome.desktop.peripherals.touchpad two-finger-scrolling-enabled true
- org.gnome.desktop.peripherals.touchpad tap-to-click true
- org.gnome.desktop.peripherals.mouse natural-scroll true
- org.gnome.desktop.peripherals.keyboard repeat-interval 30 (initial key repeat delay)
- org.gnome.desktop.peripherals.keyboard delay 500 (initial key repeat delay)
- org.gnome.desktop.interface show-battery-percentage true
- org.gnome.desktop.interface locate-pointer false (with ctrl key)
- org.gnome.desktop.interface cursor-size 24
- org.gnome.desktop.interface clock-show-seconds false
- org.gnome.desktop.interface clock-show-date true
- org.gnome.desktop.interface clock-format -->
- org.gnome.shell disable-user-extensions false
- org.gnome.shell development-tools true
- org.gnome.mutter center-new-windows
- org.gnome.gnome-session auto-save-session false (restore open apps on login)
- org.gnome.desktop.screensaver picture-uri 'file:///home/julian/...'
- org.gnome.desktop.privacy hide-identity false
- org.gnome.desktop.privacy disable-sound-output false
- org.gnome.desktop.privacy disable-microphone false
- org.gnome.desktop.privacy disable-camera false
- org.gnome.desktop.calendar show-weekdate
- org.gnome.desktop.background show-desktop-icons true
- org.gnome.desktop.background picture-uri-dark 'file:///home/julian/Pictures/Wallpapers/image.webp'
- org.gnome.desktop.a11y.applications screen-reader-enabled false
- org.gnome.desktop.a11y.applications screen-magnifier-enabled false
- org.gnome.desktop.a11y.applications screen-keyboard-enabled false
- org.gnome.desktop.a11y always-show-universal-access-status false
- org.gnome.desktop.a11y always-show-text-caret false
- org.gnome.shell.extensions.dash-to-dock > XYZ
-
Interfaces
-
org.freedesktop.UPower: (https://crates.io/crates/upower_dbus)
- is_on_battery
- is_lid_closed
- enumerate_devices
- get_display_device
- device, battery, external_device
- type (important to identify external devices) (https://upower.freedesktop.org/docs/Device.html)
- state (https://upower.freedesktop.org/docs/Device.html)
- technology (https://upower.freedesktop.org/docs/Device.html)
- get_percentage
- time_to_empty (seconds) (0 if unknown)
- time_to_full (seconds) (0 if unknown)
- capacity (battery life)
- energy_full (Wh) (actual max charge)
- energy_full_design (Wh) (factory max charge)
- energy_rate (W) (current power draw)
- temperature (K)
- model
- vendor
- voltage
-
net.hadess.PowerProfiles: power profiles (power save, balanced, performance)
- active_profile (read/write)
- PerformanceInhibited (read) (reason for performance being inhibited)
- PerformanceDegraded (read) (reason for performance being degraded)
-
org.bluez: bluetooth devices, devices stats
-
org.freedesktop.NetworkManager: network manager, wifi, connections
-
org.freedesktop.UDisks2: disks, partitions, filesystems
-
org.freedesktop.FileManager1: file manager (nautilus)
-
org.gnome.SettingsDaemon.*: settings daemon
- org.gnome.SettingsDaemon.Power:
- keyboard
- brightness (r/w)
- brightness-step-up
- brightness-step-down
- brightness-toggle
- keyboard
- org.gnome.SettingsDaemon.Power:
Gnome shell
Devtools
- D-Spy: search for and inspect D-Bus services
