Last active
March 21, 2018 07:09
-
-
Save LuckyKoala/cf06d68b961d29d7cbe2bf2772916f1b to your computer and use it in GitHub Desktop.
Linux下在Minecraft里输入中文的辅助脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
#用法: minecraft_input.sh [auto] | |
#加上参数auto意味着脚本会自动将接收到的文字发送到输入框中并发送 | |
#如果是在告示牌上使用,不需要带参数 | |
#打开zenity对话框 | |
chars=$(zenity --title 中文输入 --text 中文输入 --entry 2>/dev/null) | |
#检查是否有参数 | |
if [ $1 == "auto" ] | |
then | |
sleep 0.1 | |
#按键模拟 ESC t | |
xdotool key --delay 150 Escape t | |
sleep 0.2 | |
#输入模拟 | |
xdotool type --delay 150 "$chars" | |
#按键模拟 Return | |
xdotool key Return | |
else | |
sleep 0.2 | |
xdotool type --delay 150 "$chars" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
依赖: