Add hyprland config

This commit is contained in:
Martin Larsson 2024-04-07 02:10:08 +02:00
parent c9f3439835
commit b21ebf8043
5 changed files with 316 additions and 0 deletions

147
hypr/hyprland.conf Normal file
View file

@ -0,0 +1,147 @@
source=~/.config/hypr/macchiato.conf
# Environment variables for nvidia
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = GBM_BACMEND,nvidia-drm
env = __GLX_VNEDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
# Monitor setup
monitor = DP-1,3440x1440@240,0x0,1,bitdepth,10
# Screenshots using grim doesnt support 10 bit color as they become a different format :S
# monitor=DP-1,3440x1440@240,0x0,1,bitdepth
# Setup workspaces on boot
exec-once = [workspace 1 silent] kitty
exec-once = [workspace 2 silent] firefox
# Mandatory OS build blocks
exec-once = dunst # Notification manager
exec-once = /usr/lib/polkit-kde-authentication-agent-1 # Provides support for non-priveleged processes to talk to priveleged ones.
exec-once = waybar
# Hyprpaper
$randomize_wallpaper = sh ~/.config/hypr/hyprpaper_set.sh 2
exec-once = sh ~/.config/hypr/hyprpaper_preload.sh
exec-once = hyprpaper
exec-once = $randomize_wallpaper
# Bindings
bind = ALT, SPACE, exec, fuzzel -w 56 --line-height 24 -x 20 -P 8 -b 24273af6 -t cad3f5ff -m ed8796ff -s 363a4ff6 -S a6da95ff -M ed8796ff -B 2 -r 12 -C 181926ff -f "JetBrainsMonoNL Nerd Font Mono"
$default = SUPER
$resize = SUPER SHIFT
$move = SUPER CTRL
$movews = SUPER ALT
bind = $default, K, killactive
bind = $default, Space, togglefloating
bind = $default, S, fullscreen
bind = $default, Q, workspace, 1
bind = $default, Q, exec, $randomize_wallpaper
bind = $default, W, workspace, 2
bind = $default, W, exec, $randomize_wallpaper
bind = $default, F, workspace, 3
bind = $default, F, exec, $randomize_wallpaper
bind = $default, P, workspace, 4
bind = $default, P, exec, $randomize_wallpaper
bind = $default, B, workspace, 5
bind = $default, B, exec, $randomize_wallpaper
bind = $default, J, workspace, 6
bind = $default, J, exec, $randomize_wallpaper
bind = $default, L, workspace, 7
bind = $default, L, exec, $randomize_wallpaper
bind = $default, U, workspace, 8
bind = $default, U, exec, $randomize_wallpaper
bind = $default, Y, workspace, 9
bind = $default, Y, exec, $randomize_wallpaper
bind = $movews, Q, movetoworkspace, 1
bind = $movews, W, movetoworkspace, 2
bind = $movews, F, movetoworkspace, 3
bind = $movews, P, movetoworkspace, 4
bind = $movews, B, movetoworkspace, 5
bind = $movews, J, movetoworkspace, 6
bind = $movews, L, movetoworkspace, 7
bind = $movews, U, movetoworkspace, 8
bind = $movews, Y, movetoworkspace, 9
bind = $default, M, movefocus, l
bind = $default, N, movefocus, d
bind = $default, E, movefocus, u
bind = $default, I, movefocus, r
bind = $resize, M, resizeactive, -40 0
bind = $resize, N, resizeactive, 0 40
bind = $resize, E, resizeactive, 0 -40
bind = $resize, I, resizeactive, 40 0
bind = $move, M, movewindow, l
bind = $move, N, movewindow, d
bind = $move, E, movewindow, u
bind = $move, I, movewindow, r
general {
border_size = 2
gaps_in = 16
gaps_out = 10, 20, 20, 20
col.inactive_border = $mantle
col.active_border = $maroon
resize_on_border = true
}
decoration {
rounding = 8
active_opacity = 0.95
inactive_opacity = 0.875
fullscreen_opacity = 1.0
drop_shadow = true
shadow_range = 8
shadow_render_power = 4
col.shadow = $crust
col.shadow_inactive = $mantle
dim_inactive = true
dim_strength = 0.1
# screen_shader = examples/screenShader.frag
blur {
size = 2
passes = 3
ignore_opacity = true
xray = true
contrast = 4
}
}
input {
force_no_accel = true
scroll_method = on_button_down
scroll_button_lock = true
scroll_factor = 0.5
follow_mouse = 2
}
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
background_color = $flamingo
#vrr = 1 - This doesn't seem to play nicely with NVIDIA GPU's :(
focus_on_activate = true
}
binds {
# pass_mouse_when_bound if disabled, will not pass the mouse events to apps / dragging windows around if a keybind has been triggered. bool false
# scroll_event_delay in ms, how many ms to wait after a scroll event to allow to pass another one for the binds. int 300
# workspace_back_and_forth If enabled, an attempt to switch to the currently focused workspace will instead switch to the previous workspace. Akin to i3s auto_back_and_forth. bool false
# allow_workspace_cycles If enabled, workspaces dont forget their previous workspace, so cycles can be created by switching to the first workspace in a sequence, then endlessly going to the previous workspace. bool false
# workspace_center_on Whether switching workspaces should center the cursor on the workspace (0) or on the last active window for that workspace (1) int 0
# focus_preferred_method sets the preferred focus finding method when using focuswindow/movewindow/etc with a direction. 0 - history (recent have priority), 1 - length (longer shared edges have priority) int 0
# ignore_group_lock If enabled, dispatchers like moveintogroup, moveoutofgroup and movewindoworgroup will ignore lock per group. bool false
# movefocus_cycles_fullscreen If enabled, when on a fullscreen window, movefocus will cycle fullscreen, if not, it will move the focus in a direction.
}
opengl {
nvidia_anti_flicker = true
}

