Simple graphical interface for Arch Linux's
reflector(pacmanmirrorlist generator).
ReflectorTK provides a straightforward graphical interface for configuring and running the reflector to update Arch Linux's mirrorlist. This program is a TKinter-based drop-in replacement for reflector-simple GUI shipped with EndeavourOS.
Operation
- Reads system
reflectorconfiguration (/etc/xdg/reflector/reflector.conf) and user configuration (~/.config/reflectortk/reflectortk.ini). - Presents available countries and some basic
reflectoroptions in a GUI. - Runs the
reflectorcommand. - Shows a preview of the generated mirrorlist.
- Saves the new mirrorlist to the system default (
/etc/pacman.d/mirrorlist) usingpkexec(backing up the old one) or to a custom location.
Rationale: Why recreate reflector-simple?
- Dependency bloat:
reflector-simpleusesyadfor its graphical interface, which pulls in thewebkit2gtk-4.1as a hard dependency. In author's case,reflector-simplewas the only program requiringyadand thuswebkit2gtk, wasting ~126MB of disk space. - Python availability:
reflectoris written in Python, meaning any system using it already has Python installed. This allows leveraging the existing environment, avoid dependencies, and potentially integrate the GUI with the originalreflector. - Better maintainability: Python vs Bash (subjective).
The initial goal was to set an experiment and recreate the original bash logic of reflector-simple in Python. The results are mixed: While I had anticipated a reduced line count, the results are opposite: a ~30% increase (~1190 vs 914). However, considering the bulk of code deals with replacing interaction with the purpose-built yad with a GUI based on the clunky TKinter API, doing away with dependencies in the process, this could be seen as a win. The origin also explains why ReflectorTK intentionally interacts with reflector by parsing its output instead of using it as a Python module.
Fun fact: I don't use reflector-simple and didn't know it existed until I noticed that's what pulls bulky updates.
Requirements
- Python 3 (with the standard
tkintermodule). No third-party Python libraries are required. reflectorpolkitwhich providespkexecfor saving to the system default path.
Installation
ReflectorTK is available at the AUR repository for Arch Linux and its derivative distros. Install with your favourite AUR helper, such as pakku, paru or yay.
pakku -S reflectortk-git
Or download the PKGBUILD file and install with makepkg:
git clone https://aur.archlinux.org/reflectortk-git.git
cd reflectortk-git
makepkg -siOr just clone this repository directly and run:
git clone https://github.com/indiscipline/reflectortk.git
cd reflectortk
chmod +x reflectortk.pyUsage
- Launch the GUI:
# Make sure it's executable (`chmod +x reflectortk.py`) ./reflectortk.py # Or with Python: python reflectortk.py
- Configure: Initially, ReflectorTK loads system config from
/etc/xdg/reflector/reflector.confand updates it with user preferences loaded from~/.config/reflectortk/reflectortk.ini. Current settings are saved on program exit. - Run & Preview: the button does its thing.
- Save: A preview window will show the generated mirrorlist.
- "Save to /etc/pacman.d/mirrorlist" asks for authentication to save the list with elevated privileges. The existing mirrorlist is backed up to
/etc/pacman.d/mirrorlist.bak. - "Save As..." saves to a custom location.
- "Save to /etc/pacman.d/mirrorlist" asks for authentication to save the list with elevated privileges. The existing mirrorlist is backed up to
TODO:
- Publish to AUR.
- Rewrite leveraging
reflectoras a Python module. - Propose merging with upstream
reflector(that's why ReflectorTK is GPLv2).
Contributing
Contributions are welcome! If you have bug fixes, improvements, or feature ideas, please open an issue first.
License
ReflectorTK is licensed under the GNU General Public License version 2.0 or later; see the LICENSE file for full details.
