-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.txt
36 lines (31 loc) · 2.69 KB
/
todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
TODOS:
- Change the Quit menu item action to be more specific, since right now it just kills all the running yad instances.
- Change the See Stats menu item action to be more dynamic, do not just read a fixed number of lines.
- Change the logs format to be more clean (trim after 7chars of the application name or so, or try adding tabs).
Bonus:
- Create an applet for this little program. For the applet, you can either:
- use python and appindicator (https://fosspost.org/custom-system-tray-icon-indicator-linux, https://bazaar.launchpad.net/~geod/indicator-workspaces/main/view/head:/indicator-workspaces)
- use python through Qt.
- use python and gtk (https://bazaar.launchpad.net/~geod/indicator-workspaces/main/view/head:/indicator-workspaces)
- use python and the python-eggtrayicon deb package (https://stackoverflow.com/questions/1203451/how-to-write-an-application-for-the-system-tray-in-linux)
- use java through the TrayIcon object (https://docs.oracle.com/javase%2F8%2Fdocs%2Fapi%2F%2F/java/awt/TrayIcon.html, https://stackoverflow.com/questions/52530470/java-11-executing-source-file-via-shebang-is-not-working)
- use GtkStatusIcon (maybe deprecated)
- ( BEST ) use bash and cli tools like alltray and yad (https://funprojects.blog/2022/06/12/apps-and-scripts-in-the-system-tray/)
``
# using alltray
alltray "xterm -hold -T 'Top Processes' -e 'tail -$(wc --lines ~/.config/mmtime-v0.1/targets) ~/.local/share/mmtime-v0.1/targets.stats.db'"
``
Notes:
- To act on power mode change, you need to add hooks for power mode changement, or you can setup a hypotherical
syspension/hibernation minimum time and then check if the last time you've monitored a task is before current time
by that hypotherical period or not, if that is the case then you can assume that there was a suspend/hibenation.
i.e if time.Since(lastMonitor) > hypotherical_sys_hibernation_min_time then hibenation_occured = true
(NOTE): that is what I implemented to check for hibernation/suspend. I set a hypotherical min time period of 6 min.
Which means that I won't consider a hibernation/suspend unless there is a 6 minute sudden offset between two monitoring
instants.
Links: https://help.ubuntu.com/community/PowerManagement/ReducedPower
- As for signals, I beilive that in linux, on suspend/hibenation proceses receive a SIGSTOP from the system, and
then on system wake up, they receive a SIGCONT. On shutdown, they receive a SIGTERM, and if they persist for long
the system sends a SIGKILL to finish the process. So you can not easily log that with your program, since SIGSTOP
and SIGKILL can not be trapped (handled as wanted). Besides, that explains how processes continue thier job just
after the system wakeup after a hibernation/suspend.