NixOS/home/modules/hyprland/hyprland.nix

240 lines
7.8 KiB
Nix
Raw Normal View History

2024-06-12 09:54:11 +07:00
{ lib, inputs, pkgs, config, ... }:
let
cfg = config.profile.hyprland;
select-window = rec {
filename = "select-window.sh";
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/search-window.sh));
path = "${script}/bin/${filename}";
};
init-wallpaper = rec {
filename = "init-wallpaper.sh";
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/init-wallpaper.sh));
path = "${script}/bin/${filename}";
};
gnome-keyring = rec {
filename = "gnome-keyring.sh";
script = pkgs.writeScriptBin filename (builtins.readFile (./scripts/gnome-keyring.sh));
path = "${script}/bin/${filename}";
};
in
{
config = lib.mkIf cfg.enable {
home.packages = [
inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
2024-06-12 18:09:56 +07:00
pkgs.wl-clipboard
pkgs.kcalc
2024-06-12 09:54:11 +07:00
];
sops.secrets."gnome-keyring/${config.home.username}" = { };
wayland.windowManager.hyprland = {
enable = true;
systemd.variables = [ "all" ];
settings = {
# window decors
general = {
gaps_in = 10;
gaps_out = 14;
border_size = 3;
"col.active_border" = "rgba(ffffffff)";
layout = "dwindle";
};
dwindle = {
pseudotile = true;
preserve_split = true;
force_split = 2;
};
master = {
new_is_master = true;
};
gestures = {
workspace_swipe = true;
workspace_swipe_create_new = false;
};
workspace = cfg.settings.workspaces;
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 6;
passes = 2;
new_optimizations = "on";
ignore_opacity = true;
xray = true;
# blurls = waybar
};
active_opacity = 1.0;
inactive_opacity = 0.9;
fullscreen_opacity = 1.0;
drop_shadow = true;
shadow_range = 30;
shadow_render_power = 3;
"col.shadow" = "0x66000000";
};
monitor = cfg.settings.monitors;
"$mod" = "SUPER";
# https://wiki.hyprland.org/Configuring/Binds
bind = [
# Programs
"$mod, RETURN, exec, kitty"
"$mod, E, exec, thunar"
"$mod, B, exec, microsoft-edge"
"$mod, D, exec, rofi -show drun -replace -i"
"$mod, BackSpace, exec, wlogout"
"$mod, S, exec, pypr toggle term"
''$mod, F, exec, ${select-window.path}''
"$mod, W, exec, pypr wall next"
# Workspaces
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
"$mod CTRL, down, workspace, empty"
# Window Management
"$mod, Q, killactive"
"$mod, Space, fullscreen"
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, J, movewindow, d"
"$mod SHIFT, k, movewindow, u"
"$mod SHIFT, l, movewindow, r"
"$mod, PRINT, exec, grimblast --notify copysave output"
", PRINT, exec, grimblast --notify copysave area"
"SHIFT, PRINT, exec, grimblast --notify save area - | swappy -f -"
];
binde = [
"$mod CTRL, H, resizeactive, -100 0"
"$mod CTRL, J, resizeactive, 0 100"
"$mod CTRL, K, resizeactive, 0 -100"
"$mod CTRL, L, resizeactive, 100 0"
];
# m -> mouse
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
# e -> repeat, will repeat when held.
# l -> even when locked
bindel = [
# Media
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise --max-volume 150"
", XF86AudioLowerVolume, exec, swayosd-client --output-volume lower --max-volume 150"
# Light
", XF86MonBrightnessUp, exec, swayosd-client --brightness +10"
", XF86MonBrightnessDown, exec, swayosd-client --brightness -10"
];
bindl = [
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPause, exec, playerctl pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle"
", XF86Calculator, exec, qalculate-gtk"
];
input = {
follow_mouse = 1;
touchpad = {
natural_scroll = false;
};
mouse_refocus = false;
sensitivity = 0;
kb_options = config.profile.xkb.options;
};
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
focus_on_activate = true;
enable_swallow = true;
swallow_regex = "^(Alacritty|kitty|footclient)$";
};
animations = {
enabled = true;
bezier = [
"wind, 0.05, 0.9, 0.1, 1.05"
"winIn, 0.1, 1.1, 0.1, 1.1"
"winOut, 0.3, -0.3, 0, 1"
"liner, 1, 1, 1, 1"
];
animation = [
"windows, 1, 6, wind, slide"
"windowsIn, 1, 6, winIn, slide"
"windowsOut, 1, 5, winOut, slide"
"windowsMove, 1, 5, wind, slide"
"border, 1, 1, liner"
"borderangle, 1, 30, liner, loop"
"fade, 1, 10, default"
"workspaces, 1, 5, wind"
];
};
windowrulev2 = [
config.profile.discord.window_rule
config.profile.slack.window_rule
config.profile.whatsapp.window_rule
];
};
extraConfig = ''
exec-once=dbus-update-activation-enviroment --all
exec-once=${gnome-keyring.path} ${config.sops.secrets."gnome-keyring/${config.home.username}".path}
exec-once=${init-wallpaper.path} ${./wallpaper.jpeg}
exec-once=wallust run ${config.home.homeDirectory}/.cache/wallpaper/current
exec-once=swayosd-libinput-backend
exec-once=swayosd-server
exec-once=swww-daemon
exec-once=bash -c "sleep 10; hypridle"
exec-once=waybar
exec-once=nm-applet
exec-once=pasystray
exec-once=pypr
exec-once=dunst
source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf
exec-once=sleep 0.2 && swww img ${config.home.homeDirectory}/.cache/wallpaper/current
exec-once=bash -c "sleep 10; until ping -c 1 web.whatsapp.com; do sleep 1; done; whatsapp-for-linux"
exec-once=bash -c "sleep 10; until ping -c 1 discord.com; do sleep 1; done; discord"
exec-once=bash -c "sleep 10; until ping -c 1 google.com; do sleep 1; done; slack"
exec-once=bash -c "sleep 10; until ping -c 1 nextcloud.tigor.web.id; do sleep 1; done; nextcloud --background"
'';
};
};
}