feat: XDG Base Directory compliance, --uninstall flag, and xclip advisory
- Resolve all paths via $XDG_CONFIG_HOME, $XDG_DATA_HOME, and $XDG_RUNTIME_DIR with conventional fallbacks (~/.config, ~/.local/share, /tmp); BIN_DIR stays ~/.local/bin (no XDG standard) - Add --uninstall: removes symlink, desktop entry, and data dir with colored per-step output; prompts to remove config when interactive, skips silently when not; post-run verification reports any failures - Warn in --check-deps and --install when only xclip is present — xclip operates through XWayland and can be unreliable on Wayland - Normalize dependency messages to package names (wl-clipboard, xclip) - Update README: XDG paths in install steps, --uninstall in usage, xclip advisory in prerequisites - Fix test sandbox: export XDG_CONFIG_HOME and XDG_DATA_HOME so the overridden HOME is respected; add install (test 15) and uninstall (test 16) coverage; add cp and ln to mocked tool set
This commit is contained in:
@@ -25,7 +25,7 @@ These are mandatory for the script to run and perform basic color conversions:
|
||||
These enable specific functionality and can be installed as needed:
|
||||
- **KDE Plasma (Wayland):** Required for screen color picking (`--pick`).
|
||||
- **Python 3 PyQt6:** Required for the KDE color picker DBus interface.
|
||||
- **wl-clipboard** or **xclip:** Enables copying results to the system clipboard (`--copy`).
|
||||
- **wl-clipboard** or **xclip:** Enables copying results to the system clipboard (`--copy`). `wl-clipboard` is strongly preferred on Wayland — `xclip` operates through XWayland and can be unreliable. `--check-deps` and `--install` will warn you if only `xclip` is found.
|
||||
- **curl:** Required for fetching human-readable color names from the web (`--name`).
|
||||
- **libnotify:** Enables desktop notifications (`--notify`).
|
||||
- **ImageMagick:** Generates visual color swatch icons for notifications (`--swatch`).
|
||||
@@ -45,10 +45,10 @@ curl -sSLO https://git.rootiest.dev/rootiest/color-tool/releases/download/latest
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Install the script to `~/.local/share/color-tool/`.
|
||||
1. Install the script to `$XDG_DATA_HOME/color-tool/` (default: `~/.local/share/color-tool/`).
|
||||
2. Symlink the binary to `~/.local/bin/color-tool`.
|
||||
3. Generate a sample configuration at `~/.config/color-tool/config.toml`.
|
||||
4. Create a `.desktop` entry so you can launch the picker from your application menu.
|
||||
3. Generate a sample configuration at `$XDG_CONFIG_HOME/color-tool/config.toml` (default: `~/.config/color-tool/config.toml`).
|
||||
4. Create a `.desktop` entry in `$XDG_DATA_HOME/applications/` so you can launch the picker from your application menu.
|
||||
5. Verify and warn about any missing optional or required system dependencies.
|
||||
6. Clean up the downloaded script after installation.
|
||||
|
||||
@@ -85,7 +85,7 @@ Options:
|
||||
--set-config Update the configuration (e.g. --set-config desktop --copy)
|
||||
--reset-config Restore the configuration file to its default values
|
||||
--check-deps Check system dependencies and environment support
|
||||
--install Install to ~/.local/share/ and symlink to ~/.local/bin/
|
||||
--install Install to $XDG_DATA_HOME/color-tool/ and symlink to ~/.local/bin/
|
||||
--help, -h Show this help message
|
||||
```
|
||||
|
||||
@@ -113,7 +113,7 @@ color-tool --desktop --no-name
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
You can define your preferred defaults in `~/.config/color-tool/config.toml`. The tool uses a priority hierarchy: **CLI Flags > Desktop Config > Default Config**.
|
||||
You can define your preferred defaults in `$XDG_CONFIG_HOME/color-tool/config.toml` (default: `~/.config/color-tool/config.toml`). The tool uses a priority hierarchy: **CLI Flags > Desktop Config > Default Config**.
|
||||
|
||||
```toml
|
||||
[defaults]
|
||||
|
||||
Reference in New Issue
Block a user