Skip to content

midscroll v1.13

Latest

Choose a tag to compare

@gnhen gnhen released this 27 Jul 05:36

Choose which devices count as a mouse

midscroll picks up ordinary mice on its own. When it gets one wrong, you can now
correct it. The settings GUI lists your input devices with a switch each, so you
can add something it didn't recognise (a trackball, a receiver's second
interface, an odd HID collection) or tell it to leave one of your mice alone.

The same control is in the config file and on the command line:

EXTRA_DEVICES = /dev/input/by-id/usb-Kensington_Expert-event-mouse
IGNORE_DEVICES = 046d:c548

Each entry is a /dev/input path (the by-id and by-path links are the ones
that survive a reboot), a hex vendor:product, or part of the device name.
IGNORE_DEVICES wins over EXTRA_DEVICES. To see every device with its
identifier and what midscroll does with it:

sudo midscroll --list-devices

Per run, --extra-device SPEC and --ignore-device SPEC do the same and are
repeatable.

Keyboards are refused even when you list one, because that would have a root
daemon reading every key on them, and they would lose key repeat and their LEDs
passing through the virtual mirror. Turning that off takes a root edit of
/etc/midscroll.conf (ALLOW_KEYBOARDS = true); the settings GUI deliberately
cannot do it.

A ghost cursor while you drag

The badge now stays locked at the point where you pressed, and a ghost cursor
follows your hand from there, the way Windows autoscroll looks. The ghost is a
copy of your own pointer, read from your cursor theme at the size the compositor
would use, drawn at 85% opacity so you can tell the two apart.

The real pointer stays pinned, which is what keeps the scroll locked to the
window you started in: the ghost only draws, and cannot click, hover or focus
anything. GHOST_CURSOR turns it off and GHOST_SCALE changes how far it
travels per unit of mouse motion.

This is drawn on KDE Plasma Wayland only, as the badge always has been.
Scrolling itself works everywhere, on Wayland and X11 alike.

Security

The config file now decides which devices a root daemon opens, and the state
socket now carries cursor motion, so both got tightened:

  • the config is only read when root owns it and nobody else can write it, and
    that includes --config, so a user-writable file cannot steer the daemon
  • midscroll's own virtual devices and keyboard-class devices are refused before
    the device lists are consulted, so no config entry can reach either
  • device specs are bounded and never opened, only compared against devices the
    daemon already found, and at most 16 devices are grabbed at once
  • the state socket caps clients (16 overall, 4 per user), bounds what it reads,
    drops clients that stop reading, and sends cursor offsets only to the session
    currently in front of the screen
  • the full-screen overlay re-applies its click-through region every time it is
    shown and again every second, and takes itself down if the daemon goes quiet
  • the daemon now runs with no capabilities at all, and gained ProtectProc,
    ProcSubset, ProtectKernelModules, IPAddressDeny, UMask, MemoryMax
    and TasksMax. Its systemd-analyze security exposure went from 4.1 to 1.3
  • every Apply in the settings GUI authenticates, instead of reusing a cached
    authorization for five minutes, and inactive sessions are refused

The new SECURITY.md documents what each part trusts and why, so you can check
the claims against the code rather than take them on faith.

Upgrading

If you remove and reinstall the package rather than upgrading in place, the
session helper stays stopped, and you get no badge and no ghost cursor until it
runs again:

systemctl --user daemon-reload
systemctl --user restart midscroll-overlay

Logging out and back in does the same thing. /etc/midscroll.conf is kept as it
is; the new keys fall back to their defaults until you set them.