{ config, pkgs, ... }:
{
	imports = [
		./waybar.nix
	];
	wayland.windowManager.hyprland = {
		enable = true;
		systemd.enable = true;
		xwayland.enable = true;
		plugins = [
			# pkgs.hyprlandPlugins.hyprbars
		];
		settings = {
			input = {
				kb_layout = "us";
				kb_options = "caps:swapescape";
				touchpad = {
					natural_scroll = true;
				};
			};
			decoration = {
				rounding = "10";
				rounding_power = "2";
				active_opacity = "1";
				inactive_opacity = ".7";
				shadow = {
					enabled = true;
					range = "4";
					render_power = "3";
					color = "rgba(1a1a1aee)";
				};
				blur = {
					enabled = true;
					size = "3";
					passes = "1";
					vibrancy = "0.1696";
				};
			};
			"$mainMod" = "SUPER";
			bindm = [
				"$mainMod, mouse:272, movewindow"
				"$mainMod, mouse:273, resizewindow"
				"$mainMod ALT, mouse:272, resizewindow"
			];
		};
		extraConfig = ''
		general {
			gaps_in = 5
			gaps_out = 5
			border_size = 1
			col.active_border = rgb(b000b5)
			col.inactive_border = rgb(1f2335)
			resize_on_border = true
			allow_tearing = false
			layout = dwindle
		}
		
		dwindle {
				pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
				preserve_split = true # You probably want this
				default_split_ratio = 1.1
				force_split = 0
		}
		
		exec-once = waybar
		monitor = eDP-1, preferred,0x0,2
		# monitor = Virtual-1, 2800x1752@120, 1920x0, 1

		$terminal = footclient -e tmux new-session zsh -c '~/.local/usr/bin/tmuxstartup.sh'
		$fileManager = footclient -T vifm -e vifm
		$systeminfo = hyprsysteminfo
		$menu = wofi --show drun
		$browser = qutebrowser
		$notes = footclient -T capture -e pytui -n
		$sysmon = footclient -T system-monitor -e bashtop

		bind = $mainMod SHIFT, M, exec, hyprvirtmon.py
		bind = $mainMod SHIFT, Return, exec, $terminal
		bind = $mainMod, E, exec, $fileManager
		bind = $mainMod SHIFT, C, killactive
		bind = $mainMod SHIFT, Q, exit
		bind = $mainMod, V, togglefloating
		bind = $mainMod, R, exec, $menu
		bind = $mainMod, B, exec, $browser
		bind = $mainMod, M, exec, $sysmon
		bind = $mainMod CTRL, N, exec, $notes
		# bind = $mainMod, P, exec, $menu
		bind = $mainMod, V, togglefloating
		bind = $mainMod, P, pseudo, # dwindle
		bind = $mainMod, TAB, togglesplit, # dwindle
		bind = $mainMod, Y, fullscreen, 1
		bind = $mainMod, T, togglegroup

		# 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 focus with mainMod + Vim keys
		bind = $mainMod, H, movefocus, l
		bind = $mainMod, SEMICOLON, movefocus, r
		bind = $mainMod, K, movefocus, u
		bind = $mainMod, J, movefocus, 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

		bind = $mainMod, S, togglespecialworkspace, magic
		bind = $mainMod SHIFT, S, movetoworkspace, special:magic

		bind = $mainMod, mouse_down, workspace, e+1
		bind = $mainMod, mouse_up, workspace, e-1

		bindm = $mainMod, mouse:272, movewindow
		bindm = $mainMod, mouse:273, resizewindow

		bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
		bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
		bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
		bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
		bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
		bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-

# Requires playerctl
		bindl = , XF86AudioNext, exec, playerctl next
		bindl = , XF86AudioPause, exec, playerctl play-pause
		bindl = , XF86AudioPlay, exec, playerctl play-pause
		bindl = , XF86AudioPrev, exec, playerctl previous


		bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable"
		bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, preferred,auto,auto"

		windowrule = float,title:^(capture)$
		windowrule = size 800 600,title:^(capture)$
		windowrule = float,title:^(system-monitor)$
		windowrule = size 1024 768,title:^(system-monitor)$
		windowrulev2 = opacity 1.0 override,class:^(firefox)$

		# Ignore maximize requests from apps. You'll probably like this.
		windowrule = suppressevent maximize, class:.*

		# Fix some dragging issues with XWayland
		windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0

		'';
	};
	services.hyprpaper = {
		enable = true;
		settings = {
			ipc = "on";
			splash = false;
			splash_offset = 2.0;
			preload = [ "/etc/nixos/home/Wallpapers/tokyonight1.jpg" "/etc/nixos/home/Wallpapers/nord1.jpg" ];
			wallpaper = [ "eDP-1,/etc/nixos/home/Wallpapers/nord1.jpg" ];
		};
	};
}
