Merge branch 'main' of github.com:Teoro01/hyprland-quickshell-gui
This commit is contained in:
@@ -5,7 +5,6 @@ import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import Qt.labs.folderlistmodel
|
||||
|
||||
|
||||
PanelWindow {
|
||||
id: picker
|
||||
implicitWidth: screen.width * 0.75
|
||||
@@ -104,6 +103,7 @@ PanelWindow {
|
||||
Process {
|
||||
id: wallpaperProcess
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/set-wallpaper.sh" + " " + model.filePath + " &"]
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/set-wallpaper.sh" + " " + model.filePath + " &"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
||||
}
|
||||
|
||||
@@ -2,9 +2,22 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Io
|
||||
import Qt.labs.folderlistmodel
|
||||
|
||||
|
||||
Item { // container, invisible
|
||||
id: wLoader
|
||||
|
||||
Process {
|
||||
id: generateThumbs
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/generate-wallpaper-thumbs.sh"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: wallpaperLoader
|
||||
active: false
|
||||
@@ -14,7 +27,9 @@ Item { // container, invisible
|
||||
GlobalShortcut {
|
||||
name: "Wallpaper"
|
||||
description: "Open wallpaper picker"
|
||||
|
||||
onPressed: {
|
||||
generateThumbs.startDetached()
|
||||
wallpaperLoader.active = !wallpaperLoader.active
|
||||
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
|
||||
}
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Folder with full-size wallpapers
|
||||
WALLPAPER_DIR="$HOME/Pictures/Wallpapers"
|
||||
|
||||
# Folder to store thumbnails
|
||||
THUMB_DIR="$HOME/.cache/wallpaper-thumbs"
|
||||
|
||||
if [ ! -d $THUMB_DIR ]; then
|
||||
mkdir -p $THUMB_DIR;
|
||||
fi
|
||||
|
||||
|
||||
# Make sure the thumb directory exists
|
||||
mkdir -p "$THUMB_DIR"
|
||||
|
||||
# Max width/height of the thumbnails
|
||||
MAX_DIM=300
|
||||
|
||||
# Process each image
|
||||
for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
||||
# Skip if no files match
|
||||
[ -e "$img" ] || continue
|
||||
|
||||
# Get just the filename
|
||||
fname=$(basename "$img")
|
||||
|
||||
# Output path
|
||||
thumb="$THUMB_DIR/$fname"
|
||||
|
||||
# If thumbnail already exists and is newer than the original, skip
|
||||
if [ -f "$thumb" ] && [ "$thumb" -nt "$img" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Generate thumbnail using ImageMagick
|
||||
magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb"
|
||||
done
|
||||
|
||||
echo "Thumbnails generated in $THUMB_DIR"
|
||||
|
||||
Process {
|
||||
id: generateThumbs
|
||||
command: ["sh", "-c", Quickshell.env("HOME") + "/.config/quickshell/modules/wp/generate-wallpaper-thumbs.sh" + " " + model.filePath + " &"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
||||
}
|
||||
}
|
||||
generateThumbs.startDetached()
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
# Path to the image is the first argument
|
||||
IMAGE="$1"
|
||||
image_name=$(basename "$IMAGE")
|
||||
image="$HOME/Pictures/Wallpapers/$image_name"
|
||||
|
||||
echo "$image"
|
||||
|
||||
echo "start"
|
||||
|
||||
@@ -11,17 +15,34 @@ if [[ -z "$IMAGE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if swww daemon is running
|
||||
if ! pgrep -x "swww-daemon" > /dev/null; then
|
||||
|
||||
if [ -x "/usr/bin/swww-daemon" ]; then
|
||||
echo "swww-daemon exists and is executable"
|
||||
|
||||
# Check if swww daemon is running
|
||||
if ! pgrep -x "swww-daemon" > /dev/null; then
|
||||
echo "Starting swww daemon..."
|
||||
swww-daemon &
|
||||
|
||||
# Give the daemon a moment to start
|
||||
sleep 0.2
|
||||
echo "daemon started"
|
||||
fi
|
||||
|
||||
# Set the wallpaper
|
||||
echo "running"
|
||||
swww img "$image" -t grow --transition-duration 1
|
||||
|
||||
elif [ -x "/usr/bin/hyprpaper" ]; then
|
||||
echo "hyprpaper exists and is executable"
|
||||
|
||||
if ! pgrep -x "hyprpaper" > /dev/null; then
|
||||
echo "Starting hyprpaper daemon..."
|
||||
hyprpaper &
|
||||
|
||||
# Give the daemon a moment to start
|
||||
sleep 0.2
|
||||
echo "daemon started"
|
||||
fi
|
||||
hyprctl hyprpaper wallpaper ", $image"
|
||||
fi
|
||||
|
||||
# Set the wallpaper
|
||||
echo "running"
|
||||
swww img "$IMAGE" -t grow --transition-duration 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user