/xpointerbarrier

[Forked] Pointer barriers for dual monitor support

Primary LanguageCMIT LicenseMIT

                    _       _            _                     _
  __  ___ __   ___ (_)_ __ | |_ ___ _ __| |__   __ _ _ __ _ __(_) ___ _ __
  \ \/ / '_ \ / _ \| | '_ \| __/ _ \ '__| '_ \ / _` | '__| '__| |/ _ \ '__|
   >  <| |_) | (_) | | | | | ||  __/ |  | |_) | (_| | |  | |  | |  __/ |
  /_/\_\ .__/ \___/|_|_| |_|\__\___|_|  |_.__/ \__,_|_|  |_|  |_|\___|_|
       |_|
  https://uninformativ.de/git/xpointerbarrier
  https://uninformativ.de/bugs.html

  Forked from https://uninformativ.de/git/xpointerbarrier.git

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


This program creates four pointer barriers around each XRandR screen,
thus effectively jailing your mouse pointer to one physical screen.

Pointer barriers are mostly useful when there is more than one physical
screen connected to your computer. Properly placed barriers can then
make you feel like you're sitting in front of only one screen: When you
throw your mouse in the upper right corner, it does not suddenly switch
to another monitor.

See also:

http://who-t.blogspot.de/2012/12/whats-new-in-xi-23-pointer-barrier.html


Installation
------------

The following C libraries are required:

    - libx11
    - libxfixes
    - libxrandr

The XFIXES extension must be available on your X server.

xpointerbarrier was written on GNU (Arch Linux). No portability tests
are run by the author, but the code tries to stick to POSIX and will
probably work on other systems as well.

To build the program and install it to /usr/local:

    $ make
    # make install

Running
-------

Simply run the program in your ~/.xinitrc:

    $ xpointerbarrier 47 7 7 27

It's probably best to first configure your screens, then run the
program.

Toggling
--------

You can toggle the pointer barriers on and off by sending the program
SIGUSR1:

    $ killall -USR1 xpointerbarrier

Sample config for i3
--------------------

    # See https://i3wm.org/docs/userguide.html#mouse_warping
    mouse_warping none

    # for toggling pointer barriers on and off while pressing 'Menu'
    bindsym Menu exec --no-startup-id killall -USR1 xpointerbarrier
    bindsym --release Menu exec --no-startup-id killall -USR1 xpointerbarrier

    exec --no-startup-id xpointerbarrier 0 0 0 0