1

Using bash, I have been trying to add and display a simple spinner animation in the window decoration xfwm4 (next to the title of the window) of the Nemo (3.8.6) file manager. I’m using Xubuntu 18.04.2 LTS with the base Greybird theme.

Here is what I have tried. I installed the script found at this address:

https://askubuntu.com/questions/634034/display-the-current-date-time-in-the-windows-title/634158#634158

Works perfectly. This is what I obtained:

https://forum.ubuntu-fr.org/viewtopic.php?pid=22115889#p22115889

https://www.zupimages.net/up/19/26/owfa.png

On this screenshot, I would like to display the spinner next to the clock. I then tried to incorporate a simple spinner to the above script. I used this:

while :; do
  for c in / - \\ \|; do
    printf '%s\b' "$c"
    sleep .1
  done
done

The window decoration script:

while true
do
    wmctrl -r :ACTIVE: -N "$(awk -F' \\|\\|' '{print $1}' <<< $(xdotool getwindowfocus getwindowname)) || $(LANG=fr_FR.UTF-8 date "+%A %d %B %Y  -  %H:%M:%S")"
    sleep 1
done

This script properly displays a spinner in a console but:

  • never in the title of a window
  • the spinner is displayed within an insert cursor (how to remove this so only the spinner remains?)

Thanks for your time and help!

jlg6
  • 25
  • 5

1 Answers1

0

Reaplce

printf '%s\b' "$c"

with

wmctrl -r :ACTIVE: -N $(printf '%s\b' "$c")

Update:

#!/bin/bash

while :; do
  d=$(LANG=fr_FR.UTF-8 date "+%A %d %B %Y  -  %H:%M:%S")
  for c in / - \\ \|; do
    wmctrl -r :ACTIVE: -N "$c $d"
    sleep .1
  done
done
Cyrus
  • 84,225
  • 14
  • 89
  • 153
  • This works for me too: `wmctrl -r :ACTIVE: -N "$c"` – Cyrus Jun 28 '19 at 16:44
  • This worked, thanks a lot! Just a quick question: how do I integrate this into the window decoration script? – jlg6 Jun 28 '19 at 16:46
  • Wow, I'm amazed at how quickly you answered and with code that works perfectly. Thanks so much, this is exactly what I wanted! – jlg6 Jun 28 '19 at 17:08