sardemff7 / j4status

Status line generator
https://sardemff7.github.io/j4status/
GNU General Public License v3.0
47 stars 9 forks source link

Stops working after going fullscreen and back #19

Closed wentasah closed 9 years ago

wentasah commented 9 years ago

After running i3 fullscreen; i3 fullscreen the i3bar says "Error: status_command process exited unexpectedly (exit 0)".

Before this, the process tree looks like this: i3bar -> sh -> j4status. After the second i3 fullscreen, sh exits and j4status is adopted by pid 1. It has probably something to do with i3bar sending SIGSTOP/SIGCONT signal to the child. I figured out a difference between using i3status and j4status. When using i3status and watching the processes with top during fullscreen, both sh and i3status are marked as stopped ("T"), while with j4status it is not the case.

sardemff7 commented 9 years ago

It is totally normal because j4status is not using SIGSTOP/SIGCONT but SIGINT/SIGHUP.

Can you attach you i3/i3bar version, and the bar{} config snippet from your i3 config?

The strange thing is that you are having an sh process between i3bar and j4status. j4status should be a direct child of i3bar. Since i3bar sends SIGHUP, your sh process will exit.

wentasah commented 9 years ago

My bar{} config is simple:

bar { status_command j4status position top }

I use i3 version 4.10.2 compiled by myself.

Having shell running the status command is documented at http://i3wm.org/docs/userguide.html#status_command

Therefore, if I change status_command to

status_command exec j4status

it works correctly.

Btw. what's the reason for using SIGINT/SIGHUP in j4status?

sardemff7 commented 9 years ago

Which shell is your sh? fish maybe? Here bash is used as sh so I guess you use a different one which does not exec automatically.

The reason for SIGINT/SIGHUP is to not stop because there might be important information coming when i3bar is hiding, in which case you want i3bar to pop with the information shown. i3status does not support such a feature because it is timer-based while j4status is event-based. Some plugins in j4status will just stop polling while i3bar is hidden (e.g. time), some will continue polling important stuff (e.g. upower, sensors).

wentasah commented 9 years ago

My sh is dash (Debian). You're right that bash and dash behave differently:

$ bash -c "pstree $$" zsh───pstree

$ sh -c "pstree $$" zsh───sh───pstree

sardemff7 commented 9 years ago

I proposed a “fix” to i3bar and was advice to make it a documentation hint instead. Then I saw the hint was there already. I added one in j4status’ man page too (in 2ebb7584d9dc6bbdbf8a8deca17f36e242e597a5).