nixify: hyprland & kitty

This commit is contained in:
js0ny 2025-11-22 18:43:51 +00:00
parent db78fc2289
commit f56fa1259c
22 changed files with 449 additions and 29 deletions

View file

@ -1,8 +1,7 @@
{
currentUser = {
defaultShell = "zsh";
defaultTerminal = "ghostty";
defaultTerminalRunner = "alacritty";
defaultTerminal = "kitty";
iconTheme = "Papirus";
defaultExplorer = "dolphin";
defaultTerminalExplorer = "yazi";

View file

@ -108,6 +108,8 @@ in {
blender
logisim-evolution
onlyoffice-desktopeditors
wayland-bongocat
nur.repos.lonerOrz.antigravity
]
++ (mkFcitxIM [
pkgs.neovim-qt

View file

@ -1,8 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
grimblast
];
imports = [
./packages.nix
];
}

View file

@ -0,0 +1,137 @@
{pkgs, ...}: {
home.packages = with pkgs; [
grimblast
];
imports = [
../packages.nix
./keymaps.nix
./window-rules.nix
];
wayland.windowManager.hyprland = {
enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
systemd.enableXdgAutostart = true;
xwayland.enable = true;
# extraConfig = ''
# source=~/.config/hypr/debug.conf
# '';
settings = {
ecosystem = {
no_update_news = true;
};
exec-once = [
"waybar"
"dunst"
"${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"
];
general = {
gaps_in = 0;
gaps_out = 0;
border_size = 5;
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
"col.active_border" = "$lavender $pink 45deg";
"col.inactive_border" = "$overlay1";
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = true;
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false;
layout = "dwindle";
no_border_on_floating = false;
};
xwayland = {
force_zero_scaling = true;
};
input = {
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = true;
scroll_factor = 0.2;
};
};
misc = {
force_default_wallpaper = -1;
disable_hyprland_logo = true;
};
dwindle = {
pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # You probably want this
};
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master = {
new_status = "slave";
};
animations = {
enabled = true;
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"easeInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
# "windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, almostLinear, slide"
"workspacesIn, 1, 1.21, almostLinear, fade"
"workspacesOut, 1, 1.94, almostLinear, fade"
"specialWorkspace, 1, 1.94, almostLinear, fade"
];
};
decoration = {
rounding = 20;
# Change transparency of focused and unfocused windows
# active_opacity = 1
# inactive_opacity = 0.9
active_opacity = 0.9;
inactive_opacity = 0.85;
shadow = {
enabled = true;
range = 4;
render_power = 3;
color = "$base";
};
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
size = 10;
passes = 2;
vibrancy = 0.1696;
};
};
};
};
}

View file

@ -0,0 +1,101 @@
{config, ...}: let
term = config.currentUser.defaultTerminal;
termRunner = config.currentUser.defaultTerminalRunner;
iconTheme = config.currentUser.iconTheme;
explorer = config.currentUser.defaultExplorer;
explorerTerm = config.currentUser.defaultTerminalExplorer;
launcher = "rofi";
kbdBacklightDev = config.currentHost.keyboardBacklightDevice;
kbdBacklightStep = config.currentHost.keyboardBacklightStep;
mainMod = "SUPER";
screenshotPath = "$HOME/Pictures/Screenshots/\"$(%Y-%m-%d_%H-%M-%S.png)\"";
in {
wayland.windowManager.hyprland.settings = {
"$mainMod" = "${mainMod}";
bind = [
"$mainMod, return, exec, ${term}"
"$mainMod, Q, killactive"
''$mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 1440 810 ; dispatch centerwindow 1;"''
"$mainMod SHIFT, M, fullscreen"
"$mainMod, W, exec, ${launcher} -show window -icon-theme ${iconTheme} -show-icons"
"$mainMod, V, exec, cliphist list | ${launcher} -dmenu | cliphist decode | wl-copy"
"alt, space, exec, ${launcher} -show drun -icon-theme ${iconTheme} -show-icons"
"$mainMod, E, exec, ${explorer}"
"$mainMod SHIFT, E, exec, ${termRunner} -e ${explorerTerm}"
"$mainMod, P, pseudo"
"$mainMod, X, togglesplit"
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
"$mainMod, H, movefocus, l"
"$mainMod, L, movefocus, r"
"$mainMod, K, movefocus, u"
"$mainMod, J, movefocus, d"
"$mainMod SHIFT, H, swapwindow, l"
"$mainMod SHIFT, L, swapwindow, r"
"$mainMod SHIFT, K, swapwindow, u"
"$mainMod SHIFT, J, swapwindow, d"
"$mainMod CTRL, H, resizeactive, 10 0"
"$mainMod CTRL, L, resizeactive, -10 0"
"$mainMod CTRL, K, resizeactive, 0 10"
"$mainMod CTRL, J, resizeactive, 0 10"
"$mainMod, s, exec, grimblast copysave active ${screenshotPath}"
"$mainMod SHIFT, s, exec, grimblast copysave area ${screenshotPath}"
"alt, PRINT, exec, grimblast copysave active ${screenshotPath}"
",PRINT, exec, grimblast copysave active ${screenshotPath}"
"$mainMod SHIFT, c, exec, notify-send \"Color: $(hyprpicker)\""
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod SHIFT, 5, movetoworkspace, 5"
"$mainMod SHIFT, 6, movetoworkspace, 6"
"$mainMod SHIFT, 7, movetoworkspace, 7"
"$mainMod SHIFT, 8, movetoworkspace, 8"
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
"$mainMod, GRAVE, togglespecialworkspace, magic"
"$mainMod SHIFT, GRAVE, movetoworkspace, special:magic"
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
];
# m: Mouse: Will work with mouse buttons
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
# l: locked: Will work when an input inhibitor is active (e.g. lock screen)
bindl = [
",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous"
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioPause, exec, playerctl play-pause"
];
# e: repeat: Will repeat when the key is held down
bindel = [
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86MonBrightnessUp, exec, brightnessctl set +10%"
", XF86MonBrightnessDown, exec, brightnessctl set 10%-"
", XF86KbdBrightnessUp, exec, brightnessctl --device ${kbdBacklightDev} set ${kbdBacklightStep}+"
", XF86KbdBrightnessDown, exec, brightnessctl --device ${kbdBacklightDev} set ${kbdBacklightStep}-"
", XF86Launch4, exec, powerprofiles-next"
", XF86Launch1, exec, ${launcher} -show drun -icon-theme ${iconTheme} -show-icons"
];
gesture = [
"4, horizontal, workspace"
];
};
}

