stylix, hyprland

This commit is contained in:
js0ny 2025-11-27 22:47:31 +00:00
parent db68f9d460
commit b440038b65
39 changed files with 704 additions and 226 deletions

View file

@ -1,26 +0,0 @@
{pkgs, ...}: let
my-catppuccin-kde = pkgs.catppuccin-kde.override {
flavour = [
"mocha"
"latte"
];
accents = ["pink"];
winDecStyles = ["classic"];
};
in {
home.packages = with pkgs; [
catppuccin
# my-catppuccin-gtk
my-catppuccin-kde
catppuccin-fcitx5
];
catppuccin = {
enable = true;
flavor = "mocha";
accent = "pink";
zed.enable = false;
zsh-syntax-highlighting.enable = false;
nvim.enable = false; # Defined in lua config
};
}

View file

@ -66,6 +66,7 @@
gron
jless
unar
trash-cli
]
++ (
if pkgs.stdenv.isDarwin

View file

@ -163,6 +163,8 @@ in {
# };
# };
programs.alacritty.enable = true;
services.protonmail-bridge.enable = true;
services.remmina.enable = true;
}

View file

@ -0,0 +1,77 @@
{pkgs, ...}: let
my-catppuccin-kde = pkgs.catppuccin-kde.override {
flavour = [
"mocha"
"latte"
];
accents = ["pink"];
winDecStyles = ["classic"];
};
in {
home.packages = with pkgs; [
catppuccin
# my-catppuccin-gtk
my-catppuccin-kde
catppuccin-fcitx5
];
catppuccin = {
enable = false;
flavor = "mocha";
accent = "pink";
zed.enable = false;
zsh-syntax-highlighting.enable = false;
nvim.enable = false; # Defined in lua config
};
stylix = {
enable = true;
autoEnable = true;
fonts = {
sansSerif = {
package = pkgs.lxgw-neoxihei;
name = "LXGW Neo XiHei";
};
serif = {
package = pkgs.lxgw-wenkai;
name = "LXGW WenKai";
};
monospace = {
package = pkgs.maple-mono.NF-CN;
name = "Maple Mono NF CN";
};
emoji = {
package = pkgs.noto-fonts-emoji-blob-bin;
name = "Blobmoji";
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
size = 24;
};
icons = {
enable = true;
light = "Papirus-Light";
dark = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
targets = {
neovide.enable = false;
neovim.enable = false;
firefox = {
profileNames = ["default"];
colorTheme.enable = false; # Firefox Color
};
};
image = ./wallpaper.jpg;
polarity = "dark";
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 MiB

View file

@ -9,7 +9,7 @@
addons = with pkgs.ankiAddons; [
anki-connect
review-heatmap
recolor
# recolor # Use stylix
];
sync = {
autoSync = true;

View file

@ -2,6 +2,8 @@
home.packages = with pkgs; [
grimblast
];
# TODO: Try to isolate these variables to just Hyprland and its children
# Maybe use systemctl --user import-environment?
imports = [
../packages.nix
./keymaps.nix
@ -19,20 +21,21 @@
ecosystem = {
no_update_news = true;
};
exec-once = [
"waybar"
"dunst"
"${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"
];
# exec-once = [
# "waybar"
# "dunst"
# "${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"
# ];
general = {
gaps_in = 0;
gaps_out = 0;
gaps_in = 2;
gaps_out = 2;
border_size = 5;
border_size = 2;
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
"col.active_border" = "$lavender $pink 45deg";
"col.inactive_border" = "$overlay1";
# NOTE: use stylix
# "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;
@ -108,7 +111,7 @@
};
decoration = {
rounding = 20;
rounding = 10;
# Change transparency of focused and unfocused windows
# active_opacity = 1
@ -120,7 +123,7 @@
enabled = true;
range = 4;
render_power = 3;
color = "$base";
# color = "$base"; # NOTE: use stylix
};
# https://wiki.hyprland.org/Configuring/Variables/#blur

View file

@ -1,29 +1,47 @@
{config, ...}: let
{
config,
pkgs,
lib,
...
}: let
term = config.currentUser.defaultTerminal;
termRunner = config.currentUser.defaultTerminalRunner;
iconTheme = config.currentUser.iconTheme;
explorer = config.currentUser.defaultExplorer;
explorerTerm = config.currentUser.defaultTerminalExplorer;
launcher = "rofi";
launcher = "walker";
kbdBacklightDev = config.currentHost.keyboardBacklightDevice;
kbdBacklightStep = config.currentHost.keyboardBacklightStep;
mainMod = "SUPER";
screenshotPath = "$HOME/Pictures/Screenshots/\"$(%Y-%m-%d_%H-%M-%S.png)\"";
my = import ./scripts.nix {inherit pkgs;};
resizeStep = builtins.toString 20;
in {
wayland.windowManager.hyprland.settings = {
"$mainMod" = "${mainMod}";
bind = [
# === Run Applications ===
"$mainMod, return, exec, ${term}"
"$mainMod SHIFT, return, exec, ${termRunner} --directory ~/Atelier -e nvim"
"$mainMod, B, exec, ${lib.getExe my.launch-or-focus} firefox firefox"
"$mainMod SHIFT, B, exec, firefox --private-window"
"$mainMod, A, exec, kitty --class=kitty-terminal-popup -e aichat --session"
"$mainMod SHIFT, A, exec, ${lib.getExe my.launch-or-focus} 'Cherry Studio' 'cherry-studio'"
"$mainMod, T, exec, kitty --class=kitty-terminal-popup"
"$mainMod SHIFT, T, exec, kitty --class=kitty-terminal-popup --working-directory='${config.home.homeDirectory}/.config/shells/nohist' -e nix develop"
"$mainMod, O, exec, ${lib.getExe my.launch-or-focus} 'obsidian' 'obsidian'"
"$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, W, exec, ${launcher} -m windows"
"$mainMod, Apostrophe, exec, EDITOR_MINIMAL=1 ${termRunner} -o close_on_child_death=yes --class=${termRunner}-terminal-popup -e edit-clipboard --minimal"
"$mainMod, V, exec, ${launcher} -m clipboard"
"alt, space, exec, ${launcher} -m desktopapplications"
"$mainMod, E, exec, ${explorer}"
"$mainMod SHIFT, E, exec, ${termRunner} -e ${explorerTerm}"
"CTRL ALT, DELETE, exec, uwsm exit"
"$mainMod, P, pseudo"
"$mainMod, X, togglesplit"
"$mainMod, Y, togglesplit"
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
@ -36,10 +54,6 @@ in {
"$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}"
@ -93,6 +107,10 @@ in {
", XF86KbdBrightnessDown, exec, brightnessctl --device ${kbdBacklightDev} set ${kbdBacklightStep}-"
", XF86Launch4, exec, powerprofiles-next"
", XF86Launch1, exec, ${launcher} -show drun -icon-theme ${iconTheme} -show-icons"
"$mainMod, equal, resizeactive, ${resizeStep} 0"
"$mainMod, minus, resizeactive, -${resizeStep} 0"
"$mainMod SHIFT, equal, resizeactive, 0 ${resizeStep}"
"$mainMod SHIFT, minus, resizeactive, 0 -${resizeStep}"
];
gesture = [
"4, horizontal, workspace"

View file

@ -0,0 +1,22 @@
{pkgs, ...}: {
launch-or-focus = pkgs.writeShellApplication {
name = "hyprscript-launch-or-focus";
runtimeInputs = [pkgs.jq pkgs.hyprland pkgs.uwsm];
text = ''
if (($# == 0)); then
echo "Usage: hyprscript-launch-or-focus [window-pattern] [launch-command]"
exit 1
fi
WINDOW_PATTERN="$1"
LAUNCH_COMMAND="''${2:-"uwsm-app -- $WINDOW_PATTERN"}"
WINDOW_ADDRESS=$(hyprctl clients -j | jq -r --arg p "$WINDOW_PATTERN" '.[]|select((.class|test("\\b" + $p + "\\b";"i")) or (.title|test("\\b" + $p + "\\b";"i")))|.address' | head -n1)
if [[ -n $WINDOW_ADDRESS ]]; then
hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
else
eval exec setsid "$LAUNCH_COMMAND"
fi
'';
};
}

View file

@ -22,6 +22,7 @@
"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, size 50%, class:^(kitty-terminal-popup)$"
"float, center, title:^(Open File||Select a File||Choose wallpaper|Open Folder|Save As||Library|File Upload)(.*)$"
"float, center, class:^(qt6ct)$"
# no focus

View file

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

View file

@ -38,6 +38,7 @@ in {
./swww.nix
./kanshi.nix
./swaylock.nix
./polkit.nix
];
home.packages = with pkgs; [
swayidle # Screensaver
@ -54,13 +55,6 @@ in {
};
services.cliphist.enable = true;
services.dunst.enable = true;
services.network-manager-applet.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

@ -0,0 +1,21 @@
{pkgs, ...}: {
systemd.user.services.hyprpolkitagent = {
Unit = {
Description = "Hyprland Polkit Authentication Agent";
PartOf = ["graphical-session.target"];
After = ["graphical-session.target"];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
Install = {
WantedBy = ["graphical-session.target"];
};
};
}

View file

@ -7,57 +7,62 @@
services.blueman-applet.enable = true;
programs.waybar = {
enable = true;
systemd = {
enable = true;
target = "graphical-session.target";
};
style = ''
* {
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;
}
#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;
}
'';
# window#waybar {
# background-color: @base;
# padding: 0px;
# }
#
# #workspaces {
# color: #f0f0ff;
# background-color: rgba(30, 30, 46, 0.6);
# }
#
# #workspaces button:hover {
# background: @pink;
# }
#
# #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

@ -18,7 +18,7 @@
"pulseaudio"
"cpu"
"memory"
"network"
# "network" # Use nm-applet instead
"battery"
"clock"
];
@ -99,6 +99,7 @@
cpu = {
format = "{usage}% ";
tooltip = false;
on-click = "kitty -e btop";
};
memory = {
format = "{}% ";
@ -216,7 +217,7 @@
};
"custom/osicon" = {
format = "<span size='x-large'></span>";
on-click-right = "rofi -show drun -icon-theme Papirus -show-icons";
on-click = "walker -m desktopapplications";
};
}
];

View file

@ -197,30 +197,31 @@
"Vertical Candidate List" = ''True'';
# Use mouse wheel to go to prev or next page
"WheelForPaging" = ''True'';
# NOTE: manged by stylix
# Font
"Font" = ''"LXGW WenKai Medium 14"'';
# Menu Font
"MenuFont" = ''"LXGW WenKai 14"'';
# Tray Font
"TrayFont" = ''"Sans Bold 10"'';
# Tray Label Outline Color
"TrayOutlineColor" = ''''; #000000
# Tray Label Text Color
"TrayTextColor" = ''''; #ffffff
# "Font" = ''"LXGW WenKai Medium 14"'';
# # Menu Font
# "MenuFont" = ''"LXGW WenKai 14"'';
# # Tray Font
# "TrayFont" = ''"Sans Bold 10"'';
# # Tray Label Outline Color
# "TrayOutlineColor" = ''''; #000000
# # Tray Label Text Color
# "TrayTextColor" = ''''; #ffffff
# Theme
# "Theme" = ''plasma'';
# # Dark Theme
# "DarkTheme" = ''plasma'';
# # Follow system light/dark color scheme
# "UseDarkTheme" = ''True'';
# # Follow system accent color if it is supported by theme and desktop
# "UseAccentColor" = ''True'';
# Prefer Text Icon
"PreferTextIcon" = ''False'';
# Show Layout Name In Icon
"ShowLayoutNameInIcon" = ''True'';
# Use input method language to display text
"UseInputMethodLanguageToDisplayText" = ''True'';
# Theme
"Theme" = ''plasma'';
# Dark Theme
"DarkTheme" = ''plasma'';
# Follow system light/dark color scheme
"UseDarkTheme" = ''True'';
# Follow system accent color if it is supported by theme and desktop
"UseAccentColor" = ''True'';
# Use Per Screen DPI on X11
"PerScreenDPI" = ''False'';
# Force font DPI on Wayland
@ -280,5 +281,4 @@
};
};
};
catppuccin.fcitx5.enable = true;
}

View file

@ -48,7 +48,7 @@ in {
# Misc
rsshub-radar
proton-pass
proton-vpn
# proton-vpn
styl-us
kiss-translator

View file

@ -1,53 +1,44 @@
{...}: let
editFzfPosix = ''
edit-fzf() {
local _file
{pkgs, ...}: let
edit-fzf = pkgs.writeShellApplication {
name = "edit-fzf";
runtimeInputs = with pkgs; [fzf];
text = ''
_file=""
if command -v fd >/dev/null 2>&1; then
_file=$(fd --type f --exclude '*.lock' | fzf --height 40% --reverse -1 -q "$1")
else
# Fallback to 'find'
_file=$(find . -type f ! -name '*.lock' | fzf --height 40% --reverse -1 -q "$1")
fi
if command -v fd >/dev/null 2>&1; then
_file=$(fd --type f --exclude '*.lock' | fzf --height 40% --reverse -1 -q "''${1:-}")
else
# Fallback to 'find'
_file=$(find . -type f ! -name '*.lock' | fzf --height 40% --reverse -1 -q "''${1:-}")
fi
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
# the command substitution simply returns an empty string.
# So, we check if the variable '_file' is non-empty ('-n').
if [ -n "$_file" ]; then
"$EDITOR" "$_file"
else
echo "No file selected."
fi
}
alias ef="edit-fzf"
'';
# In POSIX shell, if fzf is cancelled (Esc/Ctrl-C),
# the command substitution simply returns an empty string.
# So, we check if the variable '_file' is non-empty ('-n').
if [ -n "$_file" ]; then
"$EDITOR" "$_file"
else
echo "No file selected."
fi
'';
};
in {
home.packages = [edit-fzf];
programs.fzf = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
};
programs.fish.interactiveShellInit = ''
function edit-fzf --description "Find and edit a file using fzf and $EDITOR"
set -l file
if command -q fd
set file (fd --type f --exclude '*.lock' | fzf --height 40% --reverse -1 -q "$argv[1]")
else
set file (find . -type f ! -name '*.lock' | fzf --height 40% --reverse -1 -q "$argv[1]")
end
set -l fzf_status $status
if test $fzf_status -eq 0; and test -n "$file"
$EDITOR $file
else
echo "No file selected."
end
end
abbr --add ef edit-fzf
'';
programs.bash.bashrcExtra = editFzfPosix;
programs.zsh.initContent = editFzfPosix;
programs = {
bash.shellAliases = {
ef = "edit-fzf";
};
zsh.shellAliases = {
ef = "edit-fzf";
};
fish.shellAbbrs = {
ef = "edit-fzf";
};
};
}

View file

@ -74,6 +74,11 @@ in {
"image/avif" = imageViewers;
"image/webp" = imageViewers;
# Microsoft Office
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = "onlyoffice-desktopeditors.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = "onlyoffice-desktopeditors.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = "onlyoffice-desktopeditors.desktop";
# Audio:
# music: elisa: fully featured, good cjk support
# audio: mpv: simple and fast

View file

@ -24,4 +24,6 @@ in {
programs.bash.shellAliases = nvimAlias;
programs.zsh.shellAliases = nvimAlias;
programs.nushell.shellAliases = nvimAlias;
home.sessionVariables.EDITOR = "nvim";
}

View file

@ -6,6 +6,8 @@ in {
shellAliases = {
"la" = "ls -a";
"lt" = "lsd --tree";
"l" = "ls -la";
"ll" = "ls -lh";
};
extraConfig = ''
$env.config.show_banner = false

View file

@ -124,11 +124,6 @@
userSettings = {
icon_theme = "Material Icon Theme";
theme = {
mode = "system";
light = "Catppuccin Latte";
dark = "Catppuccin Mocha";
};
tabs = {
show_diagnostics = "errors";
show_close_button = "hover";
@ -157,10 +152,16 @@
proxy_no_verify = null;
};
};
ui_font_size = 16;
buffer_font_size = null;
relative_line_numbers = true;
buffer_font_family = "Maple Mono NF CN";
# NOTE: managed by stylix
# ui_font_size = 16;
# buffer_font_size = null;
# relative_line_numbers = true;
# buffer_font_family = "Maple Mono NF CN";
# theme = {
# mode = "system";
# light = "Catppuccin Latte";
# dark = "Catppuccin Mocha";
# };
remove_trailing_whitespace_on_save = true;
agent = {
default_model = {

View file

@ -4,7 +4,7 @@
# Packages
./packages/cli.nix
./packages/catppuccin.nix
./packages/stylix.nix
# Shell
./programs/shell/bash.nix

View file

@ -12,7 +12,7 @@
./packages/gui.nix
./packages/flatpak.nix
./packages/fonts.nix
./packages/catppuccin.nix
./packages/stylix.nix
# Shell
./programs/shell/bash.nix
@ -63,9 +63,8 @@
./programs/walker.nix
# Desktop Linux
./programs/desktop/plasma
./programs/desktop/wayland-wm/niri
./programs/desktop/wayland-wm/hyprland
./programs/desktop/wayland-wm/niri
../../modules/home/do-not-track.nix
@ -79,6 +78,7 @@
# Development setup
../../modules/home/dev/nix.nix
../../modules/home/dev/java.nix
../../modules/home/dev/rust.nix
];
nixpkgs.config.allowUnfree = true;