Modules/Hyprland: Slight config cleanup
This commit is contained in:
+88
-60
@@ -54,7 +54,7 @@ in
|
||||
cursorSize = 24;
|
||||
cursorPackage = pkgs.bibata-cursors;
|
||||
|
||||
iconTheme = "Papirus";
|
||||
iconTheme = "Papirus-Dark";
|
||||
iconPackage = pkgs.papirus-icon-theme;
|
||||
|
||||
scheme = "catppuccin-mocha";
|
||||
@@ -85,58 +85,83 @@ in
|
||||
keybindings = {
|
||||
main-mod = "SUPER";
|
||||
|
||||
bindings = lib.mergeAttrsList [
|
||||
{
|
||||
# Applications
|
||||
"$mainMod, t" = ["exec, kitty"];
|
||||
"$mainMod, e" = ["exec, kitty --title=Yazi yazi"];
|
||||
"$mainMod, n" = ["exec, neovide"];
|
||||
# "$mainMod, r" = ["exec, kitty --title=Rmpc rmpc"];
|
||||
"$mainMod CTRL, n" = ["exec, kitty --title=Navi navi"];
|
||||
"$mainMod SHIFT, n" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"];
|
||||
"$mainMod SHIFT, f" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"];
|
||||
# "ALT, tab" = ["exec, rofi -show window"];
|
||||
bindings = let
|
||||
sessionMenu = mylib.rofi.mkMenu {
|
||||
prompt = "Session2";
|
||||
layers = [
|
||||
{
|
||||
" Poweroff" = "poweroff";
|
||||
" Reboot" = "reboot";
|
||||
" Lock" = "loginctl lock-session";
|
||||
# " Reload Hyprpanel" = "systemctl --user restart hyprpanel.service";
|
||||
" Reload Hyprland" = "hyprctl reload";
|
||||
" Exit Hyprland" = "hyprctl dispatch exit";
|
||||
# " Exit Niri" = "niri msg action quit";
|
||||
}
|
||||
];
|
||||
prompts = ["Select Session Action"];
|
||||
rofiCmd = "walker -d";
|
||||
};
|
||||
in
|
||||
lib.mergeAttrsList [
|
||||
{
|
||||
"$mainMod SHIFT, a" = ["exec, walker -m providerlist"];
|
||||
"$mainMod, a" = ["exec, walker -m desktopapplications"];
|
||||
"$mainMod, c" = ["exec, walker -m clipboard"];
|
||||
"$mainMod, Escape" = ["exec, ${sessionMenu}/bin/rofi-menu-Session2"];
|
||||
"$mainMod CTRL, w" = ["exec, waypaper"];
|
||||
}
|
||||
{
|
||||
# Applications
|
||||
"$mainMod, t" = ["exec, kitty"];
|
||||
"$mainMod, e" = ["exec, kitty --title=Yazi yazi"];
|
||||
"$mainMod, n" = ["exec, neovide"];
|
||||
# "$mainMod, r" = ["exec, kitty --title=Rmpc rmpc"];
|
||||
"$mainMod CTRL, n" = ["exec, kitty --title=Navi navi"];
|
||||
"$mainMod SHIFT, n" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"];
|
||||
"$mainMod SHIFT, f" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"];
|
||||
# "ALT, tab" = ["exec, rofi -show window"];
|
||||
|
||||
# Screenshots
|
||||
"$mainMod, p" = ["exec, hyprpicker --autocopy --format=hex"];
|
||||
"$mainMod, s" = ["exec, grim -g \"$(slurp)\""];
|
||||
"$mainMod SHIFT, s" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
|
||||
# Screenshots
|
||||
"$mainMod, p" = ["exec, hyprpicker --autocopy --format=hex"];
|
||||
"$mainMod, s" = ["exec, grim -g \"$(slurp)\""];
|
||||
"$mainMod SHIFT, s" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
|
||||
|
||||
# Audio
|
||||
", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"];
|
||||
", XF86AudioLowerVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"];
|
||||
", XF86AudioPlay" = ["exec, playerctl play-pause"];
|
||||
", XF86AudioPrev" = ["exec, playerctl previous"];
|
||||
", XF86AudioNext" = ["exec, playerctl next"];
|
||||
# Audio
|
||||
", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"];
|
||||
", XF86AudioLowerVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"];
|
||||
", XF86AudioPlay" = ["exec, playerctl play-pause"];
|
||||
", XF86AudioPrev" = ["exec, playerctl previous"];
|
||||
", XF86AudioNext" = ["exec, playerctl next"];
|
||||
|
||||
# Brightness
|
||||
", XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset gamma -10"];
|
||||
", XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset gamma +10"];
|
||||
"$mainMod, XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset temperature 5750"];
|
||||
"$mainMod, XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset identity"];
|
||||
# Brightness
|
||||
", XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset gamma -10"];
|
||||
", XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset gamma +10"];
|
||||
"$mainMod, XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset temperature 5750"];
|
||||
"$mainMod, XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset identity"];
|
||||
|
||||
"CTRL ALT, f" = let
|
||||
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
|
||||
grep = "${pkgs.gnugrep}/bin/grep";
|
||||
awk = "${pkgs.gawk}/bin/gawk";
|
||||
notify = "${pkgs.libnotify}/bin/notify-send";
|
||||
"CTRL ALT, f" = let
|
||||
hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
|
||||
grep = "${pkgs.gnugrep}/bin/grep";
|
||||
awk = "${pkgs.gawk}/bin/gawk";
|
||||
notify = "${pkgs.libnotify}/bin/notify-send";
|
||||
|
||||
toggleMouseFocus = pkgs.writeScriptBin "hypr-toggle-mouse-focus" ''
|
||||
CURRENT=$(${hyprctl} getoption input:follow_mouse | ${grep} int | ${awk} -F' ' '{print $2}')
|
||||
toggleMouseFocus = pkgs.writeScriptBin "hypr-toggle-mouse-focus" ''
|
||||
CURRENT=$(${hyprctl} getoption input:follow_mouse | ${grep} int | ${awk} -F' ' '{print $2}')
|
||||
|
||||
if [[ "$CURRENT" == "1" ]]; then
|
||||
${hyprctl} keyword input:follow_mouse 0
|
||||
${notify} "Disabled Mouse Focus!"
|
||||
else
|
||||
${hyprctl} keyword input:follow_mouse 1
|
||||
${notify} "Enabled Mouse Focus!"
|
||||
fi
|
||||
'';
|
||||
in ["exec, ${toggleMouseFocus}/bin/hypr-toggle-mouse-focus"];
|
||||
if [[ "$CURRENT" == "1" ]]; then
|
||||
${hyprctl} keyword input:follow_mouse 0
|
||||
${notify} "Disabled Mouse Focus!"
|
||||
else
|
||||
${hyprctl} keyword input:follow_mouse 1
|
||||
${notify} "Enabled Mouse Focus!"
|
||||
fi
|
||||
'';
|
||||
in ["exec, ${toggleMouseFocus}/bin/hypr-toggle-mouse-focus"];
|
||||
|
||||
# "CTRL ALT, t" = ["exec, bash -c 'systemctl --user restart hyprpanel.service'"];
|
||||
}
|
||||
];
|
||||
# "CTRL ALT, t" = ["exec, bash -c 'systemctl --user restart hyprpanel.service'"];
|
||||
}
|
||||
];
|
||||
|
||||
ws-bindings = {
|
||||
# "<Workspace>" = "<Key>";
|
||||
@@ -152,19 +177,18 @@ in
|
||||
"10" = "0";
|
||||
};
|
||||
|
||||
special-ws-bindings = {
|
||||
"ferdium" = "x";
|
||||
"msty" = "z";
|
||||
"btop" = "b";
|
||||
"rmpc" = "r";
|
||||
};
|
||||
# special-ws-bindings = {
|
||||
# "ferdium" = "x";
|
||||
# "msty" = "z";
|
||||
# "btop" = "b";
|
||||
# "rmpc" = "r";
|
||||
# };
|
||||
};
|
||||
|
||||
autostart = {
|
||||
immediate = [
|
||||
"kitty --hold fastfetch"
|
||||
# "zeal"
|
||||
"nextcloud --background"
|
||||
# "protonvpn-app"
|
||||
|
||||
# "kdeconnect-indicator" # started by services.kdeconnect.indicator
|
||||
@@ -172,6 +196,7 @@ in
|
||||
|
||||
delayed = [
|
||||
# "keepassxc" # The tray doesn't work when started too early
|
||||
"nextcloud --background"
|
||||
];
|
||||
|
||||
special-silent = {
|
||||
@@ -190,15 +215,15 @@ in
|
||||
|
||||
workspacerules = {
|
||||
"1" = [];
|
||||
"2" = ["neovide" "code-url-handler"];
|
||||
"2" = ["neovide" "code-url-handler" "dev.zed.Zed" "code" "jetbrains-(.+)"];
|
||||
"3" = ["obsidian" "Zotero"];
|
||||
"4" = ["firefox" "Google-chrome" "chromium-browser" "org.qutebrowser.qutebrowser"];
|
||||
"5" = ["steam"];
|
||||
"6" = ["steam_app_(.+)"];
|
||||
"6" = ["steam_app_(.+)" "factorio"];
|
||||
"7" = ["signal"];
|
||||
"8" = ["tidal-hifi"];
|
||||
"8" = [];
|
||||
"9" = ["discord"];
|
||||
"10" = ["python3"];
|
||||
"10" = [];
|
||||
};
|
||||
|
||||
floating = [
|
||||
@@ -209,9 +234,10 @@ in
|
||||
}
|
||||
{class = "ffplay";}
|
||||
{class = "Unity";}
|
||||
{class = "code-url-handler";}
|
||||
];
|
||||
|
||||
transparent-opacity = "0.75";
|
||||
transparent-opacity = "0.85";
|
||||
|
||||
transparent = [
|
||||
"kitty"
|
||||
@@ -297,9 +323,11 @@ in
|
||||
|
||||
# Enable wayland
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
QT_QPA_PLATFORM = "wayland;xcb";
|
||||
# QT_QPA_PLATFORM = "wayland;xcb";
|
||||
QT_QPA_PLATFORM = "wayland";
|
||||
NIXOS_OZONE_WL = "1";
|
||||
# SDL_VIDEODRIVER = "wayland"; # Leave unset as gamescope uses xwayland
|
||||
# ELECTRON_OZONE_PLATFORM_HINT = "auto";
|
||||
SDL_VIDEODRIVER = "wayland"; # Leave unset as gamescope uses xwayland
|
||||
|
||||
# Run SSH_ASKPASS as GUI, not TTY for Obsidian git
|
||||
SSH_ASKPASS_REQUIRE = "prefer";
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
y = 0;
|
||||
scale = 1;
|
||||
bitdepth = 10;
|
||||
cm = "hdr";
|
||||
cm = "auto"; # with render:cm_auto_hdr, we don't need hdr here
|
||||
};
|
||||
|
||||
"DP-2" = {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
inputs.nixvim.homeModules.nixvim
|
||||
inputs.textfox.homeManagerModules.default
|
||||
inputs.walker.homeManagerModules.default
|
||||
# inputs.stylix.homeModules.stylix
|
||||
# inputs.direnv-instant.homeModules.direnv-instant
|
||||
# inputs.niri.homeModules.niri # Imported by system module
|
||||
# inputs.noctalia.homeModules.default
|
||||
|
||||
@@ -9,6 +9,8 @@ builtins.concatLists [
|
||||
[
|
||||
"hyprctl setcursor ${config.home.pointerCursor.name} ${builtins.toString config.home.pointerCursor.size}"
|
||||
"hyprsunset --identity"
|
||||
"waypaper --restore"
|
||||
"fcitx5"
|
||||
|
||||
# HACK: Hyprland doesn't set the xwayland/x11 keymap correctly
|
||||
"setxkbmap -layout ${hyprland.keyboard.layout} -variant ${hyprland.keyboard.variant} -option ${hyprland.keyboard.option} -model pc104"
|
||||
@@ -20,6 +22,11 @@ builtins.concatLists [
|
||||
# This is used for example when running systemd commands without root.
|
||||
# "systemctl --user start hyprpolkitagent.service"
|
||||
# "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"
|
||||
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||
|
||||
# TODO: This is started by niri already (extract to module so niri/hyprland can both use it)
|
||||
# "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||
|
||||
# TODO: This is started by niri already (extract to module so niri/hyprland can both use it)
|
||||
"dunst"
|
||||
]
|
||||
]
|
||||
|
||||
@@ -24,11 +24,6 @@
|
||||
in {
|
||||
options.homemodules.hyprland = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
# TODO: Extract common niri/hyprland stuff to modules (e.g., dunst), so no configs are duplicated
|
||||
# TODO: Remove unnecessary bullshit
|
||||
# TODO: Switch to lua config
|
||||
# TODO: Synchronize with niri mappings
|
||||
|
||||
config = lib.mkIf hyprland.enable {
|
||||
assertions = [
|
||||
{
|
||||
@@ -78,45 +73,10 @@ in {
|
||||
# Deps for Qt5 and Qt6 apps (e.g., Nextcloud)
|
||||
qt5.qtwayland
|
||||
qt6.qtwayland
|
||||
|
||||
# xwayland
|
||||
# wayland-protocols
|
||||
];
|
||||
|
||||
file = {
|
||||
".config/hypr/keybindings.info".text = let
|
||||
fixupHomeDir = key:
|
||||
builtins.replaceStrings ["/home/${username}"] ["~"] key;
|
||||
|
||||
fixupNixStore = key: let
|
||||
# The pattern has to match the entire string, otherwise it won't work
|
||||
matches = builtins.match ".*/nix/store/(.*)/.*" key;
|
||||
in
|
||||
if (matches == null)
|
||||
then key
|
||||
else builtins.replaceStrings matches ["..."] key;
|
||||
|
||||
fixupNoMod = key:
|
||||
builtins.replaceStrings ["<-"] ["<"] key;
|
||||
|
||||
mkBindHelpKey = key:
|
||||
builtins.replaceStrings ["$mainMod" " " ","] ["${hyprland.keybindings.main-mod}" "-" ""] key;
|
||||
|
||||
mkBindHelpAction = action:
|
||||
builtins.replaceStrings [","] [""] action;
|
||||
|
||||
mkBindHelp = key: action: "<${mkBindHelpKey key}>: ${mkBindHelpAction action}";
|
||||
|
||||
mkBindsHelp = key: actions:
|
||||
actions
|
||||
|> builtins.map (mkBindHelp key)
|
||||
|> builtins.map fixupNoMod
|
||||
|> builtins.map fixupNixStore
|
||||
|> builtins.map fixupHomeDir;
|
||||
in
|
||||
(hyprland.keybindings.bindings // always-bind)
|
||||
|> builtins.mapAttrs mkBindsHelp
|
||||
|> builtins.attrValues
|
||||
|> builtins.concatLists
|
||||
|> builtins.concatStringsSep "\n";
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
@@ -131,12 +91,15 @@ in {
|
||||
systemd.user.services.hypridle.Install.WantedBy = lib.mkForce ["hyprland-session.target"];
|
||||
systemd.user.services.hypridle.Unit.After = lib.mkForce ["hyprland-session.target"];
|
||||
systemd.user.services.hypridle.Unit.PartOf = lib.mkForce ["hyprland-session.target"];
|
||||
systemd.user.services.elephant.Install.WantedBy = lib.mkForce ["hyprland-session.target" "graphical-session.target"];
|
||||
systemd.user.services.elephant.Unit.After = lib.mkForce ["hyprland-session.target" "graphical-session.target"];
|
||||
systemd.user.services.elephant.Unit.PartOf = lib.mkForce ["hyprland-session.target" "graphical-session.target"];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
|
||||
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
|
||||
configType = "hyprlang"; # TODO: lua
|
||||
configType = "hyprlang";
|
||||
|
||||
systemd.enable = true; # Enable hyprland-session.target
|
||||
systemd.variables = ["--all"]; # Import PATH into systemd
|
||||
|
||||
@@ -137,8 +137,12 @@
|
||||
hyprland.windowrules
|
||||
];
|
||||
|
||||
render = {
|
||||
cm_enabled = true;
|
||||
cm_auto_hdr = true;
|
||||
};
|
||||
|
||||
dwindle = {
|
||||
pseudotile = true;
|
||||
preserve_split = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user