swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.45k stars 1.1k forks source link

Swayidle's `resume` unable to turn screen back on again through `output * dpms on` #5903

Closed x10an14 closed 3 years ago

x10an14 commented 3 years ago

Please fill out the following:

Sway Version

[2020-12-21 19:04:43] 0 x10an14@christian-lenovo-laptop:~
-> $ swaymsg -t get_version
sway version 1.4
[2020-12-21 19:06:17] 0 x10an14@christian-lenovo-laptop:~
-> $

Debug output of sway session

https://gist.github.com/x10an14/ea87de7a0a1e15cd13229c30619272ce

Configuration File

Configuration file sripped of comments (read: `wl-copy < grep -vE '^\s*#' ~/.config/sway/config`) ``` set $mod Mod4 set $term alacritty set $menu dmenu_path | dmenu | xargs swaymsg exec -- output eDP-1 scale 2 output eDP-1 resolution 2560x1440 position 0,0 exec swayidle -w \ timeout 15 'pgrep --exact swaylock && swaymsg "output * dpms off"' \ timeout 600 'if ! pgrep --exact swaylock; then swaylock -e -f -F -c 1111FF; fi' \ timeout 1200 'swaymsg "output * dpms off"' \ resume 'swaymsg "output * dpms on"' \ before-sleep 'if ! pgrep --exact swaylock; then swaylock -e -f -F -c 1111FF; fi' bindswitch --reload lid:on output eDP-1 disable bindswitch --reload lid:off output eDP-1 enable input "type:keyboard" { xkb_layout no xkb_options caps:swapescape } bindsym $mod+Return exec $term bindsym $mod+Shift+q kill bindsym $mod+d exec $menu workspace_auto_back_and_forth yes floating_modifier $mod normal bindsym $mod+Shift+r reload bindsym Ctrl+Mod1+l exec swaylock \ --ignore-empty-password \ --show-failed-attempts \ --color=1111FF bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right bindsym $mod+Shift+Left move left bindsym $mod+Shift+Down move down bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right set $ws1 1 set $ws2 "2: Web" set $ws3 3 set $ws4 4 set $ws5 5 set $ws6 6 set $ws7 7 set $ws8 "8: Chats" set $ws9 9 set $ws0 "10: utils" bindsym $mod+1 workspace $ws1 bindsym $mod+2 workspace $ws2 bindsym $mod+3 workspace $ws3 bindsym $mod+4 workspace $ws4 bindsym $mod+5 workspace $ws5 bindsym $mod+6 workspace $ws6 bindsym $mod+7 workspace $ws7 bindsym $mod+8 workspace $ws8 bindsym $mod+9 workspace $ws9 bindsym $mod+0 workspace $ws0 bindsym $mod+Shift+1 move container to workspace $ws1 bindsym $mod+Shift+2 move container to workspace $ws2 bindsym $mod+Shift+3 move container to workspace $ws3 bindsym $mod+Shift+4 move container to workspace $ws4 bindsym $mod+Shift+5 move container to workspace $ws5 bindsym $mod+Shift+6 move container to workspace $ws6 bindsym $mod+Shift+7 move container to workspace $ws7 bindsym $mod+Shift+8 move container to workspace $ws8 bindsym $mod+Shift+9 move container to workspace $ws9 bindsym $mod+Shift+0 move container to workspace $ws0 bindsym $mod+h splith bindsym $mod+v splitv bindsym $mod+s layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split bindsym $mod+f fullscreen bindsym $mod+Shift+space floating toggle bindsym $mod+space focus mode_toggle bindsym $mod+p focus parent bindsym $mod+Shift+apostrophe move scratchpad bindsym $mod+apostrophe scratchpad show mode "resize" { bindsym Left resize shrink width 10px bindsym Down resize grow height 10px bindsym Up resize shrink height 10px bindsym Right resize grow width 10px bindsym Return mode "default" bindsym Escape mode "default" } bindsym $mod+r mode "resize" bar { position bottom status_command while date +'%a %Y-%m-%d %H:%M:%S %Z'; do sleep 1; done colors { statusline #ffffff background #323232 inactive_workspace #a5a4a4 #323232 #bdbdbd active_workspace #333333 #4f676a #888888 focused_workspace #008fff #007fff #ffffff } } exec swaymsg "workspace $ws1; exec $term" exec firefox assign [class="(?i)(firefox)"] $ws2 exec swaymsg "workspace $ws2; layout tabbed" exec slack assign [class="(?i)(discord|slack|zoom|teams)"] $ws8 exec swaymsg "workspace $ws8; layout tabbed" ```

Stack Trace

Not applicable - Sway doesn't crash. It still lives when checking with pgrep in a different TTY.

Description

It seems as if my swaylock command's resume isn't triggering output * dpms on for some reason? I've got the understanding that there can be mutiple resumes, but as long as there's just one, all resume's will trigger it independently of which timeout was enacted.

Swayidle command

For brevity (so you don't have to search for it in the config) here's my swayidle command:

exec swayidle -w \
         timeout 15 'pgrep --exact swaylock && swaymsg "output * dpms off"' \
         timeout 600 'if ! pgrep --exact swaylock; then swaylock -e -f -F -c 1111FF; fi' \
         timeout 1200 'swaymsg "output * dpms off"' \
         resume 'swaymsg "output * dpms on"' \
         before-sleep 'if ! pgrep --exact swaylock; then swaylock -e -f -F -c 1111FF; fi'
x10an14 commented 3 years ago

Same behaviour btw when:

  1. The screen lid is not closed, just waited a couple of minutes after swayidle turned off screen.
  2. I've commented out the lines:
    bindswitch --reload lid:on output eDP-1 disable
    bindswitch --reload lid:off output eDP-1 enable
rpigott commented 3 years ago

I've got the understanding that there can be mutiple resumes, but as long as there's just one, all resume's will trigger it independently of which timeout was enacted.

You misunderstand: the resume command is part of the timeout statement. The resume is timeout specific.

Try out a simple example in your terminal:

$ swayidle timeout 2 'echo idle 2' timeout 5 'echo idle 5' resume 'echo resume 5'

If you nudge your mouse after "idle 2" but before "idle 5" the "resume 5" will not trigger.

x10an14 commented 3 years ago

Thank you! I just read the manual (below screenshot) and ended up with a way different interpretation =) 2020-12-22T09:33:55,337368232+01:00 If I'm alone in this interpretation, there's probably no need to do anything about it!