refactor: complete rewrite

This commit is contained in:
ooks-io 2024-10-23 23:46:25 +13:00
parent 19a4bbda3c
commit 8e81943cf9
399 changed files with 3396 additions and 8042 deletions

View file

@ -0,0 +1,13 @@
{
imports = [
./rofi.nix
./mako.nix
./tools.nix
./waybar.nix
./hypridle.nix
./hyprlock.nix
./hyprpaper.nix
./gammastep.nix
./polkit.nix
];
}

View file

@ -0,0 +1,25 @@
{
lib,
osConfig,
...
}: let
inherit (lib) mkIf;
inherit (osConfig.ooknet.workstation) environment;
in {
config = mkIf (environment == "hyprland") {
services.gammastep = {
enable = true;
enableVerboseLogging = true;
provider = "manual";
latitude = -30.0;
longitude = 150.0;
temperature = {
day = 6000;
night = 4000;
};
settings.general.adjustment-method = "wayland";
};
};
}

View file

@ -0,0 +1,31 @@
{
inputs',
osConfig,
lib,
config,
...
}: let
inherit (lib) getExe mkIf;
inherit (osConfig.ooknet.workstation) environment;
hyprlock = getExe config.programs.hyprlock.package;
in {
config = mkIf (environment == "hyprland") {
services.hypridle = {
enable = true;
package = inputs'.hypridle.packages.hypridle;
settings = {
general = {
lock_cmd = hyprlock;
ignore_dbus_inhibit = false;
};
listener = [
{
timout = 300;
on-timeout = hyprlock;
}
];
};
};
};
}

View file

@ -0,0 +1,79 @@
{
lib,
osConfig,
inputs',
...
}: let
inherit (osConfig.ooknet.appearance) colorscheme fonts;
inherit (colorscheme) palette;
inherit (osConfig.ooknet.workstation) environment;
inherit (lib) mkIf;
in {
config = mkIf (environment == "hyprland") {
ooknet.binds.lock = "hyprlock";
programs.hyprlock = {
enable = true;
package = inputs'.hyprlock.packages.hyprlock;
settings = {
enable = true;
general = {
disable_loading_bar = true;
hide_cursor = true;
no_fade_in = true;
};
backgrounds = [
{
monitor = "";
path = "";
color = "0xff${palette.base01}";
}
];
input-fields = [
{
size = {
width = 300;
height = 40;
};
position = {
x = 0;
y = 0;
};
outline_thickness = 2;
dots_spacing = 0.2;
fade_on_empty = false;
placeholder_text = "";
outer_color = "0xff${palette.base02}";
inner_color = "0xff${palette.base00}";
font_color = "0xff${palette.base05}";
}
];
labels = [
{
monitor = "";
text = " ";
position = {
x = 0;
y = 80;
};
color = "0xff${palette.base08}";
font_size = 30;
font_family = "${fonts.monospace.family}";
}
{
monitor = "";
text = "$TIME";
position = {
x = 0;
y = -80;
};
color = "0xff${palette.base0B}";
font_size = 20;
font_family = "${fonts.monospace.family}";
}
];
};
};
};
}

View file

@ -0,0 +1,21 @@
{
lib,
osConfig,
...
}: let
inherit (lib) mkIf;
inherit (osConfig.ooknet.workstation) environment;
wallpaperPath = osConfig.ooknet.appearance.wallpaper.path;
in {
config = mkIf (environment == "hyprland") {
services.hyprpaper = {
enable = true;
};
xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ${wallpaperPath}
wallpaper = , ${wallpaperPath}
splash = false
ipc = off
'';
};
}

View file

@ -0,0 +1,38 @@
{
osConfig,
lib,
...
}: let
inherit (osConfig.ooknet.appearance) colorscheme fonts;
inherit (colorscheme) palette;
inherit (osConfig.ooknet.workstation) environment;
inherit (lib) mkIf;
in {
config = mkIf (environment == "hyprland") {
services.mako = {
enable = true;
font = "${fonts.regular.family} 12";
padding = "10,10";
anchor = "top-right";
width = 300;
height = 100;
borderSize = 2;
defaultTimeout = 3000;
backgroundColor = "#${palette.base00}dd";
borderColor = "#${palette.base05}dd";
textColor = "#${palette.base05}dd";
extraConfig = ''
[app-name="system-notify"]
padding=3,3
width=100
height=100
[urgency=critical]
padding=3,3
width=100
height=100
anchor=top-center
border-color=#${palette.base08}dd
'';
};
};
}

