Sway: The computer does not suspend automatically after inactivity. I reduced to 10 seconds and it does not inactivate iself within 10 seconds

Hello,

I use the unofficial and community Manjaro Sway edition. The swayidle does not have sleep or suspend option. It only turns the display off, but keeps hardware and keyboard on. I need Swayidle to make the whole computer suspending after inactivity. I use the processor AMD Ryzen 7 2700X and the video card AMD Raaedon RX 5700XT.

Here is the small code in the ~/.config/sway/definitions

set $share_dir /usr/share/sway
set $config_dir /etc/sway
set $user_config_dir $HOME/.config/sway/
set $theme_dir $share_dir/themes
set $script_dir $share_dir/scripts
set $theme $theme_dir/matcha-green
set $locking swaylock --daemonize --config $theme/swaylock
set $idle swayidle -w \
    timeout 10 'light -G > /tmp/brightness && light -S 10' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)' \
    timeout 10 'exec $locking' \
    timeout 10 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"' \
    before-sleep 'exec $locking'
  • The computer does not inactivate itself within 10 seconds. It inactivates itself within 5 minutes.
  • The computer does not suspend automatically after inactivity.

The file is located in the ~/config/sway. I believe it does not overwrite the /etc/sway/ of the unofficial and community Manjaro Sway edition.

I modified /etc/sway/definitions to reduce Swayidle time to 10 seconds for testing, but it did not inactivate itself within 10 seconds.

1 Like

What happens if you follow…

without all of those variables in your OP?

It gave an error: Unknown/invalid command 'swayidle' (even then if swayidle is installed)

Did you include the exec directive?

Mine looks like this:

exec swayidle -w
		timeout 300 'swaylock -f -c 000000'
		timeout 600 'swaymsg "output * dpms off"'
		     resume 'swaymsg "output * dpms on"'
#		before-sleep 'swaylock -f -c 000000'

(I don’t suspend/hibernate my machine)

Works fine.

On the user config and rebooting, it worked without commenting the last command, but it didn’t suspend automatically.

Hi! Can you confirm this still exists in more current images? If so, please create an issue in our github! Issues · Manjaro-Sway/manjaro-sway · GitHub

No, it was solved in your new image of Manjaro Sway, but it is facing still the problem with nwg-launcher.

closing since there is no mention of nwg-launcher. please open an issue on gh if there is one.