1

I want to change the clock on the Ubuntu panel into something more exotic. I am interested in finding a way to add an icon to the panel and be able to change it (like Psensor and Slack applications do, see picture) based on time or some other conditions.

My current Ubuntu panel

How I want it to look

When googling for this I've always gotten the response for the launch icons, and not the Ubuntu panel. I'm using Ubuntu 16.04

I've got the ide from Destin from Smarter Every Day YouTube channel, and I've made the second image in GIMP.

Jacob Vlijm
  • 83,767
  • The clock cant be altered , but additional indicator can be added - thats easy. Define what you mean by 'more exotic'. What exactly is the functionality that you want ? – Sergiy Kolodyazhnyy Feb 16 '17 at 17:20
  • Is that a binary clock you want at the end? – Terrance Feb 16 '17 at 17:20
  • @Serg "more exotic" means that it doesn't show nubers but symbols, like in the second image. – Djokjula Feb 16 '17 at 17:30
  • @Terrance This is not binary it is read from left to right and each separated set represents a digit, so it is read 1, 7, 4, 9 – Djokjula Feb 16 '17 at 17:31
  • @JacobVlijm For example the second set has 7 red dots, representing the number 7. The order of the dots doesn't matter, only the amount. – Djokjula Feb 16 '17 at 17:32
  • 1
    Haha ^ by the time you're done reading, the time has changed :) No seconds I hope? – Jacob Vlijm Feb 16 '17 at 17:34
  • Looks like binary to me and binary is read from left to right too, well, some are, but I understand what you are saying. I absolutely have no clue on how to set up something like that. Hopefully someone might know how to create a clock like that. – Terrance Feb 16 '17 at 17:37
  • @JacobVlijm I know it CAN be done since third party applications such as Psensor and Slack do it. I am interested in HOW to do it :). I've made a program that converts time data into a graphical representation, but I want that representation to be shown on the panel. – Djokjula Feb 16 '17 at 17:37
  • Can be easily done. So you have the application that produces the image? The only thing that needs to be done is to set the image? Then we simply can connect a script like this: http://askubuntu.com/a/756519/72216 (second one) to your application. Only not updating the text, but the icon. Would you like a concrete coded example, or would you make it from scratch? – Jacob Vlijm Feb 16 '17 at 17:42
  • I am totally picturing it though: let the indicator periodically get the time (synchronized with actual time to save fuel) then run your existing script with the time as argument, fetch the output image and update the indicator's panel image. Interesting question. Need to teach a few hours and will dive into it. BTW, what (input) time format is your script using? – Jacob Vlijm Feb 16 '17 at 17:44
  • Hi @Djokjula I need some information from you: what is the required time format for your script ("I've made a program that converts time data into a graphical representation"), and what is the path the indicator should fetch the image from? I need the info to produce an answer. – Jacob Vlijm Feb 16 '17 at 18:41
  • @JacobVlijm, sorry for not answering erlier. Thanks for the python script, it is exactly what i needed (with a few modifications). The program I made is in Java, and the format is what I get from Java's Date object (date.getHours()). I guess the path of the image doesn't matter since I can put it wherever (let's say ~/Pictures/Clock/). – Djokjula Feb 16 '17 at 18:50
  • @Djokjula thanks! could you show me what date.getHours() looks like? or do we simply run the script at periodic times, and the appropriate icon is produced? – Jacob Vlijm Feb 16 '17 at 18:52
  • @JacobVlijm date.getHours() returns a number from 0 to 23 which I use to get the amount of red dots on the image (date.getHours()/10 for the first set of dots, date.getHours()%10 for the second set). There is also a method date.getMinutes() which returns a number from 0 to 59. I use that data to create an image and using Processing library i display it. But, I beleve I can make a simple script that creates the image, that won't be a problem. Call it timeToImg.sh – Djokjula Feb 16 '17 at 18:59
  • @JacobVlijm Thanks! I've solved it! turns out, just by changing the image specified, you can change the image in the panel, no need for aditional code! – Djokjula Feb 16 '17 at 19:31
  • Hi @Djokjula it's a pitty if we don't add an answer to the question: unsnaswered questions are a pain on the site. If the linked answer solves yoyr issue, I will link it as a dupe to that one. – Jacob Vlijm Feb 16 '17 at 19:40

0 Answers0