nxricelib

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-04-19 17:28:08 +02:00
parent 1683946235
commit bf7848df01
9 changed files with 157 additions and 111 deletions

View File

@@ -17,30 +17,22 @@
url = "github:hyprwm/hyprland-plugins"; url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland"; inputs.hyprland.follows = "hyprland";
}; };
# hyprfocus = {
# url = "github:VortexCoyote/hyprfocus";
# inputs.hyprland.follows = "hyprland";
# };
Hyprspace = { Hyprspace = {
url = "github:KZDKM/Hyprspace"; url = "github:KZDKM/Hyprspace";
inputs.hyprland.follows = "hyprland"; inputs.hyprland.follows = "hyprland";
}; };
# hycov = {
# url = "github:DreamMaoMao/hycov";
# inputs.hyprland.follows = "hyprland";
# };
}; };
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs: outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs:
# outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, hyprland, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
overlays = [ inputs.nix-rice.overlays.default ];
user = "nx2"; user = "nx2";
nvidia = rec { nvidia = rec {
@@ -74,34 +66,39 @@
}; };
secrets = import ./secrets/passwords-and-certificates.nix; secrets = import ./secrets/passwords-and-certificates.nix;
rice = { rice = rec {
transparency = "0.9"; lib = import ./nxlib/ricelib.nix { lib = nixpkgs.lib; };
transparency = 0.9;
rounding = 5;
color = rec { color = rec {
background = "000000"; # #000000 background = "#000000";
foreground = "dddddd"; # #dddddd foreground = "#dddddd";
black = "282B35"; # #282B35 black = "#282B35";
bright-black = "686A71"; # #686A71 bright-black = "#686A71";
blue = "9d00ff"; # #9d00ff blue = "#9d00ff";
bright-blue = "c76eff"; # #c76eff bright-blue = "#c76eff";
cyan = "00ddff"; # #00ddff cyan = "#00ddff";
bright-cyan = "33f9ff"; # #33f9ff bright-cyan = "#33f9ff";
green = "0048ff"; # #0048ff green = "#0048ff";
bright-green = "1166ff"; # #1166ff bright-green = "#1166ff";
magenta = "B21889"; # #B21889 magenta = "#B21889";
bright-magenta = "ff75f6"; # #ff75f6 bright-magenta = "#ff75f6";
red = "ff0044"; # #ff0044 red = "#ff0044";
bright-red = "ff4576"; # #ff4576 bright-red = "#ff4576";
white = "939599"; # #939599 white = "#939599";
bright-white = "ffffff"; # #ffffff bright-white = "#ffffff";
yellow = "ff4000"; # #ff4000 yellow = "#ff4000";
bright-yellow = "ff8454"; # #ff8454 bright-yellow = "#ff8454";
border = red; border = red;
}; };
font = { font = {
code = { code = {
name = "CascadiaCove-NF"; name = "JetBrainsMono-NF";
package = (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; }); name2 = "JetBrainsMono Nerd Font";
package = (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; });
# name = "CascadiaCove-NF";
# package = (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; });
}; };
base = { base = {
name = "Atkinson Hyperlegible"; name = "Atkinson Hyperlegible";

View File

@@ -63,17 +63,6 @@
[initial_class_active] [initial_class_active]
[workspaces_name] [workspaces_name]
10 = "ten"
4 = "four"
8 = "eight"
9 = "nine"
6 = "six"
1 = "one"
3 = "three"
2 = "two"
0 = "zero"
7 = "seven"
5 = "five"
[title_in_class] [title_in_class]
[title_in_class_active] [title_in_class_active]
@@ -87,7 +76,6 @@
[exclude] [exclude]
"(?i)fcitx" = ".*" "(?i)fcitx" = ".*"
aProgram = "^$" aProgram = "^$"
"ueberzug.*" = ""
"" = "^$" "" = "^$"
"[Ss]team" = "^(Friends List.*)?$" "[Ss]team" = "^(Friends List.*)?$"
"explorer.exe" = ".*" "explorer.exe" = ".*"
@@ -97,7 +85,7 @@
dedup = false dedup = false
dedup_inactive_fullscreen = false dedup_inactive_fullscreen = false
delim = " " delim = " "
workspace = "{id}: {clients}" workspace = "{id}:{clients}"
workspace_empty = "{id}" workspace_empty = "{id}"
client = "{icon}" client = "{icon}"
client_fullscreen = "{icon}" client_fullscreen = "{icon}"

View File

@@ -1,9 +1,9 @@
{ config, pkgs, pkgs-unstable, inputs, host, nvidia, rice, lib, ... }: { config, pkgs, pkgs-unstable, inputs, host, nvidia, rice, lib, ... }:
let let
animation-speed = "2"; animation-speed = "2";
transparency = rice.transparency; transparency = builtins.toString rice.transparency;
gap-size = 10; gap-size = 10;
rounding = 3; rounding = rice.rounding;
border-width = 3; border-width = 3;
monitors = { monitors = {
xps = { xps = {
@@ -143,8 +143,8 @@ in
gaps_in = builtins.div gap-size 2; gaps_in = builtins.div gap-size 2;
gaps_out = gap-size; gaps_out = gap-size;
border_size = border-width; border_size = border-width;
"col.active_border" = "rgba(${rice.color.red}ff) rgba(${rice.color.bright-cyan}ff) 45deg"; "col.active_border" = "rgba(${rice.lib.nohash rice.color.red}ff) rgba(${rice.lib.nohash rice.color.cyan}ff) 90deg";
"col.inactive_border" = "rgba(${rice.color.black}ff)"; "col.inactive_border" = "rgba(${rice.lib.nohash rice.color.black}ff)";
cursor_inactive_timeout = 10; cursor_inactive_timeout = 10;
@@ -159,8 +159,8 @@ in
shadow_range = "20"; shadow_range = "20";
shadow_offset = "0 0"; shadow_offset = "0 0";
shadow_render_power = "4"; shadow_render_power = "4";
"col.shadow" = "rgba(${rice.color.red}ff)"; "col.shadow" = "rgba(${rice.lib.nohash rice.color.red}ff)";
"col.shadow_inactive" = "rgba(${rice.color.black}ff)"; "col.shadow_inactive" = "rgba(${rice.lib.nohash rice.color.black}ff)";
active_opacity = "1.0"; active_opacity = "1.0";
inactive_opacity = "1.0"; inactive_opacity = "1.0";
@@ -239,7 +239,7 @@ in
windowrulev2 = [ windowrulev2 = [
"opacity ${transparency},class:^(com.chatterino.*)$" "opacity ${transparency},class:^(com.chatterino.*)$"
"opacity ${transparency},class:^(chatterino)$" "opacity ${transparency},class:^(chatterino)$"
"bordercolor rgba(${rice.color.bright-magenta}ff), pinned:1" "bordercolor rgba(${rice.lib.nohash rice.color.bright-magenta}ff), pinned:1"
]; ];
windowrule = [ windowrule = [
@@ -250,8 +250,8 @@ in
"opacity ${transparency}, neovide" "opacity ${transparency}, neovide"
"opacity ${transparency}, obsidian" "opacity ${transparency}, obsidian"
"opacity ${transparency}, zathura" "opacity ${transparency}, zathura"
"bordercolor rgba(${rice.color.foreground}ff) rgba(${rice.color.background}b2), Alacritty" "bordercolor rgba(${rice.lib.nohash rice.color.foreground}ff) rgba(${rice.lib.nohash rice.color.background}${rice.lib.float-to-drune rice.transparency}), Alacritty"
"bordercolor rgba(${rice.color.foreground}ff) rgba(${rice.color.background}b2), Kitty" "bordercolor rgba(${rice.lib.nohash rice.color.foreground}ff) rgba(${rice.lib.nohash rice.color.background}${rice.lib.float-to-drune rice.transparency}), Kitty"
"opacity ${transparency}, discord" "opacity ${transparency}, discord"
"opacity ${transparency}, vesktop" "opacity ${transparency}, vesktop"
"opacity ${transparency}, Element" "opacity ${transparency}, Element"
@@ -313,8 +313,8 @@ in
# "SUPER, F10, hyprload,update" # "SUPER, F10, hyprload,update"
"SUPER, F11, exec, waybar" "SUPER, F11, exec, waybar"
"SUPER SHIFT, F11, exec, pkill waybar " "SUPER SHIFT, F11, exec, pkill waybar "
"SUPER, F12, exec, hyprland-autoname-workspaces --migrate-config &" "SUPER, F12, exec, hyprland-autoname-workspaces"
"SUPER SHIFT, F12, exec, pkill hyprland-autoname-workspaces " "SUPER SHIFT, F12, exec, pkill -9 hyprland-autoname-workspaces "
########################################################################### ###########################################################################
## ROW 1: ## ROW 1:
@@ -778,7 +778,7 @@ in
hyprexpo { hyprexpo {
columns = 5 columns = 5
gap_size = ${builtins.toString gap-size} gap_size = ${builtins.toString gap-size}
bg_col = rgb(${rice.color.background}) bg_col = rgb(${rice.lib.nohash rice.color.background})
workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1 workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1
enable_gesture = false # laptop touchpad, 4 fingers enable_gesture = false # laptop touchpad, 4 fingers

View File

@@ -9,28 +9,31 @@ in
programs.kitty = { programs.kitty = {
enable = true; enable = true;
font = rice.font.code; font = {
name = rice.font.code.name2;
package = rice.font.code.package;
};
settings = { settings = {
background = "#${rice.color.background}"; background = rice.color.background;
foreground = "#${rice.color.foreground}"; foreground = rice.color.foreground;
cursor = "#${rice.color.foreground}"; cursor = rice.color.foreground;
color0 = "#${rice.color.black}"; color0 = rice.color.black;
color8 = "#${rice.color.bright-black}"; color8 = rice.color.bright-black;
color1 = "#${rice.color.red}"; color1 = rice.color.red;
color9 = "#${rice.color.bright-red}"; color9 = rice.color.bright-red;
color2 = "#${rice.color.green}"; color2 = rice.color.green;
color10 = "#${rice.color.bright-green}"; color10 = rice.color.bright-green;
color3 = "#${rice.color.yellow}"; color3 = rice.color.yellow;
color11 = "#${rice.color.bright-yellow}"; color11 = rice.color.bright-yellow;
color4 = "#${rice.color.blue}"; color4 = rice.color.blue;
color12 = "#${rice.color.bright-blue}"; color12 = rice.color.bright-blue;
color5 = "#${rice.color.magenta}"; color5 = rice.color.magenta;
color13 = "#${rice.color.bright-magenta}"; color13 = rice.color.bright-magenta;
color6 = "#${rice.color.cyan}"; color6 = rice.color.cyan;
color14 = "#${rice.color.bright-cyan}"; color14 = rice.color.bright-cyan;
color7 = "#${rice.color.white}"; color7 = rice.color.white;
color15 = "#${rice.color.bright-white}"; color15 = rice.color.bright-white;
background_opacity = rice.transparency; background_opacity = builtins.toString rice.transparency;
transparency = true; transparency = true;
scroll_multiplier = 9; scroll_multiplier = 9;
window_padding_width = 5; window_padding_width = 5;

View File

@@ -11,6 +11,6 @@
backgroundColor = "#${rice.color.background}"; backgroundColor = "#${rice.color.background}";
textColor = "#${rice.color.foreground}"; textColor = "#${rice.color.foreground}";
borderColor = "#${rice.color.border}"; borderColor = "#${rice.color.border}";
font = rice.font.code.name; font = rice.font.code.name2;
}; };
} }

View File

@@ -1,4 +1,4 @@
{ config, pkgs, lib, system, user, allowed, secrets, ... }: { config, pkgs, lib, user, rice, allowed, ... }:
{ {
home.packages = [ home.packages = [
@@ -78,7 +78,7 @@
]; ];
userSettings = { userSettings = {
workbench.colorTheme = "Just Black"; workbench.colorTheme = "Just Black";
editor.fontFamily = "'CaskaydiaCove Nerd Font', 'monospace', monospace"; editor.fontFamily = "'${rice.font.code.name2}', 'monospace', monospace";
emote.SSH.useLocalServer = false; emote.SSH.useLocalServer = false;
}; };
enableUpdateCheck = false; enableUpdateCheck = false;

View File

@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, rice, ... }:
let let
in in
{ {
@@ -60,6 +60,7 @@ in
bar = { bar = {
height = 20; height = 20;
layer = "top"; layer = "top";
# position = "top";
position = "bottom"; position = "bottom";
margin-top = 0; margin-top = 0;
margin-left = 0; margin-left = 0;
@@ -153,30 +154,29 @@ in
]; ];
}; };
network = { network = {
format-wifi = " {essid}"; format-wifi = " {essid}";
format-ethernet = " Wired"; format-ethernet = "󰈀 Wired";
format-disconnected = " Disconnected"; format-disconnected = "󰌙 Disconnected";
}; };
wireplumber = { wireplumber = {
format = "󰕾 {volume}%"; format = "󰕾 {volume}%";
format-muted = " Muted"; format-muted = " Muted";
}; };
}; };
}; };
style = '' style = ''
* { * {
font-family: Atkinson Hyperlegible, Caskaydia Cove NF, Noto Sans; font-family: ${rice.font.code.name2};
font-weight: bold; font-size: 1em;
font-size: 1.01em;
min-height: 0; min-height: 0;
} }
window#waybar { window#waybar {
background-color: rgba(0, 0, 0, 0.85); background-color: rgba(${rice.lib.hex-to-rgb-comma-string rice.color.background},${builtins.toString rice.transparency});
transition-duration: 0.5s; transition-duration: 0.5s;
padding: 0.1em 1em; padding: 0.1em 1em;
padding-top: 0.1em; padding-top: 0.1em;
border: 0px solid transparent; border: None;
} }
#clock, #clock,
@@ -195,40 +195,34 @@ in
#workspaces { #workspaces {
padding: 0px 3px; padding: 0px 3px;
margin-top: 0.3em; margin-top: 0.3em;
border-radius: 0.8em; border-radius: ${builtins.toString rice.rounding}px;
color: white; color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.foreground});
}
#window {
font-weight: normal;
} }
#workspaces button { #workspaces button {
color: grey; color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.bright-black});
padding: 0px 10px; padding: 0px 10px;
margin: 1px; margin: 1px;
border-radius: 0.2em; border-radius: ${builtins.toString rice.rounding}px;
border: 0px solid transparent; border: None;
}
#workspaces button.focused {
background-color: darkred;
} }
#workspaces button:hover { #workspaces button:hover {
background-color: green; color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.background});
background-color: rgba(${rice.lib.hex-to-rgb-comma-string rice.color.foreground},${builtins.toString rice.transparency});
} }
#workspaces button.active { #workspaces button.active {
color: white; color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.foreground});
background-color: rgba(${rice.lib.hex-to-rgb-comma-string rice.color.background},${builtins.toString rice.transparency});
} }
#workspaces button.urgent { #workspaces button.urgent {
background-color: darkorchid; background-color: rgba(${rice.lib.hex-to-rgb-comma-string rice.color.magenta},${builtins.toString rice.transparency});
} }
#custom-mode { #custom-mode {
color: crimson; color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red});
} }
#cpu { #cpu {