View file

@ -0,0 +1,31 @@
{
lib,
osConfig,
pkgs,
...
}: let
inherit (lib) mkIf;
inherit (osConfig.ooknet.workstation) environment;
in {
config = mkIf (environment == "hyprland") {
systemd.user.services = {
polkit-pantheon-authentication-agent-1 = {
Unit.Description = "polkit-pantheon-authentication-agent-1";
Install = {
WantedBy = ["graphical-session.target"];
Wants = ["graphical-session.target"];
After = ["graphical-session.target"];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.pantheon.pantheon-agent-polkit}/libexec/policykit-1-pantheon/io.elementary.desktop.agent-polkit";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
};
}

View file

@ -0,0 +1,82 @@
{
lib,
config,
osConfig,
pkgs,
...
}: let
inherit (lib) mkIf;
inherit (osConfig.ooknet.appearance) colorscheme fonts;
inherit (colorscheme) palette;
inherit (osConfig.ooknet.workstation) environment;
inherit (config.lib.formats.rasi) mkLiteral;
in {
config = mkIf (environment == "hyprland") {
programs.rofi = {
enable = true;
font = "${fonts.monospace.family}";
package = pkgs.rofi-wayland;
terminal = "${config.home.sessionVariables.TERMINAL}";
theme = {
"*" = {
background = mkLiteral "#${palette.base00}";
foreground = mkLiteral "#${palette.base05}";
selected = mkLiteral "#${palette.base0B}";
message = mkLiteral "#${palette.base0D}";
background-color = mkLiteral "@background";
border-color = mkLiteral "@foreground";
text-color = mkLiteral "@foreground";
font = mkLiteral "'${fonts.monospace.family} 14'";
};
"window" = {
width = mkLiteral "15%";
border = mkLiteral "2";
padding = mkLiteral "10";
children = mkLiteral "[message,listview,inputbar]";
};
"message" = {
children = mkLiteral "[textbox]";
};
"textbox" = {
text-color = mkLiteral "@message";
horizontal-align = mkLiteral "0.50";
};
"inputbar" = {
cursor = mkLiteral "pointer";
border = mkLiteral "2";
children = mkLiteral "[textbox-prompt-colon,entry]";
};
"entry" = {
cursor = mkLiteral "false";
};
"textbox-prompt-colon" = {
text-color = mkLiteral "@selected";
expand = mkLiteral "false";
margin = mkLiteral "0 0.3em 0em 0em";
str = mkLiteral "' '";
};
"listview" = {
scrollbar = mkLiteral "true";
fixed-height = mkLiteral "false";
dynamic = mkLiteral "true";
};
"element-text" = {
horizontal-align = mkLiteral "0.50";
};
"element-text selected" = {
text-color = mkLiteral "@selected";
};
};
};
};
}

View file

@ -0,0 +1,33 @@
{
lib,
pkgs,
osConfig,
...
}: let
inherit (lib) mkIf;
inherit (builtins) attrValues;
inherit (osConfig.ooknet.workstation) environment;
in {
config = mkIf (environment == "hyprland") {
home = {
packages = attrValues {
inherit
(pkgs)
grim
slurp
libnotify
wl-screenrec
wf-recorder
wl-clipboard
;
};
};
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
};
}

View file

@ -0,0 +1,162 @@
{
config,
lib,
pkgs,
osConfig,
...
}: let
inherit (osConfig.ooknet.appearance) colorscheme fonts;
inherit (colorscheme) palette;
inherit (osConfig.ooknet.hardware) monitors;
inherit (osConfig.ooknet.workstation) environment;
inherit (lib) mkIf head;
monitorWidth = (head monitors).width - 20;
in {
config = mkIf (environment == "hyprland") {
programs.waybar = {
enable = true;
systemd.enable = true;
package = pkgs.waybar;
settings.mainBar = {
layer = "top";
position = "top";
height = 30;
width = monitorWidth;
exclusive = true;
margin-top = 10;
margin-bottom = -12;
modules-left = ["clock" "battery" "hyprland/workspaces"];
modules-center = [];
modules-right = ["custom/hyprrecord" "tray"];
"hyprland/workspaces" = let
hyprctl = config.wayland.windowManager.hyprland.package + "/bin/hyprctl";
in {
on-click = "activate";
on-scroll-up = "${hyprctl} dispatch workspace m+1";
on-scroll-down = "${hyprctl} dispatch workspace m-1";
format = "{icon}";
active-only = false;
persistent-workspaces = {
"*" = 5;
};
format-icons = {
active = "";
default = "";
urgent = "";
};
all-outputs = false;
};
clock = {
format = "{:%I:%M %p}";
format-alt = "{:%Y-%m-%d}";
};
battery = {
states = {
good = 100;
warning = 35;
critical = 15;
};
bat = "BAT0";
interval = 10;
format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
format = "{icon} {capacity}%";
format-charging = "󱐋{icon} {capacity}%";
tooltip-format = "{timeTo} {power}W";
};
tray = {
icon-size = 21;
spacing = 5;
};
"custom/hyprrecord" = {
format = "{}";
interval = "once";
exec = "echo ";
tooltip = "false";
exec-if = "pgrep wl-screenrec";
on-click = "exec hyprrecord -a --waybar screen copysave video";
signal = 12;
};
};
style =
/*
css
*/
''
* {
font-family: "${fonts.monospace.family}";
font-size: 19px;
border: solid #${palette.base05};
}
window#waybar {
background-color: transparent;
margin: 10px;
}
#clock,
#battery,
#workspaces {
background-color: #${palette.base00};
padding-right: 10px;
}
#clock {
padding-left: 10px;
border: 2px solid #${palette.base05};
border-right: 0px;
border-top-left-radius: 10px;
}
#battery {
padding-left: 10px;
border-top: 2px solid #${palette.base05};
border-bottom: 2px solid #${palette.base05};
border-left: 0px;
}
#battery.good {
color: #${palette.base0B};
}
#battery.warning {
color: #${palette.base0A};
}
#battery.critical {
color: #${palette.base08};
}
#tray {
padding-right: 10px;
padding-left: 10px;
background-color: transparent;
border: 0;
}
#workspaces {
border: 2px solid #${palette.base05};
border-left: 0;
border-top-right-radius: 10px;
}
#workspace button,
#workspaces button.active,
#workspaces button.visible {
color: #${palette.base0B};
}
#workspaces button.urgent {
color: #${palette.base08};
}
#custom-hyprrecord {
color: #${palette.base08};
padding-right: 20px;
}
'';
};
};
}

