Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard not responding in swaylock #6131

Closed
mmojzis opened this issue Mar 23, 2021 · 22 comments
Closed

Keyboard not responding in swaylock #6131

mmojzis opened this issue Mar 23, 2021 · 22 comments
Labels
bug Not working as intended

Comments

@mmojzis
Copy link

mmojzis commented Mar 23, 2021

Hello,
I just updated after one month sway and I got one issue there:
After running swaylock - even from command line and not only after sleep I am not able to type password. It doesn'ŧ respond to any key. It worked before the update. I cannot go to "stable" version of sway because there were some issues in multi-monitor setup.

sway version 1.6-rc1-03daa53a (Mar 22 2021, branch 'master')
sway config:

 # Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
#xwayland disable

### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l

# Your preferred terminal emulator
set $term gnome-terminal

# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $menu wofi | xargs swaymsg exec --

set $ssh $HOME/.config/sway/scripts/wofi-scripts/ssh.py gnome-terminal | xargs swaymsg exec --

set $swaylock swaylock -c 000000 -k -l --indicator-idle-visible

### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill

output eDP-1 scale 2 pos 1920 0 res 3840x2160

output "Dell Inc. DELL P2417H CW6Y765N4TUL" scale 1 pos 3840 0 res 1920x1080
output "Philips Consumer Electronics Company PHL 240V5 UK01730037080" scale 1 pos 0 0 res 1920x1080


#output "Unknown Q3279WG5B 0x0000AB50" scale 1 pos 3840 0 mode 2560x1440
output "Unknown Q3279WG5B 0x0000AB50" res 1920x1080
#output DP-1 scale 1 pos 3840 0 res 5120x1440
#
# Example configuration:
#
#   output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs

### Notifications
exec mako --background-color=#4c7899 --text-color=#ffffff

## Apps
exec slack
exec thunderbird
exec nm-applet --indicator

# GTK issue fix

#exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
#exec hash dbus-update-activation-environment 2>/dev/null && \
#     dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

### Idle configuration
#
# Example configuration:
#
exec swayidle -w \
          timeout 1800 '$swaylock -f -c 000000' \
          timeout 1800 'swaymsg "output * dpms off"' \
               resume 'swaymsg "output * dpms on"' \
          before-sleep '$swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.

### Input configuration
#
# Example configuration:
#
input "1739:31251:SYNA2393:00_06CB:7A13_Touchpad" {
  dwt enabled
  tap enabled
  natural_scroll disabled
  middle_emulation enabled
  tap_button_map lrm
  click_method clickfinger
  events disabled_on_external_mouse
}

input type:keyboard {
  xkb_layout cz,us
  xkb_variant qwerty,
  xkb_options grp:lalt_lshift_toggle
  xkb_numlock enabled
}  

#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.

### Key bindings
#
# Basics:
#
    # Start a terminal
    bindsym $mod+Return exec $term

    # Kill focused window
    bindsym $mod+Shift+q kill

    # Start your launcher
    bindsym $mod+d exec $menu

    # Start ssh launcher
    bindsym $mod+s exec $ssh

    # Drag floating windows by holding down $mod and left mouse button.
    # Resize them with right mouse button + $mod.
    # Despite the name, also works for non-floating windows.
    # Change normal to inverse to use left mouse button for resizing and right
    # mouse button for dragging.
    floating_modifier $mod normal

    # Reload the configuration file
    bindsym $mod+Shift+c reload
    
    # Exit sway (logs you out of your Wayland session)
    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'

    # Sound
#    bindsym XF86AudioMute exec 'pactl set-sink-mute 1 toggle && pactl set-sink-mute 0 toggle'
    bindsym XF86AudioMute exec 'pactl set-sink-mute 1 toggle && pactl set-sink-mute 0 toggle'
    bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume 1 -5% && pactl set-sink-mute 1 0 && pactl set-sink-mute 0 0'
    bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume 1 +5% && pactl set-sink-mute 1 0 && pactl set-sink-mute 0 0'
   
    # Microphone
    bindsym $mod+F1 exec 'pactl set-source-mute 1 toggle && pactl set-source-mute 0 toggle'
    bindsym $mod+F2 exec 'pactl set-source-volume 1 -5% && pactl set-source-mute 0 0'
    bindsym $mod+F3 exec 'pactl set-source-volume 1 +5% && pactl set-source-mute 0 0'

    # Lockscreen
    bindsym $mod+Ctrl+l exec $swaylock

    # Brightness
    bindsym XF86MonBrightnessDown exec $HOME/.config/sway/scripts/brightness.py down
    bindsym XF86MonBrightnessUp exec $HOME/.config/sway/scripts/brightness.py up
#
# Moving around:
#
    # Move your focus around
    bindsym $mod+$left focus left
    bindsym $mod+$down focus down
    bindsym $mod+$up focus up
    bindsym $mod+$right focus right
    # Or use $mod+[up|down|left|right]
    bindsym $mod+Left focus left
    bindsym $mod+Down focus down
    bindsym $mod+Up focus up
    bindsym $mod+Right focus right

    # Move the focused window with the same, but add Shift
    bindsym $mod+Shift+$left move left
    bindsym $mod+Shift+$down move down
    bindsym $mod+Shift+$up move up
    bindsym $mod+Shift+$right move right
    # Ditto, with arrow keys
    bindsym $mod+Shift+Left move left
    bindsym $mod+Shift+Down move down
    bindsym $mod+Shift+Up move up
    bindsym $mod+Shift+Right move right
