code review

This commit is contained in:
Miguel Palhas
2024-10-04 17:35:03 +01:00
parent cbf66e1699
commit 5256730fe1
14 changed files with 58 additions and 54 deletions
+41
View File
@@ -0,0 +1,41 @@
{ inputs, lib, pkgs, config, outputs, catppuccin, ... }: {
imports = [
inputs.nix-colors.homeManagerModule
inputs.nixvim.homeManagerModules.nixvim
catppuccin.homeManagerModules.catppuccin
../common/programs/default.nix
../common/programs/hyprland.nix
../common/programs/eww
../common/programs/kitty.nix
../common/features/colorscheme.nix
];
home.sessionVariables = {
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GDM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
wayland.windowManager.hyprland.settings = {
monitor = [ "eDP-1, preferred, 0x1080, 1.2, bitdepth, 8" ];
windowrulev2 = [
"float, class:thunar"
"move cursor -50% -50%, class:thunar"
"size 800 600, class:thunar"
];
};
programs.kitty.settings.font_size = 8;
programs = {
home-manager.enable = true;
git.enable = true;
fzf.enable = true;
};
home = {
username = lib.mkDefault "naps62";
stateVersion = lib.mkDefault "24.05";
};
}
+1
View File
@@ -0,0 +1 @@
{ catppuccin, ... }: { catppuccin.enable = true; }
+5
View File
@@ -0,0 +1,5 @@
{ inputs, pkgs, foundry, ... }: {
# home.packages = [ pkgs.foundry-bin pkgs.solc ];
programs = { gh.enable = true; };
}
+8
View File
@@ -0,0 +1,8 @@
{ lib, config, ... }: {
imports = [ ./basePrograms.nix ./zsh.nix ./neovim ];
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";
sessionPath = [ "$HOME/.local/bin" ];
};
}
+7
View File
@@ -0,0 +1,7 @@
{ config, pkgs, ... }: {
home.packages = [ pkgs.eww ];
xdg.configFile = {
"eww/eww.yuck".source = ./eww.yuck;
"eww/eww.scss".source = ./eww.scss;
};
}
+248
View File
@@ -0,0 +1,248 @@
//
// catppuccin-mocha
//
$rosewater: #f5e0dc;
$flamingo: #f2cdcd;
$pink: #ff3ac6;
$mauve: #cba6f7;
$red: #f38ba8;
$maroon: #eba0ac;
$peach: #f9e2af;
$yellow: #f9e2af;
$green: #a6e3a1;
$teal: #94e2d5;
$sky: #89dceb;
$sapphire: #74c7ec;
$blue: #89b4fa;
$lavender: #b4befe;
$text: #cdd6f4;
$subtext1: #bac2de;
$subtext0: #a6adc8;
$overlay2: #9399b2;
$overlay1: #7f849c;
$overlay0: #6c7086;
$surface2: #585b70;
$surface1: #45475a;
$surface0: #313244;
$base: #1e1e2e;
$mantle: #181825;
$crust: #11111b;
:not(menu):not(menuitem) {
all: unset;
font-family:
Material Design Icons,
FiraCode Nerd Font;
}
//
// color theming
//
tooltip.background,
.window,
menu,
menuitem,
.bar {
background-color: $crust;
}
.memory * {
color: $mauve;
}
.cpu * {
color: $peach;
}
.cputemp * {
color: $red;
}
.battery * {
color: $red;
}
.clock {
color: $text;
}
//
// General
//
.bar {
// min-height: 30px;
font-size: 16;
transition: all 0.1s ease-out;
border-radius: 0px 0px 10 10;
}
.bar {
opacity: 1;
}
.space {
margin: 0px 10px;
}
//
// tooltip
//
tooltip.background {
border-radius: 10px;
}
tooltip label {
}
//
// clock
//
.clock-time {
font-weight: bold;
margin-right: 5px;
}
//
// circular bars
//
.circle {
border-radius: 10px;
margin: 0 5;
}
.circle .icon {
font-size: 16px;
padding: 10px;
}
//
// sliders
//
.slider,
.slider trough highlight {
border-radius: 10px;
}
//
// network
//
.network,
.volume {
margin: 0 5px;
& button {
margin-right: 10;
}
.connected {
color: $green;
}
.disconnected {
color: $peach;
}
}
//
// brightness
//
.bright_icon {
font-size: 12;
color: #e4c9af;
}
//
// sliders
//
.slider trough highlight {
background-image: linear-gradient(
to right,
$yellow 30%,
$peach 50%,
$red 100% * 50
);
}
scale trough {
background-color: $surface1;
border-radius: 16px;
min-height: 10px;
min-width: 100px;
}
//
// systray
//
menu {
border-radius: 16px;
}
menuitem {
padding: 8px;
border-radius: 8px;
color: $text;
background-color: $surface2;
&:disabled {
color: $overlay2;
}
}
//
// workspaces
//
.w0,
.w01,
.w02,
.w03,
.w04,
.w05,
.w06,
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
border-radius: 10px;
font-size: 16px;
padding: 5px 5;
min-height: 25px;
min-width: 60px;
}
// Unoccupied
.w0 {
color: $overlay0;
}
// Occupied
.w01,
.w02,
.w03,
.w04,
.w05,
.w06 {
color: $text;
}
// Focused
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
font-size: 16px;
background-color: $sky;
color: $crust;
font-weight: bold;
}
+164
View File
@@ -0,0 +1,164 @@
;; Variables
(defpoll clock_time :interval "5s" "date +\%I:%M")
(defpoll clock_date :interval "1m" "date '+%d/%m'")
(defpoll volume_percent :interval "3s" :initial 0 "pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d'/' -f 2 | xargs | tr -d '%'")
;; (defpoll brightness_percent :interval "5s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll bwindowrulesattery :interval "15s" "./scripts/battery --bat")
(defpoll battery_status :interval "1m" "./scripts/battery --bat-st")
(defpoll memory :interval "5s" :initial 0 "scripts/memory")
(defpoll cpu :interval "5s" :initial 0 "scripts/cpu")
(defpoll cputemp :interval "5s" :initial 0 "scripts/cputemp")
(defpoll memory_used_mb :interval "2m" "scripts/mem-ad used")
(defpoll memory_total_mb :interval "2m" "scripts/mem-ad total")
(defpoll memory_free_mb :interval "2m" "scripts/mem-ad free")
(defvar bar_hover false)
(deflisten workspace "scripts/workspace")
(defvar eww "/home/naps62/.bin/eww -c $HOME/.config/eww")
(defvar exec_audio_control "hyprctl dispatch exec '[center]' pavucontrol")
(defvar exec_nmtui "hyprctl dispatch exec '[center]' 'kitty --class eww-nmtui -e nmtui'")
(defvar exec_workspace_scroll "echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace")
(defpoll network_name :interval "1m" "~/.config/eww/scripts/network name")
(defpoll network_icon :interval "1m" "~/.config/eww/scripts/network icon")
(defpoll network_class :interval "1m" "~/.config/eww/scripts/network class")
;;
;; widgets
;;
(defwidget widget_network []
(box :class "network" :space-evenly "false"
(button :class "${network_class}" :onclick exec_nmtui "${network_icon} ${network_name}")))
(defwidget widget_workspaces []
(eventbox :onscroll exec_workspace_scroll
(literal :content workspace))
)
;; (defwidget widget_battery []
;; (circular-progress :value battery
;; :class "circle battery"
;; :thickness 4
;; (button
;; :class "icon"
;; :tooltip "battery on ${battery}%"
;; "󰂁")))
(defwidget widget_cputemp []
(circular-progress :value cputemp
:class "circle cputemp"
:thickness 4
(button
:class "icon"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰔏")))
(defwidget widget_ram []
(circular-progress :value memory
:class "circle memory"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% ram"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰍛")))
(defwidget widget_cpu []
(circular-progress :value cpu
:class "circle cpu"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% CPU"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰻠")))
(defwidget widget_space []
(box :class "space"))
(defwidget widget_clock []
(box :class "clock"
(label :text clock_time :class "clock-time")
(button :class "clock-date" clock_date)))
(defwidget widget_volume []
(box :class "volume" :space-evenly "false"
(button :onclick exec_audio_control "󰕾")
(scale :class "slider"
:value volume_percent
:tooltip "${volume_percent}%"
:max 100
:min 0
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%" )))
;; (defwidget widget_bright []
;; (eventbox :onhover "${eww} update br_reveal=true" :onhoverlost "${eww} update br_reveal=false"
;; (box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
;; (label :text "" :class "bright_icon" :tooltip "brightness")
;; (revealer :transition "slideleft"
;; :reveal br_reveal
;; :duration "350ms"
;; (scale :class "slider brightness"
;; :value brightness_percent
;; :orientation "h"
;; :tooltip "${brightness_percent}%"
;; :max 100
;; :min 0
;; :onchange "brightnessctl set {}%" )))))
;;
;; bar layout
;;
(defwidget left []
(box :orientation "h"
:space-evenly false
:halign "start"
(widget_workspaces)))
(defwidget center []
(box :orientation "h"
:space-evenly false
:halign "center"
(box)))
(defwidget right []
(box :orientation "h"
:space-evenly false
:halign "end"
;; (widget_bright)
(widget_volume)
(widget_network)
(widget_space)
;; (widget_battery)
(widget_ram)
(widget_cpu)
(widget_cputemp)
(widget_space)
(systray)
(widget_space)
(widget_clock)
(widget_space)))
(defwidget bar_inner []
(box
:orientation "h"
(left)
(right)))
;;
;; main window
;;
(defwindow bar
:geometry (
geometry
:x "0%"
:y "0px"
:width "2080px"
:anchor "top center")
:windowtype "dock"
:monitor 0
:exclusive true
(bar_inner))
+118
View File
@@ -0,0 +1,118 @@
{ config, pkgs, ... }: {
home.sessionVariables = {
HYPRCURSOR_THEME = "Phinger Cursors";
HYPRCURSOR_SIZE = 32;
ELECTRON_OZONE_PLATFORM_HINT = "auto";
XCURSOR_SIZE = 32;
};
wayland.windowManager.hyprland = {
enable = true;
settings = {
decoration = {
blur = {
enabled = "yes";
size = 30;
passes = 1;
new_optimizations = "on";
};
drop_shadow = "yes";
shadow_range = 2;
shadow_render_power = 1;
};
input = {
kb_layout = "us";
kb_options = "ctrl:nocaps";
follow_mouse = 1;
repeat_delay = 150;
repeat_rate = 25;
touchpad = { natural_scroll = "yes"; };
numlock_by_default = "true";
};
cursor = { no_hardware_cursors = "yes"; };
general = {
gaps_in = 2;
gaps_out = 0;
};
animations = {
bezier = "easeOutQuad, 0.5, 1, 0.89, 1";
animation = [
"windows, 1, 4, easeOutQuad"
"windowsMove, 1, 1, easeOutQuad"
"windowsOut, 1, 4, default, popin 80%"
"border, 1, 4, default"
"borderangle, 1, 4, default"
"fade, 1, 4, default"
"workspaces, 1, 3, default"
];
};
dwindle = {
preserve_split = "yes";
no_gaps_when_only = true;
};
master = {
orientation = "center";
no_gaps_when_only = true;
};
"exec-once" = [
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"eww daemon & eww -c $HOME/.config/eww open bar"
];
"$mod" = "SUPER";
bind = [
"$mod, t, exec, kitty"
"$mod, e, exec, thunar"
"$mod, v, togglefloating"
"$mod, q, killactive"
"$mod, f, fullscreen, 0"
"$mod SHIFT, f, fullscreen, 1"
# move focus with mod + arrows
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
# Switch workspaces with mod + [0-9]
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
# Move active window to a workspace with mod + SHIFT + [0-9]
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
# Scroll through existing workspaces with mod + scroll
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
# media
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86MonBrightnessUp, exec, light -A 10"
", XF86MonBrightnessDown, exec, light -U 10"
];
};
};
}
+50
View File
@@ -0,0 +1,50 @@
{ config, pkgs, ... }: {
programs.kitty = {
enable = true;
settings = {
confirm_os_window_close = 0;
enable_audio_bell = false;
enabled_layouts = "tall, grid, fat, splits";
# font
font_family = "FiraCode Nerd Font Regular";
bold_font = "FiraCode Nerd Font Bold";
italic_font = "VictorMono Nerd Font Mono Oblique";
bold_italic_font = "VictorMono Nerd Font Mono Bold Oblique";
disable_ligatures = "cursor";
# tab-style
tab_bar_edge = "bottom";
tab_bar_style = "powerline";
tab_powerline_style = "slanted";
tab_title_template =
"{title}{' :{}'.format(num_windows) if num_windows > 1 else ''}";
# keys
kitty_mod = "alt";
};
keybindings = {
"kitty_mod+t" = "new_tab_with_cwd";
"kitty_mod+enter" = "new_window_with_cwd";
"kitty_mod+r" = "set_tab_title";
"kitty_mod+u" = "previous_tab";
"kitty_mod+i" = "next_tab";
"ctrl+shift+l" = "next_layout";
"ctrl+shift+left" = "resize_window narrower";
"ctrl+shift+right" = "resize_window right";
"ctrl+shift+0x27" = "change_font_size all +2.0";
"ctrl+shift+minus" = "change_font_size all -2.0";
"ctrl+shift+backspace" = "change_font_size all 0";
"kitty_mod+h" = "neighboring_window left";
"kitty_mod+j" = "neighboring_window down";
"kitty_mod+k" = "neighboring_window up";
"kitty_mod+l" = "neighboring_window right";
};
};
}
+5
View File
@@ -0,0 +1,5 @@
{ inputs, pkgs, ... }: {
imports = [ inputs.nvchad4nix.homeManagerModule ];
home.sessionVariables = { EDITOR = "nvim"; };
programs.nvchad = { enable = true; };
}
+59
View File
@@ -0,0 +1,59 @@
{ inputs, config, pkgs, ... }: {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
c = "cargo";
d = "docker";
dc = "docker compose";
g = "git";
n = "nvim";
vim = "nvim";
mm = "mise";
mr = "mise run";
ls = "eza";
cat = "bat";
ps = "procs";
# cd
".." = "cd ..";
"..2" = "cd ../..";
"..3" = "cd ../../..";
};
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
zplug = {
enable = true;
plugins =
[ { name = "hlissner/zsh-autopair"; } { name = "Aloxaf/fzf-tab"; } ];
};
initExtra = ''
# mise
eval "$(mise activate zsh)"
# asdf
${pkgs.asdf-vm}/share/asdf-vm/asdf.sh
'';
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.starship = {
enable = true;
settings = { add_newline = true; };
};
home.sessionPath =
[ "./.git/safe/../../node_modules/.bin" "./.git/safe/../../bin" ];
}
+20
View File
@@ -0,0 +1,20 @@
{ inputs, lib, pkgs, config, outputs, ... }: {
imports = [
inputs.nix-colors.homeManagerModule
inputs.nixvim.homeManagerModules.nixvim
../common/programs/default.nix
];
colorscheme = inputs.nix-colors.colorSchemes.catppuccin-frappe;
programs = {
home-manager.enable = true;
git.enable = true;
fzf.enable = true;
};
home = {
username = lib.mkDefault "naps62";
stateVersion = lib.mkDefault "24.05";
};
}