
所以我有這個腳本:
#!/bin/bash
# Flips the screen (hopefully)
syntax_error=0
orientation=0
current_orientation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
case $current_orientation in
normal)
current_orientation=0
;;
left)
current_orientation=1
;;
inverted)
current_orientation=2
;;
right)
current_orientation=3
;;
esac
if [ $current_orientation -eq 0 ]; then
orientation=2
fi
if [ $current_orientation -eq 2 ]; then
orientation=0
fi
method=evdev
# LENOVO S10-3t CHANGE ==> Hard Coded my device number to 11!!!!!!!!
device=11
swap=0
invert_x=0
invert_y=0
real_topx=0
real_topy=0
real_bottomx=4020
real_bottomy=4020
case $orientation in
0)
swap=0
invert_x=0
invert_y=0
topx=$real_topx
topy=$real_topy
bottomx=$real_bottomx
bottomy=$real_bottomy
;;
1)
swap=1
invert_x=1
invert_y=0
topx=$real_topx
topy=$real_topy
bottomx=$real_bottomy
bottomy=$real_bottomx
;;
2 )
swap=0
invert_x=1
invert_y=1
topx=$real_topx
topy=$real_topy
bottomx=$real_bottomx
bottomy=$real_bottomy
;;
3 )
swap=1
invert_x=0
invert_y=1
topx=$real_topx
topy=$real_topy
bottomx=$real_bottomy
bottomy=$real_bottomx
;;
esac
if [ $method = "evdev" ]; then
xinput set-prop "$device" "Evdev Axes Swap" $swap
xinput set-prop "$device" "Evdev Axes Swap" $swap
xinput set-prop "$device" "Evdev Axis Inversion" $invert_x $invert_y
xinput set-prop "$device" "Evdev Axis Calibration" $topx $bottomx $topy $bottomy
if [ $orientation = 2 ]; then
xrandr -o inverted
fi
if [ $orientation = 0 ]; then
xrandr -o normal
fi
fi
#
適用於我的聯想 S10-3t 的翻轉畫面。我從上網本的 wiki 頁面複製它,並在頂部添加了 #!/bin/bash。檔案名稱是 Flipscreen.sh。我怎樣才能讓它發揮作用?
答案1
右鍵單擊該文件,然後選擇“屬性”。從對話方塊中選取“允許將檔案作為程式執行”,如下圖所示。然後關閉對話框並雙擊要執行的檔案。
答案2
首先你需要讓你的文件可執行,
在目錄類型中,
sudo chmod+x flipscreen.sh
sudo bash flipscreen.sh
答案3
OpenNingia 的答案是可行的,但對於稍後會使用Google搜尋的人,您也可以透過命令列執行以下操作:
打開終端,然後轉到腳本所在的資料夾
chmod +x <yourScript>
然後執行它作為
./<yourScript>
答案4
雙擊該檔案。一個對話框會詢問您該文件是可執行的,您想做什麼。點擊“運行”,您應該就可以開始了。