View File

@@ -12,7 +12,7 @@
font-family: ${rice.font.code.name}, monospace; font-family: ${rice.font.code.name}, monospace;
font-size: 12pt; font-size: 12pt;
color: ${rice.color.foreground}; color: ${rice.color.foreground};
background-color: rgba(0, 0, 0, ${rice.transparency}); background-color: rgba(0, 0, 0, ${builtins.toString rice.transparency});
} }
button { button {

64
nxlib/ricelib.nix Normal file
View File

@@ -0,0 +1,64 @@
{ lib, ... }:
rec
{
nohash = s: builtins.substring 1 7 s;
slice-hex = hex: { r = builtins.substring 0 2 hex; g = builtins.substring 2 2 hex; b = builtins.substring 4 5 hex; };
# https://github.com/bertof/nix-rice
rune-to-num = c:
let
k = lib.strings.toUpper c;
dict = {
"0" = 0;
"1" = 1;
"2" = 2;
"3" = 3;
"4" = 4;
"5" = 5;
"6" = 6;
"7" = 7;
"8" = 8;
"9" = 9;
"A" = 10;
"B" = 11;
"C" = 12;
"D" = 13;
"E" = 14;
"F" = 15;
};
in
assert(builtins.hasAttr k dict);
builtins.getAttr k dict;
drune-to-255 = hex: (rune-to-num (builtins.substring 0 1 hex)) * 15 + (rune-to-num (builtins.substring 1 2 hex));
hex-to-rgb-comma-string = hex: let color = (slice-hex (nohash hex)); in "${builtins.toString (drune-to-255 color.r)},${builtins.toString (drune-to-255 color.g)},${builtins.toString (drune-to-255 color.b)}";
num-to-rune = n:
let
ns = builtins.toString n;
dict = {
"0" = "0";
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = "5";
"6" = "6";
"7" = "7";
"8" = "8";
"9" = "9";
"10" = "A";
"11" = "B";
"12" = "C";
"13" = "D";
"14" = "E";
"15" = "F";
};
in
assert(builtins.hasAttr ns dict);
builtins.getAttr ns dict;
float-to-drune = f: "${num-to-rune (builtins.floor((255*f) / 16))}${num-to-rune (builtins.floor(255*f) - (builtins.floor((255 * f) / 16) * 16))}";
}