Skip to content

Instantly share code, notes, and snippets.

@mvidner
Created March 24, 2022 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvidner/cda290d029de72c2e6e89d38c7e66e2c to your computer and use it in GitHub Desktop.
Save mvidner/cda290d029de72c2e6e89d38c7e66e2c to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# frozen_string_literal: true
require "dbus"
# Complex property
class Test < DBus::Object
dbus_interface "net.vidner.Scratch" do
dbus_attr_reader :progress, "(stttt)"
end
def initialize(opath)
@progress = ["working", 1, 0, 100, 42].freeze
super(opath)
end
end
bus = DBus::SessionBus.instance
svc = bus.request_service("net.vidner.Scratch")
svc.export(Test.new("/net/vidner/Scratch"))
DBus::Main.new.tap { |m| m << bus }.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment