xsuspender icon indicating copy to clipboard operation
xsuspender copied to clipboard

Xsuspender does not register focus/unfocus events

Open dbedrenko opened this issue 1 year ago • 4 comments

Hello, firstly, thank you very much for this program! It's just what I need for a few pesky applications that take up CPU even when not being used.

Specs

OS: ArchLinux Xsuspender version: Latest as-of today (4cce090) Window Manager: AwesomeWM v4.3 Xorg-server version: 21.1.8

Steps to reproduce

  1. Have this config:
[Default]
suspend_delay = 5
resume_every = 0
resume_for = 0
send_signals = true
only_on_battery = false
auto_suspend_on_battery = true
downclock_on_battery = 0
# Suspend all processes.
suspend_subtree_pattern = .

[Pavucontrol]
match_wm_class_group_contains = Pavucontrol
  1. Open pavucontrol (I tried Chromium and other apps too, any app will do)
  2. Run G_MESSAGES_DEBUG=xsuspender xsuspender in a terminal
  3. Focus Pavucontrol and notice that it's responding to mouse events.
  4. Wait 5 seconds
  5. Pavucontrol stops responding to mouse/keyboard events. No amount of clicking or minimising and re-maximising resumes the process.
  6. Terminate xsuspender to have Pavucontrol resume running.

Here's the output of that:

$ G_MESSAGES_DEBUG=xsuspender xsuspender
(xsuspender:110132): xsuspender-DEBUG: 21:24:53.280: Initializing.
(xsuspender:110132): xsuspender-DEBUG: 21:24:53.282:
needle_wm_class = (null)
needle_wm_class_group = Pavucontrol
needle_wm_name = (null)
delay = 5
resume_every = 0
resume_for = 1
only_on_battery = 0
send_signals = 1
subtree_pattern = .
downclock_on_battery = 0
exec_suspend = (null)
exec_resume = (null)

(xsuspender:110132): xsuspender-DEBUG: 21:25:03.244: AC power = 0; State changed. Suspending/resuming windows.
(xsuspender:110132): xsuspender-DEBUG: 21:25:04.244: kill -STOP 104986
(xsuspender:110132): xsuspender-DEBUG: 21:25:04.244: Exec: pstree 104986 (.) | kill -STOP
(xsuspender:110132): xsuspender-DEBUG: 21:25:04.244:       kill -STOP 104986
^C(xsuspender:110132): xsuspender-DEBUG: 21:25:12.548: Exiting ...
(xsuspender:110132): xsuspender-DEBUG: 21:25:12.549: kill -CONT 104986
(xsuspender:110132): xsuspender-DEBUG: 21:25:12.549: Exec: pstree 104986 (.) | kill -CONT
(xsuspender:110132): xsuspender-DEBUG: 21:25:12.549:       kill -CONT 104986
(xsuspender:110132): xsuspender-DEBUG: 21:25:12.558: Bye.

It seems that whatever mechanism xsuspender uses to listen to the focus/unfocus events isn't working? Can I provide any more info or experiments to help debug this issue?

dbedrenko avatar Apr 24 '23 20:04 dbedrenko