View file

@ -0,0 +1,43 @@
{...}: {
wayland.windowManager.hyprland.settings = {
windowrule = [
# windowrule = match:class mpv, float on, move (monitor_w-20-window_w) (monitor_h-20-window_h), pin on
];
windowrulev2 = [
"suppressevent maximize, class:.*"
# Right Bottom
"float, pin, size 25%, move 73% 73%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$"
"float, pin, size 25%, move 73% 73%, title:^()(.*)$"
# Right Top
"float, pin, size 25%, move 73% 10%, class:^(org.pulseaudio.pavucontrol)$"
# Right Top + no focus
"noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(org.kde.(dolphin|ark))$, title:^(Extracting|Compressing)(.*)$"
"noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(thunar)$, title:^(File Operation Progress)$"
# Centered
"float, center, size 50%, class:^(com.(telegram|ayugram).desktop)$, title:^(Media viewer)$"
"float, center, size 50%, class:^(io.github.kukuruzka165.materialgram)$, title:^(Media viewer)$"
"float, center, size 50%, class:^(wechat)$, title:^()$"
"float, center, size 50%, class:^(QQ)$, title:^()$"
"float, center, size 50%, class:^(QQ)$, title:^()$"
"float, center, size 50%, class:^(CherryStudio)$, title:^(Cherry Studio Quick Assistant)$"
"float, center, size 50%, class:^(anki)$, title:^(Add)$"
"float, center, title:^(Open File||Select a File||Choose wallpaper|Open Folder|Save As||Library|File Upload)(.*)$"
"float, center, class:^(qt6ct)$"
# no focus
"float, noinitialfocus, center, class:^(gimp)$, title:^(GIMP Startup)$"
"float, noinitialfocus, center, class:^(wechat)$, title:^(wechat)$"
# Pin + Stay focused
"float, pin, stayfocused, class:^(rofi)$"
# Workspace 1 - Master
"workspace 1, class:^(firefox)$"
# Workspace 2 - Project
"workspace 2, class:^(code|dev.zed.Zed|Vitis IDE|Vivado)$"
# Workspace 3 - Info
"workspace 3, class:^(discord|thunderbird|QQ|wechat|com.(telegram|ayugram).desktop|io.github.kukuruzka165.materialgram)$"
# Workspace 9 - Background
"workspace 9, class:^(feishin|Cider)$"
];
};
}

View file

@ -19,7 +19,7 @@ in {
criteria = lg4k60;
alias = "lg4k60";
mode = "3840x2160@59.997";
scale = 1.75;
scale = 1.6666;
};
}
# Profiles

View file

@ -25,8 +25,8 @@
{argv = ["waybar"];}
{argv = ["dunst"];}
{argv = ["fcitx5"];}
{argv = ["swww-daemon"];}
# polkit/portal helpers
{argv = ["${pkgs.kdePackages.xdg-desktop-portal-kde}/libexec/xdg-desktop-portal-kde"];}
{argv = ["${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"];}
];

View file

@ -55,4 +55,12 @@ in {
services.cliphist.enable = true;
services.dunst.enable = true;
catppuccin.dunst.enable = false;
home.pointerCursor = {
enable = true;
gtk.enable = true;
x11.enable = true;
size = 24;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
};
}

View file

