mirror of
https://github.com/duma799/hyprduma-config.git
synced 2026-05-14 14:41:00 +00:00
Remove unnecessary comments
This commit is contained in:
@@ -1,19 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Extended pywal script with system-wide theme support
|
# pywal.sh - apply pywal colors
|
||||||
# Usage: ./pywal.sh [wallpaper_path] [light|dark]
|
# Usage: ./pywal.sh [wallpaper_path] [light|dark]
|
||||||
# Examples:
|
|
||||||
# ./pywal.sh ~/Pictures/wallpaper.jpg # Apply dark theme
|
|
||||||
# ./pywal.sh ~/Pictures/wallpaper.jpg light # Apply light theme
|
|
||||||
# ./pywal.sh # Just refresh themes (use existing wallpaper)
|
|
||||||
|
|
||||||
WALLPAPER="$1"
|
WALLPAPER="$1"
|
||||||
LIGHT_MODE="$2"
|
LIGHT_MODE="$2"
|
||||||
|
|
||||||
echo "Applying pywal colors system-wide..."
|
echo "Applying pywal colors..."
|
||||||
|
|
||||||
# Generate pywal colors
|
|
||||||
if [ -n "$WALLPAPER" ]; then
|
if [ -n "$WALLPAPER" ]; then
|
||||||
# New wallpaper provided
|
|
||||||
if [ "$LIGHT_MODE" = "-l" ] || [ "$LIGHT_MODE" = "light" ]; then
|
if [ "$LIGHT_MODE" = "-l" ] || [ "$LIGHT_MODE" = "light" ]; then
|
||||||
wal -i "$WALLPAPER" -l
|
wal -i "$WALLPAPER" -l
|
||||||
DARK_MODE=0
|
DARK_MODE=0
|
||||||
@@ -26,25 +20,20 @@ if [ -n "$WALLPAPER" ]; then
|
|||||||
echo "✓ Generated dark theme from wallpaper"
|
echo "✓ Generated dark theme from wallpaper"
|
||||||
fi
|
fi
|
||||||
elif [ "$LIGHT_MODE" = "light" ] || [ "$LIGHT_MODE" = "-l" ]; then
|
elif [ "$LIGHT_MODE" = "light" ] || [ "$LIGHT_MODE" = "-l" ]; then
|
||||||
# No wallpaper, just switch to light mode
|
|
||||||
wal -l
|
wal -l
|
||||||
DARK_MODE=0
|
DARK_MODE=0
|
||||||
GTK_THEME="prefer-light"
|
GTK_THEME="prefer-light"
|
||||||
echo "✓ Switched to light theme"
|
echo "✓ Switched to light theme"
|
||||||
elif [ "$LIGHT_MODE" = "dark" ]; then
|
elif [ "$LIGHT_MODE" = "dark" ]; then
|
||||||
# No wallpaper, just switch to dark mode
|
|
||||||
wal
|
wal
|
||||||
DARK_MODE=1
|
DARK_MODE=1
|
||||||
GTK_THEME="prefer-dark"
|
GTK_THEME="prefer-dark"
|
||||||
echo "✓ Switched to dark theme"
|
echo "✓ Switched to dark theme"
|
||||||
else
|
else
|
||||||
# No arguments, just refresh with existing colors
|
|
||||||
if [ -f ~/.cache/wal/wal ]; then
|
if [ -f ~/.cache/wal/wal ]; then
|
||||||
wal -R
|
wal -R
|
||||||
# Detect if current theme is light or dark
|
|
||||||
BG_COLOR=$(grep -oP 'background.*#\K[0-9A-Fa-f]{6}' ~/.cache/wal/colors.json | head -1)
|
BG_COLOR=$(grep -oP 'background.*#\K[0-9A-Fa-f]{6}' ~/.cache/wal/colors.json | head -1)
|
||||||
if [ -n "$BG_COLOR" ]; then
|
if [ -n "$BG_COLOR" ]; then
|
||||||
# Convert hex to decimal and check brightness
|
|
||||||
R=$((16#${BG_COLOR:0:2}))
|
R=$((16#${BG_COLOR:0:2}))
|
||||||
G=$((16#${BG_COLOR:2:2}))
|
G=$((16#${BG_COLOR:2:2}))
|
||||||
B=$((16#${BG_COLOR:4:2}))
|
B=$((16#${BG_COLOR:4:2}))
|
||||||
@@ -64,7 +53,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update Caelestia's wallpaper reference to match the one pywal used
|
# Caelestia wallpaper
|
||||||
if [ -f ~/.cache/wal/wal ]; then
|
if [ -f ~/.cache/wal/wal ]; then
|
||||||
WALLPAPER_PATH=$(cat ~/.cache/wal/wal)
|
WALLPAPER_PATH=$(cat ~/.cache/wal/wal)
|
||||||
mkdir -p ~/.local/state/caelestia/wallpaper
|
mkdir -p ~/.local/state/caelestia/wallpaper
|
||||||
@@ -73,14 +62,14 @@ if [ -f ~/.cache/wal/wal ]; then
|
|||||||
echo "✓ Caelestia wallpaper reference updated"
|
echo "✓ Caelestia wallpaper reference updated"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the generated Caelestia scheme to the proper location
|
# Caelestia colors
|
||||||
if [ -f ~/.cache/wal/caelestia-scheme.json ]; then
|
if [ -f ~/.cache/wal/caelestia-scheme.json ]; then
|
||||||
mkdir -p ~/.local/state/caelestia
|
mkdir -p ~/.local/state/caelestia
|
||||||
cp ~/.cache/wal/caelestia-scheme.json ~/.local/state/caelestia/scheme.json
|
cp ~/.cache/wal/caelestia-scheme.json ~/.local/state/caelestia/scheme.json
|
||||||
echo "✓ Caelestia colors updated"
|
echo "✓ Caelestia colors updated"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate GTK themes from PyWal colors
|
# GTK themes
|
||||||
if command -v wal-gtk &> /dev/null; then
|
if command -v wal-gtk &> /dev/null; then
|
||||||
wal-gtk
|
wal-gtk
|
||||||
echo "✓ GTK themes generated"
|
echo "✓ GTK themes generated"
|
||||||
@@ -88,14 +77,14 @@ else
|
|||||||
echo "ℹ wal-gtk not found - install 'wal-gtk-theme-git' for GTK theme support"
|
echo "ℹ wal-gtk not found - install 'wal-gtk-theme-git' for GTK theme support"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set GNOME/GTK dark mode preference (affects browsers and GTK apps)
|
# GTK dark/light mode
|
||||||
if command -v gsettings &> /dev/null; then
|
if command -v gsettings &> /dev/null; then
|
||||||
gsettings set org.gnome.desktop.interface color-scheme "$GTK_THEME" 2>/dev/null && \
|
gsettings set org.gnome.desktop.interface color-scheme "$GTK_THEME" 2>/dev/null && \
|
||||||
echo "✓ System dark mode preference set to: $GTK_THEME" || \
|
echo "✓ System dark mode preference set to: $GTK_THEME" || \
|
||||||
echo "ℹ Could not set GTK color scheme preference"
|
echo "ℹ Could not set GTK color scheme preference"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update Firefox theme via pywalfox
|
# Firefox
|
||||||
if command -v pywalfox &> /dev/null; then
|
if command -v pywalfox &> /dev/null; then
|
||||||
pywalfox update &>/dev/null &
|
pywalfox update &>/dev/null &
|
||||||
echo "✓ Firefox theme update triggered"
|
echo "✓ Firefox theme update triggered"
|
||||||
@@ -103,13 +92,13 @@ else
|
|||||||
echo "ℹ pywalfox not found - install 'python-pywalfox' for Firefox support"
|
echo "ℹ pywalfox not found - install 'python-pywalfox' for Firefox support"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload Hyprland configuration
|
# Hyprland
|
||||||
if command -v hyprctl &> /dev/null; then
|
if command -v hyprctl &> /dev/null; then
|
||||||
hyprctl reload
|
hyprctl reload
|
||||||
echo "✓ Hyprland configuration reloaded"
|
echo "✓ Hyprland configuration reloaded"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restart Caelestia shell to apply new colors
|
# Caelestia
|
||||||
if pgrep -x "caelestia" > /dev/null; then
|
if pgrep -x "caelestia" > /dev/null; then
|
||||||
pkill caelestia
|
pkill caelestia
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
@@ -117,7 +106,7 @@ if pgrep -x "caelestia" > /dev/null; then
|
|||||||
echo "✓ Caelestia shell restarted"
|
echo "✓ Caelestia shell restarted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reload all running Kitty instances
|
# Kitty
|
||||||
if command -v kitty &> /dev/null; then
|
if command -v kitty &> /dev/null; then
|
||||||
if pgrep -x "kitty" > /dev/null; then
|
if pgrep -x "kitty" > /dev/null; then
|
||||||
killall -SIGUSR1 kitty 2>/dev/null
|
killall -SIGUSR1 kitty 2>/dev/null
|
||||||
@@ -126,5 +115,5 @@ if command -v kitty &> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Done! Theme applied system-wide."
|
echo "Done!"
|
||||||
echo "Current mode: $([ "$DARK_MODE" = "1" ] && echo "Dark" || echo "Light")"
|
echo "Current mode: $([ "$DARK_MODE" = "1" ] && echo "Dark" || echo "Light")"
|
||||||
|
|||||||
Reference in New Issue
Block a user