Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • D developer.puri.sm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • David Boddie
  • developer.puri.sm
  • Wiki
  • D Bus examples

D Bus examples · Changes

Page history
Add screen brightness examples. authored Feb 07, 2020 by David Boddie's avatar David Boddie
Hide whitespace changes
Inline Side-by-side
D-Bus-examples.md
View page @ 96e58fcb
......@@ -108,6 +108,46 @@ sudo gdbus call --system \
See [this thread](https://forums.puri.sm/t/phone-call-api/8433) for context.
### Getting/Setting Screen Brightness
Introspect the GNOME Settings daemon to see what interfaces are available:
```
gdbus introspect --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power
```
The `org.gnome.SettingsDaemon.Power.Screen` interface is relevant:
```
interface org.gnome.SettingsDaemon.Power.Screen {
methods:
StepUp(out i new_percentage,
out i output_id);
StepDown(out i new_percentage,
out i output_id);
signals:
properties:
readwrite i Brightness = 29;
};
```
Get all properties related to the screen:
```
gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.freedesktop.DBus.Properties.GetAll org.gnome.SettingsDaemon.Power.Screen
```
This should return something like the following:
```
({'Brightness': <29>},)
```
The brightness can be individually read:
```
gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.freedesktop.DBus.Properties.Get org.gnome.SettingsDaemon.Power.Screen Brightness
```
It can also be set:
```
gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.freedesktop.DBus.Properties.Set org.gnome.SettingsDaemon.Power.Screen Brightness '<30>'
```
## Using Applications to Provide Services
GNOME applications run using the `--gapplication-service` command line option will expose the [org.freedesktop.Application](https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus) interface on the session bus. This can be accessed to launch the application and request that it open files specified with URIs. The parameters of the API are explained by [this GApplication D-Bus APIs document](https://wiki.gnome.org/Projects/GLib/GApplication/DBusAPI) which refers to a different interface but which seems to overlap with the freedesktop interface.
......
Clone repository
  • Changing the Phosh Wallpaper
  • D Bus examples
  • Debugging Python applications in flatpaks
  • Developer Documentation Overview
  • Devkit I2C Notes
  • Devkit notes
  • Documenting Applications
  • PyGObject Development Notes
  • Home