{% if host.name == "chonk" %}
source = ~/.config/hypr/chonk.conf
{% else %}
source = ~/.config/hypr/hpomen.conf
{% endif %}

monitor = , preferred, auto, 1

# Set programs that you use
$terminal = uwsm-app -- kitty
$menu = uwsm-app -- env sh ~/.config/rofi/launch.sh

input {
	kb_layout = us
	kb_variant =
	kb_model =
	kb_options =
	kb_rules =

	follow_mouse = 1
	mouse_refocus = 1

	numlock_by_default = true
	accel_profile = flat
}

general {
	gaps_in = 2
	gaps_out = 4
	border_size = 1
	col.active_border = rgba(f0c674ff)
	col.inactive_border = rgba(707880ff)

	layout = dwindle

	# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
	allow_tearing = false
}

animations {
	enabled = yes

	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
	animation = fadeSwitch, 1, 10, default
	animation = fadeDim, 1, 10, default
}

dwindle {
	pseudotile = true
	preserve_split = true
	smart_split = false
}

misc {
	force_default_wallpaper = 0
	disable_hyprland_logo = true
	disable_splash_rendering = true
}

xwayland {
	force_zero_scaling = false
}

device {
	name = glorious-model-o-wireless
	sensitivity = 0.0
	#sensitivity = -0.9157894737  # Rough calc for max DPI - issues exist
}

windowrulev2 = suppressevent maximize, class:.*
windowrulev2 = opacity 1.0 0.9, class:.*

windowrulev2 = opacity 0.0 override 0.0 override,class:^xwaylandvideobridge$
windowrulev2 = noanim, class:^xwaylandvideobridge$
windowrulev2 = noinitialfocus, class:^xwaylandvideobridge$
windowrulev2 = maxsize 1 1, class:^xwaylandvideobridge$
windowrulev2 = noblur, class:^xwaylandvideobridge$
windowrulev2 = nofocus, class:^xwaylandvideobridge$

# class is nz.co.mega.megasync when running natively on Wayland, MEGAsync when using XWayland
windowrulev2 = float, class:^nz\.co\.mega\.megasync|MEGAsync$
# First window annoyingly closes when focus is lost
# Basic workaround: spawn centered on cursor
windowrulev2 = move cursor -50% -50%, class:^nz\.co\.mega\.megasync|MEGAsync$

$mainMod = SUPER

bind = SUPER, RETURN, exec, $terminal

bind = SUPER SHIFT, Q, killactive,
bind = SUPER SHIFT, S, exec, uwsm-app -- env sh ~/scripts/screenshot.sh
bind = SUPER SHIFT, C, exec, uwsm-app -- hyprpicker -a
bind = SUPER SHIFT, L, exec, uwsm-app -- swaylock

bind = SUPER, F, togglefloating,

bind = ALT, F9, pass, ^(com\.obsproject\.Studio)$
bind = ALT, F10, pass, ^(com\.obsproject\.Studio)$

bind = CONTROL, TAB, exec, $menu

bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d

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, 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

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

# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

bind = , XF86AudioRaiseVolume, exec, uwsm-app -- pactl set-sink-volume @DEFAULT_SINK@ +5%
bind = , XF86AudioLowerVolume, exec, uwsm-app -- pactl set-sink-volume @DEFAULT_SINK@ -5%
bind = , XF86AudioMute, exec, uwsm-app -- pactl set-sink-mute @DEFAULT_SINK@ toggle
bind = , XF86AudioMicMute, exec, uwsm-app -- pactl set-source-mute @DEFAULT_SOURCE@ toggle

bind = , XF86MonBrightnessUp, exec, uwsm-app -- brightnessctl s +5%
bind = , XF86MonBrightnessDown, exec, uwsm-app -- brightnessctl s 5%-

bind = , xf86KbdBrightnessUp, exec, uwsm-app -- brightnessctl -d *::kbd_backlight set +33%
bind = , xf86KbdBrightnessDown, exec, uwsm-app -- brightnessctl -d *::kbd_backlight set 33%-

bind=SUPER,R,submap,resize
submap=resize
binde=,right,resizeactive,10 0
binde=,left,resizeactive,-10 0
binde=,up,resizeactive,0 -10
binde=,down,resizeactive,0 10
bind=,escape,submap,reset
bind=SUPER,R,submap,reset
submap=reset

exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE
exec-once = uwsm-app -- systemctl --user import-environment
