Quantcast
Viewing all articles
Browse latest Browse all 4971

Raspberry Pi OS • Re: Keyboard layout displaying/switching for Wayfire and wf-panel-pi

Thanks for all the info, I might as well give it try in the near future. To my mind the crucial thing is that you emit the info on DBUS. Hacking a solution to emit a notification (outside the panel) is mostly trivial. For example -and for my case- I stole an example based on python that listens on DBUS and uses the system's notification daemon (mako) to display a short-lived notification every time the layout changes :

Code:

#!/usr/bin/python3import osimport gi.repository.GLibimport dbusfrom dbus.mainloop.glib import DBusGMainLoopimport signalimport syssignal.signal(signal.SIGINT, lambda x, y: sys.exit(0))def notifications(bus, message):    global previous    args = message.get_args_list()    if args[1] != previous:        os.system('notify-send -t 1500 -e '+args[1] )        previous = args[1]previous = ""DBusGMainLoop(set_as_default=True)bus = dbus.SessionBus()bus.add_match_string_non_blocking("eavesdrop=true, interface='org.wayfire.wfpanel', member='command'")bus.add_message_filter(notifications)mainloop = gi.repository.GLib.MainLoop()mainloop.run()
The solution based on the panel is of course much better and tidy, and as I said I will give it a try in the near future.

Thanks again for your plugins.

Statistics: Posted by glykos — Sun Mar 24, 2024 8:41 am



Viewing all articles
Browse latest Browse all 4971

Trending Articles