@ -9,10 +9,21 @@
enable = true;
style = ''
* {
font-family: "Font Awesome 7 Free", "JetBrainsMono Nerd Font";
font-family: "LXGW Neo XiHei", "Font Awesome 7 Free", "JetBrainsMono Nerd Font";
font-size: 14px;
font-feature-settings: "tnum";
}
window#waybar {
background-color: @base;
padding: 0px;
}
#workspaces {
color: #f0f0ff;
background-color: rgba(30, 30, 46, 0.6);
}
#workspaces button:hover {
background: @pink;
}
@ -20,6 +31,33 @@
#workspaces button.urgent {
background-color: @red;
}
#custom-osicon {
color: @blue;
padding: 0 6px;
}
#clock,
#tray,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#mode,
#idle_inhibitor,
#scratchpad,
#mpd {
padding: 0 10px;
color: @text;
background-color: @base;
}
'';
};
}

View file

@ -46,7 +46,6 @@
"alt+shift+_=new_split:down"
"alt+shift+enter=new_split:auto"
"global:super+backquote=toggle_quick_terminal"
"alt+shift+n=new_window"
];
### Misc

View file

@ -0,0 +1,81 @@
{
config,
pkgs,
...
}: let
alt =
if pkgs.stdenv.isDarwin
then "cmd"
else "alt";
in {
programs.kitty = {
enable = true;
shellIntegration = {
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
};
environment = {
"TERM_PROGRAM" = "kitty";
};
font = {
size = 12;
name = "Maple Mono NF CN";
};
settings = {
# Font
disable_ligatures = "never";
# Cursor Trail
cursor_trail = 1;
cursor_trail_decay = "0.1 0.4";
cursor_trail_start_threshold = 2;
# Tab Bar
tab_bar_edge = "top";
tab_bar_align = "left";
tab_bar_style = "powerline";
# Hide tab bar when there is only one tab
tab_bar_min_tabs = 2;
tab_title_template = "{f'{title[:30]}' if title.rindex(title[-1]) + 1 > 30 else (title.center(6) if (title.rindex(title[-1]) + 1) % 2 == 0 else title.center(5))}";
active_tab_font_style = "bold";
# macOS # TODO: true or "yes", untested
macos_option_as_alt = true;
macos_quit_when_last_window_closed = true;
enabled_layouts = "splits";
};
keybindings = {
"cmd+c" = "copy_and_clear_or_interrupt";
"ctrl+c" = "copy_and_clear_or_interrupt";
"${alt}+1" = "goto_tab 1";
"${alt}+2" = "goto_tab 2";
"${alt}+3" = "goto_tab 3";
"${alt}+4" = "goto_tab 4";
"${alt}+5" = "goto_tab 5";
"${alt}+6" = "goto_tab 6";
"${alt}+7" = "goto_tab 7";
"${alt}+8" = "goto_tab 8";
"${alt}+9" = "goto_tab 9"; # if less than 9 tabs, goes to last tab
"${alt}+0" = "goto_tab -1"; # previously active tab
"${alt}+shift+\\" = "launch --location=hsplit";
"${alt}+shift+-" = "launch --location=vsplit";
"ctrl+shift+h" = "kitty_scrollback_nvim";
"ctrl+shift+g" = "kitty_scrollback_nvim --config ksb_builtin_last_cmd_output";
"alt+shift+h" = "move_window left";
"alt+shift+l" = "move_window right";
"alt+shift+k" = "move_window up";
"alt+shift+j" = "move_window down";
"ctrl+q>h" = "move_window left";
"ctrl+q>l" = "move_window right";
"ctrl+q>k" = "move_window up";
"ctrl+q>j" = "move_window down";
};
extraConfig = ''
mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
'';
actionAliases =
if config.programs.neovim.enable
then {
"kitty_scrollback_nvim" = "kitten /home/js0ny/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py";
}
else {};
};
}

View file

@ -7,6 +7,7 @@
enable = true;
plugins = with pkgs.obs-studio-plugins; [
input-overlay
wlrobs
];
};

View file

@ -118,6 +118,9 @@ in {
bindkey '^[#' pound-insert # Alt-# to comment line
bindkey '^]' vi-find-next-char
bindkey '^[^]' vi-find-prev-char
# Misc
# ========
# source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh

View file

@ -1,8 +1,8 @@
{pkgs, ...}: {
programs.tmux = {
enable = true;
prefix = "C-q";
shortcut = "q";
prefix = "C-a";
shortcut = "a";
keyMode = "vi";
historyLimit = 10000;
mouse = true;

View file

@ -23,7 +23,7 @@
# Personal Program
./programs/chromium.nix
./programs/firefox
# ./programs/emacs.nix
./programs/emacs.nix
./programs/vscode.nix
./programs/xilinx.nix
./programs/mime.nix
@ -52,11 +52,12 @@
./programs/obsidian
./programs/aichat.nix
./programs/tmux.nix
./programs/kitty.nix
# Desktop Linux
./programs/desktop/plasma
./programs/desktop/wayland-wm/niri
./programs/desktop/wayland-wm/hyprland.nix
./programs/desktop/wayland-wm/hyprland
../../modules/home/do-not-track.nix