Skip to content

Instantly share code, notes, and snippets.

@Anr-C
Forked from nanpuyue/start_thunder.sh
Created April 8, 2017 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anr-C/10cafaf36e42ecb7991a5eaa0c32f619 to your computer and use it in GitHub Desktop.
Save Anr-C/10cafaf36e42ecb7991a5eaa0c32f619 to your computer and use it in GitHub Desktop.
CrossOver 迅雷极速版启动脚本,用于修复残留窗口遮挡屏幕
#!/bin/bash
# filename: start_thunder.sh
# date: 2017-03-11
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
EXIT_TIME=$(( $(date +%s) + 15 ))
exec "/opt/cxoffice/bin/wine" --bottle "迅雷极速版" --check --wait-children --start "C:/users/Public/Start Menu/Programs/迅雷软件/迅雷极速版/启动迅雷极速版.lnk" "$@" &
fun1(){
xdotool search --onlyvisible --classname "Thunder.exe"
}
fun2(){
local xprop_output=$(xprop -id "$1")
[[ "$xprop_output" =~ "program specified location: 0, 0" ]] && {
[[ "$xprop_output" =~ "迅雷极速版" ]] || xdotool windowminimize "$1"
}
}
fun3(){
fun1|\
while read line;do
fun2 "$line"
done
}
while (( $(date +%s) < $EXIT_TIME )) && (( $(fun1|wc -l) < 3 )); do
sleep 1
done
fun3
while (( $(date +%s) < $EXIT_TIME )) && (( $(fun1|wc -l) < 4 )); do
sleep 1
done
fun3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment