# encoding: utf-8
# api: clicky
# type: init-gui
# version: 0.2
# title: ActivityIndicator3000
# description: adapts title while scripts are running
# category: ui
# state: buggy
# hidden: 1
# nomenu: 1
#
# Starts timer in Start-Win (init-gui hook). This keeps it running
# continuosly. But task only really comes into action when $GUI.tasks[]
# queue contains a script.
# Then rewrites the window title with swirly arrows while active.
#
$GUI.act = @{
timer = [System.Windows.Threading.DispatcherTimer]::new("Background")
step = -1
arrows = "⇘⇩⇙⇐⇖⇑⇗⇒"
}
$GUI.act.timer.Interval = 2500
$GUI.act.timer.Add_Tick({
if ($GUI.tasks -and ($_title = $GUI.tasks[0].title)) {
$GUI.act.step = ($GUI.act.step + 1) % $GUI.act.arrows.length;
$GUI.w.title = $GUI.act.arrows[$GUI.act.step] + " $($cfg.main.title) → $_title"
}
elseif ($GUI.act.step -ge 0) {
$GUI.w.title = "➱ $($cfg.main.title)"
$GUI.act.step = -1
}
})
$GUI.act.timer.Start()