View file

@ -0,0 +1,49 @@
{
inputs',
lib,
osConfig,
...
}: let
inherit (osConfig.ooknet.workstation) environment;
inherit (osConfig.ooknet.hardware) gpu;
inherit (lib) mkIf;
in {
imports = [
./settings
./components
];
config = mkIf (environment == "hyprland") {
wayland.windowManager.hyprland = {
enable = true;
package = inputs'.hyprland.packages.hyprland;
xwayland.enable = true;
systemd = {
enable = true;
variables = ["--all"];
};
};
home.sessionVariables =
{
CLUTTER_BACKEND = "wayland";
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
DISABLE_QT5_COMPAT = "0";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
MOZ_ENABLE_WAYLAND = "1";
MOZ_DBUS_REMOTE = "1";
XDG_SESSION_TYPE = "wayland";
SDL_VIDEODRIVER = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_CURRENT_DESKTOP = "Hyprland";
}
// mkIf (gpu.type == "nvidia") {
LIBVA_DRIVER_NAME = "nvidia";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1";
};
};
}

View file

@ -0,0 +1,46 @@
{osConfig, ...}: let
inherit (osConfig.ooknet.appearance) colorscheme cursor;
inherit (colorscheme) palette;
in {
wayland.windowManager.hyprland = {
settings = {
# cursor = {
# inactive_timeout = 4;
# };
general = {
gaps_in = 10;
gaps_out = 10;
border_size = 2;
"col.active_border" = "0xff${palette.base05}";
"col.inactive_border" = "0xff${palette.base02}";
};
exec-once = [
"hyprctl setcursor ${cursor.name} ${toString cursor.size}"
];
decoration = {
active_opacity = 1.0;
inactive_opacity = 1.0;
fullscreen_opacity = 1.0;
rounding = 0;
blur = {
enabled = false;
ignore_opacity = true;
};
drop_shadow = true;
shadow_range = 12;
shadow_offset = "3 3";
"col.shadow" = "0x44000000";
"col.shadow_inactive" = "0x66000000";
};
animations = {
enabled = false;
};
};
};
}

