diff --git a/environments/hyprland/default.nix b/environments/hyprland/default.nix new file mode 100644 index 0000000..8fcd966 --- /dev/null +++ b/environments/hyprland/default.nix @@ -0,0 +1,37 @@ +{ + pkgs, + user, + lib, + ... +}: { + imports = [ + ../../modules/wm + ../../modules/gui + ]; + + programs.hyprland = { + enable = true; + withUWSM = true; + }; + + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.greetd}/bin/agreety --cmd zsh"; + user = "greeter"; + }; + initial_session = { + command = "${lib.getExe pkgs.uwsm} start -S hyprland-uwsm.desktop"; + user = user; + }; + }; + }; + + xdg.portal = { + enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [pkgs.xdg-desktop-portal-gtk]; + config.common.default = "*"; + }; +} diff --git a/environments/hyprland/home.nix b/environments/hyprland/home.nix new file mode 100644 index 0000000..ff2dad9 --- /dev/null +++ b/environments/hyprland/home.nix @@ -0,0 +1,125 @@ +{pkgs, ...}: { + imports = [ + ../../modules/gui/home.nix + ../../modules/wm/home.nix + ]; + services.hyprpolkitagent.enable = true; + + home.packages = with pkgs; [ + pamixer + brightnessctl + playerctl + hyprpicker + + gnome-control-center + gnome-weather + wdisplays + ]; + + xdg.configFile."hypr/hyprland.conf".source = ./hyprland.conf; + + # wayland.windowManager.hyprland = { + # enable = true; + # extraSessionVariables = { + # XDG_CURRENT_DESKTOP = "river"; + # }; + # settings = { + # default-layout = "luatile"; + # spawn = [ + # "${pkgs.river-luatile}/bin/river-luatile" + # "wallpaper" + # "ags" + # ]; + # + # input = { + # "'*'" = { + # pointer-accel = 0; + # scroll-method = "two-finger"; + # }; + # }; + # + # # border-color-focused = "0x94e2d5"; + # # border-color-unfocused = "0x00000000"; + # # border-color-urgent = "0xcba6f7"; + # + # map = { + # normal = { + # # "Super+Shift Period" = "send-to-output -current-tags next"; + # # "Super+Shift Comma" = "send-to-output -current-tags previous"; + # # "Super+Control+Shift Period" = "send-to-output next"; + # # "Super+Control+Shift Comma" = "send-to-output previous"; + # + # "Super T" = "send-layout-cmd luatile 'set_layout(\"tiling\")'"; + # "Super M" = "send-layout-cmd luatile 'set_layout(\"monocle\")'"; + # "Super D" = "send-layout-cmd luatile 'set_layout(\"deck\")'"; + # }; + # }; + # map-pointer = { + # normal = { + # "Super+Shift BTN_LEFT" = "move-view"; + # "Super+Shift BTN_RIGHT" = "resize-view"; + # }; + # }; + # }; + # extraConfig = '' + # for i in $(seq 1 9) + # do + # tags=$((1 << (i - 1))) + # riverctl map normal Super "$i" set-focused-tags -alternate $tags + # riverctl map normal Super+Shift "$i" set-view-tags $tags + # riverctl map normal Super+Control "$i" toggle-focused-tags $tags + # riverctl map normal Super+Shift+Control "$i" toggle-view-tags $tags + # done + # + # all_tags=$(((1 << 32) - 1)) + # riverctl map normal Super 0 set-focused-tags -alternate "$all_tags" + # riverctl map normal Super+Shift 0 set-view-tags "$all_tags" + # + # # Focus second screen by default (also spawn apps there) + # riverctl focus-output DP-1 + # riverctl set-focused-tags $((1 << 3)) + # + # hyprlock --immediate + # ''; + # }; + + services.kanshi = { + enable = true; + systemdTarget = "graphical-session.target"; + settings = [ + { + output.criteria = "eDP-1"; + output.scale = 1.6; + } + { + profile.name = "undocked"; + profile.outputs = [ + { + criteria = "eDP-1"; + status = "enable"; + } + ]; + } + { + profile.name = "docked"; + profile.outputs = [ + { + criteria = "eDP-1"; + status = "disable"; + } + { + criteria = "Dell Inc. DELL S2722QC 2HHZH24"; + # position = "1500,0"; + position = "0,900"; + scale = 1.7; + } + { + criteria = "*"; + position = "0,0"; + scale = 1.4; + } + ]; + } + ]; + }; +} diff --git a/environments/hyprland/hyprland.conf b/environments/hyprland/hyprland.conf new file mode 100644 index 0000000..56d533b --- /dev/null +++ b/environments/hyprland/hyprland.conf @@ -0,0 +1,134 @@ +general { + resize_on_border = true + layout = master +} + +decoration { + blur { + enabled = false + } + shadow { + enabled = false + } + animations { + enabled = false + } +} + +input { + kb_options = caps:escape_shifted_capslock + accel_profile = adaptive + touchpad { + natural_scroll = true + middle_button_emulation = true + clickfinger_behavior = true + drag_lock = true + } +} + +gestures { + workspace_swipe = true +} + +misc { + new_window_takes_over_fullscreen = true + middle_click_paste = false +} + +binds { + # allow_workspace_cycles = true + movefocus_cycles_fullscreen = true +} + +xwayland { + force_zero_scaling = true +} + +cursor { + warp_on_change_workspace = true + hide_on_key_press = true +} + +master { + allow_small_split = true + new_status = master + new_on_top = true +} + + +bindl = , XF86AudioPlay, exec, playerctl play-pause +bindl = , XF86AudioPause, exec, playerctl play-pause +bindl = , XF86AudioMedia, exec, playerctl play-pause +bindl = , XF86AudioPrev, exec, playerctl previous +bindl = , XF86AudioNext, exec, playerctl next +bindle = , XF86AudioRaiseVolume, exec, pamixer -i 5 +bindle = , XF86AudioLowerVolume, exec, pamixer -d 5 +bindl = , XF86AudioMute, exec, pamixer --toggle-mute +bindle = , XF86MonBrightnessUp, exec, brightnessctl s +5% +bindle = , XF86MonBrightnessDown, exec, brightnessctl s 5%- + +bind = Super, c, killactive +bind = Super+Shift, c, forcekillactive + +bind = Super, k, layoutmsg, cyclenext +bind = Super, j, layoutmsg, cycleprev +bind = Super+Shift, k, layoutmsg, swapnext +bind = Super+Shift, j, layoutmsg, swapprev +bind = Super, Return, layoutmsg, swapwithmaster + +bind = Super, h, layoutmsg, mfact -0.05 +bind = Super, l, layoutmsg, mfact +0.05 +bind = Super, u, layoutmsg, removemaster +bind = Super, i, layoutmsg, addmaster + +bind = Super, m, fullscreen, 1 + +bind = Super, f, fullscreen, 0 +bind = Super+Shift, f, togglefloating + +bind = Super, Period, focusmonitor, +1 +bind = Super, Comma, focusmonitor, -1 +bind = Super+Shift, Period, movewindow, mon:+1 +bind = Super+Shift, Comma, movewindow, mon:-1 + +bind = Super, 1, focusworkspaceoncurrentmonitor, 1 +bind = Super+Shift, 1, movetoworkspacesilent, 1 +bind = Super, 2, focusworkspaceoncurrentmonitor, 2 +bind = Super+Shift, 2, movetoworkspacesilent, 2 +bind = Super, 3, focusworkspaceoncurrentmonitor, 3 +bind = Super+Shift, 3, movetoworkspacesilent, 3 +bind = Super, 4, focusworkspaceoncurrentmonitor, 4 +bind = Super+Shift, 4, movetoworkspacesilent, 4 +bind = Super, 5, focusworkspaceoncurrentmonitor, 5 +bind = Super+Shift, 5, movetoworkspacesilent, 5 +bind = Super, 6, focusworkspaceoncurrentmonitor, 6 +bind = Super+Shift, 6, movetoworkspacesilent, 6 +bind = Super, 7, focusworkspaceoncurrentmonitor, 7 +bind = Super+Shift, 7, movetoworkspacesilent, 7 +bind = Super, 8, focusworkspaceoncurrentmonitor, 8 +bind = Super+Shift, 8, movetoworkspacesilent, 8 +bind = Super, 9, focusworkspaceoncurrentmonitor, 9 +bind = Super+Shift, 9, movetoworkspacesilent, 9 + + +bind = Super, r, exec, uwsm app -- $BROWSER +bind = Super, e, exec, uwsm app -- $TERMINAL +bind = Super, p, exec, rofi -show drun -show-icons -run-command "uwsm app -- {cmd}" +bind = Super, x, exec, screenshot +bind = Super+Control, x, exec, screenshot-freeze +bind = Super+Shift, x, exec, record +bind = Super, b, exec, hyprpicker | wl-copy +bind = Super, v, exec, cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy +bind = Super+Shift, l, exec, loginctl lock-session + +windowrule = workspace 3 silent, class:discord +windowrule = workspace 3 silent, class:vesktop +windowrule = workspace 2 silent, class:Youtube Music + +# smart gaps +workspace = w[tv1], gapsout:0, gapsin:0 +workspace = f[1], gapsout:0, gapsin:0 +windowrule = bordersize 0, floating:0, onworkspace:w[tv1] +windowrule = rounding 0, floating:0, onworkspace:w[tv1] +windowrule = bordersize 0, floating:0, onworkspace:f[1] +windowrule = rounding 0, floating:0, onworkspace:f[1] diff --git a/environments/river/home.nix b/environments/river/home.nix index d620b03..20a7aae 100644 --- a/environments/river/home.nix +++ b/environments/river/home.nix @@ -228,15 +228,4 @@ in { } ]; }; - - dconf.settings = { - "org/gnome/desktop/interface" = { - cursor-blink = false; - }; - # Disable close/resize buttons on GTK windows that really want CSD. - # gsettings set org.gnome.desktop.wm.preferences button-layout "" - "org/gnome/desktop/wm/preferences" = { - button-layout = ""; - }; - }; } diff --git a/environments/wsl/home.nix b/environments/wsl/home.nix index f1e5e3a..f77523b 100644 --- a/environments/wsl/home.nix +++ b/environments/wsl/home.nix @@ -1,7 +1,7 @@ {lib, ...}: { imports = [ # Install apps that I open with wslg (and tools like wl-clipboard which works) - ../../modules/gui + ../../modules/gui/home.nix ]; gtk.enable = lib.mkForce false; diff --git a/flake.nix b/flake.nix index ff373db..77d9fc3 100644 --- a/flake.nix +++ b/flake.nix @@ -70,7 +70,7 @@ }); in { nixosConfigurations.fuhen = mkSystem "fuhen" { - env = "river"; + env = "hyprland"; custom = [ nixos-hardware.nixosModules.tuxedo-infinitybook-pro14-gen7 ]; diff --git a/modules/wm/home.nix b/modules/wm/home.nix index 5645bcc..c41e1fe 100644 --- a/modules/wm/home.nix +++ b/modules/wm/home.nix @@ -32,7 +32,6 @@ wf-recorder -g "$(slurp -b 00000000 -s 61616140)" -f "$HOME/rec-$(date +%Y-%m-%d_%H:%M:%S).mp4" ''; }; - in { imports = [ ./rofi @@ -67,4 +66,15 @@ in { }; services.cliphist.enable = true; + + dconf.settings = { + "org/gnome/desktop/interface" = { + cursor-blink = false; + }; + # Disable close/resize buttons on GTK windows that really want CSD. + # gsettings set org.gnome.desktop.wm.preferences button-layout "" + "org/gnome/desktop/wm/preferences" = { + button-layout = ""; + }; + }; } diff --git a/nvim/default.nix b/nvim/default.nix index fe8ea8a..751142a 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -136,6 +136,7 @@ in zls lua-language-server bash-language-server + hyprls # gopls also needs go /shame gopls diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index f760f72..8928519 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -15,6 +15,7 @@ vim.lsp.enable("zls") vim.lsp.enable("gopls") vim.lsp.enable("bashls") vim.lsp.enable("jsonls") +vim.lsp.enable("hyprls") vim.api.nvim_create_autocmd("LspAttach", { desc = "Custom lsp attach",