refactor: move scripts to dedicated directory

This commit is contained in:
duma799
2026-03-22 23:58:28 +04:00
parent b9a9752e9f
commit fd8299fd76
5 changed files with 71 additions and 53 deletions
+11 -12
View File
@@ -26,9 +26,8 @@ ls ~/.config/wal/templates/
### 2. Install Scripts ### 2. Install Scripts
```bash ```bash
cp pywal.sh ~/.config/hypr/ cp pywal.sh ~/.config/hypr/scripts/
cp pywal.sh ~/pywal.sh chmod +x ~/.config/hypr/scripts/pywal.sh
chmod +x ~/.config/hypr/pywal.sh ~/pywal.sh
``` ```
### 3. Configure Kitty Terminal ### 3. Configure Kitty Terminal
@@ -57,7 +56,7 @@ source ~/.cache/wal/colors-tty.sh 2>/dev/null
### 5. Generate Initial Colors ### 5. Generate Initial Colors
```bash ```bash
wal -i wallpapers/sakura.jpg && ~/pywal.sh wal -i wallpapers/sakura.jpg && pywal
source ~/.bashrc source ~/.bashrc
``` ```
@@ -71,14 +70,14 @@ Press `Super+W` to open waypaper. Select a wallpaper and colors auto-apply via t
```bash ```bash
# Dark theme (default) # Dark theme (default)
~/pywal.sh ~/Pictures/wallpaper.jpg pywal ~/Pictures/wallpaper.jpg
# Light theme # Light theme
~/pywal.sh ~/Pictures/wallpaper.jpg light pywal ~/Pictures/wallpaper.jpg light
# Switch mode (keep current wallpaper) # Switch mode (keep current wallpaper)
~/pywal.sh "" light pywal "" light
~/pywal.sh "" dark pywal "" dark
# Refresh current theme # Refresh current theme
~/pywal.sh ~/pywal.sh
@@ -87,7 +86,7 @@ Press `Super+W` to open waypaper. Select a wallpaper and colors auto-apply via t
### One-Liner ### One-Liner
```bash ```bash
wal -i /path/to/wallpaper.png && ~/pywal.sh wal -i /path/to/wallpaper.png && pywal
``` ```
## Light/Dark Theme ## Light/Dark Theme
@@ -97,13 +96,13 @@ wal -i /path/to/wallpaper.png && ~/pywal.sh
Works best with bright wallpapers: Works best with bright wallpapers:
```bash ```bash
wal -i /path/to/bright-wallpaper.png -l && ~/pywal.sh wal -i /path/to/bright-wallpaper.png -l && pywal
``` ```
### Dark Theme (Default) ### Dark Theme (Default)
```bash ```bash
wal -i /path/to/dark-wallpaper.png && ~/pywal.sh wal -i /path/to/dark-wallpaper.png && pywal
``` ```
### Backend Options ### Backend Options
@@ -232,7 +231,7 @@ Run `wal -i /path/to/wallpaper.png` once to generate initial colors before start
rm -rf ~/.cache/wal rm -rf ~/.cache/wal
mkdir -p ~/.config/wal/templates mkdir -p ~/.config/wal/templates
cp ~/.config/hypr/wal/templates/* ~/.config/wal/templates/ cp ~/.config/hypr/wal/templates/* ~/.config/wal/templates/
wal -i /path/to/wallpaper.png && ~/pywal.sh wal -i /path/to/wallpaper.png && pywal
source ~/.bashrc source ~/.bashrc
``` ```
+17 -16
View File
@@ -103,7 +103,7 @@ cd hyprduma-config
# Install Hyprland config # Install Hyprland config
mkdir -p ~/.config/hypr mkdir -p ~/.config/hypr
cp hyprland.conf ~/.config/hypr/ cp hyprland.conf ~/.config/hypr/
cp -r wallpapers ~/.config/hypr/ cp -r wallpapers ~/wallpapers
mkdir -p ~/Pictures/Screenshots mkdir -p ~/Pictures/Screenshots
``` ```
@@ -111,12 +111,13 @@ mkdir -p ~/Pictures/Screenshots
```bash ```bash
# Copy all scripts # Copy all scripts
cp pywal.sh sync-caelestia-wallpaper.sh waypaper-hook.sh ~/.config/hypr/ mkdir -p ~/.config/hypr/scripts
cp monitor-handler.py ~/.config/hypr/ cp pywal.sh sync-caelestia-wallpaper.sh waypaper-hook.sh ~/.config/hypr/scripts/
chmod +x ~/.config/hypr/pywal.sh ~/.config/hypr/sync-caelestia-wallpaper.sh ~/.config/hypr/waypaper-hook.sh cp monitor-handler.py ~/.config/hypr/scripts/
chmod +x ~/.config/hypr/scripts/*.sh
# Copy pywal.sh to home for convenience # Note: The script aliases 'pywal' to ~/.config/hypr/scripts/pywal.sh
cp pywal.sh ~/pywal.sh && chmod +x ~/pywal.sh # To set it up manually: echo "alias pywal='~/.config/hypr/scripts/pywal.sh'" >> ~/.bashrc
``` ```
### Step 5: Configure Your Applications ### Step 5: Configure Your Applications
@@ -155,7 +156,7 @@ source ~/.cache/wal/colors-tty.sh 2>/dev/null
EOF EOF
# Generate initial colors # Generate initial colors
wal -i wallpapers/sakura.jpg && ~/pywal.sh wal -i ~/wallpapers/sakura.jpg && pywal
source ~/.bashrc source ~/.bashrc
``` ```
@@ -167,7 +168,7 @@ The waypaper hook automatically applies pywal colors whenever you change wallpap
# Set waypaper-hook.sh as waypaper's post_command # Set waypaper-hook.sh as waypaper's post_command
mkdir -p ~/.config/waypaper mkdir -p ~/.config/waypaper
# Add to ~/.config/waypaper/config.ini under [Settings]: # Add to ~/.config/waypaper/config.ini under [Settings]:
# post_command = /home/YOUR_USER/.config/hypr/waypaper-hook.sh # post_command = ~/.config/hypr/scripts/waypaper-hook.sh
``` ```
### Step 8: Install Fastfetch Config (Optional) ### Step 8: Install Fastfetch Config (Optional)
@@ -201,7 +202,7 @@ Hyprland
**Using command line:** **Using command line:**
```bash ```bash
wal -i /path/to/wallpaper.png && ~/pywal.sh wal -i /path/to/wallpaper.png && pywal
``` ```
**How wallpaper management works:** **How wallpaper management works:**
@@ -216,10 +217,10 @@ wal -i /path/to/wallpaper.png && ~/pywal.sh
The `pywal.sh` script supports dark/light mode and system-wide theme synchronization (GTK, Firefox, Qt). See **[PYWAL-SETUP.md](PYWAL-SETUP.md)** for the full guide including optional enhancements, light/dark theme switching, and backend options. The `pywal.sh` script supports dark/light mode and system-wide theme synchronization (GTK, Firefox, Qt). See **[PYWAL-SETUP.md](PYWAL-SETUP.md)** for the full guide including optional enhancements, light/dark theme switching, and backend options.
```bash ```bash
~/pywal.sh ~/Pictures/wallpaper.jpg # Dark theme (default) pywal ~/Pictures/wallpaper.jpg # Dark theme (default)
~/pywal.sh ~/Pictures/wallpaper.jpg light # Light theme pywal ~/Pictures/wallpaper.jpg light # Light theme
~/pywal.sh "" dark # Switch mode, keep wallpaper pywal "" dark # Switch mode, keep wallpaper
~/pywal.sh # Refresh current theme pywal # Refresh current theme
``` ```
### Monitor Configuration ### Monitor Configuration
@@ -308,7 +309,7 @@ hyprduma-config/
2. **Regenerate colors:** 2. **Regenerate colors:**
```bash ```bash
wal -R && ~/pywal.sh wal -R && pywal
``` ```
3. **Check bash configuration:** 3. **Check bash configuration:**
@@ -351,9 +352,9 @@ hyprduma-config/
``` ```
**General pywal troubleshooting:** **General pywal troubleshooting:**
- Ensure the script is executable: `chmod +x ~/pywal.sh` - Ensure the script is executable: `chmod +x ~/.config/hypr/scripts/pywal.sh`
- Check if pywal cache exists: `ls ~/.cache/wal/` - Check if pywal cache exists: `ls ~/.cache/wal/`
- Manually reload: `~/pywal.sh` - Manually reload: `pywal`
### Caelestia colors not updating ### Caelestia colors not updating
```bash ```bash
+2 -2
View File
@@ -18,9 +18,9 @@ workspace = 10, monitor:eDP-1
# Autostart # Autostart
exec-once = waypaper --restore exec-once = waypaper --restore
exec-once = sleep 1 && ~/.config/hypr/sync-caelestia-wallpaper.sh exec-once = sleep 1 && ~/.config/hypr/scripts/sync-caelestia-wallpaper.sh
exec-once = sleep 1 && caelestia shell -d exec-once = sleep 1 && caelestia shell -d
exec-once = python3 ~/.config/hypr/monitor-handler.py exec-once = python3 ~/.config/hypr/scripts/monitor-handler.py
exec-once = hyprctl setcursor Adwaita 24 exec-once = hyprctl setcursor Adwaita 24
exec-once = mkdir -p $HOME/Pictures/Screenshots exec-once = mkdir -p $HOME/Pictures/Screenshots
+41 -20
View File
@@ -37,6 +37,7 @@ PACMAN_PACKAGES = [
"adwaita-cursors", "adwaita-cursors",
"python-pywal", "python-pywal",
"fastfetch", "fastfetch",
"neovim",
] ]
@@ -232,7 +233,7 @@ def backup_configs():
config = Path.home() / ".config" config = Path.home() / ".config"
backed_up = [] backed_up = []
for name in ["hypr", "waybar", "wlogout", "waypaper"]: for name in ["hypr", "waybar", "wlogout", "waypaper", "nvim", "fastfetch"]:
src = config / name src = config / name
dst = config / f"{name}.backup" dst = config / f"{name}.backup"
if src.exists() and not src.is_symlink(): if src.exists() and not src.is_symlink():
@@ -260,13 +261,13 @@ def install_hypr_config(repo):
print_ok(f"Created {screenshots}") print_ok(f"Created {screenshots}")
wallpapers_src = repo / "wallpapers" wallpapers_src = repo / "wallpapers"
wallpapers_dst = hypr_dir / "wallpapers" wallpapers_dst = Path.home() / "wallpapers"
if wallpapers_src.exists(): if wallpapers_src.exists():
if wallpapers_dst.exists(): if wallpapers_dst.exists():
shutil.rmtree(wallpapers_dst) shutil.rmtree(wallpapers_dst)
shutil.copytree(str(wallpapers_src), str(wallpapers_dst)) shutil.copytree(str(wallpapers_src), str(wallpapers_dst))
count = len(list(wallpapers_dst.iterdir())) count = len(list(wallpapers_dst.iterdir()))
print_ok(f"Copied {count} wallpapers to ~/.config/hypr/wallpapers/") print_ok(f"Copied {count} wallpapers to ~/wallpapers/")
def install_pywal(repo): def install_pywal(repo):
@@ -286,6 +287,8 @@ def install_pywal(repo):
print_err("config/wal/templates not found in repo") print_err("config/wal/templates not found in repo")
# Scripts # Scripts
scripts_dir = hypr_dir / "scripts"
scripts_dir.mkdir(parents=True, exist_ok=True)
for script in [ for script in [
"pywal.sh", "pywal.sh",
"sync-caelestia-wallpaper.sh", "sync-caelestia-wallpaper.sh",
@@ -293,14 +296,14 @@ def install_pywal(repo):
"monitor-handler.py", "monitor-handler.py",
]: ]:
src = repo / "scripts" / script src = repo / "scripts" / script
dst = hypr_dir / script dst = scripts_dir / script
if src.exists(): if src.exists():
shutil.copy2(str(src), str(dst)) shutil.copy2(str(src), str(dst))
dst.chmod(0o755) dst.chmod(0o755)
print_ok("Copied scripts to ~/.config/hypr/") print_ok("Copied scripts to ~/.config/hypr/scripts/")
# Waypaper hook # Waypaper hook
hook_cmd = str(hypr_dir / "waypaper-hook.sh") hook_cmd = str(scripts_dir / "waypaper-hook.sh")
waypaper_config_dir = home / ".config" / "waypaper" waypaper_config_dir = home / ".config" / "waypaper"
waypaper_config_dir.mkdir(parents=True, exist_ok=True) waypaper_config_dir.mkdir(parents=True, exist_ok=True)
waypaper_ini = waypaper_config_dir / "config.ini" waypaper_ini = waypaper_config_dir / "config.ini"
@@ -330,11 +333,7 @@ def install_pywal(repo):
config.write(f) config.write(f)
print_ok("Registered waypaper-hook.sh as waypaper post_command") print_ok("Registered waypaper-hook.sh as waypaper post_command")
# pywal.sh in home # pywal.sh is already in ~/.config/hypr/scripts/pywal.sh
home_pywal = home / "pywal.sh"
shutil.copy2(str(repo / "scripts" / "pywal.sh"), str(home_pywal))
home_pywal.chmod(0o755)
print_ok("Copied pywal.sh to ~/pywal.sh")
# Kitty # Kitty
kitty_dir = home / ".config" / "kitty" kitty_dir = home / ".config" / "kitty"
@@ -362,16 +361,18 @@ def install_pywal(repo):
"(cat ~/.cache/wal/sequences &)\n" "(cat ~/.cache/wal/sequences &)\n"
"\n# To add support for TTYs (optional)\n" "\n# To add support for TTYs (optional)\n"
"source ~/.cache/wal/colors-tty.sh 2>/dev/null\n" "source ~/.cache/wal/colors-tty.sh 2>/dev/null\n"
"\n# Alias for pywal color generator\n"
"alias pywal='~/.config/hypr/scripts/pywal.sh'\n"
) )
with open(bashrc, "a") as f: with open(bashrc, "a") as f:
f.write(snippet) f.write(snippet)
print_ok("Added pywal integration to ~/.bashrc") print_ok("Added pywal integration and alias to ~/.bashrc")
# Initial colors # Initial colors
wallpaper = hypr_dir / "wallpapers" / "sakura.jpg" wallpaper = Path.home() / "wallpapers" / "sakura.jpg"
if not wallpaper.exists(): if not wallpaper.exists():
# Fallback # Fallback
wp_dir = hypr_dir / "wallpapers" wp_dir = Path.home() / "wallpapers"
if wp_dir.exists(): if wp_dir.exists():
for ext in ("*.jpg", "*.png", "*.jpeg"): for ext in ("*.jpg", "*.png", "*.jpeg"):
found = list(wp_dir.glob(ext)) found = list(wp_dir.glob(ext))
@@ -384,19 +385,19 @@ def install_pywal(repo):
run(f'wal -i {shlex.quote(str(wallpaper))}') run(f'wal -i {shlex.quote(str(wallpaper))}')
print_ok("Generated initial pywal color scheme") print_ok("Generated initial pywal color scheme")
pywal_script = home / "pywal.sh" pywal_script = scripts_dir / "pywal.sh"
if pywal_script.exists(): if pywal_script.exists():
if run(f'bash {shlex.quote(str(pywal_script))}'): if run(f'bash {shlex.quote(str(pywal_script))}'):
print_ok("Applied pywal colors to all components") print_ok("Applied pywal colors to all components")
else: else:
print_warn("pywal.sh had errors (normal if Hyprland isn't running yet)") print_warn("pywal script had errors (normal if Hyprland isn't running yet)")
elif not cmd_exists("wal"): elif not cmd_exists("wal"):
print_warn( print_warn(
"pywal (wal) not found - install python-pywal and run: wal -i <wallpaper> && ~/pywal.sh" "pywal (wal) not found - install python-pywal and run: wal -i <wallpaper> && pywal"
) )
else: else:
print_warn( print_warn(
"No wallpaper found - run manually: wal -i <wallpaper> && ~/pywal.sh" "No wallpaper found - run manually: wal -i <wallpaper> && pywal"
) )
@@ -429,6 +430,26 @@ def install_fastfetch_config(repo):
print_ok("Installed fastfetch config to ~/.config/fastfetch/") print_ok("Installed fastfetch config to ~/.config/fastfetch/")
def install_nvim_config(repo):
home = Path.home()
nvim_src = repo / "config" / "nvim"
if not nvim_src.exists():
print_warn("nvim/ directory not found in repo - skipping")
return
if not ask_yn("Install Neovim config?"):
print_warn("Skipping Neovim config")
return
nvim_dst = home / ".config" / "nvim"
if nvim_dst.exists():
shutil.rmtree(str(nvim_dst))
shutil.copytree(str(nvim_src), str(nvim_dst))
print_ok("Installed Neovim config to ~/.config/nvim/")
def print_banner(): def print_banner():
print(f"""{CYAN}{BOLD} print(f"""{CYAN}{BOLD}
@@ -456,7 +477,7 @@ def print_post_install():
Or if already running, reload with: {BOLD}SUPER + SHIFT + R{RESET} Or if already running, reload with: {BOLD}SUPER + SHIFT + R{RESET}
{CYAN}4.{RESET} Change wallpaper + colors anytime: {CYAN}4.{RESET} Change wallpaper + colors anytime:
$ wal -i ~/path/to/wallpaper.jpg && ~/pywal.sh $ wal -i ~/path/to/wallpaper.jpg && pywal
Or use waypaper GUI ({BOLD}SUPER + W{RESET}) - colors auto-apply via hook Or use waypaper GUI ({BOLD}SUPER + W{RESET}) - colors auto-apply via hook
{CYAN}5.{RESET} Try {BOLD}fastfetch{RESET} in your terminal to see system info with custom styling {CYAN}5.{RESET} Try {BOLD}fastfetch{RESET} in your terminal to see system info with custom styling
@@ -471,7 +492,7 @@ def main():
check_arch() check_arch()
total = 8 total = 9
step = 0 step = 0
step += 1 step += 1
-3
View File
@@ -34,9 +34,6 @@ if [ -f "$WALLPAPER" ]; then
# Resolve pywal.sh location (same directory as this hook, or ~/pywal.sh) # Resolve pywal.sh location (same directory as this hook, or ~/pywal.sh)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PYWAL_SCRIPT="$SCRIPT_DIR/pywal.sh" PYWAL_SCRIPT="$SCRIPT_DIR/pywal.sh"
if [ ! -f "$PYWAL_SCRIPT" ]; then
PYWAL_SCRIPT="$HOME/pywal.sh"
fi
if [ -f "$PYWAL_SCRIPT" ]; then if [ -f "$PYWAL_SCRIPT" ]; then
bash "$PYWAL_SCRIPT" "$WALLPAPER" >> "$LOG_FILE" 2>&1 bash "$PYWAL_SCRIPT" "$WALLPAPER" >> "$LOG_FILE" 2>&1