Wired Vagrant

Home | Posts | Tags

First GNOME extension published!

This follows up on the issue I mentioned previously here: /posts/2020-05-18-linux-weak-wifi-signal/

Bash scripts are great, but not very user friendly. I needed a way to quickly check and control the Power Management option of my Wi-Fi card and it seems an excellent practice for my first GNOME extension, after a couple minor contributions to Pop!_OS Shell.

The end results can be found here: https://extensions.gnome.org/extension/3258/wi-fi-power-management-toggle/

Developing it was a trying process. There’s a bit of basic documentation to setup your extension, but that’s about it. I mostly managed to learn what I needed by just reading gnome-shell source code.

I improved a bit the makefile from Pop!_OS gnome extensions to make it completely standalone and with a way to have the extension removed when I stop debugging by interrupting the task with Ctrl+C, you can take a look here.

Another thing that took some researching was to actually toggle the power management option on the wireless card. Initially I knew only about iwconfig, which had a few problems. It doesn’t persist after a reboot or waking up from suspend and it requires sudo. After having the extension modify some config file and installing a polkit file, both issues were solved, but I wasn’t completely satisfied with this. Then I stumbled on another command line tool I could use, nmcli (https://developer.gnome.org/NetworkManager/stable/nmcli.html) And it could do everything I needed, without admin privileges, permanent after reboot and not global to the card but managed per network. It was PERFECT!

I’ll probably try to improve this extension a bit, however I don’t see drastic changes coming. Probably just learning how to integrate translations. I’ll maybe also rename it to Power Save, which will be clearer for people who do not know about this feature, I initially name it that way based on how it’s called in iwconfig. And add a small config window, with explanation on what it does.