#
# Workspaces:
#
    # focus workspace for notifications
    for_window [urgent="latest"] focus
    
    workspace 3 output "Philips Consumer Electronics Company PHL 240V5 UK01730037080"
    workspace 4 output "Dell Inc. DELL P2417H CW6Y765N4TUL"

    # Switch to workspace
    bindsym --to-code {
      $mod+plus workspace 1
      $mod+ecaron workspace 2
      $mod+scaron workspace 3
      $mod+ccaron workspace 4
      $mod+rcaron workspace 5
      $mod+zcaron workspace 6
      $mod+yacute workspace 7
      $mod+aacute workspace 8
      $mod+iacute workspace 9
      $mod+eacute workspace 10
    }
    # Move focused container to workspace
    bindsym --to-code {
      $mod+Shift+plus move container to workspace 1
      $mod+Shift+ecaron move container to workspace 2
      $mod+Shift+scaron move container to workspace 3
      $mod+Shift+ccaron move container to workspace 4
      $mod+Shift+rcaron move container to workspace 5
      $mod+Shift+zcaron move container to workspace 6
      $mod+Shift+yacute move container to workspace 7
      $mod+Shift+aacute move container to workspace 8
      $mod+Shift+iacute move container to workspace 9
      $mod+Shift+eacute move container to workspace 10
    }
    # Note: workspaces can have any name you want, not just numbers.
    # We just use 1-10 as the default.
#
# Layout stuff:
#
    # You can "split" the current object of your focus with
    # $mod+b or $mod+v, for horizontal and vertical splits
    # respectively.
    bindsym $mod+b splith
    bindsym $mod+v splitv

    # Switch the current container between different layout styles
    #bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout toggle split

    # Make the current focus fullscreen
    bindsym $mod+f fullscreen

    # Toggle the current focus between tiling and floating mode
    bindsym $mod+Shift+space floating toggle

    # Swap focus between the tiling area and the floating area
    bindsym $mod+space focus mode_toggle

    # Move focus to the parent container
    bindsym $mod+a focus parent
#
# Scratchpad:
#
    # Sway has a "scratchpad", which is a bag of holding for windows.
    # You can send windows there and get them back later.

    # Move the currently focused window to the scratchpad
    bindsym $mod+Shift+minus move scratchpad

    # Show the next scratchpad window or hide the focused scratchpad window.
    # If there are multiple scratchpad windows, this command cycles through them.
    bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
    # left will shrink the containers width
    # right will grow the containers width
    # up will shrink the containers height
    # down will grow the containers height
    bindsym $left resize shrink width 10px
    bindsym $down resize grow height 10px
    bindsym $up resize shrink height 10px
    bindsym $right resize grow width 10px

    # Ditto, with arrow keys
    bindsym Left resize shrink width 10px
    bindsym Down resize grow height 10px
    bindsym Up resize shrink height 10px
    bindsym Right resize grow width 10px

    # Return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
    position top
    height 24    
    # When the status_command prints a new line to stdout, swaybar updates.
    # The default just shows the current date and time.
    status_command $HOME/.config/sway/scripts/swaybar.py

    colors {
        statusline #ffffff
        background #000000
        inactive_workspace #32323200 #32323200 #5c5c5c
    }
}

