Initial commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
{pkgs}: {
|
||||
"XF86AudioPlay" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["playerctl" "play-pause"];
|
||||
};
|
||||
"XF86AudioStop" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["playerctl" "stop"];
|
||||
};
|
||||
"XF86AudioNext" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["playerctl" "next"];
|
||||
};
|
||||
"XF86AudioPrev" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["playerctl" "previous"];
|
||||
};
|
||||
"XF86AudioMute" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"];
|
||||
};
|
||||
"XF86AudioMicMute" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"];
|
||||
};
|
||||
"XF86AudioRaiseVolume" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+"];
|
||||
};
|
||||
"XF86AudioLowerVolume" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-"];
|
||||
};
|
||||
"XF86MonBrightnessUp" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["brightnessctl" "set" "10%+"];
|
||||
};
|
||||
"XF86MonBrightnessDown" = {
|
||||
_props.allow-when-locked = true;
|
||||
spawn._args = ["brightnessctl" "set" "10%-"];
|
||||
};
|
||||
"Print".spawn._args = ["sh" "-c" "grim -g \"$(slurp)\" - | satty --filename - --output-filename ~/Pictures/Screenshots/satty-$(date +%Y%m%d-%H%M%S).png"];
|
||||
"Mod+B".spawn._args = ["zen"];
|
||||
"Mod+Return".spawn._args = ["alacritty"];
|
||||
"Mod+Q".close-window = {};
|
||||
"Mod+Shift+P".spawn._args = ["rofi-powermenu"];
|
||||
"Mod+S".switch-preset-column-width = {};
|
||||
"Mod+F".fullscreen-window = {};
|
||||
"Mod+1".set-column-width = "25%";
|
||||
"Mod+2".set-column-width = "50%";
|
||||
"Mod+3".set-column-width = "75%";
|
||||
"Mod+4".set-column-width = "100%";
|
||||
"Mod+Shift+F".expand-column-to-available-width = {};
|
||||
"Mod+Space".spawn._args = ["walker"];
|
||||
"Mod+Shift+Space".toggle-window-floating = {};
|
||||
"Mod+W".toggle-column-tabbed-display = {};
|
||||
"Mod+Comma".consume-window-into-column = {};
|
||||
"Mod+Period".expel-window-from-column = {};
|
||||
"Mod+C".center-visible-columns = {};
|
||||
"Mod+Tab".switch-focus-between-floating-and-tiling = {};
|
||||
"Mod+Minus".set-column-width = "-10%";
|
||||
"Mod+Plus".set-column-width = "+10%";
|
||||
"Mod+Shift+Minus".set-window-height = "-10%";
|
||||
"Mod+Shift+Plus".set-window-height = "+10%";
|
||||
"Mod+Left".focus-column-left = {};
|
||||
"Mod+Right".focus-column-right = {};
|
||||
"Mod+Down".focus-workspace-down = {};
|
||||
"Mod+Up".focus-workspace-up = {};
|
||||
"Mod+Shift+Left".move-column-left = {};
|
||||
"Mod+Shift+Right".move-column-right = {};
|
||||
"Mod+Shift+Up".move-column-to-workspace-up = {};
|
||||
"Mod+Shift+Down".move-column-to-workspace-down = {};
|
||||
"Mod+P" = {spawn-sh = "wl-mirror $(niri msg --json focused-output | jq -r .name)";};
|
||||
# "Mod+Alt".toggle-overview = { repeat=false; };
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
{
|
||||
window-rule = [
|
||||
{
|
||||
geometry-corner-radius._args = [8.0 8.0 12.0 12.0];
|
||||
clip-to-geometry = true;
|
||||
draw-border-with-background = false;
|
||||
}
|
||||
{
|
||||
match._props = {is-floating = true;};
|
||||
shadow = {};
|
||||
}
|
||||
{
|
||||
match._props = {is-window-cast-target = true;};
|
||||
focus-ring = {
|
||||
active-color = "#f38ba8";
|
||||
inactive-color = "#7d0d2d";
|
||||
};
|
||||
border.inactive-color = "#7d0d2d";
|
||||
shadow.color = "#7d0d2d70";
|
||||
tab-indicator = {
|
||||
active-color = "#f38ba8";
|
||||
inactive-color = "#7d0d2d";
|
||||
};
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "org.telegram.desktop";};
|
||||
block-out-from = "screencast";
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "app.drey.PaperPlane";};
|
||||
block-out-from = "screencast";
|
||||
}
|
||||
{
|
||||
match = [
|
||||
{_props = {app-id = "zen";};}
|
||||
{_props = {app-id = "helium";};}
|
||||
{_props = {app-id = "firefox";};}
|
||||
{_props = {app-id = "chromium-browser";};}
|
||||
{_props = {app-id = "xdg-desktop-portal-gtk";};}
|
||||
];
|
||||
scroll-factor = 0.6;
|
||||
}
|
||||
{
|
||||
match = [
|
||||
{_props = {app-id = "zen";};}
|
||||
{_props = {app-id = "helium";};}
|
||||
{_props = {app-id = "firefox";};}
|
||||
{_props = {app-id = "chromium-browser";};}
|
||||
];
|
||||
open-maximized = true;
|
||||
}
|
||||
{
|
||||
match._props = {title = "^Picture-in-Picture$";};
|
||||
open-floating = true;
|
||||
default-floating-position._props = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
default-column-width.fixed = 480;
|
||||
default-window-height.fixed = 270;
|
||||
}
|
||||
{
|
||||
match._props = {title = "Discord Popout";};
|
||||
open-floating = true;
|
||||
default-floating-position._props = {
|
||||
x = 32;
|
||||
y = 32;
|
||||
relative-to = "bottom-right";
|
||||
};
|
||||
}
|
||||
{
|
||||
match._props = {
|
||||
app-id = "Multiviewer";
|
||||
title = "^Track Map$";
|
||||
};
|
||||
open-floating = true;
|
||||
open-on-output = "HDMI-A-1";
|
||||
default-floating-position._props = {
|
||||
x = 1426;
|
||||
y = 747;
|
||||
relative-to = "top-right";
|
||||
};
|
||||
default-column-width.fixed = 490;
|
||||
default-window-height.fixed = 330;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = ".scrcpy-wrapped";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "com.gabm.satty";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "pavucontrol";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "pavucontrol-qt";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "com.saivert.pwvucontrol";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "io.github.fsobolev.Cavalier";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "dialog";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "popup";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "task_dialog";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "gcr-prompter";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "file-roller";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "org.gnome.FileRoller";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "nm-connection-editor";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "blueman-manager";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "xdg-desktop-portal-gtk";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "org.kde.polkit-kde-authentication-agent-1";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {app-id = "pinentry";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {title = "Progress";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {title = "File Operations";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {title = "Confirm";};
|
||||
open-floating = true;
|
||||
}
|
||||
{
|
||||
match._props = {title = "Error";};
|
||||
open-floating = true;
|
||||
}
|
||||
];
|
||||
|
||||
layer-rule = [
|
||||
{
|
||||
match._props = {namespace = "^noctalia-wallpaper*";};
|
||||
place-within-backdrop = true;
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
_: let
|
||||
pointer = "Bibata-Modern-Classic";
|
||||
in {
|
||||
environment = {
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
DISPLAY = null;
|
||||
MOZ_ENABLE_WAYLAND = "1";
|
||||
NIXOS_OZONE_WL = "1";
|
||||
QT_QPA_PLATFORM = "wayland;xcb";
|
||||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
SDL_VIDEODRIVER = "wayland";
|
||||
WLR_RENDERER = "vulkan";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
QT_QPA_PLATFORMTHEME = "qt6ct";
|
||||
GTK_IM_MODULE = "simple";
|
||||
XDG_CURRENT_DESKTOP = "Niri";
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
};
|
||||
|
||||
spawn-at-startup = [
|
||||
["wl-paste" "--watch" "cliphist" "store"]
|
||||
["wl-paste" "--type" "text" "--watch" "cliphist" "store"]
|
||||
["dunst"]
|
||||
["ashell"]
|
||||
["elephant"]
|
||||
["copyq"]
|
||||
["swww-daemon"]
|
||||
["swww" "img" "/etc/nixos/background.jpg" "--transition-type" "grow" "--transition-pos" "center" "--transition-duration" "3"]
|
||||
];
|
||||
|
||||
input = {
|
||||
keyboard.xkb.layout = "us";
|
||||
touchpad = {
|
||||
click-method = "button-areas";
|
||||
dwt = {};
|
||||
dwtp = {};
|
||||
#natural-scroll = {};
|
||||
scroll-method = "two-finger";
|
||||
tap = {};
|
||||
tap-button-map = "left-right-middle";
|
||||
middle-emulation = {};
|
||||
accel-profile = "adaptive";
|
||||
};
|
||||
focus-follows-mouse._props = {max-scroll-amount = "90%";};
|
||||
warp-mouse-to-focus = {};
|
||||
workspace-auto-back-and-forth = {};
|
||||
};
|
||||
|
||||
screenshot-path = "~/Pictures/Screenshots/Screenshot-from-%Y-%m-%d-%H-%M-%S.png";
|
||||
|
||||
overview = {
|
||||
workspace-shadow.off = {};
|
||||
backdrop-color = "transparent";
|
||||
};
|
||||
|
||||
gestures.hot-corners = {};
|
||||
|
||||
cursor = {
|
||||
xcursor-size = 20;
|
||||
xcursor-theme = pointer;
|
||||
};
|
||||
|
||||
layout = {
|
||||
background-color = "transparent";
|
||||
focus-ring.off = {};
|
||||
border = {
|
||||
width = 1;
|
||||
};
|
||||
shadow.off = {};
|
||||
preset-column-widths.proportion = [0.25 0.5 0.75 1.0];
|
||||
default-column-width.proportion = 0.5;
|
||||
always-center-single-column = {};
|
||||
gaps = 6;
|
||||
struts = {
|
||||
left = 0;
|
||||
right = 0;
|
||||
top = 0;
|
||||
bottom = 0;
|
||||
};
|
||||
tab-indicator = {
|
||||
hide-when-single-tab = {};
|
||||
place-within-column = {};
|
||||
position = "left";
|
||||
corner-radius = 20.0;
|
||||
gap = -12.0;
|
||||
gaps-between-tabs = 10.0;
|
||||
width = 4.0;
|
||||
length._props = {total-proportion = 0.1;};
|
||||
};
|
||||
};
|
||||
|
||||
prefer-no-csd = {};
|
||||
hotkey-overlay.skip-at-startup = {};
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
concatStringsSep
|
||||
splitString
|
||||
mapAttrsToList
|
||||
any
|
||||
optionalString
|
||||
pipe
|
||||
filterAttrs
|
||||
;
|
||||
inherit (builtins) typeOf replaceStrings elem;
|
||||
|
||||
indentStrings = let
|
||||
unlines = splitString "\n";
|
||||
lines = concatStringsSep "\n";
|
||||
indentAll = lines: concatStringsSep "\n" (map (x: " " + x) lines);
|
||||
in
|
||||
stringsWithNewlines: indentAll (unlines (lines stringsWithNewlines));
|
||||
|
||||
sanitizeString = replaceStrings ["\n" ''"'' "\\" "\r" "\t"] ["\\n" ''\"'' "\\\\" "\\r" "\\t"];
|
||||
|
||||
literalValueToString = element:
|
||||
lib.throwIfNot
|
||||
(elem (typeOf element) [
|
||||
"int"
|
||||
"float"
|
||||
"string"
|
||||
"bool"
|
||||
"null"
|
||||
])
|
||||
"Cannot convert value of type ${typeOf element} to KDL literal."
|
||||
(
|
||||
if typeOf element == "null"
|
||||
then "null"
|
||||
else if element == false
|
||||
then "false"
|
||||
else if element == true
|
||||
then "true"
|
||||
else if typeOf element == "string"
|
||||
then ''"${sanitizeString element}"''
|
||||
else toString element
|
||||
);
|
||||
|
||||
convertAttrsToKDL = name: attrs: let
|
||||
optArgsString = optionalString (attrs ? _args) (
|
||||
pipe attrs._args [
|
||||
(map literalValueToString)
|
||||
(concatStringsSep " ")
|
||||
(s: s + " ")
|
||||
]
|
||||
);
|
||||
optPropsString = optionalString (attrs ? _props) (
|
||||
pipe attrs._props [
|
||||
(mapAttrsToList (name: value: "${name}=${literalValueToString value}"))
|
||||
(concatStringsSep " ")
|
||||
(s: s + " ")
|
||||
]
|
||||
);
|
||||
children =
|
||||
filterAttrs (
|
||||
name: _:
|
||||
!(elem name [
|
||||
"_args"
|
||||
"_props"
|
||||
])
|
||||
)
|
||||
attrs;
|
||||
in
|
||||
''${name} ${optArgsString}${optPropsString}''
|
||||
+ (
|
||||
if children == {}
|
||||
then ""
|
||||
else "{\n${indentStrings (mapAttrsToList convertAttributeToKDL children)}\n}"
|
||||
);
|
||||
|
||||
convertListOfFlatAttrsToKDL = name: list: let
|
||||
flatElements = map literalValueToString list;
|
||||
in "${name} ${concatStringsSep " " flatElements}";
|
||||
|
||||
convertListOfNonFlatAttrsToKDL = name: list: ''${concatStringsSep "\n" (map (x: convertAttributeToKDL name x) list)}'';
|
||||
|
||||
convertListToKDL = name: list: let
|
||||
elementsAreFlat =
|
||||
!any (
|
||||
el:
|
||||
elem (typeOf el) [
|
||||
"list"
|
||||
"set"
|
||||
]
|
||||
)
|
||||
list;
|
||||
|
||||
allSingleValues =
|
||||
builtins.all (
|
||||
el:
|
||||
elem (typeOf el) ["int" "float" "string" "bool" "null"]
|
||||
)
|
||||
list;
|
||||
|
||||
isListOfLists = builtins.all (el: typeOf el == "list") list;
|
||||
in
|
||||
if isListOfLists
|
||||
then concatStringsSep "\n" (map (sublist: "${name} ${concatStringsSep " " (map literalValueToString sublist)}") list)
|
||||
else if elementsAreFlat && allSingleValues && builtins.length list > 1
|
||||
then concatStringsSep "\n" (map (val: "${name} ${literalValueToString val}") list)
|
||||
else if elementsAreFlat
|
||||
then convertListOfFlatAttrsToKDL name list
|
||||
else convertListOfNonFlatAttrsToKDL name list;
|
||||
|
||||
convertAttributeToKDL = name: value: let
|
||||
vType = typeOf value;
|
||||
in
|
||||
if
|
||||
elem vType [
|
||||
"int"
|
||||
"float"
|
||||
"bool"
|
||||
"string"
|
||||
]
|
||||
then "${name} ${literalValueToString value}"
|
||||
else if vType == "null"
|
||||
then "${name} ${literalValueToString value}"
|
||||
else if vType == "set"
|
||||
then
|
||||
if value == {}
|
||||
then name
|
||||
else convertAttrsToKDL name value
|
||||
else if vType == "list"
|
||||
then convertListToKDL name value
|
||||
else
|
||||
throw ''
|
||||
Cannot convert type `(${typeOf value})` to KDL:
|
||||
${name} = ${toString value}
|
||||
'';
|
||||
|
||||
toKDL = attrs: ''
|
||||
${concatStringsSep "\n" (mapAttrsToList convertAttributeToKDL attrs)}
|
||||
'';
|
||||
in {
|
||||
generate = name: value:
|
||||
pkgs.writeText name (toKDL value);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
toKDL = import ./_to-KDL.nix {inherit lib pkgs;};
|
||||
settings = import ./_settings.nix {inherit lib pkgs;};
|
||||
binds = import ./_binds.nix {inherit pkgs;};
|
||||
rules = import ./_rules.nix;
|
||||
|
||||
finalConfig = toKDL.generate "niri-config.kdl" (settings // {binds = binds;} // rules);
|
||||
in {
|
||||
environment.sessionVariables = {
|
||||
NIRI_CONFIG = "$HOME/.config/niri/config.kdl";
|
||||
};
|
||||
|
||||
users.users.someone.packages = with pkgs; [niri];
|
||||
|
||||
xdg.configFile."niri/config.kdl".text = builtins.readFile finalConfig;
|
||||
}
|
||||
Reference in New Issue
Block a user