Web Browser Firefox จะไม่รองรับการคลิกขวาบนคำศัพท์ที่ปรากฏบนหน้าเว็บ เพื่อใช้แสดงเมนู Look up เพื่อค้นหาคำแปลจาก Dictionary ในเครื่อง
ปัญหานี้เกิดขึ้นเนื่องจาก Firefox ใช้ custom context menu ของตัวเองแทนที่จะใช้ services ที่เป็น native macOS
วิธีแก้ปัญหา
เราสามารถแก้ปัญหานี้ได้ด้วยการเลี่ยงไปใช้ System-Wide Keyboard Shortcut แทน ดังนี้
- เอาเมาส์ไป hover เหนือคำที่ต้องการแปล หรือ double click เพื่อ highlight คำนั้น
- กดคีย์ Control(^) + Command(⌘) + D
ผลลัพธ์ที่ได้ก็จะเหมือนกับการ คลิกขวาแล้วเลือก Look up เหมือนกัน
ถ้าต้องการใช้แป้นอื่นเรียกแทนได้หรือไม่?
สำหรับ Control(^) + Command(⌘) + D นี้ เราไม่สามารถ mapping แป้นพิมพ์ในเมนู Settings ของ macOS ได้เหมือนคีย์อื่นๆ เพราะคีย์นี้ทาง Apple ฝังการทำงานเข้าไปกับ text system และ dictionary ของระบบ เราจึงต้องใช้โปรแกรม Third-Party เพื่อช่วย เช่น โปรแกรม Keyboard Maestro, BetterTouchTool หรือ Karabiner-Elements ผมเองจะใช้ Karabiner-Elements เพื่อทำการ mapping Control(^) + Command(⌘) + D เข้ากับคีย์ Caps Lock + T ก็สามารถทำได้ไม่มีปัญหาครับ
ตัวอย่าง script ที่ผมใช้ใน Karabiner-Elements โดยเบื้องหลังผมมีการ mapping Caps Lock เข้ากับแป้น Control + Option + Command + Shift อีกทีครับ
{
"global_configuration": {
// ...
},
"profiles": [
{
"name": "Default",
"complex_modifications": {
"parameters": {
// ...
},
"rules": [
// Existing rules go here...
// Add the new rule here:
{
"description": "Remap Ctrl+Opt+Cmd+Shift+T to Look Up (Ctrl+Cmd+D)",
"manipulators": [
{
"from": {
"key_code": "t",
"modifiers": {
"mandatory": [
"left_control",
"left_option",
"left_command",
"left_shift"
]
}
},
"to": [
{
"key_code": "d",
"modifiers": [
"left_control",
"left_command"
]
}
],
"type": "basic"
}
]
}
]
},
// ...
}
]
}
Photo by Stefan G: pexels.com