coadmunkee / gnome-shell-extension-espresso

Enable controlling conditions to prevent the usual auto suspend and screensaver functions from taking effect.
https://extensions.gnome.org/extension/4135/espresso/
GNU General Public License v2.0
69 stars 14 forks source link

GNOME 46 compatibility #64

Closed ajbucci closed 4 months ago

ajbucci commented 4 months ago

fixes #63

coadmunkee commented 4 months ago

These two changes provide a very barebone ability for Espresso to work partially with Gnome 46, but even basic things like clicking on the icon to enable or disable Espresso aren't working. Changing the extension widget from an Actor to a Child seems to affect the event handler.

ajbucci commented 4 months ago

Strange. Everything is working as expected on my end. All the _connect's are initialized without error, when I toggle the icon on/off I appropriately get:

Espresso: Debug: Toggle enabled. Previous state was on user     override
Espresso: Debug: Removing all inhibitors
Espresso: Debug: Requested to remove inhibition by Symbol(espresso/user)
Espresso: Debug: Locking the queue and requesting to remove Symbol(espresso/user)
Espresso: Debug: Inhibitor removed: Symbol(espresso/user), unlocking queue
Espresso: Debug: Toggle enabled. Previous state was off     override
Espresso: Debug: Requested to add inhibition by Symbol(espresso/user)
Espresso: Debug: Locking the queue and requesting to add Symbol(espresso/user)
Espresso: Debug: addInhibit called with Symbol(espresso/user)
Espresso: Debug: Inhibitor added: Symbol(espresso/user), unlocking queue

I can also see the inhibitor being added and removed as expected on DBus monitor and I've verified that it prevents my PC from sleeping if enabled, and allows my PC to sleep when disabled.

I'm on Gnome 46 / X11 / Arch.

coadmunkee commented 4 months ago

Maybe something else is messed up on my linux install.... I'll build a fresh machine and do some more testing. Thanks for the work and the details on how it is working for you.

ajbucci commented 4 months ago

No problem! Happy to help

fakhrullah commented 4 months ago

I tried this and it worked on Ubuntu 24.04 LTS.

I am not familiar with gnome-shell-extensions but here what I did.

  1. Clone the source ajbucci:master somewhere.
  2. Remove original from extensions rm -rf ~/.local/share/gnome-shell/extensions/espresso@coadmunkee.github.com
  3. Copy the built code to cp -r espresso@coadmunkee.github.com ~/.local/share/gnome-shell/extensions/
  4. Logout and login Ubuntu. I have problem there is no file schemas/gschemas.compiled.
  5. I run make-zip.sh then the file schemas/gschemas.compiled is generated.
  6. I copy paste the gschemas.compiled file to ~/.local/share/gnome-shell/extensions/espresso@coadmunkee.github.com/schemas
  7. Logout and login again Ubuntu. Then it worked.

Thanks for the great tool and the updates.

05storm26 commented 4 months ago

I have tried this as well.

Unfortunately it doesn't work for me either.

I have installed it, logged out and logged in, disabled and enabled it, and after that it is visible on the top bar, but when I click on it, nothing happens; the icon doesn't change between the two states.

coadmunkee commented 4 months ago

I built two new virtual machines fresh .. one with EndeavourOS and one with Fedora. On both platforms I am getting the same behavior 05storm26 noted above. I am not sure what is different for ajbucci and fakhrullah.

I can see some problems with the initialization code failing to connect InhibitorAdded and InhibitorRemoved events to the sessions manager. I am not sure why some of see this behavior and other don't.

ajbucci commented 4 months ago

I'll build a fresh VM and try debugging later this week

ajbucci commented 4 months ago

I still don't know why it was working for me on my Arch install... but I spun up a Fedora VM to debug and my latest commit should allow the code to run everywhere.

I can see some problems with the initialization code failing to connect InhibitorAdded and InhibitorRemoved events to the sessions manager. I am not sure why some of see this behavior and other don't.

This is actually OK as-is, there were some other errors that were halting execution inside _inhibitorAdded() and _sendNotification(). These should be fixed in my latest commit.

The reason we see the failure in the initialization for the InhibitorAdded and InhibitorRemoved signals is because they are expected to use connectSignal() instead of connect(). There is a try catch inside _connect() that handles this already. I would probably be more explicit and not use _connect() for InhibitorAdded and InhibitorRemoved, but I prefer to keep my changes to a minimum when I'm working in unfamiliar codebases to prevent unintended side-effects.

coadmunkee commented 4 months ago

I made a little time do some testing on my daily driver and on a couple of other distros on VMs. Everything seems to be working well. Thank you @ajbucci for some great work! I'll merge the pull request and submit an updated package to extensions.gnome.org this weekend.

jee-r commented 4 months ago

Hi @coadmunkee have you had time to submit the version for gnome 46 on the gnome extensions store?

coadmunkee commented 4 months ago

@jee-r - I just submitted version 10 to extensions.gnome.org (12 May 2024) ... it might be a day or so until peer review and approval are obtained for the release to be available on the site.