nix-system/hyprland.nix
2024-02-27 19:47:18 +01:00

310 lines
8.2 KiB
Nix

{ pkgs, flakes-pkgs }:
{
enable = true;
xwayland.enable = true;
# plugins = [
# flakes-pkgs.hyprfocus
# ];
systemd.enable = true;
systemd.variables = [
"GDK_BACKEND=wayland,x11"
"QT_QPA_PLATFORM=\"wayland;xcb\""
"SDL_VIDEODRIVER=wayland"
"CLUTTER_BACKEND=wayland"
"XDG_CURRENT_DESKTOP=Hyprland"
"XDG_SESSION_TYPE=wayland"
"XDG_SESSION_DESKTOP=Hyprland"
"QT_AUTO_SCREEN_SCALE_FACTOR=1"
"WLR_NO_HARDWARE_CURSORS=1"
"XCURSOR_SIZE=24"
];
settings = {
input = {
kb_layout = "fr";
kb_variant = "";
kb_model = "pc105";
kb_options = "";
kb_rules = "";
touchpad = {
natural_scroll = "no";
};
sensitivity = 0.0;
numlock_by_default = true;
repeat_delay = 200;
repeat_rate = 50;
force_no_accel = true;
follow_mouse = 2;
};
general = {
gaps_in = 0;
gaps_out = 0;
border_size = 0;
"col.active_border" = "rgb(000000)";
"col.inactive_border" = "rgba(00000000)";
layout = "dwindle";
};
decoration = {
blur = {
enabled = false;
};
drop_shadow = true;
shadow_range = 8;
shadow_render_power = 4;
"col.shadow_inactive" = "rgba(1a1a1a33)";
"col.shadow" = "rgba(1a1a1aee)";
};
animations = {
enabled = true;
bezier = "myBezier, 0, 0, .58, 1";
animation = "global, 1, 1, myBezier";
};
dwindle = {
pseudotile = true;
preserve_split = true;
force_split = 2;
no_gaps_when_only = true;
};
master = {
new_is_master = true;
};
gestures = {
workspace_swipe = "off";
};
misc = {
disable_hyprland_logo = true;
enable_swallow = true;
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
# swallow_regex = "^(Alacritty)(.*)$";
# swallow_regex = "^(kitty)(.*)$";
};
windowrule = "float, floating";
"$mod" = "SUPER";
bind = [
"$mod, q, killactive"
"$mod SHIFT, q, exec, kill -9 $(hyprctl activewindow | grep pid | grep -E -o '[0-9]+$')"
"$mod, a, togglefloating"
"$mod SHIFT, a, workspaceopt, allfloat"
"$mod, Tab, togglesplit"
"$mod, P, pseudo"
"$mod, f, fullscreen"
"$mod SHIFT, f, fakefullscreen"
"$mod, Return, exec, kitty"
"$mod SHIFT, e, exec, rofimoji"
"$mod, c, exec, rofi -show calc -modi calc -no-show-match -no-sort"
"$mod, e, exec, $TERMINAL -e lf"
"$mod SHIFT, Return, exec, kitty --working-directory \"$(window_dir)\""
"$mod, w, exec, firefox"
"$mod SHIFT, w, exec, firefox --private-window"
"$mod, m, exec, kitty --class floating -e pulsemixer"
"$mod, d, exec, ~/.bin/runmenu"
"$mod, x, exec, keepmenu"
"$mod, z, exec, tmux new -spopup_terminal -d; kitty --class floating -e tmux a -t popup_terminal"
"$mod, f11, exec, ocrzone"
"$mod, f12, exec, kitty --class floating -e nmtui"
"$mod, f2, exec, dark"
"$mod, f3, exec, hyprctl reload"
"$mod, f4, exec, rofi-udisk"
"$mod, f5, exec, mount-android"
",XF86AudioRaiseVolume, exec, pamixer -i 5"
",XF86AudioLowerVolume, exec, pamixer -d 5"
",XF86AudioMute, exec, pamixer -t"
",XF86AudioMicMute, exec, pamixer -t --default-source"
",XF86MonBrightnessUp, exec, light -A 10"
",XF86MonBrightnessDown, exec, light -U 10"
"$mod,Print, exec, screenshot"
"$mod, agrave, submap, power"
"$mod, h, movefocus, l"
"$mod, l, movefocus, r"
"$mod, k, movefocus, u"
"$mod, j, movefocus, d"
"$mod, Left, movefocus, l"
"$mod, Right, movefocus, r"
"$mod, Up, movefocus, u"
"$mod, Down, movefocus, d"
"$mod SHIFT, h, movewindow, l"
"$mod SHIFT, l, movewindow, r"
"$mod SHIFT, k, movewindow, u"
"$mod SHIFT, j, movewindow, d"
"$mod SHIFT, Left, movewindow, l"
"$mod SHIFT, Right, movewindow, r"
"$mod SHIFT, Up, movewindow, u"
"$mod SHIFT, Down, movewindow, d"
"$mod, twosuperior, workspace, 1"
"$mod, ampersand, workspace, 2"
"$mod, eacute, workspace, 3"
"$mod, quotedbl, workspace, 4"
"$mod, apostrophe, workspace, 5"
"$mod, parenleft, workspace, 6"
"$mod, minus, workspace, 7"
"$mod, egrave, workspace, 8"
"$mod, underscore, workspace, 9"
"$mod, ccedilla, workspace, 10"
"$mod, rarenright, workspace, 11"
"$mod SHIFT, twosuperior, movetoworkspacesilent, 1"
"$mod SHIFT, ampersand, movetoworkspacesilent, 2"
"$mod SHIFT, eacute, movetoworkspacesilent, 3"
"$mod SHIFT, quotedbl, movetoworkspacesilent, 4"
"$mod SHIFT, apostrophe, movetoworkspacesilent, 5"
"$mod SHIFT, parenleft, movetoworkspacesilent, 6"
"$mod SHIFT, minus, movetoworkspacesilent, 7"
"$mod SHIFT, egrave, movetoworkspacesilent, 8"
"$mod SHIFT, underscore, movetoworkspacesilent, 9"
"$mod SHIFT, ccedilla, movetoworkspacesilent, 10"
"$mod SHIFT, rarenright, movetoworkspacesilent, 11"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
binde = [
"$mod SHIFT, h, moveactive, -60 0"
"$mod SHIFT, l, moveactive, 60 0"
"$mod SHIFT, k, moveactive, 0 -60"
"$mod SHIFT, j, moveactive, 0 60"
"$mod CTRL, h, resizeactive, -60 0"
"$mod CTRL, l, resizeactive, 60 0"
"$mod CTRL, k, resizeactive, 0 -60"
"$mod CTRL, j, resizeactive, 0 60"
"$mod SHIFT, Left, moveactive, -60 0"
"$mod SHIFT, Right, moveactive, 60 0"
"$mod SHIFT, Up, moveactive, 0 -60"
"$mod SHIFT, Down, moveactive, 0 60"
"$mod CTRL, Left, resizeactive, -60 0"
"$mod CTRL, Right, resizeactive, 60 0"
"$mod CTRL, Up, resizeactive, 0 -60"
"$mod CTRL, Down, resizeactive, 0 60"
];
# plugin:hyprfocus {
# enabled = yes
#
# keyboard_focus_animation = shrink
# mouse_focus_animation = flash
#
# bezier = bezIn, 0.5,0.0,1.0,0.5
# bezier = bezOut, 0.0,0.5,0.5,1.0
#
# flash {
# flash_opacity = 0.7
#
# in_bezier = bezIn
# in_speed = 0.5
#
# out_bezier = bezOut
# out_speed = 3
# }
#
# shrink {
# shrink_percentage = 0.8
#
# in_bezier = bezIn
# in_speed = 0.5
#
# out_bezier = bezOut
# out_speed = 3
# }
# }
"plugin:hyprfocus" = {
enabled = true;
keyboard_focus_animation = "flash";
mouse_focus_animation = "nothing";
# bezier = "bezIn, 0.5,0.0,1.0,0.5";
# bezier = "bezOut, 0.0,0.5,0.5,1.0";
flash = {
flash_opacity = 0.6;
in_speed = 0.3;
};
};
};
extraConfig =
let swaybgScript = (pkgs.writers.writeFish "display-background" ''
# find background image: only file in ~/.local/share/bg
set -l bg (find ~/.local/share/bg -type l)
${pkgs.swaybg}/bin/swaybg -m fill -i $bg
# set background
# ${pkgs.nix}/bin/nix-shell \
# -p pkgs.rubyPackages.gdk_pixbuf2 \
# --run "${pkgs.swaybg}/bin/swaybg -m fill -i $bg"
'');
in
''
# env = GDK_BACKEND,wayland,x11
# env = QT_QPA_PLATFORM,wayland;xcb
# env = SDL_VIDEODRIVER,wayland
# env = CLUTTER_BACKEND,wayland
#
# env = XDG_CURRENT_DESKTOP,Hyprland
# env = XDG_SESSION_TYPE,wayland
# env = XDG_SESSION_DESKTOP,Hyprland
# env = QT_AUTO_SCREEN_SCALE_FACTOR,1
monitor=,highrr,auto,1
monitor=HDMI-A-1,preferred,auto,1,mirror,eDP-1
exec = pkill swaybg; ${swaybgScript}
exec = pkill waybar; ${pkgs.waybar}/bin/waybar
submap = power
bind = ,s, exec, systemctl suspend
bind = ,s, submap, reset
bind = SHIFT,S,exec, shutdown now
bind = ,S, submap, reset
bind = ,h, exec, systemctl hibernate
bind = ,h, submap, reset
bind = ,e, exit
bind = ,e, submap, reset
bind = ,r, exec, reboot
bind = ,r, submap, reset
bind = ,l, exec, swaylock
bind = ,l, submap, reset
bind = ,escape, submap, reset
submap = reset
'';
}