Skip to content

Commit

Permalink
Update README file
Browse files Browse the repository at this point in the history
  • Loading branch information
kmchmk committed Jun 27, 2021
1 parent e87d901 commit cdc5aa6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# SLT-Data-Usage
This script can get your SLT data usage and display it in the system tray.
This script can get your SLT data usage and display it in the system tray. This is mostly useful if you are using a unlimited package with daily limit.

Refresh interval is 120 secs, but it can easily be changed in the code.

You have to get some configs using Inspect Element option in the browser.
https://internetvas.slt.lk/

Initial setup:
```
pip install pystray
pip install requests
```
4 changes: 2 additions & 2 deletions system_tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_empty_image(): return Image.new('RGBA', (size, size//2)) # Empty image
def refresh(icon):
image = get_empty_image()
draw = ImageDraw.Draw(image)
draw.text(TOP_LEFT, data_usage.get_data_usage(), font = font_type, fill = 'yellow')
draw.text(TOP_LEFT, data_usage.get_data_usage(), font = font_type, fill = 'yellow') # ToDo - I used yellow here because of the System wide Dark theme
icon.icon = image

def update_forever(icon): # Exit method should be faster than refresh interval. So we have 2 iterations here.
Expand All @@ -34,7 +34,7 @@ def exit_method(icon):
icon.stop()

menu = (pystray.MenuItem('Refresh', refresh), pystray.MenuItem('Exit', exit_method))
icon = pystray.Icon("icon1", get_empty_image(), "Title", menu)
icon = pystray.Icon("icon1", get_empty_image(), "SLT Daily Usage (GB)", menu)
icon.visible = True
icon.run(setup=update_forever)
icon.stop()

0 comments on commit cdc5aa6

Please sign in to comment.