444 lines
14 KiB
Nix
444 lines
14 KiB
Nix
# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
system,
|
|
...
|
|
}:
|
|
let
|
|
terminal = "${config.programs.wezterm.package}/bin/wezterm";
|
|
lock =
|
|
if config.targets.genericLinux.enable then
|
|
"/bin/hyprlock"
|
|
else
|
|
"${config.programs.hyprlock.package}/bin/hyprlock";
|
|
suspend = {
|
|
shell = "${pkgs.systemd}/bin/systemctl suspend";
|
|
exec = [
|
|
"${pkgs.systemd}/bin/systemctl"
|
|
"suspend"
|
|
];
|
|
};
|
|
wrapPkg = pkg: if config.targets.genericLinux.enable then (config.lib.nixGL.wrap pkg) else pkg;
|
|
border-radius = {
|
|
i = 12;
|
|
f = 12.0;
|
|
};
|
|
in
|
|
lib.mkIf (config.flakeSettings.graphical && lib.hasSuffix "-linux" system) {
|
|
programs = {
|
|
niri = {
|
|
# https://github.com/sodiboo/niri-flake/blob/main/docs.md
|
|
package = wrapPkg pkgs.niri-unstable;
|
|
settings =
|
|
with config.lib.niri.actions;
|
|
let
|
|
nu = spawn "nu" "-c";
|
|
in
|
|
{
|
|
xwayland-satellite = {
|
|
enable = true;
|
|
path = lib.getExe pkgs.xwayland-satellite-unstable;
|
|
};
|
|
spawn-at-startup =
|
|
let
|
|
reset-failed = str: {
|
|
argv = [
|
|
"${pkgs.systemd}/bin/systemctl"
|
|
"--user"
|
|
"reset-failed"
|
|
str
|
|
];
|
|
};
|
|
in
|
|
[
|
|
(reset-failed "waybar.service")
|
|
(reset-failed "swayidle.service")
|
|
(reset-failed "wireplumber.service")
|
|
(reset-failed "swww.service")
|
|
{
|
|
argv = [
|
|
"${config.services.swww.package}/bin/swww"
|
|
"img"
|
|
"${config.stylix.image}"
|
|
];
|
|
}
|
|
];
|
|
binds =
|
|
let
|
|
volume = {
|
|
"XF86AudioRaiseVolume" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--output-volume=raise" "5";
|
|
};
|
|
"XF86AudioLowerVolume" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--output-volume=lower" "5";
|
|
};
|
|
"XF86AudioMute" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--output-volume=mute-toggle";
|
|
};
|
|
};
|
|
player = {
|
|
"XF86AudioPlay" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--playerctl=play-pause";
|
|
};
|
|
"XF86AudioPause" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--playerctl=pause";
|
|
};
|
|
"XF86AudioStop" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--playerctl=stop";
|
|
};
|
|
"XF86AudioPrev" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--playerctl=prev";
|
|
};
|
|
"XF86AudioNext" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--playerctl=next";
|
|
};
|
|
};
|
|
backlight = {
|
|
"XF86MonBrightnessUp" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--brightness=raise" "5";
|
|
};
|
|
"XF86MonBrightnessDown" = {
|
|
allow-when-locked = true;
|
|
action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--brightness=lower" "5";
|
|
};
|
|
};
|
|
toggle-keys = {
|
|
"Caps_Lock".action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--caps-lock";
|
|
"Num_Lock".action = spawn "${config.services.swayosd.package}/bin/swayosd-client" "--num-lock";
|
|
};
|
|
navigation = {
|
|
"Mod+WheelScrollDown" = {
|
|
cooldown-ms = 150;
|
|
action = focus-workspace-down;
|
|
};
|
|
"Mod+WheelScrollUp" = {
|
|
cooldown-ms = 150;
|
|
action = focus-workspace-up;
|
|
};
|
|
"Mod+WheelScrollRight".action = focus-column-right;
|
|
"Mod+WheelScrollLeft".action = focus-column-left;
|
|
"Mod+Shift+E".action = quit;
|
|
"Mod+Escape".action = toggle-keyboard-shortcuts-inhibit;
|
|
"Mod+Tab".action = toggle-overview;
|
|
"Mod+Shift+Tab".action = show-hotkey-overlay;
|
|
};
|
|
window = {
|
|
"Mod+W".action = toggle-window-floating;
|
|
"Mod+F".action = maximize-column;
|
|
"Mod+Shift+F".action = fullscreen-window;
|
|
"Mod+Q".action = close-window;
|
|
};
|
|
spawns = {
|
|
"Mod+Space".action = spawn "${config.programs.fuzzel.package}/bin/fuzzel";
|
|
"Mod+Shift+Space".action = spawn terminal;
|
|
"Super+Alt+L" = {
|
|
allow-inhibiting = false;
|
|
action = spawn lock;
|
|
};
|
|
};
|
|
screenshots =
|
|
let
|
|
full = screenshot { };
|
|
window = screenshot-window { write-to-disk = false; };
|
|
edit = nu ''
|
|
^"${pkgs.wl-clipboard-rs}/bin/wl-paste" --type image/png | ^"${config.programs.swappy.package}/bin/swappy" -f -
|
|
'';
|
|
in
|
|
{
|
|
"Print".action = full;
|
|
"Mod+XF86AudioMute".action = full;
|
|
# "Ctrl+Print".action = screenshot-screen { write-to-disk = false; };
|
|
"Alt+Print".action = window;
|
|
"Mod+Alt+XF86AudioMute".action = window;
|
|
"Ctrl+Print".action = edit;
|
|
"Mod+Ctrl+XF86AudioMute".action = edit;
|
|
};
|
|
notifications = {
|
|
"Mod+N".action = spawn "${config.services.mako.package}/bin/makoctl" "mode" "-t" "do-not-disturb";
|
|
"Mod+Shift+N".action = spawn "${config.services.mako.package}/bin/makoctl" "dismiss" "-a";
|
|
};
|
|
in
|
|
backlight
|
|
// navigation
|
|
// notifications
|
|
// player
|
|
// screenshots
|
|
// spawns
|
|
// toggle-keys
|
|
// volume
|
|
// window;
|
|
switch-events = {
|
|
lid-close.action = spawn suspend.exec;
|
|
};
|
|
prefer-no-csd = true;
|
|
window-rules = [
|
|
{
|
|
geometry-corner-radius = {
|
|
bottom-left = border-radius.f;
|
|
bottom-right = border-radius.f;
|
|
top-left = border-radius.f;
|
|
top-right = border-radius.f;
|
|
};
|
|
clip-to-geometry = true;
|
|
}
|
|
];
|
|
input = {
|
|
mouse = { };
|
|
touchpad = {
|
|
dwt = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
wezterm = {
|
|
# TODO: Fix scrolling
|
|
enable = true;
|
|
package = wrapPkg pkgs.wezterm;
|
|
extraConfig = ''
|
|
return {
|
|
hide_tab_bar_if_only_one_tab = true,
|
|
}
|
|
'';
|
|
};
|
|
kitty = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.kitty;
|
|
enableGitIntegration = true;
|
|
settings = {
|
|
clipboard_control = "write-primary write-clipboard no-append";
|
|
};
|
|
};
|
|
fuzzel = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.fuzzel;
|
|
settings = {
|
|
main = { inherit terminal; };
|
|
};
|
|
};
|
|
hyprlock = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.hyprlock;
|
|
};
|
|
waybar = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.waybar;
|
|
systemd.enable = true;
|
|
style =
|
|
let
|
|
padding = "12px";
|
|
in
|
|
''
|
|
#tray, #network, #cpu, #memory, #temperature, #wireplumber, #backlight, #clock, #custom-mako-dnd, #workspaces {
|
|
padding: 0 ${padding};
|
|
}
|
|
|
|
#workspaces button {
|
|
color: @base05;
|
|
min-width: 0;
|
|
}
|
|
'';
|
|
settings = {
|
|
# https://github.com/YaLTeR/dotfiles/blob/master/dot_config/waybar/config.jsonc.tmpl
|
|
topBar = {
|
|
layer = "top";
|
|
position = "top";
|
|
modules-left = [ "niri/window" ];
|
|
modules-right = [
|
|
"cpu"
|
|
"memory"
|
|
"battery"
|
|
"temperature"
|
|
"wireplumber"
|
|
"backlight"
|
|
"custom/mako-dnd"
|
|
"clock"
|
|
];
|
|
clock = {
|
|
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
|
|
format = "{:%m-%e\t<b>%H:%M</b>}";
|
|
};
|
|
cpu = {
|
|
format = " {usage}%";
|
|
justify = "center";
|
|
};
|
|
memory = {
|
|
format = " {percentage}% {swapPercentage}%";
|
|
justify = "center";
|
|
};
|
|
temperature = {
|
|
format = " {}°C";
|
|
justify = "center";
|
|
};
|
|
wireplumber = {
|
|
format = "{icon} {volume}%";
|
|
format-muted = " {volume}%";
|
|
format-icons = [
|
|
""
|
|
""
|
|
""
|
|
];
|
|
justify = "center";
|
|
};
|
|
backlight = {
|
|
format = "{icon} {percent}%";
|
|
format-icons = [
|
|
""
|
|
""
|
|
""
|
|
];
|
|
justify = "center";
|
|
};
|
|
battery = {
|
|
states = {
|
|
warning = 30;
|
|
critical = 15;
|
|
};
|
|
format = "{icon} {capacity}%";
|
|
format-charging = " {capacity}%";
|
|
format-plugged = " {capacity}%";
|
|
format-alt = "{icon} {time}";
|
|
format-icons = [
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
];
|
|
justify = "center";
|
|
};
|
|
"custom/mako-dnd" =
|
|
let
|
|
makoDndScript = pkgs.writeTextFile {
|
|
name = "mako-dnd-waybar";
|
|
executable = true;
|
|
text = ''
|
|
#!${pkgs.nushell}/bin/nu
|
|
let mode_output = (do -i { ^"${config.services.mako.package}/bin/makoctl" mode } | complete |
|
|
get stdout stderr |
|
|
str join |
|
|
lines |
|
|
where {|x| not ($x =~ '^Warning')} |
|
|
str join)
|
|
|
|
if ($mode_output | str contains "do-not-disturb") {
|
|
print '{"text": "", "tooltip": "Do Not Disturb Enabled", "class": "dnd-enabled"}'
|
|
} else {
|
|
print '{"text": "", "tooltip": "Do Not Disturb Disabled", "class": "dnd-disabled"}'
|
|
}
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
exec = makoDndScript;
|
|
return-type = "json";
|
|
on-click = "${config.services.mako.package}/bin/makoctl mode -t dnd";
|
|
exec-on-event = true;
|
|
interval = 5;
|
|
signal = 1;
|
|
};
|
|
};
|
|
bottomBar = {
|
|
layer = "top";
|
|
position = "bottom";
|
|
modules-left = [ "niri/workspaces" ];
|
|
modules-center = [ "wlr/taskbar" ];
|
|
modules-right = [ "tray" ];
|
|
tray = {
|
|
spacing = 10;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
rofi = {
|
|
inherit terminal;
|
|
enable = true;
|
|
package = wrapPkg pkgs.rofi;
|
|
};
|
|
swappy = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.swappy;
|
|
};
|
|
};
|
|
services = {
|
|
mako = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.mako;
|
|
settings = {
|
|
border-radius = border-radius.i;
|
|
actions = true;
|
|
default-timeout = 5;
|
|
ignore-timeout = false;
|
|
"mode=do-not-disturb" = {
|
|
invisible = 1;
|
|
};
|
|
};
|
|
};
|
|
swayidle = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.swayidle;
|
|
events = [
|
|
{
|
|
event = "before-sleep";
|
|
command =
|
|
let
|
|
script = pkgs.writeTextFile {
|
|
name = "check-hyprlock";
|
|
executable = true;
|
|
text = ''
|
|
#!${pkgs.nushell}/bin/nu
|
|
if (ps | where name =~ "hyprlock" | is-empty) { ${lock} }
|
|
'';
|
|
};
|
|
in
|
|
"${script}";
|
|
}
|
|
# {
|
|
# event = "lock";
|
|
# command = "lock";
|
|
# }
|
|
];
|
|
timeouts = [
|
|
{
|
|
timeout = 1800;
|
|
command = lock;
|
|
}
|
|
{
|
|
timeout = 2100;
|
|
command = suspend.shell;
|
|
}
|
|
];
|
|
};
|
|
swww = {
|
|
# TODO: probably need to configure manually
|
|
enable = true;
|
|
package = wrapPkg pkgs.swww;
|
|
};
|
|
swayosd = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.swayosd;
|
|
};
|
|
network-manager-applet = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.networkmanagerapplet;
|
|
};
|
|
blueman-applet = {
|
|
enable = true;
|
|
package = wrapPkg pkgs.blueman;
|
|
};
|
|
};
|
|
}
|