diff --git a/modules/desktop.nix b/modules/desktop.nix index 5f4f701..eb33165 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -77,6 +77,7 @@ in droidcam.enable = true; firefox.enable = true; firefox.languagePacks = ["fr"]; + hyprland.enable = true; ssh.askPassword = pkgs.lib.mkForce "${pkgs.ksshaskpass.out}/bin/ksshaskpass"; # conflict between kde and gnome cf. https://github.com/NixOS/nixpkgs/issues/75867 ssh.startAgent = true; @@ -162,7 +163,7 @@ in libreoffice-qt libsForQt5.ark #libsForQt5.krohnkite - #libsForQt5.bismuth + libsForQt5.bismuth mixxx nextcloud-client obsidian diff --git a/modules/home-config.nix b/modules/home-config.nix index 1347ff9..1803dfd 100644 --- a/modules/home-config.nix +++ b/modules/home-config.nix @@ -31,6 +31,14 @@ let p.vue p.yaml ])); + startupScript = pkgs.pkgs.writeShellScriptBin "hyprland-start" '' + ${pkgs.waybar}/bin/waybar & + ${pkgs.swww}/bin/swww init & + + sleep 1 + + ${pkgs.swww}/bin/swww img /home/mrflos/Nextcloud/Images/Wallpapers/chihiro014.jpg & + ''; in { # TODO can we automate the installation of home-manager ? # sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager @@ -62,6 +70,10 @@ in { rust-analyzer-unwrapped php83Packages.composer nodejs_20 + swww + grimblast + swaylock + waybar yarn ]; @@ -230,6 +242,8 @@ in { oh-my-zsh = { enable = true; extraConfig = '' + zstyle :omz:plugins:ssh-agent helper ksshaskpass + zstyle :omz:plugins:ssh-agent agent-forwarding yes zstyle :omz:plugins:ssh-agent lazy yes ''; plugins = [ "git" "ssh-agent" ]; @@ -239,6 +253,105 @@ in { }; services.ssh-agent.enable = true; + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.env = lib.mapAttrsToList (name: value: "${name},${builtins.toString value}") config.home.sessionVariables; + wayland.windowManager.hyprland.settings = { + exec-once = ''${startupScript}/bin/hyprland-start''; + "$mod" = "SUPER"; + + # assign apps + "$term" = "kitty"; + "$editor" = "nvim"; + "$file" = "dolphin"; + "$browser" = "firefox"; + + bind = [ + ", Print, exec, grimblast copy area" + # Window/Session actions + "$mod, Q, killactive" + "ALT, F4, killactive" + "$mod, delete, exit" # kill hyperland session + "$mod, W, togglefloating" # toggle the window on focus to float + "$mod, G, togglegroup" # toggle the window on focus to float + "ALT, return, fullscreen" # toggle the window on focus to fullscreen + "$mod, L, exec, swaylock" # lock screen + # "$mod, backspace, exec, wlogout-launcher-hyprland 1" # logout menu + "$CONTROL, ESCAPE, exec, systemctl-toggle --user waybar.service" + + # Application shortcuts + "$mod, T, exec, $term" # open terminal + "$mod, E, exec, $file" # open file manager + "$mod, C, exec, $editor" # open vscode + "$mod, F, exec, $browser" # open browser + + # Move focus with mainMod + arrow keys + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + "ALT, Tab, movefocus, d" + + + # Switch workspaces relative to the active workspace with mainMod + CTRL + [←→] + "$mod CTRL, right, workspace, r+1" + "$mod CTRL, left, workspace, r-1" + + # move to the first empty workspace instantly with mainMod + CTRL + [↓] + "$mod CTRL, down, workspace, empty" + + # Move active window to a relative workspace with mainMod + CTRL + ALT + [←→] + "$mod CTRL ALT, right, movetoworkspace, r+1" + "$mod CTRL ALT, left, movetoworkspace, r-1" + + # Move active window around current workspace with mainMod + SHIFT + CTRL [←→↑↓] + "$mod SHIFT $CONTROL, left, movewindow, l" + "$mod SHIFT $CONTROL, right, movewindow, r" + "$mod SHIFT $CONTROL, up, movewindow, u" + "$mod SHIFT $CONTROL, down, movewindow, d" + + # Scroll through existing workspaces with mainMod + scroll + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + + # Special workspaces (scratchpad) + "$mod ALT, S, movetoworkspacesilent, special" + "$mod, S, togglespecialworkspace," + + # Toggle Layout + "$mod, J, togglesplit," # dwindle + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + "$mod ALT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" # Move window silently to workspace Super + Alt + [0-9] + ] + ) + 10) + ); + + # Move/Resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + # Resize windows + binde = [ + "$mod SHIFT, right, resizeactive, 30 0" + "$mod SHIFT, left, resizeactive, -30 0" + "$mod SHIFT, up, resizeactive, 0 -30" + "$mod SHIFT, down, resizeactive, 0 30" + ]; + }; }; }