diff --git a/flake.nix b/flake.nix index f23e029..a848ea1 100644 --- a/flake.nix +++ b/flake.nix @@ -7,10 +7,14 @@ nix-colors.url = "github:misterio77/nix-colors"; firefox-addons = { - url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprwm-contrib = { + url = "github:hyprwm/contrib"; + inputs.nixpkgs.follows = "nixpkgs"; }; - }; outputs = { self, nixpkgs, home-manager, ... }@inputs: @@ -25,6 +29,8 @@ homeManagerModules = import ./modules/home-manager; + wallpapers = import ./home/ooks/wallpapers + nixosConfigurations = { # X1 Carbon ooksx1 = lib.nixosSystem { diff --git a/home/ooks/opt/desktop/hyprland/binds.nix b/home/ooks/opt/desktop/hyprland/binds.nix new file mode 100644 index 0000000..2f323a4 --- /dev/null +++ b/home/ooks/opt/desktop/hyprland/binds.nix @@ -0,0 +1,139 @@ +{ + wayland.windowManager.hyprland.settings = { + bind = let + + terminal = config.home.sessionVariables.TERMINAL; + browser = config.home.sessionVariables.BROWSER; + editor = config.home.sessionVariables.EDITOR; + + makoctl = "${config.services.mako.package}/bin/makoctl"; + + playerctl = "${config.services.playerctld.package}/bin/playerctl"; + playerctld = "${config.services.playerctld.package}/bin/playerctld"; + pactl = "${pkgs.pulseaudio}/bin/pactl"; + in [ + + # Program Launch + "SUPER,b,exec,${browser}"; + "SUPER,return,exec,${terminal}"; + "SUPER,e,exec,${editor}"; + + #Media + + ",XF86AudioNext,exec,${playerctl} next"; + ",XF86AudioPrev,exec,${playerctl} previous"; + ",XF86AudioPlay,exec,${playerctl} play-pause"; + ",XF86AudioStop,exec,${playerctl} stop"; + + # Window Management + + "SUPER,Q,killactive"; + "SUPERSHIFT ALT,delete,exit"; + "SUPER,F,fullscreen"; + "SUPER,Space,togglefloating"; + "SUPER,P,pseudo"; # dwindle + "SUPER,S,togglesplit"; # dwindle + + # Focus + + "SUPER,left,movefocus,l"; + "SUPER,right,movefocus,r"; + "SUPER,up,movefocus,u"; + "SUPER,down,movefocus,d"; + + +# ----- MULTIMEDIA KEYBINDS ----- # + +binde=, XF86AudioRaiseVolume, exec, ~/.scripts/volume_notify.sh 5%+ +binde=, XF86AudioLowerVolume, exec, ~/.scripts/volume_notify.sh 5%- +bind=, XF86AudioMute, exec, ~/.scripts/sounddeviceswap.sh +bind = SUPER, bracketleft, exec, playerctl --player=spotify_player previous +bind = SUPER, bracketright, exec, playerctl --player=spotify_player next +bind = SUPER, backslash, exec, playerctl --player=spotify_player play-pause + +# ----- SCREENSHOT KEYBINDS ----- # + +bind = SUPER CTRL, escape, exec, hyprshot -m window +bind = SUPER, escape, exec, hyprshot -m region + +# ----- MISC KEYBINDS ----- # + +bind = SUPER SHIFT, X, exec, hyprpicker -a -n + +# ----- WINDOW MANAGEMENT KEYBINDS ----- # + +bind = SUPER, Q, killactive, +bind = SUPERSHIFT ALT, delete, exit, +bind = SUPER, F, fullscreen, +bind = SUPER, Space, togglefloating, +bind = SUPER, P, pseudo, # dwindle +bind = SUPER, S, togglesplit, # dwindle + +# ----- FOCUS KEYBINDS ----- # + +bind = SUPER, left, movefocus, l +bind = SUPER, right, movefocus, r +bind = SUPER, up, movefocus, u +bind = SUPER, down, movefocus, d + +# ----- MOVE KEYBINDS ----- # + +bind = SUPER SHIFT, left, movewindow, l +bind = SUPER SHIFT, right, movewindow, r +bind = SUPER SHIFT, up, movewindow, u +bind = SUPER SHIFT, down, movewindow, d + +# ----- RESIZE KEYBINDS ----- # + +bind = SUPER CTRL, left, resizeactive, -20 0 +bind = SUPER CTRL, right, resizeactive, 20 0 +bind = SUPER CTRL, up, resizeactive, 0 -20 +bind = SUPER CTRL, down, resizeactive, 0 20 + +# ----- TOGGLE KEYBINDS ----- # + +bind= SUPER, g, togglegroup +bind= SUPER, tab, changegroupactive + +# ----- SPECIAL WORKSPACE KEYBINDS ----- # + +# ----- SWITCH WORKSPACE KEYBINDS ----- # + +bind = SUPER, 1, workspace, 1 +bind = SUPER, 2, workspace, 2 +bind = SUPER, 3, workspace, 3 +bind = SUPER, 4, workspace, 4 +bind = SUPER, 5, workspace, 5 +bind = SUPER, 6, workspace, 6 +bind = SUPER, 7, workspace, 7 +bind = SUPER, 8, workspace, 8 +bind = SUPER, 9, workspace, 9 +bind = SUPER, 0, workspace, 10 +bind = SUPER ALT, up, workspace, e+1 +bind = SUPER ALT, down, workspace, e-1 +bind = SUPER, tab, focusCurrentOrLast + +# ----- MOVE TO WORKSPACE KEYBINDS ----- # + +bind = SUPER SHIFT, 1, movetoworkspace, 1 +bind = SUPER SHIFT, 2, movetoworkspace, 2 +bind = SUPER SHIFT, 3, movetoworkspace, 3 +bind = SUPER SHIFT, 4, movetoworkspace, 4 +bind = SUPER SHIFT, 5, movetoworkspace, 5 +bind = SUPER SHIFT, 6, movetoworkspace, 6 +bind = SUPER SHIFT, 7, movetoworkspace, 7 +bind = SUPER SHIFT, 8, movetoworkspace, 8 +bind = SUPER SHIFT, 9, movetoworkspace, 9 +bind = SUPER SHIFT, 0, movetoworkspace, 10 + +# ----- MOUSE KEYBINDS ----- # + +bindm = SUPER, mouse:272, movewindow +bindm = SUPER, mouse:273, resizewindow +bind = SUPER, mouse_down, workspace, e+1 +bind = SUPER, mouse_up, workspace, e-1 + + ]; + + }; + } diff --git a/home/ooks/opt/desktop/hyprland/default.nix b/home/ooks/opt/desktop/hyprland/default.nix new file mode 100644 index 0000000..6b82c84 --- /dev/null +++ b/home/ooks/opt/desktop/hyprland/default.nix @@ -0,0 +1,160 @@ +{ lib, config, pkgs, ... }: { + imports = [ + ../standard + ../standard/wayland + + ./tty-init.nix + ./basic-binds.nix + ./systemd-fixes.nix + ]; + + home.packages = with pkgs; [ + inputs.hyprwm-contrib.grimblast + hyprslurp + ]; + + wayland.windowManager.hyprland = { + enable = true; + + settings = { + general = { + gaps_in = 15; + gaps_out = 20; + border_size = 2; + cursor_inactive_timeout = 4; + "col.active_border" = "0xff${config.colorscheme.colors.base0C}"; + "col.inactive_border" = "0xff${config.colorscheme.colors.base02}"; + "col.group_border_active" = "0xff${config.colorscheme.colors.base0B}"; + "col.group_border" = "0xff${config.colorscheme.colors.base04}"; + }; + input = { + kb_layout = "us"; + touchpad.disable_while_typing = false; + }; + dwindle.split_width_multiplier = 1.35; + misc.vfr = "on"; + + decoration = { + active_opacity = 0.94; + inactive_opacity = 0.84; + fullscreen_opacity = 1.0; + rounding = 5; + blur = true; + blur_size = 5; + blur_passes = 3; + blur_new_optimizations = true; + blur_ignore_opacity = true; + drop_shadow = true; + shadow_range = 12; + shadow_offset = "3 3"; + "col.shadow" = "0x44000000"; + "col.shadow_inactive" = "0x66000000"; + }; + animations = { + enabled = true; + bezier = [ + "easein,0.11, 0, 0.5, 0" + "easeout,0.5, 1, 0.89, 1" + "easeinback,0.36, 0, 0.66, -0.56" + "easeoutback,0.34, 1.56, 0.64, 1" + ]; + + animation = [ + "windowsIn,1,3,easeoutback,slide" + "windowsOut,1,3,easeinback,slide" + "windowsMove,1,3,easeoutback" + "workspaces,1,2,easeoutback,slide" + "fadeIn,1,3,easeout" + "fadeOut,1,3,easein" + "fadeSwitch,1,3,easeout" + "fadeShadow,1,3,easeout" + "fadeDim,1,3,easeout" + "border,1,3,easeout" + ]; + }; + + exec = [ + # need to fix "${pkgs.swaybg}/bin/swaybg -i --mode fill" + ]; + + bind = let + playerctl = "${config.services.playerctld.package}/bin/playerctl"; + playerctld = "${config.services.playerctld.package}/bin/playerctld"; + makoctl = "${config.services.mako.package}/bin/makoctl"; + + grimblast = "${pkgs.inputs.hyprwm-contrib.grimblast}/bin/grimblast"; + pactl = "${pkgs.pulseaudio}/bin/pactl"; + + gtk-launch = "${pkgs.gtk3}/bin/gtk-launch"; + xdg-mime = "${pkgs.xdg-utils}/bin/xdg-mime"; + defaultApp = type: "${gtk-launch} $(${xdg-mime} query default ${type})"; + + terminal = config.home.sessionVariables.TERMINAL; + browser = defaultApp "x-scheme-handler/https"; + editor = defaultApp "text/plain"; + in [ + # Program bindings + "SUPER,Return,exec,${terminal}" + "SUPER,e,exec,${editor}" + "SUPER,b,exec,${browser}" + # Brightness control (only works if the system has lightd) + ",XF86MonBrightnessUp,exec,light -A 10" + ",XF86MonBrightnessDown,exec,light -U 10" + # Volume + ",XF86AudioRaiseVolume,exec,${pactl} set-sink-volume @DEFAULT_SINK@ +5%" + ",XF86AudioLowerVolume,exec,${pactl} set-sink-volume @DEFAULT_SINK@ -5%" + ",XF86AudioMute,exec,${pactl} set-sink-mute @DEFAULT_SINK@ toggle" + "SHIFT,XF86AudioMute,exec,${pactl} set-source-mute @DEFAULT_SOURCE@ toggle" + ",XF86AudioMicMute,exec,${pactl} set-source-mute @DEFAULT_SOURCE@ toggle" + # Screenshotting + ",Print,exec,${grimblast} --notify copy output" + "SHIFT,Print,exec,${grimblast} --notify copy active" + "CONTROL,Print,exec,${grimblast} --notify copy screen" + "SUPER,Print,exec,${grimblast} --notify copy window" + "ALT,Print,exec,${grimblast} --notify copy area" + ] ++ + + (lib.optionals config.services.playerctld.enable [ + # Media control + ",XF86AudioNext,exec,${playerctl} next" + ",XF86AudioPrev,exec,${playerctl} previous" + ",XF86AudioPlay,exec,${playerctl} play-pause" + ",XF86AudioStop,exec,${playerctl} stop" + "ALT,XF86AudioNext,exec,${playerctld} shift" + "ALT,XF86AudioPrev,exec,${playerctld} unshift" + "ALT,XF86AudioPlay,exec,systemctl --user restart playerctld" + ]) ++ + # Screen lock + (lib.optionals config.programs.swaylock.enable [ + ",XF86Launch5,exec,${swaylock} -S" + ",XF86Launch4,exec,${swaylock} -S" + "SUPER,backspace,exec,${swaylock} -S" + ]) ++ + # Notification manager + (lib.optionals config.services.mako.enable [ + "SUPER,w,exec,${makoctl} dismiss" + ]) ++ + + + monitor = map (m: let + resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}"; + position = "${toString m.x}x${toString m.y}"; + in + "${m.name},${if m.enabled then "${resolution},${position},1" else "disable"}" + ) (config.monitors); + + workspace = map (m: + "${m.name},${m.workspace}" + ) (lib.filter (m: m.enabled && m.workspace != null) config.monitors); + + }; + # This is order sensitive, so it has to come here. + extraConfig = '' + # Passthrough mode (e.g. for VNC) + bind=SUPER,P,submap,passthrough + submap=passthrough + bind=SUPER,P,submap,reset + submap=reset + ''; + }; +} diff --git a/home/ooks/opt/desktop/hyprland/tty-init.nix b/home/ooks/opt/desktop/hyprland/tty-init.nix new file mode 100644 index 0000000..16763a9 --- /dev/null +++ b/home/ooks/opt/desktop/hyprland/tty-init.nix @@ -0,0 +1,19 @@ +{ + programs = { + fish.loginShellInit = '' + if test (tty) = "/dev/tty1" + exec Hyprland &> /dev/null + end + ''; + zsh.loginExtra = '' + if [ "$(tty)" = "/dev/tty1" ]; then + exec Hyprland &> /dev/null + fi + ''; + zsh.profileExtra = '' + if [ "$(tty)" = "/dev/tty1" ]; then + exec Hyprland &> /dev/null + fi + ''; + }; +}