feat: add home manager hyprland module to enable hyprland plugins

This commit is contained in:
DACHXY 2024-12-30 18:15:09 +08:00
parent 6997c5a968
commit 64499a5e90
30 changed files with 456 additions and 365 deletions

87
home/user/hypr/bind.nix Normal file
View file

@ -0,0 +1,87 @@
{ mainMod }:
let
browser = "firefox";
terminal = "ghostty";
filemanager = "thunar";
scripts = "~/.config/scripts";
resizeStep = builtins.toString 20;
brightnessStep = builtins.toString 10;
volumeStep = builtins.toString 2;
in
[
''${mainMod}, F, exec, ${browser}''
''${mainMod}, RETURN, exec, ${terminal}''
''CTRL ALT, T, exec, ${terminal}''
''${mainMod}, Q, killactive, ''
''${mainMod}, M, exec, wlogout --protocol layer-shell''
''${mainMod}, E, exec, ${filemanager}''
''${mainMod}, V, togglefloating, ''
''ALT, SPACE, exec, rofi -config ~/.config/rofi/apps.rasi -show drun''
''${mainMod} ALT, W, exec, ${scripts}/waybarRestart.sh''
''${mainMod}, P, pseudo, # dwindle''
''${mainMod}, S, togglesplit, # dwindle''
''CTRL ${mainMod} SHIFT, L, exec, swaylock''
''${mainMod} SHIFT, s, exec, hyprshot -m region --clipboard-only --freeze''
''CTRL SHIFT, s, exec, hyprshot -m window --clipboard-only --freeze''
''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output --clipboard-only --freeze''
''${mainMod}, PERIOD, exec, flatpak run it.mijorus.smile ''
''${mainMod}, X, exec, sleep 0.1 && swaync-client -t -sw''
''${mainMod} SHIFT, C, centerwindow''
'',F11, fullscreen''
''${mainMod}, F, exec, ${browser}''
''${mainMod}, C, exec, NIXOS_OZONE_WL=1 code''
# Cycle windows
''ALT, TAB, cyclenext''
''ALT, TAB, bringactivetotop''
''${mainMod}, h, movefocus, l''
''${mainMod}, l, movefocus, r''
''${mainMod}, k, movefocus, u''
''${mainMod}, j, movefocus, d''
''${mainMod}, mouse_down, workspace, e-1''
''${mainMod}, mouse_up, workspace, e+1''
''${mainMod} CTRL, l, resizeactive, ${resizeStep} 0''
''${mainMod} CTRL, h, resizeactive, -${resizeStep} 0''
''${mainMod} CTRL, k, resizeactive, 0 -${resizeStep}''
''${mainMod} CTRL, j, resizeactive, 0 ${resizeStep}''
''${mainMod} SHIFT, l, movewindow, r''
''${mainMod} SHIFT, h, movewindow, l''
''${mainMod} SHIFT, k, movewindow, u''
''${mainMod} SHIFT, j, movewindow, d''
# Media
'',XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%+''
'',XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%-''
'',XF86MonBrightnessDown, exec, brightnessctl set ${brightnessStep}%-''
'',XF86MonBrightnessUp, exec, brightnessctl set ${brightnessStep}%+''
'',XF86AudioPrev, exec, playerctl previous''
'',XF86AudioNext, exec, playerctl next''
'',XF86AudioPlay, exec, playerctl play-pause''
'',XF86AudioStop, exec, playerctl stop''
'',XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle''
# ==== Plugins ==== #
# Overview
''${mainMod}, o, hyprexpo:expo, toggle''
] ++ (
# workspaces
# binds $mainMod + [shift +] {1..9} to [move to] workspace {1..9}
builtins.concatLists (builtins.genList
(i:
let ws = i + 1;
in
[
"${mainMod}, code:1${toString i}, workspace, ${toString ws}"
"${mainMod} SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
]
)
9)
)

6
home/user/hypr/bindm.nix Normal file
View file

@ -0,0 +1,6 @@
{ mainMod }:
[
# Move/resize windows with mainMod + LMB/RMB and dragging
''${mainMod}, mouse:272, movewindow''
''${mainMod}, mouse:273, resizewindow''
]

15
home/user/hypr/exec.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, lib, inputs, system, ... }:
let
startupScript = pkgs.pkgs.writeShellScriptBin "start" ''
swaync -s ~/.config/swaync/style.css -c ~/.config/swaync/config.json &
dbus-update-activation-environment --systemd --all &
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
waybar -c ~/.config/waybar/config.json -s ~/.config/waybar/style.css &
swayidle -w &
sway-audio-idle-inhibit &
fcitx5 -d -r &
fcitx5-remote -r &
hyprsunset -t 3000k &
'';
in
''${startupScript}/bin/start''

22
home/user/hypr/input.nix Normal file
View file

@ -0,0 +1,22 @@
{
input = {
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_rules = "";
follow_mouse = 1;
accel_profile = "flat";
touchpad = {
natural_scroll = true;
};
sensitivity = -0.1; # -1.0 - 1.0, 0 means no modification.
};
cursor = {
no_hardware_cursors = true;
};
}

View file

