mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
33
.config/quickshell/nucleus-shell/scripts/interface/changebg.sh
Executable file
33
.config/quickshell/nucleus-shell/scripts/interface/changebg.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
START_DIR="$HOME/Pictures/Wallpapers"
|
||||
|
||||
# Get monitor list (Wayland/Hyprland/Qtile etc. usually expose via xrandr or hyprctl)
|
||||
MONITORS=$(xrandr --query | grep " connected" | cut -d" " -f1)
|
||||
|
||||
# Convert monitors into Zenity list arguments
|
||||
LIST_ARGS=()
|
||||
for m in $MONITORS; do
|
||||
LIST_ARGS+=("$m")
|
||||
done
|
||||
|
||||
DISPLAY=$(zenity --list \
|
||||
--title="Select Display" \
|
||||
--column="Monitor" \
|
||||
"${LIST_ARGS[@]}" \
|
||||
--height=300 \
|
||||
--width=300 2>/dev/null)
|
||||
|
||||
# User cancelled
|
||||
[ -z "$DISPLAY" ] && echo "null" && exit
|
||||
|
||||
FILE=$(zenity --file-selection \
|
||||
--title="Select Wallpaper for $DISPLAY" \
|
||||
--filename="$START_DIR/" \
|
||||
--file-filter="Images/Videos | *.png *.jpg *.jpeg *.webp *.bmp *.svg *.mp4 *.mkv *.webm *.mov *.avi *.m4v" \
|
||||
2>/dev/null)
|
||||
|
||||
[ -z "$FILE" ] && echo "null" && exit
|
||||
|
||||
# Output format: monitor|wallpaper
|
||||
echo "$DISPLAY|file://$FILE"
|
||||
66
.config/quickshell/nucleus-shell/scripts/interface/gencolors.sh
Executable file
66
.config/quickshell/nucleus-shell/scripts/interface/gencolors.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
# ~/config/quickshell/scripts/background/gencolors.sh
|
||||
# Generate Matugen color scheme for a given wallpaper
|
||||
|
||||
USER_WIDE=false
|
||||
|
||||
# Parse flags
|
||||
while [[ "$1" == --* ]]; do
|
||||
case "$1" in
|
||||
--user-wide)
|
||||
USER_WIDE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown flag: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
WALLPAPER_PATH="$1"
|
||||
SCHEME_TYPE="$2"
|
||||
SCHEME_MODE="$3"
|
||||
CONFIG_PATH="$4"
|
||||
|
||||
# Validate required arguments
|
||||
if [[ -z "$WALLPAPER_PATH" || "$WALLPAPER_PATH" == "null" ]]; then
|
||||
echo "Error: no wallpaper provided" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
: "${SCHEME_TYPE:?Error: scheme type not provided}"
|
||||
: "${SCHEME_MODE:?Error: scheme mode not provided}"
|
||||
|
||||
# Strip file:// prefix if present
|
||||
if [[ "$WALLPAPER_PATH" == file://* ]]; then
|
||||
WALLPAPER_PATH="${WALLPAPER_PATH#file://}"
|
||||
fi
|
||||
|
||||
if ! $USER_WIDE; then
|
||||
if [[ -z "$CONFIG_PATH" || ! -f "$CONFIG_PATH" ]]; then
|
||||
echo "Error: config file not found: $CONFIG_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
run_with_config() {
|
||||
matugen --config "$CONFIG_PATH" \
|
||||
image "$WALLPAPER_PATH" \
|
||||
--type "$SCHEME_TYPE" \
|
||||
--mode "$SCHEME_MODE"
|
||||
}
|
||||
|
||||
run_without_config() {
|
||||
matugen image "$WALLPAPER_PATH" \
|
||||
--type "$SCHEME_TYPE" \
|
||||
--mode "$SCHEME_MODE"
|
||||
}
|
||||
|
||||
if $USER_WIDE; then
|
||||
run_with_config
|
||||
run_without_config
|
||||
else
|
||||
run_with_config
|
||||
fi
|
||||
24
.config/quickshell/nucleus-shell/scripts/interface/selectfolder.sh
Executable file
24
.config/quickshell/nucleus-shell/scripts/interface/selectfolder.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Folder selector for wallpaper slideshow
|
||||
|
||||
START_DIR="${1:-$HOME/Pictures/Wallpapers}"
|
||||
|
||||
# Ensure start dir exists, fallback to Pictures or Home
|
||||
if [ ! -d "$START_DIR" ]; then
|
||||
START_DIR="$HOME/Pictures"
|
||||
fi
|
||||
if [ ! -d "$START_DIR" ]; then
|
||||
START_DIR="$HOME"
|
||||
fi
|
||||
|
||||
FOLDER=$(zenity --file-selection \
|
||||
--directory \
|
||||
--title="Select Wallpaper Folder" \
|
||||
--filename="$START_DIR/" 2>/dev/null)
|
||||
|
||||
if [ $? -eq 0 ] && [ -n "$FOLDER" ]; then
|
||||
echo "$FOLDER"
|
||||
else
|
||||
echo "null"
|
||||
fi
|
||||
37
.config/quickshell/nucleus-shell/scripts/interface/switchTheme.sh
Executable file
37
.config/quickshell/nucleus-shell/scripts/interface/switchTheme.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
THEME_NAME="${1:-}"
|
||||
|
||||
THEME_DIR="$HOME/.config/nucleus-shell/colorschemes"
|
||||
TARGET="$HOME/.config/nucleus-shell/config/colors.json"
|
||||
|
||||
if [[ -z "$THEME_NAME" ]]; then
|
||||
echo "Usage: switch-theme.sh <theme-name | auto>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# === AUTOGENERATED THEME ===
|
||||
if [[ "$THEME_NAME" == "auto" || "$THEME_NAME" == "autogen" ]]; then
|
||||
echo "Generating theme via Quickshell IPC…"
|
||||
|
||||
qs -c nucleus-shell ipc call global regenColors
|
||||
|
||||
echo "Autogenerated theme applied"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# === STATIC THEME ===
|
||||
SOURCE="$THEME_DIR/$THEME_NAME.json"
|
||||
|
||||
if [[ ! -f "$SOURCE" ]]; then
|
||||
echo "Theme not found: $THEME_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Atomic write
|
||||
tmp="$(mktemp)"
|
||||
cat "$SOURCE" > "$tmp"
|
||||
mv "$tmp" "$TARGET"
|
||||
|
||||
echo "Theme switched to: $THEME_NAME"
|
||||
Reference in New Issue
Block a user