Ubuntu Mintでも MagicMouse1
は普通のBluetoothマウスとして利用することができます。MagicTrackも使えるようになってきてるみたいです。(https://github.com/robotrovsky/Linux-Magic-Trackpad-2-Driver ) スワイプにはまだ対応ができてないです。
MagicMouseの認識(hid_magicmouse )
Bluetoothの認識をします。(最初何故かどうしても接続したあとにすぐに切断を繰り返していたのですが治りました) きちんと認識出ているとこのようにモジュールがロードされていることがわかります。
❯❯❯ lsmod | grep hid_magicmouse
hid_magicmouse 16384 0
hid 118784 5 i2c_hid,hid_elecom,hidp,hid_multitouch,hid_magicmouse
以下のように設定するとスクロール速度を変えることができます。
sudo rmmod hid_magicmouse
sudo modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=30
永続的に実施する場合には
options hid_magicmouse scroll_acceleration=1 scroll_speed=40
Mouseの設定
マウスの詳細のパラメータを変更するためには xinput を利用することで変更することができます。もしかしたら利用ているディストリビューションによってはGUIで変更できるかもしれません。
デバイス番号の取得
❯❯❯ xinput --list --short
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ELAN2301:00 04F3:306B Touchpad id=11 [slave pointer (2)]
⎜ ↳ atgのマウス id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Video Bus id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ XiaoMi USB 2.0 Webcam: XiaoMi U id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
↳ HP Wireless hotkeys id=13 [slave keyboard (3)]
↳ Dell AIO WMI hotkeys id=14 [slave keyboard (3)]
マウスがわかれば設定を取得できます。
❯❯❯ xinput --list-props "atgのマウス"
Device 'atgのマウス':
Device Enabled (142): 1
Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (285): 1
libinput Natural Scrolling Enabled Default (286): 0
libinput Scroll Methods Available (289): 0, 0, 1
libinput Scroll Method Enabled (290): 0, 0, 0
libinput Scroll Method Enabled Default (291): 0, 0, 0
libinput Button Scrolling Button (606): 2
libinput Button Scrolling Button Default (607): 2
libinput Middle Emulation Enabled (295): 1
libinput Middle Emulation Enabled Default (296): 0
libinput Accel Speed (297): 0.444414
libinput Accel Speed Default (298): 0.000000
libinput Accel Profiles Available (608): 1, 1
libinput Accel Profile Enabled (609): 1, 0
libinput Accel Profile Enabled Default (610): 1, 0
libinput Left Handed Enabled (299): 0
libinput Left Handed Enabled Default (300): 0
libinput Send Events Modes Available (262): 1, 0
libinput Send Events Mode Enabled (263): 0, 0
libinput Send Events Mode Enabled Default (264): 0, 0
Device Node (265): "/dev/input/event16"
Device Product ID (266): 1452, 781
libinput Drag Lock Buttons (301): <no items>
libinput Horizontal Scroll Enabled (302): 1
こちらの設定の libinput Natural Scrolling Enabled
を 1 に設定するとナチュラルスクロールになります。設定は xinput set-prop
で行うことができます。
xinput --set-prop "atgのマウス" "libinput Natural Scrolling Enabled" 1
xinput --set-prop "atgのマウス" "libinput Horizontal Scroll Enabled" 0
これらの設定をXログイン時に起動するか、またはXorgの設定として記載してもよいかと思います。MagicmouseはBluetoothなので接続したり切断したりを繰り返します。この手のデバイスの設定は都度行われるため Udev などを利用して設定を行うことになります。
❯❯❯ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[580.325963] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/power_supply/hid-60:fb:42:fe:75:70-battery (power_supply)
KERNEL[580.326116] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20/mouse1 (input)
UDEV [580.327811] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/power_supply/hid-60:fb:42:fe:75:70-battery (power_supply)
UDEV [580.328519] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20/mouse1 (input)
KERNEL[580.340319] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20/event16 (input)
UDEV [580.343579] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20/event16 (input)
KERNEL[580.364424] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20 (input)
KERNEL[580.364600] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/hidraw/hidraw1 (hidraw)
KERNEL[580.364642] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004 (hid)
KERNEL[580.364672] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004 (hid)
UDEV [580.367070] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/input/input20 (input)
UDEV [580.367329] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004/hidraw/hidraw1 (hidraw)
UDEV [580.368688] unbind /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004 (hid)
UDEV [580.369779] remove /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:512/0005:05AC:030D.0004 (hid)
KERNE
このような形で udev が動いているのでこのイベントに対してのルールを記載していけば随時設定が反映されることになります。