Ubuntu 16.04 (Unity)でnatural scrollingにする(マウスホイールの上下を逆にする)
Ubuntuではまさにこの目的のために"Natural Scrolling"というアプリがあるのだけれど、スクリーンがロックされたあとや、サスペンド・ハイバネーションから回復した後に、もとに戻ってしまう。
想像なのだけれど、Natural Scrollingアプリケーションが監視しているdbusからのメッセージがUnity向けに設計されていないのであろう。しょぼい話だ。
直し方だが、こういう方法はどうだろう。以下の内容で~/bin/natural.sh
を作成する。
This article is about how to fix an issue where "Natural Scrolling" doesn't work after Screen Unlock, resume from suspension and hibernation. IMO it's because the application's design which doesn't consider usages under Ubuntu Unity. Here's a quick fix for it. I hope it helps you.
#!/bin/bash function go_natural() { for i in $(xinput | grep 'slave pointer' | head -n -0 | cut -f 2 -d '=' | cut -f 1) ; do xinput --set-button-map $i 1 2 3 5 4 7 6; done } go_natural dbus-monitor --session "type='signal',interface='com.canonical.Unity.Session'" | \ ( while true do read X if echo $X | grep "UnlockRequested" &> /dev/null; then go_natural fi done )
次に
chmod 755 ~/bin/natural.sh
として実行権限を与える。 このファイルをStartup Applicationsに登録する。
これでひとまず手元のマシンでは所期の動作になるが、今年の4月にUbuntu 18.04にするとどうせまた直さないといけないんだろうな。