swaywm / sway

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

Firefox does not receive mouse clicks on external screen #3936

Closed ahilsend closed 5 years ago

ahilsend commented 5 years ago

set $mod Mod4 set $term termite set $bg_img /home/ahilsendeger/Pictures/wallpaper-mountain.jpg

font pango:Noto Sans Mono 11

workspace_auto_back_and_forth yes

floating_modifier $mod

start a terminal

bindsym $mod+Return exec $term

kill focused window

bindsym $mod+Shift+semicolon kill

start dmenu (a program launcher)

bindsym $mod+e exec ~/bin/dmenu.sh bindsym $mod+f2 exec ~/bin/dmenu.sh web bindsym $mod+f3 exec ~/bin/dmenu.sh search bindsym $mod+a exec ~/bin/aws-console bindsym $mod+f1 exec --no-startup-id j4-dmenu-desktop

Screenshots

bindsym $mod+print exec file=$HOME/Desktop/screenshot$(date +'%Y-%m-%dT%H:%M:%S').jpg && grim -t jpeg "$file" && imv "$file" bindsym $mod+Shift+print exec file=$HOME/Desktop/screenshot$(date +'%Y-%m-%dT%H:%M:%S').jpg && grim -t jpeg -g "$(slurp)" "$file" && imv "$file"

change focus

bindsym $mod+h focus left bindsym $mod+t focus down bindsym $mod+n focus up bindsym $mod+s focus right

alternatively, you can use the cursor keys:

bindsym $mod+Left focus left bindsym $mod+Down focus down bindsym $mod+Up focus up bindsym $mod+Right focus right

move focused window3

bindsym $mod+Shift+H move left bindsym $mod+Shift+T move down bindsym $mod+Shift+N move up bindsym $mod+Shift+S move right

alternatively, you can use the cursor 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

split in horizontal orientation

bindsym $mod+d split h

split in vertical orientation

bindsym $mod+k split v

enter fullscreen mode for the focused container

bindsym $mod+u fullscreen toggle

change container layout (stacked, tabbed, toggle split)

bindsym $mod+o layout stacking bindsym $mod+comma layout tabbed bindsym $mod+period layout toggle split

toggle tiling / floating

bindsym $mod+Shift+space floating toggle

change focus between tiling / floating windows

bindsym $mod+space focus mode_toggle

focus the parent container

bindsym $mod+a focus parent

focus the child container

bindsym $mod+d focus child

Define names for default workspaces for which we configure key bindings later on.

We use variables to avoid repeating the names in multiple places.

set $ws1 "1" set $ws2 "2" set $ws3 "3" set $ws4 "4" set $ws5 "5" set $ws6 "6" set $ws7 "7" set $ws8 "8" set $ws9 "9" set $ws10 "10"

switch to workspace

bindsym $mod+ampersand workspace $ws1 bindsym $mod+bracketleft workspace $ws2 bindsym $mod+braceleft workspace $ws3 bindsym $mod+braceright workspace $ws4 bindsym $mod+parenleft workspace $ws5 bindsym $mod+equal workspace $ws6 bindsym $mod+asterisk workspace $ws7 bindsym $mod+parenright workspace $ws8 bindsym $mod+plus workspace $ws9 bindsym $mod+bracketright workspace $ws10

move focused container to workspace

bindsym $mod+Shift+ampersand move container to workspace $ws1 bindsym $mod+Shift+bracketleft move container to workspace $ws2 bindsym $mod+Shift+braceleft move container to workspace $ws3 bindsym $mod+Shift+braceright move container to workspace $ws4 bindsym $mod+Shift+parenleft move container to workspace $ws5 bindsym $mod+Shift+equal move container to workspace $ws6 bindsym $mod+Shift+asterisk move container to workspace $ws7 bindsym $mod+Shift+parenright move container to workspace $ws8 bindsym $mod+Shift+plus move container to workspace $ws9 bindsym $mod+Shift+bracketright move container to workspace $ws10

bindsym $mod+Control+Left move workspace to output left bindsym $mod+Control+Down move workspace to output down bindsym $mod+Control+Up move workspace to output up bindsym $mod+Control+Right move workspace to output right

reload the configuration file

bindsym $mod+Shift+J reload

restart i3 inplace (preserves your layout/session, can be used to upgrade i3)

bindsym $mod+Shift+P restart

resize window (you can also use the mouse for that)

mode "resize" { bindsym h resize shrink width 10 px or 10 ppt bindsym t resize grow height 10 px or 10 ppt bindsym n resize shrink height 10 px or 10 ppt bindsym s resize grow width 10 px or 10 ppt

# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt

# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+p mode "default"

}

bindsym $mod+p mode "resize"

session management

set $session Session: lock Logout Reboot Halt hibernate suspend mode --pango_markup "$session" { bindsym Shift+R exec --no-startup-id systemctl reboot bindsym Shift+h exec --no-startup-id systemctl poweroff bindsym h exec --no-startup-id systemctl hibernate; mode "default" bindsym s exec --no-startup-id systemctl hybrid-sleep; mode "default" bindsym l exec --no-startup-id swaylock -i $bg_img --scaling fill --ring-color 859900 --inside-wrong-color d33682 ; mode "default" bindsym Shift+l exit

bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+p mode "default"

} bindsym $mod+f12 mode "$session"

Volume

