From 4959fe97fbe4a1e711374a15c3d9bccc416b2318 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Tue, 10 Dec 2024 10:41:46 -0300 Subject: [PATCH] :boom: hypr: fix wallpaper script --- hypr/autostart.conf | 21 ++++++ hypr/bindings.conf | 117 +++++++++++++++++++++++++++++++ hypr/decorations.conf | 70 ++++++++++++++++++ hypr/environment.conf | 17 +++++ hypr/hypridle.conf | 13 ++++ hypr/hyprland.conf | 37 ++++++++++ hypr/hyprlock.conf | 95 +++++++++++++++++++++++++ hypr/layout.conf | 4 ++ hypr/monitors.conf | 17 +++++ hypr/nvidia.conf | 15 ++++ hypr/plugins.conf | 14 ++++ hypr/rules.conf | 72 +++++++++++++++++++ hypr/scripts/change-wallpaper.sh | 90 ++++++++++++++++++++++++ 13 files changed, 582 insertions(+) create mode 100644 hypr/autostart.conf create mode 100644 hypr/bindings.conf create mode 100644 hypr/decorations.conf create mode 100644 hypr/environment.conf create mode 100644 hypr/hypridle.conf create mode 100644 hypr/hyprland.conf create mode 100644 hypr/hyprlock.conf create mode 100644 hypr/layout.conf create mode 100644 hypr/monitors.conf create mode 100644 hypr/nvidia.conf create mode 100644 hypr/plugins.conf create mode 100644 hypr/rules.conf create mode 100644 hypr/scripts/change-wallpaper.sh diff --git a/hypr/autostart.conf b/hypr/autostart.conf new file mode 100644 index 0000000..ccc51be --- /dev/null +++ b/hypr/autostart.conf @@ -0,0 +1,21 @@ + +############### +## AUTOSTART ## +############### + +exec-once = /usr/lib/hyprpolkitagent # Experimental Hyprland Polkit Agent +exec-once = eww daemon && eww open bar # Daemon + Status Bar +exec-once = dunst # Notification Daemon +exec-once = hyprpaper # Wallpaper +exec-once = hypridle # Idle daemon + +# Load pywal from cache +exec-once = wal -R + +# Clipboard manager +exec-once = wl-paste --type text --watch cliphist store # Stores text +exec-once = wl-paste --type image --watch cliphist store # Stores images + +# Apps +exec-once = /bin/vesktop --start-minimized +exec-once = /bin/steam-runtime -silent diff --git a/hypr/bindings.conf b/hypr/bindings.conf new file mode 100644 index 0000000..58f47a6 --- /dev/null +++ b/hypr/bindings.conf @@ -0,0 +1,117 @@ +############## +## BINDINGS ## +############## + +# https://wiki.hyprland.org/Configuring/Keywords and https://wiki.hyprland.org/Configuring/Binds for information on how to configure input + +$terminal = kitty +$fileManager = nautilus +$menu = anyrun +$dmenu = anyrun --plugins libstdin.so +$mainMod = SUPER +$lockscreen = hyprlock +$screenshotDir = $HOME/Screenshots +$screenshotFull = hyprshot -m output -o $screenshotDir +$screenshotSelect = hyprshot -m region -o $screenshotDir +$media = spotify-launcher + + +# Main binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, K, exec, $terminal +bind = $mainMod, Q, killactive +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, F, togglefloating +bind = $mainMod, SPACE, exec, $menu +bind = $mainMod, P, pseudo, +bind = $mainMod, J, togglesplit +bind = $mainMod, F11, fullscreen +bind = $mainMod, N, exec, eww open --toggle control-center +bind = $mainMod, L, exec, $lockscreen + +# Media keys +bind = , XF86AudioMedia, exec, $media +bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- # Decrease volume +bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ # Increase volume +bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle # Mute +bind = , XF86AudioPrev, exec, playerctl previous # Previous media +bind = , XF86AudioNext, exec, playerctl next # Next media +bind = , XF86AudioPlay, exec, playerctl play-pause # Toggle Play/Pause media + +# Brightness Keys +bind = , XF86MonBrightnessDown, exec, brightnessctl s 5%- # Lower monitor brightness +bind = , XF86MonBrightnessUp, exec, brightnessctl s +5% # Increase monitor brightness + +# Screenshot +bind = , Print, exec, $screenshotSelect +bind = $mainMod, Print, exec, $screenshotFull + +# Open clipboard +bind = $mainMod, V, exec, cliphist list | $dmenu | cliphist decode | xargs -r wl-copy + +# Open wallpaper menu +bind = $mainMod, W, exec, env bash $HOME/.config/hypr/scripts/change-wallpaper.sh + +# Reload binds +# Eww +bind = $mainMod, F7, exec, eww reload +# Hyprpaper (Wallpaper) +bind = $mainMod, F8, exec, pkill hyprpaper && hyprpaper +# Dunst (Notification daemon) +bind = $mainMod, F9, exec, pkill dunst && dunst + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Move windows with keyboard keys +bind = $mainMod SHIFT, left, movewindow, l +bind = $mainMod SHIFT, right, movewindow, r +bind = $mainMod SHIFT, up, movewindow, u +bind = $mainMod SHIFT, down, movewindow, d +bind = $mainMod SHIFT, C, centerwindow + +# Resize windows with arrowkeys +bind = $mainMod ALT, left, resizeactive, -60 0 +bind = $mainMod ALT, right, resizeactive, 60 0 +bind = $mainMod ALT, up, resizeactive, 0 -60 +bind = $mainMod ALT, down, resizeactive, 0 60 + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +bind = CTRL $mainMod, right, workspace, e+1 +bind = CTRL $mainMod, left, workspace, e-1 + +bind = $mainMod, S, togglespecialworkspace, magic +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow diff --git a/hypr/decorations.conf b/hypr/decorations.conf new file mode 100644 index 0000000..ffc4c71 --- /dev/null +++ b/hypr/decorations.conf @@ -0,0 +1,70 @@ + +################ +## DECORATION ## +################ + +# See https://wiki.hyprland.org/Configuring/Variables for more information on how to configure appearance + +source = ~/.cache/wal/colors-hypr.conf + +general { + gaps_in = 6 + gaps_out = 8 + + border_size = 2 + + col.active_border = $color1 + col.inactive_border = $background + + resize_on_border = false + + allow_tearing = false + + layout = dwindle +} + +misc { + animate_manual_resizes = false +} + +decoration { + rounding = 14 + + # Active Window Opacity + active_opacity = 1.0 + # Inactive Window Opacity + inactive_opacity = 0.95 + + shadow { + enabled = true + range = 3 + render_power = 5 + color = $background + } + + blur { + enabled = true + new_optimizations = true + size = 7 + passes = 2 + vibrancy = 0.9 + } +} + +animations { + enabled = true + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + bezier = amazingBezier, 0.25, 0.59, 0.1, 1.05 + bezier = layerBezier, 0.36, 0.58, 0.1, 1 + + animation = windows, 1, 5, amazingBezier, slide + animation = windowsOut, 1, 5, amazingBezier, slide + animation = layers, 1, 6, layerBezier, slide + animation = layersOut, 1, 6, layerBezier, slide + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 3.5, default + animation = fadeLayers, 1, 7, amazingBezier + animation = workspaces, 1, 4, amazingBezier, slidefade 20% +} diff --git a/hypr/environment.conf b/hypr/environment.conf new file mode 100644 index 0000000..6db6d58 --- /dev/null +++ b/hypr/environment.conf @@ -0,0 +1,17 @@ + +################# +## ENVIRONMENT ## +################# + +# Others +env = XCURSOR_THEME, Adwaita +env = XCURSOR_SIZE, 24 +env = HYPRCURSOR_THEME, Adwaita +env = HYPRCURSOR_SIZE, 24 +env = QT_QPA_PLATFORM, wayland +env = QT_QPA_PLATFORMTHEME, qt5ct +env = QT_AUTO_SCREEN_SCALE_FACTOR, 1 +env = XDG_CURRENT_DESKTOP, Hyprland +env = XDG_SESSION_TYPE, wayland +env = ADW_DISABLE_PORTAL, 1 +env = MOZ_ENABLE_WAYLAND, 1 diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf new file mode 100644 index 0000000..efc041d --- /dev/null +++ b/hypr/hypridle.conf @@ -0,0 +1,13 @@ + +general { + lock_cmd = echo "Locked Hyprland Session" + unlock_cmd = echo "Unlocked Hyprland Session" + ignore_dbus_inhibit = false + ignore_systemd_inhibit = false +} + +listener { + timeout = 3600 # 1800 -> 30m | 3600 -> 1h | 7200 -> 2h + on-timeout = hyprlock + on-resume = notify-send "Welcome back to Hyprland, $USER!" +} diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf new file mode 100644 index 0000000..47bee99 --- /dev/null +++ b/hypr/hyprland.conf @@ -0,0 +1,37 @@ + +############################################# +## Retrozinndev's Hyprland Configurations! ## +############################################# + +# Nvidia Settings +source = ~/.config/hypr/nvidia.conf + +# Environment +source = ~/.config/hypr/environment.conf + +# Monitors +source = ~/.config/hypr/monitors.conf + +# Layout +source = ~/.config/hypr/layout.conf + +# Input +source = ~/.config/hypr/input.conf + +# Devices +# source = ~/.config/hypr/devices.conf # Uncomment this line to apply file, remember to make it first! + +# Plugins (you can comment if you want pure Hyprland) +source = ~/.config/hypr/plugins.conf + +# Appearance +source = ~/.config/hypr/decorations.conf + +# Autostart +source = ~/.config/hypr/autostart.conf + +# Bindings +source = ~/.config/hypr/bindings.conf + +# Rules +source = ~/.config/hypr/rules.conf diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf new file mode 100644 index 0000000..20a69b4 --- /dev/null +++ b/hypr/hyprlock.conf @@ -0,0 +1,95 @@ + +############## +# LOCKSCREEN # +############## + +# Source colors from pywal +source = ~/.cache/wal/colors-hypr.conf + +# Fonts +$font = Cantarell Regular +$clockFont = Cantarell Black +$minimalFont = Noto Sans Mono + +general { + disable_loading_bar = true + hide_cursor = false +} + +background { + monitor = + path = $wallpaper + blur_passes = 2 + color = $background +} + +# Time +label { + monitor = + text = cmd[update:30000] echo -e "$(date +"%R")" # 24-hours + # text = cmd[update:30000] echo -e "$(date +"%I:%M %p")" # 12-hours (AM/PM) + color = $foreground + font_size = 120 + font_family = $clockFont + position = 0, -60 + halign = center + valign = top +} + +# Date +label { + monitor = + text = cmd[update:43200000] echo -e "$(date +"%A, %d %B %Y")" + color = $foreground + font_size = 20 + font_family = $font + position = 0, -250 + halign = center + valign = top +} + +# Logged user +label { + monitor = + font_size = 6 + font_family = $minimalFont + color = $foreground + text = Currently logged in as $USER + halign = center + valign = bottom + position = 0, 5 +} + +# Avatar +image { + monitor = + path = ~/.face + size = 72 + border_color = $color2 + position = 0, 100 + halign = center + valign = bottom +} + +# Input (password) +input-field { + monitor = + size = 180, 35 + outline_thickness = 2 + dots_size = .15 + dots_spacing = .6 + dots_center = true + outer_color = $background + inner_color = $color3 + font_color = $foreground + fade_on_empty = false + placeholder_text = + hide_input = false + check_color = $color4 + fail_color = $color1 + fail_text = $FAIL ($ATTEMPTS) + capslock_color = $color1 + position = 0, 40 + halign = center + valign = bottom +} diff --git a/hypr/layout.conf b/hypr/layout.conf new file mode 100644 index 0000000..4615a95 --- /dev/null +++ b/hypr/layout.conf @@ -0,0 +1,4 @@ +dwindle { + pseudotile = true + preserve_split = true +} diff --git a/hypr/monitors.conf b/hypr/monitors.conf new file mode 100644 index 0000000..1270eed --- /dev/null +++ b/hypr/monitors.conf @@ -0,0 +1,17 @@ + +############## +## MONITORS ## +############## + +# Configure yout monitor(s) here! See https://wiki.hyprland.org/Configuring/Monitors for more information on how to do that! + +# Monitor Arguments +# arg0 -> monitor name(you can get monitor names with `hyprctl monitors`); +# arg1 -> resolution@hertz; +# arg2 -> positioning from the top-left corner; +# arg3 -> scaling; +# arg4 -> variable refresh rate for games(optional); +# arg5 -> 1: vrr enabled, 0: no vrr. + +monitor = HDMI-A-1, 1920x1080@75, 0x0, 1, vrr, 1 + diff --git a/hypr/nvidia.conf b/hypr/nvidia.conf new file mode 100644 index 0000000..7ea1013 --- /dev/null +++ b/hypr/nvidia.conf @@ -0,0 +1,15 @@ + +##################### +## NVIDIA SETTINGS ## +##################### + +env = LIBVA_DRIVER_NAME, nvidia +env = GBM_BACKEND, nvidia-drm +env = __GLX_VENDOR_LIBRARY_NAME, nvidia +env = _VK_LAYER_NV_optimus, NVIDIA_only +env = __NV_PRIME_RENDER_OFFLOAD, 1 + +cursor { + # Set to true if you have issues + no_hardware_cursors = true +} diff --git a/hypr/plugins.conf b/hypr/plugins.conf new file mode 100644 index 0000000..7770f70 --- /dev/null +++ b/hypr/plugins.conf @@ -0,0 +1,14 @@ +#################### +# HYPRLAND PLUGINS # +#################### + +# You can add your preferred plugins here. Get help on how to do so: https://wiki.hyprland.org/Plugins/Using-Plugins/ + +plugin { + # Example plugin configuration + #hyprbars { + # bar_height = 24 + # hyprbars-button = rgb(ff4040), 16, 󰖭, hyprctl dispatch killactive + # hyprbars-button = rgb(eeee11), 16, , hyprctl dispatch fullscreen 1 + #} +} diff --git a/hypr/rules.conf b/hypr/rules.conf new file mode 100644 index 0000000..4209831 --- /dev/null +++ b/hypr/rules.conf @@ -0,0 +1,72 @@ + +############################ +## WINDOW / LAYER RULES ## +############################ + +# See https://wiki.hyprland.org/Configuring/Window-Rules/ and https://wiki.hyprland.org/Configuring/Workspace-Rules/ for information on how to configure this + +# Floating windows +windowrulev2 = float, class:moe.launcher.* +windowrulev2 = float, class:com.github.rafostar.Clapper +windowrulev2 = float, class:xdg-desktop-portal* +windowrulev2 = float, class:org.pulseaudio.pavucontrol +windowrulev2 = float, class:blueberry.py +windowrulev2 = float, class:org.gnome.Loupe +windowrulev2 = float, class:mcpelauncher-webview +windowrulev2 = float, class:org.gnome.Calculator +windowrulev2 = float, class:io.mrarm.mcpelauncher-ui-qt +windowrulev2 = float, class:Resources + +# Resize +windowrulev2 = size 50% 50%, class:org.pulseaudio.pavucontrol +windowrulev2 = size 50% 50%, class:blueberry.py +windowrulev2 = size 70% 70%, class:io.mrarm.mcpelauncher-ui-qt + +# Moving +windowrulev2 = move 49.27% 7.28%, class:org.pulseaudio.pavucontrol +windowrulev2 = move 49.27% 7.28%, class:blueberry.py +windowrulev2 = movetoworkspace e, class:org.pulseaudio.pavucontrol + +# Animations +windowrulev2 = animation slide right, class:org.pulseaudio.pavucontrol +windowrulev2 = animation slide right, class:blueberry.py +layerrule = animation slide right, swaync-control-center +layerrule = animation fade, selection +layerrule = animation fade, logout_dialog +layerrule = animation fade, waybar +layerrule = animation fade, hyprpaper +layerrule = animation slide right, swaync-notification-window +layerrule = animation fade, hyprpicker +layerrule = animation fade, eww-calendar +layerrule = animation fade, eww-audio + +# Opacity +windowrulev2 = opacity .95 .95, class:kitty +windowrulev2 = opacity .88 .88, class:spotify +windowrulev2 = opacity .88 .88, class:hyprpolkitagent + +# No blur +windowrulev2 = noblur, class:steam.* + +# Blur +windowrulev2 = noblur, class:^()$, title:^()$ + +# Window Blur list +blurls = logout_dialog +blurls = kitty +blurls = eww-powermenu + +# Layer Blur list +layerrule = blur, waybar +layerrule = ignorealpha .5, waybar +layerrule = blur, eww-bar +layerrule = ignorealpha .5, eww-bar +layerrule = blur, eww-calendar +layerrule = ignorealpha .5, eww-calendar +layerrule = blur, eww-cc +layerrule = ignorealpha .5, eww-cc +layerrule = blur, eww-audio +layerrule = ignorealpha .5, eww-audio + +# Suppress maximize event from windows +windowrulev2 = suppressevent maximize, class:.* diff --git a/hypr/scripts/change-wallpaper.sh b/hypr/scripts/change-wallpaper.sh new file mode 100644 index 0000000..a4c2335 --- /dev/null +++ b/hypr/scripts/change-wallpaper.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +# This script is made by retrozinndev (João Dias), It is licensed under +# the MIT License as in retrozinndev/Hyprland-Dots repository. +# GitHub: https://github.com/retrozinndev +# Dotfiles: https://github.com/retrozinndev/Hyprland-Dots + +# The script prompts the user with anyrun or wofi to choose an image file inside +# the defined $WALLPAPERS_DIR. If the user selects an entry, it automatically +# writes changes to the hyprpaper.conf file and hot-reloads wallpaper if hyprpaper +# is running. + +if [[ $WALLPAPERS_DIR == "" ]]; then + WALLPAPERS_DIR="$HOME/wallpapers" +fi + +HYPRPAPER_FILE="$HOME/.config/hypr/hyprpaper.conf" + +if [[ -f /bin/anyrun ]]; then + WALLPAPER_SELECT_CMD="anyrun --plugins libstdin.so" +elif [[ -f /bin/wofi ]]; then + WALLPAPER_SELECT_CMD="wofi --dmenu" +else + notify-send -u normal "Hyprpaper script" "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 "Hyprpaper script" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!" + exit 1 +fi + +Update_wallpaper_settings() { + echo "Writing to hyprpaper config file" + + echo "" > $HYPRPAPER_FILE # Cleans Hyprpaper conf + + echo "\$wallpaper = $SET_WALLPAPER_FULL" >> $HYPRPAPER_FILE + echo "" >> $HYPRPAPER_FILE + echo "splash = true" >> $HYPRPAPER_FILE + echo "preload = \$wallpaper" >> $HYPRPAPER_FILE + echo "wallpaper = , \$wallpaper" >> $HYPRPAPER_FILE +} + +Hot_reload_wallpaper() { + echo "Hot-reloading wallpaper" + hyprctl hyprpaper unload all + hyprctl hyprpaper preload "$SET_WALLPAPER_FULL" + hyprctl hyprpaper wallpaper ", $SET_WALLPAPER_FULL" +} + +Reload_pywal() { + echo "Reloading pywal colorscheme" + wal -q -t --cols16 darken -i "$SET_WALLPAPER_FULL" +} + +Reload_eww() { + echo "Reloading Eww..." + eww reload +} + +# Prompt wallpapers via dmenu +SET_WALLPAPER_NAME="$(ls $WALLPAPERS_DIR | $WALLPAPER_SELECT_CMD)" +SET_WALLPAPER_FULL="$WALLPAPERS_DIR/$SET_WALLPAPER_NAME" + +echo "Wallpaper: $SET_WALLPAPER_NAME" + +# Check if input wallpaper is empty +if [[ $SET_WALLPAPER_NAME == "" ]] || [[ $SET_WALLPAPER_NAME == " " ]] +then + echo "No wallpaper has been selected by user!" + if [[ $RANDOM_WALLPAPER_WHEN_EMPTY == true ]] + then + SET_WALLPAPER_NAME=$(ls $WALLPAPERS_DIR | shuf -n 1) + echo "Selected random wallpaper from $HOME/wallpapers: $SET_WALLPAPER_NAME" + SET_WALLPAPER_FULL="$WALLPAPERS_DIR/$SET_WALLPAPER_NAME" + + else + echo "Skipping hyprpaper changes and exiting." + exit 1 + fi +fi + +Hot_reload_wallpaper +Reload_pywal +Reload_eww +Update_wallpaper_settings + +exit 0