14
hypr/hyprpaper.conf Normal file
View file

@ -0,0 +1,14 @@
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/home_water.jpeg
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/cloudsnight.jpg
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/astronout.png
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/dino_landscape.jpg
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/lonely-fish.png
preload = /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/samurai_water.webp
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/home_water.jpeg
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/cloudsnight.jpg
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/astronout.png
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/dino_landscape.jpg
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/lonely-fish.png
wallpaper = DP-1, /home/walnut-arch/dev/git/.dotfiles/wallpapers/catppuccin/samurai_water.webp
splash=false

10
hypr/hyprpaper_preload.sh Executable file
View file

@ -0,0 +1,10 @@
monitor="DP-1"
wallpaper_dir="$HOME/dev/git/.dotfiles/wallpapers/catppuccin"
wallpapers=$(find "$wallpaper_dir" -type f | sort -R)
for wallpaper in $wallpapers; do
preload_string+="preload = "$wallpaper"\n"
wallpaper_string+="wallpaper = $monitor, $wallpaper\n"
done
echo -en "$preload_string$wallpaper_string\nsplash=false" > ~/.config/hypr/hyprpaper.conf

84
hypr/hyprpaper_set.sh Executable file
View file

@ -0,0 +1,84 @@
is_integer() {
local input=$1
[[ $input =~ ^-?[0-9]+$ ]]
}
wallpaper_history_path="$HOME/.wallpaper_history"
function set_wallpaper() {
local wallpaper_path="$1"
local history_size="$2"
local monitor="DP-1"
hyprctl hyprpaper wallpaper "$monitor, $wallpaper_path"
if [ $history_size -le 1 ]; then
echo "Won't set wallpaper, history size is less than or equal to 1"
return
fi
local -a wallpapers
if [ -f "$wallpaper_history_path" ]; then
mapfile -t wallpapers < "$wallpaper_history_path"
fi
wallpapers+=("$wallpaper_path")
if [ ${#wallpapers[@]} -gt $history_size ]; then
wallpapers=("${wallpapers[@]: -$history_size}")
fi
printf "%s\n" "${wallpapers[@]}" > "$wallpaper_history_path"
}
wallpaper_dir="$HOME/dev/git/.dotfiles/wallpapers/catppuccin"
files=($wallpaper_dir/*)
history_size=1
if [ $# -eq 1 ]; then
if is_integer "$1"; then
history_size=$1
if [ $history_size -lt 1 ]; then
echo "History size must be greater than 0"
exit 1
fi
if [ ${#files[@]} -le $history_size ]; then
echo "Number of wallpapers is less than or equal to the history size"
exit 1
fi
else
echo "Invalid argument: $1"
exit 1
fi
fi
if [ ${#files[@]} -eq 1 ]; then
set_wallpaper "${files[0]}" 0
exit 0
fi
if [ -f "$wallpaper_history_path" ]; then
mapfile -t history < "$wallpaper_history_path"
for hist_wallpaper in "${history[@]}"; do
for i in "${!files[@]}"; do
if [[ "${files[$i]}" == "$hist_wallpaper" ]]; then
unset 'files[i]'
fi
done
echo "Removing $hist_wallpaper"
done
# Re-create the files array to eliminate gaps
files=("${files[@]}")
fi
array_length=${#files[@]}
if [ $array_length -eq 0 ]; then
echo "No wallpapers available after filtering."
exit 1
fi
array_length=${#files[@]}
index=$(($RANDOM % $array_length))
set_wallpaper "${files[$index]}" $history_size

61
hypr/macchiato.conf Normal file
View file

@ -0,0 +1,61 @@
$rosewaterAlpha = f4dbd6
$flamingoAlpha = f0c6c6
$pinkAlpha = f5bde6
$mauveAlpha = c6a0f6
$redAlpha = ed8796
$maroonAlpha = ee99a0
$peachAlpha = f5a97f
$yellowAlpha = eed49f
$greenAlpha = a6da95
$tealAlpha = 8bd5ca
$skyAlpha = 91d7e3
$sapphireAlpha = 7dc4e4
$blueAlpha = 8aadf4
$lavenderAlpha = b7bdf8
$textAlpha = cad3f5
$subtext1Alpha = b8c0e0
$subtext0Alpha = a5adcb
$overlay2Alpha = 939ab7
$overlay1Alpha = 8087a2
$overlay0Alpha = 6e738d
$surface2Alpha = 5b6078
$surface1Alpha = 494d64
$surface0Alpha = 363a4f
$baseAlpha = 24273a
$mantleAlpha = 1e2030
$crustAlpha = 181926
$rosewater = 0xfff4dbd6
$flamingo = 0xfff0c6c6
$pink = 0xfff5bde6
$mauve = 0xffc6a0f6
$red = 0xffed8796
$maroon = 0xffee99a0
$peach = 0xfff5a97f
$yellow = 0xffeed49f
$green = 0xffa6da95
$teal = 0xff8bd5ca
$sky = 0xff91d7e3
$sapphire = 0xff7dc4e4
$blue = 0xff8aadf4
$lavender = 0xffb7bdf8
$text = 0xffcad3f5
$subtext1 = 0xffb8c0e0
$subtext0 = 0xffa5adcb
$overlay2 = 0xff939ab7
$overlay1 = 0xff8087a2
$overlay0 = 0xff6e738d
$surface2 = 0xff5b6078
$surface1 = 0xff494d64
$surface0 = 0xff363a4f
$base = 0xff24273a
$mantle = 0xff1e2030
$crust = 0xff181926