@ -0,0 +1,5 @@
[
''desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271,2560x1440@165, 0x0, 1''
''desc:Acer Technologies XV272U V3 7422007E54222, 2560x1440@144, -1440x-540, 1, transform, 1''
''desc:LG Display 0x0665, preferred, 0x0, 1.25''
]

26
home/user/hypr/plugin.nix Normal file
View file

@ -0,0 +1,26 @@
{
hyprexpo = {
columns = 3;
gap_size = 5;
bg_col = "rgb(111111)";
workspace_method = "center current"; # [center/first] [workspace] e.g. first 1 or center m+1
enable_gesture = true; # laptop touchpad
gesture_fingers = 3; # 3 or 4
gesture_distance = 300; # how far is the "max"
gesture_positive = true; # positive = swipe down. Negative = swipe up.
};
hyprwinrap = {
class = "kitty-bg";
};
touch_gestures = {
sensitivity = 4.0;
workspace_swipe_fingers = 3;
workspace_swipe_edge = "d";
long_press_delay = 400;
resize_on_border_long_press = true;
edge_margin = 10;
emulate_touchpad_swipe = false;
};
}

77
home/user/hypr/window.nix Normal file
View file

@ -0,0 +1,77 @@
{
xwayland = {
force_zero_scaling = true;
};
general = {
gaps_in = 5;
gaps_out = 10;
border_size = 2;
"col.active_border" = "rgb(EBDBB2) rgb(24273A) rgb(24273A) rgb(EBDBB2) 45deg";
"col.inactive_border" = "rgb(24273A) rgb(24273A) rgb(24273A) rgb(24273A) 45deg";
layout = "dwindle";
allow_tearing = false;
};
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 5;
passes = 3;
new_optimizations = true;
ignore_opacity = "on";
xray = false;
};
active_opacity = 0.8;
inactive_opacity = 0.8;
fullscreen_opacity = 1.0;
};
animations = {
enabled = true;
bezier = [
"linear, 0, 0, 1, 1"
"md3_standard, 0.2, 0, 0, 1"
"md3_decel, 0.05, 0.7, 0.1, 1"
"md3_accel, 0.3, 0, 0.8, 0.15"
"overshot, 0.05, 0.9, 0.1, 1.1"
"crazyshot, 0.1, 1.5, 0.76, 0.92"
"hyprnostretch, 0.05, 0.9, 0.1, 1.0"
"menu_decel, 0.1, 1, 0, 1"
"menu_accel, 0.38, 0.04, 1, 0.07"
"easeInOutCirc, 0.85, 0, 0.15, 1"
"easeOutCirc, 0, 0.55, 0.45, 1"
"easeOutExpo, 0.16, 1, 0.3, 1"
"softAcDecel, 0.26, 0.26, 0.15, 1"
"md2, 0.4, 0, 0.2, 1"
];
animation = [
"windows, 1, 3, md3_decel, popin 60%"
"windowsIn, 1, 3, md3_decel, popin 60%"
"windowsOut, 1, 3, md3_accel, popin 60%"
"border, 1, 10, default"
"fade, 1, 3, md3_decel"
"workspaces, 1, 7, menu_decel, slide"
"specialWorkspace, 1, 3, md3_decel, slidevert"
];
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
master = {
new_on_top = true;
};
gestures = {
workspace_swipe = true;
workspace_swipe_cancel_ratio = 0.15;
};
misc = {
force_default_wallpaper = 0;
};
}

View file

@ -0,0 +1,65 @@
{
windowrule = [
"pseudo, fcitx"
"float, file_progress"
"float, confirm"
"float, dialog"
"float, download"
"float, notification"
"float, error"
"float, splash"
"float, confirmreset"
"float, title:Open File"
"float, title:branchdialog"
"float, viewnior"
"float, pavucontrol-qt"
"float, pavucontrol"
"float, file-roller"
"fullscreen, wlogout"
"float, title:wlogout"
"fullscreen, title:wlogout"
"idleinhibit stayfocused, mpv"
];
windowrulev2 = [
"float, title:^(Media viewer)$"
"float, title:^(File Operation Progress)$"
"float, class:^(it.mijorus.smile)"
"float, class:^(xdg-desktop-portal-gtk)$"
"float, title:^(Steam Settings)$"
# Picture in picture windows
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
"float, class:^(vesktop)$,title:^(Discord Popout)$"
"pin, class:^(vesktop)$,title:^(Discord Popout)$"
"float, class:^(steam)$,title:^(Friends List)$"
# Workspace assign
"workspace: 5, class: ^(steam)$"
# Line
"workspace: 2, initialTitle: ^(LINE)$"
"float, initialTitle: ^(LINE)$"
# VLC
"workspace: 3, initialClass: ^(vlc)"
];
layerrule = [
"blur, waybar"
"blur, logout_dialog"
"unset, rofi"
"blur, rofi"
"ignorezero, rofi"
"unset, swaync-control-center"
"unset, swaync-notification-window"
"blur, swaync-control-center"
"blur, swaync-notification-window"
"ignorezero, swaync-control-center"
"ignorezero, swaync-notification-window"
"ignorealpha 0.1, swaync-control-center"
"ignorealpha 0.1, swaync-notification-window"
];
}