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

@ -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