View file

@ -0,0 +1,114 @@
{config, ...}: let
inherit (config.ooknet) binds;
in {
wayland.windowManager.hyprland.settings = {
bind = [
# Program Launch
"SUPER, b, exec, ${binds.browser}"
"SUPER, return, exec, ${binds.terminal}"
"SUPER, e, exec, ${binds.terminalLaunch} $EDITOR"
"SUPERSHIFT, P, exec, ${binds.password}"
"SUPER, d, exec, ${binds.discord}"
"SUPERSHIFT, e, exec, ${binds.fileManager}"
"SUPERSHIFT, S, exec, ${binds.steam}"
"SUPERSHIFT, n, exec, ${binds.notes}"
"SUPER, escape, exec, ${binds.terminalLaunch} --title=BTOP btop"
"SUPER CTRL, return, exec, ${binds.zellijMenu}"
"SUPER, delete, exec, ${binds.powerMenu}"
"SUPERSHIFT, F, exec, ${binds.factorio}"
# Spotify PLayer Controls
"SUPER, M, exec, ${binds.spotify.launch}"
"SUPER, bracketright, exec, ${binds.spotify.next}"
"SUPER, bracketleft, exec, ${binds.spotify.previous}"
"SUPER, backslash, exec, ${binds.spotify.play}"
# Brightness
",XF86MonBrightnessUp, exec, ${binds.brightness.up}"
",XF86MonBrightnessDown, exec, ${binds.brightness.down}"
# Volume
",XF86AudioRaiseVolume, exec, ${binds.volume.up}"
",XF86AudioLowerVolume, exec, ${binds.volume.down}"
",XF86AudioMute, exec, ${binds.volume.mute}"
# Window Management
"SUPER, Q, killactive"
"SUPER CTRL, backspace, killactive"
"SUPERSHIFT ALT, delete, exec, hyprkillsession"
"SUPER, F, fullscreen"
"SUPER CTRL, F, fullscreenstate"
"SUPER, Space, togglefloating"
"SUPER, P, pseudo" # dwindle
"SUPER, S, togglesplit" # dwindle
# Focus Arrows
"SUPER, left, movefocus,l"
"SUPER, right, movefocus,r"
"SUPER, up, movefocus,u"
"SUPER, down, movefocus,d"
# Focus Vim
"SUPER, h, movefocus,l"
"SUPER, l, movefocus,r"
"SUPER, k, movefocus,u"
"SUPER, j, movefocus,d"
# Move Arrows
"SUPERSHIFT, left, movewindow,l"
"SUPERSHIFT, right, movewindow,r"
"SUPERSHIFT, up, movewindow,u"
"SUPERSHIFT, down, movewindow,d"
# Move Vim
"SUPERSHIFT, h, movewindow,l"
"SUPERSHIFT, l, movewindow,r"
"SUPERSHIFT, k, movewindow,u"
"SUPERSHIFT, j, movewindow,d"
#Resize
"SUPER CTRL, left, resizeactive,-20 0"
"SUPERCTRL, right, resizeactive,20 0"
"SUPER CTRL, up, resizeactive,0 -20"
"SUPERCTRL, down, resizeactive,0 20"
# Switch workspace
"SUPER, 1, workspace,1"
"SUPER, 2, workspace,2"
"SUPER, 3, workspace,3"
"SUPER, 4, workspace,4"
"SUPER, 5, workspace,5"
"SUPER, 6, workspace,6"
"SUPER, 7, workspace,7"
"SUPER, 8, workspace,8"
"SUPER, 9, workspace,9"
"SUPER, 0, workspace,10"
"SUPER, period, workspace,e+1"
"SUPER, comma, workspace,e-1"
"SUPER, tab, focusCurrentOrLast"
# Move workspace
"SUPERSHIFT, 1, movetoworkspace,1"
"SUPERSHIFT, 2, movetoworkspace,2"
"SUPERSHIFT, 3, movetoworkspace,3"
"SUPERSHIFT, 4, movetoworkspace,4"
"SUPERSHIFT, 5, movetoworkspace,5"
"SUPERSHIFT, 6, movetoworkspace,6"
"SUPERSHIFT, 7, movetoworkspace,7"
"SUPERSHIFT, 8, movetoworkspace,8"
"SUPERSHIFT, 9, movetoworkspace,9"
"SUPERSHIFT, 0, movetoworkspace,10"
# Lock Screen
"SUPER, Backspace, exec, ${binds.lock}"
];
# Mouse
bindm = [
"SUPER, mouse:272, movewindow"
"SUPER, mouse:273, resizewindow"
];
# bindr = [
# "SUPER, SUPER_L, exec, killall rofi || rofi -show drun"
# ];
};
}