bindsym XF86AudioRaiseVolume exec pactl set-sink-volume $(pacmd list-sinks |awk '/ index:/{print $3}') +5% bindsym XF86AudioLowerVolume exec pactl set-sink-volume $(pacmd list-sinks |awk '/ index:/{print $3}') -5% bindsym XF86AudioMute exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle

Mute mic

bindsym XF86AudioMicMute exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle

Brightness

bindsym XF86MonBrightnessDown exec brightnessctl set 5%- bindsym XF86MonBrightnessUp exec brightnessctl set +5% bindsym XF86Tools exec env XDG_CURRENT_DESKTOP=GNOME gnome-control-center

colors

client.focused #859900 #859900 #fdf6e3 #6c71c4 #859900 client.focused_inactive #073642 #073642 #eee8d5 #6c71c4 #073642 client.unfocused #073642 #073642 #93a1a1 #586e75 #073642 client.urgent #d33682 #d33682 #fdf6e3 #dc322f #d33682

status bar

bar { position top status_command i3status colors { separator #dc322f background #002b36 statusline #268bd2 focused_workspace #fdf6e3 #859900 #fdf6e3 active_workspace #fdf6e3 #6c71c4 #fdf6e3 inactive_workspace #586e75 #93a1a1 #002b36 urgent_workspace #d33682 #d33682 #fdf6e3 } }

Assign windows to workspaces

assign [class="^Firefox$"] → $ws1 assign [class="^jetbrains-idea$"] → $ws3 assign [class="^jetbrains-goland$"] → $ws3 assign [class="^Slack$"] → $ws8 assign [class="^TelegramDesktop$"] → $ws9 assign [class="^Signal$"] → $ws9 assign [class="^Emacs$"] → $ws10

Assign workspaces to screens

workspace $ws1 output DP-3 workspace $ws2 output DP-3 workspace $ws3 output DP-4 workspace $ws8 output eDP-1 workspace $ws9 output eDP-1 workspace $ws10 output DP-4

Exec

exec swayidle -w timeout 300 "swaylock -i $bg_img --scaling fill --ring-color 859900 --inside-wrong-color d33682" before-sleep "swaylock -i $bg_img --scaling fill --ring-color 859900 --inside-wrong-color d33682"

Inputs

input "*" {

generic keyboard

xkb_layout "us,de,se" xkb_variant "dvp,," xkb_options "ctrl:nocaps,terminate:ctrl_alt_bksp,grp:ctrls_toggle"

generic mouse

accel_profile flat pointer_accel 0.3 }

input "1739:0:Synaptics_TM3288-011" { tap enabled tap_button_map lrm click_method clickfinger natural_scroll enabled }

input "4176:278:Yubico_Yubikey_NEO_OTP+U2F+" { xkb_layout us xkb_variant "" }

Outputs

output "*" background $bg_img fill

laptop

output "eDP-1" position 0 0

left screen

output "DP-3" position -1280 -1440

transform 90

right screen

output "DP-4" position 1280 -1440



I'm running with two external screens. The first one is connected via USB-C => DisplayPort, the second with Mini DisplayPort from the first.

Sometimes Xwayland applications like Firefox, Emacs, Goland do not receive mouse clicks on the external screens. But they do on the laptop screen.

Disconnecting the DP cable from the monitor sometimes helps, but not always.

Not sure actually if this is a sway / wayland issue, or something else.
Let me know if I can provide any more information!

Oh, and love the work you do on sway, really love it! :heart: 
ahilsend commented 5 years ago

I have tried changing the screen positions, and found a setting that does not have this issue. If the screens are lined up in one row in that order: eDP-1, DP-3, DP-4 then Firefox receives mous clicks.

Changing to moving the screens above the laptop screen does not work, and changing the order within one row does not work either.

emersion commented 5 years ago

Negative positions don't work with Xwayland. This is an Xwayland bug.

nidico commented 4 years ago

I have had the same issue with all xwayland programs on an external HDMI screen, removing negative screen positions solved the issue.

I haven't found (or created) an issue in the xwayland freedesktop tracker regarding negative positions.

emersion commented 4 years ago

https://gitlab.freedesktop.org/xorg/xserver/issues/899

jmriddell commented 2 years ago

I found a workaround for this, just move the 0 position to the top-left most monitor.

For instance, my original intended configuration was:

output eDP-1 resolution 1920x1080
output eDP-1 pos 0 0
output HDMI-A-2 resolution 1366x768
output HDMI-A-2 pos 0 -768

And became:

output eDP-1 resolution 1920x1080
output eDP-1 pos 0 768
output HDMI-A-2 resolution 1366x768
output HDMI-A-2 pos 0 0

A suggestion I have is to make sway do this conversion internally, I don't know if there is another implication for screen position else than the relative position to each other, if not I think this could be quite reasonable

OlivierNicole commented 2 years ago

Another possibility would be to print an error in case of negative positions. I had the same issue and found it quite puzzling.

jmriddell commented 2 years ago

Another possibility would be to print an error in case of negative positions. I had the same issue and found it quite puzzling.

Or maybe a warning

tjkopena commented 1 year ago

Piling on to say that I'd had this problem for a long time w/ Chrome but not Firefox. I had attributed it to something about Chrome's Wayland implementation. Recently though after an update Firefox started exhibiting the same behavior: The program was active, responded to keystrokes and so on, but only responded incorrectly or not at all to mouse actions if not on the primary display. Refactoring my sway config to remove negative output positions has fixed the problem in both Chrome and Firefox.