簡體   English   中英

如何在 mate-screensaver 中顯示和隱藏屏幕鍵盤“onboard”?

[英]How to show and hide the on-screen keyboard "onboard" in mate-screensaver?

我正在嘗試添加一個伴侶屏幕保護程序,以便在窗口上打開和關閉屏幕鍵盤(板載)。 所有功能都已准備就緒,我使用 org.mate.screensaver 架構的 2 個設置:

  • 嵌入式鍵盤啟用

  • 嵌入式鍵盤命令“onboard --xid”

切換開關的時候,我把embedded-keyboard-enabled的值分別改成true或者false,但是只有重啟mate-sreensaver窗口后鍵盤才會出現或者消失。 據我了解,鍵盤是由異步進程創建的,但是在需要時如何隱藏或顯示它?

在這些函數中,我使用 g_settings_set_boolean() 來設置關鍵參數並使用 g_settings_apply() 來應用更改。

我寫了一個在登錄時加載的小腳本,它使用我的鼠標中鍵切換隱藏和顯示。 當我想快速隱藏/顯示它時,這非常有效。

您可以復制並粘貼以下腳本,授予它執行權限,並在啟動時運行它。 (您可能需要安裝 xprintidle。)

在您喜歡的文本編輯器中復制並粘貼下面的文本。

#!/usr/bin/bash

if [[ "$(pidof -x $(basename $0))" != $$ ]] ; then exit;fi

rest=0

sleep 35;# (i need to wait 30-35 seconds at login for the physical mouse id to be assigned instead of the virtual mouse. It might go quicker for you.)

MOUSE=$(xinput --list --long | grep XIButtonClass | head -n 1 | egrep -o '[0-9]+');

toggle() { dbus-send --type=method_call --dest=org.onboard.Onboard /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.ToggleVisible;
}

while :;do
idle3=$(xprintidle)
STATE=$(xinput --query-state $MOUSE);
if [[ $STATE == *"button[2]=down"* ]];then toggle;sleep .5;elif [ $idle3 -gt 3000 ] && [ $rest = '.14' ];then rest=3;else rest=.14;fi;
sleep $rest;
done

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM