Skip to content

Instantly share code, notes, and snippets.

@shiona
Last active March 25, 2025 22:49
Show Gist options
  • Select an option

  • Save shiona/bb7c67b9a675d97fd3b8cf590f190021 to your computer and use it in GitHub Desktop.

Select an option

Save shiona/bb7c67b9a675d97fd3b8cf590f190021 to your computer and use it in GitHub Desktop.
swaywm mouse capture
# This file is supposed to be a part of swaywm config file (.config/sway/config)
# The format for both lines is:
# bindsym [key combo] exec swaymsg 'input "[mouse identifier from 'swaymsg -t get_inputs']" map_to_output "[monitor from swaymsg -t get_outputs OR * to uncapture"'
bindsym $mod+x exec swaymsg 'input "1133:49970:Logitech_Gaming_Mouse_G502" map_to_output "*"'
bindsym $mod+c exec swaymsg 'input "1133:49970:Logitech_Gaming_Mouse_G502" map_to_output "DP-1"'
# of course you can just run the capture/free from a script and not bother with the key bindings, in that case start from "swaymsg", like:
# swaymsg 'input "1133:49970:Logitech_Gaming_Mouse_G502" map_to_output "DP-1"'
@shiona
Copy link
Author

shiona commented Mar 25, 2025

Since arma3 on sway doesn't seem to capture mouse even if it's set to full screen, this helps. I guess this might be helpful for other people as well to make sure the mouse does not leave the game to a neighboring monitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment