wip: switch to niri [skip-ci]
Some checks failed
/ check (nvimDev) (push) Successful in 6s
/ check (nvimHeadless) (push) Successful in 2s
/ check (nvimNoBundledBins) (push) Successful in 4s
/ check (nvimNoLsp) (push) Successful in 5s
/ check (nvimNoTSGrammars) (push) Successful in 5s
/ check (treefmt) (push) Successful in 2s
/ check-renovaterc (push) Successful in 2s
/ build (audiomenu) (push) Successful in 2s
/ build (docs) (push) Successful in 3s
/ build (jpassmenu) (push) Successful in 1s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Failing after 2s
/ build (nvim) (push) Successful in 8s
/ report-size (push) Has been skipped
Some checks failed
/ check (nvimDev) (push) Successful in 6s
/ check (nvimHeadless) (push) Successful in 2s
/ check (nvimNoBundledBins) (push) Successful in 4s
/ check (nvimNoLsp) (push) Successful in 5s
/ check (nvimNoTSGrammars) (push) Successful in 5s
/ check (treefmt) (push) Successful in 2s
/ check-renovaterc (push) Successful in 2s
/ build (audiomenu) (push) Successful in 2s
/ build (docs) (push) Successful in 3s
/ build (jpassmenu) (push) Successful in 1s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Failing after 2s
/ build (nvim) (push) Successful in 8s
/ report-size (push) Has been skipped
Looks cooler c:
This commit is contained in:
parent
7dab7eb1dc
commit
d7de392201
8 changed files with 209 additions and 74 deletions
|
@ -158,13 +158,59 @@ 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;
|
||||
programs.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);
|
||||
# alias for concatStringsSep
|
||||
joinWith = lib.strings.concatStringsSep;
|
||||
in
|
||||
with config.lib.niri.actions;
|
||||
{
|
||||
# Open Terminal
|
||||
"${mod}+Return".action.spawn =
|
||||
if config.jhome.gui.terminal == "alacritty" then "alacritty" else config.jhome.gui.terminalCommand;
|
||||
# Open menu
|
||||
"${mod}+D".action =
|
||||
spawn "${lib.getExe pkgs.fuzzel}" "--terminal"
|
||||
"${joinWith " " config.jhome.gui.terminalCommand}";
|
||||
# Close Window
|
||||
"${mod}+Q".action = close-window;
|
||||
# Fullscreen
|
||||
"${mod}+F".action = fullscreen-window;
|
||||
# Hotkey help menu
|
||||
"${mod}+Shift+Slash".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;
|
||||
};
|
||||
# FIXME: swaylock is missing so this doesn't work anyways
|
||||
# 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;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -46,7 +39,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
|
||||
|
|
113
home/options.nix
113
home/options.nix
|
@ -78,13 +78,23 @@ let
|
|||
example = "/sys/class/hwmon/hwmon2/temp1_input";
|
||||
};
|
||||
|
||||
sway.options = {
|
||||
enable = lib.mkEnableOption "sway" // {
|
||||
windowManager.options = {
|
||||
enable = lib.mkEnableOption "window manager" // {
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"sway"
|
||||
"windowManager"
|
||||
"enable"
|
||||
] true;
|
||||
};
|
||||
windowManager = lib.mkOption {
|
||||
description = "Which window manager to enable";
|
||||
type = types.enum [ "niri" ];
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"windowManager"
|
||||
"windowManager"
|
||||
] "niri";
|
||||
};
|
||||
background = lib.mkOption {
|
||||
description = "The wallpaper to use.";
|
||||
type = types.path;
|
||||
|
@ -114,55 +124,60 @@ let
|
|||
default = true;
|
||||
example = false;
|
||||
};
|
||||
exec = lib.mkOption {
|
||||
description = "Run commands when starting sway.";
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
once = lib.mkOption {
|
||||
description = "Programs to start only once (`exec`).";
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "signal-desktop --start-in-tray" ];
|
||||
};
|
||||
always = lib.mkOption {
|
||||
description = "Programs to start whenever the config is sourced (`exec_always`).";
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "signal-desktop --start-in-tray" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
gui.options = {
|
||||
enable = lib.mkEnableOption "GUI applications" // {
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"enable"
|
||||
] false;
|
||||
gui.options =
|
||||
let
|
||||
cfg = attrs.config.jhome.gui;
|
||||
in
|
||||
{
|
||||
enable = lib.mkEnableOption "GUI applications" // {
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"enable"
|
||||
] false;
|
||||
};
|
||||
tempInfo = lib.mkOption {
|
||||
description = "Temperature info to display in the statusbar.";
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule tempInfo);
|
||||
};
|
||||
windowManager = lib.mkOption {
|
||||
description = "Window manager configuration.";
|
||||
default = { };
|
||||
type = types.submodule windowManager;
|
||||
};
|
||||
terminal = lib.mkOption {
|
||||
description = "The terminal emulator to use.";
|
||||
default = "alacritty";
|
||||
example = "wezterm";
|
||||
type = types.enum [
|
||||
"wezterm"
|
||||
"alacritty"
|
||||
];
|
||||
};
|
||||
terminalCommand = lib.mkOption {
|
||||
description = "The command to run in order to start the terminal.";
|
||||
default =
|
||||
if cfg.terminal == "wezterm" then
|
||||
[
|
||||
"wezterm"
|
||||
"start"
|
||||
]
|
||||
else if cfg.terminal == "alacritty" then
|
||||
[
|
||||
"alacritty"
|
||||
"-e"
|
||||
]
|
||||
else
|
||||
builtins.abort "no command configured for ${cfg.terminal}";
|
||||
example = [
|
||||
"wezterm"
|
||||
"start"
|
||||
];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
tempInfo = lib.mkOption {
|
||||
description = "Temperature info to display in the statusbar.";
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule tempInfo);
|
||||
};
|
||||
sway = lib.mkOption {
|
||||
description = "Sway window manager configuration.";
|
||||
default = { };
|
||||
type = types.submodule sway;
|
||||
};
|
||||
terminal = lib.mkOption {
|
||||
description = "The terminal emulator to use.";
|
||||
default = "alacritty";
|
||||
example = "wezterm";
|
||||
type = types.enum [
|
||||
"wezterm"
|
||||
"alacritty"
|
||||
];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.jhome = lib.mkOption {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue