BookwormPup: how to prevent suspend when laptop lid closed? (Solved)

New to Puppy and have questions? Start here

Moderator: Forum moderators

User avatar
MochiMoppel
Posts: 1134
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 368 times

Re: BookwormPup: how to prevent suspend when laptop lid closed? (Solved)

Post by MochiMoppel »

dimkr wrote: Thu May 09, 2024 5:55 am

I don't see any reason why someone would want X to think that the internal display is still enabled (and keep the JWM tray and open windows there) after the lid is closed.

That shouldn't be so difficult to understand. It may be exactly the configuration a user wants. My Acer even offers this as default: The desktop comes up on the internal display with the JWM tray at the bottom, the desktop fits the screen resolution, so perfect for the internal monitor. The external monitor shows the pinboard background but otherwise is empty. It serves as a big extended screen. When I shift windows to the right side they will reappear on the left side of the external monitor. I could open a fullscreen window on the big monitor while working on other stuff on the internal monitor. The laptop monitor is used as the main monitor, the external monitor is just a nice extra space. So far understandable? Now the user takes a break and closes the lid. What should he expect? Chances are that he wants to continue with the same configuration when he opens the lid again. Instead your fix shifts the tray and icons to the external monitor and from now on he is forced to use the external monitor as his main monitor. The xrandr command has destroyed his configuration and there is no easy way back.

Obviously you want to use the external monitor as main and are quite happy that your fix moves the tray to the bigger monitor. I can fully understand that. But this doesn't mean that a lid event should be in charge of messing around with the configuration. There are other and better solutions possible.

I've tested your suspend.sh again (pure curiosity, zero need for acpi) , this time with BW64 on Acer Aspire One:
External monitor attached. Closing lid triggers suspend. It shouldn't! Your changes fail because of line

Code: Select all

case "$(awk '{print $2}' /proc/acpi/button/lid/LID0/state)" in

In BW64 it's LID , not LID0.

And another bad news. I already mentioned

Code: Select all

xrandr --output eDP-1 --off || xrandr --output eDP1 --off || xrandr --output LVDS-1 --off || xrandr --output LVDS1 --off

This code works only for monitors named eDP-1 because xrandr always returns true, even if the name is wrong. Therefore better stop guessing and retrieve the exact name. You can get it from xrandr.

dimkr
Posts: 2006
Joined: Wed Dec 30, 2020 6:14 pm
Has thanked: 38 times
Been thanked: 915 times

Re: BookwormPup: how to prevent suspend when laptop lid closed? (Solved)

Post by dimkr »

MochiMoppel wrote: Fri May 10, 2024 8:15 am

Instead your fix shifts the tray and icons to the external monitor and from now on he is forced to use the external monitor as his main monitor.

From my understanding, this is a JWM bug - it doesn't move the tray back to the previously disabled monitor once it's enabled.

MochiMoppel wrote: Fri May 10, 2024 8:15 am

There are other and better solutions possible.

I agree, but fixing this properly would require a display settings panel and a daemon that reapplies the user-provided settings on every connect/disconnect/lid event, something Puppy doesn't have.

MochiMoppel wrote: Fri May 10, 2024 8:15 am

In BW64 it's LID , not LID0.

Changed to LID*, thanks.

MochiMoppel wrote: Fri May 10, 2024 8:15 am

This code works only for monitors named eDP-1 because xrandr always returns true, even if the name is wrong. Therefore better stop guessing and retrieve the exact name.

Fixed, thanks.

User avatar
MochiMoppel
Posts: 1134
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 18 times
Been thanked: 368 times

Re: BookwormPup: how to prevent suspend when laptop lid closed? (Solved)

Post by MochiMoppel »

dimkr wrote: Fri May 10, 2024 8:59 am

From my understanding, this is a JWM bug - it doesn't move the tray back to the previously disabled monitor once it's enabled.

Not only does it not move the tray back, in my case the tray relocates to the center of the screen and maximized windows cover only half of the screen, though windows can be manually resized to full screen dimension. Pretty chaotic. In my understanding this may not be a JWM bug but is rather the consequence of the --auto option, which simply resets the monitors to default settings. The results are unpredictable and potentially unpleasant. I see your changes as a nice try, but let's face it, they can break more than they fix. Let's keep it simple and restrict the suspend script to suspend handling. Monitor configuration can become very complex and is a different ball game and should be handled separately.

Even the new rule to disable suspend when an external monitor is connected may not be what users want. Would be OK for the OP of this thread, but when using the laptop as main monitor and the external monitor as mere extension then it becomes useful when a lid close event suspends the laptop and shuts down both monitors. Strangely with acpi.conf a configuration file for some user preferences exists, and new ones could easily be added, but to my knowledge there is no user interface for this file.

fixing this properly would require a display settings panel and a daemon that reapplies the user-provided settings on every connect/disconnect/lid event, something Puppy doesn't have.

Indeed. I'm not sure if another daemon is needed but a frontend for xrandr would be helpful. Might even exist in the repositories.

Post Reply

Return to “Beginners Help”