我正在使用带有基本 Greybird 主题的 Xubuntu 18.04.2 LTS。我的文件管理器是 Nemo (3.8.6),窗口装饰管理器是 xfwm4。
感谢这个 bash script1(下面的代码和源代码https://forum.ubuntu-fr.org/viewtopic.php?pid=22123363#p22123363),我可以在控制台窗口上显示一个简单的正弦曲线。此动画还会在调整窗口大小时自动适应:
[脚本1]
#!/bin/bash
motif="⠁⠂⠄⡀⢀⠠⠐⠈ "
tempo=0.04
recalcule() {
columns=$( tput cols )
repet=$(( columns / longMotif ))
reste=$(( columns % longMotif ))
}
affPointApoint() {
longChaine=${#1}
for (( i=0; i<$longChaine; i++ )); do
printf "${1:$i:1}"
trap 'recalcule' SIGWINCH
sleep $tempo
done
}
longMotif="${#motif}"
while :; do
recalcule
tput clear
for (( x=0; x<$repet; x++ )); do
affPointApoint "$motif"
done
affPointApoint "${motif:0:$reste}"
done
我现在想在控制台以外的窗口上显示这个简单的正弦曲线。甚至可以在活动窗口的装饰中做到这一点,例如在窗口标题旁边?
我的第一个想法是在下面的 script2 中使用 wmctrl,但我没能做到。你觉得你能帮上忙吗?谢谢!
[脚本2]
#!/bin/bash
while true
do
wmctrl -r :ACTIVE: -N "$(awk -F' \\|\\|' '{print $1}' <<< $(xdotool getwindowfocus getwindowname)) || $(sinusoid variable here)"
sleep .1
done
感谢您的时间和帮助!