View file

@ -0,0 +1,12 @@
{
imports = [
./misc.nix
./exec.nix
./input.nix
./binds.nix
./rules.nix
./monitor.nix
./gestures.nix
./appearance.nix
];
}

View file

@ -0,0 +1,12 @@
{pkgs, ...}: {
wayland.windowManager.hyprland.settings = {
exec = [
#"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
];
exec-once = [
"${pkgs._1password-gui}/bin/1password --silent"
# "${pkgs.live-buds-cli}/bin/earbuds -d"
# "waybar"
];
};
}

View file

@ -0,0 +1,6 @@
{
wayland.windowManager.hyprland.settings.gestures = {
workspace_swipe = true;
workspace_swipe_forever = true;
};
}

View file

@ -0,0 +1,8 @@
{
wayland.windowManager.hyprland.settings.input = {
kb_layout = "us";
follow_mouse = 1;
touchpad.natural_scroll = "no";
mouse_refocus = false;
};
}

View file

@ -0,0 +1,15 @@
{
wayland.windowManager.hyprland.settings.misc = {
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
disable_hyprland_logo = true;
disable_splash_rendering = true;
enable_swallow = true;
# TODO: use terminal/file-explorer module
swallow_regex = "foot|nemo";
focus_on_activate = true;
};
}

View file

@ -0,0 +1,30 @@
{
lib,
osConfig,
...
}: let
inherit (lib) concatMap;
inherit (osConfig.ooknet.hardware) monitors;
in {
wayland.windowManager.hyprland.settings = {
monitor =
concatMap (
m: let
resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}";
position = "${toString m.x}x${toString m.y}";
basicConfig = "${m.name},${
if m.enabled
then "${resolution},${position},1"
else "disable"
}";
in
[basicConfig]
++ (
if m.transform != 0
then ["${m.name},transform,${toString m.transform}"]
else []
)
)
monitors;
};
}

View file

@ -0,0 +1,24 @@
{
wayland.windowManager.hyprland.settings = {
windowrulev2 = [
"float,move 191 15,size 924 396,class:^(1Password)$"
"float, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
"float,move 237 175, size 1200 720,title:^(File Upload)$"
"workspace 4, title:^(Vesktop)$"
# Floating BTOP
"float,title:^(BTOP)$"
"size 85%,title:^(BTOP)$"
"pin,title:^(BTOP)$"
"center,title:^(BTOP)$"
"stayfocused,title:^(BTOP)$"
# Tearing
"immediate, title:^(TEKKEN8)$"
];
};
}