跳至主要內容

如何關閉 Linux 筆電內建的鍵盤

本篇文章將介紹如何透過指令關閉 Linux 筆電的內建鍵盤

The Walking Fish 步行魚
The Walking Fish 步行魚 ·
384 字 · 閱讀時間: 1 分鐘 · ...
如何關閉 Linux 筆電內建的鍵盤
Fig. 01 — 如何關閉 Linux 筆電內建的鍵盤 FEATURED IMAGE

使用指令

要在 Linux 系統上禁用筆電的內建鍵盤,我們需要先得知內建鍵盤的 ID,然後再將其禁用。禁用是即時的,輸入完指令無須重新開機就可以生效。

查詢筆電鍵盤的ID

收先我們需要先透過以下指令得知筆電內建鍵盤的 ID

1
xinput list

通常 Linux 系統的筆電內建鍵盤名稱會是 AT Translated Set 2 keyboard

禁用鍵盤

1
xinput set-prop {id} "Device Enabled" 0

執行效果:

開啟鍵盤

1
xinput set-prop {id} "Device Enabled" 1

設定開機自動執行禁用鍵盤指令 - 透過 Desktop Entries

要設定 Desktop Entries,我們需要先進到 家目錄 > .config > autostart 資料夾內,創建一個新的 .desktop 檔案。

檔案的內容可以照以下填寫,便可以在開機的時候自訂執行禁用鍵盤的程式。(底下的 id 記得要改)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
[Desktop Entry]

# The type as listed above
Type=Application

# The version of the desktop entry specification to which this file complies
Version=1.0

# The name of the application
Name=Disable Laptop Keyboard

# A comment which can/will be used as a tooltip
Comment=Disable Laptop Keyboard

# The executable of the application, possibly with arguments.
Exec=xinput set-prop {id} "Device Enabled" 0

# The name of the icon that will be used to display this entry
Icon=jmemorize

# Describes whether this application needs to be run in a terminal or not
Terminal=true

影片介紹

TAGS / 文章標籤
SHARE / 分享此文章

相關連結 / 延伸閱讀

1 LINKS