ultrabug / py3status

py3status is an extensible i3status wrapper written in python

Home Page:https://ultrabug.github.io/py3status/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prevent bar being stopped by using signal other than SIGSTOP

pedro-nonfree opened this issue · comments

Is your feature request related to a problem? Please describe.

When the bar is hidden, i3bar sends the SIGSTOP and SIGCONT signals to the status_command process in order to conserve battery power. This feature can be disabled by the status_command process by setting the appropriate values in its JSON header message.

https://i3wm.org/docs/userguide.html#_display_mode

it also fills the syslog with strange messages like this:

Jan 21 13:11:05 host py3status: received SIGTSTP
Jan 21 13:11:15 host py3status: received SIGCONT
Jan 21 13:11:16 host py3status: received SIGTSTP
Jan 21 13:11:25 host py3status: received SIGCONT
Jan 21 13:11:26 host py3status: received SIGTSTP
Jan 21 13:11:32 host py3status: received SIGCONT
Jan 21 13:11:32 host py3status: received SIGTSTP

looks like stop_signal is hardcoded to certain value (20)

"stop_signal": SIGTSTP,

Your py3status version
py3status version 3.31 (python 3.9.2) on i3

Describe the solution you'd like

the solution they found in i3status-rust greshake/i3status-rust#701 is a new option called never-pause

Additional context
Additional links

Rough draft.

diff --git a/py3status/core.py b/py3status/core.py
index 77e624d..42161aa 100644
--- a/py3status/core.py
+++ b/py3status/core.py
@@ -1016,7 +1016,7 @@ class Py3statusWrapper:
         header = {
             "version": 1,
             "click_events": self.config["click_events"],
-            "stop_signal": SIGTSTP,
+            "stop_signal": signal.Signals[py3_config.get("py3status", {}).get("stop_signal", "SIGTSTP")],
         }
         write(dumps(header))
         write("\n[[]\n")

and

# ~/.config/py3status/config
# --------------------------
general {

}
py3status {
    stop_signal = "SIGTSTP"
}

order += "sysdata"
order += "lm_sensors"
order += "nvidia_smi"
# ...

@pedro-nonfree I think that what @lasers suggests is good; would you like such an option?

please check #2095 thanks :)

closed via #2095