Merge branch 'main' of github.com:Teoro01/hyprland-quickshell-gui
This commit is contained in:
@@ -14,6 +14,23 @@ PanelWindow {
|
||||
visible: true
|
||||
focusable: true
|
||||
|
||||
FocusScope {
|
||||
id: pickerScope
|
||||
focus: true
|
||||
|
||||
Keys.onReleased: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
console.log("Pressed Escape, closing Wallpaper Picker")
|
||||
wallpaperLoader.active = false
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "lightblue"
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 10
|
||||
@@ -42,11 +59,22 @@ PanelWindow {
|
||||
background: Rectangle {
|
||||
|
||||
radius: 12
|
||||
color: "#2b2b2b"
|
||||
color: filterText.activeFocus ? Colors.tertiary_fg : Colors.primary_fg
|
||||
border.color: filterText.activeFocus ? Colors.tertiary : Colors.primary
|
||||
border.width: 1
|
||||
}
|
||||
|
||||
Keys.onReleased: {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
console.log("Escape pressed inside TextField")
|
||||
console.log("Pressed Escape, closing Wallpaper Picker")
|
||||
// wallpaperLoader.active = false
|
||||
filterText.text = ""
|
||||
filterText.focus = false
|
||||
event.accepted = true
|
||||
pickerScope.focus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ Item { // container, invisible
|
||||
onPressed: {
|
||||
// generateThumbs.startDetached()
|
||||
generateThumbs.running = true
|
||||
wallpaperLoader.active = !wallpaperLoader.active
|
||||
console.log("Pressed Meta+Shift+W (Hyprland global shortcut)")
|
||||
wallpaperLoader.active = !wallpaperLoader.active
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ if [ ! -d $THUMB_DIR ]; then
|
||||
mkdir -p $THUMB_DIR;
|
||||
fi
|
||||
|
||||
|
||||
shopt -s nullglob
|
||||
files=( "$THUMB_DIR"/*.jpg "$THUMB_DIR"/*.jpeg "$THUMB_DIR"/*.png )
|
||||
# printf ' %s\n' "${files[@]}"
|
||||
# Make sure the thumb directory exists
|
||||
mkdir -p "$THUMB_DIR"
|
||||
|
||||
@@ -19,6 +21,28 @@ MAX_DIM=300
|
||||
|
||||
num=0
|
||||
|
||||
remove_from_array() {
|
||||
local -n arr=$1
|
||||
local elem=$2
|
||||
local result=()
|
||||
|
||||
# echo "=== Removing element: '$elem' ==="
|
||||
# echo "Original array has ${#arr[@]} elements"
|
||||
|
||||
for item in "${arr[@]}"; do
|
||||
if [[ "$item" != "$elem" ]]; then
|
||||
result+=( "$item" )
|
||||
# echo "Keeping: '$item'"
|
||||
# else
|
||||
# echo "Removing: '$item'"
|
||||
fi
|
||||
done
|
||||
|
||||
arr=( "${result[@]}" )
|
||||
# echo "New array has ${#arr[@]} elements"
|
||||
# echo "-----------------------------------"
|
||||
}
|
||||
|
||||
# Process each image
|
||||
for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
||||
# Skip if no files match
|
||||
@@ -26,19 +50,44 @@ for img in "$WALLPAPER_DIR"/*.{jpg,jpeg,png}; do
|
||||
|
||||
# Get just the filename
|
||||
fname=$(basename "$img")
|
||||
name="${fname%.*}"
|
||||
ext="${fname##*.}"
|
||||
|
||||
# no magick file:
|
||||
temp_image_name="$THUMB_DIR/${name}_tmp.${ext}"
|
||||
|
||||
# Output path
|
||||
thumb="$THUMB_DIR/$fname"
|
||||
|
||||
|
||||
# If thumbnail already exists and is newer than the original, skip
|
||||
if [ -f "$thumb" ] && [ "$thumb" -nt "$img" ]; then
|
||||
remove_from_array files "$thumb"
|
||||
continue
|
||||
fi
|
||||
|
||||
num+=1
|
||||
|
||||
# Generate thumbnail using ImageMagick
|
||||
magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb"
|
||||
if [ -x "/usr/bin/magick" ]; then
|
||||
magick "$img" -resize "${MAX_DIM}x${MAX_DIM}" "$thumb"
|
||||
rm $temp_image_name
|
||||
else
|
||||
if [ -f "$temp_image_name" ] && [ "$temp_image_name" -nt "$img" ]; then
|
||||
continue
|
||||
fi
|
||||
cp $img $temp_image_name
|
||||
fi
|
||||
remove_from_array files "$thumb"
|
||||
done
|
||||
|
||||
# echo ""
|
||||
|
||||
# printf ' %s\n' "${files[@]}"
|
||||
|
||||
for img in $files; do
|
||||
# echo "$img"
|
||||
rm $img
|
||||
done
|
||||
|
||||
echo "$num Thumbnails generated in $THUMB_DIR"
|
||||
@@ -42,10 +42,15 @@ elif [ -x "/usr/bin/hyprpaper" ]; then
|
||||
sleep 0.2
|
||||
echo "daemon started"
|
||||
fi
|
||||
sed -i "3s|path = .*|path = ${image}|" ~/.config/hypr/hyprpaper.conf
|
||||
hyprctl hyprpaper wallpaper ", $image"
|
||||
fi
|
||||
|
||||
matugen image $image --mode dark
|
||||
if [ -x "/usr/bin/matugen" ]; then
|
||||
matugen image $image --mode dark
|
||||
else
|
||||
cp $HOME/.config/quickshell/colors/example_colors.qml $HOME/.config/quickshell/colors/Colors.qml
|
||||
fi
|
||||
|
||||
### Blured Wallpaper for wlogout
|
||||
blur="50x30"
|
||||
@@ -61,6 +66,14 @@ echo "$image" > $current_wallpaper
|
||||
|
||||
blurred_wp="$static_wallpaper_dir/blurred.jpg"
|
||||
|
||||
magick $image -blur $blur $blurred_wp
|
||||
if [ -x "/usr/bin/sddm" ]; then
|
||||
magick $image -blur $blur $blurred_wp
|
||||
else
|
||||
cp $image $blurred_wp
|
||||
fi
|
||||
if [ -x "/usr/bin/sddm" ] && [ -d "/usr/share/backgrounds" ]; then
|
||||
sddm_background="/usr/share/backgrounds/background.jpg"
|
||||
cp "$image" "$sddm_background"
|
||||
fi
|
||||
|
||||
echo "test"
|
||||
|
||||
Reference in New Issue
Block a user