From 36067587782cbfb1231d231041cbdb8494e5b8f8 Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Tue, 5 Dec 2023 00:01:59 +0100 Subject: [PATCH] hyprland: add config --- hypr/hyprland.conf | 243 +++++++++++++++++++++++++++++++++++++++ hypr/hyprpaper.conf | 5 + hypr/scripts/gamemode.sh | 15 +++ hypr/scripts/startup.sh | 61 ++++++++++ 4 files changed, 324 insertions(+) create mode 100644 hypr/hyprland.conf create mode 100644 hypr/hyprpaper.conf create mode 100755 hypr/scripts/gamemode.sh create mode 100755 hypr/scripts/startup.sh diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf new file mode 100644 index 00000000..177dd595 --- /dev/null +++ b/hypr/hyprland.conf @@ -0,0 +1,243 @@ +# ░█░█░█░█░█▀█░█▀▄░█░░░█▀█░█▀█░█▀▄░░░█▀▀░█▀█░█▀█░█▀▀░▀█▀░█▀▀ +# ░█▀█░░█░░█▀▀░█▀▄░█░░░█▀█░█░█░█░█░░░█░░░█░█░█░█░█▀▀░░█░░█░█ +# ░▀░▀░░▀░░▀░░░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀░░░░▀▀▀░▀▀▀░▀░▀░▀░░░▀▀▀░▀▀▀i + +autogenerated = 0 # remove this line to remove the warning + +# See https://wiki.hyprland.org/Configuring/Monitors/ +#monitor=DP-3,preferred,auto,1.125,vrr,2 +monitor=DP-3,preferred,auto,1,vrr,2 + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +env = VK_ICD_FILENAMES,/usr/share/vulkan/icd.d/radeon_icd.x86_64.json +env = WLR_RENDERER,vulkan +env = XDG_CURRENT_DESKTOP, Hyprland +env = XDG_SESSION_TYPE, wayland +env = XDG_SESSION_DESKTOP, Hyprland + +# Execute your favorite apps at launch + +exec-once = ~/.config/hypr/scripts/startup.sh +exec-once = qutebrowser +exec-once = ~/.local/bin/foot + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# Some default env vars. +env = XCURSOR_SIZE,24 +env = QT_QPA_PLATFORM,wayland +env = QT_QPA_PLATFORMTHEME,qt6ct +env = GDK_BACKEND=wayland +env = QT_AUTO_SCREEN_SCALE_FACTOR,1 +env = MOZ_ENABLE_WAYLAND,1 +env = GTK_USE_PORTAL,1 + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = de_se_fi + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 10 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false +} + +dwindle { + force_split = 2 +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 4 + + blur { + enabled = true + size = 3 + passes = 1 + vibrancy = 0.1696 + } + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = false +} + +misc { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + force_default_wallpaper = -1 # Set to 0 to disable the anime mascot wallpapers +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more +device:epic-mouse-v1 { + sensitivity = -0.5 +} + +group.groupbar { + font_family LiterationMono Nerd Font + font_size 16 +} + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# more windowrules + +# handle steam client +windowrule = float,^(steam)$ +windowrule = float,title:^(Steam)$ +windowrule = float,title:^(Freundesliste)$ + +# handle other clients +windowrulev2 = float, size 1560 1000, pin, workspace special:overlay, class:^(org.keepassxc.KeePassXC)$ +windowrule = float, ^(firefox)$ +windowrulev2 = opacity 1.0 override 0.8 override, group, class:^(foot)$ + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$sureMod = SUPER ALT CTRL +$mainMod = SUPER + +# binds that don't want to get fat-fingered +bind = $sureMod, Q, killactive, +bind = $sureMod, M, exit, +bind = $sureMod, F, fullscreen,0 +bind = $sureMod, Return, exec, konsole + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Return, exec, /home/andy/.local/bin/foot +bind = $mainMod, E, exec, dolphin +bind = $mainMod, F, fullscreen,1 +bind = $mainMod, V, togglefloating, +bind = $mainMod, D, exec, wofi --show drun +bind = $mainMod, R, exec, wofi --show run +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, S, togglesplit, # dwindle +bind = $sureMod, G, togglegroup +bind = $mainMod, G, moveintogroup +bind = $mainMod SHIFT, G, moveoutofgroup +bind = ALT SHIFT, F12, exec, ~/.config/hypr/scripts/gamemode.sh + +# 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 +bind = $mainMod, H, movefocus, l +bind = $mainMod, L, movefocus, r +bind = $mainMod, K, movefocus, u +bind = $mainMod, J, movefocus, d +bind = $mainMod ALT, H, changegroupactive, b +bind = $mainMod ALT, L, changegroupactive, f + +# Move windows or groups with mainMod + Shift + arrow 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, H, movewindow, l +bind = $mainMod SHIFT, L, movewindow, r +bind = $mainMod SHIFT, K, movewindow, u +bind = $mainMod SHIFT, J, movewindow, d + +# 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 + +# 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 + +# media keys +bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bind = , XF86AudioMute, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0% +bind = , XF86AudioPlay, exec, playerctl play-pause +bind = , XF86AudioNext, exec, playerctl next +bind = , XF86AudioPrev, exec, playerctl previous +bind = , XF86audiostop, exec, playerctl stop + +# 'scratchpad +bind = $mainMod, O, togglespecialworkspace, overlay +bind = $mainMod SHIFT, O, movetoworkspace, special:overlay diff --git a/hypr/hyprpaper.conf b/hypr/hyprpaper.conf new file mode 100644 index 00000000..5f20017e --- /dev/null +++ b/hypr/hyprpaper.conf @@ -0,0 +1,5 @@ +preload = /mnt/multimedia/Wallpapers/wp10330139-5120x1440-star-wars-wallpapers.jpg +wallpaper = DP-3,/mnt/multimedia/Wallpapers/wp10330139-5120x1440-star-wars-wallpapers.jpg + +ipc = off + diff --git a/hypr/scripts/gamemode.sh b/hypr/scripts/gamemode.sh new file mode 100755 index 00000000..f97d4f4f --- /dev/null +++ b/hypr/scripts/gamemode.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +HYPRGAMEMODE=$(hyprctl getoption animations:enabled | sed -n '2p' | awk '{print $2}') +if [ $HYPRGAMEMODE = 1 ] ; then + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword decoration:drop_shadow 0;\ + keyword decoration:blur 0;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + exit +fi +hyprctl reload + diff --git a/hypr/scripts/startup.sh b/hypr/scripts/startup.sh new file mode 100755 index 00000000..de07e8f6 --- /dev/null +++ b/hypr/scripts/startup.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +logger '============================' +logger 'NEW hyprland session started' + +CONFIG="$HOME/.config/mako/config" + +if [[ ! -d "$XDG_RUNTIME_DIR" ]] ; then + export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) + logger 'xdg-runtime dir set' +fi + +if [[ ! "$DBUS_SESSION_BUS_ADDRESS" ]]; then + dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus & + logger 'dbus session daemon started' +fi + +if [[ ! $(pidof /usr/lib64/libexec/polkit-kde-authentication-agent-1) ]]; then + /usr/lib64/libexec/polkit-kde-authentication-agent-1 & + logger 'polit-kde started' +fi + +if [[ ! $(pidof mako) ]]; then + mako --config "${CONFIG}" & + logger 'mako started' +fi + +killall xdg-desktop-portal-hyprland +killall xdg-desktop-portal-gnome +killall xdg-desktop-portal-kde +killall xdg-desktop-portal-wlr +killall xdg-desktop-portal +logger 'killed all xdg-desktop' +sleep 1 +/usr/libexec/xdg-desktop-portal-kde & +logger 'xdg-desktop-portal-kde started' +sleep 1 +/usr/libexec/xdg-desktop-portal-hyprland & +logger 'xdg-desktop-portal-hyprland started' +sleep 2 +/usr/libexec/xdg-desktop-portal & +logger 'xdg-desktop-portal started' + +if [[ ! $(pidof pipewire) ]]; then + gentoo-pipewire-launcher & + logger 'gentoo-pipewire-launcher started' +else + gentoo-pipewire-launcher restart & + logger 'gentoo-pipewire-launcher (re-)started' +fi + +hyprpaper & +openrgb -p simple.orp & + +if [[ ! $(pidof waybar) ]]; then + sleep 1 && waybar & + logger 'waybar started' +fi + +sleep 2 && logger 'END of hyprland session start' && logger '=============================' + -- 2.51.2