Indiscipline

Mild achievements and severe disappointments

posted by Kirill on 2025-05-31

If you’re an EndeavourOS user and were ever surprised why your system update is suddenly pulling in a ~126 MB webkit2gtk-4.1 package that nothing you consciously installed seems to use, then this is for you. I found myself annoyed by this particular dependency enough to rewrite reflector-simple, the GUI for reflector shipped with EndeavourOS. Even though I’m generally comfortable using reflector from the command line, it was interesting to see how much the Python implementation would differ from its Bash counterpart.

The result is ReflectorTK, a straightforward graphical interface for configuring and running reflector to update your Arch Linux mirrorlist. It’s designed as a Tkinter-based drop-in replacement for reflector-simple.

ReflectorTK screenshot

Rationale: Why ReflectorTK?

So, why go to the trouble of recreating reflector-simple? My motivations were threefold:

  1. Dependency bloat: reflector-simple uses yad (Yet Another Dialog) for its GUI, which in turn has webkit2gtk-4.1 as a hard dependency. In my case, reflector-simple was the only program pulling in yad and thus webkit2gtk, wasting disk space and traffic.
  2. Python’s ubiquity: reflector itself is written in Python. This means any system running reflector already has a Python interpreter. Leveraging this existing environment is only natural, allowing for a GUI without adding new dependencies. It also opens the door for tighter integration with reflector down the line.
  3. Better maintainability: Python feels more readable and maintainable for scripting and GUI work compared to Bash. This is, of course, a personal preference.

The initial experiment was to see if I could replicate the reflector-simple logic in Python with fewer lines of code. The outcome was… mixed. I anticipated a reduction, but the Python version ended up being about 30% longer (~1190 vs ~914 lines). However, when you consider that a significant portion of this code involves replacing interactions with the purpose-built yad with Tkinter’s somewhat clunky API, all while doing away with dependencies, it still feels like a win. This initial approach also explains why ReflectorTK currently interacts with reflector by parsing it output rather than using it as a Python module (though that’s a future goal).

Just to be clear, this project was undertaken for fun, first and foremost. It doesn’t imply that reflector-simple needs replacement, but it does solve a particular issue I (and potentially others) had with it. Since the program reached a reasonably presentable state, I decided to share it.

Fun fact: I don’t typically use reflector-simple and wasn’t even aware of its existence until I noticed what was pulling those bulky updates.

Features, Usage and Technical details

ReflectorTK is available on the AUR (Arch User Repository). You can install it with your favorite AUR helper. Or just run it as any other random Python script.

For detailed features, usage and installation directions read the ReflectorTK readme in program’s repository: https://github.com/indiscipline/reflectortk

Feedback & Contributing

ReflectorTK is discussed in a thread at EndeavourOS forum

Contributions, bug reports, and suggestions are most welcome! Please use the GitHub Issues page for these if possible. I’d be happy to hear your thoughts if you try out the program.

PS: If any reflector-simple maintainers are reading this and are interested, I’m open to discussing improvements to ReflectorTK to better meet EndeavourOS’s requirements, potentially allowing it to serve the role of the original script more fully.

ReflectorTK is licensed under the GNU General Public License version 2.0 or later (allowing integrating into reflector code base).