Re: OT: simplest way to display on-screen blinking colored indicator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 16 Apr 2020 14:07:21 -0700 stan via users <users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, 16 Apr 2020 08:41:22 -0500
> Ranjan Maitra <maitra@xxxxxxxxx> wrote:
>
> > The reason I need this is because the Cisco icon (that I need for VPN
> > because of required third-party 2FA) is very tiny and almost
> > impossible to see. It is time-consuming and distracting to constantly
> > have to hover over the icon to see whether it says Connected and
> > Disconnected.
> >
> > So, I am thinking of a small script that will check every second
> > (say) if VPN is on or off and then display accordingly. The script
> > part, I think I can write on my own. It is what th script will
> > do/call that i am having trouble with. So any suggestions as to what
> > I could do.
>
> Ed gave you the way to find out if it is connected.  I found this on
> the web and use it as a quick timer when I want to be notified after a
> period of time. Start it from an xterm.  It appears in whatever window
> you are currently working in. You should be able to trigger it with your
> logic.  Hard to miss.  Try it.
>
> sleep 1s && date && xterm -bg red -fg yellow -g 80x40

So, I was able to hack out a python script (I don't really know python) which does the blinking red. Blinking green is trivial after this. Here is the script (below). I am now thinking of writing the whole thing in python as a single script. Btw, how do I put this "window/indicator" into the system tray?

Thanks for the help and suggestions!

Best wishes,
Ranjan



#!/usr/bin/env python

import pygame
import time

WHITE =     (255, 255, 255)
BLUE =      (  0,   0, 255)
GREEN =     (  0, 255,   0)
RED =       (255,   0,   0)
TEXTCOLOR = (  0,   0,  0)
(width, height) = (40, 40)

running = True

background_color = WHITE

pygame.init()
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("VPN-Status")
screen.fill(background_color)
pygame.display.update()

while running:
    pygame.draw.circle(screen, RED, (20, 20), 20)
    pygame.display.update()
    time.sleep(0.25)
    pygame.draw.circle(screen, WHITE, (20, 20), 20)
    pygame.display.update()
    time.sleep(0.25)



_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux