Linuxda keychrone va mx master taqdirini o'zgartiramiz
Loyihani qo'llab quvvatlash uchub buyerga bosing
GNU/Linux foydalanuvchilari uchun ma’lumki keychrone klaviaturalari va logitech mx master sichqonchalari linux bilan to’laqonli chiqisha olmaydi. Keychrone apple hid hisobida bo’lgani uchun bluetooth orqali ulanish juda ham sekin amalga oshiriladi. Mx masterda bo’lsa sichqonchani remap qilish uchun logitech tomonidan ishlab chiqiladigan dastur mavjud emas.
Keychrone:
Ushbu klaviatura asosan apple maxsulotlari uchun ishlab chiqilgani bois linuxda fn modelar oldindan yoniq holda ulanadi. Funksional keylar ishlatish muammosini kernelga qo’shimcha o’zgartirish kiritish orqali bartaraf etish mumkin.
/etc/modprobe.d/hid_apple.conf
faylini yaratamiz va uni ichiga quyidagilarni kiritamiz:
options hid_apple fnmode=2
Kernelni qayta build qilamiz:
sudo update-initramfs -u
Bluetooth orqali ulanish muammolariniyam bartaraf etishni unutmaslik kerak. Bunda kuzatiladigan asosiy muammo keychrone klaviaturasing uzilib qolishi, qayta ulanmay qolishi yoki sekin ulanishi, shuningdek login managerda ishlamasligi.
/etc/bluetooth/input.conf
faylidan IdleTimeout
qismini komentdan ochamiz va u uchun 0 qiymatni belgilaymiz. Shuningdek xuddi shu fayldan UserspaceHID
blokiniyam ochib true
holatiga sozlaymiz.
Taxminiy kontent (sizdagi distributivga qarab farq qilishi mumkin):
[General]
IdleTimeout=0
UserspaceHID=true
#ClassicBondedOnly=true
#LEAutoSecurity=true
Shuningdek /etc/bluetooth/input.conf
faylidan ham FastConnectable
, ReconnectAttempts
, ReconnectIntervals
sozlamalarini quyidagilarga moslash lozim:
Taxminiy kontent (sizdagi distributivga qarab farq qilishi mumkin):
[General]
#Name = BlueZ
#Class = 0x000100
#DiscoverableTimeout = 0
#PairableTimeout = 0
#AutoConnectTimeout = 60
#DeviceID = bluetooth5678:abcd
#ReverseServiceDiscovery = true
#NameResolving = true
#DebugKeys = false
#ControllerMode = dual
#MultiProfile = off
FastConnectable = true
[Policy]
ReconnectAttempts=7
ReconnectIntervals=1, 2, 4, 8, 16, 32, 64
AutoEnable=true
Bluetooth moduli uchun atomatik uzilish oldini olish:
Ushbu holat asosan energy saving modeda kuzatiladi, ya’ni agarda keyboard bir marotada uziladigan bo’lsa kernel bluetoothni o’chirishga urinadi va qayta ulanish keyinchalik amalga oshirilmaydi.
Muammoni quyidagi ikki buyruq orqali hal qilish mumkin:
echo "options btusb enable_autosuspend=n" | sudo tee /etc/modprobe.d/btusb_disable_autosuspend.conf
sudo update-initramfs -u
Kompyuter lock screen (bloklanish) holatiga tushishini ham unutmaslik kerak. Agarda sizda lock screen kuzatiladigan bo’lsa operatsion tizim barcha bluetooth ulanishlarni uzadi va login oynasida qayta ulanish amalga oshirilmaydi. Bu muammoni esa kichik bash script bilan hal qilsangiz bo’ladi:
sudo tee /lib/systemd/system-sleep/bt << EOT
#!/bin/sh
case $1 in
post)
modprobe -r btusb
sleep 1
service bluetooth restart
sleep 1
modprobe btusb
;;
esac
EOT
sudo chmod +x /lib/systemd/system-sleep/bt
Yuqorudagi barcha amallar bajarilgach kompyuterga restart beramiz:
sudo reboot
Restart berilgandan so’ng klavuiaturani to’g’ri ulashga harakat qilamiz (bu ishni imkon boricha gui orqali amalga oshirmang):
bluetoothctl
->power off
->power on
->scan on
->trust MAC_ADDR
->pair MAC_ADDR
->connect MAC_ADDR
MX master uchun sozlamalar:
Logitech tomonidan unixga daxldor operatsion tizimlarda faqat macos qo’llab quvvatlanadi. Ammo shunga qaramasdan linuxning ko’ngilli foydalanuvchilari tomonidan solaar
dasturi ham ishlab chiqilgan. Ushbu dastur sizga sichqonchani tezkor va oson sozlashni amalga oshirishda yordam bera oladi.
O’rnatish:
sudo apt install solaar
(*majburiy emas) Dasturni ishga tushirmasdan oldin qutidagi yaml configni kiritishingiz mumkin. Ushbu config fayl orqali mx master sichqonchasidagi thumb bilan ovozni, gesture orqali qo’shiqlarni boshqarishni, back va forward tugmalari orqali ishchi stoli almashtirishni amalga oshirish mumkin.
Buni amalga oshirish uchun ~/.config/solaar/rules.yaml
fayliga quyidagilarni kiritamiz:
%YAML 1.3
---
- Rule:
- Test: thumb_wheel_down
- KeyPress: XF86_AudioLowerVolume
- Rule:
- Test: thumb_wheel_up
- KeyPress: XF86_AudioRaiseVolume
- Rule:
- MouseGesture: Mouse Right
- KeyPress: [XF86_AudioNext, click]
- Rule:
- MouseGesture: Mouse Left
- KeyPress: [XF86_AudioPrev, click]
- Rule:
- MouseGesture: Mouse Up
- KeyPress: [XF86_AudioPlay, click]
- Rule:
- MouseGesture: Mouse Down
- KeyPress: [XF86_AudioStop, click]
- Rule:
- Key: [Forward Button, pressed]
- KeyPress: [Control_L, Alt_L, Right]
- Rule:
- Key: [Back Button, pressed]
- KeyPress: [Control_L, Alt_L, Left]
...
Solaar dasturidan esa Thumb Wheel Diversion
qismini yoqamiz. Shuningdek Key/Button Diversion
blokidan back, forward va mouse gesture button bo’limlarini Diverted
ga o’zgartiramiz.
Sichqoncha sozlandi ammo yana bir kichik muammoni kuzatishingiz mumkin. Bunda thumb wheel ovozni boshqarish uchun juda ham sezgir hisoblanadi. Ushbu muammoni esa xbindkeys
orqali hal qilsangiz bo’ladi.
O’rnatish:
sudo apt install xbindkeys
xbindkeys -d > ~/.xbindkeysrc
mkdir ~/.xbindkeys/
Shundan so’ng ~/.xbindkeysrc
faylining eng quyi qismiga quyidagilarni kiritamiz:
"~/.xbindkeys/MX-Master-3-bindings.sh Scroll_L"
b:7 + release
"~/.xbindkeys/MX-Master-3-bindings.sh Scroll_R"
b:6 + release
~/.xbindkeys/MX-Master-3-bindings.sh
fayli kontenti:
Ushbu faylda hScrollModulo
orqali sezuvchanlikni o’zingizga moslashtirsangiz bo’ladi.
#!/usr/bin/env bash
button=$1
hScrollModulo=1
hScrollIndexBuffer="/dev/shm/LogitechMXMaster3HScroll"
if [ ! -f "$hScrollIndexBuffer" ]; then
printf "L\n0\n" > "$hScrollIndexBuffer"
fi
function temporizeHorizontalScroll {
local newDirection=$@;
local buffer=(`cat $hScrollIndexBuffer`)
local oldDirection=${buffer[0]}
local value=${buffer[1]}
if [ "$oldDirection" = "$newDirection" ]; then
((value++))
((value%=$hScrollModulo))
else
value=1
fi
echo "$newDirection $value" > $hScrollIndexBuffer || value=0
[ ${value} -ne 0 ] && exit;
}
case "$button" in
"Scroll_L")
temporizeHorizontalScroll "L"
xdotool key --clearmodifiers ctrl+shift+Tab; ;;
"Scroll_R")
temporizeHorizontalScroll "R"
xdotool key --clearmodifiers ctrl+Tab; ;;
esac
Yuqoridagi fayl yaratilgach quyidagi ikki buyruqni ham amalga oshiramiz:
chmod +x ~/.xbindkeys/MX-Master-3-bindings.sh
killall -HUP xbindkeys