include /etc/sway/config.d/*
@mmojzis mmojzis added the bug Not working as intended label Mar 23, 2021
@emersion
Copy link
Member

Your bug report is missing debug logs. Please add a link to the full debug log file.

@mmojzis
Copy link
Author

mmojzis commented Mar 25, 2021

Yes, I am not collecting logs for now, but will try to gather some tomorrow.
Actually the problem is that swaylock is just not showing that I typed something on keyboard.
And when I connect some other monitors on these external monitors is swaylock working correctly.

@alanorth
Copy link

I think I have the same issue. I'm running sway-git on Arch Linux to get around the subsurface "menu flickering" issue in Firefox 87.0 and I find that I can't unlock the screen on swaylock-git. Versions:

  • sway version 1.6-rc2-1d62d6bf (Mar 27 2021, branch 'master')
  • swaylock version 1.5-12-g9d3da72 (Mar 27 2021, branch 'master')
  • wlroots-git 0.12.0.r394.gb89bcffe-1

I captured a debug log while starting sway and immediately executing swaylock from a terminal. After pressing the delete key I get the "cleared" dialog once, then never again and then I am unable to unlock the screen, having to press the power button to initiate ACPI shut down. Log:

sway.log

Let me know if there is any other information I can provide.

@kennylevinsen
Copy link
Member

When it happens, switch to a TTY and check if there is more than one swaylock instance running.

@alanorth
Copy link

When it happens, switch to a TTY and check if there is more than one swaylock instance running.

Yes there seem to be two:

$ ps auxw | grep swaylock
aorth     224419  0.0  0.1  36116 26644 pts/3    SL+  15:43   0:00 swaylock
aorth     224420  0.0  0.0  24936  6200 pts/3    S+   15:43   0:00 swaylock
aorth     224771  0.0  0.0   6404  2460 tty4     S+   15:43   0:00 grep swaylock

I had to killall swaylock from the TTY in order to be able to use Sway without rebooting.

@kennylevinsen
Copy link
Member

In that case I imagine the issue is not lack of responsiveness, but that you are interacting with the "lower" swaylock instance (layer-shell clients like swaylock do not abide by normal focus rules), giving the appearance of unresponsiveness.

@alanorth
Copy link

alanorth commented Apr 2, 2021

@kennylevinsen So this seems to be an issue in wlroots/sway. I had been using swaylock-git because I was on sway-git and wlroots-git, but it behaves the same way with swaylock 1.5. I'm surprised nobody else is has reported this...?

@cyberhuman
Copy link
Contributor

I think I have a similar issue from time to time (I have to type the password several times before it is accepted), but I never checked the number of processes running. Will try to see the next time.

@alanorth
Copy link

alanorth commented Apr 5, 2021

@cyberhuman are you using sway 1.5? This only happens to me on recent sway-git versions (for example, current sway 1.6rc). I'm currently using sway 1.5 again so I don't have this bug.

@cyberhuman
Copy link
Contributor

I have a custom version built from master on Dec 24 with patches so I don't really know 😅

@alanorth
Copy link

Sway 1.6 just entered Arch Linux today so now I have this problem again. Swaylock 1.5 seems to start two instances, as @kennylevinsen noticed. Only way to unlock the screen is to switch to a TTY and killall swaylock.

Is the correct place to report this in sway, wlroots, or swaylock? Thanks!

@alanorth
Copy link

I just tried sway 1.6, wlroots 0.13, and swaylock 1.5 again and everything is working. I don't know what changed. Here are my versions on Arch:

# pacman -Qs sway
local/sway 1:1.6-1
    Tiling Wayland compositor and replacement for the i3 window manager
local/swaybg 1.0-4
    Wallpaper tool for Wayland compositors
local/swayidle 1.6-1
    Idle management daemon for Wayland
local/swaylock 1.5-1
    Screen locker for Wayland

@schauveau
Copy link

This is probably irrelevant but I noticed the following lines in your config:

  # focus workspace for notifications
  for_window [urgent="latest"] focus

Could it be that swaylock lost the focus when a notification occurs?

@languitar
Copy link

Experiencing the same issue with the same line. I have removed that one from my config temporarily. Let's see whether this helps,

@languitar
Copy link

That was not the cause here.

@eqn-group
Copy link

The problem is in Swaylock on lid close (sleep) with Nvidia drivers running on wayland.
I uninstall nvidia, nvidia-dkms, nvidia-gtklibs, nvidia-libs and problem solved.

It doesnt happen when you manually invoke "swaylock -f" but when you close lid and open it back, mouse, keyboard wont response, also it wont allow to go to tty.

@zachsmith
Copy link

I am having the same issues intermittently but I am not using any NVIDIA drivers or hardware.

Occasionally, after closing and re-opening the lid, I am greeted with the swaylock background image I've configured but no input is allowed. I can see the mouse cursor but it won't move, typing does not appear to register, and I am unable to switch tty's for additional investigation. The only way out is to force reboot the system.

exec swayidle -w \
         timeout 300 'swaylock -f -c 000000' \
         timeout 600 'swaymsg "output * dpms off"' \
         resume 'swaymsg "output * dpms on"' \
         before-sleep '~/.config/sway/bin/before-sleep.sh'

My before-sleep.sh script simply pauses players and runs swaylockbut I've experienced the exact same behavior simply running swaylock directly via swayidle without the script and without the playerctl call:

#!/usr/bin/env bash

playerctl -a pause
swaylock -f -c 000000 -i ~/Pictures/Wallpapers/owl-lock.png

Arch
sway 1.7

@mindrunner
Copy link

I can see the mouse cursor

That's usually a sign that something is going wrong. There shouldn't be any cursor on lock screen imho.

The only way out is to force reboot the system.

You could switch to a tty and kill swaylock / swayidle to gain access to your session I guess

@StevenPine
Copy link

I am experiencing this issue as well, two monitors connected to a desktop. The issue is intermittent which suggests a race condition to me. But sometimes after swaylock, my system goes unresponsive, monitors see no input, and I can't unlock system. I will try to gather debug logs.

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

@StevenPine
Copy link

boot to boot session logs with sway debug. I removed some nginx entries from the journalctl output. Let me know if I can provide any other information and thank you for any assistance.
sway version 1.8.1
swaydebug_logs.txt

@StevenPine
Copy link

any advice? this continues to occur and is making sway nearly unusable.

@kennylevinsen
Copy link
Member

@StevenPine please don't hijack unrelated issues. Your log does not appear to contain any issues. You can ask in the IRC channel for further assistance.

The original issue reported here should be solved by the session lock protocol, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests