1

我正在使用带有基本 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

感谢您的时间和帮助!

4

1 回答 1

1

以下实际有效(在终端中启动,将鼠标悬停在其他窗口上);我希望这是你的想法:

#!/bin/bash

motif="⠁⠂⠄⡀⢀⠠⠐⠈ "
tempo=0.04
len=${#motif}

i=0
while true
do
    left=${motif:0:i}
    right=${motif:i:len}

    wmctrl -r :ACTIVE: -N "${right}${left}"

    i=$((i+1))
    [ $i -eq $len ] && i=0

    sleep 0.1
done
于 2019-07-16T00:51:37.153 回答