Ubuntu扩展触摸屏触控错位修复
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu扩展触摸屏触控错位修复
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Ubuntu擴展觸摸屏觸控錯位修復
當我們ubuntu外接一個觸摸顯示器的時候,會發現觸摸擴展屏幕,發現操控的是主屏幕,我寫了一個腳本去修復。
#! /bin/bash #------------------------------------------------------------------------------ # Filename: repairTouchscreen.sh # Usage: ./repairTouchscreen.sh # Version: 1.0 # Date: 2018-03-29 # Author: vincent # Email: N/A # Description: 此腳本用于修復Ubuntu下,擴展觸摸顯示器,觸摸擴展屏操作主屏的錯誤 # Notes: N/A #-------------------------------------------------------------------------------outputErrorMsg() {if [ $1 -ne 0 ]thenecho $2exitfi }declare SCREEN_COUNTS # 當前顯示器的總數 declare ACTIVE_SCREEN_COUNTS # 當前活躍的顯示器數量 declare SCREEN_NAME # 顯示器的輸出名稱 declare TOUCH_DEVICE_ID # 觸摸設備ID號SCREEN_COUNTS=$(xrandr --listmonitors | wc -l) outputErrorMsg $? "Get screen counts failed!" SCREEN_COUNTS=`expr $SCREEN_COUNTS - 1`ACTIVE_SCREEN_COUNTS=$(xrandr --listactivemonitors | wc -l) outputErrorMsg $? "Get active screen counts failed!" ACTIVE_SCREEN_COUNTS=`expr $ACTIVE_SCREEN_COUNTS - 1`if [ $ACTIVE_SCREEN_COUNTS -ge 3 ] # 如果當前活躍的顯示器數量多于2個,退出 thenoutputErrorMsg 1 "There are currently three monitors, please reduce to two monitors!" fiif [ $ACTIVE_SCREEN_COUNTS -eq 1 ] # 如果只有一個活躍的顯示器,退出 thenoutputErrorMsg 1 "There are only one monitor!" fi # 如果是兩個屏幕,那么第一個是主屏幕,第二個是輔助屏幕 SCREEN_NAME=($(xrandr --listactivemonitors | awk '{if(NR > 1) {print $4}}')) outputErrorMsg $? "Get screen name failed!"TOUCH_DEVICE_ID=$(xinput | grep -iw touch) # 獲取可觸摸設備if [ -z "$TOUCH_DEVICE_ID" ] thenoutputErrorMsg 1 "There is no touch device!" fiTOUCH_DEVICE_ID=$(echo ${TOUCH_DEVICE_ID#*id=}) TOUCH_DEVICE_ID=$(echo ${TOUCH_DEVICE_ID%% *}) # 最終獲取id號if [ -z "$TOUCH_DEVICE_ID" ] thenoutputErrorMsg 1 "Device id is empty!" fixinput map-to-output $TOUCH_DEVICE_ID ${SCREEN_NAME[1]} xrandr --listactivemonitors echo "Setting successful!" 創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的Ubuntu扩展触摸屏触控错位修复的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2815:城堡问题
- 下一篇: 冒泡排序算法(C#)