Score:0

Permissions denied on try manipulating gnome from CLI

jp flag
System: Ubuntu: 22.04.1
GNOME version: 42.5

I'm trying to make script to manipulate GNOME from CLI to use it in Solaar and other automation scripts.

example:

dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'Main.overview.toggle();'

My scripts from 20.04 appeared not working. As I found out - the Eval function is not available any more due to security reasons. So I've remade it as:

toggle_activities() {
    status=$(dbus-send --session --type=method_call --print-reply=literal --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Get string:org.gnome.Shell string:OverviewActive | awk '{print $3}')

    if [ "$status" = "false" ]; then
        dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Set string:org.gnome.Shell string:OverviewActive variant:boolean:true
    else
        dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.freedesktop.DBus.Properties.Set string:org.gnome.Shell string:OverviewActive variant:boolean:false
    fi
}

But I can not solve problem with

dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.ShowApplications

In dbus-monitor I've got error:

method call time=1669718931.082783 sender=:1.16366 -> destination=org.gnome.Shell serial=2 path=/org/gnome/Shell; interface=org.gnome.Shell; member=ShowApplications
signal time=1669718931.083565 sender=org.freedesktop.DBus -> destination=:1.16366 serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.16366"
signal time=1669718931.083587 sender=org.freedesktop.DBus -> destination=(null destination) serial=31800 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.16366"
   string ":1.16366"
   string ""
error time=1669718931.084320 sender=:1.39 -> destination=:1.16366 error_name=org.freedesktop.DBus.Error.AccessDenied reply_serial=2
   string "ShowApplications is not allowed"

Is there any way to make my script trusted or remove this limitation, or any workaround?

Finally, I need these options:

  • Open/close overview (achieved)
  • Open/close applications grid
  • Switch workspace left or right

The option to emulate keystrokes is not acceptable, because of option to change any of keybindings which cause changing Solaar config and other scripts.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.