Add CLI flags, external blocklist, and GTK frontend#4
Open
orkolorko wants to merge 1 commit into
Open
Conversation
distractions--.sh: new --duration/--preset/--sites/--yes/--no-gui flags (default zenity flow unchanged). --no-gui suppresses dialogs, implies --yes, and emits PROGRESS:<pct>:<msg> lines on stdout for wrappers. Domains now loaded from blocklists.txt (INI sections, embedded fallback). Block-setup body factored into do_block_setup(); the hosts/chattr/ systemd/at calls are byte-identical. distractions_gui.py: PyGObject/GTK3 frontend, runs unprivileged, shells out via pkexec --no-gui. Includes an embedded blocklist editor and a live countdown view that polls /var/lib/hardblock/end_time. CLAUDE.md: documents the layered architecture and wrapper protocol. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
distractions--.sh(--duration,--preset,--sites,--yes,--no-gui) so the script can be driven non-interactively. The default zenity flow is unchanged.blocklists.txt(INI-style[social]/[adult]/[timewasters]sections); embedded fallback kept so the script still runs standalone if the file is missing.distractions_gui.py— a PyGObject/GTK3 frontend that runs unprivileged and shells out viapkexec --no-gui, parsingPROGRESS:<pct>:<msg>lines into a progress bar. Includes an embedded blocklist editor and a live countdown view that polls/var/lib/hardblock/end_time.chattr/ systemd /atblock-setup body is byte-identical — only extracted into ado_block_setup()function so both the zenity progress pipe and the no-gui stdout path can share it. The irreversibility guarantee is preserved.--no-guiimplies--yes, suppresses every zenity dialog, and skips the optional yad countdown (wrappers are expected to render their own). Errors go to stderr asERROR: <title>: <message>.Test plan
bash -n distractions--.sh— syntax checksudo ./distractions--.sh— confirm the existing interactive zenity flow is unchangedsudo ./distractions--.sh --no-gui --duration 1m --preset social --yes— non-interactive activation; verifyPROGRESS:lines on stdout and that the block lifts after 1 minute./distractions_gui.py— GTK form → polkit prompt → activation → countdown viewblocklists.txt(or use the GUI's "Edit list..." button), then activate; verify the new domains end up in/etc/hostsblocklists.txtand run again; verify the embedded fallback still works🤖 Generated with Claude Code