From 3155ccd9c922fc9aa501d5a06376b449baab6e21 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sat, 26 Apr 2025 22:55:06 -0300 Subject: [PATCH] hypr: update configuration, use new wallpaper menu, fix hyprlock bind --- hypr/hyprsunset.conf | 2 +- hypr/scripts/change-wallpaper.sh | 46 +++++++++++++++++--------------- hypr/scripts/clipboard-menu.sh | 2 +- hypr/scripts/screenshot.sh | 24 +++++++++++++++++ hypr/shell/bindings.conf | 8 +++--- hypr/shell/environment.conf | 2 +- hypr/user/decorations.conf | 2 ++ 7 files changed, 58 insertions(+), 28 deletions(-) create mode 100644 hypr/scripts/screenshot.sh diff --git a/hypr/hyprsunset.conf b/hypr/hyprsunset.conf index e274053..094cfb6 100644 --- a/hypr/hyprsunset.conf +++ b/hypr/hyprsunset.conf @@ -1,2 +1,2 @@ -temperature = 4000 +temperature = 4500 gamma = 100 diff --git a/hypr/scripts/change-wallpaper.sh b/hypr/scripts/change-wallpaper.sh index 708e974..bde8883 100644 --- a/hypr/scripts/change-wallpaper.sh +++ b/hypr/scripts/change-wallpaper.sh @@ -16,16 +16,6 @@ if [[ -z "$WALLPAPERS_DIR" ]]; then WALLPAPERS_DIR="$HOME/wallpapers" fi -if [[ -z "$dmenu" ]]; then - notify-send -u normal -a "Wallpaper" "Dmenu not found" "Couldn't find anyrun or wofi for dmenu! Try installing one of these two before selecting wallpaper!" - exit 1 -fi - -if [[ -z $(ls -A $WALLPAPERS_DIR) ]]; then - notify-send -u normal -a "Wallpaper" "Wallpapers not found" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!" - exit 1 -fi - function Write_changes() { echo "[LOG] Writing to hyprpaper config file" @@ -49,19 +39,33 @@ function Reload_pywal() { wal -t --cols16 $style -i "$wall" } -# Prompt wallpaper list -wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | $dmenu)" +if [[ -z "$dmenu" ]]; then + notify-send -u normal -a "Wallpaper" "Dmenu not found" "Couldn't find anyrun or wofi for dmenu! Try installing one of these two before selecting wallpaper!" + exit 1 +fi -# Check if input wallpaper is empty -if [[ $wall == "$WALLPAPERS_DIR/" ]]; then - echo "No wallpaper has been selected by user!" - if [[ $RANDOM_WALLPAPER_WHEN_EMPTY == true ]]; then - wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | shuf -n 1)" - echo "Selected random from $WALLPAPERS_DIR: $wall" - else - echo "Skipping hyprpaper changes and exiting." - exit 0 +if [[ -z $(ls -A $WALLPAPERS_DIR) ]]; then + notify-send -u normal -a "Wallpaper" "Wallpapers not found" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!" + exit 1 +fi + +if [[ -z $1 ]]; then + # Prompt wallpaper list + wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | $dmenu)" + + # Check if input wallpaper is empty + if [[ $wall == "$WALLPAPERS_DIR/" ]]; then + echo "No wallpaper has been selected by user!" + if [[ $RANDOM_WALLPAPER_WHEN_EMPTY == true ]]; then + wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | shuf -n 1)" + echo "Selected random from $WALLPAPERS_DIR: $wall" + else + echo "Skipping hyprpaper changes and exiting." + exit 0 + fi fi +else + wall=$1 fi Reload_pywal diff --git a/hypr/scripts/clipboard-menu.sh b/hypr/scripts/clipboard-menu.sh index 2e54055..8932880 100644 --- a/hypr/scripts/clipboard-menu.sh +++ b/hypr/scripts/clipboard-menu.sh @@ -3,5 +3,5 @@ selection=$(cliphist list | anyrun --plugins libstdin.so | cliphist decode) if [[ ! -z "$selection" ]]; then - printf "%s" $selection | sed -e 's/\n$//g' | wl-copy + printf "%s" "$selection" | sed -e 's/\\[n]$//g' | wl-copy fi diff --git a/hypr/scripts/screenshot.sh b/hypr/scripts/screenshot.sh new file mode 100644 index 0000000..6121146 --- /dev/null +++ b/hypr/scripts/screenshot.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# This script handles taking a screenshot using the +# hyprshot tool. +# -------------- +# Licensed under the MIT License +# Made by retrozinndev (João Dias) +# From https://github.com/retrozinndev/Hyprland-Dots + + +# exit slurp and quit if slurp(region selection) is running +killall slurp && exit 0 + +if [[ -z $(command -v hyprshot) ]]; then + echo "[err] you don't have hyprshot installed, please install it first" + exit 1 +fi + +if [[ "$1" == "full" ]]; then + hyprshot -m active -m output -o "$(xdg-user-dir PICTURES)/Screenshots" + exit 0 +fi + +hyprshot -m region -o "$(xdg-user-dir PICTURES)/Screenshots" diff --git a/hypr/shell/bindings.conf b/hypr/shell/bindings.conf index f1a6364..b8c20a6 100644 --- a/hypr/shell/bindings.conf +++ b/hypr/shell/bindings.conf @@ -5,8 +5,8 @@ bind = $mainMod, SPACE, exec, $menu bind = $mainMod, F11, fullscreen -bind = , Print, exec, killall slurp || hyprshot -m region -o "$(xdg-user-dir PICTURES)/Screenshots" -bind = $mainMod, Print, exec, killall slurp || hyprshot -m active -m output -o "$(xdg-user-dir PICTURES)/Screenshots" +bind = , Print, exec, sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh +bind = $mainMod, Print, exec, sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh full # Test-only bind, used by developer bind = $mainMod, F7, exec, ags request reload @@ -19,9 +19,9 @@ bind = $mainMod, P, pseudo, bind = $mainMod, J, togglesplit bind = $mainMod, N, exec, astal toggle control-center bind = $mainMod, M, exec, astal toggle center-window -bind = $mainMod, L, exec, $lockscreen +bind = $mainMod, L, exec, hyprlock bind = $mainMod, V, exec, sh $XDG_CONFIG_HOME/hypr/scripts/clipboard-menu.sh -bind = $mainMod, W, exec, sh $XDG_CONFIG_HOME/hypr/scripts/change-wallpaper.sh +bind = $mainMod, W, exec, astal runner '##' bind = $mainMod, $mainMod_L, exec, astal show-ws-numbers diff --git a/hypr/shell/environment.conf b/hypr/shell/environment.conf index b38aaab..49d5dfb 100644 --- a/hypr/shell/environment.conf +++ b/hypr/shell/environment.conf @@ -15,7 +15,7 @@ env = HYPRCURSOR_SIZE, 24 # Wayland stuff env = MOZ_ENABLE_WAYLAND, 1 -env = ELECTRON_OZONE_PLATFORM_HINT, x11 +env = ELECTRON_OZONE_PLATFORM_HINT, auto # QT env = QT_QPA_PLATFORM, wayland diff --git a/hypr/user/decorations.conf b/hypr/user/decorations.conf index cbec482..5600fee 100644 --- a/hypr/user/decorations.conf +++ b/hypr/user/decorations.conf @@ -2,3 +2,5 @@ ## DECORATION ## ################ # Wiki: https://wiki.hyprland.org/Configuring/Variables + +