Announcement

Collapse
No announcement yet.

Is it possible to write a script that send a signal containing a dictionary of string and array of bytes?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is it possible to write a script that send a signal containing a dictionary of string and array of bytes?

    Is it possible to write a script that makes the following appear in dbus-monitor?

    Code:
    signal time=1722266455.487564 sender=:1.581 -> destination=(null destination) serial=3 path=/kcminputrc; interface=org.kde.kconfig.notify; member=ConfigChanged
       array [
          dict entry(
             string "Mouse"
             array [
                array of bytes "cursorTheme"
             ]
          )
       ]
    PS: I'm trying to implement a script that changes a cursor theme while being capable to run on distros without plasma-apply-cursortheme binary.​ The only workaround I've managed to figure out so far is by setting XCURSOR_THEME and restarting a few apps. If you manage to find a way that doesn't require restarting apps, please let me know.

    Thank you very much.

    #2
    gdbus can send ("emit") signals with arbitrary arguments. It's part of glib so I think you'll have it already installed, but if not it's in the package libglib2.0-bin.

    I suggest searching for gdbus examples.
    Regards, John Little

    Comment


      #3
      If you could set this up with some test data and maybe post it to repl.it (or format it better), we might be able to help more


      Last edited by newiron09; Oct 02, 2024, 03:06 PM.

      Comment


        #4
        I've actually ended up restarting the apps, setting the XCURSOR_THEME and running the following:

        Code:
                dbus-send --print-reply --session --type=method_call --dest=org.kde.klauncher /KLauncher org.kde.KLauncher.setLaunchEnv string:XCURSOR_THEME string:"$ThemeToUseForTheCursors" > /dev/null 2>&1
                dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.SetEnvironment array:string:XCURSOR_THEME="$ThemeToUseForTheCursors" > /dev/null 2>&1
                dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.UpdateActivationEnvironment dict:string:string:XCURSOR_THEME,"$ThemeToUseForTheCursors" > /dev/null 2>&1
        
                printf "Xcursor.theme: %s\n" "$ThemeToUseForTheCursors" | xrdb -merge /proc/self/fd/0
        ​        dbus-send --session --type=signal /KGlobalSettings org.kde.KGlobalSettings.notifyChange int32:5 int32:0 # CursorChanged
        The xrdb -merge is required for the change to take effect once KWin is replaced.
        I'm perfectly OK with restarting the apps, so I did it that way.

        Comment

        Working...
        X