wip: switch to niri
Some checks failed
/ check (nvimDev) (push) Successful in 5s
/ check (nvimHeadless) (push) Successful in 3s
/ check (nvimNoBundledBins) (push) Successful in 4s
/ check (nvimNoLsp) (push) Successful in 5s
/ check (nvimNoTSGrammars) (push) Successful in 4s
/ check (treefmt) (push) Successful in 2s
/ build (audiomenu) (push) Successful in 1s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 2s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Failing after 3s
/ build (nvim) (push) Successful in 9s
/ report-size (push) Has been skipped

Looks cooler c:
This commit is contained in:
Jalil David Salamé Messina 2025-02-09 19:35:03 +01:00
parent 4f82dc4918
commit b445813904
Signed by: jalil
GPG key ID: F016B9E770737A0B
8 changed files with 179 additions and 51 deletions

View file

@ -146,13 +146,55 @@ in
};
# Window Manager
wayland.windowManager.sway = {
inherit (cfg.sway) enable;
package = swayPkg; # no sway package if it comes from the OS
config = import ./sway-config.nix { inherit config pkgs; };
systemd = {
enable = true;
xdgAutostart = true;
niri = {
package = pkgs.niri; # use nixpkgs' package instead of the flake's
settings = {
binds =
let
# Modifier key
mod = "Mod";
# Available workspaces (1..=9)
workspaces = lib.range 1 9;
# Run function for each workspace
perWorkspace = f: lib.mergeAttrsList (builtins.map f workspaces);
in
with config.lib.niri.actions;
{
# Open Terminal
"${mod}+Return".action.spawn = config.jhome.gui.terminalCommand;
# Open menu
"${mod}+D".action =
spawn "${lib.getExe pkgs.fuzzel}" "--terminal"
"${builtins.concatStringSep " " terminalCommand}";
# Close Window
"${mod}+Q".action = close-window;
# Fullscreen
"${mod}+F".action = fullscreen-window;
# Hotkey help menu
"${mod}+Shift+/".action = show-hotkey-overlay;
# Media Keys
"XF86AudioRaiseVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "up";
allow-when-locked = true;
};
"XF86AudioLowerVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "down";
allow-when-locked = true;
};
"XF86AudioMute" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "toggle-mute";
allow-when-locked = true;
};
# Lock screen
"XF86ScreenSaver".action = spawn "swaylock" "--image" "${cfg.background}";
# Screen brightness
"XF86MonBrightnessUp".action = spawn "${pkgs.avizo}/bin/lightctl" "up";
"XF86MonBrightnessDown".action = spawn "${pkgs.avizo}/bin/lightctl" "down";
}
// perWorkspace (workspace: {
# Focus workspace N
"${mod}+${builtins.toString workspace}".action = focus-workspace workspace;
});
};
};

View file

@ -2,14 +2,7 @@
let
cfg = config.jhome.gui.sway;
modifier = "Mod4";
inherit (config.jhome.gui) terminal;
termCmd =
if terminal == "wezterm" then
"wezterm start"
else if terminal == "alacritty" then
"alacritty -e"
else
builtins.abort "no command configured for ${terminal}";
termCmd = builtins.concatStringsSep " " config.jhome.gui.terminalCommand;
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
@ -45,7 +38,8 @@ let
};
in
{
inherit modifier terminal menu;
inherit (config.jhome.gui) terminal;
inherit modifier menu;
keybindings = import ./keybindings.nix { inherit config pkgs; };
# Appearance
bars = [ ]; # Waybar is started as a systemd service