loserMcloser / waylogout

MIT License
38 stars 2 forks source link

sway 1.10: no controls are shown after sway restart #22

Open 532910 opened 5 days ago

532910 commented 5 days ago

steps to reproduce:

  1. reload sway (Ctrl-Alt-End in my case: bindsym --to-code $mod+Ctrl+End reload)
  2. run waylogout
loserMcloser commented 4 days ago

Can't reproduce here. What is the output if you do the following from a terminal?

$ swaymsg reload
$ waylogout --debug
532910 commented 4 days ago

wlr-randr showed eDP-1 was enabled after reload as I missed --reload for bindswitch:

bindswitch --locked {
    lid:on  output $laptop_display disable
    lid:off output $laptop_display enable
}

with

bindswitch --locked --reload {
    lid:on  output $laptop_display disable
    lid:off output $laptop_display enable
}

all works fine, so this means https://github.com/loserMcloser/waylogout/issues/20 is not fixed, as when two output are enabled I see controls only on the one of them

loserMcloser commented 3 days ago

I'm not clear on what steps I need to take to reproduce.

Here's what I tried:

  1. Connected my laptop's HDMI output to my TV.
  2. Ran waylogout. Result: command indicators visible on both screens.
  3. Ran swaymsg output eDP-1 disable (where eDP-1 is my laptop's screen), so that only TV was displaying output. Then ran waylogout again. Result: command indicators were visible on the TV.
  4. Ran swaymsg output eDP-1 enable to turn laptop screen back on, then ran waylogout again. Result: command indicators were visible on both screens again.

Aside: I'm not clear on why you need (or want) --reload on those bindswitch lines in your config. My reading of man 5 sway is that including --reload is going to cause both commands output $laptop_display disable and output $laptop_display enable to run every time sway is reloaded. It doesn't seem necessary or desirable to cause your laptop display to be toggled off then on in quick succession when you reload sway.

532910 commented 3 days ago

I believe the man is wrong, --reload means just evaluate, not execute the rule:

[DEBUG] [sway/config.c:797] Read line 14: bindswitch --locked --reload {
[DEBUG] [sway/config.c:851] Entering block 'bindswitch --locked --reload'
[DEBUG] [sway/config.c:797] Read line 15:       lid:on  output $laptop_display disable 
[INFO] [sway/commands.c:381] Config command: bindswitch --locked --reload lid:on  output $laptop_display disable
[INFO] [sway/commands.c:404] After replacement: bindswitch --locked --reload lid:on output eDP-1 disable
[DEBUG] [sway/commands/bind.c:234] bindswitch - Bound lid:on to command `output eDP-1 disable`
[DEBUG] [sway/config.c:797] Read line 16:       lid:off output $laptop_display enable
[INFO] [sway/commands.c:381] Config command: bindswitch --locked --reload lid:off output $laptop_display enable
[INFO] [sway/commands.c:404] After replacement: bindswitch --locked --reload lid:off output eDP-1 enable 
[DEBUG] [sway/commands/bind.c:234] bindswitch - Bound lid:off to command `output eDP-1 enable`
[DEBUG] [sway/config.c:797] Read line 17: }
[DEBUG] [sway/config.c:868] Exiting block 'bindswitch --locked --reload'
[DEBUG] [sway/input/switch.c:102] Configured switch for device
[DEBUG] [sway/commands/bind.c:618] running command for binding: output eDP-1 disable
[INFO] [sway/commands.c:261] Handling command 'output eDP-1 disable'
[DEBUG] [sway/commands.c:436] Subcommand: disable
[DEBUG] [sway/config/output.c:261] Config stored for output eDP-1 (enabled: 0) (-1x-1@-1.000000Hz position -1,-1 scale -1.000000 subpixel unknown transform -1) (bg (null) (null)) (power -1) (max render time: -1) (allow tearing: -1) 

My laptop lid is always closed I don't see what's going there.

When I start sway lid:on output $laptop_display disable disables eDP-1, only DP-1 is enabled, all works fine. When I do restart, sway enables eDP-1, that's why I need --reload to disable it back.

532910 commented 3 days ago

even if I open laptop lid and see both monitors, waylogout shows controls only on the one screen

532910 commented 3 days ago
% wlr-randr
DP-1 "Stargate Technology HS156KC demoset-1 (DP-1)"
  Make: Stargate Technology
  Model: HS156KC
  Serial: demoset-1
  Physical size: 300x260 mm
  Enabled: yes
  Modes:
    3840x2160 px, 59.981998 Hz (preferred, current)
    3840x2160 px, 50.000000 Hz
    3840x2160 px, 30.000000 Hz
    3840x2160 px, 29.969999 Hz
    3840x2160 px, 25.000000 Hz
    3840x2160 px, 24.000000 Hz
    3840x2160 px, 23.976000 Hz
    1920x1200 px, 59.981998 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 50.000000 Hz
    1920x1080 px, 30.000000 Hz
    1920x1080 px, 29.969999 Hz
    1920x1080 px, 25.000000 Hz
    1920x1080 px, 24.000000 Hz
    1920x1080 px, 23.976000 Hz
    1600x1200 px, 59.981998 Hz
    1680x1050 px, 59.981998 Hz
    1400x1050 px, 59.978001 Hz
    1280x1024 px, 60.020000 Hz
    1440x900 px, 59.887001 Hz
    1280x960 px, 60.000000 Hz
    1280x800 px, 59.981998 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 59.939999 Hz
    1280x720 px, 50.000000 Hz
    1280x720 px, 30.000000 Hz
    1280x720 px, 29.969999 Hz
    1280x720 px, 25.000000 Hz
    1280x720 px, 24.000000 Hz
    1280x720 px, 23.976000 Hz
    1024x768 px, 60.004002 Hz
    800x600 px, 60.317001 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 59.939999 Hz
    720x480 px, 59.939999 Hz
    640x480 px, 60.000000 Hz
    640x480 px, 59.939999 Hz
    640x480 px, 59.939999 Hz
  Position: 0,0
  Transform: normal
  Scale: 2.000000
  Adaptive Sync: disabled
eDP-1 "LG Display 0x0608 (eDP-1)"
  Make: LG Display
  Model: 0x0608
  Serial: (null)
  Physical size: 310x170 mm
  Enabled: yes
  Modes:
    1920x1080 px, 60.020000 Hz (preferred, current)
    1920x1080 px, 47.999001 Hz
    1680x1050 px, 60.020000 Hz
    1280x1024 px, 60.020000 Hz
    1440x900 px, 60.020000 Hz
    1280x800 px, 60.020000 Hz
    1280x720 px, 60.020000 Hz
    1024x768 px, 60.020000 Hz
    800x600 px, 60.020000 Hz
    640x480 px, 60.020000 Hz
  Position: 1920,0
  Transform: normal
  Scale: 1.000000
  Adaptive Sync: disabled
% waylogout --trace     
2024-11-26 07:58:03 - [main.c:1736] Found config at /home/sergio/.config/waylogout/config
2024-11-26 07:58:03 - [main.c:1641] Config Line #3: font=Warnock Pro
2024-11-26 07:58:03 - [main.c:1641] Config Line #5: symbol-font-size=128
2024-11-26 07:58:03 - [main.c:1641] Config Line #11: indicator-radius=80
2024-11-26 07:58:03 - [main.c:1641] Config Line #13: indicator-separation=1
2024-11-26 07:58:03 - [main.c:1641] Config Line #17: screenshots
2024-11-26 07:58:03 - [main.c:1641] Config Line #18: effect-greyscale
2024-11-26 07:58:03 - [main.c:1641] Config Line #19: effect-blur=1x1
2024-11-26 07:58:03 - [main.c:1641] Config Line #20: effect-pixelate=1
2024-11-26 07:58:03 - [main.c:1641] Config Line #23: inside-color=00000000
2024-11-26 07:58:03 - [main.c:1641] Config Line #24: inside-selection-color=00000000
2024-11-26 07:58:03 - [main.c:1641] Config Line #25: ring-color=00000000
2024-11-26 07:58:03 - [main.c:1641] Config Line #28: ring-selection-color=00000000
2024-11-26 07:58:03 - [main.c:1641] Config Line #31: text-color=aed700
2024-11-26 07:58:03 - [main.c:1641] Config Line #32: text-selection-color=ff0085
2024-11-26 07:58:03 - [main.c:1641] Config Line #35: line-uses-ring
2024-11-26 07:58:03 - [main.c:1641] Config Line #37: hide-cancel
2024-11-26 07:58:03 - [main.c:1641] Config Line #38: poweroff-command='systemctl poweroff'
2024-11-26 07:58:03 - [main.c:1641] Config Line #39: reboot-command='systemctl reboot'
2024-11-26 07:58:03 - [main.c:1641] Config Line #40: suspend-command='systemctl suspend'
2024-11-26 07:58:03 - [main.c:1641] Config Line #42: logout-command='swaymsg exit'
2024-11-26 07:58:03 - [main.c:1746] Parsing CLI Args
2024-11-26 07:58:03 - [action.c:362] Action power off:  
  symbol  
  command systemctl poweroff
  shortcut p
2024-11-26 07:58:03 - [action.c:362] Action reboot:  
  symbol  
  command systemctl reboot
  shortcut r
2024-11-26 07:58:03 - [action.c:362] Action sleep:  
  symbol  
  command systemctl suspend
  shortcut s
2024-11-26 07:58:03 - [action.c:362] Action logout:  
  symbol  
  command swaymsg exit
  shortcut x
2024-11-26 07:58:03 - [action.c:375] Found 0 configured actions
2024-11-26 07:58:03 - [action.c:164] No default action configured
2024-11-26 07:58:03 - [main.c:382]: trace: handle_wl_output_geometry
2024-11-26 07:58:03 - [main.c:398]: trace: handle_wl_output_scale
2024-11-26 07:58:03 - [main.c:586]: trace: handle_wl_output_name
2024-11-26 07:58:03 - [main.c:587] output name is DP-1
2024-11-26 07:58:03 - [main.c:598]: trace: handle_wl_output_done
2024-11-26 07:58:03 - [main.c:382]: trace: handle_wl_output_geometry
2024-11-26 07:58:03 - [main.c:398]: trace: handle_wl_output_scale
2024-11-26 07:58:03 - [main.c:586]: trace: handle_wl_output_name
2024-11-26 07:58:03 - [main.c:587] output name is eDP-1
2024-11-26 07:58:03 - [main.c:598]: trace: handle_wl_output_done
2024-11-26 07:58:03 - [main.c:464]: trace: handle_screencopy_frame_buffer
2024-11-26 07:58:03 - [main.c:464]: trace: handle_screencopy_frame_buffer
2024-11-26 07:58:03 - [main.c:491]: trace: handle_screencopy_frame_flags
2024-11-26 07:58:03 - [main.c:539]: trace: handle_screencopy_frame_ready
2024-11-26 07:58:03 - [main.c:558] Loaded screenshot for output DP-1
2024-11-26 07:58:03 - [main.c:491]: trace: handle_screencopy_frame_flags
2024-11-26 07:58:03 - [main.c:539]: trace: handle_screencopy_frame_ready
2024-11-26 07:58:04 - [main.c:558] Loaded screenshot for output eDP-1
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
2024-11-26 07:58:04 - [main.c:278] Surface for output eDP-1 ready
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
2024-11-26 07:58:04 - [main.c:278] Surface for output DP-1 ready
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
2024-11-26 07:58:04 - [main.c:296]: trace: layer_surface_configure
532910 commented 3 days ago
% waylogout --version         
waylogout version 0fee386 (" __DATE__ ", branch 'mainline')
loserMcloser commented 2 days ago

I believe the man is wrong

No sorry, my bad, I misunderstood the man page (though it could be worded better). Your explanation made more sense --- the command is executed on reload but only if the switch state matches.

Still can't reproduce your issue here. I am testing with the same version of waylogout (0fee386).

Here's what I tried this morning:

  1. Set HandleLidSwitch and HandleLidSwitchExternalPower to ignore in /etc/systemd/logind.conf then reloaded systemd-logind.service.
  2. Added your bindswitch lines to my sway config. Reloaded sway.
  3. Connected TV to HDMI output on my laptop.

But from here I could not find any permutation of the operations of of opening/closing laptop lid, reloading sway, and running waylogout that caused unexpected behaviour (though sometimes there was a slight delay between when waylogout showed up on my laptop screen and when it showed up on my TV, when both outputs were enabled).

(I verified using swaymsg -t get_outputs that the laptop display was in fact disabled when the lid was closed, and re-confirmed after each reload of sway.)

Ignoring the bindswitch configuration for the moment, is there some specific order/combination of the following commands run from a terminal that causes the issue for you?

> swaymsg output eDP-1 enable/disable
> swaymsg reload
> waylogout
532910 commented 2 days ago

Sorry for confusing you with reload, lid and bindings, forgot about all of this, it doesn't work just from the start.

~/.config/sway/config:

bindsym --to-code Mod1+Escape      exec tilix
bindsym --to-code Mod1+Ctrl+Delete exec waylogout
% apt policy sway 
sway:
  Installed: 1.10-1
  Candidate: 1.10-1
  Version table:
 *** 1.10-1 200
        200 https://deb.debian.org/debian experimental/main amd64 Packages
        100 /var/lib/dpkg/status
     1.9-2 600
        600 https://deb.debian.org/debian sid/main amd64 Packages
% wlr-randr 
DP-2 "Stargate Technology HS156KC demoset-1 (DP-2)"
  Make: Stargate Technology
  Model: HS156KC
  Serial: demoset-1
  Physical size: 300x260 mm
  Enabled: yes
  Modes:
    3840x2160 px, 59.981998 Hz (preferred, current)
    3840x2160 px, 50.000000 Hz
    3840x2160 px, 30.000000 Hz
    3840x2160 px, 29.969999 Hz
    3840x2160 px, 25.000000 Hz
    3840x2160 px, 24.000000 Hz
    3840x2160 px, 23.976000 Hz
    1920x1200 px, 59.981998 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 50.000000 Hz
    1920x1080 px, 30.000000 Hz
    1920x1080 px, 29.969999 Hz
    1920x1080 px, 25.000000 Hz
    1920x1080 px, 24.000000 Hz
    1920x1080 px, 23.976000 Hz
    1600x1200 px, 59.981998 Hz
    1680x1050 px, 59.981998 Hz
    1400x1050 px, 59.978001 Hz
    1280x1024 px, 60.020000 Hz
    1440x900 px, 59.887001 Hz
    1280x960 px, 60.000000 Hz
    1280x800 px, 59.981998 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 59.939999 Hz
    1280x720 px, 50.000000 Hz
    1280x720 px, 30.000000 Hz
    1280x720 px, 29.969999 Hz
    1280x720 px, 25.000000 Hz
    1280x720 px, 24.000000 Hz
    1280x720 px, 23.976000 Hz
    1024x768 px, 60.004002 Hz
    800x600 px, 60.317001 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 59.939999 Hz
    720x480 px, 59.939999 Hz
    640x480 px, 60.000000 Hz
    640x480 px, 59.939999 Hz
    640x480 px, 59.939999 Hz
  Position: 0,0
  Transform: normal
  Scale: 2.000000
  Adaptive Sync: disabled
eDP-1 "LG Display 0x0608 (eDP-1)"
  Make: LG Display
  Model: 0x0608
  Serial: (null)
  Physical size: 310x170 mm
  Enabled: yes
  Modes:
    1920x1080 px, 60.020000 Hz (preferred, current)
    1920x1080 px, 47.999001 Hz
    1680x1050 px, 60.020000 Hz
    1280x1024 px, 60.020000 Hz
    1440x900 px, 60.020000 Hz
    1280x800 px, 60.020000 Hz
    1280x720 px, 60.020000 Hz
    1024x768 px, 60.020000 Hz
    800x600 px, 60.020000 Hz
    640x480 px, 60.020000 Hz
  Position: 1920,0
  Transform: normal
  Scale: 1.000000
  Adaptive Sync: disabled

image

Effects are applied to the both monitors.