How does gnome-shell deal with power button press event?

Hi,
I am trying to figure out what happened when the power button is pressed. I found there is a dbus signal named ‘AcceleratorActivated’ was emitted when the power button is pressed by org.gnome.Shell. so I download the gnome-shell code from https://gitlab.gnome.org/GNOME/gnome-shell. But I find it seems depend on javascript , and I can only find the following code is related to AcceleratorActivated, but I can not find out when and how this signal was triggered, is there any debug tool for gnome-shell or any document about this would help me? thank you.

        global.display.connect('accelerator-activated',
        (display, action, device, timestamp) => {
            this._emitAcceleratorActivated(action, device, timestamp);
        });

This is handled by gnome-settings-daemon.

Thank you.
I do find the signal ‘AcceleratorActivated’ from org.gnome.ShellKeyGrabber.xml, but I can not find where this signal is emitted. can you be more specific?

It is emitted in the code you quoted above.

The chain of events is roughly as follows:

gnome-settings-daemon → gnome-shell: please grab XF86Power for me
gnome-shell → mutter: add XF86Power keybinding
mutter → gnome-shell: keybinding with ID n was activated
gnome-shell → emit AcceleratorActivated for action n
gnome-settings-daemon: n corresponds to power-off action, so do that

1 Like

Thank you very much.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.