You are not logged in.
You can use a longer "UPDATE" interval in line 4. It's 100 ms right now, you can set it to 200 or 300 or 1000 whatever your want to get longer flashes. Personally I think the rapid 10 fps updates look nice and more like a real physical HD LED, but to each his own.
Yes, those deprecation warnings. I think you will just have to live with them. I programmed this according to the latest PyGTK docs and there is no indication what functions I should use instead of these supposedly deprecated ones. So just ignore these messages for now. GTK 4 will probably break everything anyway, but that seems not to be supported by PyGTK right now…
Last edited by Morn (2021-04-18 13:39:13)
Offline
Thanks morn for that info, i think in the messages it mentions to use the other use GLib.timeout_add instead
GObject.timeout_ it says, could you try using that see what it does, thanks for your time input, just need to set it up to autostart now
Offline
Great, don't forget to mark this thread as solved by editing your first post.
If you autostart it, make sure it can find its icons. E.g. just hardcode the path in line 26:
i = f"/home/me/somewhere/icon{rr}{ww}.png"The code is indented with tabs, so just keep the indentation or set your editor's indentation mode accordingly. Python 3 does not like mixed tabs and spaces…
Last edited by Morn (2021-04-18 13:39:28)
Offline
The problem i get is running the python from bashrc file takes over the terminal and i cant use it for anything else, how to get the icom.py to run in background and allow use of terminal
Offline
foobar & disownYou maybe wanna read into some bash tutorials…
Offline
yes i googling on stuff i found nohup or pythonw trying those
Offline
You need a better google…
https://unix.stackexchange.com/question … disown-and
Offline
The problem i get is running the python from bashrc file takes over the terminal and i cant use it for anything else, how to get the icom.py to run in background and allow use of terminal
If you use startx, you can simply put this command in your .xinitrc.
Offline
I have tried out all the combinations, I have cinnamon starting from my xintrc, so i placed command in .bashrc as follows : nohup python /home/jet/hd-led_pygtk/icon.py &
only problem is if i start a new terminal window then it starts a new instant of program but i can use tabs and so long as i dont keep restarting terminal i should be ok.
Offline
What does your bashrc have to do with your xinitrc?
How did you install archlinux?
Offline
I have tried out all the combinations, I have cinnamon starting from my xintrc, so i placed command in .bashrc as follows : nohup python /home/jet/hd-led_pygtk/icon.py &
only problem is if i start a new terminal window then it starts a new instant of program but i can use tabs and so long as i dont keep restarting terminal i should be ok.
Leave your .bashrc alone and put it in your .xinitrc then!
I have now also created a similar program to monitor network traffic:
#!/usr/bin/env python
fn = "/sys/class/net/enp23s0/statistics/"
UPDATE = 100 # update interval in ms
ro, wo = 0, 0
last = ""
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
from gi.repository import Gtk
tray = Gtk.StatusIcon()
tray.set_visible(True)
def update():
global ro, wo, last
r = open(fn + "rx_packets").read()
w = open(fn + "tx_packets").read()
rr, ww = "0", "0"
if r != ro:
rr = "1"
if w != wo:
ww = "1"
ro, wo = r, w
i = f"icon{rr}{ww}.png"
if i != last:
tray.set_from_file(i)
tray.set_visible(True)
last = i
GObject.timeout_add(UPDATE, update)
update()
Gtk.main()Last edited by Morn (2021-04-20 08:38:29)
Offline
Hi i have lightdm autologin from cinnamon which is set in xintrc as exec cinnamon-session
So my system auto boots without user name input to my desktop and then i have terminal and firefox autostart.
Offline
I have lightdm autologin from cinnamon which is set in xintrc as exec cinnamon-session
That makes no sense at all but also that you're not using xinitrc, see https://wiki.archlinux.org/index.php/XDG_Autostart
Also
How did you install archlinux?
Offline
I have the line in xintrc to exec cinnamon-session, and have lightdm as login manager which i set to autologin by amending its .ini file, and it all works fine no problem for a good few years now, i installed it all manually arch way. Also i streamlined the system to suppress login messages so i get a fast clean boot with no boot messages following examples on arch wiki and stuff on youtube etc
Offline
pacman -Qi xinit-xsessionOffline
i get this on running above command : error: package 'xinit-xsession' was not found
i tried loading it via pacman but doenst allow it?
Offline
Because it's an AUR package and w/o it (or something equivalent), lightdm won't start your xinitrc as a session.
You could try to prepend some garbage "exec foobar" to your xintrc and I'm gonna bet your right arm that it will have no impact.
https://wiki.archlinux.org/index.php/Li … _autologin
https://wiki.archlinux.org/index.php/XDG_Autostart
Offline
Ok thanks for that info, i have added both programs and amended to my system and can only place them in bashrc it shows the errors but at least they r working, which setup have u got which desktop or on terminal etc, thanks for doing these programs up and i was reading the newer gtk stuff will deprecate much of the code in future. I only know basic bash and python and not got time to learn more stuff.
thanks once again.
Offline
This seems to be some google translation?
Anyway and again: leave your bashrc alone.
Use the xdg autostart to automatically launch stuff.
Or switch to xinit *instead* of lightdm.
But leave your bashrc alone - it has no business being involved here.
Offline
Ok thanks will look into that, cheers!!!
Offline
Hi I just checked my cinnamon stuff and i have added the files to the cinnamon autostart program and removed the entries from bashrc.
So finally job done. Thanks to Seth and Morn for helping, all in a days work!!!
Offline
You're welcome! Then you can conclude this endless saga now by marking the thread as "[SOLVED]"… ![]()
Offline