diff --git a/CHANGELOG.md b/CHANGELOG.md index a686d54..269eda2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,497 @@ --- -# 🚀 **Current Release - ZaneyOS v2.5.4** +# 🚀 **Current Release - ZaneyOS v2.6.1** + +- Removed `discord` and `discord-canary` + - They use an outdated `electron` + - That build uses and `openssl v1.1.1w` + - That ius OEL and marked insecure in NIXOS + - Users can use an alternativve client until discord is updated +- Disabled `zen browser` in `zaneyos/modules/home/default.nix` + - Needs to be migrated to being enabled via host variable +- Changed from `zen` to `latest` kernel + - Linux kernel v7.0 is much better than 6.19_zen +- Disabled `vfr = true;` in hyprland config + - It's not supportorted after `v54.3` + - Disabling now to avoid error on next update +- Added `awww` as flake input for installs < 25.11 +- Fixed eval warnings: + - `gtk.gtk4.theme` set to `null` + - `git.signing.format` set to `null` +- `nixvim` lualine theme set to `auto` +- Changed to NixOS unstable branch +- Ported `DropTerminal` from `KoolDots` to ZaneyOS + - Replaces pyprland and some python dependencies +- Hyprland updated to v0.54 + - Added support for scrolling and monocle layouts + - Fixed hyprland float-all bindings + - Updated Window Rules for new Hyprland format +- Disabled steam by default +- Removed `adb.enable` no longer supported and not needed for ZaneyOS +- Changed `nixfmt-rfc-style` package for updated `nitfmt` + - `nixfmt-rfc-style` no longer supported +- Fixed other evaluation warnings with `Xorg` package changes + +# 🚀 **Current Release - ZaneyOS v2.6.0** + +#### 📅 **Updated: April 3rd, 2026** + +- Swapped `awww` for `swww` + - `swww` is no longer maintained + - removed `--format xrgb` flag also no needed + +#### 📅 **Updated: February 19th, 2026** + +- Fixed `zcli` GPU detection for newer AMD GPUs + - Fixed the fix to properly detect VMs +- `nixvim.nix` changes + - Disabled Zig language server + - Disabled marksman language server + - Caused dotnet lib to be compiled (takes hours) + +#### 📅 **Updated: February 16th, 2026** + +- Removed `hyprpanel` + - No longer maintained + - Vendor created `wayle` to replace it + - Replaced in ZaneyOS with 'noctalia-shell' + +- `webkitgtk` being built from source + - Removed audacity is called `wxwidgets` + - Created overlay for `tumbler` to disable `libepub` + - These caused the build from source issue + - Building `webkitgtk` takes hours every rebuild/update + +#### 📅 **Updated: January 31st, 2026** + +- Changed default login manager to `TUI` + - Issues recently (again) with SDDM and some GPUs + - Often related to SDDM wayland support option + - Some GPUs need it enabled, others disabled + +#### 📅 **Updated: January 28th, 2026** + +- Disabled gnome in stylix. Caused install failure + +#### 📅 **Updated: January 26th, 2026** + +- `noctalia-shell` regression: + - Removed `noctalia-shell` systemd service + - Caused old version of `noctalia-shell` + - Adjusted `noctalia-shell` bindings to match change +- Default applications now settable + - Globally for all hosts + - `zaneyos/modules/home/xdg.nix` + - Per host + - `zaneyos/hosts/HOSTNAME/variables.nix` + - Host settings override `xdg.nix` settings + +#### 📅 **Updated: January 23rd, 2026** + +- Added additional fonts +- Fixed issue with Hypridle and Home Manager + - Added `systemdTarget = "hyprland-session.target";` + - Thank you `Yang Kexuan` for the fix + - Reference issue: [5899](https://github.com/nix-community/home-manager/issues/5899) + +#### 📅 **Updated: January 5th, 2026** + +- Removed extra newline in `exec-once.nix` +- Fixed typo in `noctalia.nix` +- Added docs reference per systemd spec +- Improved code overall + - Thanks `lichen.gel.calm` for finding these issues +- Disabled `noctalia-shell` systemd service + - Caused older revision of `noctalia-shell` to load + - Now started from hyprland + +#### 📅 **Updated: December 29th, 2025** + +- Removed extra `noctalia-shell` startup +- Added initial support for AMD, NVIDIA Hybrid laptops +- Keypress to recover from DPMS now enabled by default + +#### 📅 **Updated: December 21st, 2025** + +- Added user systemd service for `noctalia-shell` +- Updated Hyprland bindings to accomodate change +- Updated `nixvim` + +## `nixvim` Features Migrated from Bugsvim + +#### Custom Diagnostic Icons + + ```lua + Error = " " + Warn = " " + Hint = "" + Info = "" + ``` + - Custom unicode symbols for each diagnostic severity level + - Integrated into vim.diagnostic.config() for gutter display + +#### Diagnostic Display Options + + - **Sign Column**: Shows diagnostic icons in the gutter with custom text and highlight groups + - **Virtual Text**: Inline diagnostics with custom prefix (`●`) and 2-space spacing + - **Virtual Lines**: Enhanced visibility for error context without cluttering + - **Underline**: Visual underline for error locations + - **Floating Window**: Hover diagnostics with rounded borders and source attribution + - **Severity Sorting**: Errors prioritized over warnings + +### 2. Text Yank Highlighting + + **Migration**: Highlight yanked text for 200ms (IncSearch highlight group) + - Autocmd-based implementation in extraConfigLua + - Uses vim.hl.on_yank for smooth visual feedback + +### 3. LSP Attachment Keybindings + + **Enhanced LSP Integration** with on-attach callbacks: + ``` + K - Hover documentation + gd - Goto definition + gD - Goto declaration + gi - Goto implementation + gr - References + rn - Rename symbol + ca - Code action + ``` + - Buffer-local scope prevents global pollution + - Guard against multiple registrations with flag check + +### 4. Startup Dashboard + + **Migration**: alpha-nvim with custom banner generation + +#### Dynamic Header Generation + + - Primary: `toilet -f ansi-shadow NIXOS` + - Secondary: `figlet -f "ANSI Shadow" NIXOS` + - Tertiary: `figlet NIXOS` + - Fallback: ASCII art banner (9 lines) + +#### Dashboard Buttons + + | Shortcut | Action | Command | + |----------|--------|---------| + | `f` | Find file | Telescope find_files | + | `r` | Recent files | Telescope oldfiles | + | `g` | Live grep | Telescope live_grep | + | `n` | New file | :enew | + | `e` | File browser | Neotree toggle | + | `q` | Quit | :qa | + +#### Footer + + Dynamic version display: `NixVim • Neovim X.Y.Z` + +### 5. Theme Integration + + **Migration**: Tokyo Night colorscheme with Stylix integration + - Tokyo Night colors for status line (lualine) + - Notify background color tied to Stylix palette: `#${config.lib.stylix.colors.base01}` + - Consistent color management across UI components + +## Comprehensive Feature Set + +### UI/Visuals Migrated + + - Lualine status line (Tokyo Night theme) + - Bufferline for buffer management + - Indent-blankline for visual indentation + - Colorizer for inline color display + - Illuminate for reference highlighting + - Which-key for keybinding discovery (Helix preset) + +### Core Editing + + - Treesitter for syntax highlighting + - Neo-tree file browser + - Telescope fuzzy finder with media_files extension + - Project.nvim for project management + - Hop/Leap motion plugins + - vim-surround for text manipulation + - Comment.nvim for toggle comments + +### Advanced Features + + - snacks.nvim ecosystem (terminal, scratch buffers, zen mode, git integration, notifier) + - Noice for enhanced UI/messages + - Notify for notifications + - todo-comments for task navigation + - nvim-autopairs with Treesitter support + +### Language Support + + **LSP Servers**: nil_ls, lua_ls, pyright, ts_ls, html, cssls, clangd, zls, marksman, hyprls, tailwindcss, bashls + + **Formatters**: + - Nix: alejandra + - Lua: stylua + - JavaScript/TypeScript: prettierd + - Shell: shfmt + + **Completion**: blink-cmp with luasnip snippets + +### Development Tools + + - Git integration: gitsigns + diffview + - Markdown preview + - Trouble diagnostics panel + - Terminal: toggleterm with float direction + +## Implementation Details + +### Module Structure + + - **File**: `modules/home/editors/nixvim.nix` (743 lines) + - **Framework**: Nixvim home-manager module + - **Theme**: Tokyo Night (primary), Catppuccin (fallback) + - **Runtime Tools**: 23+ packages (bat, chafa, fd, figlet, lazygit, prettierd, ripgrep, etc.) + +## Keybinding Highlights + + ``` + jk - Exit insert mode + ff - Find files + fm - Find media files + lg - Live grep + fe - File explorer toggle + t - Toggle terminal + . - Toggle comment (line/visual) + z - Zen mode + Z - Zoom + gg - Lazygit + - Terminal (via snacks) + ]t / [t - Next/prev TODO comment + n - Notification history + ``` + +#### 📅 **Updated: December 21st, 2025** + +- Added user systemd service for `noctalia-shell` +- Updated Hyprland bindings to accomodate change +- Updated `nixvim` + +## `nixvim` Features Migrated from Bugsvim + +#### Custom Diagnostic Icons + + ```lua + Error = " " + Warn = " " + Hint = "" + Info = "" + ``` + - Custom unicode symbols for each diagnostic severity level + - Integrated into vim.diagnostic.config() for gutter display + +#### Diagnostic Display Options + + - **Sign Column**: Shows diagnostic icons in the gutter with custom text and highlight groups + - **Virtual Text**: Inline diagnostics with custom prefix (`●`) and 2-space spacing + - **Virtual Lines**: Enhanced visibility for error context without cluttering + - **Underline**: Visual underline for error locations + - **Floating Window**: Hover diagnostics with rounded borders and source attribution + - **Severity Sorting**: Errors prioritized over warnings + +### 2. Text Yank Highlighting + + **Migration**: Highlight yanked text for 200ms (IncSearch highlight group) + - Autocmd-based implementation in extraConfigLua + - Uses vim.hl.on_yank for smooth visual feedback + +### 3. LSP Attachment Keybindings + + **Enhanced LSP Integration** with on-attach callbacks: + ``` + K - Hover documentation + gd - Goto definition + gD - Goto declaration + gi - Goto implementation + gr - References + rn - Rename symbol + ca - Code action + ``` + - Buffer-local scope prevents global pollution + - Guard against multiple registrations with flag check + +### 4. Startup Dashboard + + **Migration**: alpha-nvim with custom banner generation + +#### Dynamic Header Generation + + - Primary: `toilet -f ansi-shadow NIXOS` + - Secondary: `figlet -f "ANSI Shadow" NIXOS` + - Tertiary: `figlet NIXOS` + - Fallback: ASCII art banner (9 lines) + +#### Dashboard Buttons + + | Shortcut | Action | Command | + |----------|--------|---------| + | `f` | Find file | Telescope find_files | + | `r` | Recent files | Telescope oldfiles | + | `g` | Live grep | Telescope live_grep | + | `n` | New file | :enew | + | `e` | File browser | Neotree toggle | + | `q` | Quit | :qa | + +#### Footer + + Dynamic version display: `NixVim • Neovim X.Y.Z` + +### 5. Theme Integration + + **Migration**: Tokyo Night colorscheme with Stylix integration + - Tokyo Night colors for status line (lualine) + - Notify background color tied to Stylix palette: `#${config.lib.stylix.colors.base01}` + - Consistent color management across UI components + +## Comprehensive Feature Set + +### UI/Visuals Migrated + + - Lualine status line (Tokyo Night theme) + - Bufferline for buffer management + - Indent-blankline for visual indentation + - Colorizer for inline color display + - Illuminate for reference highlighting + - Which-key for keybinding discovery (Helix preset) + +### Core Editing + + - Treesitter for syntax highlighting + - Neo-tree file browser + - Telescope fuzzy finder with media_files extension + - Project.nvim for project management + - Hop/Leap motion plugins + - vim-surround for text manipulation + - Comment.nvim for toggle comments + +### Advanced Features + + - snacks.nvim ecosystem (terminal, scratch buffers, zen mode, git integration, notifier) + - Noice for enhanced UI/messages + - Notify for notifications + - todo-comments for task navigation + - nvim-autopairs with Treesitter support + +### Language Support + + **LSP Servers**: nil_ls, lua_ls, pyright, ts_ls, html, cssls, clangd, zls, marksman, hyprls, tailwindcss, bashls + + **Formatters**: + - Nix: alejandra + - Lua: stylua + - JavaScript/TypeScript: prettierd + - Shell: shfmt + + **Completion**: blink-cmp with luasnip snippets + +### Development Tools + + - Git integration: gitsigns + diffview + - Markdown preview + - Trouble diagnostics panel + - Terminal: toggleterm with float direction + +## Implementation Details + +### Module Structure + + - **File**: `modules/home/editors/nixvim.nix` (743 lines) + - **Framework**: Nixvim home-manager module + - **Theme**: Tokyo Night (primary), Catppuccin (fallback) + - **Runtime Tools**: 23+ packages (bat, chafa, fd, figlet, lazygit, prettierd, ripgrep, etc.) + +## Keybinding Highlights + + ``` + jk - Exit insert mode + ff - Find files + fm - Find media files + lg - Live grep + fe - File explorer toggle + t - Toggle terminal + . - Toggle comment (line/visual) + z - Zen mode + Z - Zoom + gg - Lazygit + - Terminal (via snacks) + ]t / [t - Next/prev TODO comment + n - Notification history + ``` + +#### 📅 **Updated: December 21st, 2025** + +- Updated: + - `nixvim.nix` now uses `blink-cmp` for completion/suggestions + - This replaces `nvim-cmp` + - `blink-cmp` is better, integrated in nixvim + - Removed LUA code related to `nvim-cmp` + +- Fixed: + - Output of `zcli list-gens` corrected + - Thanks `@codingismy11to71` + +#### 📅 **Updated: December 14th, 2025** + +- Fixed: +- hyprlock background image +- `--diff-always` to `nh` rebuilds +- Removed extra `Ghz` in `fastfetch` output +- Fixed hard coded directory for cheatsheets path +- Removed hard coded title +- Focus follows mouse + - Consistent with hyprland +- Turned off resize overlay +- Added curosr wrap shader + - Thanks to Steven Scott for the fixes + +#### 📅 **Updated: December 12th, 2025** + +- Fixed: + - `Weather.py` script + - Start menu in waybars +- Ported from ddubsos: + - `kitty-bg` and `ghostty-bg` + - Adds random backgrounds to terminals + - Custom Quickshell logout menu + - Custom startmenu + - Custom logout menu + - Quickshell wallpaper apps + - One for images, one for video wallpapers + - `ly` login manager + - `nwg-dock-hyprland.nix` + - `SUPERCTRL+D` to toggle +- Added: + - More wallpapers + - Video wallpapers + +#### 📅 **Updated: December 9th, 2025** + +- Notifcation history binding had wrong keyword + - Thanks to Kexuan Yang for fixing it + +#### 📅 **Updated: December 7th, 2025** + +- Added `alejandra` formatter to `flake.nix` + - ran `nix fmt ./` and updated all files to current format spec +- Added `alejandra` as default formatter in `nixvim.nix` +- Hybrid GPU detection fails in `install-zaneyos.sh` + - Should be `nvidia-laptop` not `hybrid` + - Thanks to sasek @sasek333 for spotting this + +#### 📅 **Updated: December 6th, 2025** + +- Changed: + - Quickshell now comes fromm NixPkgs. + - No more compiling on rebuilds + - Remove Flake input and input in `quickshell.nix` #### 📅 **Updated: December 3rd, 2025** diff --git a/FAQ.es.md b/FAQ.es.md index 3e10776..5a08953 100644 --- a/FAQ.es.md +++ b/FAQ.es.md @@ -1,8 +1,8 @@ [English](FAQ.md) | [Español](FAQ.es.md) -# 💬 Preguntas frecuentes de ZaneyOS para v2.5.3 +# 💬 Preguntas frecuentes de ZaneyOS -- **Fecha:** 3 de deciembre de 2025 +- **Fecha:** 14 de deciembre de 2025 **⌨ ¿Dónde puedo ver los atajos de teclado de Hyprland?** @@ -139,6 +139,32 @@ zcli doom status # Verifica estado de instalación +
+**¿Cómo configuro aplicaciones predeterminadas (PDF, navegador) por host?** + +- Edita `~/zaneyos/hosts//variables.nix` y descomenta `mimeDefaultApps`. +- Home Manager usará esto vía `modules/home/xdg.nix` para escribir tu `~/.config/mimeapps.list`. +- Usa IDs `.desktop` reales de `/usr/share/applications` o `~/.local/share/applications`. + +```nix +# hosts//variables.nix +# Aplicaciones predeterminadas a nivel de host (consumidas por xdg.mimeApps) +# mimeDefaultApps = { +# # PDFs +# "application/pdf" = ["okular.desktop"]; +# "application/x-pdf" = ["okular.desktop"]; +# # Navegador web +# "x-scheme-handler/http" = ["google-chrome.desktop"]; # o brave-browser.desktop, firefox.desktop +# "x-scheme-handler/https" = ["google-chrome.desktop"]; +# "text/html" = ["google-chrome.desktop"]; +# # Archivos +# "inode/directory" = ["thunar.desktop"]; # gestor de archivos +# "text/plain" = ["nvim.desktop"]; # o code.desktop +# }; +``` + +
+ ## Atajos Principales de Hyprland A continuación se muestran los atajos de teclado para Hyprland, formateados para @@ -387,9 +413,9 @@ Edita la línea `extraMonitorSettings`. **Ejemplos:** - Monitor Único: `extraMonitorSettings = "monitor=eDP-1,1920x1080@60,auto,1";` - Monitores Múltiples: `extraMonitorSettings = " - monitor=eDP-1,1920x1080@60,auto,auto - monitor=HDMI-A-1,2560x1440@75,auto,auto - ";` + monitor=eDP-1,1920x1080@60,auto,auto + monitor=HDMI-A-1,2560x1440@75,auto,auto + ";` - Para configuraciones multi-monitor más complejas, puedes usar la aplicación GUI, `nwg-displays` Esta mostrará tus monitores conectados actualmente @@ -799,7 +825,7 @@ stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; ** ¿Cómo puedo establecer un temporizador para cambiar el wallpaper automáticamente? ** 1. Edita el archivo `~/zaneyos/modules/home/hyprland/config.nix` file. -2. Comenta la línea `sleep 1.5 && swww img ...` +2. Comenta la línea `sleep 1.5 && awww img ...` 3. Agrega nueva línea después de eso con `sleep 1 && wallsetter` ```json @@ -807,13 +833,13 @@ settings = { exec-once = [ "dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "killall -q swww;sleep .5 && swww init" + "killall -q awww;sleep .5 && awww init" "killall -q waybar;sleep .5 && waybar" "killall -q swaync;sleep .5 && swaync" "nm-applet --indicator" "lxqt-policykit-agent" "pypr &" - #"sleep 1.5 && swww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" + #"sleep 1.5 && awww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" "sleep 1 && wallsetter" ]; ``` diff --git a/FAQ.md b/FAQ.md index 398cca1..32c6708 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,8 +1,8 @@ [English](FAQ.md) | [Español](FAQ.es.md) -# 💬 ZaneyOS FAQ for v2.5.3 +# 💬 ZaneyOS FAQ -- **Date:** 3-Decemnber-2025 +- **Date:** 14-Decemnber-2025 **⌨ Where can I see the Hyprland keybindings?** @@ -228,6 +228,32 @@ Below are the keybindings for Hyprland, formatted for easy reference.
+
+**How do I set default apps (PDF, browser) per host?** + +- Edit `~/zaneyos/hosts//variables.nix` and uncomment `mimeDefaultApps`. +- Home Manager will consume these via `modules/home/xdg.nix` to write your `~/.config/mimeapps.list`. +- Use real `.desktop` IDs from `/usr/share/applications` or `~/.local/share/applications`. + +```nix +# hosts//variables.nix +# Host-level default applications (picked up by Home Manager xdg.mimeApps) +# mimeDefaultApps = { +# # PDFs +# "application/pdf" = ["okular.desktop"]; +# "application/x-pdf" = ["okular.desktop"]; +# # Web browser +# "x-scheme-handler/http" = ["google-chrome.desktop"]; # or brave-browser.desktop, firefox.desktop +# "x-scheme-handler/https" = ["google-chrome.desktop"]; +# "text/html" = ["google-chrome.desktop"]; +# # Files +# "inode/directory" = ["thunar.desktop"]; # file manager +# "text/plain" = ["nvim.desktop"]; # or code.desktop +# }; +``` + +
+
**How to I add flatpaks? ?** @@ -375,9 +401,9 @@ Edit the `extraMonitorSettings` line. **Examples:** - Single Monitor: `extraMonitorSettings = "monitor=eDP-1,1920x1080@60,auto,1";` - Multiple Monitors: `extraMonitorSettings = " - monitor=eDP-1,1920x1080@60,auto,auto - monitor=HDMI-A-1,2560x1440@75,auto,auto - ";` + monitor=eDP-1,1920x1080@60,auto,auto + monitor=HDMI-A-1,2560x1440@75,auto,auto + ";` - For more complex, multi-monitor configurations, you may wish to use the GUI application, `nwg-displays` This will show your currently connected monitors @@ -785,7 +811,7 @@ stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; ** How can I set a timer to change the wallpaper automatically? ** 1. Edit the `~/zaneyos/modules/home/hyprland/config.nix` file. -2. Comment out the line `sleep 1.5 && swww img ...` +2. Comment out the line `sleep 1.5 && awww img ...` 3. Add new line after that with `sleep 1 && wallsetter` ```json @@ -793,13 +819,13 @@ settings = { exec-once = [ "dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "killall -q swww;sleep .5 && swww init" + "killall -q awww;sleep .5 && awww init" "killall -q waybar;sleep .5 && waybar" "killall -q swaync;sleep .5 && swaync" "nm-applet --indicator" "lxqt-policykit-agent" "pypr &" - #"sleep 1.5 && swww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" + #"sleep 1.5 && awww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" "sleep 1 && wallsetter" ]; ``` @@ -1570,9 +1596,9 @@ Edit the `extraMonitorSettings` line. **Examples:** - Single Monitor: `extraMonitorSettings = "monitor=eDP-1,1920x1080@60,auto,1";` - Multiple Monitors: `extraMonitorSettings = " - monitor=eDP-1,1920x1080@60,auto,auto - monitor=HDMI-A-1,2560x1440@75,auto,auto - ";` + monitor=eDP-1,1920x1080@60,auto,auto + monitor=HDMI-A-1,2560x1440@75,auto,auto + ";` - For more complex, multi-monitor configurations, you may wish to use the GUI application, `nwg-displays` This will show your currently connected monitors @@ -1976,7 +2002,7 @@ stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; ** How can I set a timer to change the wallpaper automatically? ** 1. Edit the `~/zaneyos/modules/home/hyprland/config.nix` file. -2. Comment out the line `sleep 1.5 && swww img ...` +2. Comment out the line `sleep 1.5 && awww img ...` 3. Add new line after that with `sleep 1 && wallsetter` ```json @@ -1984,13 +2010,13 @@ settings = { exec-once = [ "dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "killall -q swww;sleep .5 && swww init" + "killall -q awww;sleep .5 && awww init" "killall -q waybar;sleep .5 && waybar" "killall -q swaync;sleep .5 && swaync" "nm-applet --indicator" "lxqt-policykit-agent" "pypr &" - #"sleep 1.5 && swww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" + #"sleep 1.5 && awww img /home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg" "sleep 1 && wallsetter" ]; ``` diff --git a/README.es.md b/README.es.md index b2fa0c9..1e83376 100644 --- a/README.es.md +++ b/README.es.md @@ -4,7 +4,7 @@ ## ZaneyOS 🟰 Mejores Configs ❄️ NixOS -** Actualizado: 3 de junio de 2025 +\*\* Actualizado: 16 de enero de 2026 ZaneyOS es una forma sencilla de reproducir mi configuración en cualquier sistema NixOS. Incluye el fondo de pantalla, scripts, aplicaciones, archivos de configuración y más. @@ -47,13 +47,6 @@ Incluye el fondo de pantalla, scripts, aplicaciones, archivos de configuración - Guía para Principiantes de Nix: [English](cheatsheets/nix-beginner-guide.md) | [Español](cheatsheets/nix-beginner-guide.es.md) - Guía de Personalización de Hyprland: [English](cheatsheets/hyprland-customization-guide.md) | [Español](cheatsheets/hyprland-customization-guide.es.md) -### Ten en cuenta: - -> **Este proyecto tiene un [Wiki](https://zaney.org/wiki/zaneyos-2.3/). ¡Aprende a usar ZaneyOS aquí!** -> **ddubs ha puesto mucho esfuerzo en el -> [FAQ](https://zaney.org/wiki/zaneyos-2.3/faq), así que debería ser preciso. -> Sin embargo, si notas que algo está mal, crea un issue o contáctanos en Discord.** - #### 🍖 Requisitos - Debes estar ejecutando NixOS, versión 23.11+. @@ -89,13 +82,6 @@ Incluye el fondo de pantalla, scripts, aplicaciones, archivos de configuración - Muchas personas pacientes y con ganas de ayudar te apoyan usando ZaneyOS. - No dudes en pasar por el Discord para pedir ayuda. -
- -Hazte un favor y -[lee el wiki](https://zaney.org/wiki/zaneyos-2.3/). - -
- #### 📦 ¿Cómo instalo paquetes? - Puedes buscar en [Nix Packages](https://search.nixos.org/packages?) y @@ -109,9 +95,7 @@ Hazte un favor y - Siéntete libre de abrir un issue en el repo. Por favor etiqueta las solicitudes de funcionalidades comenzando el título con [feature request], ¡gracias! -- Contáctanos también en [Discord](https://discord.gg/2cRdBs8) para una respuesta potencialmente más rápida. - -- No olvides revisar el [FAQ](https://zaney.org/wiki/zaneyos-2.3/faq) +- Contáctanos también en [Discord](https://discord.gg/XhZmNTnhtp) para una respuesta potencialmente más rápida. # Atajos de Hyprland @@ -180,7 +164,7 @@ A continuación los atajos de Hyprland, en formato de referencia rápida. La col ## 🎨 Atajos de Noctalia Shell -*Disponibles cuando `barChoice = "noctalia"` en `variables.nix`* +_Disponibles cuando `barChoice = "noctalia"` en `variables.nix`_ - `$modifier + D` → Alternar iniciador - `$modifier + Shift + Return` → Alternar iniciador @@ -196,7 +180,7 @@ A continuación los atajos de Hyprland, en formato de referencia rápida. La col ### Iniciador Rofi (Modo Waybar) -*Disponible cuando `barChoice = "waybar"` en `variables.nix`* +_Disponible cuando `barChoice = "waybar"` en `variables.nix`_ - `$modifier + D` → Lanzar Rofi - `$modifier + Shift + Return` → Lanzar Rofi @@ -240,7 +224,7 @@ Luego: ![Comando del script de instalación de ZaneyOS](img/install-script.jpg) ``` -sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/stable-2.4/install-zaneyos.sh) +sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/main/install-zaneyos.sh) ``` #### El proceso de instalación se verá así: @@ -271,7 +255,7 @@ nix-shell -p git vim 2. Clona este repo y entra: ``` -cd && git clone https://gitlab.com/zaney/zaneyos.git -b stable-2.4 --depth=1 ~/zaneyos +cd && git clone https://gitlab.com/zaney/zaneyos.git -b main --depth=1 ~/zaneyos cd zaneyos También puedes ejecutar el script `install.sh` si quieres. @@ -299,7 +283,7 @@ nixos-generate-config --show-hardware-config > hosts//hardware. 7. Ejecuta esto para habilitar flakes e instalar, reemplazando hostname por el perfil (p. ej. `intel`, `nvidia`, `nvidia-laptop`, `amd-hybrid` o `vm`): ``` -NIX_CONFIG="experimental-features = nix-command flakes" +NIX_CONFIG="experimental-features = nix-command flakes" sudo nixos-rebuild switch --flake .#profile ``` @@ -307,66 +291,13 @@ Ahora, cuando quieras reconstruir, tienes el alias `fr` que reconstruye el flake
-## Actualizar de ZaneyOS 2.3 a 2.4 - -> **🚀 IMPORTANTE:** Si ya tienes ZaneyOS 2.3, usa el sistema de actualización automatizado en lugar de reinstalar. - -### ✅ Proceso de actualización automatizado: - -ZaneyOS incluye un sistema de actualización completo que migra tu configuración de forma segura: - -```bash -cd ~/zaneyos -./upgrade-2.3-to-2.4.sh -``` - -### 🔍 ¿Qué hace el sistema de actualización? - -1. **Análisis previo**: Escaneo integral de tus personalizaciones -2. **Respaldo completo**: Copia total de tu configuración actual -3. **Migración automática**: Conserva todos tus ajustes y personalizaciones -4. **Actualización segura**: Usa la opción `boot` para evitar conflictos del gestor de acceso -5. **Reversión fácil**: Un solo comando si algo sale mal - -### 📋 ¿Qué se migra automáticamente? - -- ✅ Todas las configuraciones y variables de hosts -- ✅ Configuraciones de hardware -- ✅ Paquetes personalizados (globales y por host) -- ✅ Temas, fondos y ajustes de monitores -- ✅ Configuración de Git y preferencias personales -- ✅ Preferencias de terminal con habilitación automática - -### ⚠️ Qué requiere atención manual - -- Entradas personalizadas en flake.nix -- Archivos de configuración personal del shell (zshrc-personal.nix, etc.) -- Modificaciones de módulos personalizados - -### 📚 Documentación completa - -Para instrucciones detalladas, solución de problemas y seguridad: - -- **Lee**: `UPGRADE-2.3-to-2.4.md` en tu directorio zaneyos -- **Informe de análisis**: Guardado automáticamente como `~/zaneyos-upgrade-analysis-TIMESTAMP.txt` - -### 🔄 Reversión sencilla - -Si algo falla, vuelve a 2.3 fácilmente: - -```bash -cd ~/zaneyos -./upgrade-2.3-to-2.4.sh --revert -``` - ---- - ### Reconocimientos especiales: Gracias por toda su ayuda +- KoolDots https://github.com/LinuxBeginnings - Jakookit https://github.com/jakookit -- Justaguylinux https://github.com/drewgrif +- Justaguylinux https://codeberg.org/Justaguylinux - Jerry Starke https://github.com/JerrySM64 ## ¡Disfruta! diff --git a/README.md b/README.md index 369fece..375ced2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## ZaneyOS 🟰 Best ❄️ NixOS Configs -\*\* Updated: November 28th,2025 +\*\* Updated: January 16th, 2026 ZaneyOS is a simple way of reproducing my configuration on any NixOS system. This includes the wallpaper, scripts, applications, config files, and more. @@ -55,14 +55,6 @@ This includes the wallpaper, scripts, applications, config files, and more. [English](cheatsheets/hyprland-customization-guide.md) | [Español](cheatsheets/hyprland-customization-guide.es.md) -### Please note: - -> **This project has a [Wiki](https://zaney.org/wiki/zaneyos-2.3/). Find out how -> to use ZaneyOS here!** **ddubs has put a lot of effort into the -> [FAQ](https://zaney.org/wiki/zaneyos-2.3/faq) so it should be accurate. -> However, please if you notice that something is wrong with it create an issue -> or reach out to us on Discord.** - #### 🍖 Requirements - You must be running on NixOS, version 24.05+. @@ -84,7 +76,7 @@ This includes the wallpaper, scripts, applications, config files, and more. #### 🏇 Optimized Workflow & Simple Yet Elegant Neovim - Using Hyprland for increased elegance, functionality, and efficiency. -- No massive NeoVIM project here. This is my simple, easy to understand, yet +- No massive NeoVIM project here, using `nixvim` for an incredible NeoVIM setup. With language support already added in. #### 🖥️ Multi Host & User Configuration @@ -102,13 +94,6 @@ This includes the wallpaper, scripts, applications, config files, and more. running ZaneyOS. - Feel free to reach out on the Discord for any help with anything. -
- -Please do yourself a favor and -[read the wiki](https://zaney.org/wiki/zaneyos-2.3/). - -
- #### 📦 How To Install Packages? - You can search the [Nix Packages](https://search.nixos.org/packages?) & @@ -123,11 +108,9 @@ Please do yourself a favor and - Please feel free to raise an issue on the repo, please label a feature request with the title beginning with [feature request], thank you! -- Contact us on [Discord](https://discord.gg/2cRdBs8) as well, for a potentially +- Contact us on [Discord](https://discord.gg/XhZmNTnhtp) as well, for a potentially faster response. -- Don't forget to checkout the [FAQ](https://zaney.org/wiki/zaneyos-2.3/faq) - # Hyprland Keybindings Below are the keybindings for Hyprland, formatted for easy reference. The right @@ -262,7 +245,7 @@ Then: ![ZaneyOS Install Script Command](img/install-script.jpg) ``` -sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/stable-2.4/install-zaneyos.sh) +sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/main/install-zaneyos.sh) ``` #### The install process will look something like this: @@ -293,7 +276,7 @@ nix-shell -p git vim 2. Clone this repo & enter it: ``` -cd && git clone https://gitlab.com/zaney/zaneyos.git -b stable-2.4 --depth=1 ~/zaneyos +cd && git clone https://gitlab.com/zaney/zaneyos.git -b main --depth=1 ~/zaneyos cd zaneyos You can still run the `install.sh` script if you want to. @@ -308,93 +291,33 @@ cp -r hosts/default hosts/ git add . ``` -4. Edit `hosts//variables.nix`. +4. Edit `hosts//variables.nix` + ```nixos-generate-config --show-hardware-config > hosts//hardware.nix``` -5. Edit `flake.nix` and fill in your username, profile, and hostname. - -6. Generate your hardware.nix like so: - -``` -nixos-generate-config --show-hardware-config > hosts//hardware.nix ``` 7. Run this to enable flakes and install the flake replacing hostname with profile. I.e. `intel`, `nvidia`, `nvidia-laptop`, `amd-hybrid`, or `vm` ``` + NIX_CONFIG="experimental-features = nix-command flakes" sudo nixos-rebuild switch --flake .#profile + ``` Now when you want to rebuild the configuration you have access to an alias called `fr` that will rebuild the flake and you do not have to be in the `zaneyos` folder for it to work. - - -## Upgrading from ZaneyOS 2.3 to 2.4 -- At this time do NOT user the upgrade script - -> **🚀 IMPORTANT:** If you already have ZaneyOS 2.3 installed, use the automated -> upgrade system instead of reinstalling! - -### ✅ Automated Upgrade Process: - -ZaneyOS includes a comprehensive upgrade system that safely migrates your -configuration: - -```bash -cd ~/zaneyos -./upgrade-2.3-to-2.4.sh -``` - -### 🔍 What the Upgrade System Does: - -1. **Pre-Upgrade Analysis** - Comprehensive scan of your customizations -2. **Complete Backup** - Full backup of your current configuration -3. **Automatic Migration** - Preserves all your settings and customizations -4. **Safe Upgrade** - Uses `boot` option to prevent display manager conflicts -5. **Easy Revert** - One-command rollback if needed - -### 📋 What Gets Automatically Migrated: - -- ✅ All host configurations and variables -- ✅ Hardware configurations -- ✅ Custom packages (both global and per-host) -- ✅ Themes, wallpapers, and monitor settings -- ✅ Git configuration and personal settings -- ✅ Terminal preferences with automatic enabling - -### ⚠️ What Requires Manual Attention: - -- Custom flake.nix inputs -- Personal shell configuration files (zshrc-personal.nix, etc.) -- Custom module modifications - -### 📚 Complete Documentation: - -For detailed upgrade instructions, troubleshooting, and safety information: - -- **Read**: `UPGRADE-2.3-to-2.4.md` in your zaneyos directory -- **Analysis Report**: Saved automatically as - `~/zaneyos-upgrade-analysis-TIMESTAMP.txt` - -### 🔄 Easy Revert: - -If anything goes wrong, easily revert to 2.3: - -```bash -cd ~/zaneyos -./upgrade-2.3-to-2.4.sh --revert -``` - ---- - ### Special Recognitions: Thank you for all your assistance -- Jakookit https://github.com/jakookit -- Justaguylinux https://github.com/drewgrif +- KoolDots https://github.com/LinuxBeginnings +- JakKoolit https://github.com/Jakoolit +- Justaguylinux https://codeberg.org/Justaguylinux - Jerry Starke https://github.com/JerrySM64 ## Hope you enjoy! +``` diff --git a/cheatsheets/add-gnome.md b/cheatsheets/add-gnome.md new file mode 100644 index 0000000..b36cdc5 --- /dev/null +++ b/cheatsheets/add-gnome.md @@ -0,0 +1,58 @@ +# Add GNOME Desktop (overview) + +This guide gives **basic steps** and **which files to edit** to add GNOME to ZaneyOS. + +In NixOS, you enable it through NixOS options in a module (a `.nix` file), then pick a display manager (login screen). +This repo already has **SDDM** (graphical) and **LY** (text) login support. You can keep using either — both can start GNOME sessions. + +## Files to edit (minimal list) + +1. `modules/core/default.nix` + - Import your new GNOME module so it becomes part of the system config. + +2. `modules/core/xserver.nix` + - GNOME needs `services.xserver.enable = true;` (this file currently disables X11). + +3. `modules/core/gnome.nix` (new file you create) + - Turn on GNOME’s desktop manager. + +4. `hosts//variables.nix` + - Make sure your `displayManager` is set to either `"sddm"` or `"tui"` (for LY), since those are already supported here. + +## Suggested minimal GNOME module (example) + +```nix path=null start=null +{ ... }: +{ + services.xserver = { + enable = true; + desktopManager.gnome.enable = true; + }; +} +``` + +## Where to import the GNOME module + +In `modules/core/default.nix`, add your GNOME file to the imports list: + +```nix path=null start=null +imports = [ + # ... + ./gnome.nix + # ... +]; +``` + +## Flatpak: GNOME Extensions Manager + +To add the Flatpak app **Extension Manager** (for GNOME extensions), edit `modules/core/flatpak.nix` and add its ID: + +```nix path=null start=null +services.flatpak.packages = [ + "com.mattjakeman.ExtensionManager" +]; +``` + +## `git add .` and rebuild + +Once you have the file created. In the ZaneyOS directory run `git add . ` then `zcli rebuild` diff --git a/flake.lock b/flake.lock index aaf2ac8..e53589f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,27 @@ { "nodes": { + "alejandra": { + "inputs": { + "fenix": "fenix", + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777149230, + "narHash": "sha256-pu6dVB6NrIj90rrqCgJ5pPlBzS76pW4WA6rE1rD1Gp8=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "8c4a4a572bee519b04e9bb9207e7d993f55ecb4f", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "repo": "alejandra", + "type": "github" + } + }, "antigravity-nix": { "inputs": { "flake-utils": "flake-utils", @@ -8,11 +30,11 @@ ] }, "locked": { - "lastModified": 1763923069, - "narHash": "sha256-rz0rpiWu333RNbzVV+3t3AGotCSM7g4J6xf4d/xeyP8=", + "lastModified": 1776411505, + "narHash": "sha256-7HILfdTOvWzAMmfS3lQV3MDmVrr2Epj8x4c9F3mzOSE=", "owner": "jacopone", "repo": "antigravity-nix", - "rev": "31ba7531e8a84b9e5ee498f822e35bc6a419f3c0", + "rev": "9f31d28882185d30c0e3082fbc52dab1cd4e879f", "type": "github" }, "original": { @@ -21,6 +43,28 @@ "type": "github" } }, + "awww": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1777136912, + "narHash": "sha256-owyQdC2vi0kYC119fzyVQp0J4G0t1n4xXUwryhlBbqA=", + "ref": "refs/heads/main", + "rev": "f66e12a76dbc4c669b2f1375f78bce49f5b19d66", + "revCount": 1363, + "type": "git", + "url": "https://codeberg.org/LGFae/awww" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/LGFae/awww" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -42,28 +86,28 @@ "base16-fish": { "flake": false, "locked": { - "lastModified": 1754405784, - "narHash": "sha256-l9xHIy+85FN+bEo6yquq2IjD1rSg9fjfjpyGP1W8YXo=", + "lastModified": 1765809053, + "narHash": "sha256-XCUQLoLfBJ8saWms2HCIj4NEN+xNsWBlU1NrEPcQG4s=", "owner": "tomyun", "repo": "base16-fish", - "rev": "23ae20a0093dca0d7b39d76ba2401af0ccf9c561", + "rev": "86cbea4dca62e08fb7fd83a70e96472f92574782", "type": "github" }, "original": { "owner": "tomyun", "repo": "base16-fish", - "rev": "23ae20a0093dca0d7b39d76ba2401af0ccf9c561", + "rev": "86cbea4dca62e08fb7fd83a70e96472f92574782", "type": "github" } }, "base16-helix": { "flake": false, "locked": { - "lastModified": 1760703920, - "narHash": "sha256-m82fGUYns4uHd+ZTdoLX2vlHikzwzdu2s2rYM2bNwzw=", + "lastModified": 1776754714, + "narHash": "sha256-E3OAK27smtATTmX45uoTSRsVD+Y+ZiVVfgM/tjpbtYg=", "owner": "tinted-theming", "repo": "base16-helix", - "rev": "d646af9b7d14bff08824538164af99d0c521b185", + "rev": "4d508123037e7851ad36ebf7d9c48b0e9e1eb581", "type": "github" }, "original": { @@ -89,14 +133,36 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "alejandra", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1768113825, + "narHash": "sha256-f09fAifGPEuRrz1DFY910jexq0DaBuQBbq7WcxQIUgs=", + "owner": "nix-community", + "repo": "fenix", + "rev": "55106e04d905c6a7726d0f6be77ed39a99f66a61", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { - "lastModified": 1764724327, - "narHash": "sha256-OkFLrD3pFR952TrjQi1+Vdj604KLcMnkpa7lkW7XskI=", + "lastModified": 1776136500, + "narHash": "sha256-r0gN2brVWA351zwMV0Flmlcd6SGMvYqFbvC3DfKFM8Y=", "owner": "rafaelmardojai", "repo": "firefox-gnome-theme", - "rev": "66b7c635763d8e6eb86bd766de5a1e1fbfcc1047", + "rev": "0f8ba203d475587f477e7ae12661bd8459e225b7", "type": "github" }, "original": { @@ -106,6 +172,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1761588595, + "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1751685974, @@ -129,11 +211,11 @@ ] }, "locked": { - "lastModified": 1763759067, - "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", "type": "github" }, "original": { @@ -150,11 +232,11 @@ ] }, "locked": { - "lastModified": 1760948891, - "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", "type": "github" }, "original": { @@ -171,11 +253,11 @@ ] }, "locked": { - "lastModified": 1763759067, - "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", "type": "github" }, "original": { @@ -202,21 +284,19 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, + "flakeCompat": { + "flake": false, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, @@ -239,20 +319,18 @@ "gnome-shell": { "flake": false, "locked": { - "host": "gitlab.gnome.org", - "lastModified": 1764524476, - "narHash": "sha256-bTmNn3Q4tMQ0J/P0O5BfTQwqEnCiQIzOGef9/aqAZvk=", + "lastModified": 1767737596, + "narHash": "sha256-eFujfIUQDgWnSJBablOuG+32hCai192yRdrNHTv0a+s=", "owner": "GNOME", "repo": "gnome-shell", - "rev": "c0e1ad9f0f703fd0519033b8f46c3267aab51a22", - "type": "gitlab" + "rev": "ef02db02bf0ff342734d525b5767814770d85b49", + "type": "github" }, "original": { - "host": "gitlab.gnome.org", "owner": "GNOME", - "ref": "gnome-49", "repo": "gnome-shell", - "type": "gitlab" + "rev": "ef02db02bf0ff342734d525b5767814770d85b49", + "type": "github" } }, "home-manager": { @@ -262,16 +340,16 @@ ] }, "locked": { - "lastModified": 1764776959, - "narHash": "sha256-d+5CGloq7Lo1u2SkzhF8oiOdUc6Z5emh22nTXUB9CFA=", + "lastModified": 1778503501, + "narHash": "sha256-08L/X4/do7nET4rzidJ76eV/1r+mB7DchVpdPypsghc=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1680d594a9281651cbf7d126941a8c8e2396183", + "rev": "85ba629c79449badf4338117c27f0ee92b4b9f1a", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-25.11", + "ref": "master", "repo": "home-manager", "type": "github" } @@ -284,11 +362,11 @@ ] }, "locked": { - "lastModified": 1762964643, - "narHash": "sha256-RYHN8O/Aja59XDji6WSJZPkJpYVUfpSkyH+PEupBJqM=", + "lastModified": 1777594677, + "narHash": "sha256-h90sHwoRJLRvaTpZroTvU2JRHDFj0czUafM8eqLe1RI=", "owner": "nix-community", "repo": "home-manager", - "rev": "827f2a23373a774a8805f84ca5344654c31f354b", + "rev": "899c08a15beae5da51a5cecd6b2b994777a948da", "type": "github" }, "original": { @@ -297,41 +375,13 @@ "type": "github" } }, - "ixx": { - "inputs": { - "flake-utils": [ - "nixvim", - "nuschtosSearch", - "flake-utils" - ], - "nixpkgs": [ - "nixvim", - "nuschtosSearch", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1754860581, - "narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.1.1", - "repo": "ixx", - "type": "github" - } - }, "mnw": { "locked": { - "lastModified": 1758834834, - "narHash": "sha256-Y7IvY4F8vajZyp3WGf+KaiIVwondEkMFkt92Cr9NZmg=", + "lastModified": 1777828893, + "narHash": "sha256-gVWVnmyNr74BVKfhMMZDWkhx2699dhmZ2g0W8TTHtkk=", "owner": "Gerg-L", "repo": "mnw", - "rev": "cfbc7d1cc832e318d0863a5fc91d940a96034001", + "rev": "c1c0b544bfabe6669b5a6a0383ccb475fe60258b", "type": "github" }, "original": { @@ -340,13 +390,35 @@ "type": "github" } }, + "ndg": { + "inputs": { + "nixpkgs": [ + "nvf", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776882296, + "narHash": "sha256-DWZozXwMsgvUqfVlL1mQ8dOxW7GJ/8CdyaDN+1niZRg=", + "owner": "feel-co", + "repo": "ndg", + "rev": "ab7d78d4884b3a34968cf9fa3d16c0c1246d5c6e", + "type": "github" + }, + "original": { + "owner": "feel-co", + "ref": "refs/tags/v2.6.0", + "repo": "ndg", + "type": "github" + } + }, "nix-flatpak": { "locked": { - "lastModified": 1739444422, - "narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=", + "lastModified": 1767983141, + "narHash": "sha256-7ZCulYUD9RmJIDULTRkGLSW1faMpDlPKcbWJLYHoXcs=", "owner": "gmodena", "repo": "nix-flatpak", - "rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177", + "rev": "440818969ac2cbd77bfe025e884d0aa528991374", "type": "github" }, "original": { @@ -358,48 +430,48 @@ }, "nixpkgs": { "locked": { - "lastModified": 1764800781, - "narHash": "sha256-vSNALyWgk6vwdIQcLd7phN4nwv9QgkwLf5eImaEorHk=", + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6a0a964635aa209cc1129755b560bb4ac697da3b", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-25.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1761880412, - "narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=", + "lastModified": 1774386573, + "narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386", + "rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_3": { "locked": { - "lastModified": 1764522689, - "narHash": "sha256-SqUuBFjhl/kpDiVaKLQBoD8TLD+/cTUzzgVFoaHrkqY=", + "lastModified": 1777268161, + "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8bb5646e0bed5dbd3ab08c7a7cc15b75ab4e1d0f", + "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -410,20 +482,18 @@ "nixpkgs": [ "nixpkgs" ], - "nuschtosSearch": "nuschtosSearch", - "systems": "systems_3" + "systems": "systems_2" }, "locked": { - "lastModified": 1764755396, - "narHash": "sha256-f6UrlGdwg+TIxxyDjeq1M7WGNZH/vpbOm0yzPgkMy9c=", + "lastModified": 1778510615, + "narHash": "sha256-cMNCx8mQTJnVkA6kt3B3ArGpCOOniYn644hH0mJHSsw=", "owner": "nix-community", "repo": "nixvim", - "rev": "64d9e2616f4ee2acee380d61ccf1f3d610e7e969", + "rev": "fa8cd368d27cf9541f086485884928315abdcc8c", "type": "github" }, "original": { "owner": "nix-community", - "ref": "nixos-25.11", "repo": "nixvim", "type": "github" } @@ -432,14 +502,15 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ] + ], + "noctalia-qs": "noctalia-qs" }, "locked": { - "lastModified": 1764789847, - "narHash": "sha256-q/q97hi5bGDTE1Quoo13L35Nc+oqcPGFVd7PPCmLk6E=", + "lastModified": 1778464608, + "narHash": "sha256-tZRvyaKVP0DJ9DSFrr6K/l3X74Orfirk3Jjo7+br4Qs=", "owner": "noctalia-dev", "repo": "noctalia-shell", - "rev": "c80a68007b34791bcc25b94df35427d0d04a51cf", + "rev": "761869a561548874fe7e293b157fd7841576b367", "type": "github" }, "original": { @@ -448,6 +519,29 @@ "type": "github" } }, + "noctalia-qs": { + "inputs": { + "nixpkgs": [ + "noctalia", + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1778377995, + "narHash": "sha256-uUzHDHqQF1rdVNiTa05L0mML3/d7fpbAShjCRWxbrBQ=", + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "rev": "d8327a723eed6dd9aebe8e0b162126f390e827df", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": [ @@ -460,11 +554,11 @@ ] }, "locked": { - "lastModified": 1764773531, - "narHash": "sha256-mCBl7MD1WZ7yCG6bR9MmpPO2VydpNkWFgnslJRIT1YU=", + "lastModified": 1777598946, + "narHash": "sha256-X239dAGaU1+gfDj8jKH8GzlqKMcxaVfXOio+uzBOkeE=", "owner": "nix-community", "repo": "NUR", - "rev": "1d9616689e98beded059ad0384b9951e967a17fa", + "rev": "5d55af01c0f86be583931fe99207fc56c14134b3", "type": "github" }, "original": { @@ -473,43 +567,21 @@ "type": "github" } }, - "nuschtosSearch": { - "inputs": { - "flake-utils": "flake-utils_2", - "ixx": "ixx", - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1761730856, - "narHash": "sha256-t1i5p/vSWwueZSC0Z2BImxx3BjoUDNKyC2mk24krcMY=", - "owner": "NuschtOS", - "repo": "search", - "rev": "e29de6db0cb3182e9aee75a3b1fd1919d995d85b", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "nvf": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts_2", "mnw": "mnw", + "ndg": "ndg", "nixpkgs": "nixpkgs_2", "systems": "systems_4" }, "locked": { - "lastModified": 1762622004, - "narHash": "sha256-NpzzgaoMK8aRHnndHWbYNKLcZN0r1y6icCoJvGoBsoE=", + "lastModified": 1778408907, + "narHash": "sha256-QXjdRz5fssxAWDrtfBYxvjMtTqJzQAbnAmX3u22xCck=", "owner": "notashelf", "repo": "nvf", - "rev": "09470524a214ed26633ddc2b6ec0c9bf31a8b909", + "rev": "e86a92e4b29b499e5f1285b737b7612115103da9", "type": "github" }, "original": { @@ -518,40 +590,59 @@ "type": "github" } }, - "quickshell": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1764663772, - "narHash": "sha256-sHqLmm0wAt3PC4vczJeBozI1/f4rv9yp3IjkClHDXDs=", - "ref": "refs/heads/master", - "rev": "26531fc46ef17e9365b03770edd3fb9206fcb460", - "revCount": 713, - "type": "git", - "url": "https://git.outfoxxed.me/outfoxxed/quickshell" - }, - "original": { - "type": "git", - "url": "https://git.outfoxxed.me/outfoxxed/quickshell" - } - }, "root": { "inputs": { + "alejandra": "alejandra", "antigravity-nix": "antigravity-nix", + "awww": "awww", "home-manager": "home-manager", "nix-flatpak": "nix-flatpak", "nixpkgs": "nixpkgs", "nixvim": "nixvim", "noctalia": "noctalia", "nvf": "nvf", - "quickshell": "quickshell", "stylix": "stylix", "zen-browser": "zen-browser" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1768083390, + "narHash": "sha256-TGWPJq2mXwxfAe83iZ18DIqXC4sOSj7RkW9b59h6Ox4=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "e42e8ff582ba12a88b6845525d08b6428e6d0fb9", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "awww", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764038373, + "narHash": "sha256-M6w2wNBRelcavoDAyFL2iO4NeWknD40ASkH1S3C0YGM=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "ab3536fe850211a96673c6ffb2cb88aab8071cc9", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -564,23 +655,22 @@ "nixpkgs": "nixpkgs_3", "nur": "nur", "systems": "systems_5", - "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", "tinted-tmux": "tinted-tmux", "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1764795851, - "narHash": "sha256-DgtI/SwRiVnAfAVrXoRFymVP1AGvB3ZxYL6XMOZFvJQ=", + "lastModified": 1778104276, + "narHash": "sha256-/DSSnU0LLmOTG/OCgGwYpxP6+5YvxRx2g/GhI4x6aCU=", "owner": "danth", "repo": "stylix", - "rev": "cfde343ff369c8aa898f263ed3dad8c5eb095491", + "rev": "18ed8d270231e067fe2739998479ed5d7c659c2c", "type": "github" }, "original": { "owner": "danth", - "ref": "release-25.11", + "ref": "master", "repo": "stylix", "type": "github" } @@ -617,16 +707,16 @@ }, "systems_3": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -660,23 +750,6 @@ "type": "github" } }, - "tinted-foot": { - "flake": false, - "locked": { - "lastModified": 1726913040, - "narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=", - "owner": "tinted-theming", - "repo": "tinted-foot", - "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "tinted-foot", - "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", - "type": "github" - } - }, "tinted-kitty": { "flake": false, "locked": { @@ -696,11 +769,11 @@ "tinted-schemes": { "flake": false, "locked": { - "lastModified": 1763914658, - "narHash": "sha256-Hju0WtMf3iForxtOwXqGp3Ynipo0EYx1AqMKLPp9BJw=", + "lastModified": 1777041405, + "narHash": "sha256-BAGZ7ObFV/9Z61OJZun7ifPyhkuHqNuW1QIhQ8LuzCo=", "owner": "tinted-theming", "repo": "schemes", - "rev": "0f6be815d258e435c9b137befe5ef4ff24bea32c", + "rev": "5f868b3a338b6904c47f3833b9c411be641983a8", "type": "github" }, "original": { @@ -712,11 +785,11 @@ "tinted-tmux": { "flake": false, "locked": { - "lastModified": 1764465359, - "narHash": "sha256-lbSVPqLEk2SqMrnpvWuKYGCaAlfWFMA6MVmcOFJjdjE=", + "lastModified": 1777169200, + "narHash": "sha256-h7dDbIzP5hDr9v97w9PL6jdAgXawmj6krcH+959rqpU=", "owner": "tinted-theming", "repo": "tinted-tmux", - "rev": "edf89a780e239263cc691a987721f786ddc4f6aa", + "rev": "f798c2dce44ef815bb6b8f05a82135c7942d35ac", "type": "github" }, "original": { @@ -728,11 +801,11 @@ "tinted-zed": { "flake": false, "locked": { - "lastModified": 1764464512, - "narHash": "sha256-rCD/pAhkMdCx6blsFwxIyvBJbPZZ1oL2sVFrH07lmqg=", + "lastModified": 1777463218, + "narHash": "sha256-Bhkozqtq3BKLqWTlmKm8uAptfX4aRGI8QX3eEL54Vpc=", "owner": "tinted-theming", "repo": "base16-zed", - "rev": "907dbba5fb8cf69ebfd90b00813418a412d0a29a", + "rev": "5768d08ed2e7944a26a958868cdb073cb8856dae", "type": "github" }, "original": { @@ -741,6 +814,28 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "noctalia", + "noctalia-qs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "zen-browser": { "inputs": { "home-manager": "home-manager_2", @@ -749,11 +844,11 @@ ] }, "locked": { - "lastModified": 1764598958, - "narHash": "sha256-sJQHRL8trBoG/ArR+mUlyp5cyKU0pgQY+qDQzZGnVgM=", + "lastModified": 1778377655, + "narHash": "sha256-wHsd+tesB3FtwUZbGjU/sWMZhw0m0yYBSXufMDVyQmc=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "8cded25e10b13e2999241f1c73a7d4e5e5d6f69e", + "rev": "101d6731d7b163ef4f6fab8c6eea7da4ddb52ec3", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1ec7801..9ca5d5b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,12 @@ inputs = { home-manager = { - url = "github:nix-community/home-manager/release-25.11"; + url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; }; - nixpkgs.url = "github:nixos/nixpkgs/release-25.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nvf.url = "github:notashelf/nvf"; - stylix.url = "github:danth/stylix/release-25.11"; + stylix.url = "github:danth/stylix/master"; nix-flatpak.url = "github:gmodena/nix-flatpak?ref=latest"; noctalia = { @@ -18,13 +18,7 @@ # Checking nixvim to see if it's better nixvim = { - url = "github:nix-community/nixvim/nixos-25.11"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - # QuickShell (optional add quickshell to outputs to enable) - quickshell = { - url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; + url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -38,46 +32,55 @@ url = "github:0xc000022070/zen-browser-flake/beta"; inputs.nixpkgs.follows = "nixpkgs"; }; + alejandra = { + url = "github:kamadorueda/alejandra"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + awww = { + url = "git+https://codeberg.org/LGFae/awww"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = - { nixpkgs - , home-manager - , nixvim - , nix-flatpak - , ... - } @ inputs: - let - system = "x86_64-linux"; - host = "zaneyos-24-vm"; - profile = "vm"; - username = "dwilliams"; + outputs = { + nixpkgs, + home-manager, + nixvim, + nix-flatpak, + alejandra, + ... + } @ inputs: let + system = "x86_64-linux"; + host = "zaneyos-24-vm"; + profile = "vm"; + username = "dwilliams"; - # Deduplicate nixosConfigurations while preserving the top-level 'profile' - mkNixosConfig = gpuProfile: - nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - inherit username; - inherit host; - inherit profile; # keep using the let-bound profile for modules/scripts - }; - modules = [ - ./modules/core/overlays.nix - ./profiles/${gpuProfile} - nix-flatpak.nixosModules.nix-flatpak - ]; + # Deduplicate nixosConfigurations while preserving the top-level 'profile' + mkNixosConfig = gpuProfile: + nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit username; + inherit host; + inherit profile; # keep using the let-bound profile for modules/scripts }; - in - { - nixosConfigurations = { - amd = mkNixosConfig "amd"; - nvidia = mkNixosConfig "nvidia"; - nvidia-laptop = mkNixosConfig "nvidia-laptop"; - amd-hybrid = mkNixosConfig "amd-hybrid"; - intel = mkNixosConfig "intel"; - vm = mkNixosConfig "vm"; + modules = [ + ./modules/core/overlays.nix + ./profiles/${gpuProfile} + nix-flatpak.nixosModules.nix-flatpak + ]; }; + in { + nixosConfigurations = { + amd = mkNixosConfig "amd"; + nvidia = mkNixosConfig "nvidia"; + nvidia-laptop = mkNixosConfig "nvidia-laptop"; + amd-nvidia-hybrid = mkNixosConfig "amd-nvidia-hybrid"; + intel = mkNixosConfig "intel"; + vm = mkNixosConfig "vm"; }; + + formatter.x86_64-linux = inputs.alejandra.packages.x86_64-linux.default; + }; } diff --git a/hosts/default/default.nix b/hosts/default/default.nix index 1ef7d77..6faad47 100644 --- a/hosts/default/default.nix +++ b/hosts/default/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { imports = [ ./hardware.nix ./host-packages.nix diff --git a/hosts/default/hardware.nix b/hosts/default/hardware.nix index a662432..54dab41 100644 --- a/hosts/default/hardware.nix +++ b/hosts/default/hardware.nix @@ -1,35 +1,36 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/dd005850-6230-40c4-9d70-8c8cf443658d"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/dd005850-6230-40c4-9d70-8c8cf443658d"; + fsType = "ext4"; + }; boot.initrd.luks.devices."luks-b7565781-148e-4c94-9c76-36c84dd93dc8".device = "/dev/disk/by-uuid/b7565781-148e-4c94-9c76-36c84dd93dc8"; - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/C2A6-DF56"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C2A6-DF56"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/default/host-packages.nix b/hosts/default/host-packages.nix index f44b200..8f9f927 100644 --- a/hosts/default/host-packages.nix +++ b/hosts/default/host-packages.nix @@ -1,7 +1,28 @@ -{pkgs, ...}: { +{configs, pkgs, ...}: { + environment.systemPackages = with pkgs; [ - audacity - discord - nodejs + # Add local pacakaged here ]; + # Add host specific flatpaks here + services = { + flatpak = { + packages = [ + ]; + }; + }; + + + services.auto-cpufreq.enable = false; + services.auto-cpufreq.settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + charger = { + governor = "performance"; + turbo = "auto"; + }; + }; + + } diff --git a/hosts/default/variables.nix b/hosts/default/variables.nix index 968c2ad..8badf01 100644 --- a/hosts/default/variables.nix +++ b/hosts/default/variables.nix @@ -1,13 +1,13 @@ { # Git Configuration ( For Pulling Software Repos ) - gitUsername = "Tyler Kelley"; - gitEmail = "tylerzanekelley@gmail.com"; + gitUsername = "Don Williams"; + gitEmail = "don.e.williams@gmail.com"; # Set Displau Manager # `tui` for Text login # `sddm` for graphical GUI (default) # SDDM background is set with stylixImage - displayManager = "sddm"; + displayManager = "tui"; # Emable/disable bundled applications tmuxEnable = false; @@ -21,6 +21,8 @@ #To install: Enable here, zcli rebuild, then run zcli doom install doomEmacsEnable = false; + # Python development tools are included by default + # Hyprland Settings # Examples: # extraMonitorSettings = "monitor = Virtual-1,1920x1080@60,auto,1"; @@ -28,7 +30,7 @@ # You can configure multiple monitors. # Inside the quotes, create a new line for each monitor. extraMonitorSettings = " - + monitor = Virtual-1,1920x1080@60,auto,1 "; # Bar/Shell Settings @@ -45,6 +47,21 @@ # or as a flatpak browser = "brave"; + # Host-level default applications (picked up by Home Manager xdg.mimeApps) + # Uncomment and adjust the .desktop IDs to set per-host defaults. + # mimeDefaultApps = { + # # PDFs + # "application/pdf" = ["okular.desktop"]; + # "application/x-pdf" = ["okular.desktop"]; + # # Web browser + # "x-scheme-handler/http" = ["google-chrome.desktop"]; # or brave-browser.desktop, firefox.desktop + # "x-scheme-handler/https" = ["google-chrome.desktop"]; + # "text/html" = ["google-chrome.desktop"]; + # # Files + # "inode/directory" = ["thunar.desktop"]; # file manager + # "text/plain" = ["nvim.desktop"]; # or code.desktop + # }; + # Available Options: # Kitty, ghostty, wezterm, aalacrity # Note: kitty, wezterm, alacritty have to be enabled in `variables.nix` @@ -67,8 +84,8 @@ printEnable = false; # Enable Thunar GUI File Manager - # Yazi is default File Manager - thunarEnable = false; + # Yazi is alternate File Manager + thunarEnable = true; # Themes, waybar and animation. # Only uncomment your selection @@ -78,17 +95,17 @@ # This will set your color palette # Default background # Add new images to ~/zaneyos/wallpapers - stylixImage = ../../wallpapers/mountainscapedark.jpg; + #stylixImage = ../../wallpapers/mountainscapedark.jpg; #stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; #stylixImage = ../../wallpapers/Anime-Purple-eyes.png; - #stylixImage = ../../wallpapers/Rainnight.jpg; + stylixImage = ../../wallpapers/Rainnight.jpg; #stylixImage = ../../wallpapers/zaney-wallpaper.jpg; #stylixImage = ../../wallpapers/nix-wallpaper-stripes-logo.png; #stylixImage = ../../wallpapers/beautifulmountainscape.jpg; # Set Waybar # Available Options: - waybarChoice = ../../modules/home/waybar/waybar-curved.nix; + #waybarChoice = ../../modules/home/waybar/waybar-curved.nix; #waybarChoice = ../../modules/home/waybar/waybar-ddubs.nix; #waybarChoice = ../../modules/home/waybar/waybar-ddubs-2.nix; #waybarChoice = ../../modules/home/waybar/waybar-simple.nix; @@ -107,12 +124,12 @@ #waybarChoice = ../../modules/home/waybar/waybar-jwt-transparent.nix; #waybarChoice = ../../modules/home/waybar/waybar-jwt-ultradark.nix; #waybarChoice = ../../modules/home/waybar/waybar-pctrade-catppuccin.nix; - #waybarChoice = ../../modules/home/waybar/waybar-mangowc-jak-catppuccin.nix; + waybarChoice = ../../modules/home/waybar/waybar-mangowc-jak-catppuccin.nix; #waybarChoice = ../../modules/home/waybar/waybar-old-ddubsos.nix; # Set Animation style # Available options are: - animChoice = ../../modules/home/hyprland/animations-def.nix; + #animChoice = ../../modules/home/hyprland/animations-def.nix; #animChoice = ../../modules/home/hyprland/animations-end4.nix; #animChoice = ../../modules/home/hyprland/animations-end4-slide.nix; #animChoice = ../../modules/home/hyprland/animations-end-slide.nix; @@ -121,7 +138,7 @@ #animChoice = ../../modules/home/hyprland/animations-hyde-optimized.nix; #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-1.nix; #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-2.nix; - #animChoice = ../../modules/home/hyprland/animations-ml4w-classic.nix; + animChoice = ../../modules/home/hyprland/animations-ml4w-classic.nix; #animChoice = ../../modules/home/hyprland/animations-ml4w-fast.nix; #animChoice = ../../modules/home/hyprland/animations-ml4w-high.nix; diff --git a/hosts/nixstation/default.nix b/hosts/nixstation/default.nix deleted file mode 100644 index 1ef7d77..0000000 --- a/hosts/nixstation/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: { - imports = [ - ./hardware.nix - ./host-packages.nix - ]; -} diff --git a/hosts/nixstation/hardware.nix b/hosts/nixstation/hardware.nix deleted file mode 100644 index bff5110..0000000 --- a/hosts/nixstation/hardware.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config -, lib -, modulesPath -, ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - boot = { - initrd = { - availableKernelModules = [ - "xhci_pci" - "ehci_pci" - "ahci" - "nvme" - "usbhid" - "sd_mod" - ]; - kernelModules = [ ]; - luks.devices = { - "luks-8941ac93-f043-46d1-b128-37d5e846303f".device = "/dev/disk/by-uuid/8941ac93-f043-46d1-b128-37d5e846303f"; - }; - }; - kernelModules = [ "kvm-intel" ]; - extraModulePackages = [ ]; - }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/8bac633b-c4e6-44bc-83b3-97b5472594e8"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/BC0C-F843"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - "/home/zaney/BFD" = { - device = "/dev/disk/by-uuid/5A30E2CC30E2AE67"; - fsType = "ntfs"; - options = [ - "defaults" - "umask=000" - "dmask=027" - "fmask=137" - "uid=1000" - "gid=1000" - "windows_names" - ]; - }; - }; - swapDevices = [ ]; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/nixstation/host-packages.nix b/hosts/nixstation/host-packages.nix deleted file mode 100644 index 0934757..0000000 --- a/hosts/nixstation/host-packages.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, ... }: { - environment.systemPackages = with pkgs; [ - audacity - discord - nodejs - obs-studio - handbrake - yt-dlp - android-studio - android-studio-tools - android-tools - ]; -} diff --git a/hosts/nixstation/variables.nix b/hosts/nixstation/variables.nix deleted file mode 100644 index b3b0f87..0000000 --- a/hosts/nixstation/variables.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ - # Git Configuration ( For Pulling Software Repos ) - gitUsername = "Tyler Kelly"; - gitEmail = "tylerzanekelly@gmail.com"; - - # Set Displau Manager - # `tui` for Text login - # `sddm` for graphical GUI - # SDDM background is set with stylixImage - displayManager = "sddm"; - - # Emable/disable bundled applications - tmuxEnable = false; - alacrittyEnable = false; - weztermEnable = false; - ghosttyEnable = false; - vscodeEnable = false; - antigravityEnable = false; # Google port of vscodium - helixEnable = false; - #To install rebuild, then run zcli doom install - doomEmacsEnable = false; - - # P10K or starship prompt - userPrompt = "starship"; - - # Hyprland Settings - extraMonitorSettings = "monitor=Virtual-1,1920x1080@75,auto,1"; - - # Bar/Shell Settings - # Choose between noctalia or waybar - barChoice = "noctalia"; - - # Waybar Settings (used when barChoice = "waybar") - clock24h = false; - - # Program Options - browser = "brave"; # Set Default Browser (google-chrome-stable for google-chrome) - terminal = "kitty"; # Set Default System Terminal - keyboardLayout = "us"; - consoleKeyMap = "us"; - - # For hybrid support (Intel/NVIDIA Prime or AMD/NVIDIA) - intelID = "PCI:1:0:0"; - amdgpuID = "PCI:5:0:0"; - nvidiaID = "PCI:0:2:0"; - - # Enable NFS - enableNFS = true; - - # Enable Printing Support - printEnable = false; - - # Enable Thunar GUI File Manager - thunarEnable = true; - - # Set Stylix Image - # This will set your color palette - # Default background - # Add new images to ~/zaneyos/wallpapers - #stylixImage = ../../wallpapers/mountainscapedark.jpg; - stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; - #stylixImage = ../../wallpapers/Anime-Purple-eyes.png; - #stylixImage = ../../wallpapers/Rainnight.jpg; - #stylixImage = ../../wallpapers/zaney-wallpaper.jpg; - #stylixImage = ../../wallpapers/nix-wallpapers-strips-logo.jpg; - #stylixImage = ../../wallpapers/beautifulmountainscape.jpg; - - # Set Waybar - # Available options: - waybarChoice = ../../modules/home/waybar/waybar-curved.nix; - #waybarChoice = ../../modules/home/waybar/waybar-simple.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jerry.nix; - #waybarChoice = ../../modules/home/waybar/waybar-ddubs.nix; - #waybarChoice = ../../modules/home/waybar/waybar-ddubs-2.nix; - #waybarChoice = ../../modules/home/waybar/waybar-dwm.nix; - #waybarChoice = ../../modules/home/waybar/waybar-dwm-2.nix; - #waybarChoice = ../../modules/home/waybar/waybar-TheBlackDon.nix; - #waybarChoice = ../../modules/home/waybar/waybar-tony.nix; - #waybarChoice = ../../modules/home/waybar/waybar-ddubsos-v1.nix; - #waybarChoice = ../../modules/home/waybar/waybar-mecha.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jak-catppuccin.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jak-ml4w-modern.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jak-oglo-simple.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jwt-catppuccin.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jwt-transparent.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jwt-ultradark.nix; - #waybarChoice = ../../modules/home/waybar/waybar-pctrade-catppuccin.nix; - #waybarChoice = ../../modules/home/waybar/waybar-mangowc-jak-catppuccin.nix; - #waybarChoice = ../../modules/home/waybar/waybar-old-ddubsos.nix; - - # Set Animation style - # Available options are: - animChoice = ../../modules/home/hyprland/animations-end4.nix; - #animChoice = ../../modules/home/hyprland/animations-def.nix; - #animChoice = ../../modules/home/hyprland/animations-end4-slide.nix; - #animChoice = ../../modules/home/hyprland/animations-end-slide.nix; - #animChoice = ../../modules/home/hyprland/animations-dynamic.nix; - #animChoice = ../../modules/home/hyprland/animations-moving.nix; - #animChoice = ../../modules/home/hyprland/animations-hyde-optimized.nix; - #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-1.nix; - #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-2.nix; - #animChoice = ../../modules/home/hyprland/animations-ml4w-classic.nix; - #animChoice = ../../modules/home/hyprland/animations-ml4w-fast.nix; - #animChoice = ../../modules/home/hyprland/animations-ml4w-high.nix; - - # Set network hostId if required (needed for zfs) - # Otherwise leave as-is - hostId = "5ab03f50"; -} diff --git a/hosts/zaneyos-24-vm/default.nix b/hosts/zaneyos-24-vm/default.nix index 1ef7d77..6faad47 100644 --- a/hosts/zaneyos-24-vm/default.nix +++ b/hosts/zaneyos-24-vm/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { imports = [ ./hardware.nix ./host-packages.nix diff --git a/hosts/zaneyos-24-vm/hardware.nix b/hosts/zaneyos-24-vm/hardware.nix index 5a99045..8434bb8 100644 --- a/hosts/zaneyos-24-vm/hardware.nix +++ b/hosts/zaneyos-24-vm/hardware.nix @@ -1,37 +1,41 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/e5fc1006-4d0b-41db-8c43-22b3cb8110c6"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/e5fc1006-4d0b-41db-8c43-22b3cb8110c6"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/9287-3738"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/9287-3738"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; - fileSystems."/mnt/nas" = - { device = "192.168.40.11:/volume1/DiskStation54TB"; - fsType = "nfs"; - }; + fileSystems."/mnt/nas" = { + device = "192.168.40.11:/volume1/DiskStation54TB"; + fsType = "nfs"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/a6e9dd8b-6767-44f4-84fa-30d02d90d087"; } - ]; + swapDevices = [ + {device = "/dev/disk/by-uuid/a6e9dd8b-6767-44f4-84fa-30d02d90d087";} + ]; networking.useDHCP = lib.mkDefault true; # networking.interfaces.docker0.useDHCP = lib.mkDefault true; diff --git a/hosts/zaneyos-24-vm/host-packages.nix b/hosts/zaneyos-24-vm/host-packages.nix index f44b200..33b6047 100644 --- a/hosts/zaneyos-24-vm/host-packages.nix +++ b/hosts/zaneyos-24-vm/host-packages.nix @@ -1,7 +1,4 @@ {pkgs, ...}: { environment.systemPackages = with pkgs; [ - audacity - discord - nodejs ]; } diff --git a/hosts/zaneyos-24-vm/variables.nix b/hosts/zaneyos-24-vm/variables.nix index ab60d97..ab6507d 100644 --- a/hosts/zaneyos-24-vm/variables.nix +++ b/hosts/zaneyos-24-vm/variables.nix @@ -7,7 +7,7 @@ # `tui` for Text login # `sddm` for graphical GUI (default) # SDDM background is set with stylixImage - displayManager = "sddm"; + displayManager = "tui"; # Emable/disable bundled applications tmuxEnable = true; @@ -21,6 +21,9 @@ #To install: Enable here, zcli rebuild, then run zcli doom install doomEmacsEnable = true; + # Python development tools + pythonEnable = false; + # Hyprland Settings # Examples: # extraMonitorSettings = "monitor = Virtual-1,1920x1080@60,auto,1"; @@ -43,7 +46,22 @@ # This does NOT install your browser # You need to install it by adding it to the `packages.nix` # or as a flatpak - browser = "brave"; + browser = "google-chrome"; + + # Host-level default applications (picked up by Home Manager xdg.mimeApps) + # Uncomment and adjust the .desktop IDs to set per-host defaults. + # mimeDefaultApps = { + # # PDFs + # "application/pdf" = ["okular.desktop"]; + # "application/x-pdf" = ["okular.desktop"]; + # # Web browser + # "x-scheme-handler/http" = ["google-chrome.desktop"]; # or brave-browser.desktop, firefox.desktop + # "x-scheme-handler/https" = ["google-chrome.desktop"]; + # "text/html" = ["google-chrome.desktop"]; + # # Files + # "inode/directory" = ["thunar.desktop"]; # file manager + # "text/plain" = ["nvim.desktop"]; # or code.desktop + # }; # Available Options: # Kitty, ghostty, wezterm, aalacrity @@ -81,14 +99,14 @@ #stylixImage = ../../wallpapers/mountainscapedark.jpg; #stylixImage = ../../wallpapers/AnimeGirlNightSky.jpg; #stylixImage = ../../wallpapers/Anime-Purple-eyes.png; - #stylixImage = ../../wallpapers/Rainnight.jpg; - stylixImage = ../../wallpapers/zaney-wallpaper.jpg; + stylixImage = ../../wallpapers/Rainnight.jpg; + #stylixImage = ../../wallpapers/zaney-wallpaper.jpg; #stylixImage = ../../wallpapers/nix-wallpapers-strips-logo.jpg; #stylixImage = ../../wallpapers/beautifulmountainscape.jpg; # Set Waybar # Available Options: - waybarChoice = ../../modules/home/waybar/waybar-ddubs-2.nix; + #waybarChoice = ../../modules/home/waybar/waybar-ddubs-2.nix; #waybarChoice = ../../modules/home/waybar/waybar-curved.nix; #waybarChoice = ../../modules/home/waybar/waybar-ddubs.nix; #waybarChoice = ../../modules/home/waybar/waybar-simple.nix; @@ -100,7 +118,7 @@ #waybarChoice = ../../modules/home/waybar/waybar-tony.nix; #waybarChoice = ../../modules/home/waybar/waybar-ddubsos-v1.nix; #waybarChoice = ../../modules/home/waybar/waybar-mecha.nix; - #waybarChoice = ../../modules/home/waybar/waybar-jak-catppuccin.nix; + waybarChoice = ../../modules/home/waybar/waybar-jak-catppuccin.nix; #waybarChoice = ../../modules/home/waybar/waybar-jak-ml4w-modern.nix; #waybarChoice = ../../modules/home/waybar/waybar-jak-oglo-simple.nix; #waybarChoice = ../../modules/home/waybar/waybar-jwt-catppuccin.nix; @@ -119,9 +137,9 @@ #animChoice = ../../modules/home/hyprland/animations-dynamic.nix; #animChoice = ../../modules/home/hyprland/animations-moving.nix; #animChoice = ../../modules/home/hyprland/animations-hyde-optimized.nix; - animChoice = ../../modules/home/hyprland/animations-mahaveer-me-1.nix; + #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-1.nix; #animChoice = ../../modules/home/hyprland/animations-mahaveer-me-2.nix; - #animChoice = ../../modules/home/hyprland/animations-ml4w-classic.nix; + animChoice = ../../modules/home/hyprland/animations-ml4w-classic.nix; #animChoice = ../../modules/home/hyprland/animations-ml4w-fast.nix; #animChoice = ../../modules/home/hyprland/animations-ml4w-high.nix; diff --git a/hosts/zaneyos-oem/default.nix b/hosts/zaneyos-oem/default.nix index 1ef7d77..6faad47 100644 --- a/hosts/zaneyos-oem/default.nix +++ b/hosts/zaneyos-oem/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { imports = [ ./hardware.nix ./host-packages.nix diff --git a/hosts/zaneyos-oem/hardware.nix b/hosts/zaneyos-oem/hardware.nix index 90746ff..a017b4c 100644 --- a/hosts/zaneyos-oem/hardware.nix +++ b/hosts/zaneyos-oem/hardware.nix @@ -1,20 +1,21 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config -, lib -, pkgs -, modulesPath -, ... +{ + config, + lib, + pkgs, + modulesPath, + ... }: { imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/e5fc1006-4d0b-41db-8c43-22b3cb8110c6"; @@ -24,7 +25,7 @@ fileSystems."/boot" = { device = "/dev/disk/by-uuid/9287-3738"; fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; + options = ["fmask=0077" "dmask=0077"]; }; fileSystems."/mnt/nas" = { @@ -33,7 +34,7 @@ }; swapDevices = [ - { device = "/dev/disk/by-uuid/a6e9dd8b-6767-44f4-84fa-30d02d90d087"; } + {device = "/dev/disk/by-uuid/a6e9dd8b-6767-44f4-84fa-30d02d90d087";} ]; networking.useDHCP = lib.mkDefault true; diff --git a/hosts/zaneyos-oem/host-packages.nix b/hosts/zaneyos-oem/host-packages.nix index 37a6b3b..d1a5eb3 100644 --- a/hosts/zaneyos-oem/host-packages.nix +++ b/hosts/zaneyos-oem/host-packages.nix @@ -1,12 +1,10 @@ {pkgs, ...}: { environment.systemPackages = with pkgs; [ - nodejs atop bottom dua fd gping - lunarvim luarocks mission-center resources diff --git a/hosts/zaneyos-oem/variables.nix b/hosts/zaneyos-oem/variables.nix index 424e468..937ccec 100644 --- a/hosts/zaneyos-oem/variables.nix +++ b/hosts/zaneyos-oem/variables.nix @@ -20,6 +20,9 @@ #To install rebuild, then run zcli doom install doomEmacsEnable = false; + # Python development tools + pythonEnable = false; + # P10K or starship prompt userPrompt = "starship"; @@ -35,6 +38,22 @@ # Program Options browser = "brave"; # Set Default Browser (google-chrome-stable for google-chrome) + + # Host-level default applications (picked up by Home Manager xdg.mimeApps) + # Uncomment and adjust the .desktop IDs to set per-host defaults. + # mimeDefaultApps = { + # # PDFs + # "application/pdf" = ["okular.desktop"]; + # "application/x-pdf" = ["okular.desktop"]; + # # Web browser + # "x-scheme-handler/http" = ["google-chrome.desktop"]; # or brave-browser.desktop, firefox.desktop + # "x-scheme-handler/https" = ["google-chrome.desktop"]; + # "text/html" = ["google-chrome.desktop"]; + # # Files + # "inode/directory" = ["thunar.desktop"]; # file manager + # "text/plain" = ["nvim.desktop"]; # or code.desktop + # }; + terminal = "kitty"; # Set Default System Terminal keyboardLayout = "us"; keyboardVariant = ""; diff --git a/install-zaneyos.sh b/install-zaneyos.sh index b49146b..657492d 100755 --- a/install-zaneyos.sh +++ b/install-zaneyos.sh @@ -138,24 +138,51 @@ has_nvidia=false has_intel=false has_amd=false has_vm=false +detect_vm() { + if command -v systemd-detect-virt &>/dev/null; then + if systemd-detect-virt --quiet; then + return 0 + fi + fi + for f in /sys/class/dmi/id/product_name /sys/class/dmi/id/sys_vendor; do + if [ -r "$f" ] && grep -Eqi 'qemu|kvm|vmware|virtualbox|hyper-v|microsoft corporation|xen|parallels' "$f"; then + return 0 + fi + done + return 1 +} -if lspci | grep -qi 'vga\|3d'; then +if detect_vm; then + has_vm=true +fi + +if lspci | grep -qi 'vga\|3d\|display'; then while read -r line; do - if echo "$line" | grep -qi 'nvidia'; then + if echo "$line" | grep -Eq '\[10de:'; then has_nvidia=true - elif echo "$line" | grep -qi 'amd'; then + elif echo "$line" | grep -Eq '\[1002:'; then + has_amd=true + elif echo "$line" | grep -Eq '\[8086:'; then + has_intel=true + elif echo "$line" | grep -Eq '\[(1af4|15ad|80ee|1b36|1414|1234|1013):'; then + has_vm=true + elif echo "$line" | grep -qi 'nvidia'; then + has_nvidia=true + elif echo "$line" | grep -qi 'amd\|ati\|advanced micro devices'; then has_amd=true elif echo "$line" | grep -qi 'intel'; then has_intel=true - elif echo "$line" | grep -qi 'virtio\|vmware'; then + elif echo "$line" | grep -Eqi 'virtio|vmware|virtualbox|qxl|hyper-v|microsoft corporation|parallels|qemu|bochs|cirrus|svga|virtual'; then has_vm=true fi - done < <(lspci | grep -i 'vga\|3d') + done < <(lspci -nn | grep -i 'vga\|3d\|display') if $has_vm; then DETECTED_PROFILE="vm" + elif $has_nvidia && $has_amd; then + DETECTED_PROFILE="amd-nvidia-hybrid" elif $has_nvidia && $has_intel; then - DETECTED_PROFILE="hybrid" + DETECTED_PROFILE="nvidia-laptop" elif $has_nvidia; then DETECTED_PROFILE="nvidia" elif $has_amd; then @@ -183,9 +210,10 @@ if [ -z "$profile" ]; then read -rp "Enter Your Hardware Profile (GPU) Options: [ amd ] +amd-nvidia-hybrid +intel nvidia nvidia-laptop -intel vm Please type out your choice: " profile if [ -z "$profile" ]; then @@ -291,12 +319,38 @@ print_header "Keyboard Variant Configuration" # Suggest a variant when user typed a variant-like layout variant_suggestion="" case "$keyboardLayout" in - dvorak|colemak|workman|intl|us-intl) - variant_suggestion="$keyboardLayout";; - *) ;; +dvorak | colemak | workman | intl | us-intl) + variant_suggestion="$keyboardLayout" + ;; +*) ;; esac read -rp "Enter your keyboard variant (e.g., dvorak) [ $variant_suggestion ]: " keyboardVariant keyboardVariant="${keyboardVariant:-$variant_suggestion}" + +# Normalize layout/variant to avoid accidentally forcing US for non-US layouts +# - Accept uppercase inputs; treat BR/DE/FR/ES/IT/RU/UK in variant field as layout +# - Map us-intl/intl and dvorak/colemak/workman to layout=us + appropriate variant +keyboardLayout=$(echo "$keyboardLayout" | tr '[:upper:]' '[:lower:]') +keyboardVariant=$(echo "$keyboardVariant" | tr '[:upper:]' '[:lower:]') + +case "$keyboardLayout" in +us-intl | intl) + keyboardLayout="us" + if [ -z "$keyboardVariant" ]; then keyboardVariant="intl"; fi + ;; +dvorak | colemak | workman) + if [ -z "$keyboardVariant" ]; then keyboardVariant="$keyboardLayout"; fi + keyboardLayout="us" + ;; +*) ;; +esac + +# If a layout accidentally ended up in the variant field, fix it +if [[ "$keyboardVariant" =~ ^(us|br|de|fr|es|it|ru|uk)$ ]]; then + keyboardLayout="$keyboardVariant" + keyboardVariant="" +fi + if [ -z "$keyboardVariant" ]; then echo -e "${GREEN}✓ Keyboard variant set to: none${NC}" else @@ -362,23 +416,23 @@ rm ./flake.nix.bak # Update timezone in system.nix cp ./modules/core/system.nix ./modules/core/system.nix.bak -awk -v newtz="$timezone" '/^ time\.timeZone = / { sub(/"[^"]*"/, "\"" newtz "\""); } { print }' ./modules/core/system.nix.bak > ./modules/core/system.nix +awk -v newtz="$timezone" '/^ time\.timeZone = / { sub(/"[^"]*"/, "\"" newtz "\""); } { print }' ./modules/core/system.nix.bak >./modules/core/system.nix rm ./modules/core/system.nix.bak # Update variables in host file (do all keys in one pass to avoid quoting issues) cp ./hosts/$hostName/variables.nix ./hosts/$hostName/variables.nix.bak awk -v v_user="$gitUsername" \ - -v v_email="$gitEmail" \ - -v v_kb="$keyboardLayout" \ - -v v_kv="$keyboardVariant" \ - -v v_ckm="$consoleKeyMap" ' + -v v_email="$gitEmail" \ + -v v_kb="$keyboardLayout" \ + -v v_kv="$keyboardVariant" \ + -v v_ckm="$consoleKeyMap" ' /^ gitUsername = / { sub(/"[^"]*"/, "\"" v_user "\"") } /^ gitEmail = / { sub(/"[^"]*"/, "\"" v_email "\"") } /^ keyboardLayout = / { sub(/"[^"]*"/, "\"" v_kb "\"") } /^ keyboardVariant = / { sub(/"[^"]*"/, "\"" v_kv "\"") } /^ consoleKeyMap = / { sub(/"[^"]*"/, "\"" v_ckm "\"") } { print } -' ./hosts/$hostName/variables.nix.bak > ./hosts/$hostName/variables.nix +' ./hosts/$hostName/variables.nix.bak >./hosts/$hostName/variables.nix rm ./hosts/$hostName/variables.nix.bak echo "Configuration files updated successfully!" diff --git a/modules/core/boot.nix b/modules/core/boot.nix index 61095d3..51a5da5 100644 --- a/modules/core/boot.nix +++ b/modules/core/boot.nix @@ -1,11 +1,13 @@ -{ pkgs, config, ... }: - { + pkgs, + config, + ... +}: { boot = { - kernelPackages = pkgs.linuxPackages_zen; - kernelModules = [ "v4l2loopback" ]; - extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; - kernel.sysctl = { "vm.max_map_count" = 2147483642; }; + kernelPackages = pkgs.linuxPackages_latest; + kernelModules = ["v4l2loopback"]; + extraModulePackages = [config.boot.kernelPackages.v4l2loopback]; + kernel.sysctl = {"vm.max_map_count" = 2147483642;}; loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; # Appimage Support diff --git a/modules/core/cachix.nix b/modules/core/cachix.nix index 2465f0b..df7a1a6 100644 --- a/modules/core/cachix.nix +++ b/modules/core/cachix.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{lib, ...}: { nix.settings = { substituters = lib.mkAfter [ "https://cache.nixos.org" diff --git a/modules/core/default.nix b/modules/core/default.nix index a203d1a..fc6f714 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -2,12 +2,10 @@ inputs, host, ... -}: -let +}: let # Import the host-specific variables.nix vars = import ../../hosts/${host}/variables.nix; -in -{ +in { imports = [ ./boot.nix ./flatpak.nix @@ -20,7 +18,11 @@ in ./packages.nix ./printing.nix # Conditionally import the display manager module - (if vars.displayManager == "tui" then ./greetd.nix else ./sddm.nix) + ( + if vars.displayManager == "tui" + then ./ly.nix + else ./sddm.nix + ) ./security.nix ./services.nix ./steam.nix diff --git a/modules/core/flatpak.nix b/modules/core/flatpak.nix index 9c8692c..2862127 100644 --- a/modules/core/flatpak.nix +++ b/modules/core/flatpak.nix @@ -1,8 +1,8 @@ -{ pkgs, ... }: { +{pkgs, ...}: { xdg.portal = { enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - configPackages = [ pkgs.hyprland ]; + extraPortals = [pkgs.xdg-desktop-portal-hyprland]; + configPackages = [pkgs.hyprland]; }; services = { flatpak = { @@ -15,7 +15,7 @@ #"com.github.tchx84.Flatseal" #Manage flatpak permissions - should always have this #"com.rtosta.zapzap" # WhatsApp client #"io.github.flattool.Warehouse" # Manage flatpaks, clean data, remove flatpaks and deps - #"it.mijorus.gearlever" # Manage and support AppImages + #"it.mijorus.gearlever" # Manage and support AppImages #"io.github.freedoom.Phase1" # Classic Doom FPS 1 #"io.github.freedoom.Phase2" # Classic Doom FPS 2 #"io.github.dvlv.boxbuddyrs" # Manage distroboxes diff --git a/modules/core/fonts.nix b/modules/core/fonts.nix index 7f278bd..22b9e78 100644 --- a/modules/core/fonts.nix +++ b/modules/core/fonts.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { fonts = { packages = with pkgs; [ dejavu_fonts @@ -15,6 +14,11 @@ minecraftia nerd-fonts.im-writing nerd-fonts.blex-mono + nerd-fonts.iosevka-term + nerd-fonts.lilex + nerd-fonts.ubuntu + nerd-fonts.jetbrains-mono + nerd-fonts.fira-mono noto-fonts noto-fonts-color-emoji noto-fonts-cjk-sans diff --git a/modules/core/greetd.nix b/modules/core/greetd.nix index 1cd2c47..cb59b68 100644 --- a/modules/core/greetd.nix +++ b/modules/core/greetd.nix @@ -1,6 +1,7 @@ -{ pkgs -, username -, ... +{ + pkgs, + username, + ... }: { services.greetd = { enable = true; diff --git a/modules/core/hardware.nix b/modules/core/hardware.nix index 5c6ec61..f34c74d 100644 --- a/modules/core/hardware.nix +++ b/modules/core/hardware.nix @@ -1,10 +1,9 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { hardware = { sane = { enable = true; - extraBackends = [ pkgs.sane-airscan ]; - disabledDefaultBackends = [ "escl" ]; + extraBackends = [pkgs.sane-airscan]; + disabledDefaultBackends = ["escl"]; }; logitech.wireless.enable = false; logitech.wireless.enableGraphical = false; diff --git a/modules/core/ly.nix b/modules/core/ly.nix new file mode 100644 index 0000000..e50fb41 --- /dev/null +++ b/modules/core/ly.nix @@ -0,0 +1,33 @@ +{ + host, + lib, + ... +}: let + # Import the host-specific variables.nix + vars = import ../../hosts/${host}/variables.nix; + useLy = vars.displayManager == "tui"; +in { + config = lib.mkIf useLy { + # Prefer ly when TUI is selected; avoid greetd conflicts + services.greetd.enable = lib.mkDefault false; + + services.displayManager.ly = { + enable = true; + settings = { + animation = "matrix"; + bigclock = true; + # --- Color Settings (0xAARRGGBB) --- + # Background color of dialog box (Black) + bg = "0x00000000"; + # Foreground text color (Cyan: #00FFFF) + fg = "0x0000FFFF"; + # Border color (Red: #FF0000) + border_fg = "0x00FF0000"; + # Error message color (Red) + error_fg = "0x00FF0000"; + # Clock color (Purple: #800080) + clock_color = "#800080"; + }; + }; + }; +} diff --git a/modules/core/network.nix b/modules/core/network.nix index 132d9bc..325f7a0 100644 --- a/modules/core/network.nix +++ b/modules/core/network.nix @@ -1,17 +1,16 @@ -{ pkgs -, host -, options -, ... -}: -let - inherit (import ../../hosts/${host}/variables.nix) hostId; -in { + pkgs, + host, + options, + ... +}: let + inherit (import ../../hosts/${host}/variables.nix) hostId; +in { networking = { hostName = "${host}"; hostId = hostId; networkmanager.enable = true; - timeServers = options.networking.timeServers.default ++ [ "pool.ntp.org" ]; + timeServers = options.networking.timeServers.default ++ ["pool.ntp.org"]; firewall = { enable = true; allowedTCPPorts = [ @@ -29,5 +28,5 @@ in }; }; - environment.systemPackages = with pkgs; [ networkmanagerapplet ]; + environment.systemPackages = with pkgs; [networkmanagerapplet]; } diff --git a/modules/core/nfs.nix b/modules/core/nfs.nix index 7999158..adbcde8 100644 --- a/modules/core/nfs.nix +++ b/modules/core/nfs.nix @@ -1,8 +1,6 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../hosts/${host}/variables.nix) enableNFS; -in -{ +in { services = { rpcbind.enable = enableNFS; nfs.server.enable = enableNFS; diff --git a/modules/core/nh.nix b/modules/core/nh.nix index ce9304b..4785056 100644 --- a/modules/core/nh.nix +++ b/modules/core/nh.nix @@ -1,6 +1,7 @@ -{ pkgs -, username -, ... +{ + pkgs, + username, + ... }: { programs.nh = { enable = true; diff --git a/modules/core/overlays.nix b/modules/core/overlays.nix index ee53195..1f473aa 100644 --- a/modules/core/overlays.nix +++ b/modules/core/overlays.nix @@ -1,6 +1,14 @@ -{ inputs, ... }: { +{inputs, ...}: { nixpkgs.overlays = [ # Provide pkgs.google-antigravity via antigravity-nix overlay inputs.antigravity-nix.overlays.default + # Build tumbler without EPUB thumbnailer (libgepub) to avoid webkitgtk + (_final: prev: { + xfce = prev.xfce // { + tumbler = prev.xfce.tumbler.overrideAttrs (old: { + buildInputs = prev.lib.remove prev.libgepub old.buildInputs; + }); + }; + }) ]; } diff --git a/modules/core/packages.nix b/modules/core/packages.nix index 548c914..5c7a7a9 100644 --- a/modules/core/packages.nix +++ b/modules/core/packages.nix @@ -1,4 +1,5 @@ { + inputs, pkgs, host, ... @@ -12,6 +13,7 @@ with pkgs; [ matugen # color palette generator needed for noctalia-shell app2unit # launcher for noctalia-shell + gpu-screen-recorder # needed for nnoctalia-shell ] else []; in { @@ -29,7 +31,6 @@ in { seahorse.enable = true; fuse.userAllowOther = true; mtr.enable = true; - adb.enable = true; hyprlock.enable = true; gnupg.agent = { enable = true; @@ -38,10 +39,15 @@ in { }; nixpkgs.config.allowUnfree = true; + nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ]; environment.systemPackages = with pkgs; - noctaliaPkgs + [ + inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.awww + ] + ++ noctaliaPkgs ++ [ + alejandra # nix formatter amfora # Fancy Terminal Browser For Gemini Protocol appimage-run # Needed For AppImage Support brave # Brave Browser @@ -49,16 +55,14 @@ in { cliphist # Clipboard manager using rofi menu cmatrix # Matrix Movie Effect In Terminal cowsay # Great Fun Terminal Program - discord # Stable client - discord-canary # beta client docker-compose # Allows Controlling Docker From A Single File duf # Utility For Viewing Disk Usage In Terminal dysk # Disk space util nice formattting eza # Beautiful ls Replacement ffmpeg # Terminal Video / Audio Editing file-roller # Archive Manager - gedit # Simple Graphical Text Editor - gemini-cli # CLI AI client ONLY (optional) + gearlever # Manage / run Appimages + icu # dep for gearlever gimp # Great Photo Editor gpu-screen-recorder # needed for nnoctalia-shell power-profiles-daemon # needed for noctalia-shell power cycle @@ -75,8 +79,11 @@ in { mdcat # CLI markdown parser mpv # Incredible Video Player ncdu # Disk Usage Analyzer With Ncurses Interface - nixfmt-rfc-style # Nix Formatter + nixfmt # Nix Formatter nwg-displays # configure monitor configs via GUI + nwg-drawer # Application launcher for wayland + nwg-dock-hyprland # Dock for hyprland + nwg-menu # App menu for waybar onefetch # provides zsaneyos build info on current system pandoc # format MD to HTML for cheatsheet parser pavucontrol # For Editing Audio Levels & Devices @@ -93,9 +100,9 @@ in { upower # noctalia shell battery uwsm # Universal Wayland Session Manager (optional must be enabled) v4l-utils # Used For Things Like OBS Virtual Camera - warp-terminal # Terminal with AI support build in waypaper # Change wallpaper wget # Tool For Fetching Files With Links ytmdl # Tool For Downloading Audio From YouTube + python3 # Python 3 programming language ]; } diff --git a/modules/core/printing.nix b/modules/core/printing.nix index a6d5e1b..982126f 100644 --- a/modules/core/printing.nix +++ b/modules/core/printing.nix @@ -1,8 +1,6 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../hosts/${host}/variables.nix) printEnable; -in -{ +in { services = { printing = { enable = printEnable; diff --git a/modules/core/quickshell.nix b/modules/core/quickshell.nix index 32e8f22..1eaee7c 100644 --- a/modules/core/quickshell.nix +++ b/modules/core/quickshell.nix @@ -1,31 +1,34 @@ -{ pkgs, inputs, ... }: -{ - environment.systemPackages = with pkgs; [ - inputs.quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default - - # Qt6 related kits(for slove Qt5Compat problem) - qt6.qt5compat - qt6.qtbase - qt6.qtquick3d - qt6.qtwayland - qt6.qtdeclarative - qt6.qtsvg - - # alternate options - # libsForQt5.qt5compat - kdePackages.qt5compat - libsForQt5.qt5.qtgraphicaleffects - ]; - - # necessary environment variables - environment.variables = { - QML_IMPORT_PATH = "${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtbase}/lib/qt-6/qml"; - QML2_IMPORT_PATH = "${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtbase}/lib/qt-6/qml"; - }; - - # make sure the Qt application is working properly - environment.sessionVariables = { - QT_QPA_PLATFORM = "wayland;xcb"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; - }; -} +{ + pkgs, + inputs, + ... +}: { + environment.systemPackages = with pkgs; [ + quickshell + + # Qt6 related kits(for slove Qt5Compat problem) + qt6.qt5compat + qt6.qtbase + qt6.qtquick3d + qt6.qtwayland + qt6.qtdeclarative + qt6.qtsvg + + # alternate options + # libsForQt5.qt5compat + kdePackages.qt5compat + libsForQt5.qt5.qtgraphicaleffects + ]; + + # necessary environment variables + environment.variables = { + QML_IMPORT_PATH = "${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtbase}/lib/qt-6/qml"; + QML2_IMPORT_PATH = "${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtbase}/lib/qt-6/qml"; + }; + + # make sure the Qt application is working properly + environment.sessionVariables = { + QT_QPA_PLATFORM = "wayland;xcb"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + }; +} diff --git a/modules/core/sddm.nix b/modules/core/sddm.nix index 2034987..c173803 100644 --- a/modules/core/sddm.nix +++ b/modules/core/sddm.nix @@ -65,7 +65,7 @@ in { services.displayManager = { sddm = { package = pkgs.kdePackages.sddm; - extraPackages = [ sddm-astronaut ]; + extraPackages = [sddm-astronaut]; enable = true; wayland.enable = true; theme = "sddm-astronaut-theme"; @@ -87,8 +87,8 @@ in { vars = import ../../hosts/${host}/variables.nix; keyboardLayout = vars.keyboardLayout or "us"; keyboardVariant = vars.keyboardVariant or ""; - in ({ XKB_DEFAULT_LAYOUT = keyboardLayout; } - // lib.optionalAttrs (keyboardVariant != "") { XKB_DEFAULT_VARIANT = keyboardVariant; }); + in ({XKB_DEFAULT_LAYOUT = keyboardLayout;} + // lib.optionalAttrs (keyboardVariant != "") {XKB_DEFAULT_VARIANT = keyboardVariant;}); - environment.systemPackages = [ sddm-astronaut ]; + environment.systemPackages = [sddm-astronaut]; } diff --git a/modules/core/services.nix b/modules/core/services.nix index 6705142..caf5798 100644 --- a/modules/core/services.nix +++ b/modules/core/services.nix @@ -1,4 +1,4 @@ -{ profile, ... }: { +{profile, ...}: { # Services to start services = { upower.enable = true; # noctalia shell battery @@ -13,7 +13,7 @@ PasswordAuthentication = true; #Users can SSH using kb and password KbdInteractiveAuthentication = true; }; - ports = [ 22 ]; + ports = [22]; }; blueman.enable = true; # Bluetooth Support tumbler.enable = true; # Image/video preview diff --git a/modules/core/starfish.nix b/modules/core/starfish.nix index 48564f1..bffc1aa 100644 --- a/modules/core/starfish.nix +++ b/modules/core/starfish.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { programs = { starship = { enable = false; diff --git a/modules/core/steam.nix b/modules/core/steam.nix index cb8a5a5..84829ec 100644 --- a/modules/core/steam.nix +++ b/modules/core/steam.nix @@ -1,11 +1,11 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs = { steam = { - enable = true; + enable = false; remotePlay.openFirewall = true; dedicatedServer.openFirewall = false; gamescopeSession.enable = true; - extraCompatPackages = [ pkgs.proton-ge-bin ]; + extraCompatPackages = [pkgs.proton-ge-bin]; }; gamescope = { diff --git a/modules/core/stylix.nix b/modules/core/stylix.nix index 800d070..3ed5d35 100644 --- a/modules/core/stylix.nix +++ b/modules/core/stylix.nix @@ -1,11 +1,10 @@ -{ pkgs -, host -, ... -}: -let - inherit (import ../../hosts/${host}/variables.nix) stylixImage; -in { + pkgs, + host, + ... +}: let + inherit (import ../../hosts/${host}/variables.nix) stylixImage; +in { # Styling Options stylix = { enable = true; diff --git a/modules/core/syncthing.nix b/modules/core/syncthing.nix index b214716..b374c5c 100644 --- a/modules/core/syncthing.nix +++ b/modules/core/syncthing.nix @@ -1,4 +1,4 @@ -{ username, ... }: { +{username, ...}: { services.syncthing = { enable = false; user = "${username}"; diff --git a/modules/core/system.nix b/modules/core/system.nix index bc2dbb8..d728615 100644 --- a/modules/core/system.nix +++ b/modules/core/system.nix @@ -29,7 +29,7 @@ in { }; environment.variables = { NIXOS_OZONE_WL = "1"; - ZANEYOS_VERSION = "2.5.4"; + ZANEYOS_VERSION = "2.6.1"; ZANEYOS = "true"; }; console.keyMap = "${consoleKeyMap}"; diff --git a/modules/core/thunar.nix b/modules/core/thunar.nix index ea1229b..9c82ac5 100644 --- a/modules/core/thunar.nix +++ b/modules/core/thunar.nix @@ -1,17 +1,16 @@ -{ host -, pkgs -, ... -}: -let - inherit (import ../../hosts/${host}/variables.nix) thunarEnable; -in { + host, + pkgs, + ... +}: let + inherit (import ../../hosts/${host}/variables.nix) thunarEnable; +in { programs = { thunar = { enable = thunarEnable; - plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-volman + plugins = [ + pkgs.thunar-archive-plugin + pkgs.thunar-volman ]; }; }; diff --git a/modules/core/user.nix b/modules/core/user.nix index cc2d268..a292018 100644 --- a/modules/core/user.nix +++ b/modules/core/user.nix @@ -1,22 +1,21 @@ -{ pkgs -, inputs -, username -, host -, profile -, ... -}: -let - inherit (import ../../hosts/${host}/variables.nix) gitUsername; -in { - imports = [ inputs.home-manager.nixosModules.home-manager ]; + pkgs, + inputs, + username, + host, + profile, + ... +}: let + inherit (import ../../hosts/${host}/variables.nix) gitUsername; +in { + imports = [inputs.home-manager.nixosModules.home-manager]; home-manager = { useUserPackages = true; useGlobalPkgs = false; backupFileExtension = "backup"; - extraSpecialArgs = { inherit inputs username host profile pkgs; }; + extraSpecialArgs = {inherit inputs username host profile pkgs;}; users.${username} = { - imports = [ ./../home ]; + imports = [./../home]; home = { username = "${username}"; homeDirectory = "/home/${username}"; @@ -35,11 +34,11 @@ in "lp" "networkmanager" "scanner" - "wheel" #subdo access + "wheel" #sudo access "vboxusers" #Virtual Box ]; shell = pkgs.zsh; ignoreShellProgramCheck = true; }; - nix.settings.allowed-users = [ "${username}" ]; + nix.settings.allowed-users = ["${username}"]; } diff --git a/modules/core/virtualisation.nix b/modules/core/virtualisation.nix index 09fd5dd..e7023e8 100644 --- a/modules/core/virtualisation.nix +++ b/modules/core/virtualisation.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { # Only enable either docker or podman -- Not both virtualisation = { docker = { diff --git a/modules/core/xserver.nix b/modules/core/xserver.nix index dab29e3..98f88e7 100644 --- a/modules/core/xserver.nix +++ b/modules/core/xserver.nix @@ -1,13 +1,40 @@ -{ host, ... }: -let +{host, ...}: let vars = import ../../hosts/${host}/variables.nix; keyboardLayout = vars.keyboardLayout or "us"; keyboardVariant = vars.keyboardVariant or ""; - layoutIsVariant = builtins.elem keyboardLayout [ "dvorak" "colemak" "workman" "intl" "us-intl" ]; - xkbLayout = if (keyboardVariant != "" || layoutIsVariant) then "us" else keyboardLayout; - xkbVariant = if (keyboardVariant != "") then keyboardVariant else if layoutIsVariant then keyboardLayout else ""; -in -{ + + # Treat only known US-based variants as implying layout = "us". + usVariants = ["dvorak" "colemak" "workman" "intl" "us-intl" "altgr-intl"]; + normalizeUSVariant = v: + if v == "us-intl" + then "intl" + else v; + + # If layout itself is a US variant (e.g., "dvorak", "us-intl"), normalize it + layoutFromLayout = + if builtins.elem keyboardLayout usVariants + then "us" + else keyboardLayout; + variantFromLayout = + if builtins.elem keyboardLayout usVariants + then normalizeUSVariant keyboardLayout + else ""; + + # If the provided variant is a US variant, force layout to us; otherwise keep layout + layoutFromVariant = + if builtins.elem keyboardVariant usVariants + then "us" + else layoutFromLayout; + variantFinal = + if builtins.elem keyboardVariant usVariants + then normalizeUSVariant keyboardVariant + else if variantFromLayout != "" + then variantFromLayout + else keyboardVariant; + + xkbLayout = layoutFromVariant; + xkbVariant = variantFinal; +in { services.xserver = { enable = false; xkb = { diff --git a/modules/drivers/amd-drivers.nix b/modules/drivers/amd-drivers.nix index b0a51dd..e745302 100644 --- a/modules/drivers/amd-drivers.nix +++ b/modules/drivers/amd-drivers.nix @@ -1,19 +1,18 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; -let - cfg = config.drivers.amdgpu; -in { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.drivers.amdgpu; +in { options.drivers.amdgpu = { enable = mkEnableOption "Enable AMD Drivers"; }; config = mkIf cfg.enable { - systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ]; - services.xserver.videoDrivers = [ "amdgpu" ]; + systemd.tmpfiles.rules = ["L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"]; + services.xserver.videoDrivers = ["amdgpu"]; }; } diff --git a/modules/drivers/default.nix b/modules/drivers/default.nix index b966b93..fef514c 100644 --- a/modules/drivers/default.nix +++ b/modules/drivers/default.nix @@ -1,6 +1,4 @@ -{ ... -}: -{ +{...}: { imports = [ ./amd-drivers.nix ./intel-drivers.nix diff --git a/modules/drivers/intel-drivers.nix b/modules/drivers/intel-drivers.nix index 337e4f6..907f54d 100644 --- a/modules/drivers/intel-drivers.nix +++ b/modules/drivers/intel-drivers.nix @@ -1,12 +1,12 @@ -{ lib -, pkgs -, config -, ... +{ + lib, + pkgs, + config, + ... }: with lib; let cfg = config.drivers.intel; -in -{ +in { options.drivers.intel = { enable = mkEnableOption "Enable Intel Graphics Drivers"; }; @@ -19,6 +19,7 @@ in intel-vaapi-driver libva-vdpau-driver libvdpau-va-gl + vpl-gpu-rt ]; }; }; diff --git a/modules/drivers/local-hardware-clock.nix b/modules/drivers/local-hardware-clock.nix index cf4e73f..1ebc431 100644 --- a/modules/drivers/local-hardware-clock.nix +++ b/modules/drivers/local-hardware-clock.nix @@ -1,16 +1,15 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; -let - cfg = config.local.hardware-clock; -in { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.local.hardware-clock; +in { options.local.hardware-clock = { enable = mkEnableOption "Change Hardware Clock To Local Time"; }; - config = mkIf cfg.enable { time.hardwareClockInLocalTime = true; }; + config = mkIf cfg.enable {time.hardwareClockInLocalTime = true;}; } diff --git a/modules/drivers/nvidia-amd-hybrid.nix b/modules/drivers/nvidia-amd-hybrid.nix index b81b10d..4bc78b6 100644 --- a/modules/drivers/nvidia-amd-hybrid.nix +++ b/modules/drivers/nvidia-amd-hybrid.nix @@ -1,30 +1,34 @@ -{ config, lib, pkgs, ... }: - +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.drivers.nvidia-amd-hybrid; -in -{ +in { options.drivers.nvidia-amd-hybrid = { enable = mkEnableOption "Enable AMD iGPU + NVIDIA dGPU (Prime offload)"; # AMD iGPU Bus ID (e.g., PCI:5:0:0). Expose as option for future host wiring. - amdgpuBusID = mkOption { + amdgpuBusId = mkOption { type = types.str; default = "PCI:5:0:0"; - description = "PCI Bus ID for AMD iGPU (amdgpuBusId)"; + description = "PCI Bus ID for AMD iGPU"; }; # NVIDIA dGPU Bus ID (e.g., PCI:1:0:0) - nvidiaBusID = mkOption { + nvidiaBusId = mkOption { type = types.str; default = "PCI:1:0:0"; - description = "PCI Bus ID for NVIDIA dGPU (nvidiaBusId)"; + description = "PCI Bus ID for NVIDIA dGPU"; }; }; config = mkIf cfg.enable { # Enforce kernel 6.12 when this hybrid config is selected - boot.kernelPackages = lib.mkForce pkgs.linuxPackages_6_12; + # Not sure this is still neeeded but leaving just in case + # boot.kernelPackages = lib.mkForce pkgs.linuxPackages_6_12; - services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { modesetting.enable = true; @@ -44,8 +48,8 @@ in }; # Wire from options - amdgpuBusId = cfg.amdgpuBusID; - nvidiaBusId = cfg.nvidiaBusID; + amdgpuBusId = cfg.amdgpuBusId; + nvidiaBusId = cfg.nvidiaBusId; }; }; }; diff --git a/modules/drivers/nvidia-drivers.nix b/modules/drivers/nvidia-drivers.nix index 2c30be9..0d395fc 100644 --- a/modules/drivers/nvidia-drivers.nix +++ b/modules/drivers/nvidia-drivers.nix @@ -1,19 +1,18 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; -let - cfg = config.drivers.nvidia; -in { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.drivers.nvidia; +in { options.drivers.nvidia = { enable = mkEnableOption "Enable Nvidia Drivers"; }; config = mkIf cfg.enable { - services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { # Modesetting is required. modesetting.enable = true; diff --git a/modules/drivers/nvidia-prime-drivers.nix b/modules/drivers/nvidia-prime-drivers.nix index 147df1a..559a35e 100644 --- a/modules/drivers/nvidia-prime-drivers.nix +++ b/modules/drivers/nvidia-prime-drivers.nix @@ -1,13 +1,12 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; -let - cfg = config.drivers.nvidia-prime; -in { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.drivers.nvidia-prime; +in { options.drivers.nvidia-prime = { enable = mkEnableOption "Enable Nvidia Prime Hybrid GPU Offload"; intelBusID = mkOption { diff --git a/modules/drivers/vm-guest-services.nix b/modules/drivers/vm-guest-services.nix index 778bcf3..3c2895d 100644 --- a/modules/drivers/vm-guest-services.nix +++ b/modules/drivers/vm-guest-services.nix @@ -1,13 +1,12 @@ -{ lib -, pkgs -, config -, ... -}: -with lib; -let - cfg = config.vm.guest-services; -in { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.vm.guest-services; +in { options.vm.guest-services = { enable = mkEnableOption "Enable Virtual Machine Guest Services"; }; @@ -15,6 +14,6 @@ in config = mkIf cfg.enable { services.qemuGuest.enable = true; services.spice-vdagentd.enable = true; - services.spice-webdavd.enable = false; #Causes build failure davsfs2 unsupported neon version 9-12-25 + services.spice-webdavd.enable = false; #Causes build failure davsfs2 unsupported neon version 9-12-25 }; } diff --git a/modules/home/bash.nix b/modules/home/bash.nix index 0712618..ba4de54 100644 --- a/modules/home/bash.nix +++ b/modules/home/bash.nix @@ -1,4 +1,4 @@ -{ profile, ... }: { +{profile, ...}: { programs.bash = { enable = false; enableCompletion = true; diff --git a/modules/home/bashrc-personal.nix b/modules/home/bashrc-personal.nix index 386597b..6b5e732 100644 --- a/modules/home/bashrc-personal.nix +++ b/modules/home/bashrc-personal.nix @@ -1,20 +1,20 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ bash ]; +{pkgs, ...}: { + home.packages = with pkgs; [bash]; home.file."./.bashrc-personal".text = '' - # This file allows you to define your own aliases, functions, etc - # below are just some examples of what you can use this file for - - #!/usr/bin/env bash - # Set defaults - # - #export EDITOR="nvim" - #export VISUAL="nvim" - - #alias c="clear" - #eval "$(zoxide init bash)" - #eval "$(oh-my-posh init bash --config $HOME/.config/powerlevel10k_rainbow.omp.json)" + # This file allows you to define your own aliases, functions, etc + # below are just some examples of what you can use this file for + + #!/usr/bin/env bash + # Set defaults + # + #export EDITOR="nvim" + #export VISUAL="nvim" + + #alias c="clear" + #eval "$(zoxide init bash)" + #eval "$(oh-my-posh init bash --config $HOME/.config/powerlevel10k_rainbow.omp.json)" ''; } diff --git a/modules/home/cli/bat.nix b/modules/home/cli/bat.nix index d63242a..898b65a 100644 --- a/modules/home/cli/bat.nix +++ b/modules/home/cli/bat.nix @@ -1,6 +1,7 @@ -{ pkgs -, lib -, ... +{ + pkgs, + lib, + ... }: { programs.bat = { enable = true; diff --git a/modules/home/cli/bottom.nix b/modules/home/cli/bottom.nix index 3b24f84..63814fc 100644 --- a/modules/home/cli/bottom.nix +++ b/modules/home/cli/bottom.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { programs.bottom = { enable = true; settings = { @@ -9,14 +9,14 @@ { ratio = 2; child = [ - { type = "cpu"; } - { type = "temp"; } + {type = "cpu";} + {type = "temp";} ]; } { ratio = 2; child = [ - { type = "network"; } + {type = "network";} ]; } { diff --git a/modules/home/cli/btop.nix b/modules/home/cli/btop.nix index 0f20db1..845d758 100644 --- a/modules/home/cli/btop.nix +++ b/modules/home/cli/btop.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.btop = { enable = true; package = pkgs.btop.override { diff --git a/modules/home/cli/cava.nix b/modules/home/cli/cava.nix index e3c23cd..31a700f 100644 --- a/modules/home/cli/cava.nix +++ b/modules/home/cli/cava.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { programs.cava = { enable = true; settings = { diff --git a/modules/home/cli/fzf.nix b/modules/home/cli/fzf.nix index 0100ad8..030b44c 100644 --- a/modules/home/cli/fzf.nix +++ b/modules/home/cli/fzf.nix @@ -1,14 +1,13 @@ # Fzf is a general-purpose command-line fuzzy finder. -{ config -, lib -, ... -}: -let +{ + config, + lib, + ... +}: let accent = "#" + config.lib.stylix.colors.base0D; foreground = "#" + config.lib.stylix.colors.base05; muted = "#" + config.lib.stylix.colors.base03; -in -{ +in { programs.fzf = { enable = true; enableZshIntegration = true; diff --git a/modules/home/cli/gh.nix b/modules/home/cli/gh.nix index 0df8cc3..dce545b 100644 --- a/modules/home/cli/gh.nix +++ b/modules/home/cli/gh.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { programs = { gh.enable = true; }; diff --git a/modules/home/cli/git.nix b/modules/home/cli/git.nix index 4d24e00..996b394 100644 --- a/modules/home/cli/git.nix +++ b/modules/home/cli/git.nix @@ -1,10 +1,9 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../../hosts/${host}/variables.nix) gitUsername gitEmail; -in -{ +in { programs.git = { enable = true; + signing.format = null; settings = { user = { diff --git a/modules/home/cli/htop.nix b/modules/home/cli/htop.nix index 263697b..bdc77b4 100644 --- a/modules/home/cli/htop.nix +++ b/modules/home/cli/htop.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { programs.htop = { enable = true; settings = @@ -25,18 +25,18 @@ highlight_threads = 1; } // (with config.lib.htop; - leftMeters [ - (bar "AllCPUs2") - (bar "Memory") - (bar "Swap") - (text "Zram") - ]) + leftMeters [ + (bar "AllCPUs2") + (bar "Memory") + (bar "Swap") + (text "Zram") + ]) // (with config.lib.htop; - rightMeters [ - (text "Tasks") - (text "LoadAverage") - (text "Uptime") - (text "Systemd") - ]); + rightMeters [ + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + (text "Systemd") + ]); }; } diff --git a/modules/home/cli/lazygit.nix b/modules/home/cli/lazygit.nix index 298c74d..942567d 100644 --- a/modules/home/cli/lazygit.nix +++ b/modules/home/cli/lazygit.nix @@ -1,10 +1,12 @@ # Lazygit is a simple terminal UI for git commands. -{ config, lib, ... }: -let +{ + config, + lib, + ... +}: let accent = "#${config.lib.stylix.colors.base0D}"; muted = "#${config.lib.stylix.colors.base03}"; -in -{ +in { programs.lazygit = { enable = true; settings = lib.mkForce { @@ -18,8 +20,8 @@ in }; gui = { theme = { - activeBorderColor = [ accent "bold" ]; - inactiveBorderColor = [ muted ]; + activeBorderColor = [accent "bold"]; + inactiveBorderColor = [muted]; }; showListFooter = false; showRandomTip = false; diff --git a/modules/home/default.nix b/modules/home/default.nix index f54576a..4b1a69f 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -25,6 +25,7 @@ in { ./bash.nix ./bashrc-personal.nix ./overview.nix + ./python.nix ./cli/bat.nix ./cli/btop.nix ./cli/bottom.nix @@ -57,7 +58,7 @@ in { ./wlogout ./xdg.nix ./yazi - ./zen-browser.nix + #./zen-browser.nix ./zoxide.nix ./zsh ] diff --git a/modules/home/editors/antigravity.nix b/modules/home/editors/antigravity.nix index 8d07ff4..c5dc963 100644 --- a/modules/home/editors/antigravity.nix +++ b/modules/home/editors/antigravity.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { # Google Antigravity IDE helper, exposed via antigravity-nix overlay as pkgs.google-antigravity home.packages = with pkgs; [ google-antigravity diff --git a/modules/home/editors/doom-emacs-install.nix b/modules/home/editors/doom-emacs-install.nix index dc45b0f..cdc48fa 100644 --- a/modules/home/editors/doom-emacs-install.nix +++ b/modules/home/editors/doom-emacs-install.nix @@ -1,12 +1,9 @@ -{ pkgs, ... }: - -let +{pkgs, ...}: let doom-icon = pkgs.fetchurl { url = "https://raw.githubusercontent.com/jeetelongname/doom-banners/master/splashes/doom/doom-emacs-color2.svg"; sha256 = "1xxi5ra1z8njsqaqiaq96wyn1sc967l42kvjzbji1zrjj8za6bgq"; }; -in -{ +in { # 1. Create a script to install Doom Emacs home.packages = [ (pkgs.writeShellScriptBin "get-doom" '' @@ -73,6 +70,6 @@ in icon = doom-icon; terminal = false; type = "Application"; - categories = [ "Development" "TextEditor" ]; + categories = ["Development" "TextEditor"]; }; } diff --git a/modules/home/editors/doom-emacs.nix b/modules/home/editors/doom-emacs.nix index ca1f248..8559a3f 100644 --- a/modules/home/editors/doom-emacs.nix +++ b/modules/home/editors/doom-emacs.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { home.packages = with pkgs; [ emacs-pgtk git diff --git a/modules/home/editors/evil-helix.nix b/modules/home/editors/evil-helix.nix index 911cca7..3204ffc 100644 --- a/modules/home/editors/evil-helix.nix +++ b/modules/home/editors/evil-helix.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let enableEvilHelix = true; # Set to true to enable the configuration -in -{ +in { home.packages = with pkgs; ( if enableEvilHelix then [ @@ -11,7 +9,8 @@ in jsonnet-language-server luaformatter lua-language-server - marksman + #marksman # causes dotnet and dotnet-swr to build which takes hours + multimarkdown taplo nil jq-lsp @@ -25,7 +24,7 @@ in docker-language-server typescript-language-server ] - else [ ] + else [] ); home.file.".config/helix/languages.toml".text = diff --git a/modules/home/editors/nixvim.nix b/modules/home/editors/nixvim.nix index be5243c..af1676d 100644 --- a/modules/home/editors/nixvim.nix +++ b/modules/home/editors/nixvim.nix @@ -44,6 +44,9 @@ settings = { flavour = "mocha"; transparent_background = false; + integrations = { + lualine = true; + }; }; }; @@ -53,7 +56,7 @@ lualine = { enable = true; settings = { - options = {theme = "catppuccin";}; + options = {theme = "auto";}; }; }; bufferline.enable = true; @@ -74,11 +77,16 @@ treesitter-context.enable = false; # Project management - project-nvim.enable = true; + project-nvim = { + enable = true; + settings = { + history.save_dir = "${config.home.homeDirectory}/.local/share/nvim/project_nvim"; + }; + }; # Notifications and UI polish notify.enable = true; - noice.enable = true; + noice.enable = false; # Startup dashboard alpha = { @@ -124,14 +132,38 @@ markdown-preview.enable = true; # Completion and snippets - cmp = { + blink-cmp = { enable = true; + settings = { + keymap = { + preset = "default"; + "" = ["accept" "fallback"]; + "" = ["select_next" "fallback"]; + "" = ["select_prev" "fallback"]; + }; + appearance = { + nerd_font_variant = "mono"; + }; + completion = { + documentation = { + auto_show = true; + auto_show_delay_ms = 500; + }; + }; + sources = { + default = ["lsp" "path" "snippets" "buffer"]; + }; + snippets = { + preset = "luasnip"; + }; + fuzzy = { + implementation = "prefer_rust_with_warning"; + }; + signature = { + enabled = true; + }; + }; }; - # Completion sources for LSP, buffer, path, and snippets - cmp-nvim-lsp.enable = true; - cmp-buffer.enable = true; - cmp-path.enable = true; - cmp_luasnip.enable = true; luasnip.enable = true; friendly-snippets.enable = true; @@ -150,8 +182,8 @@ html.enable = true; cssls.enable = true; clangd.enable = true; - zls.enable = true; - marksman.enable = true; + zls.enable = false; + marksman.enable = false; hyprls.enable = true; # hyprls is optional; keep tools available via extraPackages }; @@ -169,7 +201,7 @@ enable = true; settings = { formatters_by_ft = { - nix = ["nixpkgs_fmt"]; + nix = ["alejandra"]; lua = ["stylua"]; javascript = ["prettierd"]; typescript = ["prettierd"]; @@ -302,13 +334,14 @@ lazygit nil hyprls - nodePackages.typescript-language-server - nodePackages.typescript + typescript-language-server + typescript vscode-langservers-extracted pyright lua-language-server zls marksman + multimarkdown clang-tools prettierd stylua @@ -316,6 +349,8 @@ nixpkgs-fmt figlet toilet + bash-language-server + tailwindcss-language-server ]; # Diagnostic UI and notify background tweaks @@ -361,44 +396,6 @@ vim.notify = notify end - -- nvim-cmp setup: sources + mappings + snippet expansion - do - local ok_cmp, cmp = pcall(require, "cmp") - if ok_cmp then - local ok_snip, luasnip = pcall(require, "luasnip") - if ok_snip then - -- Load friendly-snippets lazily if available - pcall(function() - require("luasnip.loaders.from_vscode").lazy_load() - end) - end - cmp.setup({ - snippet = { - expand = function(args) - if ok_snip then luasnip.lsp_expand(args.body) end - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, { - { name = "path" }, - { name = "buffer" }, - }), - }) - -- nvim-cmp integration with nvim-autopairs (optional) - local ok_ap, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp") - if ok_ap then - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end - end - end -- Startup dashboard (alpha-nvim) do @@ -421,17 +418,18 @@ return #lines > 0 and lines or nil end - header_lines = gen_banner('toilet -f ansi-shadow NIXOS 2>/dev/null') - or gen_banner('figlet -f "ANSI Shadow" NIXOS 2>/dev/null') - or gen_banner('figlet NIXOS 2>/dev/null') + header_lines = gen_banner('toilet -f ansi-shadow NIXVIM 2>/dev/null') + or gen_banner('figlet -f "ANSI Shadow" NIXVIM 2>/dev/null') + or gen_banner('figlet NIXVIM 2>/dev/null') if not header_lines then header_lines = { - " _ _ ___ __ __ ___ ___ ____ ", - "| \\ | |_ _| \\ \\/ / / _ \\ / _ \\\ | _ \\ ", - "| \\| || | \\ / | | | | | | || | | |", - "| |\\ || | / \\ | |_| | |_| || |_| |", - "|_| \\_|___| /_/\\_\\ \\___/ \\___/ |____/ ", + "███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗", + "████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║", + "██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║", + "██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║", + "██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║", + "╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝", } end dashboard.section.header.val = header_lines @@ -462,4 +460,9 @@ end ''; }; + + home.activation.projectNvimHistory = '' + mkdir -p "$HOME/.local/share/nvim/project_nvim" + find "$HOME/.local/share/nvim/project_nvim" -type f -size 0 -delete 2>/dev/null || true + ''; } diff --git a/modules/home/editors/nvf.nix b/modules/home/editors/nvf.nix index 5ff7bd5..1c97a12 100644 --- a/modules/home/editors/nvf.nix +++ b/modules/home/editors/nvf.nix @@ -1,8 +1,9 @@ -{ inputs -, config -, ... +{ + inputs, + config, + ... }: { - imports = [ inputs.nvf.homeManagerModules.default ]; + imports = [inputs.nvf.homeManagerModules.default]; programs.nvf = { enable = true; @@ -50,55 +51,55 @@ keymaps = [ { key = "jk"; - mode = [ "i" ]; + mode = ["i"]; action = ""; desc = "Exit insert mode"; } { key = "nh"; - mode = [ "n" ]; + mode = ["n"]; action = ":nohl"; desc = "Clear search highlights"; } { key = "ff"; - mode = [ "n" ]; + mode = ["n"]; action = "Telescope find_files"; desc = "Search files by name"; } { key = "lg"; - mode = [ "n" ]; + mode = ["n"]; action = "Telescope live_grep"; desc = "Search files by contents"; } { key = "fe"; - mode = [ "n" ]; + mode = ["n"]; action = "Neotree toggle"; desc = "File browser toggle"; } { key = ""; - mode = [ "i" ]; + mode = ["i"]; action = ""; desc = "Move left in insert mode"; } { key = ""; - mode = [ "i" ]; + mode = ["i"]; action = ""; desc = "Move down in insert mode"; } { key = ""; - mode = [ "i" ]; + mode = ["i"]; action = ""; desc = "Move up in insert mode"; } { key = ""; - mode = [ "i" ]; + mode = ["i"]; action = ""; desc = "Move right in insert mode"; } @@ -108,7 +109,7 @@ spellcheck = { enable = true; - languages = [ "en" ]; + languages = ["en"]; programmingWordlist.enable = true; }; @@ -223,7 +224,7 @@ comments = { comment-nvim.enable = true; }; - + luaConfigPost = '' -- Nix LSP (nil) configuration for auto-eval-inputs local lspconfig = require('lspconfig') @@ -236,7 +237,7 @@ }, }, }) - + -- Auto-update programming wordlist on first startup vim.api.nvim_create_autocmd("VimEnter", { callback = function() @@ -258,7 +259,7 @@ dirtytalkUpdate = '' # Create the spell directory if it doesn't exist mkdir -p "$HOME/.local/share/nvim/site/spell" - + # Try to run DirtytalkUpdate in headless mode with better error handling if ! ${config.programs.nvf.finalPackage}/bin/nvim --headless -c "DirtytalkUpdate" -c "qa!" 2>/dev/null; then echo "Note: DirtytalkUpdate will run automatically on first Neovim startup" diff --git a/modules/home/editors/vscode.nix b/modules/home/editors/vscode.nix index 8b2d3dc..4f3ce02 100644 --- a/modules/home/editors/vscode.nix +++ b/modules/home/editors/vscode.nix @@ -90,4 +90,5 @@ in { }; }; nixpkgs.config.allowUnfree = true; + nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ]; } diff --git a/modules/home/emoji.nix b/modules/home/emoji.nix index f53d31b..2eb5988 100644 --- a/modules/home/emoji.nix +++ b/modules/home/emoji.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { home.file.".config/.emoji".text = '' 😀 grinning face face smile happy joy :D grin 😃 grinning face with big eyes face happy joy haha :D :) smile funny diff --git a/modules/home/fastfetch/default.nix b/modules/home/fastfetch/default.nix index ea3675b..cdd1cd7 100644 --- a/modules/home/fastfetch/default.nix +++ b/modules/home/fastfetch/default.nix @@ -90,7 +90,7 @@ } { type = "cpu"; - format = "{1} ({3}) @ {7} GHz"; + format = "{1} ({3}) @ {7}"; key = " ├  "; keyColor = "33"; } diff --git a/modules/home/gtk.nix b/modules/home/gtk.nix index f433efa..12fe645 100644 --- a/modules/home/gtk.nix +++ b/modules/home/gtk.nix @@ -1,7 +1,6 @@ -{ pkgs, ... }: - -{ +{config, pkgs, ...}: { gtk = { + gtk4.theme = null; iconTheme = { name = "Papirus-Dark"; package = pkgs.papirus-icon-theme; diff --git a/modules/home/hyprland/animations-def.nix b/modules/home/hyprland/animations-def.nix index dbbaea5..e7fbe6e 100644 --- a/modules/home/hyprland/animations-def.nix +++ b/modules/home/hyprland/animations-def.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { wayland.windowManager.hyprland.settings = { animations = { enabled = true; diff --git a/modules/home/hyprland/animations-dynamic.nix b/modules/home/hyprland/animations-dynamic.nix index eb96614..8977f7e 100644 --- a/modules/home/hyprland/animations-dynamic.nix +++ b/modules/home/hyprland/animations-dynamic.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { wayland.windowManager.hyprland.settings = { # name "Dynamic" # credit https://github.com/mylinuxforwork/dotfiles diff --git a/modules/home/hyprland/animations-end4.nix b/modules/home/hyprland/animations-end4.nix index fd8fbce..18369a8 100644 --- a/modules/home/hyprland/animations-end4.nix +++ b/modules/home/hyprland/animations-end4.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { wayland.windowManager.hyprland.settings = { # Name: END-4 # Credit: END-4 project https://github.com/end-4/dots-hyprland diff --git a/modules/home/hyprland/animations-moving.nix b/modules/home/hyprland/animations-moving.nix index 59d8c77..c162b5f 100644 --- a/modules/home/hyprland/animations-moving.nix +++ b/modules/home/hyprland/animations-moving.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { wayland.windowManager.hyprland.settings = { # name "moving" # credit https://github.com/mylinuxforwork/dotfiles diff --git a/modules/home/hyprland/binds.nix b/modules/home/hyprland/binds.nix index 8dc425d..5d8491f 100644 --- a/modules/home/hyprland/binds.nix +++ b/modules/home/hyprland/binds.nix @@ -10,17 +10,18 @@ noctaliaBind = if barChoice == "noctalia" then [ - "$modifier,D, Noctalia Launcher, exec, qs -c noctalia-shell ipc call launcher toggle" - "$modifier SHIFT,Return, Noctalia Launcher, exec, qs -c noctalia-shell ipc call launcher toggle" - "$modifier,M, Noctalia Notifications, exec, qs -c noctalia-shell ipc call notifications toggleHistory" - "$modifier,V, Noctalia Clipboard, exec, qs -c noctalia-shell ipc call launcher clipboard" - "$modifier ALT,P, Noctalia Settings, exec, qs -c noctalia-shell ipc call settings toggle" - "$modifier SHIFT,comma, Noctalia Settings, exec, qs -c noctalia-shell ipc call settings toggle" - "$modifier ALT,L, Noctalia Lock Screen, exec, qs -c noctalia-shell ipc call sessionMenu lockAndSuspend" - "$modifier SHIFT,Y, Noctalia Wallpaper, exec, qs -c noctalia-shell ipc call wallpaper toggle" - "$modifier,X, Noctalia Power Menu, exec, dms qs -c noctalia-shell ipc call sessionMenu toggle" - "$modifier,C, Noctalia Control Center, exec, qs -c noctalia-shell ipc call controlCenter toggle" - "$modifier CTRL,R, Noctalia Screen Recorder, exec, qs -c noctalia-shell ipc call screenRecorder toggle" + "$modifier,D, Noctalia Launcher, exec, noctalia-shell ipc call launcher toggle" + "$modifier SHIFT,Return, Noctalia Launcher, exec, noctalia-shell ipc call launcher toggle" + "$modifier,M, Noctalia Notifications, exec, noctalia-shell ipc call notifications toggleHistory" + "$modifier,V, Noctalia Clipboard, exec, noctalia-shell ipc call launcher clipboard" + "$modifier ALT,P, Noctalia Settings, exec, noctalia-shell ipc call settings toggle" + "$modifier SHIFT,comma, Noctalia Settings, exec, noctalia-shell ipc call settings toggle" + "$modifier CTRL,L, Noctalia Lock Screen, exec, noctalia-shell ipc call sessionMenu lockscreen lock" + "$modifier SHIFT,W, Noctalia Wallpaper, exec, noctalia-shell ipc call wallpaper toggle" + "$modifier,X, Noctalia Power Menu, exec, noctalia-shell ipc call sessionMenu toggle" + "$modifier,C, Noctalia Control Center, exec, noctalia-shell ipc call controlCenter toggle" + "$modifier CTRL,R, Noctalia Screen Recorder, exec, noctalia-shell ipc call screenRecorder toggle" + "$modifier SHIFT,R, Restart Noctalia shell, exec, restart.noctalia" ] else []; # Rofi launcher bindings (only included when barChoice != "noctalia") @@ -46,16 +47,17 @@ in { ++ rofiClipboardBind ++ [ # ============= WORKSPACE OVERVIEW ============= + "$modifier CTRL,D, Toggle Dock, exec, dock" "$modifier, TAB, QS Overview, exec, qs ipc -c overview call overview toggle" # ============= TERMINALS ============= "$modifier,Return, Terminal, exec, ${terminal}" # ============= APPLICATION LAUNCHERS ============= "$modifier,K, Keybinds Search Tool, exec, qs-keybinds" "$modifier CTRL,C, Cheatsheets Viewer, exec, qs-cheatsheets" - "$modifier SHIFT,K, Legacy Keybinds Menu, exec, list-keybinds" + "$modifier SHIFT,K, Keybinds Search Tool, exec, qs-keybinds" "$modifier SHIFT,D, Discord, exec, discord" - "$modifier SHIFT,W, Web Search, exec, web-search" - "$modifier ALT,W, Wallpaper Setter, exec, wallsetter" + "$modifier ALT,W, Web Search, exec, web-search" + "$modifier SHIFT,W, QS Wallpaper Setter, exec, qs-wallpapers-apply" "$modifier SHIFT,N, Notification Reset, exec, swaync-client -rs" "$modifier,W, Web Browser, exec, ${browser}" "$modifier,Y, File Manager, exec, kitty -e yazi" @@ -68,16 +70,22 @@ in { "$modifier,O, OBS Studio, exec, obs" "$modifier ALT,C, Color Picker, exec, hyprpicker -a" "$modifier,G, GIMP, exec, gimp" - "$modifier shift,T, Dropdown Terminal, exec, pypr toggle term" + "$modifier SHIFT,T, Dropdown Terminal, exec, sh -lc 'DropTerminal'" "$modifier,T, Thunar, exec, thunar" "$modifier ALT,M, Audio Control, exec, pavucontrol" # ============= WINDOW MANAGEMENT ============= "$modifier,Q, Kill Active Window, killactive," "$modifier,P, Pseudo Tile, pseudo," - "$modifier SHIFT,I, Toggle Split, togglesplit," + "$modifier SHIFT,I, Toggle Split, layoutmsg, togglesplit" "$modifier,F, Maximize, fullscreen," "$modifier SHIFT,F, Toggle Floating, togglefloating," - "$modifier ALT,F, Float All Windows, workspaceopt, allfloat" + "$modifier ALT,F, Float All Windows, exec, hyprland-float-all" + # ============= LAYOUTS ============= + "$modifier ALT,L, Toggle Layouts, exec, hyprland-change-layout toggle" + "$modifier ALT,1, Layout Dwindle, exec, hyprland-change-layout dwindle" + "$modifier ALT,2, Layout Master, exec, hyprland-change-layout master" + "$modifier ALT,3, Layout Scrolling, exec, hyprland-change-layout scrolling" + "$modifier ALT,4, Layout Monocle, exec, hyprland-change-layout monocle" "$modifier SHIFT,C, Exit/Logout of Hyprland, exit," # ============= WINDOW MOVEMENT (ARROW KEYS) ============= "$modifier SHIFT,left, Move Left, movewindow, l" diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix index 25234de..0e41181 100644 --- a/modules/home/hyprland/default.nix +++ b/modules/home/hyprland/default.nix @@ -1,8 +1,6 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../../hosts/${host}/variables.nix) animChoice; -in -{ +in { imports = [ animChoice ./binds.nix @@ -11,7 +9,6 @@ in ./hypridle.nix ./hyprland.nix ./hyprlock.nix - ./pyprland.nix ./windowrules.nix ]; } diff --git a/modules/home/hyprland/env.nix b/modules/home/hyprland/env.nix index 134cc58..ee61625 100644 --- a/modules/home/hyprland/env.nix +++ b/modules/home/hyprland/env.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { wayland.windowManager.hyprland = { settings = { env = [ diff --git a/modules/home/hyprland/exec-once.nix b/modules/home/hyprland/exec-once.nix index 8260c4c..edb5f50 100644 --- a/modules/home/hyprland/exec-once.nix +++ b/modules/home/hyprland/exec-once.nix @@ -1,38 +1,45 @@ -{ host, ... }: -let +{host, ...}: let vars = import ../../../hosts/${host}/variables.nix; - inherit (vars) + inherit + (vars) barChoice stylixImage ; # Noctalia-specific startup commands - noctaliaExec = if barChoice == "noctalia" then [ - "killall -q waybar" - "pkill waybar" - "killall -q swaync" - "pkill swaync" - "qs -c noctalia-shell" - ] else []; + noctaliaExec = + if barChoice == "noctalia" + then [ + "killall -q waybar" + "pkill waybar" + "killall -q swaync" + "pkill swaync" + "noctalia-shell &" + ] + else []; # Waybar-specific startup commands - waybarExec = if barChoice != "noctalia" then [ - "killall -q swww;sleep .5 && swww-daemon" - "killall -q waybar;sleep .5 && waybar" - "killall -q swaync;sleep .5 && swaync" - "nm-applet --indicator" - "sleep 1.0 && swww img ${stylixImage}" - ] else []; -in -{ + waybarExec = + if barChoice != "noctalia" + then [ + "killall -q awww;sleep .5 && awww-daemon" + "killall -q waybar;sleep .5 && waybar" + "killall -q swaync;sleep .5 && swaync" + "nm-applet --indicator" + # Delayed-only restore so Stylix finishes first, then user's wallpaper wins with a single change + "sh -lc 'sleep 2 && (qs-wallpapers-restore || waypaper --wallpaper ${stylixImage} --backend awww) >/dev/null 2>&1 || true'" + ] + else []; +in { wayland.windowManager.hyprland.settings = { - exec-once = [ - "wl-paste --type text --watch cliphist store" # Saves text - "wl-paste --type image --watch cliphist store" # Saves images - "dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP -" - "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" - "systemctl --user start hyprpolkitagent" - "pypr &" - "qs -c overview" # Start quickshell-overview daemon - ] ++ noctaliaExec ++ waybarExec; + exec-once = + [ + "wl-paste --type text --watch cliphist store" # Saves text + "wl-paste --type image --watch cliphist store" # Saves images + "dbus-update-activation-environment --all --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + "systemctl --user start hyprpolkitagent" + "qs -c overview" # Start quickshell-overview daemon + "hyprland-change-layout init" + ] + ++ noctaliaExec ++ waybarExec; }; } diff --git a/modules/home/hyprland/hypridle.nix b/modules/home/hyprland/hypridle.nix index 21fbf57..fe70347 100644 --- a/modules/home/hyprland/hypridle.nix +++ b/modules/home/hyprland/hypridle.nix @@ -1,9 +1,8 @@ -{ ... }: - -{ +{...}: { services = { hypridle = { enable = true; + systemdTarget = "hyprland-session.target"; settings = { general = { after_sleep_cmd = "hyprctl dispatch dpms on"; diff --git a/modules/home/hyprland/hyprland.nix b/modules/home/hyprland/hyprland.nix index eb7159a..635c6c7 100644 --- a/modules/home/hyprland/hyprland.nix +++ b/modules/home/hyprland/hyprland.nix @@ -4,20 +4,46 @@ pkgs, lib, ... -}: -let +}: let vars = import ../../../hosts/${host}/variables.nix; extraMonitorSettings = vars.extraMonitorSettings or ""; keyboardLayout = vars.keyboardLayout or "us"; keyboardVariant = vars.keyboardVariant or ""; stylixImage = vars.stylixImage or null; - layoutIsVariant = builtins.elem keyboardLayout [ "dvorak" "colemak" "workman" "intl" "us-intl" ]; - hyprKbLayout = if (keyboardVariant != "" || layoutIsVariant) then "us" else keyboardLayout; - hyprKbVariant = if (keyboardVariant != "") then keyboardVariant else if layoutIsVariant then keyboardLayout else ""; -in -{ + + # Treat only known US-based variants as implying layout = "us". + usVariants = ["dvorak" "colemak" "workman" "intl" "us-intl" "altgr-intl"]; + normalizeUSVariant = v: + if v == "us-intl" + then "intl" + else v; + + # If layout itself is a US variant (e.g., "dvorak", "us-intl"), normalize it + layoutFromLayout = + if builtins.elem keyboardLayout usVariants + then "us" + else keyboardLayout; + variantFromLayout = + if builtins.elem keyboardLayout usVariants + then normalizeUSVariant keyboardLayout + else ""; + + # If the provided variant is a US variant, force layout to us; otherwise keep layout + layoutFromVariant = + if builtins.elem keyboardVariant usVariants + then "us" + else layoutFromLayout; + variantFinal = + if builtins.elem keyboardVariant usVariants + then normalizeUSVariant keyboardVariant + else if variantFromLayout != "" + then variantFromLayout + else keyboardVariant; + + hyprKbLayout = layoutFromVariant; + hyprKbVariant = variantFinal; +in { home.packages = with pkgs; [ - swww grim slurp wl-clipboard @@ -25,6 +51,7 @@ in ydotool hyprpolkitagent hyprshot + hyprshutdown hyprpicker #hyprland-qtutils # needed for banners and ANR messages ]; @@ -46,32 +73,34 @@ in systemd = { enable = true; enableXdgAutostart = true; - variables = [ "--all" ]; + variables = ["--all"]; }; xwayland = { enable = true; }; settings = { - input = ({ - kb_layout = hyprKbLayout; - kb_options = [ - "grp:alt_caps_toggle" - "caps:super" - ]; - numlock_by_default = true; - repeat_delay = 300; - follow_mouse = 1; - float_switch_override_focus = 0; - sensitivity = 0; - touchpad = { - natural_scroll = true; - disable_while_typing = true; - scroll_factor = 0.8; - }; - } // lib.optionalAttrs (hyprKbVariant != "") { kb_variant = hyprKbVariant; }); + input = + { + kb_layout = hyprKbLayout; + kb_options = [ + "grp:alt_caps_toggle" + "caps:super" + ]; + numlock_by_default = true; + repeat_delay = 300; + follow_mouse = 1; + float_switch_override_focus = 0; + sensitivity = 0; + touchpad = { + natural_scroll = true; + disable_while_typing = true; + scroll_factor = 0.8; + }; + } + // lib.optionalAttrs (hyprKbVariant != "") {kb_variant = hyprKbVariant;}; gestures = { - gesture = [ "3, horizontal, workspace" ]; + gesture = ["3, horizontal, workspace"]; workspace_swipe_distance = 500; workspace_swipe_invert = true; workspace_swipe_min_speed_to_force = 30; @@ -79,16 +108,24 @@ in workspace_swipe_create_new = true; workspace_swipe_forever = true; }; + "$modifier" = "SUPER"; + + scrolling = { + column_width = 0.80; + fullscreen_on_one_column = true; + direction = "right"; + follow_focus = true; + }; + + monocle = {}; general = { - "$modifier" = "SUPER"; layout = "dwindle"; gaps_in = 6; gaps_out = 8; border_size = 2; resize_on_border = true; - "col.active_border" = - "rgb(${config.lib.stylix.colors.base08}) rgb(${config.lib.stylix.colors.base0C}) 45deg"; + "col.active_border" = "rgb(${config.lib.stylix.colors.base08}) rgb(${config.lib.stylix.colors.base0C}) 45deg"; "col.inactive_border" = "rgb(${config.lib.stylix.colors.base01})"; }; @@ -96,11 +133,11 @@ in layers_hog_keyboard_focus = true; initial_workspace_tracking = 0; mouse_move_enables_dpms = true; - key_press_enables_dpms = false; + key_press_enables_dpms = true; disable_hyprland_logo = true; disable_splash_rendering = true; enable_swallow = false; - vfr = true; # Variable Frame Rate + # vfr = true; # Variable Frame Rate Not supported post v0.54.3 vrr = 2; # Variable Refresh Rate Might need to set to 0 for NVIDIA/AQ_DRM_DEVICES # Screen flashing to black momentarily or going black when app is fullscreen # Try setting vrr to 0 @@ -111,9 +148,15 @@ in }; dwindle = { - pseudotile = true; + pseudotile = false; preserve_split = true; - force_split = 2; + smart_resizing = true; + use_active_for_splits = true; + smart_split = false; + default_split_ratio = 1.0; + split_bias = 0; + precise_mouse_move = false; + special_scale_factor = 0.8; }; decoration = { @@ -154,9 +197,16 @@ in }; master = { - new_status = "master"; - new_on_top = 1; - mfact = 0.5; + new_status = "slave"; + new_on_top = false; + new_on_active = "none"; + orientation = "left"; + mfact = 0.55; + slave_count_for_center_master = 2; + center_master_fallback = "left"; + smart_resizing = true; + drop_at_cursor = true; + always_keep_position = false; }; # Ensure Xwayland windows render at integer scale; compositor scales them @@ -168,9 +218,7 @@ in extraConfig = " monitor=,preferred,auto,auto monitor=Virtual-1,1920x1080@60,auto,1 - ${ - extraMonitorSettings - } + ${extraMonitorSettings} # To enable blur on waybar uncomment the line below # Thanks to SchotjeChrisman #layerrule = blur,waybar diff --git a/modules/home/hyprland/hyprlock.nix b/modules/home/hyprland/hyprlock.nix index d2c22b9..7d70433 100644 --- a/modules/home/hyprland/hyprlock.nix +++ b/modules/home/hyprland/hyprlock.nix @@ -1,4 +1,8 @@ -{ username, ... }: { +{ + config, + username, + ... +}: { programs.hyprlock = { enable = true; settings = { @@ -10,7 +14,7 @@ }; background = [ { - path = "/home/${username}/Pictures/Wallpapers/beautifulmountainscape.jpg"; + path = config.stylix.image; blur_passes = 3; blur_size = 8; } diff --git a/modules/home/hyprland/nwg-dock-hyprland/colors.css b/modules/home/hyprland/nwg-dock-hyprland/colors.css new file mode 100644 index 0000000..a6eba0d --- /dev/null +++ b/modules/home/hyprland/nwg-dock-hyprland/colors.css @@ -0,0 +1,106 @@ +/* +* Css Colors +* Generated with Matugen +*/ +@define-color blur_background rgba(18, 19, 24, 0.3); +@define-color blur_background8 rgba(18, 19, 24, 0.8); + + @define-color background #121318; + + @define-color error #ffb4ab; + + @define-color error_container #93000a; + + @define-color inverse_on_surface #2f3036; + + @define-color inverse_primary #485d92; + + @define-color inverse_surface #e2e2e9; + + @define-color on_background #e2e2e9; + + @define-color on_error #690005; + + @define-color on_error_container #ffdad6; + + @define-color on_primary #162e60; + + @define-color on_primary_container #dae2ff; + + @define-color on_primary_fixed #001946; + + @define-color on_primary_fixed_variant #2f4578; + + @define-color on_secondary #2a3042; + + @define-color on_secondary_container #dce2f9; + + @define-color on_secondary_fixed #151b2c; + + @define-color on_secondary_fixed_variant #404659; + + @define-color on_surface #e2e2e9; + + @define-color on_surface_variant #c5c6d0; + + @define-color on_tertiary #412742; + + @define-color on_tertiary_container #fed7fa; + + @define-color on_tertiary_fixed #2a122c; + + @define-color on_tertiary_fixed_variant #593d59; + + @define-color outline #8f9099; + + @define-color outline_variant #44464f; + + @define-color primary #b1c5ff; + + @define-color primary_container #2f4578; + + @define-color primary_fixed #dae2ff; + + @define-color primary_fixed_dim #b1c5ff; + + @define-color scrim #000000; + + @define-color secondary #c0c6dc; + + @define-color secondary_container #404659; + + @define-color secondary_fixed #dce2f9; + + @define-color secondary_fixed_dim #c0c6dc; + + @define-color shadow #000000; + + @define-color source_color #1253be; + + @define-color surface #121318; + + @define-color surface_bright #38393f; + + @define-color surface_container #1e1f25; + + @define-color surface_container_high #282a2f; + + @define-color surface_container_highest #33343a; + + @define-color surface_container_low #1a1b21; + + @define-color surface_container_lowest #0d0e13; + + @define-color surface_dim #121318; + + @define-color surface_tint #b1c5ff; + + @define-color surface_variant #44464f; + + @define-color tertiary #e0bbdd; + + @define-color tertiary_container #593d59; + + @define-color tertiary_fixed #fed7fa; + + @define-color tertiary_fixed_dim #e0bbdd; diff --git a/modules/home/hyprland/pyprland.nix b/modules/home/hyprland/pyprland.nix deleted file mode 100644 index 490b1c4..0000000 --- a/modules/home/hyprland/pyprland.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ pyprland ]; - - home.file.".config/hypr/pyprland.toml".text = '' - [pyprland] - plugins = [ - "scratchpads", - ] - - [scratchpads.term] - animation = "fromTop" - command = "kitty --class kitty-dropterm" - class = "kitty-dropterm" - size = "70% 70%" - max_size = "1920px 100%" - position = "150px 150px" - ''; -} diff --git a/modules/home/hyprland/windowrules.nix b/modules/home/hyprland/windowrules.nix index d1567a3..be4fc9a 100644 --- a/modules/home/hyprland/windowrules.nix +++ b/modules/home/hyprland/windowrules.nix @@ -1,90 +1,436 @@ -{host, ...}: let - inherit - (import ../../../hosts/${host}/variables.nix) - extraMonitorSettings - ; -in { +_: { wayland.windowManager.hyprland = { - settings = { - windowrule = [ - #"noblur, xwayland:1" # Helps prevent odd borders/shadows for xwayland apps - # downside it can impact other xwayland apps - # This rule is a template for a more targeted approach - "noblur, class:^(\bresolve\b)$, xwayland:1" # Window rule for just resolve - "tag +file-manager, class:^([Tt]hunar|org.gnome.Nautilus|[Pp]cmanfm-qt)$" - "tag +terminal, class:^(com.mitchellh.ghostty|org.wezfurlong.wezterm|Alacritty|kitty|kitty-dropterm)$" - "tag +browser, class:^(Brave-browser(-beta|-dev|-unstable)?)$" - "tag +browser, class:^([Ff]irefox|org.mozilla.firefox|[Ff]irefox-esr)$" - "tag +browser, class:^([Gg]oogle-chrome(-beta|-dev|-unstable)?)$" - "tag +browser, class:^([Tt]horium-browser|[Cc]achy-browser)$" - "tag +projects, class:^(codium|codium-url-handler|VSCodium)$" - "tag +projects, class:^(VSCode|code-url-handler)$" - "tag +im, class:^([Dd]iscord|[Ww]ebCord|[Vv]esktop)$" - "tag +im, class:^([Ff]erdium)$" - "tag +im, class:^([Ww]hatsapp-for-linux)$" - "tag +im, class:^(org.telegram.desktop|io.github.tdesktop_x64.TDesktop)$" - "tag +im, class:^(teams-for-linux)$" - "tag +games, class:^(gamescope)$" - "tag +games, class:^(steam_app_\d+)$" - "tag +gamestore, class:^([Ss]team)$" - "tag +gamestore, title:^([Ll]utris)$" - "tag +gamestore, class:^(com.heroicgameslauncher.hgl)$" - "tag +settings, class:^(gnome-disks|wihotspot(-gui)?)$" - "tag +settings, class:^([Rr]ofi)$" - "tag +settings, class:^(file-roller|org.gnome.FileRoller)$" - "tag +settings, class:^(nm-applet|nm-connection-editor|blueman-manager)$" - "tag +settings, class:^(pavucontrol|org.pulseaudio.pavucontrol|com.saivert.pwvucontrol)$" - "tag +settings, class:^(nwg-look|qt5ct|qt6ct|[Yy]ad)$" - "tag +settings, class:(xdg-desktop-portal-gtk)" - "tag +settings, class:(.blueman-manager-wrapped)" - "tag +settings, class:(nwg-displays)" - "move 72% 7%,title:^(Picture-in-Picture)$" - # qs-keybinds floating viewer - "float, title:^(Hyprland Keybinds|Emacs Leader Keybinds|Kitty Configuration|WezTerm Configuration|Ghostty Configuration|Yazi Configuration)$" - "center, title:^(Hyprland Keybinds|Emacs Leader Keybinds|Kitty Configuration|WezTerm Configuration|Ghostty Configuration|Yazi Configuration)$" - "size 55% 66%, title:^(Hyprland Keybinds|Emacs Leader Keybinds|Kitty Configuration|WezTerm Configuration|Ghostty Configuration|Yazi Configuration)$" - # qs-cheatsheets floating viewer - "float, title:^(Cheatsheets Viewer)$" - "center, title:^(Cheatsheets Viewer)$" - "size 65% 60%, title:^(Cheatsheets Viewer)$" - "center, class:^([Ff]erdium)$" - "float, class:^([Ww]aypaper)$" - "center, class:^(pavucontrol|org.pulseaudio.pavucontrol|com.saivert.pwvucontrol)$" - "center, class:([Tt]hunar), title:negative:(.*[Tt]hunar.*)" - "center, title:^(Authentication Required)$" - "idleinhibit fullscreen, class:^(*)$" - "idleinhibit fullscreen, title:^(*)$" - "idleinhibit fullscreen, fullscreen:1" - "float, tag:settings*" - "float, class:^([Ff]erdium)$" - "float, title:^(Picture-in-Picture)$" - "float, class:^(mpv|com.github.rafostar.Clapper)$" - "float, title:^(Authentication Required)$" - "float, class:(codium|codium-url-handler|VSCodium), title:negative:(.*codium.*|.*VSCodium.*)" - "float, class:^(com.heroicgameslauncher.hgl)$, title:negative:(Heroic Games Launcher)" - "float, class:^([Ss]team)$, title:negative:^([Ss]team)$" - "float, class:([Tt]hunar), title:negative:(.*[Tt]hunar.*)" - "float, initialTitle:(Add Folder to Workspace)" - "float, initialTitle:(Open Files)" - "float, initialTitle:(wants to save)" - "size 70% 60%, initialTitle:(Open Files)" - "size 70% 60%, initialTitle:(Add Folder to Workspace)" - "size 70% 70%, tag:settings*" - "size 60% 70%, class:^([Ff]erdium)$" - "opacity 1.0 1.0, tag:browser*" - "opacity 0.9 0.8, tag:projects*" - "opacity 0.94 0.86, tag:im*" - "opacity 0.9 0.8, tag:file-manager*" - "opacity 0.8 0.7, tag:terminal*" - "opacity 0.8 0.7, tag:settings*" - "opacity 0.8 0.7, class:^(gedit|org.gnome.TextEditor|mousepad)$" - "opacity 0.9 0.8, class:^(seahorse)$ # gnome-keyring gui" - "opacity 0.95 0.75, title:^(Picture-in-Picture)$" - "pin, title:^(Picture-in-Picture)$" - "keepaspectratio, title:^(Picture-in-Picture)$" - "noblur, tag:games*" - "fullscreen, tag:games*" - ]; - }; + extraConfig = '' + # Set float and centering for dialog boxes + rule = float(true), match:modal:1 + rule = center(true), match:modal:1 + + windowrule { + name = Resolve + match:class = ^(\bresolve\b)$ + match:xwayland = 1 + no_blur = on + } + + windowrule { + name = Thunar + match:class = ^([Tt]hunar|org.gnome.Nautilus|[Pp]cmanfm-qt)$ + tag = +file-manager + } + + windowrule { + name = Terminals + match:class = ^(com.mitchellh.ghostty|org.wezfurlong.wezterm|Alacritty|kitty|kitty-dropterm|dropterminal)$ + tag = +terminal + } + + windowrule { + name = Brave-browser + match:class = ^(Brave-browser(-beta|-dev|-unstable)?)$ + tag = +browser + } + + windowrule { + name = Firefox + match:class = ^([Ff]irefox|org.mozilla.firefox|[Ff]irefox-esr)$ + tag = +browser + } + + windowrule { + name = Google-chrome + match:class = ^([Gg]oogle-chrome(-beta|-dev|-unstable)?)$ + tag = +browser + } + + windowrule { + name = Thorium-browser + match:class = ^([Tt]horium-browser|[Cc]achy-browser)$ + tag = +browser + } + + windowrule { + name = vscodium + match:class = ^(codium|codium-url-handler|VSCodium)$ + tag = +projects + } + + windowrule { + name = vscode + match:class = ^(VSCode|code-url-handler)$ + tag = +projects + } + + windowrule { + name = Discord + match:class = ^([Dd]iscord|[Ww]ebCord|[Vv]esktop)$ + tag = +im + } + + windowrule { + name = Ferdium + match:class = ^([Ff]erdium)$ + center = on + float = on + size = 60% = 70% + tag = +im + } + + windowrule { + name = Whatsapp + match:class = ^([Ww]hatsapp-for-linux)$ + tag = +im + } + + windowrule { + name = Telegram-desktop + match:class = ^(org.telegram.desktop|io.github.tdesktop_x64.TDesktop)$ + tag = +im + } + + windowrule { + name = teams-for-linux + match:class = ^(teams-for-linux)$ + tag = +im + } + + windowrule { + name = gamescope + match:class = ^(gamescope)$ + tag = +games + } + + windowrule { + name = steam-app + match:class = ^(steam_app\d+)$ + tag = +games + } + + windowrule { + name = Steam + match:class = ^([Ss]team)$ + tag = +gamestore + } + + windowrule { + name = Lutris + match:title = ^([Ll]utris)$ + tag = +gamestore + } + + windowrule { + name = heroicgameslauncher + match:class = ^(com.heroicgameslauncher.hgl)$ + tag = +gamestore + } + + windowrule { + name = gnome-disks + match:class = ^(gnome-disks|wihotspot(-gui)?)$ + tag = +settings + } + + windowrule { + name = rofi + match:class = ^([Rr]ofi)$ + tag = +settings + no_blur = off + } + + windowrule { + name = FileRoller + match:class = ^(file-roller|org.gnome.FileRoller)$ + tag = +settings + } + + windowrule { + name = NetworkManger + match:class = ^(nm-applet|nm-connection-editor|blueman-manager)$ + tag = +settings + } + + windowrule { + name = PlusAudio + match:class = ^(pavucontrol|org.pulseaudio.pavucontrol|com.saivert.pwvucontrol)$ + center = on + tag = +settings + no_blur = off + } + + windowrule { + name = nwg-look + match:class = ^(nwg-look|qt5ct|qt6ct|[Yy]ad)$ + tag = +settings + } + + windowrule { + name = xdg-desktop-portal-gtk + match:class = (xdg-desktop-portal-gtk) + tag = +settings + } + + windowrule { + name = blueman + match:class = (.blueman-manager-wrapped) + tag = +settings + } + + windowrule { + name = nwg-displays + match:class = (nwg-displays) + tag = +settings + } + + windowrule { + name = Picture-in-Picture + match:title = ^(Picture-in-Picture)$ + float = on + move = 72% = 7% + opacity = 0.95 = 0.75 + pin = 0 + keep_aspect_ratio = on + } + + windowrule { + name = ThunarFileMgr + match:class = ([Tt]hunar) + match:title = negative:(.*[Tt]hunar.*) + center = on + float = on + } + + windowrule { + name = Authentication-Required + match:title = ^(Authentication Required)$ + center = on + float = on + } + + windowrule { + name = IdleInhibit-fullscreen-1 + match:class = ^(*)$ + idle_inhibit = fullscreen + } + + windowrule { + name = IdleInhibit-fullscreen-2 + match:title = ^(*)$ + idle_inhibit = fullscreen + } + + windowrule { + name = IdleInhibit-fullscreen-3 + match:fullscreen = 1 + idle_inhibit = fullscreen + } + + windowrule { + name = Settings-Tag + match:tag = settings* + float = on + opacity = 0.8 = 0.7 + size = 70% = 70% + no_blur = off + } + + windowrule { + name = WayPaper + match:class = ^([Ww]aypaper)$ + float = on + no_blur = off + } + + windowrule { + name = mpv-or-clapper + match:class = ^(mpv|com.github.rafostar.Clapper)$ + float = on + } + + windowrule { + name = codium-url-handler + match:class = (codium|codium-url-handler|VSCodium) + match:title = negative:(.*codium.*|.*VSCodium.*) + float = on + } + + windowrule { + name = heroicgameslauncher-1 + match:class = ^(com.heroicgameslauncher.hgl)$ + match:title = negative:(Heroic Games Launcher) + float = on + } + + windowrule { + name = Steam + match:class = ^([Ss]team)$ + match:title = negative:^([Ss]team)$ + float = on + } + + windowrule { + name = Add-Folder + match:initial_title = (Add Folder to Workspace) + float = on + size = 70% = 60% + } + + windowrule { + name = Open-File + match:initial_title = (Open Files) + float = on + size = 70% = 60% + } + + windowrule { + name = Wants-to-Save + match:initial_title = (wants to save) + float = on + } + + windowrule { + name = Browsers + match:tag = browser* + opacity = 1.0 = 1.0 + } + + windowrule { + name = Projects + match:tag = projects* + opacity = 0.9 = 0.8 + } + + windowrule { + name = Instant-Messaging + match:tag = im* + opacity = 0.94 = 0.86 + } + + windowrule { + name = File-Managers + match:tag = file-manager* + opacity = 0.9 = 0.8 + } + + windowrule { + name = Terminals-opacity + match:tag = terminal* + opacity = 0.8 = 0.7 + no_blur = off + } + + windowrule { + name = windowrule-77 + match:class = ^(gedit|org.gnome.TextEditor|mousepad)$ + opacity = 0.8 = 0.7 + } + + windowrule { + name = windowrule-78 + match:class = ^(seahorse)$ + opacity = 0.9 = 0.8 + } + + windowrule { + name = windowrule-79 + match:tag = games* + no_blur = on + } + + windowrule { + name = windowrule-80 + match:tag = games* + fullscreen = on + } + + windowrule { + name = qs-keybinds + match:title = ^(Hyprland Keybinds|Emacs Leader Keybinds|Kitty Configuration|WezTerm Configuration|Ghostty Configuration|Yazi Configuration)$ + float = on + center = on + size = 55% = 66% + } + + windowrule { + name = qs-cheatsheets + match:title = ^(Cheatsheets Viewer)$ + float = on + center = on + size = 65% = 60% + } + + windowrule { + name = qs-extended-viewers + match:title = ^(Hyprland Keybinds|Niri Keybinds|BSPWM Keybinds|i3 Keybinds|Sway Keybinds|DWM Keybinds|Emacs Leader Keybinds|Kitty Configuration|WezTerm Configuration|Ghostty Configuration|Yazi Configuration|Cheatsheets Viewer|Documentation Viewer)$ + float = on + center = on + size = 55% = 66% + } + + windowrule { + name = QS-Wallpapers + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(Wallpapers)$ + border_size = 0 + float = on + no_blur = on + no_shadow = on + rounding = 12 + } + + windowrule { + name = QA-Video-Wallpapers + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(Video Wallpapers)$ + border_size = 0 + center = on + float = on + no_blur = on + no_shadow = on + rounding = 12 + } + + windowrule { + name = QS-wlogout + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(qs-wlogout)$ + border_size = 0 + center = on + float = on + opacity = 1.0 = 1.0 + rounding = 20 + } + + windowrule { + name = QA-Panels + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(Panels)$ + center = on + float = on + no_blur = on + no_shadow = on + rounding = 12 + } + + windowrule { + name = QS-Cheatsheets + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(Cheatsheets Viewer)$ + border_size = 0 + center = on + float = on + no_shadow = on + rounding = 12 + } + + windowrule { + name = QS-Documentation-Viewer + match:class = ^(org\.qt-project\.qml)$ + match:title = ^(Documentation Viewer)$ + border_size = 0 + center = on + float = on + no_shadow = on + rounding = 12 + } + ''; }; } diff --git a/modules/home/install-zaneyos.sh b/modules/home/install-zaneyos.sh index a3fdc50..cf88a04 100755 --- a/modules/home/install-zaneyos.sh +++ b/modules/home/install-zaneyos.sh @@ -102,18 +102,18 @@ has_intel=false has_amd=false has_vm=false -if lspci | grep -qi 'vga\|3d'; then +if lspci | grep -qi 'vga\|3d\|display'; then while read -r line; do if echo "$line" | grep -qi 'nvidia'; then has_nvidia=true - elif echo "$line" | grep -qi 'amd'; then + elif echo "$line" | grep -qi 'amd\|ati\|advanced micro devices'; then has_amd=true elif echo "$line" | grep -qi 'intel'; then has_intel=true elif echo "$line" | grep -qi 'virtio\|vmware'; then has_vm=true fi - done < <(lspci | grep -i 'vga\|3d') + done < <(lspci | grep -i 'vga\|3d\|display') if $has_vm; then DETECTED_PROFILE="vm" diff --git a/modules/home/noctalia.nix b/modules/home/noctalia.nix index a3ec97d..bd98c3c 100644 --- a/modules/home/noctalia.nix +++ b/modules/home/noctalia.nix @@ -1,26 +1,29 @@ -{ config, pkgs, inputs, lib, ... }: -let - system = pkgs.stdenv.hostPlatform.system; - noctaliaPath = inputs.noctalia.packages.${system}.default; - configDir = "${noctaliaPath}/share/noctalia-shell"; -in { - # Install the Noctalia package for this user (CLI, assets, etc.) + pkgs, + inputs, + lib, + ... +}: let + system = pkgs.stdenv.hostPlatform.system; + noctaliaPkg = inputs.noctalia.packages.${system}.default; + configDir = "${noctaliaPkg}/share/noctalia-shell"; +in { + # Install the Noctalia package home.packages = [ - noctaliaPath + noctaliaPkg + pkgs.quickshell # Ensure quickshell is available for the service ]; - # Seed the Noctalia QuickShell shell code into ~/.config/quickshell/noctalia-shell - # once, then leave it writable so the GUI and the user can tweak it. - home.activation.seedNoctaliaShellCode = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + # Seed the configuration + home.activation.seedNoctaliaShellCode = lib.hm.dag.entryAfter ["writeBoundary"] '' set -eu DEST="$HOME/.config/quickshell/noctalia-shell" SRC="${configDir}" if [ ! -d "$DEST" ]; then - mkdir -p "$HOME/.config/quickshell" - cp -R "$SRC" "$DEST" - chmod -R u+rwX "$DEST" + $DRY_RUN_CMD mkdir -p "$HOME/.config/quickshell" + $DRY_RUN_CMD cp -R "$SRC" "$DEST" + $DRY_RUN_CMD chmod -R u+rwX "$DEST" fi ''; } diff --git a/modules/home/obs-studio.nix b/modules/home/obs-studio.nix index d0b610c..05d8469 100644 --- a/modules/home/obs-studio.nix +++ b/modules/home/obs-studio.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.obs-studio = { enable = true; #enableVirtualCamera = true; diff --git a/modules/home/overview.nix b/modules/home/overview.nix index 09f32b7..6ecfeaa 100644 --- a/modules/home/overview.nix +++ b/modules/home/overview.nix @@ -1,8 +1,10 @@ -{ config, lib, ... }: -let - overviewSource = ./overview; -in { + config, + lib, + ... +}: let + overviewSource = ./overview; +in { # Quickshell-overview is a Qt6 QML app for Hyprland workspace overview # It shows all workspaces with live window previews, drag-and-drop support # Toggled via: SUPER + TAB (bound in hyprland/binds.nix) @@ -10,11 +12,11 @@ in # Seed the Quickshell overview code into ~/.config/quickshell/overview # Copy (not symlink) so QML module resolution works and users can edit files - home.activation.seedOverviewCode = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + home.activation.seedOverviewCode = lib.hm.dag.entryAfter ["writeBoundary"] '' set -eu DEST="$HOME/.config/quickshell/overview" SRC="${overviewSource}" - + if [ ! -d "$DEST" ]; then mkdir -p "$HOME/.config/quickshell" cp -R "$SRC" "$DEST" diff --git a/modules/home/python.nix b/modules/home/python.nix new file mode 100644 index 0000000..48c160f --- /dev/null +++ b/modules/home/python.nix @@ -0,0 +1,35 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + python3Packages.pip # Python package installer + python3Packages.virtualenv # Virtual environment tool + python3Packages.setuptools # Package development library + python3Packages.black # Code formatter + python3Packages.flake8 # Linting tool + python3Packages.mypy # Type checking + python3Packages.requests # HTTP library for the Weather.py script + ]; + + # Add pip configuration + home.file.".config/pip/pip.conf".text = '' + [global] + user = true + ''; + + # Set environment variables for Python development + home.sessionVariables = { + PIP_USER = "1"; + }; + + # Create a wrapper script for Weather.py to ensure it uses Python with required packages + home.file.".local/bin/weather" = { + text = '' + #!/bin/sh + # Use python3 with the correct package path + exec ${pkgs.python3.withPackages (p: [p.requests])}/bin/python3 $HOME/.config/waybar/scripts/Weather.py "$@" + ''; + executable = true; + }; + + # Set Python path in environment + home.sessionPath = ["${pkgs.python3}/bin"]; +} diff --git a/modules/home/qt.nix b/modules/home/qt.nix index b8df345..2674038 100644 --- a/modules/home/qt.nix +++ b/modules/home/qt.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{lib, ...}: { qt = { enable = true; platformTheme.name = lib.mkForce "qtct"; diff --git a/modules/home/rofi/config-long.nix b/modules/home/rofi/config-long.nix index e8e9773..d947a47 100644 --- a/modules/home/rofi/config-long.nix +++ b/modules/home/rofi/config-long.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { home.file.".config/rofi/config-long.rasi".text = '' @import "~/.config/rofi/config.rasi" window { diff --git a/modules/home/rofi/default.nix b/modules/home/rofi/default.nix index 1b6ae5f..6493e45 100644 --- a/modules/home/rofi/default.nix +++ b/modules/home/rofi/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { imports = [ ./config-long.nix ./rofi.nix diff --git a/modules/home/rofi/rofi.nix b/modules/home/rofi/rofi.nix index 71deb21..f8c881b 100644 --- a/modules/home/rofi/rofi.nix +++ b/modules/home/rofi/rofi.nix @@ -1,6 +1,7 @@ -{ pkgs -, config -, ... +{ + pkgs, + config, + ... }: { programs = { rofi = { @@ -16,193 +17,191 @@ display-run = " Run"; display-filebrowser = " File"; }; - theme = - let - inherit (config.lib.formats.rasi) mkLiteral; - in - { - "*" = { - bg = mkLiteral "#${config.stylix.base16Scheme.base00}"; - bg-alt = mkLiteral "#${config.stylix.base16Scheme.base09}"; - foreground = mkLiteral "#${config.stylix.base16Scheme.base01}"; - selected = mkLiteral "#${config.stylix.base16Scheme.base08}"; - active = mkLiteral "#${config.stylix.base16Scheme.base0B}"; - text-selected = mkLiteral "#${config.stylix.base16Scheme.base00}"; - text-color = mkLiteral "#${config.stylix.base16Scheme.base05}"; - border-color = mkLiteral "#${config.stylix.base16Scheme.base0F}"; - urgent = mkLiteral "#${config.stylix.base16Scheme.base0E}"; - }; - "window" = { - transparency = "real"; - width = mkLiteral "1000px"; - location = mkLiteral "center"; - anchor = mkLiteral "center"; - fullscreen = false; - x-offset = mkLiteral "0px"; - y-offset = mkLiteral "0px"; - cursor = "default"; - enabled = true; - border-radius = mkLiteral "15px"; - background-color = mkLiteral "@bg"; - }; - "mainbox" = { - enabled = true; - spacing = mkLiteral "0px"; - orientation = mkLiteral "horizontal"; - children = map mkLiteral [ - "imagebox" - "listbox" - ]; - background-color = mkLiteral "transparent"; - }; - "imagebox" = { - padding = mkLiteral "20px"; - background-color = mkLiteral "transparent"; - background-image = mkLiteral ''url("~/Pictures/Wallpapers/Rainnight.jpg", height)''; - orientation = mkLiteral "vertical"; - children = map mkLiteral [ - "inputbar" - "dummy" - "mode-switcher" - ]; - }; - "listbox" = { - spacing = mkLiteral "20px"; - padding = mkLiteral "20px"; - background-color = mkLiteral "transparent"; - orientation = mkLiteral "vertical"; - children = map mkLiteral [ - "message" - "listview" - ]; - }; - "dummy" = { - background-color = mkLiteral "transparent"; - }; - "inputbar" = { - enabled = true; - spacing = mkLiteral "10px"; - padding = mkLiteral "10px"; - border-radius = mkLiteral "10px"; - background-color = mkLiteral "@bg-alt"; - text-color = mkLiteral "@foreground"; - children = map mkLiteral [ - "textbox-prompt-colon" - "entry" - ]; - }; - "textbox-prompt-colon" = { - enabled = true; - expand = false; - str = ""; - background-color = mkLiteral "inherit"; - text-color = mkLiteral "inherit"; - }; - "entry" = { - enabled = true; - background-color = mkLiteral "inherit"; - text-color = mkLiteral "inherit"; - cursor = mkLiteral "text"; - placeholder = "Search"; - placeholder-color = mkLiteral "inherit"; - }; - "mode-switcher" = { - enabled = true; - spacing = mkLiteral "20px"; - background-color = mkLiteral "transparent"; - text-color = mkLiteral "@foreground"; - }; - "button" = { - padding = mkLiteral "15px"; - border-radius = mkLiteral "10px"; - background-color = mkLiteral "@bg-alt"; - text-color = mkLiteral "inherit"; - cursor = mkLiteral "pointer"; - }; - "button selected" = { - background-color = mkLiteral "@selected"; - text-color = mkLiteral "@foreground"; - }; - "listview" = { - enabled = true; - columns = 1; - lines = 8; - cycle = true; - dynamic = true; - scrollbar = false; - layout = mkLiteral "vertical"; - reverse = false; - fixed-height = true; - fixed-columns = true; - spacing = mkLiteral "10px"; - background-color = mkLiteral "transparent"; - text-color = mkLiteral "@foreground"; - cursor = "default"; - }; - "element" = { - enabled = true; - spacing = mkLiteral "15px"; - padding = mkLiteral "8px"; - border-radius = mkLiteral "10px"; - background-color = mkLiteral "transparent"; - text-color = mkLiteral "@text-color"; - cursor = mkLiteral "pointer"; - }; - "element normal.normal" = { - background-color = mkLiteral "inherit"; - text-color = mkLiteral "@text-color"; - }; - "element normal.urgent" = { - background-color = mkLiteral "@urgent"; - text-color = mkLiteral "@text-color"; - }; - "element normal.active" = { - background-color = mkLiteral "inherit"; - text-color = mkLiteral "@text-color"; - }; - "element selected.normal" = { - background-color = mkLiteral "@selected"; - text-color = mkLiteral "@foreground"; - }; - "element selected.urgent" = { - background-color = mkLiteral "@urgent"; - text-color = mkLiteral "@text-selected"; - }; - "element selected.active" = { - background-color = mkLiteral "@urgent"; - text-color = mkLiteral "@text-selected"; - }; - "element-icon" = { - background-color = mkLiteral "transparent"; - text-color = mkLiteral "inherit"; - size = mkLiteral "36px"; - cursor = mkLiteral "inherit"; - }; - "element-text" = { - background-color = mkLiteral "transparent"; - text-color = mkLiteral "inherit"; - cursor = mkLiteral "inherit"; - vertical-align = mkLiteral "0.5"; - horizontal-align = mkLiteral "0.0"; - }; - "message" = { - background-color = mkLiteral "transparent"; - }; - "textbox" = { - padding = mkLiteral "15px"; - border-radius = mkLiteral "10px"; - background-color = mkLiteral "@bg-alt"; - text-color = mkLiteral "@foreground"; - vertical-align = mkLiteral "0.5"; - horizontal-align = mkLiteral "0.0"; - }; - "error-message" = { - padding = mkLiteral "15px"; - border-radius = mkLiteral "20px"; - background-color = mkLiteral "@bg"; - text-color = mkLiteral "@foreground"; - }; + theme = let + inherit (config.lib.formats.rasi) mkLiteral; + in { + "*" = { + bg = mkLiteral "#${config.stylix.base16Scheme.base00}"; + bg-alt = mkLiteral "#${config.stylix.base16Scheme.base09}"; + foreground = mkLiteral "#${config.stylix.base16Scheme.base01}"; + selected = mkLiteral "#${config.stylix.base16Scheme.base08}"; + active = mkLiteral "#${config.stylix.base16Scheme.base0B}"; + text-selected = mkLiteral "#${config.stylix.base16Scheme.base00}"; + text-color = mkLiteral "#${config.stylix.base16Scheme.base05}"; + border-color = mkLiteral "#${config.stylix.base16Scheme.base0F}"; + urgent = mkLiteral "#${config.stylix.base16Scheme.base0E}"; }; + "window" = { + transparency = "real"; + width = mkLiteral "1000px"; + location = mkLiteral "center"; + anchor = mkLiteral "center"; + fullscreen = false; + x-offset = mkLiteral "0px"; + y-offset = mkLiteral "0px"; + cursor = "default"; + enabled = true; + border-radius = mkLiteral "15px"; + background-color = mkLiteral "@bg"; + }; + "mainbox" = { + enabled = true; + spacing = mkLiteral "0px"; + orientation = mkLiteral "horizontal"; + children = map mkLiteral [ + "imagebox" + "listbox" + ]; + background-color = mkLiteral "transparent"; + }; + "imagebox" = { + padding = mkLiteral "20px"; + background-color = mkLiteral "transparent"; + background-image = mkLiteral ''url("~/Pictures/Wallpapers/Rainnight.jpg", height)''; + orientation = mkLiteral "vertical"; + children = map mkLiteral [ + "inputbar" + "dummy" + "mode-switcher" + ]; + }; + "listbox" = { + spacing = mkLiteral "20px"; + padding = mkLiteral "20px"; + background-color = mkLiteral "transparent"; + orientation = mkLiteral "vertical"; + children = map mkLiteral [ + "message" + "listview" + ]; + }; + "dummy" = { + background-color = mkLiteral "transparent"; + }; + "inputbar" = { + enabled = true; + spacing = mkLiteral "10px"; + padding = mkLiteral "10px"; + border-radius = mkLiteral "10px"; + background-color = mkLiteral "@bg-alt"; + text-color = mkLiteral "@foreground"; + children = map mkLiteral [ + "textbox-prompt-colon" + "entry" + ]; + }; + "textbox-prompt-colon" = { + enabled = true; + expand = false; + str = ""; + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + }; + "entry" = { + enabled = true; + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "text"; + placeholder = "Search"; + placeholder-color = mkLiteral "inherit"; + }; + "mode-switcher" = { + enabled = true; + spacing = mkLiteral "20px"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@foreground"; + }; + "button" = { + padding = mkLiteral "15px"; + border-radius = mkLiteral "10px"; + background-color = mkLiteral "@bg-alt"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "pointer"; + }; + "button selected" = { + background-color = mkLiteral "@selected"; + text-color = mkLiteral "@foreground"; + }; + "listview" = { + enabled = true; + columns = 1; + lines = 8; + cycle = true; + dynamic = true; + scrollbar = false; + layout = mkLiteral "vertical"; + reverse = false; + fixed-height = true; + fixed-columns = true; + spacing = mkLiteral "10px"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@foreground"; + cursor = "default"; + }; + "element" = { + enabled = true; + spacing = mkLiteral "15px"; + padding = mkLiteral "8px"; + border-radius = mkLiteral "10px"; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "@text-color"; + cursor = mkLiteral "pointer"; + }; + "element normal.normal" = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "@text-color"; + }; + "element normal.urgent" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@text-color"; + }; + "element normal.active" = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "@text-color"; + }; + "element selected.normal" = { + background-color = mkLiteral "@selected"; + text-color = mkLiteral "@foreground"; + }; + "element selected.urgent" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@text-selected"; + }; + "element selected.active" = { + background-color = mkLiteral "@urgent"; + text-color = mkLiteral "@text-selected"; + }; + "element-icon" = { + background-color = mkLiteral "transparent"; + text-color = mkLiteral "inherit"; + size = mkLiteral "36px"; + cursor = mkLiteral "inherit"; + }; + "element-text" = { + background-color = mkLiteral "transparent"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "inherit"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.0"; + }; + "message" = { + background-color = mkLiteral "transparent"; + }; + "textbox" = { + padding = mkLiteral "15px"; + border-radius = mkLiteral "10px"; + background-color = mkLiteral "@bg-alt"; + text-color = mkLiteral "@foreground"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.0"; + }; + "error-message" = { + padding = mkLiteral "15px"; + border-radius = mkLiteral "20px"; + background-color = mkLiteral "@bg"; + text-color = mkLiteral "@foreground"; + }; + }; }; }; } diff --git a/modules/home/scripts/DropTerminal.nix b/modules/home/scripts/DropTerminal.nix new file mode 100644 index 0000000..cbc14d1 --- /dev/null +++ b/modules/home/scripts/DropTerminal.nix @@ -0,0 +1,446 @@ +{pkgs}: +pkgs.writeShellScriptBin "DropTerminal" '' + #!/usr/bin/env bash + # Dropdown Terminal for Hyprland (Nix-managed) + # Source: adapted from Dropterminal.sh by Kiran George (SherLock707) + # Usage: + # DropTerminal [-d] [] + # Behavior: + # - If is omitted, uses $TERM, with fallback to kitty when $TERM is unset/empty + + set -euo pipefail + + DEBUG=false + # Use a dedicated special workspace so preload never flashes on screen + SPECIAL_WS="special:dropterminal" + ADDR_FILE="/tmp/dropdown_terminal_addr" + SPAWN_ONLY=false # if true, just create hidden in scratchpad and exit + + # Sanitize Hyprland JSON to strict JSON (work around NaN/Inf issues) + hyprjson() { + # Usage: hyprjson + # Emits strict JSON, replacing invalid numeric literals with null + hyprctl "$@" -j 2>/dev/null | sed -E 's/: *nan([,}])/ : null\1/gi; s/: *-nan([,}])/ : null\1/gi; s/: *inf([,}])/ : null\1/gi; s/: *-inf([,}])/ : null\1/gi' + } + + # Dropdown size and position configuration (percentages) + WIDTH_PERCENT=65 # Width as percentage of screen width + HEIGHT_PERCENT=65 # Height as percentage of screen height + Y_PERCENT=10 # Y position as percentage from top (X is auto-centered) + + # Animation settings + ANIMATION_DURATION=100 # milliseconds + SLIDE_STEPS=5 + SLIDE_DELAY=5 # milliseconds between steps + + # Parse arguments + if [ "''${1-}" = "-d" ] || [ "''${1-}" = "--debug" ]; then + DEBUG=true + shift || true + fi + if [ "''${1-}" = "-S" ] || [ "''${1-}" = "--spawn-only" ]; then + SPAWN_ONLY=true + shift || true + fi + # Env override for startup usage + if [ "''${DROPTERM_SPAWN_ONLY-}" = "1" ]; then + SPAWN_ONLY=true + fi + + # Terminal command: prefer explicit arg; otherwise always use kitty + TERMINAL_CMD="''${1-}" + if [ -z "''${TERMINAL_CMD}" ]; then + TERMINAL_CMD="kitty" + fi + + # Debug echo function + debug_echo() { + if [ "$DEBUG" = true ]; then + echo "$@" >&2 + fi + } + + # Wait until Hyprland returns sane JSON (monitors/workspace ready) + wait_for_hypr() { + for i in $(seq 1 60); do + if hyprjson monitors | ${pkgs.jq}/bin/jq -e 'length > 0' >/dev/null 2>&1 \ + && hyprjson activeworkspace | ${pkgs.jq}/bin/jq -e '.id | numbers' >/dev/null 2>&1; then + return 0 + fi + sleep 0.05 + done + return 0 + } + + # Function to get window geometry + get_window_geometry() { + local addr="$1" + hyprjson clients | ${pkgs.jq}/bin/jq -r --arg ADDR "$addr" '.[] | select(.address == $ADDR) | "\(.at[0]) \(.at[1]) \(.size[0]) \(.size[1])"' + } + + # Ensure a window is floating + ensure_floating() { + local addr="$1" + local is_float=$(hyprjson clients | ${pkgs.jq}/bin/jq -r --arg ADDR "$addr" '.[] | select(.address == $ADDR) | .floating // false') + if [ "$is_float" != "true" ]; then + hyprctl dispatch togglefloating "address:$addr" >/dev/null 2>&1 || true + sleep 0.02 + fi + } + + # Function to animate window slide down (show) + animate_slide_down() { + local addr="$1" + local target_x="$2" + local target_y="$3" + local width="$4" + local height="$5" + if ! [[ "$target_x" =~ ^-?[0-9]+$ ]] || ! [[ "$target_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then + debug_echo "Invalid geometry for slide down; skipping animation" + return 1 + fi + + debug_echo "Animating slide down for window $addr to position $target_x,$target_y" + + # Start position (above screen) + local start_y=$((target_y - height - 50)) + + # Calculate step size + local step_y=$(((target_y - start_y) / SLIDE_STEPS)) + + # Move window to start position instantly (off-screen) + hyprctl dispatch movewindowpixel "exact $target_x $start_y,address:$addr" >/dev/null 2>&1 + sleep 0.05 + + # Animate slide down + for i in $(seq 1 $SLIDE_STEPS); do + local current_y=$((start_y + (step_y * i))) + hyprctl dispatch movewindowpixel "exact $target_x $current_y,address:$addr" >/dev/null 2>&1 + sleep 0.03 + done + + # Ensure final position is exact + hyprctl dispatch movewindowpixel "exact $target_x $target_y,address:$addr" >/dev/null 2>&1 + } + + # Function to animate window slide up (hide) + animate_slide_up() { + local addr="$1" + local start_x="$2" + local start_y="$3" + local width="$4" + local height="$5" + if ! [[ "$start_x" =~ ^-?[0-9]+$ ]] || ! [[ "$start_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then + debug_echo "Invalid geometry for slide up; skipping animation" + return 1 + fi + + debug_echo "Animating slide up for window $addr from position $start_x,$start_y" + + # End position (above screen) + local end_y=$((start_y - height - 50)) + + # Calculate step size + local step_y=$(((start_y - end_y) / SLIDE_STEPS)) + + # Animate slide up + for i in $(seq 1 $SLIDE_STEPS); do + local current_y=$((start_y - (step_y * i))) + hyprctl dispatch movewindowpixel "exact $start_x $current_y,address:$addr" >/dev/null 2>&1 + sleep 0.03 + done + + debug_echo "Slide up animation completed" + } + + # Function to get monitor info including scale and name of focused monitor + get_monitor_info() { + local monitor_data=$(hyprjson monitors | ${pkgs.jq}/bin/jq -r '.[] | select(.focused == true) | "\(.x) \(.y) \(.width) \(.height) \(.scale // 1) \(.name)"') + if [ -z "$monitor_data" ] || [[ "$monitor_data" =~ ^null ]]; then + debug_echo "Error: Could not get focused monitor information" + return 1 + fi + echo "$monitor_data" + } + + # Function to calculate dropdown position with proper scaling and centering + calculate_dropdown_position() { + local monitor_info=$(get_monitor_info) + + if [ $? -ne 0 ] || [ -z "$monitor_info" ]; then + debug_echo "Error: Failed to get monitor info, using fallback values" + echo "100 100 800 600 fallback-monitor" + return 1 + fi + + local mon_x=$(echo $monitor_info | cut -d' ' -f1) + local mon_y=$(echo $monitor_info | cut -d' ' -f2) + local mon_width=$(echo $monitor_info | cut -d' ' -f3) + local mon_height=$(echo $monitor_info | cut -d' ' -f4) + local mon_scale=$(echo $monitor_info | cut -d' ' -f5) + local mon_name=$(echo $monitor_info | cut -d' ' -f6) + # Ensure geometry values are numeric; Hyprland can emit non-JSON status lines during startup + if ! [[ "$mon_x" =~ ^-?[0-9]+$ ]] || ! [[ "$mon_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$mon_width" =~ ^[0-9]+$ ]] || ! [[ "$mon_height" =~ ^[0-9]+$ ]]; then + debug_echo "Error: Non-numeric monitor geometry; using fallback values" + echo "100 100 800 600 fallback-monitor" + return 1 + fi + + debug_echo "Monitor info: x=$mon_x, y=$mon_y, width=$mon_width, height=$mon_height, scale=$mon_scale" + + # Validate scale value and provide fallback + if [ -z "$mon_scale" ] || [ "$mon_scale" = "null" ] || [ "$mon_scale" = "0" ]; then + debug_echo "Invalid scale value, using 1.0 as fallback" + mon_scale="1.0" + fi + + # Calculate logical dimensions by dividing physical dimensions by scale + local logical_width logical_height + if [ -x "${pkgs.bc}/bin/bc" ]; then + logical_width=$(echo "scale=0; $mon_width / $mon_scale" | ${pkgs.bc}/bin/bc | cut -d'.' -f1) + logical_height=$(echo "scale=0; $mon_height / $mon_scale" | ${pkgs.bc}/bin/bc | cut -d'.' -f1) + else + # Fallback to integer math (multiply by 100 for precision, then divide) + local scale_int=$(echo "$mon_scale" | sed 's/\.///' | sed 's/^0*//') + if [ -z "$scale_int" ]; then scale_int=100; fi + + logical_width=$(((mon_width * 100) / scale_int)) + logical_height=$(((mon_height * 100) / scale_int)) + fi + + # Ensure we have valid integer values + if ! [[ "$logical_width" =~ ^-?[0-9]+$ ]]; then logical_width=$mon_width; fi + if ! [[ "$logical_height" =~ ^-?[0-9]+$ ]]; then logical_height=$mon_height; fi + + debug_echo "Physical resolution: ''${mon_width}x''${mon_height}" + debug_echo "Logical resolution: ''${logical_width}x''${logical_height} (physical ÷ scale)" + + # Calculate window dimensions based on LOGICAL space percentages + local width=$((logical_width * WIDTH_PERCENT / 100)) + local height=$((logical_height * HEIGHT_PERCENT / 100)) + + # Calculate Y position from top based on percentage of LOGICAL height + local y_offset=$((logical_height * Y_PERCENT / 100)) + + # Calculate centered X position in LOGICAL space + local x_offset=$(((logical_width - width) / 2)) + + # Apply monitor offset to get final positions in logical coordinates + local final_x=$((mon_x + x_offset)) + local final_y=$((mon_y + y_offset)) + + debug_echo "Window size: ''${width}x''${height} (logical pixels)" + debug_echo "Final position: x=$final_x, y=$final_y (logical coordinates)" + debug_echo "Hyprland will scale these to physical coordinates automatically" + + echo "$final_x $final_y $width $height $mon_name" + } + + # Ensure Hyprland is ready and get the current workspace + wait_for_hypr + CURRENT_WS=$(hyprjson activeworkspace | ${pkgs.jq}/bin/jq -r '.id // empty') + if [ -z "''${CURRENT_WS}" ]; then + # Try once more after a short wait + sleep 0.1 + CURRENT_WS=$(hyprjson activeworkspace | ${pkgs.jq}/bin/jq -r '.id // empty') + fi + if [ -z "''${CURRENT_WS}" ]; then + debug_echo "Warning: unable to read active workspace; using workspace 1" + CURRENT_WS="1" + fi + + # Function to get stored terminal address + get_terminal_address() { + if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then + cut -d' ' -f1 "$ADDR_FILE" + fi + } + + # Function to get stored monitor name + get_terminal_monitor() { + if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then + cut -d' ' -f2- "$ADDR_FILE" + fi + } + + # Function to check if terminal exists + terminal_exists() { + local addr=$(get_terminal_address) + if [ -n "$addr" ]; then + hyprjson clients | ${pkgs.jq}/bin/jq -e --arg ADDR "$addr" 'map(select(.address == $ADDR)) | any' >/dev/null 2>&1 + else + return 1 + fi + } + + # Function to check if terminal is in special workspace + terminal_in_special() { + local addr=$(get_terminal_address) + if [ -n "$addr" ]; then + hyprjson clients | ${pkgs.jq}/bin/jq -e --arg ADDR "$addr" --arg WS "$SPECIAL_WS" 'map(select(.address == $ADDR and .workspace.name == $WS)) | any' >/dev/null 2>&1 + else + return 1 + fi + } + + # Function to spawn terminal and capture its address + spawn_terminal() { + debug_echo "Creating new dropdown terminal with command: $TERMINAL_CMD" + + # Calculate dropdown position for later use + local pos_info=$(calculate_dropdown_position) + if [ $? -ne 0 ]; then + debug_echo "Warning: Using fallback positioning" + fi + local target_x target_y width height monitor_name + read -r target_x target_y width height monitor_name <<<"$pos_info" + if ! [[ "$target_x" =~ ^-?[0-9]+$ ]] || ! [[ "$target_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then + debug_echo "Invalid position parsed; using fallback values" + target_x=100 + target_y=100 + width=800 + height=600 + monitor_name="fallback-monitor" + fi + + debug_echo "Target position: ''${target_x},''${target_y}, size: ''${width}x''${height}" + + # Create a unique title so we can robustly identify the new window + local token=$(date +%s%N) + local title="dropterm-$token" + local spawn_cmd="$TERMINAL_CMD --class dropterminal --instance-group dropterminal --title $title" + + # Launch in scratchpad to avoid visible spawn; size will be enforced after detection + hyprctl dispatch exec "[float; workspace $SPECIAL_WS silent] $spawn_cmd" >/dev/null 2>&1 || true + + # Wait for the new window with our unique class/title (up to ~3s) + local new_addr="" + for i in $(seq 1 60); do + new_addr=$(hyprjson clients | ${pkgs.jq}/bin/jq -r --arg CLS "dropterminal" --arg TITLE "$title" \ + '.[] | select(.class == $CLS and .title == $TITLE) | .address' | head -1) + if [ -n "$new_addr" ]; then break; fi + sleep 0.05 + done + + if [ -n "$new_addr" ] && [ "$new_addr" != "null" ]; then + # Store the address and monitor name + echo "$new_addr $monitor_name" >"$ADDR_FILE" + debug_echo "Terminal created with address: $new_addr in special workspace on monitor $monitor_name" + + # Ensure scratchpad placement (in case exec flags were ignored) + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$new_addr" >/dev/null 2>&1 || true + ensure_floating "$new_addr" + hyprctl dispatch resizewindowpixel "exact $width $height,address:$new_addr" >/dev/null 2>&1 || true + + if [ "$SPAWN_ONLY" = true ]; then + # Keep it hidden for startup preload + debug_echo "Spawn-only: leaving terminal hidden in scratchpad" + return 0 + fi + + # Bring to current workspace and set up geometry/animation + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$new_addr" + ensure_floating "$new_addr" + hyprctl dispatch pin "address:$new_addr" + hyprctl dispatch resizewindowpixel "exact $width $height,address:$new_addr" + animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" + + return 0 + fi + + debug_echo "Failed to detect new kitty window; aborting spawn" + return 1 + } + + # Main logic + if terminal_exists; then + TERMINAL_ADDR=$(get_terminal_address) + debug_echo "Found existing terminal: $TERMINAL_ADDR" + focused_monitor=$(get_monitor_info | awk '{print $6}') + dropdown_monitor=$(get_terminal_monitor) + if [ "$focused_monitor" != "$dropdown_monitor" ]; then + debug_echo "Monitor focus changed: moving dropdown to $focused_monitor" + # Calculate new position for focused monitor + pos_info=$(calculate_dropdown_position) + read -r target_x target_y width height monitor_name <<<"$pos_info" + if ! [[ "$target_x" =~ ^-?[0-9]+$ ]] || ! [[ "$target_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then + debug_echo "Invalid position parsed; using fallback values" + target_x=100 + target_y=100 + width=800 + height=600 + monitor_name="fallback-monitor" + fi + # Move and resize window + hyprctl dispatch movewindowpixel "exact $target_x $target_y,address:$TERMINAL_ADDR" + hyprctl dispatch resizewindowpixel "exact $width $height,address:$TERMINAL_ADDR" + # Update ADDR_FILE + echo "$TERMINAL_ADDR $monitor_name" >"$ADDR_FILE" + fi + + if terminal_in_special; then + debug_echo "Bringing terminal from scratchpad with slide down animation" + + # Calculate target position + pos_info=$(calculate_dropdown_position) + read -r target_x target_y width height monitor_name <<<"$pos_info" + if ! [[ "$target_x" =~ ^-?[0-9]+$ ]] || ! [[ "$target_y" =~ ^-?[0-9]+$ ]] || \ + ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then + debug_echo "Invalid position parsed; using fallback values" + target_x=100 + target_y=100 + width=800 + height=600 + fi + + # Use movetoworkspacesilent to avoid affecting workspace history + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$TERMINAL_ADDR" + ensure_floating "$TERMINAL_ADDR" + hyprctl dispatch pin "address:$TERMINAL_ADDR" + + # Set size and animate slide down + hyprctl dispatch resizewindowpixel "exact $width $height,address:$TERMINAL_ADDR" + animate_slide_down "$TERMINAL_ADDR" "$target_x" "$target_y" "$width" "$height" + + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + else + debug_echo "Hiding terminal to scratchpad with slide up animation" + + # Get current geometry for animation + geometry=$(get_window_geometry "$TERMINAL_ADDR") + if [ -n "$geometry" ]; then + curr_x=$(echo $geometry | cut -d' ' -f1) + curr_y=$(echo $geometry | cut -d' ' -f2) + curr_width=$(echo $geometry | cut -d' ' -f3) + curr_height=$(echo $geometry | cut -d' ' -f4) + + debug_echo "Current geometry: ''${curr_x},''${curr_y} ''${curr_width}x''${curr_height}" + + # Animate slide up first + animate_slide_up "$TERMINAL_ADDR" "$curr_x" "$curr_y" "$curr_width" "$curr_height" + + # Small delay then move to special workspace and unpin + sleep 0.1 + hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle) + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + else + debug_echo "Could not get window geometry, moving to scratchpad without animation" + hyprctl dispatch pin "address:$TERMINAL_ADDR" + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + fi + fi + else + debug_echo "No existing terminal found, creating new one" + if spawn_terminal; then + TERMINAL_ADDR=$(get_terminal_address) + if [ "$SPAWN_ONLY" = false ] && [ -n "$TERMINAL_ADDR" ]; then + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + fi + fi + fi +'' diff --git a/modules/home/scripts/default.nix b/modules/home/scripts/default.nix index f88fade..4874006 100644 --- a/modules/home/scripts/default.nix +++ b/modules/home/scripts/default.nix @@ -1,28 +1,48 @@ -{ pkgs -, username -, profile -, ... +{ + config, + pkgs, + inputs, + username, + profile, + ... }: { home.packages = [ - (import ./emopicker9000.nix { inherit pkgs; }) - (import ./hm-find.nix { inherit pkgs; }) - (import ./keybinds.nix { inherit pkgs; }) - (import ./qs-keybinds.nix { inherit pkgs; }) - (import ./note.nix { inherit pkgs; }) - (import ./note-from-clipboard.nix { inherit pkgs; }) - (import ./nvidia-offload.nix { inherit pkgs; }) - (import ./rofi-launcher.nix { inherit pkgs; }) - (import ./screenshootin.nix { inherit pkgs; }) - (import ./squirtle.nix { inherit pkgs; }) - (import ./task-waybar.nix { inherit pkgs; }) + (import ./emopicker9000.nix {inherit pkgs;}) + (import ./hm-find.nix {inherit pkgs;}) + (import ./keybinds.nix {inherit pkgs;}) + (import ./qs-keybinds.nix {inherit pkgs;}) + (import ./note.nix {inherit pkgs;}) + (import ./note-from-clipboard.nix {inherit pkgs;}) + (import ./nvidia-offload.nix {inherit pkgs;}) + (import ./rofi-launcher.nix {inherit pkgs;}) + (import ./screenshootin.nix {inherit pkgs;}) + (import ./squirtle.nix {inherit pkgs;}) + (import ./task-waybar.nix {inherit pkgs;}) + (import ./DropTerminal.nix {inherit pkgs;}) (import ./wallsetter.nix { - inherit pkgs; + inherit pkgs inputs; inherit username; }) - (import ./web-search.nix { inherit pkgs; }) + (import ./web-search.nix {inherit pkgs;}) # Cheatsheets viewer + parser - (import ./cheatsheets-parser.nix { inherit pkgs; }) - (import ./qs-cheatsheets.nix { inherit pkgs; }) + (import ./cheatsheets-parser.nix {inherit pkgs;}) + (import ./qs-cheatsheets.nix {inherit config pkgs;}) + (import ./docs-parser.nix {inherit pkgs;}) + # QuickShell scripts + (import ./qs-vid-wallpapers.nix {inherit pkgs;}) + (import ./qs-vid-wallpapers-apply.nix {inherit pkgs;}) + (import ./qs-vid-wallpapers-watchdog.nix {inherit pkgs;}) + (import ./qs-wallpapers.nix {inherit pkgs;}) + (import ./qs-wallpapers-apply.nix {inherit pkgs inputs;}) + (import ./qs-wallpapers-restore.nix {inherit pkgs inputs;}) + (import ./qs-wlogout.nix {inherit pkgs;}) + (import ./qs-docs.nix {inherit pkgs;}) + (import ./docs-parser.nix {inherit pkgs;}) + (import ./hyprland-float-all.nix {inherit pkgs;}) + (import ./hyprland-change-layout.nix {inherit pkgs;}) + (import ./launch-nwg-menu.nix {inherit pkgs;}) + (import ./hyprland-dock.nix {inherit pkgs;}) + (import ./restart.noctalia.nix {inherit pkgs;}) (import ./zcli.nix { inherit pkgs profile; backupFiles = [ @@ -30,4 +50,15 @@ ]; }) ]; + + xdg.desktopEntries.dropterminal = { + name = "Drop Terminal"; + comment = "Dropdown terminal (Hyprland)"; + exec = "DropTerminal"; + terminal = false; + type = "Application"; + icon = "kitty"; + settings.StartupWMClass = "dropterminal"; + categories = ["System" "Utility" "TerminalEmulator"]; + }; } diff --git a/modules/home/scripts/docs-parser.nix b/modules/home/scripts/docs-parser.nix new file mode 100644 index 0000000..1276bea --- /dev/null +++ b/modules/home/scripts/docs-parser.nix @@ -0,0 +1,242 @@ +{pkgs}: +pkgs.writeShellScriptBin "docs-parser" '' + #!/usr/bin/env bash + set -euo pipefail + + # Default paths + DOCS_DIR="$HOME/ddubsos/docs" + + # Handle arguments + MODE="''${1:-files}" + CATEGORY="''${2:-AI}" + LANGUAGE="''${3:-en}" + + usage() { + cat </dev/null | sed 's/^# //' || echo "") + if [[ -n "$title" ]]; then + echo "$title" + else + # Fallback to clean filename + get_clean_filename "$filepath" + fi + else + get_clean_filename "$filepath" + fi + } + + # Main processing + case "$MODE" in + "files") + # Generate JSON list of available files for a category + echo "[" + + # Handle special "root" category for files in docs/ root directory + if [[ "$CATEGORY" == "root" ]]; then + # Find markdown files directly in docs root directory + if [[ -d "$DOCS_DIR" ]]; then + first=true + + while IFS= read -r -d "" filepath; do + file_lang=$(get_language "$filepath") + + # Filter by requested language + if [[ "$file_lang" == "$LANGUAGE" ]]; then + clean_name=$(get_clean_filename "$filepath") + title=$(get_title_from_file "$filepath") + + if [[ "$first" == "true" ]]; then + first=false + else + echo "," + fi + + cat <&2 + exit 1 + fi + else + # All files metadata with content + echo "[" + first=true + + if [[ -d "$DOCS_DIR/$CATEGORY" ]]; then + while IFS= read -r -d "" filepath; do + file_lang=$(get_language "$filepath") + + # Filter by requested language + if [[ "$file_lang" == "$LANGUAGE" ]]; then + clean_name=$(get_clean_filename "$filepath") + title=$(get_title_from_file "$filepath") + content=$(cat "$filepath" | ${pkgs.jq}/bin/jq -R -s .) + + if [[ "$first" == "true" ]]; then + first=false + else + echo "," + fi + + cat <&2 + usage >&2 + exit 1 + ;; + esac +'' diff --git a/modules/home/scripts/emopicker9000.nix b/modules/home/scripts/emopicker9000.nix index ed8e4ed..b622cc3 100644 --- a/modules/home/scripts/emopicker9000.nix +++ b/modules/home/scripts/emopicker9000.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: pkgs.writeShellScriptBin "emopicker9000" '' # check if rofi is already running if pidof rofi > /dev/null; then diff --git a/modules/home/scripts/gemini-cli.nix b/modules/home/scripts/gemini-cli.nix index d39d30c..acb521d 100644 --- a/modules/home/scripts/gemini-cli.nix +++ b/modules/home/scripts/gemini-cli.nix @@ -1,9 +1,11 @@ -{ config, pkgs, ... }: - -let +{ + config, + pkgs, + ... +}: let gemini-launcher = pkgs.writeShellScriptBin "gemini-launcher" '' #!${pkgs.bash}/bin/bash - + # Define the path to your API key file KEY_FILE="${config.home.homeDirectory}/gem.key" @@ -18,9 +20,7 @@ let exec ${pkgs.kitty}/bin/kitty -e bash -c "echo 'NOTE: Gemini API key file not found at ~/.gem.key.'; echo 'To use a key, create this file with content: export GEMINI_API_KEY=\"YOUR_KEY\"'; echo; echo 'Starting Gemini CLI, which will fall back to web-based login...'; echo; exec ${pkgs.gemini-cli}/bin/gemini" fi ''; - -in -{ +in { home.packages = [ gemini-launcher ]; @@ -32,6 +32,6 @@ in exec = "gemini-launcher"; terminal = false; type = "Application"; - categories = [ "Development" "Utility" ]; + categories = ["Development" "Utility"]; }; } diff --git a/modules/home/scripts/hm-find.nix b/modules/home/scripts/hm-find.nix index 77771d5..d997469 100644 --- a/modules/home/scripts/hm-find.nix +++ b/modules/home/scripts/hm-find.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: pkgs.writeShellScriptBin "hm-find" '' #!/usr/bin/env bash diff --git a/modules/home/scripts/hyprland-change-layout.nix b/modules/home/scripts/hyprland-change-layout.nix new file mode 100644 index 0000000..0ce0e65 --- /dev/null +++ b/modules/home/scripts/hyprland-change-layout.nix @@ -0,0 +1,85 @@ +{pkgs}: +pkgs.writeShellScriptBin "hyprland-change-layout" '' + #!/usr/bin/env bash + set -euo pipefail + + notif="''${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images/catppuccin-macchiato.png" + layouts=(dwindle master scrolling monocle) + + get_layout() { + ${pkgs.hyprland}/bin/hyprctl -j getoption general:layout | ${pkgs.jq}/bin/jq -r '.str' + } + + next_layout() { + local current="$1" + local i + for i in "''${!layouts[@]}"; do + if [[ "''${layouts[i]}" == "$current" ]]; then + echo "''${layouts[((i + 1) % ''${#layouts[@]})]}" + return + fi + done + echo "''${layouts[0]}" + } + + set_layout() { + local target="$1" + + ${pkgs.hyprland}/bin/hyprctl keyword general:layout "$target" + ${pkgs.hyprland}/bin/hyprctl keyword unbind SUPER,J || true + ${pkgs.hyprland}/bin/hyprctl keyword unbind SUPER,K || true + ${pkgs.hyprland}/bin/hyprctl keyword unbind SUPER,O || true + ${pkgs.hyprland}/bin/hyprctl keyword unbind SUPER_SHIFT,M || true + + case "$target" in + "dwindle") + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,J,cyclenext + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,K,cyclenext,prev + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,O,layoutmsg,togglesplit + ${pkgs.libnotify}/bin/notify-send -e -u low -i "$notif" " Dwindle Layout" + ;; + "master") + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,J,layoutmsg,cyclenext + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,K,layoutmsg,cycleprev + ${pkgs.libnotify}/bin/notify-send -e -u low -i "$notif" " Master Layout" + ;; + "scrolling") + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,J,cyclenext + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,K,cyclenext,prev + ${pkgs.libnotify}/bin/notify-send -e -u low -i "$notif" " Scrolling Layout" + ;; + "monocle") + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,J,layoutmsg,cyclenext + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER,K,layoutmsg,cycleprev + ${pkgs.hyprland}/bin/hyprctl keyword bind SUPER_SHIFT,M,layoutmsg,swapnext + ${pkgs.libnotify}/bin/notify-send -e -u low -i "$notif" " Monocle Layout" + ;; + *) + echo "Unknown layout: $target" >&2 + return 1 + ;; + esac + } + + current="$(get_layout)" + arg="''${1:-toggle}" + + case "$arg" in + init) + set_layout "$current" + ;; + toggle|next) + set_layout "$(next_layout "$current")" + ;; + set) + set_layout "''${2:-}" + ;; + master|dwindle|scrolling|monocle) + set_layout "$arg" + ;; + *) + echo "Usage: $(basename "$0") [toggle|next|init|set |master|dwindle|scrolling|monocle]" >&2 + exit 1 + ;; + esac +'' diff --git a/modules/home/scripts/hyprland-dock.nix b/modules/home/scripts/hyprland-dock.nix new file mode 100644 index 0000000..60b4c9e --- /dev/null +++ b/modules/home/scripts/hyprland-dock.nix @@ -0,0 +1,41 @@ +# ~/ddubsos/modules/home/scripts/hyprland-dock.nix +{pkgs}: +pkgs.writeShellScriptBin "dock" '' + + # Change to #!/usr/bin for non NixOS systems + ##!/bin/bash + # Author: Don Williams + # Date: 2025-08-03 + # Revision: 0.1 + # + # A script to toggle the nwg-dock-hyprland panel. + # For hyprland I create a bind to call this script. + # It's a toggle. + # + + # Variables + # I like nwg-drawer but you can use rofi, wofi, walker, etc + MENU="nwg-drawer -mb 100 -mt 100 -ml 300 -mr 300" + + # Masked apps won't show in DOCK. + # I am running pyprland scratchpads + # They don't show up correctly so I mask it off + MASK_APPS="kitty-dropterm" + + ICON_SIZE=32 + MARGIN_BOTTOM=10 + MARGIN_LEFT=10 + MARGIN_RIGHT=10 + ROWS=5 + + # If running kill it + if pgrep -f "nwg-dock-hyprland" > /dev/null + then + pkill -f "nwg-dock-hyprland" + else + # To disable launcher option set -nolauncher + # nwg-dock-hyprland -i 40 -x -mb 10 -w 3 -nolauncher + nwg-dock-hyprland -i "$ICON_SIZE" -w "$ROWS" -mb "$MARGIN_BOTTOM" -ml "$MARGIN_LEFT" -mr "$MARGIN_RIGHT" -x -g "$MASK_APPS" -c "$MENU" + fi + +'' diff --git a/modules/home/scripts/hyprland-float-all.nix b/modules/home/scripts/hyprland-float-all.nix new file mode 100644 index 0000000..e99c30f --- /dev/null +++ b/modules/home/scripts/hyprland-float-all.nix @@ -0,0 +1,11 @@ +{pkgs}: +pkgs.writeShellScriptBin "hyprland-float-all" '' + #!/usr/bin/env bash + set -euo pipefail + + ws="$(${pkgs.hyprland}/bin/hyprctl activeworkspace -j | ${pkgs.jq}/bin/jq -r .id)" + ${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r --arg ws "$ws" '.[] | select(.workspace.id == ($ws|tonumber)) | .address' \ + | while read -r addr; do + [ -n "''${addr:-}" ] && ${pkgs.hyprland}/bin/hyprctl dispatch togglefloating "address:$addr" + done +'' diff --git a/modules/home/scripts/keybinds-parser.nix b/modules/home/scripts/keybinds-parser.nix index 5451e94..0d2ef32 100644 --- a/modules/home/scripts/keybinds-parser.nix +++ b/modules/home/scripts/keybinds-parser.nix @@ -271,7 +271,7 @@ pkgs.writeShellScriptBin "keybinds-parser" '' else if (low ~ /(emacs|code|vscode|nvim|vim)/) category="editor" else if (low ~ /(rofi|wofi|dmenu|launcher)/) category="launcher" else if (low ~ /(chrome|chromium|firefox|brave|browser)/) category="browser" - else if (low ~ /(swww|wallpaper)/) category="wallpaper" + else if (low ~ /(awww|wallpaper)/) category="wallpaper" else if (low ~ /(playerctl|wpctl|pactl|pamixer|brightnessctl|volume|brightness)/) category="media" else category="app" } else { diff --git a/modules/home/scripts/keybinds.nix b/modules/home/scripts/keybinds.nix index d19af17..15da0ad 100644 --- a/modules/home/scripts/keybinds.nix +++ b/modules/home/scripts/keybinds.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: pkgs.writeShellScriptBin "list-keybinds" '' # check if rofi is already running if pidof rofi > /dev/null; then @@ -6,7 +6,7 @@ pkgs.writeShellScriptBin "list-keybinds" '' fi msg='☣️ NOTE ☣️: Clicking with Mouse or Pressing ENTER will have NO function' - + # Parse keybind entries from the Nix config and format for rofi display BIND_NIX="$HOME/zaneyos/modules/home/hyprland/binds.nix" if [[ -f "$BIND_NIX" ]]; then @@ -16,18 +16,18 @@ pkgs.writeShellScriptBin "list-keybinds" '' /noctaliaBind/ { in_block = 1; next } /rofiBind/ { in_block = 1; next } /bindd[ ]*=/ && /\[/ { in_block = 1; next } - + in_block { # Check for end of array if (/^[ ]*\]/) { in_block = 0 next } - + # Extract quoted string from line if (match($0, /"([^"]+)"/, arr)) { line = arr[1] - + # Split by comma to get: mods, key, desc, action, params n = split(line, parts, ",") if (n >= 3) { @@ -35,17 +35,17 @@ pkgs.writeShellScriptBin "list-keybinds" '' mods = parts[1] key = parts[2] desc = parts[3] - + gsub(/^[ \t]+|[ \t]+$/, "", mods) gsub(/^[ \t]+|[ \t]+$/, "", key) gsub(/^[ \t]+|[ \t]+$/, "", desc) - + # Build display keybind if (mods != "" && key != "") { display = mods " + " key gsub(/\$modifier/, "SUPER", display) gsub(/ +/, " ", display) - + # Output: "KEYBIND: Description" if (desc != "") { printf "%s: %s\n", display, desc diff --git a/modules/home/scripts/launch-nwg-menu.nix b/modules/home/scripts/launch-nwg-menu.nix new file mode 100644 index 0000000..08672ab --- /dev/null +++ b/modules/home/scripts/launch-nwg-menu.nix @@ -0,0 +1,9 @@ +{pkgs}: +pkgs.writeShellScriptBin "launch-nwg-menu" '' + set -euo pipefail + exec nwg-menu \ + -isl 32 -iss 18 -k -ml 10 -mt 0 -va top \ + -s "$HOME/.config/nwg-menu/style.css" \ + -cmd-lock string "hyprlock" \ + -cmd-logout "hyprctl dispatch exit" +'' diff --git a/modules/home/scripts/note-from-clipboard.nix b/modules/home/scripts/note-from-clipboard.nix index 3c4546e..ddb767a 100644 --- a/modules/home/scripts/note-from-clipboard.nix +++ b/modules/home/scripts/note-from-clipboard.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "note-from-clipboard" '' #!/usr/bin/env bash diff --git a/modules/home/scripts/note.nix b/modules/home/scripts/note.nix index 3554cb1..43a1786 100644 --- a/modules/home/scripts/note.nix +++ b/modules/home/scripts/note.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "note" '' # Colors for nice output @@ -16,7 +16,7 @@ pkgs.writeShellScriptBin "note" '' # XDG-compliant notes directory and file NOTES_DIR="$HOME/.local/share/notes" NOTES_FILE="$NOTES_DIR/notes.txt" - + # Create notes directory if it doesn't exist mkdir -p "$NOTES_DIR" @@ -42,24 +42,24 @@ pkgs.writeShellScriptBin "note" '' local note_text="$1" local timestamp=$(date '+%Y-%m-%d %H:%M:%S') local date_only=$(date '+%Y-%m-%d') - + # Create notes file if it doesn't exist touch "$NOTES_FILE" - + # Get next note number local note_num=1 if [ -f "$NOTES_FILE" ] && [ -s "$NOTES_FILE" ]; then note_num=$(grep -E "^#[0-9]+" "$NOTES_FILE" | sed 's/^#\([0-9]*\).*/\1/' | sort -n | tail -1) note_num=$((note_num + 1)) fi - + # Add the note with proper formatting { echo "#$note_num [$timestamp]" echo "$note_text" echo "" } >> "$NOTES_FILE" - + echo -e "''${GREEN}✓''${NC} Note #$note_num added ''${GRAY}($date_only)''${NC}" } @@ -70,14 +70,14 @@ pkgs.writeShellScriptBin "note" '' echo -e "''${GRAY}Use ''${CYAN}note ''${GRAY} to add your first note''${NC}" return fi - + echo -e "''${BOLD}''${BLUE}📝 Your Notes''${NC}" echo -e "''${GRAY}📁 $NOTES_FILE''${NC}" echo -e "''${GRAY}$(printf '%.0s─' {1..50})''${NC}" - + local in_note=false local note_content="" - + while IFS= read -r line; do # Check if line starts with # followed by numbers and space and [ if echo "$line" | grep -q "^#[0-9][0-9]* \["; then @@ -86,13 +86,13 @@ pkgs.writeShellScriptBin "note" '' echo -e "$note_content" echo "" fi - + # Extract note number and timestamp local num=$(echo "$line" | sed 's/^#\([0-9]*\) \[.*/\1/') local timestamp=$(echo "$line" | sed 's/^#[0-9]* \[\(.*\)\]/\1/') local date_part=$(echo "$timestamp" | cut -d' ' -f1) local time_part=$(echo "$timestamp" | cut -d' ' -f2) - + echo -e "''${BOLD}''${CYAN}#$num''${NC} ''${GRAY}[$date_part ''${YELLOW}$time_part''${GRAY}]''${NC}" in_note=true note_content="" @@ -113,13 +113,13 @@ pkgs.writeShellScriptBin "note" '' note_content="" fi done < "$NOTES_FILE" - + # Print last note if file doesn't end with empty line if [ "$in_note" = true ] && [ -n "$note_content" ]; then echo -e "$note_content" echo "" fi - + local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE") echo -e "''${GRAY}$(printf '%.0s─' {1..50})''${NC}" echo -e "''${GRAY}Total: ''${BOLD}$total_notes''${NC} ''${GRAY}notes''${NC}" @@ -128,27 +128,27 @@ pkgs.writeShellScriptBin "note" '' # Function to delete a note delete_note() { local note_num="$1" - + if [ ! -f "$NOTES_FILE" ] || [ ! -s "$NOTES_FILE" ]; then echo -e "''${RED}✗''${NC} No notes found" return 1 fi - + if ! echo "$note_num" | grep -q "^[0-9][0-9]*$"; then echo -e "''${RED}✗''${NC} Invalid note number: $note_num" return 1 fi - + # Check if note exists if ! grep -q "^#$note_num " "$NOTES_FILE"; then echo -e "''${RED}✗''${NC} Note #$note_num not found" return 1 fi - + # Create temporary file without the specified note local temp_file=$(mktemp) local skip_lines=false - + while IFS= read -r line; do if echo "$line" | grep -q "^#[0-9][0-9]* "; then local current_num=$(echo "$line" | sed 's/^#\([0-9]*\) .*/\1/') @@ -159,7 +159,7 @@ pkgs.writeShellScriptBin "note" '' skip_lines=false fi fi - + if [ "$skip_lines" = false ]; then echo "$line" >> "$temp_file" elif [ -z "$line" ]; then @@ -167,7 +167,7 @@ pkgs.writeShellScriptBin "note" '' skip_lines=false fi done < "$NOTES_FILE" - + mv "$temp_file" "$NOTES_FILE" echo -e "''${GREEN}✓''${NC} Note #$note_num deleted" } @@ -178,11 +178,11 @@ pkgs.writeShellScriptBin "note" '' echo -e "''${YELLOW}📝 No notes to clear''${NC}" return fi - + local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE") echo -e "''${YELLOW}⚠''${NC} This will delete all $total_notes notes. Are you sure? ''${GRAY}[y/N]''${NC}" read -r confirmation - + if echo "$confirmation" | grep -qi "^y"; then > "$NOTES_FILE" echo -e "''${GREEN}✓''${NC} All notes cleared" @@ -204,7 +204,7 @@ pkgs.writeShellScriptBin "note" '' piped_content="$piped_content"$'\n'"$line" fi done - + if [ -n "$piped_content" ]; then add_note "$piped_content" else @@ -213,7 +213,7 @@ pkgs.writeShellScriptBin "note" '' fi return fi - + # Handle command line arguments case "$1" in "") diff --git a/modules/home/scripts/nvidia-offload.nix b/modules/home/scripts/nvidia-offload.nix index ada00d9..a99f6d4 100644 --- a/modules/home/scripts/nvidia-offload.nix +++ b/modules/home/scripts/nvidia-offload.nix @@ -1,5 +1,4 @@ -{ pkgs }: - +{pkgs}: pkgs.writeShellScriptBin "nvidia-offload" '' export __NV_PRIME_RENDER_OFFLOAD=1 export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 diff --git a/modules/home/scripts/qs-cheatsheets.nix b/modules/home/scripts/qs-cheatsheets.nix index 0b3f988..9494ea2 100644 --- a/modules/home/scripts/qs-cheatsheets.nix +++ b/modules/home/scripts/qs-cheatsheets.nix @@ -1,4 +1,7 @@ -{pkgs}: +{ + config, + pkgs, +}: pkgs.writeShellScriptBin "qs-cheatsheets" '' #!/usr/bin/env bash set -euo pipefail @@ -263,9 +266,9 @@ pkgs.writeShellScriptBin "qs-cheatsheets" '' // Handle root directory files var filePath; if (selectedCategory === "root") { - filePath = "/home/dwilliams/zaneyos/cheatsheets/" + filename; + filePath = "${config.home.homeDirectory}/zaneyos/cheatsheets/" + filename; } else { - filePath = "/home/dwilliams/zaneyos/cheatsheets/" + selectedCategory + "/" + filename; + filePath = "${config.home.homeDirectory}/zaneyos/cheatsheets/" + selectedCategory + "/" + filename; } const xhr = new XMLHttpRequest(); diff --git a/modules/home/scripts/qs-docs.nix b/modules/home/scripts/qs-docs.nix new file mode 100644 index 0000000..b5dfc82 --- /dev/null +++ b/modules/home/scripts/qs-docs.nix @@ -0,0 +1,940 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-docs" '' + #!/usr/bin/env bash + set -euo pipefail + + # Configurable defaults via env + CATEGORY="''${DOCS_CATEGORY:-AI}" + LANGUAGE="''${DOCS_LANGUAGE:-en}" + + usage() { + cat <&2; exit 2 ;; + \\?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + # Validate category (dynamically check if directory exists or is "root") + if [[ "$CATEGORY" != "root" && ! -d "$HOME/ddubsos/docs/$CATEGORY" ]]; then + echo "Error: Category directory '$CATEGORY' not found in docs/" >&2 + echo "Available categories:" >&2 + echo " root" >&2 + ls -1 "$HOME/ddubsos/docs/" | grep -E '^[a-zA-Z]' | head -10 >&2 + exit 1 + fi + + # Validate language + if [[ "$LANGUAGE" != "en" && "$LANGUAGE" != "es" ]]; then + echo "Error: Invalid language '$LANGUAGE'. Use 'en' or 'es'" >&2 + exit 1 + fi + + # Perf timing helpers + now_ms() { ${pkgs.coreutils}/bin/date +%s%3N; } + if [ -n "''${QS_PERF:-}" ]; then t0=$(now_ms); fi + + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + files_json="$tmpdir/files.json" + categories_json="$tmpdir/categories.json" + qml="$tmpdir/docs.qml" + + # Helper: convert all markdown to HTML for better rendering fidelity + convert_markdown_sets() { + # Simple on-disk cache to speed up launches + CACHE_ROOT="''${XDG_CACHE_HOME:-$HOME/.cache}/qs-html/docs" + + # Iterate all generated files_*.json manifests + for json in "$tmpdir"/files_*.json; do + [ -f "$json" ] || continue + name=$(basename "$json") + # files__.json + category="''${name#files_}" + category="''${category%_*}" + language="''${name##*_}" + language="''${language%.json}" + outdir="$tmpdir/html/$category/$language" + cachedir="$CACHE_ROOT/$category/$language" + ${pkgs.coreutils}/bin/mkdir -p "$outdir" "$cachedir" + # Extract paths from JSON + while IFS= read -r src; do + [ -n "$src" ] || continue + base="$(basename "$src")" + base_noext="''${base%.*}" + out="$outdir/''${base_noext}.html" + cache="$cachedir/''${base_noext}.html" + + # If cache is newer than source, reuse it + if [ -f "$cache" ] && [ "$cache" -nt "$src" ]; then + ${pkgs.coreutils}/bin/cp -f "$cache" "$out" + continue + fi + + # Convert with pandoc (GitHub-Flavored Markdown) to a temp file, then update cache and out + tmp_html="$out.tmp" + if ${pkgs.pandoc}/bin/pandoc -f gfm -t html5 --wrap=none "$src" -o "$tmp_html" 2>/dev/null; then + ${pkgs.coreutils}/bin/cp -f "$tmp_html" "$out" + ${pkgs.coreutils}/bin/cp -f "$tmp_html" "$cache" + ${pkgs.coreutils}/bin/rm -f "$tmp_html" + else + # Fallback: escape and wrap in
+            esc=$(<"$src" ${pkgs.gnused}/bin/sed -e 's/&/\&/g' -e 's//\>/g')
+            printf '
%s
' \"$esc\" | ${pkgs.coreutils}/bin/tee \"$out\" > \"$cache\" >/dev/null + fi + done < <(${pkgs.jq}/bin/jq -r '.[] | .path // empty' "$json" 2>/dev/null) + done + } + + # Generate data + if [ -n "''${QS_PERF:-}" ]; then t1=$(now_ms); fi + ${pkgs.callPackage ./docs-parser.nix {}}/bin/docs-parser files "$CATEGORY" "$LANGUAGE" > "$files_json" + ${pkgs.callPackage ./docs-parser.nix {}}/bin/docs-parser categories > "$categories_json" + + # Generate files for all categories and languages for switching + # First generate root directory files + for lang in en es; do + ${pkgs.callPackage ./docs-parser.nix {}}/bin/docs-parser files "root" "$lang" > "$tmpdir/files_root_''${lang}.json" 2>/dev/null || echo '[]' > "$tmpdir/files_root_''${lang}.json" + done + + # Then dynamically discover all category directories + if [ -d "$HOME/ddubsos/docs" ]; then + for category_dir in "$HOME/ddubsos/docs"/*/; do + if [ -d "$category_dir" ]; then + category=$(basename "$category_dir") + for lang in en es; do + ${pkgs.callPackage ./docs-parser.nix {}}/bin/docs-parser files "$category" "$lang" > "$tmpdir/files_''${category}_''${lang}.json" 2>/dev/null || echo '[]' > "$tmpdir/files_''${category}_''${lang}.json" + done + fi + done + fi + + # Convert all discovered Markdown files to HTML for RichText rendering + convert_markdown_sets + + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms=$((t2 - t1))" >&2; fi + + # Optional: shell-only mode for perf (skip QML) + if [ -n "''${QS_SHELL_ONLY:-}" ]; then + if [ -n "''${QS_PERF:-}" ]; then echo "[perf] shell_only=1 total_ms=$((t2 - t0))" >&2; fi + exit 0 + fi + + # Derive QML flags from env + PERF_BOOL=false; [ -n "''${QS_PERF:-}" ] && PERF_BOOL=true + AUTO_QUIT_BOOL=false; [ -n "''${QS_AUTO_QUIT:-}" ] && AUTO_QUIT_BOOL=true + + # Create QML interface + cat > "$qml" < 0 && (!win.selectedFile || win.selectedFile === "")) { + win.selectedFile = result[0].filename; + win.loadFileContent(result[0].filename); + } + } catch (e) { + console.error("Failed to parse files JSON:", e); + console.log("Response text:", xhr.responseText); + win.docsFiles = []; + win.filesLoaded = true; + // Clear the model on parse error + filesModel.clear(); + } + } else { + console.error("Failed to load files, status:", xhr.status); + console.log("File path:", filePath); + win.docsFiles = []; + win.filesLoaded = true; + filesModel.clear(); + } + } + }; + xhr.open("GET", "file://" + filePath); + xhr.send(); + } + + // Load content of specific file + function loadFileContent(filename) { + console.log("Loading content for:", filename); + + // Handle root directory files + var filePath; + if (selectedCategory === "root") { + filePath = "/home/dwilliams/ddubsos/docs/" + filename; + } else { + filePath = "/home/dwilliams/ddubsos/docs/" + selectedCategory + "/" + filename; + } + + const xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status === 200 || xhr.status === 0) { + win.fileContent = xhr.responseText; + win.selectedFile = filename; + + // Also load pre-converted HTML for better rendering + var base = filename.replace(/\.[^.]+$/, ""); + var htmlPath = win.tmpDir + "/html/" + win.selectedCategory + "/" + win.selectedLanguage + "/" + base + ".html"; + const xhr2 = new XMLHttpRequest(); + xhr2.onreadystatechange = function() { + if (xhr2.readyState === XMLHttpRequest.DONE) { + if (xhr2.status === 200 || xhr2.status === 0) { + win.htmlContent = xhr2.responseText; + } else { + win.htmlContent = ""; + } + win.updateSearch(); // recompute matches and content after html load + } + }; + xhr2.open("GET", "file://" + htmlPath); + xhr2.send(); + } else { + win.fileContent = "Error loading file: " + filename; + win.htmlContent = ""; + win.displayedContent = "Error loading file: " + filename; + win.matchPositions = []; + win.searchCount = 0; + win.currentMatchIndex = 0; + } + } + }; + xhr.open("GET", "file://" + filePath); + xhr.send(); + } + + // Load available categories + function loadCategories() { + const xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status === 200 || xhr.status === 0) { + try { + const result = JSON.parse(xhr.responseText); + win.availableCategories = result; + } catch (e) { + console.error("Failed to parse categories JSON:", e); + win.availableCategories = ["AI", "Zed", "ddubsos"]; + } + } + } + }; + xhr.open("GET", "file://" + categoriesJsonPath); + xhr.send(); + } + + // Switch category + function switchCategory(newCategory) { + selectedCategory = newCategory; + selectedFile = ""; + fileContent = ""; + loadDocsFiles(); + } + + // Switch language + function switchLanguage(newLanguage) { + selectedLanguage = newLanguage; + selectedFile = ""; + fileContent = ""; + loadDocsFiles(); + } + + // Escape HTML for safe RichText rendering + function escapeHtml(s) { + return s + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/\"/g, """) + .replace(/'/g, "'"); + } + + + function rebuildDisplayedContent() { + if (!fileContent || fileContent.length === 0) { + displayedContent = ""; + return; + } + // Prefer pre-converted HTML if available; fallback to escaped pre + if (htmlContent && htmlContent.length > 0) { + displayedContent = htmlContent; + } else { + displayedContent = "
" + escapeHtml(fileContent) + "
"; + } + } + + // Update search matches and rebuild content + function updateSearch() { + matchPositions = []; + searchCount = 0; + currentMatchIndex = 0; + + // Clear matches list by default + matchesModel.clear(); + + if (!fileContent || !searchQuery || searchQuery.trim() === "") { + rebuildDisplayedContent(); + return; + } + var needle = String(searchQuery).toLowerCase(); + if (needle.length === 0) { + rebuildDisplayedContent(); + return; + } + var hay = String(fileContent).toLowerCase(); + var idx = 0; + while (true) { + var pos = hay.indexOf(needle, idx); + if (pos === -1) break; + matchPositions.push([pos, pos + needle.length]); + idx = pos + needle.length; + } + + searchCount = matchPositions.length; + + // Build matches list with context snippets + for (var j = 0; j < matchPositions.length; j++) { + var s = matchPositions[j][0]; + var e = matchPositions[j][1]; + var ctxStart = Math.max(0, s - 80); + var ctxEnd = Math.min(fileContent.length, e + 80); + var snippet = fileContent.slice(ctxStart, ctxEnd).replace(/\n/g, " "); + matchesModel.append({ idx: j, start: s, snippet: snippet }); + } + + currentMatchIndex = (searchCount > 0) ? 0 : 0; + rebuildDisplayedContent(); + } + + function scrollToApproximatePosition(pos) { + var flick = contentScroll && contentScroll.contentItem ? contentScroll.contentItem : null; + if (!flick || !fileContent || fileContent.length === 0) return; + var ratio = Math.max(0, Math.min(1, pos / fileContent.length)); + var maxY = Math.max(0, flick.contentHeight - contentScroll.height); + flick.contentY = ratio * maxY; + } + + function jumpToMatch(index) { + if (searchCount <= 0) return; + var clamped = Math.max(0, Math.min(searchCount - 1, index)); + currentMatchIndex = clamped; + var start = matchPositions[currentMatchIndex][0]; + scrollToApproximatePosition(start); + if (typeof matchesList !== 'undefined' && matchesList) { + matchesList.positionViewAtIndex(currentMatchIndex, ListView.Center); + } + } + + function gotoNextMatch() { + if (searchCount <= 0) return; + var next = (currentMatchIndex + 1) % searchCount; + jumpToMatch(next); + } + + function gotoPrevMatch() { + if (searchCount <= 0) return; + var prev = (currentMatchIndex - 1 + searchCount) % searchCount; + jumpToMatch(prev); + } + + Component.onCompleted: { + qStart = Date.now(); + if (perfEnabled) console.log("[perf] q0_window_created"); + loadCategories(); + loadDocsFiles(); + updateSearch(); + } + + // App-wide shortcuts + Shortcut { + sequences: [ "Escape" ] + context: Qt.ApplicationShortcut + onActivated: Qt.quit() + } + + Shortcut { + sequences: [ "N", "Right" ] + context: Qt.ApplicationShortcut + onActivated: win.gotoNextMatch() + } + + Shortcut { + sequences: [ "P", "Left" ] + context: Qt.ApplicationShortcut + onActivated: win.gotoPrevMatch() + } + + Rectangle { + id: frame + anchors.fill: parent + anchors.margins: 12 + radius: 12 + border.width: 0 + border.color: "#00000000" + color: "#DD000000" + clip: true + + Row { + anchors.fill: parent + anchors.margins: 16 + spacing: 16 + + // Left sidebar + Rectangle { + id: sidebar + width: 400 + height: parent.height + radius: 8 + color: "#BB111111" + border.width: 1 + border.color: "#444444" + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 12 + + // Category buttons + Text { + text: "Categories" + color: "#66ccff" + font.pixelSize: 16 + font.bold: true + } + + Flow { + width: parent.width + spacing: 6 + + Repeater { + model: availableCategories + + Button { + property string categoryName: modelData || "" + text: categoryName.charAt(0).toUpperCase() + categoryName.slice(1) + width: Math.max(80, text.length * 8 + 16) + height: 32 + background: Rectangle { + color: win.selectedCategory === categoryName ? "#66ccff" : "#333333" + radius: 6 + border.width: 1 + border.color: "#555555" + } + contentItem: Text { + text: parent.text + color: win.selectedCategory === categoryName ? "#000000" : "#cccccc" + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + onClicked: { + win.switchCategory(categoryName); + } + } + } + } + + // Language toggle + Row { + spacing: 8 + + Text { + text: "Language:" + color: "#cccccc" + anchors.verticalCenter: parent.verticalCenter + } + + Button { + text: "EN" + width: 40 + height: 28 + background: Rectangle { + color: win.selectedLanguage === "en" ? "#66ccff" : "#333333" + radius: 4 + border.width: 1 + border.color: "#555555" + } + contentItem: Text { + text: parent.text + color: win.selectedLanguage === "en" ? "#000000" : "#cccccc" + font.pixelSize: 11 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + onClicked: win.switchLanguage("en") + } + + Button { + text: "ES" + width: 40 + height: 28 + background: Rectangle { + color: win.selectedLanguage === "es" ? "#66ccff" : "#333333" + radius: 4 + border.width: 1 + border.color: "#555555" + } + contentItem: Text { + text: parent.text + color: win.selectedLanguage === "es" ? "#000000" : "#cccccc" + font.pixelSize: 11 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + onClicked: win.switchLanguage("es") + } + } + + // File list + Text { + text: "Files" + color: "#66ccff" + font.pixelSize: 14 + font.bold: true + } + + ScrollView { + width: parent.width + height: parent.height - 160 + clip: true + + ListView { + id: filesList + model: filesModel + spacing: 4 + + delegate: Rectangle { + property string fileName: model.filename || "" + property string cleanName: model.clean_name || fileName + property string fileTitle: model.title || "" + + width: filesList.width - 20 + height: 40 + radius: 6 + color: win.selectedFile === fileName ? "#66ccff" : "transparent" + border.width: 1 + border.color: win.selectedFile === fileName ? "#66ccff" : "#333333" + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.color = "#66ccff" + onExited: parent.border.color = win.selectedFile === fileName ? "#66ccff" : "#333333" + onClicked: { + if (fileName) { + win.loadFileContent(fileName); + } + } + } + + Column { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 12 + anchors.rightMargin: 12 + + Text { + text: cleanName || fileName || "Unknown file" + color: win.selectedFile === fileName ? "#000000" : "#ffffff" + font.pixelSize: 13 + font.bold: true + width: parent.width + elide: Text.ElideRight + } + + Text { + text: fileTitle || "" + color: win.selectedFile === fileName ? "#333333" : "#cccccc" + font.pixelSize: 10 + width: parent.width + elide: Text.ElideRight + visible: text !== "" + } + } + } + } + } + } + } + + // Main content area + Rectangle { + id: contentArea + width: parent.width - sidebar.width - 16 + height: parent.height + radius: 8 + color: "#BB111111" + border.width: 1 + border.color: "#444444" + + Column { + anchors.fill: parent + anchors.margins: 16 + spacing: 12 + + // Search bar + Rectangle { + width: parent.width + height: 36 + radius: 6 + border.width: 1 + border.color: "#66ccff" + color: "#BB000000" + + Row { + anchors.fill: parent + anchors.margins: 8 + spacing: 8 + + Rectangle { + width: parent.width - 220 + height: parent.height + color: "transparent" + + TextInput { + id: searchInput + anchors.fill: parent + anchors.margins: 4 + color: "white" + font.pixelSize: 14 + onTextChanged: { + win.searchQuery = text; + win.updateSearch(); + } + Keys.onPressed: (ev) => { + if (ev.key === Qt.Key_N || ev.key === Qt.Key_Right) { win.gotoNextMatch(); ev.accepted = true; } + else if (ev.key === Qt.Key_P || ev.key === Qt.Key_Left) { win.gotoPrevMatch(); ev.accepted = true; } + } + } + + Text { + text: "Search in file..." + color: "#88ffffff" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 8 + visible: searchInput.text.length === 0 + } + } + + Text { + text: (win.searchCount > 0 ? "[" + (win.currentMatchIndex + 1) + "/" + win.searchCount + "]" : "[0/0]") + color: win.searchCount > 0 ? "#00e676" : "#ff5252" + font.pixelSize: 14 + verticalAlignment: Text.AlignVCenter + } + + Item { + width: 5 + height: 1 + } + + Button { + text: "Prev" + width: 60 + height: parent.height - 4 + onClicked: win.gotoPrevMatch() + enabled: win.searchCount > 0 + background: Rectangle { + color: parent.enabled ? "#333333" : "#222222" + radius: 4 + border.width: 1 + border.color: "#555555" + } + contentItem: Text { + text: parent.text + color: parent.enabled ? "#ffffff" : "#888888" + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + Button { + text: "Next" + width: 60 + height: parent.height - 4 + onClicked: win.gotoNextMatch() + enabled: win.searchCount > 0 + background: Rectangle { + color: parent.enabled ? "#333333" : "#222222" + radius: 4 + border.width: 1 + border.color: "#555555" + } + contentItem: Text { + text: parent.text + color: parent.enabled ? "#ffffff" : "#888888" + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + + CheckBox { + id: matchesToggle + text: "Matches" + checked: true + anchors.verticalCenter: parent.verticalCenter + } + } + } + + // Content and matches view + Row { + id: contentRow + width: parent.width + height: parent.height - 48 + spacing: 12 + + // Main content + ScrollView { + id: contentScroll + width: matchesPanel.visible ? parent.width - matchesPanel.width - 12 : parent.width + height: parent.height + clip: true + + TextEdit { + id: contentDisplay + text: win.displayedContent + textFormat: TextEdit.RichText + color: "#ffffff" + font.family: "monospace" + font.pixelSize: 13 + readOnly: true + selectByMouse: true + wrapMode: TextEdit.Wrap + persistentSelection: true + Keys.onPressed: (ev) => { + if (ev.key === Qt.Key_N || ev.key === Qt.Key_Right) { win.gotoNextMatch(); ev.accepted = true; } + else if (ev.key === Qt.Key_P || ev.key === Qt.Key_Left) { win.gotoPrevMatch(); ev.accepted = true; } + } + } + } + + // Matches panel + Rectangle { + id: matchesPanel + width: visible ? 320 : 0 + height: parent.height + radius: 6 + color: "#BB000000" + border.width: 1 + border.color: "#555555" + visible: win.searchCount > 0 && matchesToggle.checked + + Column { + anchors.fill: parent + anchors.margins: 8 + spacing: 8 + + Text { + text: "Matches (" + win.searchCount + ")" + color: "#66ccff" + font.pixelSize: 13 + font.bold: true + } + + ScrollView { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + clip: true + + ListView { + id: matchesList + model: matchesModel + spacing: 6 + delegate: Rectangle { + property int matchIndex: model.idx || index + property string snippet: model.snippet || "" + width: matchesList.width - 12 + height: Math.min(snippetText.implicitHeight + 16, 100) + radius: 6 + color: win.currentMatchIndex === matchIndex ? "#66ccff" : "transparent" + border.width: 1 + border.color: win.currentMatchIndex === matchIndex ? "#66ccff" : "#333333" + + MouseArea { + anchors.fill: parent + onClicked: win.jumpToMatch(matchIndex) + } + + Column { + anchors.fill: parent + anchors.margins: 8 + spacing: 4 + + Text { + text: "#" + (matchIndex + 1) + color: win.currentMatchIndex === matchIndex ? "#000000" : "#bbbbbb" + font.pixelSize: 10 + } + Text { + id: snippetText + text: snippet + textFormat: Text.PlainText + color: win.currentMatchIndex === matchIndex ? "#000000" : "#dddddd" + font.pixelSize: 11 + wrapMode: Text.Wrap + elide: Text.ElideRight + } + } + } + } + } + } + } + } + } + } + } + } + } + QML_TEMPLATE + + # Prepare QML runtime environment (Qt6) + export QT_QPA_PLATFORM="wayland;xcb" + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:${pkgs.qt6.qtwayland}/lib/qt-6/plugins" + export QML_IMPORT_PATH="${pkgs.qt6.qtbase}/lib/qt-6/qml:${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtsvg}/lib/qt-6/qml" + export QML2_IMPORT_PATH="$QML_IMPORT_PATH" + export QML_XHR_ALLOW_FILE_READ="1" + + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml" + if ! [ -x "$QML_BIN" ]; then + if [ -x "${pkgs.qt6.qtdeclarative}/bin/qml6" ]; then + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml6" + elif command -v qml >/dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + fi + fi + + # Debug mode: run QML directly and do not filter output + if [ -n "''${QS_DEBUG:-}" ]; then + { + echo "[qs-docs] CATEGORY=$CATEGORY" >&2 + echo "[qs-docs] LANGUAGE=$LANGUAGE" >&2 + echo "[qs-docs] QML_BIN=$QML_BIN" >&2 + echo "[qs-docs] QML_FILE=$qml" >&2 + } || true + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + exec "$QML_BIN" "$qml" + fi + + # Run QML runtime + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + output=$({ "$QML_BIN" "$qml" 2>&1 || true; }) + + # Handle any output if needed + if [ -n "''${output:-}" ]; then + echo "$output" + fi +'' diff --git a/modules/home/scripts/qs-panels.nix b/modules/home/scripts/qs-panels.nix new file mode 100644 index 0000000..2f0f97c --- /dev/null +++ b/modules/home/scripts/qs-panels.nix @@ -0,0 +1,152 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-panels" '' + #!/usr/bin/env bash + set -euo pipefail + + # Detect current active panel/bar (robust matching, no regex metachar) + active="" + if pgrep -x waybar >/dev/null 2>&1; then active="waybar"; fi + if pgrep -x dms >/dev/null 2>&1 || pgrep -fa dms | grep -q "\bdms\b.*\brun\b"; then active="dms"; fi + if pgrep -fa quickshell | grep -q "noctalia-shell"; then active="noctalia"; fi + + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + qml="$tmpdir/panels.qml" + + # Style parameters + WIDTH=440; HEIGHT=220 + + cat > "$qml" </dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + fi + fi + + # Run QML and capture selection from console + # Capture selection robustly from console output + sel=$({ "$QML_BIN" "$qml" 2>&1 || true; } \ + | ${pkgs.gnugrep}/bin/grep -o 'SELECT:[A-Za-z0-9_-]*' \ + | ${pkgs.coreutils}/bin/tail -n 1 \ + | ${pkgs.coreutils}/bin/cut -d: -f2 \ + | ${pkgs.coreutils}/bin/tr -d '\r' \ + | ${pkgs.gnused}/bin/sed 's/^\s\+//;s/\s\+$//' ) + + # Fallback debug: write last log when empty selection + if [ -z "${sel:-}" ]; then + mkdir -p "$HOME/.cache" + { "$QML_BIN" "$qml" 2>&1 || true; } > "$HOME/.cache/qs-panels.lastlog" || true + fi + + # Resolve runner path explicitly to avoid PATH issues inside QML-launched env + run_and_exit() { + local bin + bin=$(command -v "$1" || true) + if [ -n "$bin" ]; then + exec "$bin" + else + echo "Error: $1 not found" >&2 + exit 1 + fi + } + + case "${sel:-}" in + noctalia) run_and_exit noctalia-run ;; + dms) run_and_exit dms-run ;; + waybar) run_and_exit waybar-run ;; + *) exit 0 ;; + esac +'' diff --git a/modules/home/scripts/qs-vid-wallpapers-apply.nix b/modules/home/scripts/qs-vid-wallpapers-apply.nix new file mode 100644 index 0000000..61be824 --- /dev/null +++ b/modules/home/scripts/qs-vid-wallpapers-apply.nix @@ -0,0 +1,101 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-vid-wallpapers-apply" '' + #!/usr/bin/env bash + set -euo pipefail + + [ -n "''${QS_DEBUG:-}" ] && set -x + DEBUG="''${QS_DEBUG:-}" + log() { if [ -n "$DEBUG" ]; then echo "[qs-vid-apply] $*" >&2; fi } + + PRINT_ONLY=0 + SHELL_ONLY=0 + while [ $# -gt 0 ]; do + case "$1" in + --print-only) PRINT_ONLY=1; shift ;; + --shell-only) SHELL_ONLY=1; shift ;; + *) break ;; + esac + done + + BACKEND="''${WALLPAPER_BACKEND:-mpvpaper}" + + if [ $SHELL_ONLY -eq 1 ]; then + log "Shell-only perf run" + QS_DEBUG= QS_SHELL_ONLY=1 QS_PERF="''${QS_PERF:-}" qs-vid-wallpapers 2> >(cat >&2) || true + exit 0 + fi + + if [ $PRINT_ONLY -eq 1 ]; then + log "Print-only run; auto-quit picker" + if [ -n "''${QS_PERF:-}" ]; then + QS_AUTO_QUIT=1 QS_PERF="''${QS_PERF:-}" QS_DEBUG=1 qs-vid-wallpapers "$@" || true + else + sel="$(QS_AUTO_QUIT=1 QS_DEBUG= qs-vid-wallpapers "$@" || true)" + log "Selected=$sel" + fi + exit 0 + fi + + out="$(QS_DEBUG= QS_AUTO_QUIT= QS_PERF= qs-vid-wallpapers "$@" || true)" + sel=$(${pkgs.coreutils}/bin/printf "%s\n" "$out" | ${pkgs.gawk}/bin/awk -F'SELECT:' '/SELECT:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + audio=$(${pkgs.coreutils}/bin/printf "%s\n" "$out" | ${pkgs.gawk}/bin/awk -F'AUDIO:' '/AUDIO:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + + # Fallback: some picker builds output only the path; if so, treat it as selection + if [ -z "''${sel:-}" ] && [ -n "''${out:-}" ] && [ -f "''${out}" ]; then + sel="$out" + fi + + if [ -z "''${sel:-}" ]; then + log "No selection received; exiting" + exit 0 + fi + + # default to OFF if not provided by picker + if [ -z "''${audio:-}" ]; then + audio="OFF" + fi + + log "Backend=$BACKEND" + log "Selected=$sel" + log "Audio=$audio" + + # Force mpvpaper for video wallpapers + if [ "''${BACKEND}" != "mpvpaper" ]; then + log "Forcing BACKEND=mpvpaper for video wallpapers (was: $BACKEND)" + BACKEND="mpvpaper" + fi + + case "$BACKEND" in + mpvpaper) + log "Stopping awww-daemon, hyprpaper, mpvpaper if running" + ${pkgs.procps}/bin/pkill -x awww-daemon >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x hyprpaper >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + log "Sleeping briefly before starting mpvpaper" + ${pkgs.coreutils}/bin/sleep 0.2 + # Build mpv options string based on audio toggle + # Use both --loop-file and --loop for maximum compatibility + opts="--loop-file=inf --loop=inf --image-display-duration=inf --no-osc --no-osd-bar --keep-open=yes" + if [ """$audio""" != "ON" ]; then + opts="--no-audio $opts" + fi + if [ -n "$DEBUG" ]; then + ${pkgs.mpvpaper}/bin/mpvpaper \ + -o "$opts" \ + '*' "$sel" & + else + ${pkgs.mpvpaper}/bin/mpvpaper \ + -o "$opts" \ + '*' "$sel" >/dev/null 2>&1 & + fi + disown || true + log "mpvpaper launched" + exit 0 + ;; + + *) + echo "Unknown BACKEND: $BACKEND" >&2 + exit 2 + ;; + esac +'' diff --git a/modules/home/scripts/qs-vid-wallpapers-watchdog.nix b/modules/home/scripts/qs-vid-wallpapers-watchdog.nix new file mode 100644 index 0000000..acae25f --- /dev/null +++ b/modules/home/scripts/qs-vid-wallpapers-watchdog.nix @@ -0,0 +1,48 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-vid-wallpapers-watchdog" '' + #!/usr/bin/env bash + set -euo pipefail + + [ -n "''${QS_DEBUG:-}" ] && set -x + DEBUG="''${QS_DEBUG:-}" + log() { if [ -n "$DEBUG" ]; then echo "[qs-vid-watchdog] $*" >&2; fi } + + log "Starting video wallpaper watchdog" + + # Get the current video wallpaper if any + STATE_DIR="''${XDG_STATE_HOME:-$HOME/.local/state}/qs-wallpapers" + STATE_FILE_JSON="$STATE_DIR/current.json" + + if [ -f "$STATE_FILE_JSON" ]; then + CURRENT_VIDEO="$(${pkgs.jq}/bin/jq -r '.path // empty' "$STATE_FILE_JSON" 2>/dev/null || true)" + if [ -n "$CURRENT_VIDEO" ] && [ -f "$CURRENT_VIDEO" ]; then + log "Monitoring video wallpaper: $CURRENT_VIDEO" + + # Monitor and restart if needed + while true; do + # Check if mpvpaper is running with video files + if ! ${pkgs.procps}/bin/pgrep -f "mpvpaper.*\.\(mp4|m4v|mp4v|mov|webm|avi|mkv|mpeg|mpg|wmv|avchd|flv|ogv|m2ts|ts|3gp\)" > /dev/null; then + log "Video wallpaper stopped, restarting..." + + # Get audio preference from state if available + AUDIO="OFF" + + # Start mpvpaper with same options as the original script + opts="--loop=inf --no-audio --no-osc --no-osd-bar --keep-open=yes --keepaspect=yes --hwdec=auto" + + ${pkgs.mpvpaper}/bin/mpvpaper \ + -o "$opts" \ + '*' "$CURRENT_VIDEO" >/dev/null 2>&1 & + + # Let it start + sleep 3 + fi + + # Check every 10 seconds + sleep 10 + done + fi + fi + + log "No video wallpaper to monitor" +'' diff --git a/modules/home/scripts/qs-vid-wallpapers.nix b/modules/home/scripts/qs-vid-wallpapers.nix new file mode 100644 index 0000000..a3d5e4a --- /dev/null +++ b/modules/home/scripts/qs-vid-wallpapers.nix @@ -0,0 +1,575 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-vid-wallpapers" '' + #!/usr/bin/env bash + set -euo pipefail + + # Configurable defaults via env + DIR="''${WALL_DIR:-$HOME/Pictures/Wallpapers}" + CACHE="''${VID_WALL_CACHE_DIR:-$HOME/.cache/vidthumbs}" + SIZE="''${VID_WALL_THUMB_SIZE:-200}" + + usage() { + cat <&2; exit 2 ;; + \?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + if [ ! -d "$DIR" ]; then + echo "Video wallpapers directory not found: $DIR" >&2 + DIR_MISSING=1 + else + DIR_MISSING=0 + fi + + mkdir -p "$CACHE" + + # Perf timing helpers + now_ms() { ${pkgs.coreutils}/bin/date +%s%3N; } + if [ -n "''${QS_PERF:-}" ]; then t0=$(now_ms); fi + + # Collect videos deterministically + mapfile -t VIDEOS < <( { ${pkgs.findutils}/bin/find -L "$DIR" \ + \( -type f -o -xtype f \) \ + \( -iname '*.mp4' -o -iname '*.m4v' -o -iname '*.mp4v' -o \ + -iname '*.mov' -o -iname '*.webm' -o -iname '*.avi' -o \ + -iname '*.mkv' -o -iname '*.mpeg' -o -iname '*.mpg' -o \ + -iname '*.wmv' -o -iname '*.avchd' -o -iname '*.flv' -o \ + -iname '*.ogv' -o -iname '*.m2ts' -o -iname '*.ts' -o \ + -iname '*.3gp' -o -iname '*.avif' -o -iname '*.AVIF' \) \ + -print0 2>/dev/null || true; } \ + | ${pkgs.coreutils}/bin/tr '\0' '\n' | ${pkgs.coreutils}/bin/sort -f ) + if [ -n "''${QS_PERF:-}" ]; then t1=$(now_ms); echo "[perf] find_ms=$((t1 - t0))" >&2; fi + + if [ "''${#VIDEOS[@]}" -eq 0 ]; then + if [ -n "''${QS_DEBUG:-}" ]; then + echo "[qs-vid-wallpapers] No videos found in $DIR (followed symlinks); launching empty UI" >&2 + fi + EMPTY=1 + else + EMPTY=0 + fi + + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + json="$tmpdir/walls.json" + qml="$tmpdir/walls.qml" + + # Build JSON with path, name (no ext), and thumb path; ensure thumb exists + printf "[" > "$json" + first=1 + for vid in "''${VIDEOS[@]}"; do + hash=$(${pkgs.coreutils}/bin/printf "%s" "$vid" | ${pkgs.coreutils}/bin/sha256sum | ${pkgs.coreutils}/bin/cut -d" " -f1) + thumb="$CACHE/$hash.png" + if [ ! -f "$thumb" ]; then + # Use ffmpegthumbnailer for speed; tolerate errors + ${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer -i "$vid" -o "$thumb" -s "$SIZE" -q 8 2>/dev/null || true + # Some formats like AVIF (animated) may fail; fallback to ffmpeg if available + if [ ! -f "$thumb" ]; then + ${pkgs.ffmpeg}/bin/ffmpeg -y -v error -i "$vid" -frames:v 1 -vf "scale='min(iw,$SIZE)':-1:force_original_aspect_ratio=decrease,pad=$SIZE:$SIZE:(ow-iw)/2:(oh-ih)/2" "$thumb" 2>/dev/null || true + fi + fi + base=$(${pkgs.coreutils}/bin/basename "$vid") + name="''${base%.*}" + if [ $first -eq 0 ]; then printf "," >> "$json"; fi + first=0 + printf "{\"path\":\"%s\",\"name\":\"%s\",\"thumb\":\"%s\"}" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$vid" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$name" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$thumb" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + >> "$json" + done + printf "]" >> "$json" + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms=$((t2 - t1))" >&2; fi + + # Functions to detect/kill video-only mpvpaper instances robustly (order-independent) + video_mpv_active() { + ${pkgs.procps}/bin/pgrep -f -a mpvpaper | ${pkgs.gawk}/bin/awk 'BEGIN{IGNORECASE=1} + { + for (i = 2; i <= NF; i++) { + t = $i + if (t == "-o") { i++; continue } + if (t ~ /\.(mp4|m4v|mp4v|mov|webm|avi|mkv|mpeg|mpg|wmv|avchd|flv|ogv|m2ts|ts|3gp)$/) { found=1; exit } + } + } + END { exit found?0:1 }' >/dev/null 2>&1 + } + + kill_video_mpv() { + pids=$(${pkgs.procps}/bin/pgrep -f -a mpvpaper | ${pkgs.gawk}/bin/awk 'BEGIN{IGNORECASE=1} + { + pid=$1 + for (i = 2; i <= NF; i++) { + t = $i + if (t == "-o") { i++; continue } + if (t ~ /\.(mp4|m4v|mp4v|mov|webm|avi|mkv|mpeg|mpg|wmv|avchd|flv|ogv|m2ts|ts|3gp)$/) { print pid; break } + } + }' | ${pkgs.coreutils}/bin/tr '\n' ' ') + if [ -n "''${pids:-}" ]; then + # shellcheck disable=SC2086 + ${pkgs.coreutils}/bin/kill $pids >/dev/null 2>&1 || true + fi + } + + # Optional: shell-only mode for perf (skip QML) + if [ "''${1:-}" = "--shell-only" ] || [ -n "''${QS_SHELL_ONLY:-}" ]; then + [ -n "''${QS_PERF:-}" ] && echo "[perf] shell_only=1 total_ms=$((t2 - t0))" >&2 + exit 0 + fi + + # Derive QML flags from env + PERF_BOOL=false; [ -n "''${QS_PERF:-}" ] && PERF_BOOL=true + AUTO_QUIT_BOOL=false; [ -n "''${QS_AUTO_QUIT:-}" ] && AUTO_QUIT_BOOL=true + NOIM_BOOL=false; [ "''${EMPTY:-0}" -eq 1 ] && NOIM_BOOL=true + NODIR_BOOL=false; [ "''${DIR_MISSING:-0}" -eq 1 ] && NODIR_BOOL=true + + # QML UI builder (recompute status each time) + write_qml() { + if video_mpv_active; then MPV_ACTIVE_BOOL=true; else MPV_ACTIVE_BOOL=false; fi + cat > "$qml" < + (it.name && it.name.toLowerCase().indexOf(s) !== -1) || + (it.path && it.path.toLowerCase().indexOf(s) !== -1) + ); + } + + ListModel { id: imagesModel } + + function sortedByName(arr) { + return arr.slice().sort(function(a, b) { + const an = (a && a.name ? a.name : "").toLowerCase(); + const bn = (b && b.name ? b.name : "").toLowerCase(); + if (an < bn) return -1; + if (an > bn) return 1; + return 0; + }); + } + + function populateModel(arr) { + const start = Date.now(); + imagesModel.clear(); + const sorted = sortedByName(arr); + for (let i = 0; i < sorted.length; i++) { + imagesModel.append(sorted[i]); + } + if (perfEnabled) console.log("[perf] q2_inline_model_appended count=" + imagesModel.count + " total_ms=" + (Date.now() - qStart)); + } + + Component.onCompleted: { + qStart = Date.now(); + if (perfEnabled) console.log("[perf] q0_window_created"); + if (perfEnabled) console.log("[perf] q1_inline_data"); + populateModel(imagesData); + } + + Shortcut { + sequences: [ "Escape" ] + context: Qt.ApplicationShortcut + onActivated: Qt.quit() + } + + + Rectangle { + id: frame + anchors.fill: parent + anchors.margins: 12 + radius: 12 + border.width: 2 + border.color: "#66ccff" + color: "#DD000000" + + // Header with status and action + Rectangle { + id: header + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 12 + height: 44 + radius: 10 + color: "#BB000000" + border.width: 1 + border.color: "#66ccff" + + Row { + id: headerRow + anchors.fill: parent + anchors.margins: 10 + spacing: 12 + + Rectangle { + id: statusDot + width: 12 + height: 12 + radius: 6 + color: mpvActive ? "#22c55e" : "#ef4444" + anchors.verticalCenter: parent.verticalCenter + } + + // Status badge with stronger highlight for ACTIVE + Rectangle { + id: statusBadge + radius: 9 + height: parent.height - 8 + width: statusText.implicitWidth + 24 + antialiasing: true + smooth: true + border.width: 1 + border.color: mpvActive ? "#66dd88" : "#dd6666" + gradient: Gradient { + GradientStop { position: 0.0; color: mpvActive ? "#66bbff66" : "#66ff6666" } + GradientStop { position: 1.0; color: mpvActive ? "#3388cc44" : "#33884444" } + } + Text { + id: statusText + anchors.centerIn: parent + text: mpvActive ? "MPVPaper: ACTIVE" : "MPVPaper: INACTIVE" + color: mpvActive ? "#ffffff" : "#ffeeeeee" + font.pixelSize: 14 + font.bold: true + } + } + + Item { width: 12; height: 1 } + + // Audio toggle (Disable sound) + Rectangle { + id: audioToggle + radius: 9 + border.width: 1 + border.color: "#8888ff" + height: parent.height - 8 + width: toggleText.implicitWidth + 36 + antialiasing: true + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#3344aadd" } + GradientStop { position: 1.0; color: "#223366aa" } + } + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 10 + spacing: 8 + Rectangle { + id: chk + width: 14; height: 14; radius: 3 + border.width: 1 + border.color: "#cccccc" + color: disableAudio ? "#22c55e" : "#ef4444" + } + Text { + id: toggleText + text: "Disable sound" + color: "white" + font.pixelSize: 13 + font.bold: true + } + } + MouseArea { + anchors.fill: parent + onClicked: disableAudio = !disableAudio + } + } + + Item { width: 12; height: 1 } + + Rectangle { + id: killBtn + visible: mpvActive + radius: 9 + border.width: 1 + border.color: "#ff7777" + height: parent.height - 8 + width: killText.implicitWidth + 28 + antialiasing: true + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#ccff6666" } + GradientStop { position: 1.0; color: "#66aa0000" } + } + + Text { + id: killText + anchors.centerIn: parent + text: "Stop Video Wallpaper" + color: "white" + font.pixelSize: 13 + font.bold: true + } + + MouseArea { + anchors.fill: parent + onClicked: { console.log("ACTION:KILL_MPV_VID"); Qt.quit(); } + } + } + + Rectangle { anchors.verticalCenter: parent.verticalCenter; width: 0; height: 1; } + + // Spacer (fixed width). Remove Layout.fillWidth to avoid QtQuick.Layouts dependency + Item { id: spacer; width: 1; height: 1 } + } + } + + // Search bar (rounded) + Rectangle { + id: searchBar + anchors.top: header.bottom + anchors.margins: 12 + width: parent.width / 3 + anchors.horizontalCenter: parent.horizontalCenter + height: 40 + radius: 10 + color: "#88000000" + border.width: 1 + border.color: "#66ccff" + clip: true + + TextInput { + id: searchInput + anchors.fill: parent + anchors.margins: 12 + color: "white" + font.pixelSize: 14 + focus: true + Keys.onEscapePressed: Qt.quit() + onTextChanged: { + win.searchQuery = text; + populateModel(filterImages(text)); + } + } + + Text { + text: "Search…" + color: "#88ffffff" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 + visible: searchInput.text.length === 0 + } + } + + // Empty-state overlay when no files are found + Item { + id: emptyOverlay + anchors.fill: parent + visible: noImages + Column { + anchors.centerIn: parent + spacing: 8 + Text { text: dirMissing ? "Directory not found" : "No videos found"; color: "white"; font.pixelSize: 16; horizontalAlignment: Text.AlignHCenter } + Text { text: dirPath; color: "#cccccc"; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter } + Text { text: dirMissing ? "Create the directory or pass -d DIR / set WALL_DIR" : "Tip: pass -d DIR or set WALL_DIR to your wallpapers folder"; color: "#aaaaaa"; font.pixelSize: 11; horizontalAlignment: Text.AlignHCenter } + } + } + + GridView { + id: grid + anchors.left: parent.left + anchors.right: parent.right + anchors.top: searchBar.bottom + anchors.bottom: parent.bottom + anchors.leftMargin: hpad + anchors.rightMargin: hpad + anchors.topMargin: 8 + anchors.bottomMargin: 8 + model: imagesModel + interactive: true + focus: true + Keys.onEscapePressed: Qt.quit() + cellWidth: thumbSize + (cellPadding * 2) + cellHeight: thumbSize + (cellPadding * 2) + 18 + boundsBehavior: Flickable.StopAtBounds + clip: true + flow: GridView.FlowLeftToRight + + delegate: Item { + width: grid.cellWidth + height: grid.cellHeight + Component.onCompleted: { + if (!win.firstDelegateLogged && win.perfEnabled) { + console.log("[perf] q5_first_delegate total_ms=" + (Date.now() - win.qStart)); + win.firstDelegateLogged = true; + } + } + + Column { + anchors.fill: parent + anchors.margins: cellPadding + spacing: 0 + + Rectangle { + width: thumbSize + height: thumbSize + color: "transparent" + radius: 10 + border.width: 0 + border.color: "#66ccff" + clip: true + + Image { + id: thumbImg + anchors.fill: parent + anchors.margins: 2 + source: thumb + fillMode: Image.PreserveAspectFit + smooth: true + antialiasing: true + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: thumbImg.width + height: thumbImg.height + radius: 10 + } + } + } + + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.width = 2 + onExited: parent.border.width = 0 + onClicked: { parent.border.width = 2; console.log("SELECT:" + path); console.log("AUDIO:" + (win.disableAudio ? "OFF" : "ON")); Qt.quit(); } + } + } + + Text { + text: name + color: "white" + font.pixelSize: 12 + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + width: thumbSize + } + } + } + } + } + } + QML + } + + # Prepare QML runtime environment (Qt6) + export QT_QPA_PLATFORM="wayland;xcb" + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export QT_LOGGING_TO_CONSOLE="1" + export QT_FORCE_STDERR_LOGGING="1" + export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:${pkgs.qt6.qtwayland}/lib/qt-6/plugins" + export QML_IMPORT_PATH="${pkgs.qt6.qtbase}/lib/qt-6/qml:${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtsvg}/lib/qt-6/qml" + export QML2_IMPORT_PATH="$QML_IMPORT_PATH" + + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml" + if ! [ -x "$QML_BIN" ]; then + if [ -x "${pkgs.qt6.qtdeclarative}/bin/qml6" ]; then + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml6" + elif command -v qml >/dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + fi + fi + + # Debug mode: run QML directly and do not filter output + if [ -n "''${QS_DEBUG:-}" ]; then + { + echo "[qs-vid-wallpapers] DIR=$DIR" >&2 + echo "[qs-vid-wallpapers] CACHE=$CACHE" >&2 + echo "[qs-vid-wallpapers] SIZE=$SIZE" >&2 + echo "[qs-vid-wallpapers] VIDEOS_COUNT=''${#VIDEOS[@]}" >&2 + echo "[qs-vid-wallpapers] QML_BIN=$QML_BIN" >&2 + echo "[qs-vid-wallpapers] QML_FILE=$qml" >&2 + echo "[qs-vid-wallpapers] QML_IMPORT_PATH=$QML_IMPORT_PATH" >&2 + } || true + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + write_qml + exec "$QML_BIN" "$qml" + fi + + # Run QML runtime and capture selection or action from console + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + + while :; do + write_qml + out=$({ "$QML_BIN" "$qml" 2>&1 || true; }) + action=$(printf "%s\n" "$out" | ${pkgs.gawk}/bin/awk -F'ACTION:' '/ACTION:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + sel=$(printf "%s\n" "$out" | ${pkgs.gawk}/bin/awk -F'SELECT:' '/SELECT:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + + if [ "''${action:-}" = "KILL_MPV_VID" ]; then + kill_video_mpv + # wait briefly for processes to terminate to avoid stale status + for i in $(${pkgs.coreutils}/bin/seq 1 10); do + if ! video_mpv_active; then break; fi + ${pkgs.coreutils}/bin/sleep 0.05 + done + # loop to rebuild QML with updated status and continue showing UI + continue + fi + + if [ -n "''${sel:-}" ]; then + printf "%s\n" "$sel" + break + fi + + # No action, no selection: exit loop + break + done +'' diff --git a/modules/home/scripts/qs-wallpapers-apply.nix b/modules/home/scripts/qs-wallpapers-apply.nix new file mode 100644 index 0000000..2bc1818 --- /dev/null +++ b/modules/home/scripts/qs-wallpapers-apply.nix @@ -0,0 +1,191 @@ +{pkgs, inputs}: let + awwwPkg = inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.awww; +in +pkgs.writeShellScriptBin "qs-wallpapers-apply" '' + #!/usr/bin/env bash + set -euo pipefail + + [ -n "''${QS_DEBUG:-}" ] && set -x + DEBUG="''${QS_DEBUG:-}" + log() { if [ -n "$DEBUG" ]; then echo "[qs-apply] $*" >&2; fi } + + PRINT_ONLY=0 + SHELL_ONLY=0 + RESTORE_ONLY=0 + while [ $# -gt 0 ]; do + case "$1" in + --print-only) PRINT_ONLY=1; shift ;; + --shell-only) SHELL_ONLY=1; shift ;; + --restore) RESTORE_ONLY=1; shift ;; + *) break ;; + esac + done + + if [ $RESTORE_ONLY -eq 1 ]; then + log "Restore requested; delegating to qs-wallpapers-restore" + exec qs-wallpapers-restore + fi + + BACKEND="''${WALLPAPER_BACKEND:-}" + # Auto-detect sensible default backend per compositor when not provided via env + if [ -z "''${BACKEND:-}" ]; then + if [ "''${XDG_SESSION_DESKTOP:-}" = "Niri" ] || [ "''${XDG_CURRENT_DESKTOP:-}" = "Niri" ] || command -v niri >/dev/null 2>&1; then + BACKEND="awww" + else + BACKEND="mpvpaper" + fi + fi + + if [ $SHELL_ONLY -eq 1 ]; then + log "Shell-only perf run" + QS_DEBUG= QS_SHELL_ONLY=1 QS_PERF="''${QS_PERF:-}" qs-wallpapers 2> >(cat >&2) || true + exit 0 + fi + + # Run the picker with QS_DEBUG disabled so it prints the selection to stdout + if [ $PRINT_ONLY -eq 1 ]; then + log "Print-only run; auto-quit picker" + if [ -n "''${QS_PERF:-}" ]; then + # In perf mode, run picker in debug so QML [perf] logs are emitted to stderr + QS_AUTO_QUIT=1 QS_PERF="''${QS_PERF:-}" QS_DEBUG=1 qs-wallpapers "$@" || true + else + sel="$(QS_AUTO_QUIT=1 QS_DEBUG= qs-wallpapers "$@" || true)" + log "Selected=$sel" + fi + exit 0 + fi + + # Ensure any env-driven auto-quit/perf flags don't leak into normal runs + sel="$(QS_DEBUG= QS_AUTO_QUIT= QS_PERF= qs-wallpapers "$@" || true)" + + if [ -z "''${sel:-}" ]; then + log "No selection received; exiting" + exit 0 + fi + + log "Backend=$BACKEND" + log "Selected=$sel" + + # Persist current selection for restore-on-login + STATE_DIR="''${XDG_STATE_HOME:-$HOME/.local/state}/qs-wallpapers" + STATE_FILE_JSON="$STATE_DIR/current.json" + STATE_FILE_TXT="$STATE_DIR/current_wallpaper" + ${pkgs.coreutils}/bin/mkdir -p "$STATE_DIR" + + json_escape() { ${pkgs.gnused}/bin/sed 's/\\\\/\\\\\\\\/g;s/"/\\\\"/g'; } + sel_esc="$(${pkgs.coreutils}/bin/printf '%s' "$sel" | json_escape)" + + tmp_json="$STATE_FILE_JSON.tmp" + ${pkgs.coreutils}/bin/printf '{"path":"%s","backend":"%s","timestamp":%s}\n' \ + "$sel_esc" "$BACKEND" "$(${pkgs.coreutils}/bin/date +%s)" > "$tmp_json" + ${pkgs.coreutils}/bin/mv -f "$tmp_json" "$STATE_FILE_JSON" + + tmp_txt="$STATE_FILE_TXT.tmp" + ${pkgs.coreutils}/bin/printf '%s\n' "$sel" > "$tmp_txt" + ${pkgs.coreutils}/bin/mv -f "$tmp_txt" "$STATE_FILE_TXT" + + # Maintain a convenient symlink for other tools and themes + PIC_DIR="$HOME/Pictures" + CUR_LINK="$PIC_DIR/current_wallpaper" + ${pkgs.coreutils}/bin/mkdir -p "$PIC_DIR" + ${pkgs.coreutils}/bin/ln -sfn "$sel" "$CUR_LINK" || true + + # Update hyprlock wallpaper link if tool is available + if command -v hyprlock-update-wallpaper-link >/dev/null 2>&1; then + hyprlock-update-wallpaper-link >/dev/null 2>&1 || true + fi + + case "$BACKEND" in + mpvpaper) + # Stop other wallpaper daemons to avoid conflicts + log "Stopping awww-daemon, hyprpaper, mpvpaper if running" + ${pkgs.procps}/bin/pkill -x awww-daemon >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x hyprpaper >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + # Give the compositor a moment to release layers + log "Sleeping briefly before starting mpvpaper" + ${pkgs.coreutils}/bin/sleep 0.2 + # Apply to all monitors; replace '*' with a specific output if desired + # Ensure images cover the output by enabling aspect-preserving zoom + crop + MPV_OPTS="--no-audio --loop-file=inf --image-display-duration=inf --no-osc --no-osd-bar --keep-open=yes --keepaspect=yes --panscan=1.0" + if [ -n "$DEBUG" ]; then + ${pkgs.mpvpaper}/bin/mpvpaper \ + -o "$MPV_OPTS" \ + '*' "$sel" & + else + ${pkgs.mpvpaper}/bin/mpvpaper \ + -o "$MPV_OPTS" \ + '*' "$sel" >/dev/null 2>&1 & + fi + disown || true + log "mpvpaper launched" + exit 0 + ;; + + awww) + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + # Start awww-daemon if needed (newer awww has no 'init' subcommand) + if ! ${awwwPkg}/bin/awww query >/dev/null 2>&1; then + log "Starting awww-daemon" + ${awwwPkg}/bin/awww-daemon >/dev/null 2>&1 & disown || true + # wait briefly for the daemon to be ready + for i in $(${pkgs.coreutils}/bin/seq 1 50); do + if ${awwwPkg}/bin/awww query >/dev/null 2>&1; then + log "awww-daemon ready" + break + fi + ${pkgs.coreutils}/bin/sleep 0.1 + done + fi + # Stop hyprpaper as well to avoid any conflict with layer surfaces + ${pkgs.procps}/bin/pkill -x hyprpaper >/dev/null 2>&1 || true + + # Robust resize: if WALLPAPER_RESIZE is set, use it; otherwise try fill -> fit -> crop + run_awww_img() { + if [ -n "''${WALLPAPER_RESIZE:-}" ]; then + log "awww img --resize ''${WALLPAPER_RESIZE} $sel" + ${awwwPkg}/bin/awww img --resize "''${WALLPAPER_RESIZE}" "$sel" + return $? + fi + log "Trying awww resize modes: fill -> fit -> crop" + ${awwwPkg}/bin/awww img --resize fill "$sel" || \ + ${awwwPkg}/bin/awww img --resize fit "$sel" || \ + ${awwwPkg}/bin/awww img --resize crop "$sel" + } + + # Niri: generic apply has proven to work more reliably than per-output here + run_awww_img + exit $? + ;; + + hyprpaper) + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x awww-daemon >/dev/null 2>&1 || true + # Generate a minimal hyprpaper config and start it + _TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d) + _CFG="$_TMPDIR/hyprpaper.conf" + { + echo "ipc=on" + echo "splash=false" + } > "$_CFG" + # Add preload/wallpaper lines for each monitor + ${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name' | while read -r mon; do + echo "preload = $sel" >> "$_CFG" + echo "wallpaper = $mon,$sel" >> "$_CFG" + done + log "Starting hyprpaper with config $_CFG" + if [ -n "$DEBUG" ]; then + ${pkgs.hyprpaper}/bin/hyprpaper -c "$_CFG" & + else + ${pkgs.hyprpaper}/bin/hyprpaper -c "$_CFG" >/dev/null 2>&1 & + fi + disown || true + exit 0 + ;; + + *) + echo "Unknown BACKEND: $BACKEND" >&2 + exit 2 + ;; + esac +'' diff --git a/modules/home/scripts/qs-wallpapers-restore.nix b/modules/home/scripts/qs-wallpapers-restore.nix new file mode 100644 index 0000000..81a3554 --- /dev/null +++ b/modules/home/scripts/qs-wallpapers-restore.nix @@ -0,0 +1,128 @@ +{pkgs, inputs}: let + awwwPkg = inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.awww; +in +pkgs.writeShellScriptBin "qs-wallpapers-restore" '' + #!/usr/bin/env bash + set -euo pipefail + + [ -n "''${QS_DEBUG:-}" ] && set -x + DEBUG="''${QS_DEBUG:-}" + log() { if [ -n "$DEBUG" ]; then echo "[qs-restore] $*" >&2; fi } + + # Read state + STATE_FILE_JSON="''${XDG_STATE_HOME:-$HOME/.local/state}/qs-wallpapers/current.json" + STATE_FILE_TXT="''${XDG_STATE_HOME:-$HOME/.local/state}/qs-wallpapers/current_wallpaper" + + PATH_J="" + BACKEND_J="" + if [ -f "$STATE_FILE_JSON" ]; then + PATH_J="$(${pkgs.jq}/bin/jq -r '.path // ""' "$STATE_FILE_JSON" 2>/dev/null || true)" + BACKEND_J="$(${pkgs.jq}/bin/jq -r '.backend // ""' "$STATE_FILE_JSON" 2>/dev/null || true)" + elif [ -f "$STATE_FILE_TXT" ]; then + PATH_J="$(${pkgs.coreutils}/bin/head -n1 "$STATE_FILE_TXT" 2>/dev/null || true)" + fi + + if [ -z "''${PATH_J:-}" ] || [ ! -f "$PATH_J" ]; then + log "No valid saved wallpaper path; exiting" + exit 0 + fi + + # Update hyprlock wallpaper link if tool is available + if command -v hyprlock-update-wallpaper-link >/dev/null 2>&1; then + hyprlock-update-wallpaper-link >/dev/null 2>&1 || true + fi + + # Order: recorded backend first, then awww -> hyprpaper -> mpvpaper -> waypaper + ORDER_DEFAULT="awww,hyprpaper,mpvpaper,waypaper" + ORDER_COMBINED="$BACKEND_J,$ORDER_DEFAULT" + # De-duplicate while preserving order (awk trick) + ORDER=$({ echo "$ORDER_COMBINED" | ${pkgs.coreutils}/bin/tr ',' '\n' | ${pkgs.gawk}/bin/awk 'NF{ if (!seen[$0]++) print $0 }' | ${pkgs.coreutils}/bin/tr '\n' ','; echo; } | ${pkgs.coreutils}/bin/tr -s ',' | ${pkgs.gnused}/bin/sed 's/^,\|,$//g') + if [ -n "''${QS_RESTORE_ORDER:-}" ]; then + ORDER="''${QS_RESTORE_ORDER}" + fi + log "ORDER=$ORDER" + + # Helpers + wait_for_proc() { + local name="$1"; local timeout="''${2:-10}"; local i + for i in $(${pkgs.coreutils}/bin/seq 1 "$timeout"); do + if ${pkgs.procps}/bin/pgrep -x "$name" >/dev/null 2>&1; then return 0; fi + ${pkgs.coreutils}/bin/sleep 1 + done + return 1 + } + + start_awww() { + + # Stop conflicting daemons if we intend to use awww + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x hyprpaper >/dev/null 2>&1 || true + + if ! ${awwwPkg}/bin/awww query >/dev/null 2>&1; then + log "Starting awww-daemon" + ${awwwPkg}/bin/awww-daemon >/dev/null 2>&1 & disown || true + for i in $(${pkgs.coreutils}/bin/seq 1 50); do + if ${awwwPkg}/bin/awww query >/dev/null 2>&1; then break; fi + ${pkgs.coreutils}/bin/sleep 0.1 + done + fi + # Robust resize: use explicit WALLPAPER_RESIZE if provided; otherwise try fill -> fit -> crop + if [ -n "''${WALLPAPER_RESIZE:-}" ]; then + log "awww img --resize ''${WALLPAPER_RESIZE} $PATH_J" + ${awwwPkg}/bin/awww img --resize "''${WALLPAPER_RESIZE}" "$PATH_J" + else + log "Trying awww resize modes: fill -> fit -> crop" + ${awwwPkg}/bin/awww img --resize fill "$PATH_J" || \ + ${awwwPkg}/bin/awww img --resize fit "$PATH_J" || \ + ${awwwPkg}/bin/awww img --resize crop "$PATH_J" + fi + } + + start_hyprpaper() { + ${pkgs.procps}/bin/pkill -x mpvpaper >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x awww-daemon >/dev/null 2>&1 || true + _TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d) + _CFG="$_TMPDIR/hyprpaper.conf" + { + echo "ipc=on" + echo "splash=false" + } > "$_CFG" + ${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[].name' | while read -r mon; do + echo "preload = $PATH_J" >> "$_CFG" + echo "wallpaper = $mon,$PATH_J" >> "$_CFG" + done + log "Starting hyprpaper" + ${pkgs.hyprpaper}/bin/hyprpaper -c "$_CFG" >/dev/null 2>&1 & disown || true + } + + start_mpvpaper() { + ${pkgs.procps}/bin/pkill -x awww-daemon >/dev/null 2>&1 || true + ${pkgs.procps}/bin/pkill -x hyprpaper >/dev/null 2>&1 || true + local MPV_OPTS="--no-audio --loop-file=inf --image-display-duration=inf --no-osc --no-osd-bar --keep-open=yes --keepaspect=yes --panscan=1.0" + log "Starting mpvpaper" + ${pkgs.mpvpaper}/bin/mpvpaper -o "$MPV_OPTS" '*' "$PATH_J" >/dev/null 2>&1 & disown || true + } + + start_waypaper() { + if command -v waypaper >/dev/null 2>&1; then + log "Trying waypaper" + waypaper --backend awww --wallpaper "$PATH_J" >/dev/null 2>&1 || return 1 + else + return 1 + fi + } + + IFS=',' read -r -a tools <<<"$ORDER" + for t in "''${tools[@]}"; do + case "$t" in + awww) start_awww && exit 0 || log "awww failed; falling back" ;; + hyprpaper) start_hyprpaper && exit 0 || log "hyprpaper failed; falling back" ;; + mpvpaper) start_mpvpaper && exit 0 || log "mpvpaper failed; falling back" ;; + waypaper) start_waypaper && exit 0 || log "waypaper failed; falling back" ;; + *) : ;; + esac + done + + log "All restore methods failed" + exit 1 +'' diff --git a/modules/home/scripts/qs-wallpapers.nix b/modules/home/scripts/qs-wallpapers.nix new file mode 100644 index 0000000..ce03e7b --- /dev/null +++ b/modules/home/scripts/qs-wallpapers.nix @@ -0,0 +1,405 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-wallpapers" '' + #!/usr/bin/env bash + set -euo pipefail + + + # Configurable defaults via env + DIR="''${WALL_DIR:-$HOME/Pictures/Wallpapers}" + CACHE="''${WALL_CACHE_DIR:-$HOME/.cache/wallthumbs}" + SIZE="''${WALL_THUMB_SIZE:-200}" + + usage() { + cat <&2; exit 2 ;; + \?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + if [ ! -d "$DIR" ]; then + echo "Wallpapers directory not found: $DIR" >&2 + DIR_MISSING=1 + else + DIR_MISSING=0 + fi + + mkdir -p "$CACHE" + + # Prebuild thumbs quickly (quiet) + ${pkgs.coreutils}/bin/env \ + WALL_DIR="$DIR" WALL_CACHE_DIR="$CACHE" WALL_THUMB_SIZE="$SIZE" \ + ${pkgs.callPackage ./wallpaper-thumbs-build.nix {}}/bin/wallpaper-thumbs-build -q >/dev/null 2>&1 || true + + # Perf timing helpers + now_ms() { ${pkgs.coreutils}/bin/date +%s%3N; } + if [ -n "''${QS_PERF:-}" ]; then t0=$(now_ms); fi + + # Collect images deterministically, tolerate symlink loops and permission errors + mapfile -t IMAGES < <( { ${pkgs.findutils}/bin/find -L "$DIR" \ + \( -type f -o -xtype f \) \ + \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.avif' -o -iname '*.bmp' -o -iname '*.tiff' \) \ + -print0 2>/dev/null || true; } \ + | ${pkgs.coreutils}/bin/tr '\0' '\n' | ${pkgs.coreutils}/bin/sort ) + if [ -n "''${QS_PERF:-}" ]; then t1=$(now_ms); echo "[perf] find_ms=$((t1 - t0))" >&2; fi + + if [ "''${#IMAGES[@]}" -eq 0 ]; then + if [ -n "''${QS_DEBUG:-}" ]; then + echo "[qs-wallpapers] No images found in $DIR (followed symlinks); launching empty UI" >&2 + fi + EMPTY=1 + else + EMPTY=0 + fi + + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + json="$tmpdir/walls.json" + qml="$tmpdir/walls.qml" + + # If a prebuilt manifest exists, reuse it to avoid rebuilding JSON at runtime + manifest="$CACHE/walls.json" + if [ -f "$manifest" ]; then + ${pkgs.coreutils}/bin/cp -f "$manifest" "$json" + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms(prebuilt)=0" >&2; fi + else + # Build JSON with path, name (no ext), and thumb path; ensure thumb exists + printf "[" > "$json" + first=1 + for img in "''${IMAGES[@]}"; do + # Faster hash (path string) using sha256sum instead of openssl + hash=$(${pkgs.coreutils}/bin/printf "%s" "$img" | ${pkgs.coreutils}/bin/sha256sum | ${pkgs.coreutils}/bin/cut -d" " -f1) + thumb="$CACHE/$hash.png" + if [ ! -f "$thumb" ]; then + ${pkgs.imagemagick}/bin/convert "$img" -auto-orient -thumbnail "''${SIZE}x''${SIZE}>" \ + -background none -gravity center -extent "''${SIZE}x''${SIZE}" "$thumb" 2>/dev/null || true + fi + base=$(${pkgs.coreutils}/bin/basename "$img") + name="''${base%.*}" + if [ $first -eq 0 ]; then printf "," >> "$json"; fi + first=0 + printf "{\"path\":\"%s\",\"name\":\"%s\",\"thumb\":\"%s\"}" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$img" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$name" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$thumb" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + >> "$json" + done + printf "]" >> "$json" + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms=$((t2 - t1))" >&2; fi + fi + + # Optional: shell-only mode for perf (skip QML) + if [ "''${1:-}" = "--shell-only" ] || [ -n "''${QS_SHELL_ONLY:-}" ]; then + if [ -n "''${QS_PERF:-}" ]; then echo "[perf] shell_only=1 total_ms=$((t2 - t0))" >&2; fi + exit 0 + fi + + # Derive QML flags from env + PERF_BOOL=false; [ -n "''${QS_PERF:-}" ] && PERF_BOOL=true + AUTO_QUIT_BOOL=false; [ -n "''${QS_AUTO_QUIT:-}" ] && AUTO_QUIT_BOOL=true + NOIM_BOOL=false; [ "''${EMPTY:-0}" -eq 1 ] && NOIM_BOOL=true + NODIR_BOOL=false; [ "''${DIR_MISSING:-0}" -eq 1 ] && NODIR_BOOL=true + + # QML UI: grid of thumbnails with labels, tight margins, scrollable + # Embedded JSON in QML to avoid XHR and file I/O + cat > "$qml" < + (it.name && it.name.toLowerCase().indexOf(s) !== -1) || + (it.path && it.path.toLowerCase().indexOf(s) !== -1) + ); + } + + ListModel { id: imagesModel } + + // Return a new array sorted by display name (case-insensitive) + function sortedByName(arr) { + return arr.slice().sort(function(a, b) { + const an = (a && a.name ? a.name : "").toLowerCase(); + const bn = (b && b.name ? b.name : "").toLowerCase(); + if (an < bn) return -1; + if (an > bn) return 1; + return 0; + }); + } + + function populateModel(arr) { + const start = Date.now(); + imagesModel.clear(); + const sorted = sortedByName(arr); + for (let i = 0; i < sorted.length; i++) { + imagesModel.append(sorted[i]); + } + if (perfEnabled) console.log("[perf] q2_inline_model_appended count=" + imagesModel.count + " total_ms=" + (Date.now() - qStart)); + if (autoQuit) Qt.quit(); + } + + Component.onCompleted: { + qStart = Date.now(); + if (perfEnabled) console.log("[perf] q0_window_created"); + if (perfEnabled) console.log("[perf] q1_inline_data"); + populateModel(imagesData); + } + + // App-wide ESC shortcut; does not depend on focus + Shortcut { + sequences: [ "Escape" ] + context: Qt.ApplicationShortcut + onActivated: Qt.quit() + } + + + Rectangle { + id: frame + anchors.fill: parent + anchors.margins: 12 + radius: 12 + border.width: 2 + border.color: "#66ccff" + color: "#DD000000" + + // Search bar (rounded) + Rectangle { + id: searchBar + anchors.top: parent.top + anchors.margins: 12 + width: parent.width / 3 + anchors.horizontalCenter: parent.horizontalCenter + height: 40 + radius: 10 + border.width: 1 + border.color: "#66ccff" + color: "#BB000000" + antialiasing: true + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#3344aadd" } + GradientStop { position: 1.0; color: "#223366aa" } + } + clip: true + + TextInput { + id: searchInput + anchors.fill: parent + anchors.margins: 12 + color: "white" + font.pixelSize: 14 + focus: true + Keys.onEscapePressed: Qt.quit() + onTextChanged: { + win.searchQuery = text; + // Filter then sort by name inside populateModel + populateModel(filterImages(text)); + } + } + + Text { + text: "Search…" + color: "#88ffffff" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 + visible: searchInput.text.length === 0 + } + } + + // Empty-state overlay when no images are found + Item { + id: emptyOverlay + anchors.fill: parent + visible: noImages + Column { + anchors.centerIn: parent + spacing: 8 + Text { text: dirMissing ? "Directory not found" : "No images found"; color: "white"; font.pixelSize: 16; horizontalAlignment: Text.AlignHCenter } + Text { text: dirPath; color: "#cccccc"; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter } + Text { text: dirMissing ? "Create the directory or pass -d DIR / set WALL_DIR" : "Tip: pass -d DIR or set WALL_DIR to your wallpapers folder"; color: "#aaaaaa"; font.pixelSize: 11; horizontalAlignment: Text.AlignHCenter } + } + } + GridView { + id: grid + anchors.left: parent.left + anchors.right: parent.right + anchors.top: searchBar.bottom + anchors.bottom: parent.bottom + anchors.leftMargin: hpad + anchors.rightMargin: hpad + anchors.topMargin: 8 + anchors.bottomMargin: 8 + model: imagesModel + interactive: true + focus: true + Keys.onEscapePressed: Qt.quit() + cellWidth: thumbSize + (cellPadding * 2) + cellHeight: thumbSize + (cellPadding * 2) + 18 + boundsBehavior: Flickable.StopAtBounds + clip: true + flow: GridView.FlowLeftToRight + + delegate: Item { + width: grid.cellWidth + height: grid.cellHeight + Component.onCompleted: { + if (!win.firstDelegateLogged && win.perfEnabled) { + console.log("[perf] q5_first_delegate total_ms=" + (Date.now() - win.qStart)); + win.firstDelegateLogged = true; + } + } + + Column { + anchors.fill: parent + anchors.margins: cellPadding + spacing: 0 + + Rectangle { + width: thumbSize + height: thumbSize + color: "transparent" + radius: 10 + border.width: 0 + border.color: "#66ccff" + clip: true + + Image { + id: thumbImg + anchors.fill: parent + anchors.margins: 2 + source: thumb + fillMode: Image.PreserveAspectFit + smooth: true + antialiasing: true + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: thumbImg.width + height: thumbImg.height + radius: 10 + } + } + } + + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.width = 2 + onExited: parent.border.width = 0 + onClicked: { parent.border.width = 2; console.log("SELECT:" + path); Qt.quit(); } + } + } + + Text { + text: name + color: "white" + font.pixelSize: 12 + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + width: thumbSize + } + } + } + } + } + } + QML + + # Prepare QML runtime environment (Qt6) + export QT_QPA_PLATFORM="wayland;xcb" + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export QT_LOGGING_TO_CONSOLE="1" + export QT_FORCE_STDERR_LOGGING="1" + export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:${pkgs.qt6.qtwayland}/lib/qt-6/plugins" + export QML_IMPORT_PATH="${pkgs.qt6.qtbase}/lib/qt-6/qml:${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtsvg}/lib/qt-6/qml" + export QML2_IMPORT_PATH="$QML_IMPORT_PATH" + + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml" + if ! [ -x "$QML_BIN" ]; then + if [ -x "${pkgs.qt6.qtdeclarative}/bin/qml6" ]; then + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml6" + elif command -v qml >/dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + fi + fi + + # Debug mode: run QML directly and do not filter output + if [ -n "''${QS_DEBUG:-}" ]; then + { + echo "[qs-wallpapers] DIR=$DIR" >&2 + echo "[qs-wallpapers] CACHE=$CACHE" >&2 + echo "[qs-wallpapers] SIZE=$SIZE" >&2 + echo "[qs-wallpapers] IMAGES_COUNT=''${#IMAGES[@]}" >&2 + echo "[qs-wallpapers] QML_BIN=$QML_BIN" >&2 + echo "[qs-wallpapers] QML_FILE=$qml" >&2 + echo "[qs-wallpapers] QML_IMPORT_PATH=$QML_IMPORT_PATH" >&2 + } || true + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + exec "$QML_BIN" "$qml" + fi + + # Run QML runtime and capture selection from console + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + sel=$({ "$QML_BIN" "$qml" 2>&1 || true; } | ${pkgs.gawk}/bin/awk -F'SELECT:' '/SELECT:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + + if [ -n "''${sel:-}" ]; then + printf "%s\n" "$sel" + fi +'' diff --git a/modules/home/scripts/qs-wallpapers.nix.backup b/modules/home/scripts/qs-wallpapers.nix.backup new file mode 100644 index 0000000..2a25f51 --- /dev/null +++ b/modules/home/scripts/qs-wallpapers.nix.backup @@ -0,0 +1,403 @@ +{pkgs}: +pkgs.writeShellScriptBin "qs-wallpapers" '' + #!/usr/bin/env bash + set -euo pipefail + + + # Configurable defaults via env + DIR="''${WALL_DIR:-$HOME/Pictures/Wallpapers}" + CACHE="''${WALL_CACHE_DIR:-$HOME/.cache/wallthumbs}" + SIZE="''${WALL_THUMB_SIZE:-200}" + + usage() { + cat <&2; exit 2 ;; + \?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + if [ ! -d "$DIR" ]; then + echo "Wallpapers directory not found: $DIR" >&2 + DIR_MISSING=1 + else + DIR_MISSING=0 + fi + + mkdir -p "$CACHE" + + # Prebuild thumbs quickly (quiet) + ${pkgs.coreutils}/bin/env \ + WALL_DIR="$DIR" WALL_CACHE_DIR="$CACHE" WALL_THUMB_SIZE="$SIZE" \ + ${pkgs.callPackage ./wallpaper-thumbs-build.nix {}}/bin/wallpaper-thumbs-build -q >/dev/null 2>&1 || true + + # Perf timing helpers + now_ms() { ${pkgs.coreutils}/bin/date +%s%3N; } + if [ -n "''${QS_PERF:-}" ]; then t0=$(now_ms); fi + + # Collect images deterministically, tolerate symlink loops and permission errors + mapfile -t IMAGES < <( { ${pkgs.findutils}/bin/find -L "$DIR" \ + \( -type f -o -xtype f \) \ + \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.avif' -o -iname '*.bmp' -o -iname '*.tiff' \) \ + -print0 2>/dev/null || true; } \ + | ${pkgs.coreutils}/bin/tr '\0' '\n' | ${pkgs.coreutils}/bin/sort ) + if [ -n "''${QS_PERF:-}" ]; then t1=$(now_ms); echo "[perf] find_ms=$((t1 - t0))" >&2; fi + + if [ "''${#IMAGES[@]}" -eq 0 ]; then + if [ -n "''${QS_DEBUG:-}" ]; then + echo "[qs-wallpapers] No images found in $DIR (followed symlinks); launching empty UI" >&2 + fi + EMPTY=1 + else + EMPTY=0 + fi + + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + json="$tmpdir/walls.json" + qml="$tmpdir/walls.qml" + + # If a prebuilt manifest exists, reuse it to avoid rebuilding JSON at runtime + manifest="$CACHE/walls.json" + if [ -f "$manifest" ]; then + ${pkgs.coreutils}/bin/cp -f "$manifest" "$json" + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms(prebuilt)=0" >&2; fi + else + # Build JSON with path, name (no ext), and thumb path; ensure thumb exists + printf "[" > "$json" + first=1 + for img in "''${IMAGES[@]}"; do + # Faster hash (path string) using sha256sum instead of openssl + hash=$(${pkgs.coreutils}/bin/printf "%s" "$img" | ${pkgs.coreutils}/bin/sha256sum | ${pkgs.coreutils}/bin/cut -d" " -f1) + thumb="$CACHE/$hash.png" + if [ ! -f "$thumb" ]; then + ${pkgs.imagemagick}/bin/convert "$img" -auto-orient -thumbnail "''${SIZE}x''${SIZE}>" \ + -background none -gravity center -extent "''${SIZE}x''${SIZE}" "$thumb" 2>/dev/null || true + fi + base=$(${pkgs.coreutils}/bin/basename "$img") + name="''${base%.*}" + if [ $first -eq 0 ]; then printf "," >> "$json"; fi + first=0 + printf "{\"path\":\"%s\",\"name\":\"%s\",\"thumb\":\"%s\"}" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$img" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$name" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + "$(${pkgs.coreutils}/bin/printf "%s" "$thumb" | ${pkgs.gnused}/bin/sed 's/\\/\\\\/g;s/"/\\"/g')" \ + >> "$json" + done + printf "]" >> "$json" + if [ -n "''${QS_PERF:-}" ]; then t2=$(now_ms); echo "[perf] json_ms=$((t2 - t1))" >&2; fi + fi + + # Optional: shell-only mode for perf (skip QML) + if [ "''${1:-}" = "--shell-only" ] || [ -n "''${QS_SHELL_ONLY:-}" ]; then + if [ -n "''${QS_PERF:-}" ]; then echo "[perf] shell_only=1 total_ms=$((t2 - t0))" >&2; fi + exit 0 + fi + + # Derive QML flags from env + PERF_BOOL=false; [ -n "''${QS_PERF:-}" ] && PERF_BOOL=true + AUTO_QUIT_BOOL=false; [ -n "''${QS_AUTO_QUIT:-}" ] && AUTO_QUIT_BOOL=true + NOIM_BOOL=false; [ "''${EMPTY:-0}" -eq 1 ] && NOIM_BOOL=true + NODIR_BOOL=false; [ "''${DIR_MISSING:-0}" -eq 1 ] && NODIR_BOOL=true + + # QML UI: grid of thumbnails with labels, tight margins, scrollable + # Embedded JSON in QML to avoid XHR and file I/O + cat > "$qml" < + (it.name && it.name.toLowerCase().indexOf(s) !== -1) || + (it.path && it.path.toLowerCase().indexOf(s) !== -1) + ); + } + + ListModel { id: imagesModel } + + // Return a new array sorted by display name (case-insensitive) + function sortedByName(arr) { + return arr.slice().sort(function(a, b) { + const an = (a && a.name ? a.name : "").toLowerCase(); + const bn = (b && b.name ? b.name : "").toLowerCase(); + if (an < bn) return -1; + if (an > bn) return 1; + return 0; + }); + } + + function populateModel(arr) { + const start = Date.now(); + imagesModel.clear(); + const sorted = sortedByName(arr); + for (let i = 0; i < sorted.length; i++) { + imagesModel.append(sorted[i]); + } + if (perfEnabled) console.log("[perf] q2_inline_model_appended count=" + imagesModel.count + " total_ms=" + (Date.now() - qStart)); + if (autoQuit) Qt.quit(); + } + + Component.onCompleted: { + qStart = Date.now(); + if (perfEnabled) console.log("[perf] q0_window_created"); + if (perfEnabled) console.log("[perf] q1_inline_data"); + populateModel(imagesData); + } + + // App-wide ESC shortcut; does not depend on focus + Shortcut { + sequences: [ "Escape" ] + context: Qt.ApplicationShortcut + onActivated: Qt.quit() + } + + + Rectangle { + id: frame + anchors.fill: parent + anchors.margins: 12 + radius: 12 + border.width: 2 + border.color: "#66ccff" + color: "#DD000000" + + // Search bar (rounded) + Rectangle { + id: searchBar + anchors.top: parent.top + anchors.margins: 12 + width: parent.width / 3 + anchors.horizontalCenter: parent.horizontalCenter + height: 40 + radius: 10 + border.width: 1 + border.color: "#66ccff" + color: "#BB000000" + antialiasing: true + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#3344aadd" } + GradientStop { position: 1.0; color: "#223366aa" } + } + clip: true + + TextInput { + id: searchInput + anchors.fill: parent + anchors.margins: 12 + color: "white" + font.pixelSize: 14 + focus: true + Keys.onEscapePressed: Qt.quit() + onTextChanged: { + win.searchQuery = text; + // Filter then sort by name inside populateModel + populateModel(filterImages(text)); + } + } + + Text { + text: "Search…" + color: "#88ffffff" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 16 + visible: searchInput.text.length === 0 + } + } + + // Empty-state overlay when no images are found + Item { + id: emptyOverlay + anchors.fill: parent + visible: noImages + Column { + anchors.centerIn: parent + spacing: 8 + Text { text: dirMissing ? "Directory not found" : "No images found"; color: "white"; font.pixelSize: 16; horizontalAlignment: Text.AlignHCenter } + Text { text: dirPath; color: "#cccccc"; font.pixelSize: 12; horizontalAlignment: Text.AlignHCenter } + Text { text: dirMissing ? "Create the directory or pass -d DIR / set WALL_DIR" : "Tip: pass -d DIR or set WALL_DIR to your wallpapers folder"; color: "#aaaaaa"; font.pixelSize: 11; horizontalAlignment: Text.AlignHCenter } + } + } + GridView { + id: grid + anchors.left: parent.left + anchors.right: parent.right + anchors.top: searchBar.bottom + anchors.bottom: parent.bottom + anchors.leftMargin: hpad + anchors.rightMargin: hpad + anchors.topMargin: 8 + anchors.bottomMargin: 8 + model: imagesModel + interactive: true + focus: true + Keys.onEscapePressed: Qt.quit() + cellWidth: thumbSize + (cellPadding * 2) + cellHeight: thumbSize + (cellPadding * 2) + 18 + boundsBehavior: Flickable.StopAtBounds + clip: true + flow: GridView.FlowLeftToRight + + delegate: Item { + width: grid.cellWidth + height: grid.cellHeight + Component.onCompleted: { + if (!win.firstDelegateLogged && win.perfEnabled) { + console.log("[perf] q5_first_delegate total_ms=" + (Date.now() - win.qStart)); + win.firstDelegateLogged = true; + } + } + + Column { + anchors.fill: parent + anchors.margins: cellPadding + spacing: 0 + + Rectangle { + width: thumbSize + height: thumbSize + color: "transparent" + radius: 10 + border.width: 0 + border.color: "#66ccff" + clip: true + + Image { + id: thumbImg + anchors.fill: parent + anchors.margins: 2 + source: thumb + fillMode: Image.PreserveAspectFit + smooth: true + antialiasing: true + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: thumbImg.width + height: thumbImg.height + radius: 10 + } + } + } + + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.width = 2 + onExited: parent.border.width = 0 + onClicked: { parent.border.width = 2; console.log("SELECT:" + path); Qt.quit(); } + } + } + + Text { + text: name + color: "white" + font.pixelSize: 12 + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + width: thumbSize + } + } + } + } + } + } + QML + + # Prepare QML runtime environment (Qt6) + export QT_QPA_PLATFORM="wayland;xcb" + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:${pkgs.qt6.qtwayland}/lib/qt-6/plugins" + export QML_IMPORT_PATH="${pkgs.qt6.qtbase}/lib/qt-6/qml:${pkgs.qt6.qtdeclarative}/lib/qt-6/qml:${pkgs.qt6.qt5compat}/lib/qt-6/qml:${pkgs.qt6.qtsvg}/lib/qt-6/qml" + export QML2_IMPORT_PATH="$QML_IMPORT_PATH" + + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml" + if ! [ -x "$QML_BIN" ]; then + if [ -x "${pkgs.qt6.qtdeclarative}/bin/qml6" ]; then + QML_BIN="${pkgs.qt6.qtdeclarative}/bin/qml6" + elif command -v qml >/dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + fi + fi + + # Debug mode: run QML directly and do not filter output + if [ -n "''${QS_DEBUG:-}" ]; then + { + echo "[qs-wallpapers] DIR=$DIR" >&2 + echo "[qs-wallpapers] CACHE=$CACHE" >&2 + echo "[qs-wallpapers] SIZE=$SIZE" >&2 + echo "[qs-wallpapers] IMAGES_COUNT=''${#IMAGES[@]}" >&2 + echo "[qs-wallpapers] QML_BIN=$QML_BIN" >&2 + echo "[qs-wallpapers] QML_FILE=$qml" >&2 + echo "[qs-wallpapers] QML_IMPORT_PATH=$QML_IMPORT_PATH" >&2 + } || true + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + exec "$QML_BIN" "$qml" + fi + + # Run QML runtime and capture selection from console + [ -n "''${QS_PERF:-}" ] && echo "[perf] pre_qml_ms=$(( $(now_ms) - t2 ))" >&2 + sel=$({ "$QML_BIN" "$qml" 2>&1 || true; } | ${pkgs.gawk}/bin/awk -F'SELECT:' '/SELECT:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + + if [ -n "''${sel:-}" ]; then + printf "%s\n" "$sel" + fi +'' diff --git a/modules/home/scripts/qs-wlogout-icons/hibernate.png b/modules/home/scripts/qs-wlogout-icons/hibernate.png new file mode 100644 index 0000000..a6322aa Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/hibernate.png differ diff --git a/modules/home/scripts/qs-wlogout-icons/lock.png b/modules/home/scripts/qs-wlogout-icons/lock.png new file mode 100644 index 0000000..f0b1eaf Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/lock.png differ diff --git a/modules/home/scripts/qs-wlogout-icons/logout.png b/modules/home/scripts/qs-wlogout-icons/logout.png new file mode 100644 index 0000000..345a8aa Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/logout.png differ diff --git a/modules/home/scripts/qs-wlogout-icons/reboot.png b/modules/home/scripts/qs-wlogout-icons/reboot.png new file mode 100644 index 0000000..29cfa2f Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/reboot.png differ diff --git a/modules/home/scripts/qs-wlogout-icons/shutdown.png b/modules/home/scripts/qs-wlogout-icons/shutdown.png new file mode 100644 index 0000000..4d7d499 Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/shutdown.png differ diff --git a/modules/home/scripts/qs-wlogout-icons/suspend.png b/modules/home/scripts/qs-wlogout-icons/suspend.png new file mode 100644 index 0000000..647bd66 Binary files /dev/null and b/modules/home/scripts/qs-wlogout-icons/suspend.png differ diff --git a/modules/home/scripts/qs-wlogout.nix b/modules/home/scripts/qs-wlogout.nix new file mode 100644 index 0000000..4c24cac --- /dev/null +++ b/modules/home/scripts/qs-wlogout.nix @@ -0,0 +1,282 @@ +{ + pkgs, + inputs ? null, +}: let + icons = pkgs.runCommand "qs-wlogout-icons" {} '' + mkdir -p $out + cp ${./qs-wlogout-icons}/* $out/ + ''; +in + pkgs.writeShellScriptBin "qs-wlogout" '' + #!/usr/bin/env bash + set -euo pipefail + + [ -n "''${QS_DEBUG:-}" ] && set -x + DEBUG="''${QS_DEBUG:-}" + log() { if [ -n "$DEBUG" ]; then echo "[qs-wlogout] $*" >&2; fi } + + # Configurable defaults via env + ICONS_DIR="''${QS_WLOGOUT_ICONS_DIR:-$HOME/.local/share/qs-wlogout/icons}" + QML_DIR="''${QS_WLOGOUT_QML_DIR:-$HOME/.local/share/qs-wlogout}" + SPANISH="''${QS_WLOGOUT_SPANISH:-0}" + + usage() { + cat <&2; exit 2 ;; + \?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + # Ensure required directories exist + mkdir -p "$(dirname "$ICONS_DIR")" + mkdir -p "$ICONS_DIR" + mkdir -p "$QML_DIR" + + # Copy icons if they don't exist + if [ ! -f "$ICONS_DIR/lock.png" ]; then + log "Copying default icons to $ICONS_DIR" + cp -r ${icons}/* "$ICONS_DIR/" 2>/dev/null || { + log "Failed to copy icons from nix store, creating fallback icons" + # Fallback: create minimal icon set + for icon in lock logout suspend hibernate shutdown reboot; do + ${pkgs.imagemagick}/bin/convert -size 64x64 xc:white -fill black -gravity center -pointsize 16 -annotate +0+0 "$icon" "$ICONS_DIR/$icon.png" 2>/dev/null || true + done + } + fi + + # Create temporary QML files + tmpdir=$(${pkgs.coreutils}/bin/mktemp -d) + main_qml="$tmpdir/main.qml" + + log "ICONS_DIR=$ICONS_DIR" + log "QML_DIR=$QML_DIR" + log "Main QML=$main_qml" + + # No need for separate LogoutButton.qml - using inline data in main.qml + + # Generate main.qml (standard Qt QML application) + cat > "$tmpdir/main.qml" </dev/null 2>&1; then + QML_BIN=$(command -v qml) + elif command -v qml6 >/dev/null 2>&1; then + QML_BIN=$(command -v qml6) + elif command -v qmlscene >/dev/null 2>&1; then + QML_BIN=$(command -v qmlscene) + else + echo "Error: Qt QML runtime not found" >&2 + echo "Make sure Qt6 is installed and qtdeclarative is available" >&2 + exit 1 + fi + fi + + log "QML_BIN=$QML_BIN" + + # Debug mode: show more info and don't hide output + if [ -n "''${QS_DEBUG:-}" ]; then + echo "[qs-wlogout] ICONS_DIR=$ICONS_DIR" >&2 + echo "[qs-wlogout] QML_DIR=$QML_DIR" >&2 + echo "[qs-wlogout] QML_BIN=$QML_BIN" >&2 + echo "[qs-wlogout] Main QML=$main_qml" >&2 + exec "$QML_BIN" "$main_qml" + fi + + # Run QML application and capture command execution from console output + out=$({ "$QML_BIN" "$main_qml" 2>&1 || true; }) + exec_cmd=$(printf "%s\n" "$out" | ${pkgs.gawk}/bin/awk -F'EXEC:' '/EXEC:/{print $2}' | ${pkgs.coreutils}/bin/tail -n1) + + if [ -n "''${exec_cmd:-}" ]; then + log "Executing: $exec_cmd" + exec ${pkgs.bash}/bin/bash -c "$exec_cmd" + fi + '' diff --git a/modules/home/scripts/restart.noctalia b/modules/home/scripts/restart.noctalia new file mode 100644 index 0000000..747c18a --- /dev/null +++ b/modules/home/scripts/restart.noctalia @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Restart the Noctalia QuickShell session by terminating only the noctalia-shell +# processes, avoiding any signals to unrelated process groups (e.g. Hyprland). + +log() { printf "[restart.noctalia] %s\n" "$*"; } + +list_target_pids() { + # Collect only PIDs whose command explicitly runs noctalia-shell + # - direct wrapper: ".../noctalia-shell" + # - quickshell/qs with "-c noctalia-shell" + ps -eo pid=,cmd= \ + | ${GREP:-grep} -E "(^|/)(noctalia-shell)( |$)|(^| )((qs|quickshell))( | ).*-c( |=)?noctalia-shell( |$)" \ + | awk '{print $1}' +} + +terminate_targets() { + local pids left tries + mapfile -t pids < <(list_target_pids || true) + + if ((${#pids[@]} > 0)); then + kill -TERM "${pids[@]}" 2>/dev/null || true + fi + + # Wait up to ~3s for clean exit + for tries in {1..15}; do + mapfile -t left < <(list_target_pids || true) + ((${#left[@]} == 0)) && break + sleep 0.2 + done + + # Force kill leftovers only (do not touch anything else) + if ((${#left[@]} > 0)); then + kill -KILL "${left[@]}" 2>/dev/null || true + fi +} + +start_noctalia() { + # Prefer the noctalia-shell wrapper to ensure proper env and runtime flags + if command -v noctalia-shell >/dev/null 2>&1; then + nohup setsid noctalia-shell >/dev/null 2>&1 & + elif command -v quickshell >/dev/null 2>&1; then + nohup setsid quickshell -c noctalia-shell >/dev/null 2>&1 & + elif command -v qs >/dev/null 2>&1; then + nohup setsid qs -c noctalia-shell >/dev/null 2>&1 & + else + echo "Error: noctalia-shell/quickshell/qs not found in PATH" >&2 + exit 1 + fi +} + +terminate_targets +start_noctalia diff --git a/modules/home/scripts/restart.noctalia.nix b/modules/home/scripts/restart.noctalia.nix new file mode 100644 index 0000000..d229149 --- /dev/null +++ b/modules/home/scripts/restart.noctalia.nix @@ -0,0 +1,24 @@ +{pkgs, ...}: let + binPath = pkgs.lib.makeBinPath [ + pkgs.coreutils + pkgs.procps + pkgs.psmisc + pkgs.gnugrep + pkgs.findutils + pkgs.util-linux + pkgs.bash + ]; + script = builtins.readFile ./restart.noctalia; +in + pkgs.writeShellScriptBin "restart.noctalia" '' + set -euo pipefail + export PATH=${binPath}:$PATH + + tmp_script=$(mktemp) + trap 'rm -f "$tmp_script"' EXIT + cat > "$tmp_script" <<'BASH_EOF' + ${script} + BASH_EOF + chmod +x "$tmp_script" + exec ${pkgs.bash}/bin/bash "$tmp_script" "$@" + '' diff --git a/modules/home/scripts/rofi-launcher.nix b/modules/home/scripts/rofi-launcher.nix index 014802d..b1a3eb2 100644 --- a/modules/home/scripts/rofi-launcher.nix +++ b/modules/home/scripts/rofi-launcher.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: pkgs.writeShellScriptBin "rofi-launcher" '' # check if rofi is already running if pidof rofi > /dev/null; then diff --git a/modules/home/scripts/screenshootin.nix b/modules/home/scripts/screenshootin.nix index 15042b4..40de68e 100644 --- a/modules/home/scripts/screenshootin.nix +++ b/modules/home/scripts/screenshootin.nix @@ -1,5 +1,4 @@ -{ pkgs }: - +{pkgs}: pkgs.writeShellScriptBin "screenshootin" '' grim -g "$(slurp)" - | swappy -f - '' diff --git a/modules/home/scripts/squirtle.nix b/modules/home/scripts/squirtle.nix index c1aeb93..198a18c 100644 --- a/modules/home/scripts/squirtle.nix +++ b/modules/home/scripts/squirtle.nix @@ -1,23 +1,22 @@ -{ pkgs }: - +{pkgs}: pkgs.writeShellScriptBin "squirtle" '' echo " -  ████████ ██████ -  ██████████████ ██████████ +  ████████ ██████ +  ██████████████ ██████████  ████████████████████ ██████████████  ████████████████████████ ██████████████ ██████████████████████████████████████████ - ████████████████████████████████████████ - ██████████████████████████████████████ -  ██████████████████████████████████ -  ████████████████████████████████ -  ██████████████████████████████ -  ██████████████████████████ -  ██████████████████████ -  ██████████████████████ -  ██████████████████████ -  ████ ████████████ -  ██████████ + ████████████████████████████████████████ + ██████████████████████████████████████ +  ██████████████████████████████████ +  ████████████████████████████████ +  ██████████████████████████████ +  ██████████████████████████ +  ██████████████████████ +  ██████████████████████ +  ██████████████████████ +  ████ ████████████ +  ██████████  ██████  " '' diff --git a/modules/home/scripts/task-waybar.nix b/modules/home/scripts/task-waybar.nix index 9ba29d1..46b079c 100644 --- a/modules/home/scripts/task-waybar.nix +++ b/modules/home/scripts/task-waybar.nix @@ -1,5 +1,4 @@ -{ pkgs }: - +{pkgs}: pkgs.writeShellScriptBin "task-waybar" '' sleep 0.1 ${pkgs.swaynotificationcenter}/bin/swaync-client -t & diff --git a/modules/home/scripts/wallpaper-thumbs-build.nix b/modules/home/scripts/wallpaper-thumbs-build.nix new file mode 100644 index 0000000..5a54a76 --- /dev/null +++ b/modules/home/scripts/wallpaper-thumbs-build.nix @@ -0,0 +1,70 @@ +{pkgs}: +pkgs.writeShellScriptBin "wallpaper-thumbs-build" '' + #!/usr/bin/env bash + set -euo pipefail + + DIR="''${WALL_DIR:-$HOME/Pictures/Wallpapers}" + CACHE="''${WALL_CACHE_DIR:-$HOME/.cache/wallthumbs}" + SIZE="''${WALL_THUMB_SIZE:-256}" + PARALLEL="''${WALL_PARALLEL:-0}" + QUIET="0" + + usage() { + cat <&2; exit 2 ;; + \?) echo "Unknown option -$OPTARG" >&2; usage; exit 2 ;; + esac + done + + if [ ! -d "$DIR" ]; then + echo "Wallpapers directory not found: $DIR" >&2 + exit 1 + fi + + mkdir -p "$CACHE" + + # Gather images deterministically; follow symlinks and ignore errors + mapfile -t IMAGES < <( { ${pkgs.findutils}/bin/find -L "$DIR" \ + \( -type f -o -xtype f \) \ + \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.avif' -o -iname '*.bmp' -o -iname '*.tiff' \) \ + -print0 2>/dev/null || true; } \ + | ${pkgs.coreutils}/bin/tr '\0' '\n' | ${pkgs.coreutils}/bin/sort ) + + if [ "''${#IMAGES[@]}" -eq 0 ]; then + exit 0 + fi + + # Generate thumbnails (serial loop) + for img in "''${IMAGES[@]}"; do + hash=$(${pkgs.coreutils}/bin/printf "%s" "$img" | ${pkgs.openssl}/bin/openssl dgst -sha256 -r | ${pkgs.gawk}/bin/awk '{print $1}') + out="$CACHE/$hash.png" + if [ -f "$out" ]; then + continue + fi + ${pkgs.imagemagick}/bin/convert "$img" -auto-orient -thumbnail "''${SIZE}x''${SIZE}>" \ + -background none -gravity center -extent "''${SIZE}x''${SIZE}" "$out" 2>/dev/null || true + if [ "$QUIET" != "1" ]; then + echo "thumb: $out" + fi + done +'' diff --git a/modules/home/scripts/wallsetter.nix b/modules/home/scripts/wallsetter.nix index 6f391a6..59c5226 100644 --- a/modules/home/scripts/wallsetter.nix +++ b/modules/home/scripts/wallsetter.nix @@ -1,5 +1,6 @@ -{ pkgs, ... }: - +{pkgs, inputs, ...}: let + awwwPkg = inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.awww; +in pkgs.writeShellScriptBin "wallsetter" '' TIMEOUT=720 @@ -18,7 +19,7 @@ pkgs.writeShellScriptBin "wallsetter" '' PREVIOUS=$WALLPAPER - ${pkgs.swww}/bin/swww img "$WALLPAPER" --transition-type random --transition-step 1 --transition-fps 60 + ${awwwPkg}/bin/awww img "$WALLPAPER" --transition-type random --transition-step 1 --transition-fps 60 sleep $TIMEOUT done '' diff --git a/modules/home/scripts/web-search.nix b/modules/home/scripts/web-search.nix index 0a28e6b..7a0f5c4 100644 --- a/modules/home/scripts/web-search.nix +++ b/modules/home/scripts/web-search.nix @@ -1,4 +1,4 @@ -{ pkgs }: +{pkgs}: pkgs.writeShellScriptBin "web-search" '' # check if rofi is already running if pidof rofi > /dev/null; then diff --git a/modules/home/scripts/zcli.nix b/modules/home/scripts/zcli.nix index 26ca095..05eae32 100644 --- a/modules/home/scripts/zcli.nix +++ b/modules/home/scripts/zcli.nix @@ -1,11 +1,11 @@ -{ pkgs -, profile -, backupFiles ? [ ".config/mimeapps.list.backup" ] -, ... -}: -let +{ + pkgs, + profile, + backupFiles ? [".config/mimeapps.list.backup"], + ... +}: let backupFilesString = pkgs.lib.strings.concatStringsSep " " backupFiles; - + # Create the get-doom script as a dependency get-doom-script = pkgs.writeShellScriptBin "get-doom" '' #!/usr/bin/env bash @@ -78,625 +78,648 @@ let print_success "All done! Doom Emacs is ready to use." ''; in + pkgs.writeShellScriptBin "zcli" '' + #!${pkgs.bash}/bin/bash + set -euo pipefail -pkgs.writeShellScriptBin "zcli" '' - #!${pkgs.bash}/bin/bash - set -euo pipefail - - # --- Program info --- - # - # zcli - NixOS System Management CLI - # ================================== - # - # Purpose: NixOS system management utility for ZaneyOS distribution - # Author: Don Williams (ddubs) & Zaney - # Start Date: June 7th, 2025 - # Version: 1.0.2 - # - # Architecture: - # - Nix-generated shell script using writeShellScriptBin - # - Configuration via Nix parameters (profile, backupFiles) - # - Uses 'nh' tool for NixOS operations, 'inxi' for diagnostics - # - Git integration for host configuration versioning - # - # Helper Functions: - # verify_hostname() - Validates current hostname against flake.nix host variable - # Exits with error if mismatch or missing host directory - # detect_gpu_profile() - Parses lspci output to identify GPU hardware - # Returns: nvidia/nvidia-laptop/amd-hybrid/amd/intel/vm/empty - # handle_backups() - Removes files listed in BACKUP_FILES array from $HOME - # parse_nh_args() - Parses command-line arguments for nh operations - # print_help() - Outputs command usage and available operations - # - # Command Functions: - # cleanup - Interactive cleanup of old generations via 'nh clean' - # diag - Generate system report using 'inxi --full' - # list-gens - Display user/system generations via nix-env and nix profile - # rebuild - NixOS rebuild using 'nh os switch' - # rebuild-boot - NixOS rebuild for next boot using 'nh os boot' - # trim - SSD optimization via 'sudo fstrim -v /' - # update - Flake update + rebuild using 'nh os switch --update' - # update-host - Modify flake.nix host/profile variables via sed - # add-host - Add new host configuration - # del-host - Delete host configuration - # doom [sub] - Doom Emacs management (install/status/remove/update) - # - # Variables: - # PROJECT - Base directory name (ddubsos/zaneyos) - # PROFILE - Hardware profile from Nix parameter - # BACKUP_FILES - Array of backup file paths to clean - # FLAKE_NIX_PATH - Path to flake.nix for host/profile updates - # + # --- Program info --- + # + # zcli - NixOS System Management CLI + # ================================== + # + # Purpose: NixOS system management utility for ZaneyOS distribution + # Author: Don Williams (ddubs) & Zaney + # Start Date: June 7th, 2025 + # Version: 1.0.2 + # + # Architecture: + # - Nix-generated shell script using writeShellScriptBin + # - Configuration via Nix parameters (profile, backupFiles) + # - Uses 'nh' tool for NixOS operations, 'inxi' for diagnostics + # - Git integration for host configuration versioning + # + # Helper Functions: + # verify_hostname() - Validates current hostname against flake.nix host variable + # Exits with error if mismatch or missing host directory + # detect_gpu_profile() - Parses lspci output to identify GPU hardware + # Returns: nvidia/nvidia-laptop/amd-hybrid/amd/intel/vm/empty + # handle_backups() - Removes files listed in BACKUP_FILES array from $HOME + # parse_nh_args() - Parses command-line arguments for nh operations + # print_help() - Outputs command usage and available operations + # + # Command Functions: + # cleanup - Interactive cleanup of old generations via 'nh clean' + # diag - Generate system report using 'inxi --full' + # list-gens - Display user/system generations via nix-env and nix profile + # rebuild - NixOS rebuild using 'nh os switch' + # rebuild-boot - NixOS rebuild for next boot using 'nh os boot' + # trim - SSD optimization via 'sudo fstrim -v /' + # update - Flake update + rebuild using 'nh os switch --update' + # update-host - Modify flake.nix host/profile variables via sed + # add-host - Add new host configuration + # del-host - Delete host configuration + # doom [sub] - Doom Emacs management (install/status/remove/update) + # + # Variables: + # PROJECT - Base directory name (ddubsos/zaneyos) + # PROFILE - Hardware profile from Nix parameter + # BACKUP_FILES - Array of backup file paths to clean + # FLAKE_NIX_PATH - Path to flake.nix for host/profile updates + # - # --- Configuration --- - PROJECT="zaneyos" #ddubos or zaneyos - PROFILE="${profile}" - BACKUP_FILES_STR="${backupFilesString}" - VERSION="1.0.2" - FLAKE_NIX_PATH="$HOME/$PROJECT/flake.nix" + # --- Configuration --- + PROJECT="zaneyos" #ddubos or zaneyos + PROFILE_DEFAULT="${profile}" + BACKUP_FILES_STR="${backupFilesString}" + VERSION="1.0.2" + FLAKE_NIX_PATH="$HOME/$PROJECT/flake.nix" - read -r -a BACKUP_FILES <<< "$BACKUP_FILES_STR" + read -r -a BACKUP_FILES <<< "$BACKUP_FILES_STR" - # --- Helper Functions --- - verify_hostname() { - local current_hostname - local flake_hostname - - current_hostname="$(hostname)" - - # Extract the host value from flake.nix - if [ -f "$FLAKE_NIX_PATH" ]; then - flake_hostname=$(${pkgs.gnugrep}/bin/grep -E '^[[:space:]]*host[[:space:]]*=' "$FLAKE_NIX_PATH" | ${pkgs.gnused}/bin/sed 's/.*=[[:space:]]*"\([^"]*\)".*/\1/') - - if [ -z "$flake_hostname" ]; then - echo "Error: Could not find 'host' variable in $FLAKE_NIX_PATH" >&2 - exit 1 + # --- Helper Functions --- + get_flake_profile() { + local flake_profile="" + if [ -f "$FLAKE_NIX_PATH" ]; then + flake_profile=$(${pkgs.gnugrep}/bin/grep -E '^[[:space:]]*profile[[:space:]]*=' "$FLAKE_NIX_PATH" | ${pkgs.gnused}/bin/sed 's/.*=[[:space:]]*"\([^"]*\)".*/\1/') fi - - if [ "$current_hostname" != "$flake_hostname" ]; then - echo "Error: Hostname mismatch!" >&2 - echo " Current hostname: '$current_hostname'" >&2 - echo " Flake.nix host: '$flake_hostname'" >&2 - echo "" >&2 - echo "Hint: Run 'zcli update-host' to automatically update flake.nix" >&2 - echo " or manually edit $FLAKE_NIX_PATH" >&2 - exit 1 - fi - else - echo "Error: Flake.nix not found at $FLAKE_NIX_PATH" >&2 - exit 1 - fi - - # Also check if host folder exists - local folder="$HOME/$PROJECT/hosts/$current_hostname" - if [ ! -d "$folder" ]; then - echo "Error: Matching host not found in $PROJECT, Missing folder: $folder" >&2 - exit 1 - fi - } + echo "$flake_profile" + } + verify_hostname() { + local current_hostname + local flake_hostname - print_help() { - echo "ZaneyOS CLI Utility -- version $VERSION" - echo "" - echo "Usage: zcli [command] [options]" - echo "" - echo "Commands:" - echo " cleanup - Clean up old system generations. Can specify a number to keep." - echo " diag - Create a system diagnostic report." - echo " (Filename: homedir/diag.txt)" - echo " list-gens - List user and system generations." - echo " rebuild - Rebuild the NixOS system configuration." - echo " rebuild-boot - Rebuild and set as boot default (activates on next restart)." - echo " trim - Trim filesystems to improve SSD performance." - echo " update - Update the flake and rebuild the system." - echo " update-host - Auto set host and profile in flake.nix." - echo " (Opt: zcli update-host [hostname] [profile])" - echo "" - echo "Options for rebuild, rebuild-boot, and update commands:" - echo " --dry, -n - Show what would be done without doing it" - echo " --ask, -a - Ask for confirmation before proceeding" - echo " --cores N - Limit build to N cores (useful for VMs)" - echo " --verbose, -v - Show verbose output" - echo " --no-nom - Don't use nix-output-monitor" - echo "" - echo "Doom Emacs:" - echo " doom install - Install Doom Emacs using get-doom script." - echo " doom status - Check if Doom Emacs is installed." - echo " doom remove - Remove Doom Emacs installation." - echo " doom update - Update Doom Emacs (runs doom sync)." - echo "" - echo " help - Show this help message." - } + current_hostname="$(hostname)" - handle_backups() { - if [ ''${#BACKUP_FILES[@]} -eq 0 ]; then - echo "No backup files configured to check." - return - fi + # Extract the host value from flake.nix + if [ -f "$FLAKE_NIX_PATH" ]; then + flake_hostname=$(${pkgs.gnugrep}/bin/grep -E '^[[:space:]]*host[[:space:]]*=' "$FLAKE_NIX_PATH" | ${pkgs.gnused}/bin/sed 's/.*=[[:space:]]*"\([^"]*\)".*/\1/') - echo "Checking for backup files to remove..." - for file_path in "''${BACKUP_FILES[@]}"; do - full_path="$HOME/$file_path" - if [ -f "$full_path" ]; then - echo "Removing stale backup file: $full_path" - rm "$full_path" - fi - done - } - - detect_gpu_profile() { - local detected_profile="" - local has_nvidia=false - local has_intel=false - local has_amd=false - local has_vm=false - - if ${pkgs.pciutils}/bin/lspci &> /dev/null; then # Check if lspci is available - if ${pkgs.pciutils}/bin/lspci | ${pkgs.gnugrep}/bin/grep -qi 'vga\|3d'; then - while read -r line; do - if echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'nvidia'; then - has_nvidia=true - elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'amd'; then - has_amd=true - elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'intel'; then - has_intel=true - elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'virtio\|vmware'; then - has_vm=true - fi - done < <(${pkgs.pciutils}/bin/lspci | ${pkgs.gnugrep}/bin/grep -i 'vga\|3d') - - if "$has_vm"; then - detected_profile="vm" - elif "$has_nvidia" && "$has_intel"; then - detected_profile="nvidia-laptop" - elif "$has_nvidia" && "$has_amd"; then - detected_profile="amd-hybrid" - elif "$has_nvidia"; then - detected_profile="nvidia" - elif "$has_amd"; then - detected_profile="amd" - elif "$has_intel"; then - detected_profile="intel" + if [ -z "$flake_hostname" ]; then + echo "Error: Could not find 'host' variable in $FLAKE_NIX_PATH" >&2 + exit 1 fi - fi - else - echo "Warning: lspci command not found. Cannot auto-detect GPU profile." >&2 - fi - echo "$detected_profile" # Return the detected profile - } - # --- Helper function to parse additional arguments --- - parse_nh_args() { - local args_string="" - local options_selected=() - shift # Remove the main command (rebuild, rebuild-boot, update) - - while [[ $# -gt 0 ]]; do - case $1 in - --dry|-n) - args_string="$args_string --dry" - options_selected+=("dry run mode (showing what would be done)") - shift - ;; - --ask|-a) - args_string="$args_string --ask" - options_selected+=("confirmation prompts enabled") - shift - ;; - --cores) - if [[ -n $2 && $2 =~ ^[0-9]+$ ]]; then - args_string="$args_string -- --cores $2" - options_selected+=("limited to $2 CPU cores") - shift 2 + if [ "$current_hostname" != "$flake_hostname" ]; then + echo "Error: Hostname mismatch!" >&2 + echo " Current hostname: '$current_hostname'" >&2 + echo " Flake.nix host: '$flake_hostname'" >&2 + echo "" >&2 + echo "Hint: Run 'zcli update-host' to automatically update flake.nix" >&2 + echo " or manually edit $FLAKE_NIX_PATH" >&2 + exit 1 + fi + else + echo "Error: Flake.nix not found at $FLAKE_NIX_PATH" >&2 + exit 1 + fi + + # Also check if host folder exists + local folder="$HOME/$PROJECT/hosts/$current_hostname" + if [ ! -d "$folder" ]; then + echo "Error: Matching host not found in $PROJECT, Missing folder: $folder" >&2 + exit 1 + fi + } + + print_help() { + echo "ZaneyOS CLI Utility -- version $VERSION" + echo "" + echo "Usage: zcli [command] [options]" + echo "" + echo "Commands:" + echo " cleanup - Clean up old system generations. Can specify a number to keep." + echo " diag - Create a system diagnostic report." + echo " (Filename: homedir/diag.txt)" + echo " list-gens - List user and system generations." + echo " rebuild - Rebuild the NixOS system configuration." + echo " rebuild-boot - Rebuild and set as boot default (activates on next restart)." + echo " trim - Trim filesystems to improve SSD performance." + echo " update - Update the flake and rebuild the system." + echo " update-host - Auto set host and profile in flake.nix." + echo " (Opt: zcli update-host [hostname] [profile])" + echo "" + echo "Options for rebuild, rebuild-boot, and update commands:" + echo " --dry, -n - Show what would be done without doing it" + echo " --ask, -a - Ask for confirmation before proceeding" + echo " --cores N - Limit build to N cores (useful for VMs)" + echo " --verbose, -v - Show verbose output" + echo " --no-nom - Don't use nix-output-monitor" + echo "" + echo "Doom Emacs:" + echo " doom install - Install Doom Emacs using get-doom script." + echo " doom status - Check if Doom Emacs is installed." + echo " doom remove - Remove Doom Emacs installation." + echo " doom update - Update Doom Emacs (runs doom sync)." + echo "" + echo " help - Show this help message." + } + + handle_backups() { + if [ ''${#BACKUP_FILES[@]} -eq 0 ]; then + echo "No backup files configured to check." + return + fi + + echo "Checking for backup files to remove..." + for file_path in "''${BACKUP_FILES[@]}"; do + full_path="$HOME/$file_path" + if [ -f "$full_path" ]; then + echo "Removing stale backup file: $full_path" + rm "$full_path" + fi + done + } + + detect_gpu_profile() { + local detected_profile="" + local has_nvidia=false + local has_intel=false + local has_amd=false + local has_vm=false + # Prefer hypervisor detection first to avoid misclassifying VMs as AMD + if ${pkgs.systemd}/bin/systemd-detect-virt -q; then + echo "vm" + return + fi + + if ${pkgs.pciutils}/bin/lspci &> /dev/null; then # Check if lspci is available + if ${pkgs.pciutils}/bin/lspci -nn | ${pkgs.gnugrep}/bin/grep -qi 'vga\|3d\|display'; then + while read -r line; do + if echo "$line" | ${pkgs.gnugrep}/bin/grep -Eq '\[10de:'; then + has_nvidia=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -Eq '\[1002:'; then + has_amd=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -Eq '\[8086:'; then + has_intel=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -Eq '\[(1af4|15ad|80ee|1b36|1414|1234|1013):'; then + has_vm=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'nvidia'; then + has_nvidia=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'amd\|ati\|advanced micro devices'; then + has_amd=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'intel'; then + has_intel=true + elif echo "$line" | ${pkgs.gnugrep}/bin/grep -qi 'virtio\|vmware\|virtualbox\|qxl\|hyper-v\|microsoft corporation\|parallels\|qemu\|bochs\|cirrus\|svga\|virtual'; then + has_vm=true + fi + done < <(${pkgs.pciutils}/bin/lspci -nn | ${pkgs.gnugrep}/bin/grep -i 'vga\|3d\|display') + + if $has_vm; then + detected_profile="vm" + elif $has_nvidia && $has_intel; then + detected_profile="nvidia-laptop" + elif $has_nvidia && $has_amd; then + detected_profile="amd-hybrid" + elif $has_nvidia; then + detected_profile="nvidia" + elif $has_amd; then + detected_profile="amd" + elif $has_intel; then + detected_profile="intel" + fi + fi + else + echo "Warning: lspci command not found. Cannot auto-detect GPU profile." >&2 + fi + echo "$detected_profile" # Return the detected profile + } + + # --- Helper function to parse additional arguments --- + parse_nh_args() { + local args_string="" + local options_selected=() + shift # Remove the main command (rebuild, rebuild-boot, update) + + while [[ $# -gt 0 ]]; do + case $1 in + --dry|-n) + args_string="$args_string --dry" + options_selected+=("dry run mode (showing what would be done)") + shift + ;; + --ask|-a) + args_string="$args_string --ask" + options_selected+=("confirmation prompts enabled") + shift + ;; + --cores) + if [[ -n $2 && $2 =~ ^[0-9]+$ ]]; then + args_string="$args_string -- --cores $2" + options_selected+=("limited to $2 CPU cores") + shift 2 + else + echo "Error: --cores requires a numeric argument" >&2 + exit 1 + fi + ;; + --verbose|-v) + args_string="$args_string --verbose" + options_selected+=("verbose output enabled") + shift + ;; + --no-nom) + args_string="$args_string --no-nom" + options_selected+=("nix-output-monitor disabled") + shift + ;; + --) + shift + args_string="$args_string -- $*" + options_selected+=("additional arguments: $*") + break + ;; + -*) + echo "Warning: Unknown flag '$1' - passing through to nh" >&2 + args_string="$args_string $1" + options_selected+=("unknown flag '$1' passed through") + shift + ;; + *) + echo "Error: Unexpected argument '$1'" >&2 + exit 1 + ;; + esac + done + + # Print friendly confirmation of selected options to stderr so it doesn't interfere with return value + if [[ ''${#options_selected[@]} -gt 0 ]]; then + echo "Options selected:" >&2 + for option in "''${options_selected[@]}"; do + echo " ✓ $option" >&2 + done + echo >&2 + fi + + # Return only the args string + echo "$args_string" + } + + # --- Main Logic --- + PROFILE="$(get_flake_profile)" + if [ -z "$PROFILE" ]; then + PROFILE="$PROFILE_DEFAULT" + fi + if [ "$#" -eq 0 ]; then + echo "Error: No command provided." >&2 + print_help + exit 1 + fi + + case "$1" in + cleanup) + echo "Warning! This will remove old generations of your system." + read -p "How many generations to keep (default: all)? " keep_count + + if [ -z "$keep_count" ]; then + read -p "This will remove all but the current generation. Continue (y/N)? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + ${pkgs.nh}/bin/nh clean all -v else - echo "Error: --cores requires a numeric argument" >&2 + echo "Cleanup cancelled." + fi + else + read -p "This will keep the last $keep_count generations. Continue (y/N)? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + ${pkgs.nh}/bin/nh clean all -k "$keep_count" -v + else + echo "Cleanup cancelled." + fi + fi + + LOG_DIR="$HOME/zcli-cleanup-logs" + mkdir -p "$LOG_DIR" + LOG_FILE="$LOG_DIR/zcli-cleanup-$(${pkgs.coreutils}/bin/date +%Y-%m-%d_%H-%M-%S).log" + echo "Cleaning up old log files..." >> "$LOG_FILE" + ${pkgs.findutils}/bin/find "$LOG_DIR" -type f -mtime +3 -name "*.log" -delete >> "$LOG_FILE" 2>&1 + echo "Cleanup process logged to $LOG_FILE" + ;; + diag) + echo "Generating system diagnostic report..." + ${pkgs.inxi}/bin/inxi --full > "$HOME/diag.txt" + echo "Diagnostic report saved to $HOME/diag.txt" + ;; + help) + print_help + ;; + list-gens) + echo "--- User Generations ---" + ${pkgs.nix}/bin/nix-env --list-generations || echo "Could not list user generations." + echo "" + echo "--- System Generations ---" + ${pkgs.nix}/bin/nix profile history --profile /nix/var/nix/profiles/system || echo "Could not list system generations." + ;; + rebuild) + verify_hostname + handle_backups + + # Parse additional arguments + extra_args=$(parse_nh_args "$@") + + echo "Starting NixOS rebuild for host: $(${pkgs.nettools}/bin/hostname)" + if eval "${pkgs.nh}/bin/nh os switch --diff always --hostname '$PROFILE' $extra_args"; then + echo "Rebuild finished successfully" + else + echo "Rebuild Failed" >&2 + exit 1 + fi + ;; + rebuild-boot) + verify_hostname + handle_backups + + # Parse additional arguments + extra_args=$(parse_nh_args "$@") + + echo "Starting NixOS rebuild (boot) for host: $(${pkgs.nettools}/bin/hostname)" + echo "Note: Configuration will be activated on next reboot" + if eval "${pkgs.nh}/bin/nh os boot --diff always --hostname '$PROFILE' $extra_args"; then + echo "Rebuild-boot finished successfully" + echo "New configuration set as boot default - restart to activate" + else + echo "Rebuild-boot Failed" >&2 + exit 1 + fi + ;; + trim) + echo "Running 'sudo fstrim -v /' may take a few minutes and impact system performance." + read -p "Enter (y/Y) to run now or enter to exit (y/N): " -n 1 -r + echo # move to a new line + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Running fstrim..." + sudo ${pkgs.util-linux}/bin/fstrim -v / + echo "fstrim complete." + else + echo "Trim operation cancelled." + fi + ;; + update) + verify_hostname + handle_backups + + # Parse additional arguments + extra_args=$(parse_nh_args "$@") + + echo "Updating flake and rebuilding system for host: $(${pkgs.nettools}/bin/hostname)" + if eval "${pkgs.nh}/bin/nh os switch --diff always --hostname '$PROFILE' --update $extra_args"; then + echo "Update and rebuild finished successfully" + else + echo "Update and rebuild Failed" >&2 + exit 1 + fi + ;; + update-host) + target_hostname="" + target_profile="" + + if [ "$#" -eq 3 ]; then # zcli update-host + target_hostname="$2" + target_profile="$3" + elif [ "$#" -eq 1 ]; then # zcli update-host (auto-detect) + echo "Attempting to auto-detect hostname and GPU profile..." + target_hostname=$(${pkgs.nettools}/bin/hostname) + target_profile=$(detect_gpu_profile) + + if [ -z "$target_profile" ]; then + echo "Error: Could not auto-detect a specific GPU profile. Please provide it manually." >&2 + echo "Usage: zcli update-host [hostname] [profile]" >&2 exit 1 fi - ;; - --verbose|-v) - args_string="$args_string --verbose" - options_selected+=("verbose output enabled") - shift - ;; - --no-nom) - args_string="$args_string --no-nom" - options_selected+=("nix-output-monitor disabled") - shift - ;; - --) - shift - args_string="$args_string -- $*" - options_selected+=("additional arguments: $*") - break - ;; - -*) - echo "Warning: Unknown flag '$1' - passing through to nh" >&2 - args_string="$args_string $1" - options_selected+=("unknown flag '$1' passed through") - shift - ;; - *) - echo "Error: Unexpected argument '$1'" >&2 - exit 1 - ;; - esac - done - - # Print friendly confirmation of selected options to stderr so it doesn't interfere with return value - if [[ ''${#options_selected[@]} -gt 0 ]]; then - echo "Options selected:" >&2 - for option in "''${options_selected[@]}"; do - echo " ✓ $option" >&2 - done - echo >&2 - fi - - # Return only the args string - echo "$args_string" - } - - # --- Main Logic --- - if [ "$#" -eq 0 ]; then - echo "Error: No command provided." >&2 - print_help - exit 1 - fi - - case "$1" in - cleanup) - echo "Warning! This will remove old generations of your system." - read -p "How many generations to keep (default: all)? " keep_count - - if [ -z "$keep_count" ]; then - read -p "This will remove all but the current generation. Continue (y/N)? " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - ${pkgs.nh}/bin/nh clean all -v + echo "Auto-detected Hostname: $target_hostname" + echo "Auto-detected Profile: $target_profile" else - echo "Cleanup cancelled." - fi - else - read -p "This will keep the last $keep_count generations. Continue (y/N)? " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - ${pkgs.nh}/bin/nh clean all -k "$keep_count" -v - else - echo "Cleanup cancelled." - fi - fi - - LOG_DIR="$HOME/zcli-cleanup-logs" - mkdir -p "$LOG_DIR" - LOG_FILE="$LOG_DIR/zcli-cleanup-$(${pkgs.coreutils}/bin/date +%Y-%m-%d_%H-%M-%S).log" - echo "Cleaning up old log files..." >> "$LOG_FILE" - ${pkgs.findutils}/bin/find "$LOG_DIR" -type f -mtime +3 -name "*.log" -delete >> "$LOG_FILE" 2>&1 - echo "Cleanup process logged to $LOG_FILE" - ;; - diag) - echo "Generating system diagnostic report..." - ${pkgs.inxi}/bin/inxi --full > "$HOME/diag.txt" - echo "Diagnostic report saved to $HOME/diag.txt" - ;; - help) - print_help - ;; - list-gens) - echo "--- User Generations ---" - ${pkgs.nix}/bin/nix-env --list-generations | ${pkgs.coreutils}/bin/cat || echo "Could not list user generations." - echo "" - echo "--- System Generations ---" - ${pkgs.nix}/bin/nix profile history --profile /nix/var/nix/profiles/system | ${pkgs.coreutils}/bin/cat || echo "Could not list system generations." - ;; - rebuild) - verify_hostname - handle_backups - - # Parse additional arguments - extra_args=$(parse_nh_args "$@") - - echo "Starting NixOS rebuild for host: $(${pkgs.nettools}/bin/hostname)" - if eval "${pkgs.nh}/bin/nh os switch --hostname '$PROFILE' $extra_args"; then - echo "Rebuild finished successfully" - else - echo "Rebuild Failed" >&2 - exit 1 - fi - ;; - rebuild-boot) - verify_hostname - handle_backups - - # Parse additional arguments - extra_args=$(parse_nh_args "$@") - - echo "Starting NixOS rebuild (boot) for host: $(${pkgs.nettools}/bin/hostname)" - echo "Note: Configuration will be activated on next reboot" - if eval "${pkgs.nh}/bin/nh os boot --hostname '$PROFILE' $extra_args"; then - echo "Rebuild-boot finished successfully" - echo "New configuration set as boot default - restart to activate" - else - echo "Rebuild-boot Failed" >&2 - exit 1 - fi - ;; - trim) - echo "Running 'sudo fstrim -v /' may take a few minutes and impact system performance." - read -p "Enter (y/Y) to run now or enter to exit (y/N): " -n 1 -r - echo # move to a new line - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo "Running fstrim..." - sudo ${pkgs.util-linux}/bin/fstrim -v / - echo "fstrim complete." - else - echo "Trim operation cancelled." - fi - ;; - update) - verify_hostname - handle_backups - - # Parse additional arguments - extra_args=$(parse_nh_args "$@") - - echo "Updating flake and rebuilding system for host: $(${pkgs.nettools}/bin/hostname)" - if eval "${pkgs.nh}/bin/nh os switch --hostname '$PROFILE' --update $extra_args"; then - echo "Update and rebuild finished successfully" - else - echo "Update and rebuild Failed" >&2 - exit 1 - fi - ;; - update-host) - target_hostname="" - target_profile="" - - if [ "$#" -eq 3 ]; then # zcli update-host - target_hostname="$2" - target_profile="$3" - elif [ "$#" -eq 1 ]; then # zcli update-host (auto-detect) - echo "Attempting to auto-detect hostname and GPU profile..." - target_hostname=$(${pkgs.nettools}/bin/hostname) - target_profile=$(detect_gpu_profile) - - if [ -z "$target_profile" ]; then - echo "Error: Could not auto-detect a specific GPU profile. Please provide it manually." >&2 + echo "Error: Invalid number of arguments for 'update-host'." >&2 echo "Usage: zcli update-host [hostname] [profile]" >&2 exit 1 fi - echo "Auto-detected Hostname: $target_hostname" - echo "Auto-detected Profile: $target_profile" - else - echo "Error: Invalid number of arguments for 'update-host'." >&2 - echo "Usage: zcli update-host [hostname] [profile]" >&2 - exit 1 - fi - echo "Updating $FLAKE_NIX_PATH..." + echo "Updating $FLAKE_NIX_PATH..." - # Update host - if ${pkgs.gnused}/bin/sed -i "s/^[[:space:]]*host[[:space:]]*=[[:space:]]*\".*\"/ host = \"$target_hostname\"/" "$FLAKE_NIX_PATH"; then - echo "Successfully updated host to: $target_hostname" - else - echo "Error: Failed to update host in $FLAKE_NIX_PATH" >&2 - exit 1 - fi - - # Update profile - if ${pkgs.gnused}/bin/sed -i "s/^[[:space:]]*profile[[:space:]]*=[[:space:]]*\".*\"/ profile = \"$target_profile\"/" "$FLAKE_NIX_PATH"; then - echo "Successfully updated profile to: $target_profile" - else - echo "Error: Failed to update profile in $FLAKE_NIX_PATH" >&2 - exit 1 - fi - - echo "Flake.nix updated successfully!" - ;; - add-host) - hostname="" - profile_arg="" - - if [ "$#" -ge 2 ]; then - hostname="$2" - fi - if [ "$#" -eq 3 ]; then - profile_arg="$3" - fi - - if [ -z "$hostname" ]; then - read -p "Enter the new hostname: " hostname - fi - - if [ -d "$HOME/$PROJECT/hosts/$hostname" ]; then - echo "Error: Host '$hostname' already exists." >&2 - exit 1 - fi - - echo "Copying default host configuration..." - ${pkgs.coreutils}/bin/cp -r "$HOME/$PROJECT/hosts/default" "$HOME/$PROJECT/hosts/$hostname" - - detected_profile="" - if [[ -n "$profile_arg" && "$profile_arg" =~ ^(intel|amd|nvidia|nvidia-laptop|amd-hybrid|vm)$ ]]; then - detected_profile="$profile_arg" - else - echo "Detecting GPU profile..." - detected_profile=$(detect_gpu_profile) - echo "Detected GPU profile: $detected_profile" - read -p "Is this correct? (y/n) " -n 1 -r - echo - if [[ $REPLY =~ ^[Nn]$ ]]; then - read -p "Enter the correct profile (intel, amd, nvidia, nvidia-laptop, amd-hybrid, vm): " new_profile - while [[ ! "$new_profile" =~ ^(intel|amd|nvidia|nvidia-laptop|amd-hybrid|vm)$ ]]; do - echo "Invalid profile. Please enter one of the following: intel, amd, nvidia, nvidia-laptop, amd-hybrid, vm" - read -p "Enter the correct profile: " new_profile - done - detected_profile=$new_profile - fi - fi - - echo "Setting profile to '$detected_profile'..." - ${pkgs.gnused}/bin/sed -i "s/profile = .*/profile = \"$detected_profile\";/" "$HOME/$PROJECT/hosts/$hostname/default.nix" - - read -p "Generate new hardware.nix? (y/n) " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo "Generating hardware.nix..." - sudo nixos-generate-config --show-hardware-config > "$HOME/$PROJECT/hosts/$hostname/hardware.nix" - echo "hardware.nix generated." - fi - - echo "Adding new host to git..." - ${pkgs.git}/bin/git -C "$HOME/$PROJECT" add . - echo "hostname: $hostname added" - ;; - del-host) - hostname="" - if [ "$#" -eq 2 ]; then - hostname="$2" - else - read -p "Enter the hostname to delete: " hostname - fi - - if [ ! -d "$HOME/$PROJECT/hosts/$hostname" ]; then - echo "Error: Host '$hostname' does not exist." >&2 - exit 1 - fi - - read -p "Are you sure you want to delete the host '$hostname'? (y/N) " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo "Deleting host '$hostname'..." - ${pkgs.coreutils}/bin/rm -rf "$HOME/$PROJECT/hosts/$hostname" - ${pkgs.git}/bin/git -C "$HOME/$PROJECT" add . - echo "hostname: $hostname removed" - else - echo "Deletion cancelled." - fi - ;; - doom) - if [ "$#" -lt 2 ]; then - echo "Error: doom command requires a subcommand." >&2 - echo "Usage: zcli doom [install|status|remove|update]" >&2 - exit 1 - fi - - # Ensure we're acting on a valid host and we can locate variables.nix - verify_hostname - current_hostname="$(hostname)" - host_vars_file="$HOME/$PROJECT/hosts/$current_hostname/variables.nix" - - if [ ! -f "$host_vars_file" ]; then - echo "Error: Host variables file not found: $host_vars_file" >&2 - echo "Please ensure your host folder exists and contains variables.nix." >&2 - exit 1 - fi - - is_doom_enabled() { - # Return 0 if doomEmacsEnable = true; appears (ignoring leading spaces) - ${pkgs.gnugrep}/bin/grep -Eq '^[[:space:]]*doomEmacsEnable[[:space:]]*=[[:space:]]*true[[:space:]]*;' "$host_vars_file" - } - - ensure_doom_enabled() { - # If the variable is present but false, flip it; if missing, append it - if ${pkgs.gnugrep}/bin/grep -Eq '^[[:space:]]*doomEmacsEnable[[:space:]]*=' "$host_vars_file"; then - ${pkgs.gnused}/bin/sed -i 's/^[[:space:]]*doomEmacsEnable[[:space:]]*=.*/ doomEmacsEnable = true;/' "$host_vars_file" + # Update host + if ${pkgs.gnused}/bin/sed -i "s/^[[:space:]]*host[[:space:]]*=[[:space:]]*\".*\"/ host = \"$target_hostname\"/" "$FLAKE_NIX_PATH"; then + echo "Successfully updated host to: $target_hostname" else - echo "" >> "$host_vars_file" - echo " # Enabled by zcli doom on $(date)" >> "$host_vars_file" - echo " doomEmacsEnable = true;" >> "$host_vars_file" + echo "Error: Failed to update host in $FLAKE_NIX_PATH" >&2 + exit 1 fi - } - doom_subcommand="$2" - case "$doom_subcommand" in - install) - if ! is_doom_enabled; then - echo "✗ Doom Emacs is disabled for host '$current_hostname' (doomEmacsEnable = false)." >&2 - echo "To enable, set doomEmacsEnable = true; in:" >&2 - echo " $host_vars_file" >&2 - echo "and rebuild your system before installing Doom." >&2 - echo - read -p "Enable Doom for this host now and rebuild? (y/N) " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo "Enabling Doom Emacs in $host_vars_file..." - ensure_doom_enabled - echo "Rebuilding system so user modules are applied..." - if ${pkgs.nh}/bin/nh os switch --hostname "$PROFILE"; then - echo "Rebuild complete. Proceeding with Doom installation." - else - echo "Error: Rebuild failed. Please fix the build and re-run 'zcli doom install'." >&2 - exit 1 - fi - else - echo "Aborting. Please enable doomEmacsEnable and rebuild before installing." >&2 - exit 1 - fi - fi - echo "Installing Doom Emacs..." - ${get-doom-script}/bin/get-doom - ;; - status) - if [ -x "$HOME/.emacs.d/bin/doom" ] && [ -f "$HOME/.emacs.d/core/doom.el" ]; then - echo "✔ Doom Emacs appears installed at $HOME/.emacs.d" - if [ -f "$HOME/.doom.d/init.el" ]; then - echo " • User config found: $HOME/.doom.d/init.el" - else - echo " • Warning: User config (~/.doom.d) not found" - fi - echo "Version information:" - "$HOME/.emacs.d/bin/doom" version 2>/dev/null || echo "Could not get version information" - else - if [ -d "$HOME/.emacs.d" ]; then - if [ -z "$(ls -A "$HOME/.emacs.d" 2>/dev/null)" ]; then - echo "✗ Found empty ~/.emacs.d (not a valid Doom installation)" - else - echo "✗ ~/.emacs.d exists but Doom was not detected" - fi - else - echo "✗ Doom Emacs is not installed" - fi - echo "Run 'zcli doom install' to install it" - fi - ;; - remove) - if [ ! -d "$HOME/.emacs.d" ]; then - echo "Doom Emacs is not installed" - exit 0 - fi + # Update profile + if ${pkgs.gnused}/bin/sed -i "s/^[[:space:]]*profile[[:space:]]*=[[:space:]]*\".*\"/ profile = \"$target_profile\"/" "$FLAKE_NIX_PATH"; then + echo "Successfully updated profile to: $target_profile" + else + echo "Error: Failed to update profile in $FLAKE_NIX_PATH" >&2 + exit 1 + fi - echo "Warning: This will completely remove Doom Emacs and all your configuration!" - read -p "Are you sure you want to continue? (y/N) " -n 1 -r + echo "Flake.nix updated successfully!" + ;; + add-host) + hostname="" + profile_arg="" + + if [ "$#" -ge 2 ]; then + hostname="$2" + fi + if [ "$#" -eq 3 ]; then + profile_arg="$3" + fi + + if [ -z "$hostname" ]; then + read -p "Enter the new hostname: " hostname + fi + + if [ -d "$HOME/$PROJECT/hosts/$hostname" ]; then + echo "Error: Host '$hostname' already exists." >&2 + exit 1 + fi + + echo "Copying default host configuration..." + ${pkgs.coreutils}/bin/cp -r "$HOME/$PROJECT/hosts/default" "$HOME/$PROJECT/hosts/$hostname" + + detected_profile="" + if [[ -n "$profile_arg" && "$profile_arg" =~ ^(intel|amd|nvidia|nvidia-laptop|amd-hybrid|vm)$ ]]; then + detected_profile="$profile_arg" + else + echo "Detecting GPU profile..." + detected_profile=$(detect_gpu_profile) + echo "Detected GPU profile: $detected_profile" + read -p "Is this correct? (y/n) " -n 1 -r echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo "Removing Doom Emacs..." - ${pkgs.coreutils}/bin/rm -rf "$HOME/.emacs.d" - echo "✔ Doom Emacs has been removed" - else - echo "Removal cancelled" - fi - ;; - update) - if [ ! -x "$HOME/.emacs.d/bin/doom" ] || [ ! -f "$HOME/.emacs.d/core/doom.el" ]; then - echo "Error: Doom Emacs is not installed correctly. Run 'zcli doom install' first." >&2 - exit 1 + if [[ $REPLY =~ ^[Nn]$ ]]; then + read -p "Enter the correct profile (intel, amd, nvidia, nvidia-laptop, amd-hybrid, vm): " new_profile + while [[ ! "$new_profile" =~ ^(intel|amd|nvidia|nvidia-laptop|amd-hybrid|vm)$ ]]; do + echo "Invalid profile. Please enter one of the following: intel, amd, nvidia, nvidia-laptop, amd-hybrid, vm" + read -p "Enter the correct profile: " new_profile + done + detected_profile=$new_profile fi + fi - echo "Updating Doom Emacs..." - "$HOME/.emacs.d/bin/doom" sync - echo "✔ Doom Emacs update complete" - ;; - *) - echo "Error: Invalid doom subcommand '$doom_subcommand'" >&2 + echo "Setting profile to '$detected_profile'..." + ${pkgs.gnused}/bin/sed -i "s/profile = .*/profile = \"$detected_profile\";/" "$HOME/$PROJECT/hosts/$hostname/default.nix" + + read -p "Generate new hardware.nix? (y/n) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Generating hardware.nix..." + sudo nixos-generate-config --show-hardware-config > "$HOME/$PROJECT/hosts/$hostname/hardware.nix" + echo "hardware.nix generated." + fi + + echo "Adding new host to git..." + ${pkgs.git}/bin/git -C "$HOME/$PROJECT" add . + echo "hostname: $hostname added" + ;; + del-host) + hostname="" + if [ "$#" -eq 2 ]; then + hostname="$2" + else + read -p "Enter the hostname to delete: " hostname + fi + + if [ ! -d "$HOME/$PROJECT/hosts/$hostname" ]; then + echo "Error: Host '$hostname' does not exist." >&2 + exit 1 + fi + + read -p "Are you sure you want to delete the host '$hostname'? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Deleting host '$hostname'..." + ${pkgs.coreutils}/bin/rm -rf "$HOME/$PROJECT/hosts/$hostname" + ${pkgs.git}/bin/git -C "$HOME/$PROJECT" add . + echo "hostname: $hostname removed" + else + echo "Deletion cancelled." + fi + ;; + doom) + if [ "$#" -lt 2 ]; then + echo "Error: doom command requires a subcommand." >&2 echo "Usage: zcli doom [install|status|remove|update]" >&2 exit 1 - ;; - esac - ;; - *) - echo "Error: Invalid command '$1'" >&2 - print_help - exit 1 - ;; - esac -'' + fi + + # Ensure we're acting on a valid host and we can locate variables.nix + verify_hostname + current_hostname="$(hostname)" + host_vars_file="$HOME/$PROJECT/hosts/$current_hostname/variables.nix" + + if [ ! -f "$host_vars_file" ]; then + echo "Error: Host variables file not found: $host_vars_file" >&2 + echo "Please ensure your host folder exists and contains variables.nix." >&2 + exit 1 + fi + + is_doom_enabled() { + # Return 0 if doomEmacsEnable = true; appears (ignoring leading spaces) + ${pkgs.gnugrep}/bin/grep -Eq '^[[:space:]]*doomEmacsEnable[[:space:]]*=[[:space:]]*true[[:space:]]*;' "$host_vars_file" + } + + ensure_doom_enabled() { + # If the variable is present but false, flip it; if missing, append it + if ${pkgs.gnugrep}/bin/grep -Eq '^[[:space:]]*doomEmacsEnable[[:space:]]*=' "$host_vars_file"; then + ${pkgs.gnused}/bin/sed -i 's/^[[:space:]]*doomEmacsEnable[[:space:]]*=.*/ doomEmacsEnable = true;/' "$host_vars_file" + else + echo "" >> "$host_vars_file" + echo " # Enabled by zcli doom on $(date)" >> "$host_vars_file" + echo " doomEmacsEnable = true;" >> "$host_vars_file" + fi + } + + doom_subcommand="$2" + case "$doom_subcommand" in + install) + if ! is_doom_enabled; then + echo "✗ Doom Emacs is disabled for host '$current_hostname' (doomEmacsEnable = false)." >&2 + echo "To enable, set doomEmacsEnable = true; in:" >&2 + echo " $host_vars_file" >&2 + echo "and rebuild your system before installing Doom." >&2 + echo + read -p "Enable Doom for this host now and rebuild? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Enabling Doom Emacs in $host_vars_file..." + ensure_doom_enabled + echo "Rebuilding system so user modules are applied..." + if ${pkgs.nh}/bin/nh os switch --diff always --hostname "$PROFILE"; then + echo "Rebuild complete. Proceeding with Doom installation." + else + echo "Error: Rebuild failed. Please fix the build and re-run 'zcli doom install'." >&2 + exit 1 + fi + else + echo "Aborting. Please enable doomEmacsEnable and rebuild before installing." >&2 + exit 1 + fi + fi + echo "Installing Doom Emacs..." + ${get-doom-script}/bin/get-doom + ;; + status) + if [ -x "$HOME/.emacs.d/bin/doom" ] && [ -f "$HOME/.emacs.d/core/doom.el" ]; then + echo "✔ Doom Emacs appears installed at $HOME/.emacs.d" + if [ -f "$HOME/.doom.d/init.el" ]; then + echo " • User config found: $HOME/.doom.d/init.el" + else + echo " • Warning: User config (~/.doom.d) not found" + fi + echo "Version information:" + "$HOME/.emacs.d/bin/doom" version 2>/dev/null || echo "Could not get version information" + else + if [ -d "$HOME/.emacs.d" ]; then + if [ -z "$(ls -A "$HOME/.emacs.d" 2>/dev/null)" ]; then + echo "✗ Found empty ~/.emacs.d (not a valid Doom installation)" + else + echo "✗ ~/.emacs.d exists but Doom was not detected" + fi + else + echo "✗ Doom Emacs is not installed" + fi + echo "Run 'zcli doom install' to install it" + fi + ;; + remove) + if [ ! -d "$HOME/.emacs.d" ]; then + echo "Doom Emacs is not installed" + exit 0 + fi + + echo "Warning: This will completely remove Doom Emacs and all your configuration!" + read -p "Are you sure you want to continue? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Removing Doom Emacs..." + ${pkgs.coreutils}/bin/rm -rf "$HOME/.emacs.d" + echo "✔ Doom Emacs has been removed" + else + echo "Removal cancelled" + fi + ;; + update) + if [ ! -x "$HOME/.emacs.d/bin/doom" ] || [ ! -f "$HOME/.emacs.d/core/doom.el" ]; then + echo "Error: Doom Emacs is not installed correctly. Run 'zcli doom install' first." >&2 + exit 1 + fi + + echo "Updating Doom Emacs..." + "$HOME/.emacs.d/bin/doom" sync + echo "✔ Doom Emacs update complete" + ;; + *) + echo "Error: Invalid doom subcommand '$doom_subcommand'" >&2 + echo "Usage: zcli doom [install|status|remove|update]" >&2 + exit 1 + ;; + esac + ;; + *) + echo "Error: Invalid command '$1'" >&2 + print_help + exit 1 + ;; + esac + '' diff --git a/modules/home/starship-ddubs-1.nix b/modules/home/starship-ddubs-1.nix index 2faa8b0..6bc0434 100644 --- a/modules/home/starship-ddubs-1.nix +++ b/modules/home/starship-ddubs-1.nix @@ -1,13 +1,12 @@ # starship is a minimal, fast, and extremely customizable prompt for any shell! -{ config -, lib -, ... -}: -let +{ + config, + lib, + ... +}: let accent = "#${config.lib.stylix.colors.base0D}"; background-alt = "#${config.lib.stylix.colors.base01}"; -in -{ +in { programs.starship = { enable = false; settings = { @@ -22,7 +21,7 @@ in "\n" "$character" ]; - directory = { style = accent; }; + directory = {style = accent;}; character = { success_symbol = "[❯](${accent})"; diff --git a/modules/home/starship.nix b/modules/home/starship.nix index 51090b9..05e7772 100644 --- a/modules/home/starship.nix +++ b/modules/home/starship.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.starship = { enable = false; package = pkgs.starship; diff --git a/modules/home/stylix.nix b/modules/home/stylix.nix index 4448304..1624de0 100644 --- a/modules/home/stylix.nix +++ b/modules/home/stylix.nix @@ -1,5 +1,7 @@ _: { stylix.targets = { + # Avoid fetching GNOME Shell sources on non-GNOME systems (breaks on some remotes) + gnome.enable = false; waybar.enable = false; rofi.enable = false; hyprland.enable = false; diff --git a/modules/home/swappy.nix b/modules/home/swappy.nix index b3b62a3..0029798 100644 --- a/modules/home/swappy.nix +++ b/modules/home/swappy.nix @@ -1,4 +1,4 @@ -{ username, ... }: { +{username, ...}: { home.file = { ".config/swappy/config".text = '' [Default] diff --git a/modules/home/swaync.nix b/modules/home/swaync.nix index 2662402..a29959b 100644 --- a/modules/home/swaync.nix +++ b/modules/home/swaync.nix @@ -1,4 +1,6 @@ -{ config, ... }: { +{config, ...}: { + home.file."${config.xdg.configHome}/swaync/images/catppuccin-macchiato.png".source = + ./swaync/images/catppuccin-macchiato.png; services.swaync = { enable = true; settings = { diff --git a/modules/home/swaync/images/catppuccin-macchiato.png b/modules/home/swaync/images/catppuccin-macchiato.png new file mode 100644 index 0000000..ddb8cd6 Binary files /dev/null and b/modules/home/swaync/images/catppuccin-macchiato.png differ diff --git a/modules/home/tealdeer.nix b/modules/home/tealdeer.nix index 1b2c859..a8e6c94 100644 --- a/modules/home/tealdeer.nix +++ b/modules/home/tealdeer.nix @@ -1,4 +1,4 @@ -{ ... }: { +{...}: { programs.tealdeer = { enable = true; settings = { diff --git a/modules/home/terminals/ghostty-themes/catppuccin-mocha b/modules/home/terminals/ghostty-themes/catppuccin-mocha new file mode 100644 index 0000000..f6ff7d1 --- /dev/null +++ b/modules/home/terminals/ghostty-themes/catppuccin-mocha @@ -0,0 +1,22 @@ +palette = 0=#45475a +palette = 1=#f38ba8 +palette = 2=#a6e3a1 +palette = 3=#f9e2af +palette = 4=#89b4fa +palette = 5=#f5c2e7 +palette = 6=#94e2d5 +palette = 7=#a6adc8 +palette = 8=#585b70 +palette = 9=#f37799 +palette = 10=#89d88b +palette = 11=#ebd391 +palette = 12=#74a8fc +palette = 13=#f2aede +palette = 14=#6bd7ca +palette = 15=#bac2de +background = #1e1e2e +foreground = #cdd6f4 +cursor-color = #f5e0dc +cursor-text = #cdd6f4 +selection-background = #585b70 +selection-foreground = #cdd6f4 diff --git a/modules/home/terminals/ghostty.nix b/modules/home/terminals/ghostty.nix index be09725..a46a587 100644 --- a/modules/home/terminals/ghostty.nix +++ b/modules/home/terminals/ghostty.nix @@ -1,100 +1,222 @@ -{ pkgs, ... }: -let - # A recent issue 7/7/2025 w/ghostty causes it to hang or respond slowly - # This is a workaround until a fix is released - myGhostty = pkgs.ghostty.overrideAttrs (_: { - preBuild = '' - shopt -s globstar - sed -i 's/^const xev = @import("xev");$/const xev = @import("xev").Epoll;/' **/*.zig - shopt -u globstar - ''; - }); -in { + pkgs, + config, + ... +}: let + ghostHome = "${config.xdg.configHome}/ghostty"; + shaderFile = "${ghostHome}/shaders/shader.glsl"; +in { + # Install Ghostty theme(s) so referenced names resolve even if the package's share/themes doesn't include them + home.file = { + "${ghostHome}/themes/catppuccin-mocha".source = ./ghostty-themes/catppuccin-mocha; + + # Optional: dedicated background overlay config for reference (CLI overrides are used at runtime) + "${ghostHome}/ghostty-bg.conf".text = '' + # Overlay for background image; the wrapper passes these via CLI as well + # Keep the main config untouched; this file documents the desired values. + background-image=${config.home.homeDirectory}/Pictures/current_image_ghostty + background-image-opacity=0.9 + background-image-position=center + background-image-fit=cover + background-image-repeat=false + ''; + + "${shaderFile}".source = pkgs.fetchurl { + # enabling custom-shader-animation = always, as cursors + # can get stuck on losing focus and look terrible. this + # will only animate for half a second, if you change to + # a whole-terminal crazily animated thing then probably + # disable that option + url = "https://github.com/sahaj-b/ghostty-cursor-shaders/raw/88c27a55b2e970eec19c21ef858a1a5bea489a1d/cursor_warp.glsl"; + sha256 = "sha256-9ZlLcNu5cH0Ibc7qrS+lfrY4neesQm/5FdTCNa85G+s="; + }; + }; + programs.ghostty = { enable = true; - package = myGhostty; # to fix a but in current builds of ghostty - #package = pkgs.ghostty; + package = pkgs.ghostty; + enableFishIntegration = true; + enableZshIntegration = true; + enableBashIntegration = true; + clearDefaultKeybinds = true; + settings = { + custom-shader = shaderFile; + custom-shader-animation = "always"; + term = "xterm-256color"; + confirm-close-surface = "false"; + font-family = "Maple Mono NF"; + font-size = 12; + theme = "dark:catppuccin-mocha,light:catppuccin-mocha"; + adjust-cell-height = "10%"; + window-theme = "dark"; + window-height = "32"; + window-width = "110"; + background-opacity = "1.00"; + background-blur-radius = "60"; + selection-background = "#2d3f76"; + selection-foreground = "#c8d3f5"; + cursor-style = "bar"; + mouse-hide-while-typing = "true"; + wait-after-command = "false"; + shell-integration = "detect"; + window-save-state = "always"; + gtk-single-instance = "true"; + unfocused-split-opacity = "0.5"; + quick-terminal-position = "center"; + shell-integration-features = "cursor,sudo"; + bold-is-bright = "false"; + focus-follows-mouse = "true"; + # never show the size popups + resize-overlay = "never"; + keybind = [ + # Copy/Paste + "ctrl+shift+c=copy_to_clipboard" + "ctrl+shift+v=paste_from_clipboard" + + # Font size control + "ctrl+shift+plus=increase_font_size:1" + "ctrl+shift+minus=decrease_font_size:1" + "ctrl+shift+zero=reset_font_size" + + "alt+s>r=reload_config" + "alt+s>x=close_surface" + + "alt+s>n=new_window" + + # tabs + "alt+s>c=new_tab" + "alt+s>shift+l=next_tab" + "alt+s>shift+h=previous_tab" + "alt+s>comma=move_tab:-1" + "alt+s>period=move_tab:1" + + # quick tab switch + "alt+s>1=goto_tab:1" + "alt+s>2=goto_tab:2" + "alt+s>3=goto_tab:3" + "alt+s>4=goto_tab:4" + "alt+s>5=goto_tab:5" + "alt+s>6=goto_tab:6" + "alt+s>7=goto_tab:7" + "alt+s>8=goto_tab:8" + "alt+s>9=goto_tab:9" + + # split + "alt+s>\\=new_split:right" + "alt+s>-=new_split:down" + + "alt+s>j=goto_split:bottom" + "alt+s>k=goto_split:top" + "alt+s>h=goto_split:left" + "alt+s>l=goto_split:right" + + "alt+s>z=toggle_split_zoom" + + "alt+s>e=equalize_splits" + ]; + }; }; - home.file."./.config/ghostty/config".text = '' - #theme = Aura - theme = Dracula - #theme = Aardvark Blue - #theme = GruvboxDarkHard - adjust-cell-height = 10% - window-theme = dark - window-height = 32 - window-width = 110 - background-opacity = 0.95 - background-blur-radius = 60 - selection-background = #2d3f76 - selection-foreground = #c8d3f5 - cursor-style = bar - mouse-hide-while-typing = true - - # keybindings - # Copy/Paste - keybind = ctrl+shift+c=copy_to_clipboard - keybind = ctrl+shift+v=paste_from_clipboard - - keybind = alt+s>r=reload_config - keybind = alt+s>x=close_surface - - keybind = alt+s>n=new_window - - # tabs - keybind = alt+s>c=new_tab - keybind = alt+s>shift+l=next_tab - keybind = alt+s>shift+h=previous_tab - keybind = alt+s>comma=move_tab:-1 - keybind = alt+s>period=move_tab:1 - - # quick tab switch - keybind = alt+s>1=goto_tab:1 - keybind = alt+s>2=goto_tab:2 - keybind = alt+s>3=goto_tab:3 - keybind = alt+s>4=goto_tab:4 - keybind = alt+s>5=goto_tab:5 - keybind = alt+s>6=goto_tab:6 - keybind = alt+s>7=goto_tab:7 - keybind = alt+s>8=goto_tab:8 - keybind = alt+s>9=goto_tab:9 - - # split - keybind = alt+s>\=new_split:right - keybind = alt+s>-=new_split:down - - keybind = alt+s>j=goto_split:bottom - keybind = alt+s>k=goto_split:top - keybind = alt+s>h=goto_split:left - keybind = alt+s>l=goto_split:right - - keybind = alt+s>z=toggle_split_zoom - - keybind = alt+s>e=equalize_splits - - # other - #copy-on-select = clipboard - - font-size = 12 - #font-family = JetBrainsMono Nerd Font Mono - #font-family-bold = JetBrainsMono NFM Bold - #font-family-bold-italic = JetBrainsMono NFM Bold Italic - #font-family-italic = JetBrainsMono NFM Italic - - font-family = BerkeleyMono Nerd Font - #font-family = Iosevka Nerd Font - # font-family = SFMono Nerd Font - - title = "GhosTTY" - - wait-after-command = false - shell-integration = detect - window-save-state = always - gtk-single-instance = true - unfocused-split-opacity = 0.5 - quick-terminal-position = center - shell-integration-features = cursor,sudo + # Desktop entry for ghostty-bg + home.file."${config.xdg.dataHome}/applications/ghostty-bg.desktop".text = '' + [Desktop Entry] + Version=1.0 + Type=Application + Name=Ghostty with Background + Comment=Terminal emulator with random background image + Exec=ghostty-bg --foreground + Icon=utilities-terminal + Terminal=false + Categories=System;TerminalEmulator;Utility; + Keywords=terminal;shell;prompt; ''; + + # Wrapper script to launch Ghostty with background image from a randomized symlink + home.packages = [ + (pkgs.writeShellScriptBin "ghostty-bg" '' + #!/usr/bin/env bash + set -euo pipefail + + # Defaults + SOURCE_DIR="$HOME/Pictures/Wallpapers" + LINK_PATH="$HOME/Pictures/current_image_ghostty" + LAUNCH=1 + FOREGROUND=0 + + # Parse options (stop at first positional or --) + while [[ $# -gt 0 ]]; do + case "$1" in + -s|--source) + [[ $# -ge 2 ]] || { echo "Missing value for $1" >&2; exit 2; } + SOURCE_DIR="$2"; shift 2;; + -l|--link) + [[ $# -ge 2 ]] || { echo "Missing value for $1" >&2; exit 2; } + LINK_PATH="$2"; shift 2;; + --no-launch) + LAUNCH=0; shift;; + --foreground) + FOREGROUND=1; shift;; + -h|--help) + cat <<'EOF' + Usage: ghostty-bg [options] [--] [ghostty_args...] + + Defaults: Launches ghostty in the background with background-image linked at ~/Pictures/current_image_ghostty + + Options: + -s, --source DIR Source directory of images (default: ~/Pictures/Wallpapers) + -l, --link PATH Symlink path (default: ~/Pictures/current_image_ghostty) + --no-launch Only update symlink; do not launch ghostty + --foreground Run ghostty in the foreground (default is background) + -h, --help Show this help + EOF + exit 0;; + --) + shift; break;; + -*) + echo "Unknown option: $1" >&2; exit 2;; + *) + break;; + esac + done + + # Validate and choose random image + if [[ ! -d "$SOURCE_DIR" ]]; then + echo "Source directory not found: $SOURCE_DIR" >&2 + exit 1 + fi + + CHOSEN="$(${pkgs.findutils}/bin/find -L "$SOURCE_DIR" -type f \ + \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.bmp' -o -iname '*.gif' \) \ + -print0 | ${pkgs.coreutils}/bin/shuf -z -n 1 | ${pkgs.coreutils}/bin/tr -d '\0')" + if [[ -z "$CHOSEN" ]]; then + echo "No images found in: $SOURCE_DIR" >&2 + exit 1 + fi + + # Update symlink + mkdir -p "$(dirname "$LINK_PATH")" + ln -sfn "$CHOSEN" "$LINK_PATH" + + # Launch ghostty with CLI overrides for background image + if (( LAUNCH )); then + if (( FOREGROUND )); then + exec ghostty \ + --background-image="$LINK_PATH" \ + --background-image-opacity=0.9 \ + --background-image-position=center \ + --background-image-fit=cover \ + --background-image-repeat=false \ + "$@" + else + setsid -f ghostty \ + --background-image="$LINK_PATH" \ + --background-image-opacity=0.9 \ + --background-image-position=center \ + --background-image-fit=cover \ + --background-image-repeat=false \ + "$@" >/dev/null 2>&1 < /dev/null & + fi + fi + '') + ]; } diff --git a/modules/home/terminals/kitty.nix b/modules/home/terminals/kitty.nix index 69a4490..72304e6 100644 --- a/modules/home/terminals/kitty.nix +++ b/modules/home/terminals/kitty.nix @@ -1,8 +1,16 @@ -{ pkgs, ... }: { +{ + pkgs, + config, + lib, + ... +}: { programs.kitty = { enable = true; + + # Upstream test failures resolved; use default kitty package (>= 0.44). package = pkgs.kitty; settings = { + font_family = "Maple Mono NF"; font_size = 12; wheel_scroll_min_lines = 1; window_padding_width = 4; @@ -19,57 +27,256 @@ tab_bar_style = "powerline"; #tab_bar_style = "fade"; enabled_layouts = "splits"; + open_url_with_default = true; + detect_urls = true; + allow_remote_control = true; }; + + shellIntegration.enableZshIntegration = true; + shellIntegration.enableFishIntegration = true; + shellIntegration.enableBashIntegration = true; + shellIntegration.mode = "enabled"; + extraConfig = '' - # Clipboard - map ctrl+shift+v paste_from_selection - map shift+insert paste_from_selection + #open_url_with default + url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty sftp ssh + #detect_urls yes - # Scrolling - map ctrl+shift+up scroll_line_up - map ctrl+shift+down scroll_line_down - map ctrl+shift+k scroll_line_up - map ctrl+shift+j scroll_line_down - map ctrl+shift+page_up scroll_page_up - map ctrl+shift+page_down scroll_page_down - map ctrl+shift+home scroll_home - map ctrl+shift+end scroll_end - map ctrl+shift+h show_scrollback + # Clipboard + map ctrl+shift+v paste_from_selection + map shift+insert paste_from_selection + + # Scrolling + map ctrl+shift+up scroll_line_up + map ctrl+shift+down scroll_line_down + map ctrl+shift+k scroll_line_up + map ctrl+shift+j scroll_line_down + map ctrl+shift+page_up scroll_page_up + map ctrl+shift+page_down scroll_page_down + map ctrl+shift+home scroll_home + map ctrl+shift+end scroll_end + map ctrl+shift+h show_scrollback + + # Window management + map alt+n new_window_with_cwd + #map alt+n new_os_window + map alt+w close_window + map ctrl+shift+enter launch --location=hsplit + map ctrl+shift+s launch --location=vsplit + map ctrl+shift+] next_window + map ctrl+shift+[ previous_window + map ctrl+shift+f move_window_forward + map ctrl+shift+b move_window_backward + map ctrl+shift+` move_window_to_top + map ctrl+shift+1 first_window + map ctrl+shift+2 second_window + map ctrl+shift+3 third_window + map ctrl+shift+4 fourth_window + map ctrl+shift+5 fifth_window + map ctrl+shift+6 sixth_window + map ctrl+shift+7 seventh_window + map ctrl+shift+8 eighth_window + map ctrl+shift+9 ninth_window # Tab management + map ctrl+shift+0 tenth_window + map ctrl+shift+right next_tab + map ctrl+shift+left previous_tab + map ctrl+shift+t new_tab + map ctrl+shift+q close_tab + map ctrl+shift+l next_layout + map ctrl+shift+. move_tab_forward + map ctrl+shift+, move_tab_backward + + # Miscellaneous + map ctrl+shift+up increase_font_size + map ctrl+shift+down decrease_font_size + map ctrl+shift+backspace restore_font_size + + #Manually set color scheme to catpuccin-mocha + #Disabled stylix support + + ## name: Catppuccin Kitty Mocha + ## author: Catppuccin Org + ## license: MIT + ## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf + ## blurb: Soothing pastel theme for the high-spirited! + + # The basic colors + foreground #cdd6f4 + background #1e1e2e + selection_foreground #1e1e2e + selection_background #f5e0dc + + # Cursor colors + cursor #f5e0dc + cursor_text_color #1e1e2e + + # URL underline color when hovering with mouse + url_color #f5e0dc + + # Kitty window border colors + active_border_color #b4befe + inactive_border_color #6c7086 + bell_border_color #f9e2af + + # OS Window titlebar colors + wayland_titlebar_color system + macos_titlebar_color system + + # Tab bar colors + active_tab_foreground #11111b + active_tab_background #cba6f7 + inactive_tab_foreground #cdd6f4 + inactive_tab_background #181825 + tab_bar_background #11111b + + # Colors for marks (marked text in the terminal) + mark1_foreground #1e1e2e + mark1_background #b4befe + mark2_foreground #1e1e2e + mark2_background #cba6f7 + mark3_foreground #1e1e2e + mark3_background #74c7ec + + # The 16 terminal colors + + # black + color0 #45475a + color8 #585b70 + + # red + color1 #f38ba8 + color9 #f38ba8 + + # green + color2 #a6e3a1 + color10 #a6e3a1 + + # yellow + color3 #f9e2af + color11 #f9e2af + + # blue + color4 #89b4fa + color12 #89b4fa + + # magenta + color5 #f5c2e7 + color13 #f5c2e7 + + # cyan + color6 #94e2d5 + color14 #94e2d5 + + # white + color7 #bac2de + color15 #a6adc8 - # Window management - map alt+n new_window_with_cwd #open in current dir - #map alt+n new_os_window #opens term in $HOME - map alt+w close_window - map ctrl+shift+enter launch --location=hsplit - map ctrl+shift+s launch --location=vsplit - map ctrl+shift+] next_window - map ctrl+shift+[ previous_window - map ctrl+shift+f move_window_forward - map ctrl+shift+b move_window_backward - map ctrl+shift+` move_window_to_top - map ctrl+shift+1 first_window - map ctrl+shift+2 second_window - map ctrl+shift+3 third_window - map ctrl+shift+4 fourth_window - map ctrl+shift+5 fifth_window - map ctrl+shift+6 sixth_window - map ctrl+shift+7 seventh_window - map ctrl+shift+8 eighth_window - map ctrl+shift+9 ninth_window # Tab management - map ctrl+shift+0 tenth_window - map ctrl+shift+right next_tab - map ctrl+shift+left previous_tab - map ctrl+shift+t new_tab - map ctrl+shift+q close_tab - map ctrl+shift+l next_layout - map ctrl+shift+. move_tab_forward - map ctrl+shift+, move_tab_backward - # Miscellaneous - map ctrl+shift+up increase_font_size - map ctrl+shift+down decrease_font_size - map ctrl+shift+backspace restore_font_size ''; }; + + # Dedicated kitty config that layers background image settings on top of the main config + # Keep standard kitty.conf as-is; kitty-bg.conf only adds/overrides background-related options. + home.file."${config.xdg.configHome}/kitty/kitty-bg.conf".text = lib.mkForce '' + include ./kitty.conf + # Background image managed by wrapper via symlink + background_image ${config.home.homeDirectory}/Pictures/current_image_kitty + background_image_layout scaled + background_tint 0.95 + background_opacity 1.0 + linux_display_server auto + ''; + + # Desktop entry for kitty-bg + home.file."${config.xdg.dataHome}/applications/kitty-bg.desktop".text = '' + [Desktop Entry] + Version=1.0 + Type=Application + Name=Kitty with Background + Comment=Terminal emulator with random background image + Exec=kitty-bg + Icon=utilities-terminal + Terminal=false + Categories=System;TerminalEmulator;Utility; + Keywords=terminal;shell;prompt; + ''; + + # Wrapper to select a random wallpaper, update the symlink, and launch kitty with kitty-bg.conf + home.packages = [ + (pkgs.writeShellScriptBin "kitty-bg" '' + #!/usr/bin/env bash + set -euo pipefail + + # Defaults + SOURCE_DIR="$HOME/Pictures/Wallpapers" + LINK_PATH="$HOME/Pictures/current_image" + CONFIG_FILE="$HOME/.config/kitty/kitty-bg.conf" + LAUNCH=1 + FOREGROUND=0 + + # Parse basic options (stop at first positional or --) + while [[ $# -gt 0 ]]; do + case "$1" in + -s|--source) + [[ $# -ge 2 ]] || { echo "Missing value for $1" >&2; exit 2; } + SOURCE_DIR="$2"; shift 2;; + -l|--link) + [[ $# -ge 2 ]] || { echo "Missing value for $1" >&2; exit 2; } + LINK_PATH="$2"; shift 2;; + --no-launch) + LAUNCH=0; shift;; + --foreground) + FOREGROUND=1; shift;; + -h|--help) + cat <<'EOF' + Usage: kitty-bg [options] [--] [kitty_args...] + + Defaults: Launches kitty in the background with ~/.config/kitty/kitty-bg.conf + + Options: + -s, --source DIR Source directory of images (default: ~/Pictures/Wallpapers) + -l, --link PATH Symlink path (default: ~/Pictures/current_image_kitty) + --no-launch Only update symlink; do not launch kitty + --foreground Run kitty in the foreground (default is background) + -h, --help Show this help + EOF + exit 0;; + --) + shift; break;; + -*) + echo "Unknown option: $1" >&2; exit 2;; + *) + break;; + esac + done + + # Validate source dir and choose a random image (no Bash arrays to avoid Nix string issues) + if [[ ! -d "$SOURCE_DIR" ]]; then + echo "Source directory not found: $SOURCE_DIR" >&2 + exit 1 + fi + + CHOSEN="$(${pkgs.findutils}/bin/find -L "$SOURCE_DIR" -type f \ + \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.bmp' -o -iname '*.gif' \) \ + -print0 | ${pkgs.coreutils}/bin/shuf -z -n 1 | ${pkgs.coreutils}/bin/tr -d '\0')" + if [[ -z "$CHOSEN" ]]; then + echo "No images found in: $SOURCE_DIR" >&2 + exit 1 + fi + + # Update symlink + mkdir -p "$(dirname "$LINK_PATH")" + ln -sfn "$CHOSEN" "$LINK_PATH" + + # Launch kitty using the dedicated config (background by default) + if (( LAUNCH )); then + if (( FOREGROUND )); then + exec kitty --config "$CONFIG_FILE" "$@" + else + setsid -f kitty --config "$CONFIG_FILE" "$@" >/dev/null 2>&1 < /dev/null & + fi + fi + '') + ]; } diff --git a/modules/home/terminals/wezterm.nix b/modules/home/terminals/wezterm.nix index d939ca0..ab274ff 100644 --- a/modules/home/terminals/wezterm.nix +++ b/modules/home/terminals/wezterm.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.wezterm = { enable = true; package = pkgs.wezterm; diff --git a/modules/home/virtmanager.nix b/modules/home/virtmanager.nix index 0a885e1..15065e6 100644 --- a/modules/home/virtmanager.nix +++ b/modules/home/virtmanager.nix @@ -1,10 +1,8 @@ -{ ... }: - -{ +{...}: { dconf.settings = { "org/virt-manager/virt-manager/connections" = { - autoconnect = [ "qemu:///system" ]; - uris = [ "qemu:///system" ]; + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; }; }; } diff --git a/modules/home/waybar/Jerry-waybar.nix b/modules/home/waybar/Jerry-waybar.nix index 07e242f..32bbdff 100644 --- a/modules/home/waybar/Jerry-waybar.nix +++ b/modules/home/waybar/Jerry-waybar.nix @@ -157,7 +157,7 @@ in }; "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/scripts/Weather.py b/modules/home/waybar/scripts/Weather.py new file mode 100644 index 0000000..1783fed --- /dev/null +++ b/modules/home/waybar/scripts/Weather.py @@ -0,0 +1,719 @@ +#!/usr/bin/env python3 +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ # +# Rewritten to use Open-Meteo APIs (worldwide, no API key) for robust weather data. +# Outputs Waybar-compatible JSON and a simple text cache. + +import json +import os +import sys +import time +import html +import subprocess +from typing import Any, Dict, List, Optional, Tuple +from datetime import datetime + +import requests + +# =============== Configuration =============== +# You can configure behavior via environment variables OR the constants below. +# Examples (zsh): +# # One-off run +# # WEATHER_UNITS can be "metric" or "imperial" +# WEATHER_UNITS=imperial WEATHER_PLACE="Concord, NH" python3 ~/.config/waybar/scripts/Weather.py +# +# # Persist in current shell session +# export WEATHER_UNITS=imperial +# export WEATHER_LAT=43.2229 +# export WEATHER_LON=-71.332 +# export WEATHER_PLACE="Concord, NH" +# export WEATHER_TOOLTIP_MARKUP=1 # 1 to enable Pango markup, 0 to disable +# export WEATHER_LOC_ICON="📍" # or "*" for ASCII-only +# +CACHE_DIR = os.path.expanduser("~/.cache") +API_CACHE_PATH = os.path.join(CACHE_DIR, "open_meteo_cache.json") +SIMPLE_TEXT_CACHE_PATH = os.path.join(CACHE_DIR, ".weather_cache") +CACHE_TTL_SECONDS = int(os.getenv("WEATHER_CACHE_TTL", "600")) # default 10 minutes + +# Units: metric or imperial (default imperial for ddubsos branch) +UNITS = os.getenv("WEATHER_UNITS", "imperial").strip().lower() # metric|imperial + +# Optional manual coordinates +ENV_LAT = os.getenv("WEATHER_LAT") +ENV_LON = os.getenv("WEATHER_LON") +# Optional manual place override for tooltip +ENV_PLACE = os.getenv("WEATHER_PLACE") +# Manual place name set inside this file. If set (non-empty), this takes top priority. +# Example: MANUAL_PLACE = "Concord, NH, US" +MANUAL_PLACE: Optional[str] = None + +# Location icon in tooltip (default to a standard emoji to avoid missing glyphs) +LOC_ICON = os.getenv("WEATHER_LOC_ICON", "📍") +# Enable/disable Pango markup in tooltip (1/0, true/false) +TOOLTIP_MARKUP = os.getenv("WEATHER_TOOLTIP_MARKUP", "1").lower() not in ("0", "false", "no") +# Optional debug logging to stderr (set WEATHER_DEBUG=1 to enable) +DEBUG = os.getenv("WEATHER_DEBUG", "0").lower() not in ("0", "false", "no") + +# HTTP settings +UA = ( + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 " + "(KHTML, like Gecko) Chrome/128.0 Safari/537.36" +) +TIMEOUT = 8 + +SESSION = requests.Session() +SESSION.headers.update({"User-Agent": UA}) + +# =============== Icon and status mapping =============== +# Icon style: 'emoji' (colorful), 'nerd' (mono glyphs), or 'gnome' (symbolic names, useful for other bars) +ICON_STYLE = os.getenv("WEATHER_ICON_STYLE", "emoji").strip().lower() # emoji|nerd|gnome + +# Nerd Font weather glyphs (mono) +WEATHER_ICONS_NERD = { + "sunnyDay": "󰖙", + "clearNight": "󰖔", + "cloudyFoggyDay": "", + "cloudyFoggyNight": "", + "rainyDay": "", + "rainyNight": "", + "snowyIcyDay": "", + "snowyIcyNight": "", + "severe": "", + "default": "", +} + +# Colored emoji set (renders with system emoji font, gives the "3D" look) +WEATHER_ICONS_EMOJI = { + "sunnyDay": "☀️", + "clearNight": "🌙", + "cloudyFoggyDay": "⛅️", + "cloudyFoggyNight": "☁️🌙", + "rainyDay": "🌦️", + "rainyNight": "🌧️", + "snowyIcyDay": "🌨️", + "snowyIcyNight": "❄️🌙", + "severe": "⛈️", + "default": "🌥️", +} + +# GNOME symbolic icon names (not used directly by Waybar, here for parity) +WEATHER_ICONS_GNOME = { + "sunnyDay": "Sun-symbolic", + "clearNight": "Moon-symbolic", + "cloudyFoggyDay": "CloudSun-symbolic", + "cloudyFoggyNight": "CloudyMoon-symbolic", + "rainyDay": "CloudRain-symbolic", + "rainyNight": "CloudRain-symbolic", + "snowyIcyDay": "CloudSnowfall-symbolic", + "snowyIcyNight": "CloudSnowfall-symbolic", + "severe": "CloudBolt-symbolic", + "default": "Cloud-symbolic", +} + +# Optional: allow disabling automatic fallback via env +DISABLE_EMOJI_FALLBACK = os.getenv("WEATHER_DISABLE_EMOJI_FALLBACK", "0").lower() in ("1", "true", "yes") + +# Basic detection of color emoji font availability via fontconfig (fc-list) +EMOJI_FONT_CANDIDATES = [ + "Noto Color Emoji", + "Noto Emoji", + "Apple Color Emoji", + "Segoe UI Emoji", + "Twitter Color Emoji", + "Twemoji", + "JoyPixels", +] + +def has_color_emoji_font() -> bool: + try: + # Quick check: list installed fonts; search for any candidate name + proc = subprocess.run( + ["fc-list"], + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + text=True, + timeout=1.5, + check=False, + ) + out = proc.stdout or "" + out_lower = out.lower() + for name in EMOJI_FONT_CANDIDATES: + if name.lower() in out_lower: + return True + except Exception: + # If detection fails, don't block emoji; assume not available to be safe on minimal setups + return False + return False + +# Determine the active icon style with fallback from emoji -> nerd when no color emoji fonts are present +if ICON_STYLE == "emoji" and not DISABLE_EMOJI_FALLBACK and not has_color_emoji_font(): + ACTIVE_ICON_STYLE = "nerd" +else: + ACTIVE_ICON_STYLE = ICON_STYLE + +# Choose active set +WEATHER_ICONS = ( + WEATHER_ICONS_EMOJI if ACTIVE_ICON_STYLE == "emoji" else WEATHER_ICONS_NERD if ACTIVE_ICON_STYLE == "nerd" else WEATHER_ICONS_GNOME +) + +WMO_STATUS = { + 0: "Clear sky", + 1: "Mainly clear", + 2: "Partly cloudy", + 3: "Overcast", + 45: "Fog", + 48: "Depositing rime fog", + 51: "Light drizzle", + 53: "Moderate drizzle", + 55: "Dense drizzle", + 56: "Freezing drizzle", + 57: "Freezing drizzle", + 61: "Light rain", + 63: "Moderate rain", + 65: "Heavy rain", + 66: "Freezing rain", + 67: "Freezing rain", + 71: "Slight snow", + 73: "Moderate snow", + 75: "Heavy snow", + 77: "Snow grains", + 80: "Rain showers", + 81: "Rain showers", + 82: "Violent rain showers", + 85: "Snow showers", + 86: "Heavy snow showers", + 95: "Thunderstorm", + 96: "Thunderstorm w/ hail", + 99: "Thunderstorm w/ hail", +} + + +def wmo_to_icon(code: int, is_day: int) -> str: + day = bool(is_day) + if code == 0: + return WEATHER_ICONS["sunnyDay" if day else "clearNight"] + if code in (1, 2, 3, 45, 48): + return WEATHER_ICONS["cloudyFoggyDay" if day else "cloudyFoggyNight"] + if code in (51, 53, 55, 61, 63, 65, 80, 81, 82): + return WEATHER_ICONS["rainyDay" if day else "rainyNight"] + if code in (56, 57, 66, 67, 71, 73, 75, 77, 85, 86): + return WEATHER_ICONS["snowyIcyDay" if day else "snowyIcyNight"] + if code in (95, 96, 99): + return WEATHER_ICONS["severe"] + return WEATHER_ICONS["default"] + + +def wmo_to_status(code: int) -> str: + return WMO_STATUS.get(code, "Unknown") + + +# =============== Utilities =============== + +def esc(s: Optional[str]) -> str: + return html.escape(s, quote=False) if s else "" + +def log_debug(msg: str) -> None: + if DEBUG: + print(msg, file=sys.stderr) + + +def temp_color(temp_val: Optional[float]) -> str: + """Choose a color for the temperature number based on value and unit set.""" + if not isinstance(temp_val, (int, float)): + return "#cdd6f4" # default text + # Work in Fahrenheit for thresholds if imperial, else Celsius + t = float(temp_val) + if UNITS == "metric": + if t <= -5: + return "#89dceb" # sky + if t <= 5: + return "#74c7ec" # sapphire + if t <= 15: + return "#a6e3a1" # green + if t <= 25: + return "#f9e2af" # yellow + if t <= 32: + return "#fab387" # peach + return "#f38ba8" # red + else: + if t <= 25: + return "#89dceb" + if t <= 41: + return "#74c7ec" + if t <= 60: + return "#a6e3a1" + if t <= 77: + return "#f9e2af" + if t <= 90: + return "#fab387" + return "#f38ba8" + +def ensure_cache_dir() -> None: + try: + os.makedirs(CACHE_DIR, exist_ok=True) + except Exception as e: + print(f"Error creating cache dir: {e}", file=sys.stderr) + + +def read_api_cache() -> Optional[Dict[str, Any]]: + try: + if not os.path.exists(API_CACHE_PATH): + return None + with open(API_CACHE_PATH, "r", encoding="utf-8") as f: + data = json.load(f) + if (time.time() - data.get("timestamp", 0)) <= CACHE_TTL_SECONDS: + return data + return None + except Exception as e: + print(f"Error reading cache: {e}", file=sys.stderr) + return None + + +def write_api_cache(payload: Dict[str, Any]) -> None: + try: + ensure_cache_dir() + payload["timestamp"] = time.time() + with open(API_CACHE_PATH, "w", encoding="utf-8") as f: + json.dump(payload, f) + except Exception as e: + print(f"Error writing API cache: {e}", file=sys.stderr) + + +def write_simple_text_cache(text: str) -> None: + try: + ensure_cache_dir() + with open(SIMPLE_TEXT_CACHE_PATH, "w", encoding="utf-8") as f: + f.write(text) + except Exception as e: + print(f"Error writing simple cache: {e}", file=sys.stderr) + + +def get_coords() -> Tuple[float, float]: + # 1) Explicit env + if ENV_LAT and ENV_LON: + try: + return float(ENV_LAT), float(ENV_LON) + except ValueError: + print("Invalid WEATHER_LAT/WEATHER_LON; falling back to IP geolocation", file=sys.stderr) + + # 2) Try cached coordinates from last successful forecast + try: + cached = read_api_cache() + if cached and isinstance(cached, dict): + fc = cached.get("forecast") or {} + lat = fc.get("latitude") + lon = fc.get("longitude") + if isinstance(lat, (int, float)) and isinstance(lon, (int, float)): + return float(lat), float(lon) + except Exception as e: + print(f"Reading cached coords failed: {e}", file=sys.stderr) + + # 3) IP-based geolocation with multiple providers (prefer ipwho.is, ipapi.co; ipinfo.io as fallback) + # ipwho.is + try: + resp = SESSION.get("https://ipwho.is/", timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + if data.get("success"): + lat = data.get("latitude") + lon = data.get("longitude") + if isinstance(lat, (int, float)) and isinstance(lon, (int, float)): + return float(lat), float(lon) + except Exception as e: + print(f"ipwho.is failed: {e}", file=sys.stderr) + + # ipapi.co + try: + resp = SESSION.get("https://ipapi.co/json", timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + lat = data.get("latitude") + lon = data.get("longitude") + if isinstance(lat, (int, float)) and isinstance(lon, (int, float)): + return float(lat), float(lon) + except Exception as e: + print(f"ipapi.co failed: {e}", file=sys.stderr) + + # ipinfo.io (fallback) + try: + resp = SESSION.get("https://ipinfo.io/json", timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + loc = data.get("loc") + if loc and "," in loc: + lat_s, lon_s = loc.split(",", 1) + return float(lat_s), float(lon_s) + except Exception as e: + print(f"ipinfo.io failed: {e}", file=sys.stderr) + + # 4) Last resort + print("IP geolocation failed: no providers succeeded", file=sys.stderr) + return 0.0, 0.0 + + +def units_params(units: str) -> Dict[str, str]: + if units == "imperial": + return { + "temperature_unit": "fahrenheit", + "wind_speed_unit": "mph", + "precipitation_unit": "inch", + } + # default metric + return { + "temperature_unit": "celsius", + "wind_speed_unit": "kmh", + "precipitation_unit": "mm", + } + + +def format_visibility(meters: Optional[float]) -> str: + if meters is None: + return "" + try: + if UNITS == "imperial": + miles = meters / 1609.344 + return f"{miles:.1f} mi" + else: + km = meters / 1000.0 + return f"{km:.1f} km" + except Exception: + return "" + + +# =============== API Fetching =============== + +def fetch_open_meteo(lat: float, lon: float) -> Dict[str, Any]: + base = "https://api.open-meteo.com/v1/forecast" + params = { + "latitude": lat, + "longitude": lon, + "current": "temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,wind_direction_10m,weather_code,visibility,precipitation,pressure_msl,is_day", + "hourly": "precipitation_probability,weather_code", + "daily": "temperature_2m_max,temperature_2m_min", + "timezone": "auto", + } + params.update(units_params(UNITS)) + resp = SESSION.get(base, params=params, timeout=TIMEOUT) + resp.raise_for_status() + return resp.json() + + +def fetch_aqi(lat: float, lon: float) -> Optional[Dict[str, Any]]: + try: + base = "https://air-quality-api.open-meteo.com/v1/air-quality" + params = { + "latitude": lat, + "longitude": lon, + "current": "european_aqi", + "timezone": "auto", + } + resp = SESSION.get(base, params=params, timeout=TIMEOUT) + resp.raise_for_status() + return resp.json() + except Exception as e: + print(f"AQI fetch failed: {e}", file=sys.stderr) + return None + + +def fetch_place(lat: float, lon: float) -> Optional[str]: + """Reverse geocode lat/lon to an approximate place. Tries Nominatim first, then Open-Meteo.""" + lang = os.getenv("WEATHER_LANG", "en") + + # 1) Nominatim (OpenStreetMap) + try: + base = "https://nominatim.openstreetmap.org/reverse" + params = { + "lat": lat, + "lon": lon, + "format": "jsonv2", + "accept-language": lang, + } + headers = {"User-Agent": UA + " Weather.py/1.0"} + resp = SESSION.get(base, params=params, headers=headers, timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + address = data.get("address", {}) + name = data.get("name") or address.get("city") or address.get("town") or address.get("village") or address.get("hamlet") + admin1 = address.get("state") + country = address.get("country") + parts = [part for part in [name, admin1, country] if part] + if parts: + return ", ".join(parts) + except Exception as e: + log_debug(f"Reverse geocoding (Nominatim) failed: {e}") + + # 2) Open-Meteo reverse (fallback) + try: + base = "https://geocoding-api.open-meteo.com/v1/reverse" + params = { + "latitude": lat, + "longitude": lon, + "language": lang, + "format": "json", + } + resp = SESSION.get(base, params=params, timeout=TIMEOUT) + resp.raise_for_status() + data = resp.json() + results = data.get("results") or [] + if results: + p = results[0] + name = p.get("name") + admin1 = p.get("admin1") + country = p.get("country") + parts = [part for part in [name, admin1, country] if part] + if parts: + return ", ".join(parts) + except Exception as e: + log_debug(f"Reverse geocoding (Open-Meteo) failed: {e}") + + return None + + +# =============== Build Output =============== + +def safe_get(dct: Dict[str, Any], *keys, default=None): + cur: Any = dct + for k in keys: + if isinstance(cur, dict): + if k not in cur: + return default + cur = cur[k] + elif isinstance(cur, list): + try: + cur = cur[k] # type: ignore[index] + except Exception: + return default + else: + return default + return cur + + +def build_hourly_precip(forecast: Dict[str, Any]) -> str: + try: + times: List[str] = safe_get(forecast, "hourly", "time", default=[]) or [] + probs: List[Optional[float]] = safe_get( + forecast, "hourly", "precipitation_probability", default=[] + ) or [] + cur_time: Optional[str] = safe_get(forecast, "current", "time") + idx = times.index(cur_time) if cur_time in times else 0 + window = probs[idx : idx + 6] + if not window: + return "" + parts = [f"{int(p)}%" if p is not None else "-" for p in window] + return " (next 6h) " + " ".join(parts) + except Exception: + return "" + + +def build_output(lat: float, lon: float, forecast: Dict[str, Any], aqi: Optional[Dict[str, Any]], place: Optional[str] = None) -> Tuple[Dict[str, Any], str]: + cur = forecast.get("current", {}) + cur_units = forecast.get("current_units", {}) + daily = forecast.get("daily", {}) + daily_units = forecast.get("daily_units", {}) + + temp_val = cur.get("temperature_2m") + temp_unit = cur_units.get("temperature_2m", "") + temp_str = f"{int(round(temp_val))}{temp_unit}" if isinstance(temp_val, (int, float)) else "N/A" + temp_col = temp_color(temp_val) + + feels_val = cur.get("apparent_temperature") + feels_unit = cur_units.get("apparent_temperature", "") + feels_str = f"Feels like {int(round(feels_val))}{feels_unit}" if isinstance(feels_val, (int, float)) else "" + + is_day = int(cur.get("is_day", 1) or 1) + code = int(cur.get("weather_code", -1) or -1) + + unavailable = False + + # Fallbacks: if current weather_code is missing/invalid + if code == -1: + try: + times: List[str] = safe_get(forecast, "hourly", "time", default=[]) or [] + codes: List[Optional[int]] = safe_get(forecast, "hourly", "weather_code", default=[]) or [] + cur_time: Optional[str] = safe_get(forecast, "current", "time") + + idx = 0 + if cur_time and times: + # Find nearest index by absolute time difference + try: + ct = datetime.fromisoformat(cur_time) + diffs = [] + for t in times: + try: + diffs.append(abs((datetime.fromisoformat(t) - ct).total_seconds())) + except Exception: + diffs.append(float("inf")) + idx = min(range(len(diffs)), key=lambda i: diffs[i]) if diffs else 0 + except Exception: + # If parsing fails, try exact match fallback + idx = times.index(cur_time) if cur_time in times else 0 + + # Prefer nearest code if valid, else first non-null code in window + hcode = None + if isinstance(codes, list) and codes: + if idx < len(codes) and isinstance(codes[idx], (int, float)): + hcode = int(codes[idx]) + else: + for c in codes: + if isinstance(c, (int, float)): + hcode = int(c) + break + if isinstance(hcode, int): + code = hcode + log_debug(f"Fallback hourly weather_code used: code={code} idx={idx} cur_time={cur_time}") + except Exception as e: + log_debug(f"Hourly code fallback failed: {e}") + + # Final fallback: no valid code at all + if not isinstance(code, int) or code < 0: + unavailable = True + log_debug("Weather code invalid; setting status to 'Condition Unavailable'") + + # Compute icon/status (override if unavailable) + if unavailable: + icon = WEATHER_ICONS["default"] + status = "Condition Unavailable" + code_for_class = "unavailable" + else: + icon = wmo_to_icon(code, is_day) + status = wmo_to_status(code) + code_for_class = f"wmo-{code} {'day' if is_day else 'night'}" + + # min/max today (index 0) + tmin_val = safe_get(daily, "temperature_2m_min", 0) + tmax_val = safe_get(daily, "temperature_2m_max", 0) + dtemp_unit = daily_units.get("temperature_2m_min", temp_unit) + tmin_str = f"{int(round(tmin_val))}{dtemp_unit}" if isinstance(tmin_val, (int, float)) else "" + tmax_str = f"{int(round(tmax_val))}{dtemp_unit}" if isinstance(tmax_val, (int, float)) else "" + min_max = f" {tmin_str}\t\t {tmax_str}" if tmin_str and tmax_str else "" + + wind_val = cur.get("wind_speed_10m") + wind_unit = cur_units.get("wind_speed_10m", "") + wind_text = f" {int(round(wind_val))}{wind_unit}" if isinstance(wind_val, (int, float)) else "" + + hum_val = cur.get("relative_humidity_2m") + humidity_text = f" {int(hum_val)}%" if isinstance(hum_val, (int, float)) else "" + + vis_val = cur.get("visibility") + visibility_text = f" {format_visibility(vis_val)}" if isinstance(vis_val, (int, float)) else "" + + aqi_val = safe_get(aqi or {}, "current", "european_aqi") + aqi_text = f"AQI {int(aqi_val)}" if isinstance(aqi_val, (int, float)) else "AQI N/A" + + hourly_precip = build_hourly_precip(forecast) + prediction = f"\n\n{hourly_precip}" if hourly_precip else "" + + # Build place string (priority: MANUAL_PLACE > ENV_PLACE > reverse geocode > lat,lon) + place_str = (MANUAL_PLACE or ENV_PLACE or place or f"{lat:.3f}, {lon:.3f}") + location_text = f"{LOC_ICON} {place_str}" + + # Build tooltip (markup or plain) + if TOOLTIP_MARKUP: + # Escape dynamic text to avoid breaking Pango markup + tooltip_text = str.format( + "\t\t{}\t\t\n{}\n{}\n{}\n{}\n\n{}\n{}\n{}{}", + f'{esc(temp_str)}', + f" {icon}", + f"{esc(status)}", + esc(location_text), + f"{esc(feels_str)}" if feels_str else "", + f"{esc(min_max)}" if min_max else "", + f"{esc(wind_text)}\t{esc(humidity_text)}", + f"{esc(visibility_text)}\t{esc(aqi_text)}", + f" {esc(prediction)}" if prediction else "", + ) + else: + lines = [ + f"{icon} {temp_str}", + status, + location_text, + ] + if feels_str: + lines.append(feels_str) + if min_max: + lines.append(min_max) + lines.append(f"{wind_text} {humidity_text}".strip()) + lines.append(f"{visibility_text} {aqi_text}".strip()) + if prediction: + lines.append(hourly_precip) + tooltip_text = "\n".join([ln for ln in lines if ln]) + + # Build main text with colorful icon and colored temp; prefer larger icon if emoji + if ACTIVE_ICON_STYLE == "emoji": + icon_text = f"{icon}" + else: + # Colorize mono icons subtly + icon_text = f"{icon}" + + temp_text = f"{esc(temp_str)}" + + out_data = { + "text": f"{icon_text} {temp_text}", + "alt": status, + "tooltip": tooltip_text, + "class": code_for_class, + } + + simple_weather = ( + f"{icon} {status}\n" + + f" {temp_str} ({feels_str})\n" + + (f"{wind_text} \n" if wind_text else "") + + (f"{humidity_text} \n" if humidity_text else "") + + f"{visibility_text} {aqi_text}\n" + ) + + return out_data, simple_weather + + +def main() -> None: + lat, lon = get_coords() + + # Try cache first + cached = read_api_cache() + if cached and isinstance(cached, dict): + forecast = cached.get("forecast") + aqi = cached.get("aqi") + cached_place = cached.get("place") if isinstance(cached.get("place"), str) else None + place_effective = MANUAL_PLACE or ENV_PLACE or cached_place + try: + out, simple = build_output(lat, lon, forecast, aqi, place_effective) + print(json.dumps(out, ensure_ascii=False)) + write_simple_text_cache(simple) + return + except Exception as e: + print(f"Cached data build failed, refetching: {e}", file=sys.stderr) + + # Fetch fresh + try: + forecast = fetch_open_meteo(lat, lon) + aqi = fetch_aqi(lat, lon) + # Use manual/env place if provided; otherwise reverse geocode + place_effective = MANUAL_PLACE or ENV_PLACE or fetch_place(lat, lon) + write_api_cache({"forecast": forecast, "aqi": aqi, "place": place_effective}) + out, simple = build_output(lat, lon, forecast, aqi, place_effective) + print(json.dumps(out, ensure_ascii=False)) + write_simple_text_cache(simple) + except Exception as e: + print(f"Open-Meteo fetch failed: {e}", file=sys.stderr) + # Last resort: try stale cache without TTL + try: + if os.path.exists(API_CACHE_PATH): + with open(API_CACHE_PATH, "r", encoding="utf-8") as f: + stale = json.load(f) + out, simple = build_output(lat, lon, stale.get("forecast", {}), stale.get("aqi"), stale.get("place") if isinstance(stale.get("place"), str) else None) + print(json.dumps(out, ensure_ascii=False)) + write_simple_text_cache(simple) + return + except Exception as e2: + print(f"Failed to use stale cache: {e2}", file=sys.stderr) + # Fallback minimal output + fallback = { + "text": f"{WEATHER_ICONS['default']} N/A", + "alt": "Unavailable", + "tooltip": "Weather unavailable", + "class": "unavailable", + } + print(json.dumps(fallback, ensure_ascii=False)) + + +if __name__ == "__main__": + main() diff --git a/modules/home/waybar/scripts/battery-level.sh b/modules/home/waybar/scripts/battery-level.sh new file mode 100755 index 0000000..ddde6ea --- /dev/null +++ b/modules/home/waybar/scripts/battery-level.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +# Original script by Eric Murphy +# https://github.com/ericmurphyxyz/dotfiles/blob/master/.local/bin/battery-alert +# +# Modified by Jesse Mirabel (@sejjy) +# https://github.com/sejjy/mechabar + +# This script sends a notification when the battery is full, low, or critical. +# icon theme used: tela-circle-icon-theme-dracula +# +# (see the bottom of the script for more information) + +export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" + +# battery levels +WARNING_LEVEL=20 +CRITICAL_LEVEL=10 + +# get the battery state and percentage using upower (waybar dependency) +BAT_PATH=$(upower -e | grep BAT | head -n 1) +BATTERY_STATE=$(upower -i "$BAT_PATH" | awk '/state:/ {print $2}') +BATTERY_LEVEL=$(upower -i "$BAT_PATH" | awk '/percentage:/ {print $2}' | tr -d '%') + +# prevent multiple notifications +FILE_FULL=/tmp/battery-full +FILE_WARNING=/tmp/battery-warning +FILE_CRITICAL=/tmp/battery-critical + +# remove the files if the battery is no longer in that state +if [ "$BATTERY_STATE" == "discharging" ]; then + rm -f $FILE_FULL +elif [ "$BATTERY_STATE" == "charging" ]; then + rm -f "$FILE_WARNING" "$FILE_CRITICAL" +fi + +# if the battery is full and is plugged in +if [ "$BATTERY_LEVEL" -eq 100 ] && [ "$BATTERY_STATE" == "fully-charged" ] && [ ! -f $FILE_FULL ]; then + notify-send -a "state" "Battery Charged (${BATTERY_LEVEL}%)" "You might want to unplug your PC." -i "battery-full" -r 9991 + touch $FILE_FULL + +# if the battery is low and is discharging +elif [ "$BATTERY_LEVEL" -le $WARNING_LEVEL ] && [ "$BATTERY_STATE" == "discharging" ] && [ ! -f $FILE_WARNING ]; then + notify-send -a "state" "Battery Low (${BATTERY_LEVEL}%)" "You might want to plug in your PC." -u critical -i "battery-caution" -r 9991 -h string:fgcolor:\#fab387 -h string:frcolor:\#fab387 + touch $FILE_WARNING + +# if the battery is critical and is discharging +elif [ "$BATTERY_LEVEL" -le $CRITICAL_LEVEL ] && [ "$BATTERY_STATE" == "discharging" ] && [ ! -f $FILE_CRITICAL ]; then + notify-send -a "state" "Battery Critical (${BATTERY_LEVEL}%)" "Plug in your PC now." -u critical -i "battery-empty" -r 9991 + touch $FILE_CRITICAL +fi + +# systemd service +# Add the following to ~/.config/systemd/user/battery-level.service: + +# [Unit] +# Description=Battery Level Checker +# After=graphical.target +# +# [Service] +# ExecStart=%h/.config/waybar/scripts/battery-level.sh +# Type=oneshot + +# systemd timer +# Add the following to ~/.config/systemd/user/battery-level.timer: + +# [Unit] +# Description=Run Battery Level Checker +# +# [Timer] +# OnBootSec=1min +# OnUnitActiveSec=1min +# Unit=battery-level.service +# +# [Install] +# WantedBy=timers.target + +# enable the timer by running the following commands: +# systemctl --user daemon-reload +# systemctl --user enable --now battery-level.timer diff --git a/modules/home/waybar/scripts/battery-state.sh b/modules/home/waybar/scripts/battery-state.sh new file mode 100755 index 0000000..d7cf5fc --- /dev/null +++ b/modules/home/waybar/scripts/battery-state.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +# Original script by Eric Murphy +# https://github.com/ericmurphyxyz/dotfiles/blob/master/.local/bin/battery-alert +# +# Modified by Jesse Mirabel (@sejjy) +# https://github.com/sejjy/mechabar + +# This script sends a notification when the battery is charging or discharging. +# icon theme used: tela-circle-icon-theme-dracula +# +# (see the bottom of the script for more information) + +export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" + +# get the battery state from the udev rule +BATTERY_STATE=$1 + +# get the battery percentage using upower (waybar dependency) +BAT_PATH=$(upower -e | grep BAT | head -n 1) +BATTERY_LEVEL=$(upower -i "$BAT_PATH" | awk '/percentage:/ {print $2}' | tr -d '%') + +# set the battery charging state and icon +case "$BATTERY_STATE" in +"charging") + BATTERY_CHARGING="Charging" + BATTERY_ICON="090-charging" + ;; +"discharging") + BATTERY_CHARGING="Disharging" + BATTERY_ICON="090" + ;; +esac + +# send the notification +notify-send -a "state" "Battery ${BATTERY_CHARGING} (${BATTERY_LEVEL}%)" -u normal -i "battery-${BATTERY_ICON}" -r 9991 + +# udev rule +# Add the following to /etc/udev/rules.d/60-power.rules: + +# ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", ENV{DISPLAY}=":0", RUN+="/usr/bin/su -c '$HOME/.config/waybar/scripts/battery-state.sh discharging'" +# ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", RUN+="/usr/bin/su -c '$HOME/.config/waybar/scripts/battery-state.sh charging'" + +# the number 60 in the udev rule can be changed to any number between 0 and 99. +# the lower the number, the higher the priority. +# +# $USER does not work, so you have to replace "" with your username. + +# reload udev rules by running the following command: +# sudo udevadm control --reload-rules diff --git a/modules/home/waybar/scripts/brightness-control.sh b/modules/home/waybar/scripts/brightness-control.sh new file mode 100755 index 0000000..28fa223 --- /dev/null +++ b/modules/home/waybar/scripts/brightness-control.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +# Print error message for invalid arguments +print_error() { + cat <<"EOF" +Usage: ./brightnesscontrol.sh +Valid actions are: + i -- ncrease brightness [+2%] + d -- ecrease brightness [-2%] +EOF +} + +# Send a notification with brightness info +send_notification() { + brightness=$(brightnessctl info | grep -oP "(?<=\()\d+(?=%)") + notify-send -a "state" -r 91190 -i "gpm-brightness-lcd" -h int:value:"$brightness" "Brightness: ${brightness}%" -u low +} + +# Get the current brightness percentage and device name +get_brightness() { + brightness=$(brightnessctl -m | grep -o '[0-9]\+%' | head -c-2) + device=$(brightnessctl -m | head -n 1 | awk -F',' '{print $1}' | sed 's/_/ /g; s/\<./\U&/g') # Get device name + current_brightness=$(brightnessctl -m | head -n 1 | awk -F',' '{print $3}') # Get current brightness + max_brightness=$(brightnessctl -m | head -n 1 | awk -F',' '{print $5}') # Get max brightness +} +get_brightness + +# Handle options +while getopts o: opt; do + case "${opt}" in + o) + case $OPTARG in + i) # Increase brightness + if [[ $brightness -lt 10 ]]; then + brightnessctl set +1% + else + brightnessctl set +2% + fi + send_notification + ;; + d) # Decrease brightness + if [[ $brightness -le 1 ]]; then + brightnessctl set 1% + elif [[ $brightness -le 10 ]]; then + brightnessctl set 1%- + else + brightnessctl set 2%- + fi + send_notification + ;; + *) + print_error + ;; + esac + ;; + *) + print_error + ;; + esac +done + +# Determine the icon based on brightness level +get_icon() { + if ((brightness <= 5)); then + icon="" + elif ((brightness <= 15)); then + icon="" + elif ((brightness <= 30)); then + icon="" + elif ((brightness <= 45)); then + icon="" + elif ((brightness <= 55)); then + icon="" + elif ((brightness <= 65)); then + icon="" + elif ((brightness <= 80)); then + icon="" + elif ((brightness <= 95)); then + icon="" + else + icon="" + fi +} + +# Backlight module and tooltip +get_icon +module="${icon} ${brightness}%" + +tooltip="Device Name: ${device}" +tooltip+="\nBrightness: ${current_brightness} / ${max_brightness}" + +echo "{\"text\": \"${module}\", \"tooltip\": \"${tooltip}\"}" diff --git a/modules/home/waybar/scripts/cpu-temp.sh b/modules/home/waybar/scripts/cpu-temp.sh new file mode 100755 index 0000000..b6f2355 --- /dev/null +++ b/modules/home/waybar/scripts/cpu-temp.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +model=$(awk -F ': ' '/model name/{print $2}' /proc/cpuinfo | head -n 1 | sed 's/@.*//; s/ *\((R)\|(TM)\)//g; s/^[ \t]*//; s/[ \t]*$//') + +# get CPU clock speeds +get_cpu_frequency() { + freqlist=$(awk '/cpu MHz/ {print $4}' /proc/cpuinfo) + maxfreq=$(sed 's/...$//' /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq) + if [ -z "$freqlist" ] || [ -z "$maxfreq" ]; then + echo "--" + return + fi + average_freq=$(echo "$freqlist" | tr ' ' '\n' | awk "{sum+=\$1} END {printf \"%.0f/%s MHz\", sum/NR, $maxfreq}") + echo "$average_freq" +} + +# get CPU temp +get_cpu_temperature() { + temp=$(sensors | awk '/Package id 0/ {print $4}' | awk -F '[+.]' '{print $2}') + if [[ -z "$temp" ]]; then + temp=$(sensors | awk '/Tctl/ {print $2}' | tr -d '+°C') + fi + if [[ -z "$temp" ]]; then + temp="--" + temp_f="--" + else + temp=${temp%.*} + temp_f=$(awk "BEGIN {printf \"%.1f\", ($temp * 9 / 5) + 32}") + fi + # Celsius and Fahrenheit + echo "${temp:---} ${temp_f:---}" +} + +get_temperature_icon() { + temp_value=$1 + if [ "$temp_value" = "--" ]; then + icon="󱔱" # none + elif [ "$temp_value" -ge 80 ]; then + icon="󰸁" # high + elif [ "$temp_value" -ge 70 ]; then + icon="󱃂" # medium + elif [ "$temp_value" -ge 60 ]; then + icon="󰔏" # normal + else + icon="󱃃" # low + fi + echo "$icon" +} + +cpu_frequency=$(get_cpu_frequency) +read -r temp_info < <(get_cpu_temperature) +temp=$(echo "$temp_info" | awk '{print $1}') +temp_f=$(echo "$temp_info" | awk '{print $2}') +thermo_icon=$(get_temperature_icon "$temp") + +# high temp warning +if [ "$temp" == "--" ] || [ "$temp" -ge 80 ]; then + text_output="${thermo_icon} ${temp}°C" +else + text_output="${thermo_icon} ${temp}°C" +fi + +tooltip=":: ${model}\n" +tooltip+="Clock Speed: ${cpu_frequency}\nTemperature: ${temp_f}°F" + +# module and tooltip +echo "{\"text\": \"$text_output\", \"tooltip\": \"$tooltip\"}" diff --git a/modules/home/waybar/scripts/power-menu.sh b/modules/home/waybar/scripts/power-menu.sh new file mode 100755 index 0000000..d330c3d --- /dev/null +++ b/modules/home/waybar/scripts/power-menu.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Use a dedicated narrow dark theme for the power menu +config="$HOME/.config/rofi/power-menu.rasi" + +actions=$(echo -e " Lock\n Shutdown\n Reboot\n Suspend\n Hibernate\n󰞘 Logout") + +# Display logout menu +selected_option=$(echo -e "$actions" | rofi -dmenu -i -p "Power Menu" -config "${config}" || pkill -x rofi) + +# Perform actions based on the selected option +case "$selected_option" in +*Lock) + loginctl lock-session + ;; +*Shutdown) + systemctl poweroff + ;; +*Reboot) + systemctl reboot + ;; +*Suspend) + systemctl suspend + ;; +*Hibernate) + systemctl hibernate + ;; +*Logout) + loginctl kill-session "$XDG_SESSION_ID" + ;; +esac diff --git a/modules/home/waybar/scripts/volume-control.sh b/modules/home/waybar/scripts/volume-control.sh new file mode 100755 index 0000000..76bb2f7 --- /dev/null +++ b/modules/home/waybar/scripts/volume-control.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +# Define functions +print_error() { + cat <<"EOF" +Usage: ./volumecontrol.sh -[device] +...valid devices are... + i -- input device + o -- output device + p -- player application +...valid actions are... + i -- increase volume [+2] + d -- decrease volume [-2] + m -- mute [x] +EOF + exit 1 +} + +icon() { + vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/%//') + mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') + + if [ "$mute" = "yes" ] || [ "$vol" -eq 0 ]; then + icon="volume-level-muted" + elif [ "$vol" -lt 33 ]; then + icon="volume-level-low" + elif [ "$vol" -lt 66 ]; then + icon="volume-level-medium" + else + icon="volume-level-high" + fi +} + +send_notification() { + icon + notify-send -a "state" -r 91190 -i "$icon" -h int:value:"$vol" "Volume: ${vol}%" -u low +} + +notify_mute() { + mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') + if [ "$mute" = "yes" ]; then + notify-send -a "state" -r 91190 -i "volume-level-muted" "Volume: Muted" -u low + else + icon + notify-send -a "state" -r 91190 -i "$icon" "Volume: Unmuted" -u low + fi +} + +action_volume() { + case "${1}" in + i) + # Increase volume if below 100 + current_vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/%//') + if [ "$current_vol" -lt 100 ]; then + new_vol=$((current_vol + 2)) + [ "$new_vol" -gt 100 ] && new_vol=100 + pactl set-sink-volume @DEFAULT_SINK@ "${new_vol}%" + fi + ;; + d) + # Decrease volume if above 0 + current_vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/%//') + new_vol=$((current_vol - 2)) + [ "$new_vol" -lt 0 ] && new_vol=0 + pactl set-sink-volume @DEFAULT_SINK@ "${new_vol}%" + ;; + esac +} + +select_output() { + if [ "$@" ]; then + desc="$*" + device=$(pactl list sinks | grep -C2 -F "Description: $desc" | grep Name | cut -d: -f2 | xargs) + if pactl set-default-sink "$device"; then + notify-send -r 91190 "Activated: $desc" + else + notify-send -r 91190 "Error activating $desc" + fi + else + pactl list sinks | grep -ie "Description:" | awk -F ': ' '{print $2}' | sort + fi +} + +# Evaluate device option +while getopts iops: DeviceOpt; do + case "${DeviceOpt}" in + i) + nsink=$(pactl list sources short | awk '{print $2}') + [ -z "${nsink}" ] && echo "ERROR: Input device not found..." && exit 0 + srce="--default-source" + ;; + o) + nsink=$(pactl list sinks short | awk '{print $2}') + [ -z "${nsink}" ] && echo "ERROR: Output device not found..." && exit 0 + srce="" + ;; + p) + nsink=$(playerctl --list-all | grep -w "${OPTARG}") + [ -z "${nsink}" ] && echo "ERROR: Player ${OPTARG} not active..." && exit 0 + # shellcheck disable=SC2034 + srce="${nsink}" + ;; + s) + # Select an output device + select_output "$@" + exit + ;; + *) print_error ;; + esac +done + +# Set default variables +shift $((OPTIND - 1)) + +# Execute action +case "${1}" in +i) action_volume i ;; +d) action_volume d ;; +m) pactl set-sink-mute @DEFAULT_SINK@ toggle && notify_mute && exit 0 ;; +*) print_error ;; +esac + +send_notification diff --git a/modules/home/waybar/scripts/wifi-status.sh b/modules/home/waybar/scripts/wifi-status.sh new file mode 100755 index 0000000..2485268 --- /dev/null +++ b/modules/home/waybar/scripts/wifi-status.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash + +# This script gathers detailed Wi-Fi connection information. +# It collects the following fields: +# +# - SSID (Service Set Identifier): The name of the Wi-Fi network you +# are currently connected to. Example: "My_Network" +# +# - IP Address: The IP address assigned to the device by the router. +# This is typically a private IP within the local network. Example: +# "192.168.1.29/24" (with subnet mask) +# +# - Router (Gateway): The IP address of the router (default gateway) +# that your device uses to communicate outside the local network. +# Example: "192.168.1.1" +# +# - MAC Address: The unique Media Access Control address of the local +# device's Wi-Fi adapter. Example: "F8:34:41:07:1B:65" +# +# - Security: The encryption protocol being used to secure your Wi-Fi +# connection. Common security protocols include: +# - WPA2 (Wi-Fi Protected Access 2): The most commonly used security +# standard, offering strong encryption (AES). +# - WPA3: The latest version, providing even stronger security, +# especially in public or open networks. +# - WEP (Wired Equivalent Privacy): An outdated and insecure protocol +# that should not be used. +# Example: "WPA2" indicates that the connection is secured using WPA2 +# with AES encryption. +# +# - BSSID (Basic Service Set Identifier): The MAC address of the Wi-Fi +# access point you are connected to. Example: "A4:22:49:DA:91:A0" +# +# - Channel: The wireless channel your Wi-Fi network is using. This is +# associated with the frequency band. Example: "100 (5500 MHz)" +# indicates the channel number (100) and the frequency (5500 MHz), +# which is within the 5 GHz band. +# +# - RSSI (Received Signal Strength Indicator): The strength of the +# Wi-Fi signal, typically in dBm (decibels relative to 1 milliwatt). +# Closer to 0 means stronger signal, with values like -40 dBm being +# very good. Example: "-40 dBm" +# +# - Signal: The signal quality, which is represented as a percentage, +# where higher numbers mean better signal. Example: "100" +# indicates perfect signal strength. +# +# - Rx Rate (Receive Rate): The maximum data rate (in Mbit/s) at which +# the device can receive data from the Wi-Fi access point. Example: +# "866.7 MBit/s" indicates a high-speed connection on a modern +# standard. +# +# - Tx Rate (Transmit Rate): The maximum data rate (in Mbit/s) at +# which the device can send data to the Wi-Fi access point. Example: +# "866.7 MBit/s" +# +# - PHY Mode (Physical Layer Mode): The Wi-Fi protocol or standard in +# use. Common modes include 802.11n, 802.11ac, and 802.11ax (Wi-Fi +# 6). Example: "802.11ac" indicates you're using the 5 GHz band with +# a modern high-speed standard. + +if ! command -v nmcli &>/dev/null; then + echo "{\"text\": \"󰤫\", \"tooltip\": \"nmcli utility is missing\"}" + exit 1 +fi + +# Check if Wi-Fi is enabled +wifi_status=$(nmcli radio wifi) + +if [ "$wifi_status" = "disabled" ]; then + echo "{\"text\": \"󰤮\", \"tooltip\": \"Wi-Fi Disabled\"}" + exit 0 +fi + +wifi_info=$(nmcli -t -f active,ssid,signal,security dev wifi | grep "^yes") + +# If no ESSID is found, set a default value +if [ -z "$wifi_info" ]; then + essid="No Connection" + signal=0 + tooltip="No Connection" +else + # Some defaults + ip_address="127.0.0.1" + # gateway="127.0.0.1" + # mac_address="N/A" + security=$(echo "$wifi_info" | awk -F: '{print $4}') + # bssid="N/A" + chan="N/A" + # rssi="N/A" + # rx_bitrate="" + # tx_bitrate="" + # phy_mode="" + signal=$(echo "$wifi_info" | awk -F: '{print $3}') + + active_device=$(nmcli -t -f DEVICE,STATE device status | + grep -w "connected" | + grep -v -E "^(dummy|lo:|virbr0)" | + awk -F: '{print $1}' | + head -n 1) + + if [ -n "$active_device" ]; then + output=$(nmcli -e no -g ip4.address,ip4.gateway,general.hwaddr device show "$active_device") + + ip_address=$(echo "$output" | sed -n '1p') + # gateway=$(echo "$output" | sed -n '2p') + # mac_address=$(echo "$output" | sed -n '3p') + + line=$(nmcli -e no -t -f active,bssid,chan,freq device wifi | grep "^yes") + + # bssid=$(echo "$line" | awk -F':' '{print $2":"$3":"$4":"$5":"$6":"$7}') + chan=$(echo "$line" | awk -F':' '{print $8}') + freq=$(echo "$line" | awk -F':' '{print $9}') + chan="$chan ($freq)" + + # if command -v iw &>/dev/null; then + # iw_output=$(iw dev "$active_device" station dump) + # rssi=$(echo "$iw_output" | grep "signal:" | awk '{print $2 " dBm"}') + + # Upload speed + # rx_bitrate=$(echo "$iw_output" | grep "rx bitrate:" | awk '{print $3 " " $4}') + + # Download speed + # tx_bitrate=$(echo "$iw_output" | grep "tx bitrate:" | awk '{print $3 " " $4}') + + # Physical Layer Mode + # if echo "$iw_output" | grep -E -q "rx bitrate:.* VHT"; then + # phy_mode="802.11ac" # Wi-Fi 5 + # elif echo "$iw_output" | grep -E -q "rx bitrate:.* HT"; then + # phy_mode="802.11n" # Wi-Fi 4 + # elif echo "$iw_output" | grep -E -q "rx bitrate:.* HE"; then + # phy_mode="802.11ax" # Wi-Fi 6 + # fi + # fi + + # Get the current Wi-Fi ESSID + essid=$(echo "$wifi_info" | awk -F: '{print $2}') + + tooltip=":: ${essid}" + tooltip+="\nIP Address: ${ip_address}" + # tooltip+="\nRouter: ${gateway}" + # tooltip+="\nMAC Address: ${mac_address}" + tooltip+="\nSecurity: ${security}" + # tooltip+="\nBSSID: ${bssid}" + tooltip+="\nChannel: ${chan}" + # tooltip+="\nRSSI: ${rssi}" + tooltip+="\nStrength: ${signal} / 100" + + # if [ -n "$rx_bitrate" ]; then + # tooltip+="\nRx Rate: ${rx_bitrate}" + # fi + + # if [ -n "$tx_bitrate" ]; then + # tooltip+="\nTx Rate: ${tx_bitrate}" + # fi + + # if [ -n "$phy_mode" ]; then + # tooltip+="\nPHY Mode: ${phy_mode}" + # fi + fi +fi + +# Determine Wi-Fi icon based on signal strength +if [ "$signal" -ge 80 ]; then + icon="󰤨" # Strong signal +elif [ "$signal" -ge 60 ]; then + icon="󰤥" # Good signal +elif [ "$signal" -ge 40 ]; then + icon="󰤢" # Weak signal +elif [ "$signal" -ge 20 ]; then + icon="󰤟" # Very weak signal +else + icon="󰤯" # No signal +fi + +# Module and tooltip +echo "{\"text\": \"${icon}\", \"tooltip\": \"${tooltip}\"}" diff --git a/modules/home/waybar/waybar-curved.nix b/modules/home/waybar/waybar-curved.nix index 09a07e3..33e46fe 100644 --- a/modules/home/waybar/waybar-curved.nix +++ b/modules/home/waybar/waybar-curved.nix @@ -1,277 +1,277 @@ -{ pkgs -, lib -, host -, config -, ... -}: -let +{ + pkgs, + lib, + host, + config, + ... +}: let betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)"; inherit (import ../../../hosts/${host}/variables.nix) clock24h; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; - modules-center = [ "hyprland/workspaces" ]; - modules-left = [ - "custom/startmenu" - "hyprland/window" - "pulseaudio" - "cpu" - "memory" - "idle_inhibitor" - ]; - modules-right = [ - "custom/hyprbindings" - "custom/notification" - "custom/exit" - "battery" - "tray" - "clock" - ]; + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; + modules-center = ["hyprland/workspaces"]; + modules-left = [ + "custom/startmenu" + "hyprland/window" + "pulseaudio" + "cpu" + "memory" + "idle_inhibitor" + ]; + modules-right = [ + "custom/hyprbindings" + "custom/notification" + "custom/exit" + "battery" + "tray" + "clock" + ]; - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "clock" = { - format = - if clock24h == true - then '' {:L%H:%M}'' - else '' {:L%I:%M %p}''; - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; - }; - "hyprland/window" = { - max-length = 22; - separate-outputs = false; - rewrite = { - "" = " 🙈 No Windows? "; + "clock" = { + format = + if clock24h == true + then '' {:L%H:%M}'' + else '' {:L%I:%M %p}''; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; }; - }; - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - }; - "disk" = { - format = " {free}"; - tooltip = true; - }; - "network" = { - format-icons = [ - "󰤯" - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - format-ethernet = " {bandwidthDownOctets}"; - format-wifi = "{icon} {signalStrength}%"; - format-disconnected = "󰤮"; - tooltip = false; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ - "" - "" - "" + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + rewrite = { + "" = " 🙈 No Windows? "; + }; + }; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + }; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; + "disk" = { + format = " {free}"; + tooltip = true; + }; + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; }; - on-click = "sleep 0.1 && pavucontrol"; - }; - "custom/exit" = { - tooltip = false; - format = ""; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = ""; - # exec = "rofi -show drun"; - on-click = "sleep 0.1 && rofi-launcher"; - }; - "custom/hyprbindings" = { - tooltip = false; - format = "󱕴"; - on-click = "sleep 0.1 && list-keybinds"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + "tray" = { + spacing = 12; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "sleep 0.1 && pavucontrol"; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && task-waybar"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "custom/exit" = { + tooltip = false; + format = ""; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = ""; + # exec = "rofi -show drun"; + on-click = "sleep 0.1 && rofi-launcher"; + }; + "custom/hyprbindings" = { + tooltip = false; + format = "󱕴"; + on-click = "sleep 0.1 && list-keybinds"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && task-waybar"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + on-click = ""; + tooltip = false; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ - "󰁺" - "󰁻" - "󰁼" - "󰁽" - "󰁾" - "󰁿" - "󰂀" - "󰂁" - "󰂂" - "󰁹" - ]; - on-click = ""; - tooltip = false; - }; - } - ]; - style = concatStrings [ - '' - * { - font-family: JetBrainsMono Nerd Font Mono; - font-size: 16px; - border-radius: 0px; - border: none; - min-height: 0px; } - window#waybar { - background: rgba(0,0,0,0); - } - #workspaces { - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base01}; - margin: 4px 4px; - padding: 5px 5px; - border-radius: 16px; - } - #workspaces button { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - opacity: 0.5; - transition: ${betterTransition}; - } - #workspaces button.active { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - transition: ${betterTransition}; - opacity: 1.0; - min-width: 40px; - } - #workspaces button:hover { - font-weight: bold; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - opacity: 0.8; - transition: ${betterTransition}; - } - tooltip { - background: #${config.lib.stylix.colors.base00}; - border: 1px solid #${config.lib.stylix.colors.base08}; - border-radius: 12px; - } - tooltip label { - color: #${config.lib.stylix.colors.base08}; - } - #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { - font-weight: bold; - margin: 4px 0px; - margin-left: 7px; - padding: 0px 18px; - background: #${config.lib.stylix.colors.base04}; - color: #${config.lib.stylix.colors.base00}; - border-radius: 24px 10px 24px 10px; - } - #custom-startmenu { - color: #${config.lib.stylix.colors.base0B}; - background: #${config.lib.stylix.colors.base02}; - font-size: 28px; - margin: 0px; - padding: 0px 30px 0px 15px; - border-radius: 0px 0px 40px 0px; - } - #custom-hyprbindings, #network, #battery, - #custom-notification, #tray, #custom-exit { - font-weight: bold; - background: #${config.lib.stylix.colors.base0F}; - color: #${config.lib.stylix.colors.base00}; - margin: 4px 0px; - margin-right: 7px; - border-radius: 10px 24px 10px 24px; - padding: 0px 18px; - } - #clock { - font-weight: bold; - color: #0D0E15; - background: linear-gradient(90deg, #${config.lib.stylix.colors.base0E}, #${config.lib.stylix.colors.base0C}); - margin: 0px; - padding: 0px 15px 0px 30px; - border-radius: 0px 0px 0px 40px; - } - '' - ]; - }; -} + ]; + style = concatStrings [ + '' + * { + font-family: JetBrainsMono Nerd Font Mono; + font-size: 16px; + border-radius: 0px; + border: none; + min-height: 0px; + } + window#waybar { + background: rgba(0,0,0,0); + } + #workspaces { + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base01}; + margin: 4px 4px; + padding: 5px 5px; + border-radius: 16px; + } + #workspaces button { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + opacity: 0.5; + transition: ${betterTransition}; + } + #workspaces button.active { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + transition: ${betterTransition}; + opacity: 1.0; + min-width: 40px; + } + #workspaces button:hover { + font-weight: bold; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + opacity: 0.8; + transition: ${betterTransition}; + } + tooltip { + background: #${config.lib.stylix.colors.base00}; + border: 1px solid #${config.lib.stylix.colors.base08}; + border-radius: 12px; + } + tooltip label { + color: #${config.lib.stylix.colors.base08}; + } + #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { + font-weight: bold; + margin: 4px 0px; + margin-left: 7px; + padding: 0px 18px; + background: #${config.lib.stylix.colors.base04}; + color: #${config.lib.stylix.colors.base00}; + border-radius: 24px 10px 24px 10px; + } + #custom-startmenu { + color: #${config.lib.stylix.colors.base0B}; + background: #${config.lib.stylix.colors.base02}; + font-size: 28px; + margin: 0px; + padding: 0px 30px 0px 15px; + border-radius: 0px 0px 40px 0px; + } + #custom-hyprbindings, #network, #battery, + #custom-notification, #tray, #custom-exit { + font-weight: bold; + background: #${config.lib.stylix.colors.base0F}; + color: #${config.lib.stylix.colors.base00}; + margin: 4px 0px; + margin-right: 7px; + border-radius: 10px 24px 10px 24px; + padding: 0px 18px; + } + #clock { + font-weight: bold; + color: #0D0E15; + background: linear-gradient(90deg, #${config.lib.stylix.colors.base0E}, #${config.lib.stylix.colors.base0C}); + margin: 0px; + padding: 0px 15px 0px 30px; + border-radius: 0px 0px 0px 40px; + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-ddubs-2.nix b/modules/home/waybar/waybar-ddubs-2.nix index 2b44044..2cce101 100644 --- a/modules/home/waybar/waybar-ddubs-2.nix +++ b/modules/home/waybar/waybar-ddubs-2.nix @@ -1,9 +1,9 @@ -{ pkgs -, config -, lib -, ... -}: -let +{ + pkgs, + config, + lib, + ... +}: let terminal = "kitty"; base00 = "0F1419"; base01 = "131721"; @@ -20,337 +20,337 @@ let base0E = "D2A6FF"; base0F = "E6B673"; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; - modules-left = [ "custom/startmenu" "tray" "hyprland/window" ]; - modules-center = [ "hyprland/workspaces" ]; - modules-right = [ "idle_inhibitor" "custom/notification" "pulseaudio" "battery" "clock" "custom/exit" ]; + modules-left = ["custom/startmenu" "tray" "hyprland/window"]; + modules-center = ["hyprland/workspaces"]; + modules-right = ["idle_inhibitor" "custom/notification" "pulseaudio" "battery" "clock" "custom/exit"]; - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "clock" = { - format = '' {:%H:%M}''; - /* + "clock" = { + format = '' {:%H:%M}''; + /* ''{: %I:%M %p}''; */ - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }{calendar}"; - }; - "hyprland/window" = { - max-length = 60; - separate-outputs = false; - }; - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - on-click = "${terminal} -e btop"; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - on-click = "${terminal} -e btop"; - }; - "disk" = { - format = " {free}"; - tooltip = true; - # Not working with zaneyos window open then closes - #on-click = "${terminal} -e sh -c df -h ; read"; - }; - "network" = { - format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - format-ethernet = " {bandwidthDownBits}"; - format-wifi = " {bandwidthDownBits}"; - format-disconnected = "󰤮"; - tooltip = false; - on-click = "${terminal} -e btop"; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ "" "" "" ]; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }{calendar}"; }; - on-click = "pavucontrol"; - }; - "custom/exit" = { - tooltip = false; - format = "⏻"; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = " "; - # exec = "rofi -show drun"; - on-click = "rofi -show drun"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = " "; - deactivated = " "; + "hyprland/window" = { + max-length = 60; + separate-outputs = false; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + on-click = "${terminal} -e btop"; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "swaync-client -t"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + on-click = "${terminal} -e btop"; + }; + "disk" = { + format = " {free}"; + tooltip = true; + # Not working with zaneyos window open then closes + #on-click = "${terminal} -e sh -c df -h ; read"; + }; + "network" = { + format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; + format-ethernet = " {bandwidthDownBits}"; + format-wifi = " {bandwidthDownBits}"; + format-disconnected = "󰤮"; + tooltip = false; + on-click = "${terminal} -e btop"; + }; + "tray" = { + spacing = 12; + }; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + }; + "custom/exit" = { + tooltip = false; + format = "⏻"; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = " "; + # exec = "rofi -show drun"; + on-click = "rofi -show drun"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = " "; + deactivated = " "; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "swaync-client -t"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + on-click = ""; + tooltip = false; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; - on-click = ""; - tooltip = false; - }; - } - ]; - style = concatStrings [ - '' - * { - font-size: 16pt; - font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif; - font-weight: bold; } - window#waybar { - /* + ]; + style = concatStrings [ + '' + * { + font-size: 16pt; + font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif; + font-weight: bold; + } + window#waybar { + /* + + background-color: rgba(26,27,38,0); + border-bottom: 1px solid rgba(26,27,38,0); + border-radius: 0px; + color: #${base0F}; + */ background-color: rgba(26,27,38,0); border-bottom: 1px solid rgba(26,27,38,0); border-radius: 0px; color: #${base0F}; - */ - - background-color: rgba(26,27,38,0); - border-bottom: 1px solid rgba(26,27,38,0); - border-radius: 0px; - color: #${base0F}; - } - #workspaces { - /* - Eternal - background: linear-gradient(180deg, #${base00}, #${base01}); - margin: 5px 5px 5px 0px; - padding: 0px 10px; - border-radius: 0px 15px 15px 0px; + } + #workspaces { + /* + Eternal + background: linear-gradient(180deg, #${base00}, #${base01}); + margin: 5px 5px 5px 0px; + padding: 0px 10px; + border-radius: 0px 15px 15px 0px; + border: 0px; + font-style: normal; + color: #${base00}; + */ + background: linear-gradient(45deg, #${base01}, #${base01}); + margin: 5px; + padding: 0px 1px; + border-radius: 15px; border: 0px; font-style: normal; color: #${base00}; - */ - background: linear-gradient(45deg, #${base01}, #${base01}); - margin: 5px; - padding: 0px 1px; - border-radius: 15px; - border: 0px; - font-style: normal; - color: #${base00}; - } - #workspaces button { - padding: 0px 5px; - margin: 4px 3px; - border-radius: 15px; - border: 0px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 0.5; - transition: all 0.3s ease-in-out; - } - #workspaces button.active { - padding: 0px 5px; - margin: 4px 3px; - border-radius: 15px; - border: 0px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 1.0; - min-width: 40px; - transition: all 0.3s ease-in-out; - } - #workspaces button:hover { - border-radius: 15px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 0.8; - } - tooltip { - background: #${base00}; - border: 1px solid #${base0E}; - border-radius: 10px; - } - tooltip label { - color: #${base07}; - } - #window { - /* - Eternal + } + #workspaces button { + padding: 0px 5px; + margin: 4px 3px; + border-radius: 15px; + border: 0px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 0.5; + transition: all 0.3s ease-in-out; + } + #workspaces button.active { + padding: 0px 5px; + margin: 4px 3px; + border-radius: 15px; + border: 0px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 1.0; + min-width: 40px; + transition: all 0.3s ease-in-out; + } + #workspaces button:hover { + border-radius: 15px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 0.8; + } + tooltip { + background: #${base00}; + border: 1px solid #${base0E}; + border-radius: 10px; + } + tooltip label { + color: #${base07}; + } + #window { + /* + Eternal + color: #${base05}; + background: #${base00}; + border-radius: 15px; + margin: 5px; + padding: 2px 20px; + */ + margin: 5px; + padding: 2px 20px; + color: #${base05}; + background: #${base01}; + border-radius: 15px 15px 15px 15px; + } + #memory { + color: #${base0F}; + /* + Eternal + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + */ + background: #${base01}; + margin: 5px; + padding: 2px 20px; + border-radius: 15px 15px 15px 15px; + } + #clock { + color: #${base0B}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + } + #idle_inhibitor { + color: #${base0A}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 3px; + padding: 2px 20px; + } + #cpu { + color: #${base07}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + } + #disk { + color: #${base0F}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + } + #battery { + color: #${base08}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + } + #network { + color: #${base09}; + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + } + #tray { color: #${base05}; background: #${base00}; - border-radius: 15px; + border-radius: 15px 15px 15px 15px; margin: 5px; + padding: 2px 15px; + } + #pulseaudio { + color: #${base0D}; + /* + Eternal + background: #${base00}; + border-radius: 15px 15px 15px 15px; + margin: 5px; + padding: 2px 20px; + */ + background: #${base01}; + margin: 4px; padding: 2px 20px; - */ - margin: 5px; - padding: 2px 20px; - color: #${base05}; - background: #${base01}; - border-radius: 15px 15px 15px 15px; - } - #memory { - color: #${base0F}; - /* - Eternal + border-radius: 15px 15px 15px 15px; + } + #custom-notification { + color: #${base0C}; background: #${base00}; border-radius: 15px 15px 15px 15px; margin: 5px; padding: 2px 20px; - */ - background: #${base01}; - margin: 5px; - padding: 2px 20px; - border-radius: 15px 15px 15px 15px; - } - #clock { - color: #${base0B}; + } + #custom-startmenu { + color: #${base0E}; + background: #${base00}; + border-radius: 0px 15px 15px 0px; + margin: 5px 5px 5px 0px; + padding: 2px 20px; + } + #idle_inhibitor { + color: #${base09}; background: #${base00}; border-radius: 15px 15px 15px 15px; margin: 5px; padding: 2px 20px; - } - #idle_inhibitor { - color: #${base0A}; + } + #custom-exit { + color: #${base0E}; background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 3px; + border-radius: 15px 0px 0px 15px; + margin: 5px 0px 5px 5px; padding: 2px 20px; - } - #cpu { - color: #${base07}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #disk { - color: #${base0F}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #battery { - color: #${base08}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #network { - color: #${base09}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #tray { - color: #${base05}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 15px; - } - #pulseaudio { - color: #${base0D}; - /* - Eternal - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - */ - background: #${base01}; - margin: 4px; - padding: 2px 20px; - border-radius: 15px 15px 15px 15px; - } - #custom-notification { - color: #${base0C}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #custom-startmenu { - color: #${base0E}; - background: #${base00}; - border-radius: 0px 15px 15px 0px; - margin: 5px 5px 5px 0px; - padding: 2px 20px; - } - #idle_inhibitor { - color: #${base09}; - background: #${base00}; - border-radius: 15px 15px 15px 15px; - margin: 5px; - padding: 2px 20px; - } - #custom-exit { - color: #${base0E}; - background: #${base00}; - border-radius: 15px 0px 0px 15px; - margin: 5px 0px 5px 5px; - padding: 2px 20px; - } - '' - ]; - }; -} + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-ddubs.nix b/modules/home/waybar/waybar-ddubs.nix index 094babe..08edf50 100644 --- a/modules/home/waybar/waybar-ddubs.nix +++ b/modules/home/waybar/waybar-ddubs.nix @@ -1,283 +1,283 @@ -{ pkgs -, lib -, host -, config -, ... -}: -let +{ + pkgs, + lib, + host, + config, + ... +}: let betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)"; inherit (import ../../../hosts/${host}/variables.nix) clock24h; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; - modules-center = [ "hyprland/workspaces" ]; - modules-left = [ - "custom/startmenu" - "hyprland/window" - "pulseaudio" - "cpu" - "memory" - "idle_inhibitor" - ]; - modules-right = [ - "custom/hyprbindings" - "custom/notification" - "custom/exit" - "battery" - "tray" - "clock" - ]; + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; + modules-center = ["hyprland/workspaces"]; + modules-left = [ + "custom/startmenu" + "hyprland/window" + "pulseaudio" + "cpu" + "memory" + "idle_inhibitor" + ]; + modules-right = [ + "custom/hyprbindings" + "custom/notification" + "custom/exit" + "battery" + "tray" + "clock" + ]; - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "clock" = { - format = - if clock24h == true - then '' {:L%H:%M}'' - else '' {:L%I:%M %p}''; - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; - }; - "hyprland/window" = { - max-length = 22; - separate-outputs = false; - rewrite = { - "" = " 🙈 No Windows? "; + "clock" = { + format = + if clock24h == true + then '' {:L%H:%M}'' + else '' {:L%I:%M %p}''; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; }; - }; - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - }; - "disk" = { - format = " {free}"; - tooltip = true; - }; - "network" = { - format-icons = [ - "󰤯" - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - format-ethernet = " {bandwidthDownOctets}"; - format-wifi = "{icon} {signalStrength}%"; - format-disconnected = "󰤮"; - tooltip = false; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ - "" - "" - "" + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + rewrite = { + "" = " 🙈 No Windows? "; + }; + }; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + }; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; + "disk" = { + format = " {free}"; + tooltip = true; + }; + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; }; - on-click = "sleep 0.1 && pavucontrol"; - }; - "custom/exit" = { - tooltip = false; - format = ""; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = ""; - # exec = "rofi -show drun"; - #on-click = "sleep 0.1 && rofi-launcher"; - on-click = "sleep 0.1 && nwg-drawer -mb 200 -mt 200 -mr 200 -ml 200"; - }; - "custom/hyprbindings" = { - tooltip = false; - format = "󱕴"; - on-click = "sleep 0.1 && list-keybinds"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + "tray" = { + spacing = 12; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "sleep 0.1 && pavucontrol"; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && task-waybar"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "custom/exit" = { + tooltip = false; + format = ""; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = ""; + # exec = "rofi -show drun"; + #on-click = "sleep 0.1 && rofi-launcher"; + on-click = "sleep 0.1 && nwg-drawer -mb 200 -mt 200 -mr 200 -ml 200"; + }; + "custom/hyprbindings" = { + tooltip = false; + format = "󱕴"; + on-click = "sleep 0.1 && list-keybinds"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && task-waybar"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + on-click = ""; + tooltip = false; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ - "󰁺" - "󰁻" - "󰁼" - "󰁽" - "󰁾" - "󰁿" - "󰂀" - "󰂁" - "󰂂" - "󰁹" - ]; - on-click = ""; - tooltip = false; - }; - } - ]; - style = concatStrings [ - '' - * { - font-family: JetBrainsMono Nerd Font Mono; - font-size: 18px; - border-radius: 0px; - border: none; - min-height: 0px; } - window#waybar { - background: rgba(0,0,0,0); - } - #workspaces { - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base01}; - margin: 4px 4px; - padding: 5px 5px; - border-radius: 16px; - } - #workspaces button { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - opacity: 0.5; - transition: ${betterTransition}; - } - #workspaces button.active { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - transition: ${betterTransition}; - opacity: 1.0; - min-width: 40px; - } - #workspaces button:hover { - font-weight: bold; - border-radius: 16px; - color: #${config.lib.stylix.colors.base00}; - background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); - opacity: 0.8; - transition: ${betterTransition}; - } - tooltip { - background: #${config.lib.stylix.colors.base00}; - border: 1px solid #${config.lib.stylix.colors.base08}; - border-radius: 12px; - } - tooltip label { - color: #${config.lib.stylix.colors.base08}; - } - #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { - font-weight: bold; - margin: 4px 0px; - margin-left: 7px; - padding: 0px 18px; - background: #${config.lib.stylix.colors.base00}; - color: #${config.lib.stylix.colors.base08}; - border-radius: 8px 8px 8px 8px; - } - #idle_inhibitor { - font-size: 28px; - } - #custom-startmenu { - color: #${config.lib.stylix.colors.base0B}; - background: #${config.lib.stylix.colors.base02}; - font-size: 22px; - margin: 0px; - padding: 0px 5px 0px 5px; - border-radius: 16px 16px 16px 16px; - } - #custom-hyprbindings, #network, #battery, - #custom-notification, #tray, #custom-exit { - /* font-weight: bold; */ - font-size: 20px; - background: #${config.lib.stylix.colors.base00}; - color: #${config.lib.stylix.colors.base08}; - margin: 4px 0px; - margin-right: 7px; - border-radius: 8px 8px 8px 8px; - padding: 0px 18px; - } - #clock { - font-weight: bold; - font-size: 16px; - color: #0D0E15; - background: linear-gradient(90deg, #${config.lib.stylix.colors.base0B}, #${config.lib.stylix.colors.base02}); - margin: 0px; - padding: 0px 5px 0px 5px; - border-radius: 16px 16px 16px 16px; - } - '' - ]; - }; -} + ]; + style = concatStrings [ + '' + * { + font-family: JetBrainsMono Nerd Font Mono; + font-size: 18px; + border-radius: 0px; + border: none; + min-height: 0px; + } + window#waybar { + background: rgba(0,0,0,0); + } + #workspaces { + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base01}; + margin: 4px 4px; + padding: 5px 5px; + border-radius: 16px; + } + #workspaces button { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + opacity: 0.5; + transition: ${betterTransition}; + } + #workspaces button.active { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + transition: ${betterTransition}; + opacity: 1.0; + min-width: 40px; + } + #workspaces button:hover { + font-weight: bold; + border-radius: 16px; + color: #${config.lib.stylix.colors.base00}; + background: linear-gradient(45deg, #${config.lib.stylix.colors.base08}, #${config.lib.stylix.colors.base0D}); + opacity: 0.8; + transition: ${betterTransition}; + } + tooltip { + background: #${config.lib.stylix.colors.base00}; + border: 1px solid #${config.lib.stylix.colors.base08}; + border-radius: 12px; + } + tooltip label { + color: #${config.lib.stylix.colors.base08}; + } + #window, #pulseaudio, #cpu, #memory, #idle_inhibitor { + font-weight: bold; + margin: 4px 0px; + margin-left: 7px; + padding: 0px 18px; + background: #${config.lib.stylix.colors.base00}; + color: #${config.lib.stylix.colors.base08}; + border-radius: 8px 8px 8px 8px; + } + #idle_inhibitor { + font-size: 28px; + } + #custom-startmenu { + color: #${config.lib.stylix.colors.base0B}; + background: #${config.lib.stylix.colors.base02}; + font-size: 22px; + margin: 0px; + padding: 0px 5px 0px 5px; + border-radius: 16px 16px 16px 16px; + } + #custom-hyprbindings, #network, #battery, + #custom-notification, #tray, #custom-exit { + /* font-weight: bold; */ + font-size: 20px; + background: #${config.lib.stylix.colors.base00}; + color: #${config.lib.stylix.colors.base08}; + margin: 4px 0px; + margin-right: 7px; + border-radius: 8px 8px 8px 8px; + padding: 0px 18px; + } + #clock { + font-weight: bold; + font-size: 16px; + color: #0D0E15; + background: linear-gradient(90deg, #${config.lib.stylix.colors.base0B}, #${config.lib.stylix.colors.base02}); + margin: 0px; + padding: 0px 5px 0px 5px; + border-radius: 16px 16px 16px 16px; + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-ddubsos-v1.nix b/modules/home/waybar/waybar-ddubsos-v1.nix index 657389c..4af0fed 100644 --- a/modules/home/waybar/waybar-ddubsos-v1.nix +++ b/modules/home/waybar/waybar-ddubsos-v1.nix @@ -174,7 +174,7 @@ in }; "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-dwm-2.nix b/modules/home/waybar/waybar-dwm-2.nix index 862f609..2ec4d4e 100644 --- a/modules/home/waybar/waybar-dwm-2.nix +++ b/modules/home/waybar/waybar-dwm-2.nix @@ -477,4 +477,3 @@ ''; }; } - diff --git a/modules/home/waybar/waybar-dwm2.nix b/modules/home/waybar/waybar-dwm2.nix index ead9e76..bd98a34 100644 --- a/modules/home/waybar/waybar-dwm2.nix +++ b/modules/home/waybar/waybar-dwm2.nix @@ -163,7 +163,7 @@ in { }; "custom/weather" = { "return-type" = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-jak-catppuccin.nix b/modules/home/waybar/waybar-jak-catppuccin.nix index 9e82461..aaa5e29 100644 --- a/modules/home/waybar/waybar-jak-catppuccin.nix +++ b/modules/home/waybar/waybar-jak-catppuccin.nix @@ -556,11 +556,9 @@ in { }; modules = [ "custom/menu" - "custom/light_dark" "custom/file_manager" "custom/tty" "custom/browser" - "custom/settings" ]; }; @@ -615,35 +613,10 @@ in { # ---------- Custom modules (from ModulesCustom) ---------- "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; - - "custom/file_manager" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --files"; - tooltip = true; - "tooltip-format" = "File Manager"; - }; - "custom/tty" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --term"; - tooltip = true; - "tooltip-format" = "Launch Terminal"; - }; - "custom/browser" = { - format = " "; - "on-click" = "xdg-open https://"; - tooltip = true; - "tooltip-format" = "Launch Browser"; - }; - "custom/settings" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/Kool_Quick_Settings.sh"; - tooltip = true; - "tooltip-format" = "Launch KooL Hyprland Settings Menu"; - }; "custom/qs_wallpapers_apply" = { # Image wallpaper apply (qs-wallpapers-apply) format = " "; @@ -658,27 +631,6 @@ in { tooltip = true; "tooltip-format" = "Set video wallpaper"; }; - "custom/cycle_wall" = { - format = " "; - "on-click" = "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh"; - "on-click-right" = "$HOME/.config/hypr/UserScripts/WallpaperRandom.sh"; - "on-click-middle" = "$HOME/.config/hypr/scripts/WaybarStyles.sh"; - tooltip = true; - "tooltip-format" = "Left Click: Wallpaper Menu\nMiddle Click: Random wallpaper\nRight Click: Waybar Styles Menu"; - }; - "custom/hint" = { - format = "󰺁 HINT!"; - "on-click" = "$HOME/.config/hypr/scripts/KeyHints.sh"; - "on-click-right" = "$HOME/.config/hypr/scripts/KeyBinds.sh"; - tooltip = true; - "tooltip-format" = "Left Click: Quick Tips\nRight Click: Keybinds"; - }; - "custom/dot_update" = { - format = " 󰁈 "; - "on-click" = "$HOME/.config/hypr/scripts/KooLsDotsUpdate.sh"; - tooltip = true; - "tooltip-format" = "Check KooL Dots update\nIf available"; - }; "custom/hypridle" = { format = "󱫗 "; "return-type" = "json"; @@ -689,29 +641,12 @@ in { "on-click" = "$HOME/.config/hypr/scripts/Hypridle.sh toggle"; "on-click-right" = "hyprlock"; }; - "custom/light_dark" = { - format = "󰔎 "; - "on-click" = "$HOME/.config/hypr/scripts/DarkLight.sh"; - "on-click-right" = "$HOME/.config/hypr/scripts/WaybarStyles.sh"; - "on-click-middle" = "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh"; - tooltip = true; - "tooltip-format" = "Left Click: Switch Dark-Light Themes\nMiddle Click: Wallpaper Menu\nRight Click: Waybar Styles Menu"; - }; "custom/lock" = { format = "󰌾"; "on-click" = "$HOME/.config/hypr/scripts/LockScreen.sh"; tooltip = true; "tooltip-format" = "󰷛 Screen Lock"; }; - "custom/menu" = { - format = "  "; - # "on-click" = "pkill rofi || rofi -show drun -modi run,drun,filebrowser,window"; - "on-click" = "launch-nwg-menu"; - "on-click-middle" = "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh"; - "on-click-right" = "$HOME/.config/hypr/scripts/WaybarLayout.sh"; - tooltip = true; - "tooltip-format" = "Left Click: Rofi Menu\nMiddle Click: Wallpaper Menu\nRight Click: Waybar Layout Menu"; - }; "custom/startmenu" = { tooltip = true; "tooltip-format" = "App menu"; diff --git a/modules/home/waybar/waybar-jak-ml4w-modern.nix b/modules/home/waybar/waybar-jak-ml4w-modern.nix index 2eba53b..0074853 100644 --- a/modules/home/waybar/waybar-jak-ml4w-modern.nix +++ b/modules/home/waybar/waybar-jak-ml4w-modern.nix @@ -90,6 +90,7 @@ in { "margin-right" = 8; "modules-left" = [ + "custom/startmenu" "group/app_drawer" "custom/separator#blank" "custom/cava_mviz" @@ -325,7 +326,7 @@ in { "format-alt-click" = "click"; tooltip = true; "tooltip-format" = "{used:0.1f}GB/{total:0.1f}G"; - "on-click-right" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --btop"; + "on-click-right" = "kitty -e btop"; }; mpris = { @@ -378,7 +379,7 @@ in { "󰤥" "󰤨" ]; - "on-click-right" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --nmtui"; + "on-click-right" = " kitty -e nmtui"; }; "network#speed" = { @@ -493,43 +494,6 @@ in { "tooltip-format" = "Hyprpicker"; }; - "custom/file_manager" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --files"; - tooltip = true; - "tooltip-format" = "File Manager"; - }; - - "custom/tty" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/WaybarScripts.sh --term"; - tooltip = true; - "tooltip-format" = "Launch Terminal"; - }; - - "custom/browser" = { - format = " "; - "on-click" = "xdg-open https://"; - tooltip = true; - "tooltip-format" = "Launch Browser"; - }; - - "custom/settings" = { - format = " "; - "on-click" = "$HOME/.config/hypr/scripts/Kool_Quick_Settings.sh"; - tooltip = true; - "tooltip-format" = "Launch KooL Hyprland Settings Menu"; - }; - - "custom/cycle_wall" = { - format = " "; - "on-click" = "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh"; - "on-click-right" = "$HOME/.config/hypr/UserScripts/WallpaperRandom.sh"; - "on-click-middle" = "$HOME/.config/hypr/scripts/WaybarStyles.sh"; - tooltip = true; - "tooltip-format" = "Left Click: Wallpaper Menu\nMiddle Click: Random wallpaper\nRight Click: Waybar Styles Menu"; - }; - "custom/hypridle" = { format = "󱫗 "; "return-type" = "json"; @@ -541,13 +505,6 @@ in { "on-click-right" = "hyprlock"; }; - "custom/keyboard" = { - exec = "cat $HOME/.cache/kb_layout"; - interval = 1; - format = " {}"; - "on-click" = "$HOME/.config/hypr/scripts/SwitchKeyboardLayout.sh"; - }; - "custom/lock" = { format = "󰌾"; "on-click" = "$HOME/.config/hypr/scripts/LockScreen.sh"; diff --git a/modules/home/waybar/waybar-jak-oglo-simple.nix b/modules/home/waybar/waybar-jak-oglo-simple.nix index a5f8660..d84c8e3 100644 --- a/modules/home/waybar/waybar-jak-oglo-simple.nix +++ b/modules/home/waybar/waybar-jak-oglo-simple.nix @@ -661,7 +661,7 @@ in { "custom/weather" = { "return-type" = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-jerry.nix b/modules/home/waybar/waybar-jerry.nix index 96e3c1f..3d9890b 100644 --- a/modules/home/waybar/waybar-jerry.nix +++ b/modules/home/waybar/waybar-jerry.nix @@ -1,9 +1,9 @@ -{ pkgs -, config -, lib -, ... -}: -let +{ + pkgs, + config, + lib, + ... +}: let terminal = "kitty"; base00 = "0F1419"; base01 = "131721"; @@ -20,337 +20,337 @@ let base0E = "D2A6FF"; base0F = "E6B673"; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; - modules-center = [ "network" "pulseaudio" "cpu" "hyprland/workspaces" "memory" "disk" "clock" ]; # Eterna: [ "hyprland/window" ] - modules-left = [ "custom/startmenu" "hyprland/window" ]; # Eternal: [ "hyprland/workspaces" "cpu" "memory" "network" ] - modules-right = [ "tray" "idle_inhibitor" "custom/notification" "battery" "custom/exit" ]; # Eternal: [ "idle_inhibitor" "pulseaudio" "clock" "custom/notification" "tray" ] + modules-center = ["network" "pulseaudio" "cpu" "hyprland/workspaces" "memory" "disk" "clock"]; # Eterna: [ "hyprland/window" ] + modules-left = ["custom/startmenu" "hyprland/window"]; # Eternal: [ "hyprland/workspaces" "cpu" "memory" "network" ] + modules-right = ["tray" "idle_inhibitor" "custom/notification" "battery" "custom/exit"]; # Eternal: [ "idle_inhibitor" "pulseaudio" "clock" "custom/notification" "tray" ] - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "clock" = { - format = '' {:%H:%M}''; - /* + "clock" = { + format = '' {:%H:%M}''; + /* ''{: %I:%M %p}''; */ - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }{calendar}"; - }; - "hyprland/window" = { - max-length = 60; - separate-outputs = false; - }; - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - on-click = "${terminal} -e btop"; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - on-click = "${terminal} -e btop"; - }; - "disk" = { - format = " {free}"; - tooltip = true; - # Not working with zaneyos window open then closes - #on-click = "${terminal} -e sh -c df -h ; read"; - }; - "network" = { - format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; - format-ethernet = " {bandwidthDownBits}"; - format-wifi = " {bandwidthDownBits}"; - format-disconnected = "󰤮"; - tooltip = false; - on-click = "${terminal} -e btop"; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ "" "" "" ]; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }{calendar}"; }; - on-click = "pavucontrol"; - }; - "custom/exit" = { - tooltip = false; - format = "⏻"; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = " "; - # exec = "rofi -show drun"; - on-click = "rofi -show drun"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = " "; - deactivated = " "; + "hyprland/window" = { + max-length = 60; + separate-outputs = false; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + on-click = "${terminal} -e btop"; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "swaync-client -t"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + on-click = "${terminal} -e btop"; + }; + "disk" = { + format = " {free}"; + tooltip = true; + # Not working with zaneyos window open then closes + #on-click = "${terminal} -e sh -c df -h ; read"; + }; + "network" = { + format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; + format-ethernet = " {bandwidthDownBits}"; + format-wifi = " {bandwidthDownBits}"; + format-disconnected = "󰤮"; + tooltip = false; + on-click = "${terminal} -e btop"; + }; + "tray" = { + spacing = 12; + }; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + }; + "custom/exit" = { + tooltip = false; + format = "⏻"; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = " "; + # exec = "rofi -show drun"; + on-click = "rofi -show drun"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = " "; + deactivated = " "; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "swaync-client -t"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + on-click = ""; + tooltip = false; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; - on-click = ""; - tooltip = false; - }; - } - ]; - style = concatStrings [ - '' - * { - font-size: 16px; - font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif; - font-weight: bold; } - window#waybar { - /* + ]; + style = concatStrings [ + '' + * { + font-size: 16px; + font-family: JetBrainsMono Nerd Font, Font Awesome, sans-serif; + font-weight: bold; + } + window#waybar { + /* + + background-color: rgba(26,27,38,0); + border-bottom: 1px solid rgba(26,27,38,0); + border-radius: 0px; + color: #${base0F}; + */ background-color: rgba(26,27,38,0); border-bottom: 1px solid rgba(26,27,38,0); border-radius: 0px; color: #${base0F}; - */ - - background-color: rgba(26,27,38,0); - border-bottom: 1px solid rgba(26,27,38,0); - border-radius: 0px; - color: #${base0F}; - } - #workspaces { - /* - Eternal - background: linear-gradient(180deg, #${base00}, #${base01}); - margin: 5px 5px 5px 0px; - padding: 0px 10px; - border-radius: 0px 15px 50px 0px; + } + #workspaces { + /* + Eternal + background: linear-gradient(180deg, #${base00}, #${base01}); + margin: 5px 5px 5px 0px; + padding: 0px 10px; + border-radius: 0px 15px 50px 0px; + border: 0px; + font-style: normal; + color: #${base00}; + */ + background: linear-gradient(45deg, #${base01}, #${base01}); + margin: 5px; + padding: 0px 1px; + border-radius: 15px; border: 0px; font-style: normal; color: #${base00}; - */ - background: linear-gradient(45deg, #${base01}, #${base01}); - margin: 5px; - padding: 0px 1px; - border-radius: 15px; - border: 0px; - font-style: normal; - color: #${base00}; - } - #workspaces button { - padding: 0px 5px; - margin: 4px 3px; - border-radius: 15px; - border: 0px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 0.5; - transition: all 0.3s ease-in-out; - } - #workspaces button.active { - padding: 0px 5px; - margin: 4px 3px; - border-radius: 15px; - border: 0px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 1.0; - min-width: 40px; - transition: all 0.3s ease-in-out; - } - #workspaces button:hover { - border-radius: 15px; - color: #${base00}; - background: linear-gradient(45deg, #${base0D}, #${base0E}); - opacity: 0.8; - } - tooltip { - background: #${base00}; - border: 1px solid #${base0E}; - border-radius: 10px; - } - tooltip label { - color: #${base07}; - } - #window { - /* - Eternal + } + #workspaces button { + padding: 0px 5px; + margin: 4px 3px; + border-radius: 15px; + border: 0px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 0.5; + transition: all 0.3s ease-in-out; + } + #workspaces button.active { + padding: 0px 5px; + margin: 4px 3px; + border-radius: 15px; + border: 0px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 1.0; + min-width: 40px; + transition: all 0.3s ease-in-out; + } + #workspaces button:hover { + border-radius: 15px; + color: #${base00}; + background: linear-gradient(45deg, #${base0D}, #${base0E}); + opacity: 0.8; + } + tooltip { + background: #${base00}; + border: 1px solid #${base0E}; + border-radius: 10px; + } + tooltip label { + color: #${base07}; + } + #window { + /* + Eternal + color: #${base05}; + background: #${base00}; + border-radius: 15px; + margin: 5px; + padding: 2px 20px; + */ + margin: 5px; + padding: 2px 20px; + color: #${base05}; + background: #${base01}; + border-radius: 50px 15px 50px 15px; + } + #memory { + color: #${base0F}; + /* + Eternal + background: #${base00}; + border-radius: 50px 15px 50px 15px; + margin: 5px; + padding: 2px 20px; + */ + background: #${base01}; + margin: 5px; + padding: 2px 20px; + border-radius: 15px 50px 15px 50px; + } + #clock { + color: #${base0B}; + background: #${base00}; + border-radius: 15px 50px 15px 50px; + margin: 5px; + padding: 2px 20px; + } + #idle_inhibitor { + color: #${base0A}; + background: #${base00}; + border-radius: 50px 15px 50px 15px; + margin: 5px; + padding: 2px 20px; + } + #cpu { + color: #${base07}; + background: #${base00}; + border-radius: 50px 15px 50px 15px; + margin: 5px; + padding: 2px 20px; + } + #disk { + color: #${base0F}; + background: #${base00}; + border-radius: 15px 50px 15px 50px; + margin: 5px; + padding: 2px 20px; + } + #battery { + color: #${base08}; + background: #${base00}; + border-radius: 15px 50px 15px 50px; + margin: 5px; + padding: 2px 20px; + } + #network { + color: #${base09}; + background: #${base00}; + border-radius: 50px 15px 50px 15px; + margin: 5px; + padding: 2px 20px; + } + #tray { color: #${base05}; background: #${base00}; - border-radius: 15px; + border-radius: 15px 50px 15px 50px; margin: 5px; padding: 2px 20px; - */ - margin: 5px; - padding: 2px 20px; - color: #${base05}; - background: #${base01}; - border-radius: 50px 15px 50px 15px; - } - #memory { - color: #${base0F}; - /* - Eternal - background: #${base00}; + } + #pulseaudio { + color: #${base0D}; + /* + Eternal + background: #${base00}; + border-radius: 15px 50px 15px 50px; + margin: 5px; + padding: 2px 20px; + */ + background: #${base01}; + margin: 4px; + padding: 2px 20px; border-radius: 50px 15px 50px 15px; - margin: 5px; - padding: 2px 20px; - */ - background: #${base01}; - margin: 5px; - padding: 2px 20px; - border-radius: 15px 50px 15px 50px; - } - #clock { - color: #${base0B}; + } + #custom-notification { + color: #${base0C}; background: #${base00}; border-radius: 15px 50px 15px 50px; margin: 5px; padding: 2px 20px; - } - #idle_inhibitor { - color: #${base0A}; + } + #custom-startmenu { + color: #${base0E}; background: #${base00}; - border-radius: 50px 15px 50px 15px; - margin: 5px; + border-radius: 0px 15px 50px 0px; + margin: 5px 5px 5px 0px; padding: 2px 20px; - } - #cpu { - color: #${base07}; - background: #${base00}; - border-radius: 50px 15px 50px 15px; - margin: 5px; - padding: 2px 20px; - } - #disk { - color: #${base0F}; + } + #idle_inhibitor { + color: #${base09}; background: #${base00}; border-radius: 15px 50px 15px 50px; margin: 5px; padding: 2px 20px; - } - #battery { - color: #${base08}; - background: #${base00}; - border-radius: 15px 50px 15px 50px; - margin: 5px; - padding: 2px 20px; - } - #network { - color: #${base09}; - background: #${base00}; - border-radius: 50px 15px 50px 15px; - margin: 5px; - padding: 2px 20px; - } - #tray { - color: #${base05}; - background: #${base00}; - border-radius: 15px 50px 15px 50px; - margin: 5px; - padding: 2px 20px; - } - #pulseaudio { - color: #${base0D}; - /* - Eternal + } + #custom-exit { + color: #${base0E}; background: #${base00}; - border-radius: 15px 50px 15px 50px; - margin: 5px; + border-radius: 15px 0px 0px 50px; + margin: 5px 0px 5px 5px; padding: 2px 20px; - */ - background: #${base01}; - margin: 4px; - padding: 2px 20px; - border-radius: 50px 15px 50px 15px; - } - #custom-notification { - color: #${base0C}; - background: #${base00}; - border-radius: 15px 50px 15px 50px; - margin: 5px; - padding: 2px 20px; - } - #custom-startmenu { - color: #${base0E}; - background: #${base00}; - border-radius: 0px 15px 50px 0px; - margin: 5px 5px 5px 0px; - padding: 2px 20px; - } - #idle_inhibitor { - color: #${base09}; - background: #${base00}; - border-radius: 15px 50px 15px 50px; - margin: 5px; - padding: 2px 20px; - } - #custom-exit { - color: #${base0E}; - background: #${base00}; - border-radius: 15px 0px 0px 50px; - margin: 5px 0px 5px 5px; - padding: 2px 20px; - } - '' - ]; - }; -} + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-jwt-catppuccin.nix b/modules/home/waybar/waybar-jwt-catppuccin.nix index 02cfa59..3db7f3b 100644 --- a/modules/home/waybar/waybar-jwt-catppuccin.nix +++ b/modules/home/waybar/waybar-jwt-catppuccin.nix @@ -126,7 +126,7 @@ in { "margin-right" = 8; modules-left = [ - "custom/menu" + "custom/startmenu" "hyprland/workspaces" "custom/cava_mviz" "battery" @@ -156,16 +156,6 @@ in { }; }; - "custom/menu" = { - format = "  "; - # on-click = "pkill rofi || rofi -show drun -modi run,drun,filebrowser,window"; - on-click = "launch-nwg-menu"; - on-click-middle = "$HOME/.config/hypr/UserScripts/WallpaperSelect.sh"; - on-click-right = "$HOME/.config/hypr/scripts/WaybarLayout.sh"; - tooltip = true; - tooltip-format = "Left Click: Rofi Menu\nMiddle Click: Wallpaper Menu\nRight Click: Waybar Layout Menu"; - }; - # Integrated CAVA visualizer using the inline script above "custom/cava_mviz" = { exec = "${waybarCava}/bin/WaybarCava"; @@ -199,7 +189,7 @@ in { "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-jwt-transparent.nix b/modules/home/waybar/waybar-jwt-transparent.nix index 67b7799..4a8fc1b 100644 --- a/modules/home/waybar/waybar-jwt-transparent.nix +++ b/modules/home/waybar/waybar-jwt-transparent.nix @@ -96,7 +96,7 @@ in { "margin-right" = 8; modules-left = [ - "custom/menu" + "custom/startmenu" "hyprland/workspaces" "custom/cava_mviz" "battery" @@ -169,7 +169,7 @@ in { "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-jwt-ultradark.nix b/modules/home/waybar/waybar-jwt-ultradark.nix index e62d09b..59e9303 100644 --- a/modules/home/waybar/waybar-jwt-ultradark.nix +++ b/modules/home/waybar/waybar-jwt-ultradark.nix @@ -96,7 +96,7 @@ in { "margin-right" = 8; modules-left = [ - "custom/menu" + "custom/startmenu" "hyprland/workspaces" "custom/cava_mviz" "battery" @@ -169,7 +169,7 @@ in { "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-mecha.nix b/modules/home/waybar/waybar-mecha.nix index 06723f0..81f0ce6 100644 --- a/modules/home/waybar/waybar-mecha.nix +++ b/modules/home/waybar/waybar-mecha.nix @@ -179,7 +179,7 @@ in { "custom/weather" = { "return-type" = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-nekodyke.nix b/modules/home/waybar/waybar-nekodyke.nix index 0a9988e..11aebd0 100755 --- a/modules/home/waybar/waybar-nekodyke.nix +++ b/modules/home/waybar/waybar-nekodyke.nix @@ -1,306 +1,306 @@ -{ pkgs -, lib -, host -, config -, ... -}: -let +{ + pkgs, + lib, + host, + config, + ... +}: let betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)"; inherit (import ../../../hosts/${host}/variables.nix) clock24h; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; - margin-top = 6; - margin-left = 6; - margin-right = 6; - modules-center = [ "hyprland/workspaces" ]; - modules-left = [ - "custom/startmenu" - "cpu" - "memory" - "temperature" - "disk" - "hyprland/window" - "idle_inhibitor" - ]; - modules-right = [ - "pulseaudio" - "battery" - "custom/hyprbindings" - "custom/notification" - "clock" - "tray" - ]; - - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; - }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "pulseaudio/slider" = { - min = 0; - max = 100; - orientation = "horizontal"; - }; - "temperature" = { - format = " {temperatureC}°C "; - }; - "clock" = { - format = - if clock24h == true - then '' {:L%H:%M}'' - else '' {:L%I:%M %p}''; - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; - }; - "hyprland/window" = { - max-length = 22; - separate-outputs = false; - rewrite = { - "" = " 🙈 No Windows? "; - }; - }; - "memory" = { - interval = 5; - icon-size = 20; - format = " {}%"; - tooltip = true; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - }; - "disk" = { - format = "󱛟 {free}"; - tooltip = true; - }; - "network" = { - format-icons = [ - "󰤯" - "󰤟" - "󰤢" - "󰤥" - "󰤨" + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; + margin-top = 6; + margin-left = 6; + margin-right = 6; + modules-center = ["hyprland/workspaces"]; + modules-left = [ + "custom/startmenu" + "cpu" + "memory" + "temperature" + "disk" + "hyprland/window" + "idle_inhibitor" ]; - format-ethernet = " {bandwidthDownOctets}"; - format-wifi = "{icon} {signalStrength}%"; - format-disconnected = "󰤮"; - tooltip = false; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ - "" - "" - "" + modules-right = [ + "pulseaudio" + "battery" + "custom/hyprbindings" + "custom/notification" + "clock" + "tray" + ]; + + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; + }; + "pulseaudio/slider" = { + min = 0; + max = 100; + orientation = "horizontal"; + }; + "temperature" = { + format = " {temperatureC}°C "; + }; + "clock" = { + format = + if clock24h == true + then '' {:L%H:%M}'' + else '' {:L%I:%M %p}''; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; + }; + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + rewrite = { + "" = " 🙈 No Windows? "; + }; + }; + "memory" = { + interval = 5; + icon-size = 20; + format = " {}%"; + tooltip = true; + }; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; + "disk" = { + format = "󱛟 {free}"; + tooltip = true; + }; + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; }; - on-click = "sleep 0.1 && pavucontrol"; - scroll-step = 2; - }; - "custom/exit" = { - tooltip = false; - format = ""; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = ""; - # exec = "rofi -show drun"; - #on-click = "sleep 0.1 && rofi-launcher"; - on-click = "sleep 0.1 && nwg-drawer -mb 200 -mt 200 -mr 200 -ml 200"; - }; - "custom/hyprbindings" = { - tooltip = false; - format = "󱕴"; - on-click = "sleep 0.1 && list-keybinds"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + "tray" = { + spacing = 12; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "sleep 0.1 && pavucontrol"; + scroll-step = 2; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && task-waybar"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "custom/exit" = { + tooltip = false; + format = ""; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = ""; + # exec = "rofi -show drun"; + #on-click = "sleep 0.1 && rofi-launcher"; + on-click = "sleep 0.1 && nwg-drawer -mb 200 -mt 200 -mr 200 -ml 200"; + }; + "custom/hyprbindings" = { + tooltip = false; + format = "󱕴"; + on-click = "sleep 0.1 && list-keybinds"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && task-waybar"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + on-click = ""; + tooltip = false; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ - "󰁺" - "󰁻" - "󰁼" - "󰁽" - "󰁾" - "󰁿" - "󰂀" - "󰂁" - "󰂂" - "󰁹" - ]; - on-click = ""; - tooltip = false; - }; - } - ]; - style = concatStrings [ - '' - * { - font-family: JetBrainsMono Nerd Font Mono; - font-size: 16px; - border-radius: 0px; - border: none; - min-height: 0px; - margin: 0px; } - window#waybar { - background: #${config.lib.stylix.colors.base00}; - padding: 2px; - border-radius: 4px; - } - #workspaces { - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base00}; - border: 2px solid #${config.lib.stylix.colors.base0B}; - margin: 2px 4px; - padding: 5px 5px; - border-radius: 4px; - } - #workspaces button { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 16px; - color: #${config.lib.stylix.colors.base0B}; - background: #${config.lib.stylix.colors.base00}; + ]; + style = concatStrings [ + '' + * { + font-family: JetBrainsMono Nerd Font Mono; + font-size: 16px; + border-radius: 0px; + border: none; + min-height: 0px; + margin: 0px; + } + window#waybar { + background: #${config.lib.stylix.colors.base00}; + padding: 2px; + border-radius: 4px; + } + #workspaces { + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base00}; + border: 2px solid #${config.lib.stylix.colors.base0B}; + margin: 2px 4px; + padding: 5px 5px; + border-radius: 4px; + } + #workspaces button { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 16px; + color: #${config.lib.stylix.colors.base0B}; + background: #${config.lib.stylix.colors.base00}; - } - #workspaces button.active { - font-weight: bold; - padding: 0px 5px; - margin: 0px 3px; - border-radius: 4px; - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base0B}; - transition: ${betterTransition}; - opacity: 1.0; - min-width: 40px; - } - #workspaces button:hover { - font-weight: bold; - border-radius: 4px; - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base0B}; - opacity: 0.8; - } - tooltip { - background: #${config.lib.stylix.colors.base00}; - border: 1px solid #${config.lib.stylix.colors.base08}; - border-radius: 12px; - } - tooltip label { - color: #${config.lib.stylix.colors.base08}; - } - #window, #pulseaudio, #temperature, #cpu, #memory, #idle_inhibitor, #disk { - font-weight: bold; - margin: 2px 0px; - margin-right: 7px; - padding: 0px 18px; - background: #${config.lib.stylix.colors.base00}; - color: #${config.lib.stylix.colors.base0B}; - border: 2px solid #${config.lib.stylix.colors.base0B}; - border-radius: 4px; - } - #idle_inhibitor { - font-size: 28px; - } - #custom-startmenu { - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base0B}; - font-size: 22px; - padding: 0px 5px 0px 5px; - border-radius: 4px; - padding: 0px 8px; - margin: 0px; - margin-right:7px; + } + #workspaces button.active { + font-weight: bold; + padding: 0px 5px; + margin: 0px 3px; + border-radius: 4px; + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base0B}; + transition: ${betterTransition}; + opacity: 1.0; + min-width: 40px; + } + #workspaces button:hover { + font-weight: bold; + border-radius: 4px; + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base0B}; + opacity: 0.8; + } + tooltip { + background: #${config.lib.stylix.colors.base00}; + border: 1px solid #${config.lib.stylix.colors.base08}; + border-radius: 12px; + } + tooltip label { + color: #${config.lib.stylix.colors.base08}; + } + #window, #pulseaudio, #temperature, #cpu, #memory, #idle_inhibitor, #disk { + font-weight: bold; + margin: 2px 0px; + margin-right: 7px; + padding: 0px 18px; + background: #${config.lib.stylix.colors.base00}; + color: #${config.lib.stylix.colors.base0B}; + border: 2px solid #${config.lib.stylix.colors.base0B}; + border-radius: 4px; + } + #idle_inhibitor { + font-size: 28px; + } + #custom-startmenu { + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base0B}; + font-size: 22px; + padding: 0px 5px 0px 5px; + border-radius: 4px; + padding: 0px 8px; + margin: 0px; + margin-right:7px; - } - #custom-hyprbindings, #network, #battery, - #custom-notification, #clock, #custom-exit { - /* font-weight: bold; */ - font-size: 20px; - background: #${config.lib.stylix.colors.base00}; - color: #${config.lib.stylix.colors.base0B}; - margin: 2px 0px; - margin-right: 7px; - border: 2px solid #${config.lib.stylix.colors.base0B}; - border-radius: 4px; - padding: 0px 12px; - } - #tray{ - font-weight: bold; - font-size: 16px; - margin: 0px; - background: #${config.lib.stylix.colors.base0B}; - color: #${config.lib.stylix.colors.base00}; - border: 2px solid #${config.lib.stylix.colors.base0B}; - padding: 0px 18px; - margin: 0px 0px; - border-radius: 4px; - } - '' - ]; - }; -} + } + #custom-hyprbindings, #network, #battery, + #custom-notification, #clock, #custom-exit { + /* font-weight: bold; */ + font-size: 20px; + background: #${config.lib.stylix.colors.base00}; + color: #${config.lib.stylix.colors.base0B}; + margin: 2px 0px; + margin-right: 7px; + border: 2px solid #${config.lib.stylix.colors.base0B}; + border-radius: 4px; + padding: 0px 12px; + } + #tray{ + font-weight: bold; + font-size: 16px; + margin: 0px; + background: #${config.lib.stylix.colors.base0B}; + color: #${config.lib.stylix.colors.base00}; + border: 2px solid #${config.lib.stylix.colors.base0B}; + padding: 0px 18px; + margin: 0px 0px; + border-radius: 4px; + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-old-ddubsos.nix b/modules/home/waybar/waybar-old-ddubsos.nix index 89f3b8b..775fe46 100644 --- a/modules/home/waybar/waybar-old-ddubsos.nix +++ b/modules/home/waybar/waybar-old-ddubsos.nix @@ -260,7 +260,7 @@ in "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-pctrade-catppuccin.nix b/modules/home/waybar/waybar-pctrade-catppuccin.nix index d950cea..6802976 100644 --- a/modules/home/waybar/waybar-pctrade-catppuccin.nix +++ b/modules/home/waybar/waybar-pctrade-catppuccin.nix @@ -175,7 +175,7 @@ in # Weather widget (uses existing ddubsos Weather.py script if present) "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/waybar/waybar-simple.nix b/modules/home/waybar/waybar-simple.nix index 9ffb056..04f1ae0 100644 --- a/modules/home/waybar/waybar-simple.nix +++ b/modules/home/waybar/waybar-simple.nix @@ -1,305 +1,305 @@ -{ pkgs -, lib -, host -, config -, ... -}: -let +{ + pkgs, + lib, + host, + config, + ... +}: let inherit (import ../../../hosts/${host}/variables.nix) clock24h; in -with lib; { - # Configure & Theme Waybar - programs.waybar = { - enable = true; - package = pkgs.waybar; - settings = [ - { - layer = "top"; - position = "top"; - modules-center = [ "hyprland/workspaces" ]; - modules-left = [ - "custom/startmenu" - "custom/arrow6" - "pulseaudio" - "cpu" - "memory" - "idle_inhibitor" - "custom/arrow7" - "hyprland/window" - ]; - modules-right = [ - "custom/arrow4" - "custom/hyprbindings" - "custom/arrow3" - "custom/notification" - "custom/arrow3" - "custom/exit" - "battery" - "custom/arrow2" - "tray" - "custom/arrow1" - "clock" - ]; + with lib; { + # Configure & Theme Waybar + programs.waybar = { + enable = true; + package = pkgs.waybar; + settings = [ + { + layer = "top"; + position = "top"; + modules-center = ["hyprland/workspaces"]; + modules-left = [ + "custom/startmenu" + "custom/arrow6" + "pulseaudio" + "cpu" + "memory" + "idle_inhibitor" + "custom/arrow7" + "hyprland/window" + ]; + modules-right = [ + "custom/arrow4" + "custom/hyprbindings" + "custom/arrow3" + "custom/notification" + "custom/arrow3" + "custom/exit" + "battery" + "custom/arrow2" + "tray" + "custom/arrow1" + "clock" + ]; - "hyprland/workspaces" = { - format = "{name}"; - format-icons = { - default = " "; - active = " "; - urgent = " "; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-up = "hyprctl dispatch workspace e+1"; + on-scroll-down = "hyprctl dispatch workspace e-1"; }; - on-scroll-up = "hyprctl dispatch workspace e+1"; - on-scroll-down = "hyprctl dispatch workspace e-1"; - }; - "clock" = { - format = - if clock24h == true - then '' {:L%H:%M}'' - else '' {:L%I:%M %p}''; - tooltip = true; - tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; - }; - "hyprland/window" = { - max-length = 22; - separate-outputs = false; - rewrite = { - "" = " 🙈 No Windows? "; + "clock" = { + format = + if clock24h == true + then '' {:L%H:%M}'' + else '' {:L%I:%M %p}''; + tooltip = true; + tooltip-format = "{:%A, %d.%B %Y }\n{calendar}"; }; - }; - "memory" = { - interval = 5; - format = " {}%"; - tooltip = true; - }; - "cpu" = { - interval = 5; - format = " {usage:2}%"; - tooltip = true; - }; - "disk" = { - format = " {free}"; - tooltip = true; - }; - "network" = { - format-icons = [ - "󰤯" - "󰤟" - "󰤢" - "󰤥" - "󰤨" - ]; - format-ethernet = " {bandwidthDownOctets}"; - format-wifi = "{icon} {signalStrength}%"; - format-disconnected = "󰤮"; - tooltip = false; - }; - "tray" = { - spacing = 12; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = " {volume}%"; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = [ - "" - "" - "" + "hyprland/window" = { + max-length = 22; + separate-outputs = false; + rewrite = { + "" = " 🙈 No Windows? "; + }; + }; + "memory" = { + interval = 5; + format = " {}%"; + tooltip = true; + }; + "cpu" = { + interval = 5; + format = " {usage:2}%"; + tooltip = true; + }; + "disk" = { + format = " {free}"; + tooltip = true; + }; + "network" = { + format-icons = [ + "󰤯" + "󰤟" + "󰤢" + "󰤥" + "󰤨" ]; + format-ethernet = " {bandwidthDownOctets}"; + format-wifi = "{icon} {signalStrength}%"; + format-disconnected = "󰤮"; + tooltip = false; }; - on-click = "sleep 0.1 && pavucontrol"; - }; - "custom/exit" = { - tooltip = false; - format = ""; - on-click = "sleep 0.1 && wlogout"; - }; - "custom/startmenu" = { - tooltip = false; - format = ""; - on-click = "sleep 0.1 && rofi-launcher"; - }; - "custom/hyprbindings" = { - tooltip = false; - format = "󱕴"; - on-click = "sleep 0.1 && list-keybinds"; - }; - "idle_inhibitor" = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; + "tray" = { + spacing = 12; }; - tooltip = "true"; - }; - "custom/notification" = { - tooltip = false; - format = "{icon} {}"; - format-icons = { - notification = ""; - none = ""; - dnd-notification = ""; - dnd-none = ""; - inhibited-notification = ""; - inhibited-none = ""; - dnd-inhibited-notification = ""; - dnd-inhibited-none = ""; + "pulseaudio" = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + "" + ]; + }; + on-click = "sleep 0.1 && pavucontrol"; }; - return-type = "json"; - exec-if = "which swaync-client"; - exec = "swaync-client -swb"; - on-click = "sleep 0.1 && task-waybar"; - escape = true; - }; - "battery" = { - states = { - warning = 30; - critical = 15; + "custom/exit" = { + tooltip = false; + format = ""; + on-click = "sleep 0.1 && wlogout"; + }; + "custom/startmenu" = { + tooltip = false; + format = ""; + on-click = "sleep 0.1 && rofi-launcher"; + }; + "custom/hyprbindings" = { + tooltip = false; + format = "󱕴"; + on-click = "sleep 0.1 && list-keybinds"; + }; + "idle_inhibitor" = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + tooltip = "true"; + }; + "custom/notification" = { + tooltip = false; + format = "{icon} {}"; + format-icons = { + notification = ""; + none = ""; + dnd-notification = ""; + dnd-none = ""; + inhibited-notification = ""; + inhibited-none = ""; + dnd-inhibited-notification = ""; + dnd-inhibited-none = ""; + }; + return-type = "json"; + exec-if = "which swaync-client"; + exec = "swaync-client -swb"; + on-click = "sleep 0.1 && task-waybar"; + escape = true; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = "󰂄 {capacity}%"; + format-plugged = "󱘖 {capacity}%"; + format-icons = [ + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + on-click = ""; + tooltip = false; + }; + "custom/arrow1" = { + format = ""; + }; + "custom/arrow2" = { + format = ""; + }; + "custom/arrow3" = { + format = ""; + }; + "custom/arrow4" = { + format = ""; + }; + "custom/arrow5" = { + format = ""; + }; + "custom/arrow6" = { + format = ""; + }; + "custom/arrow7" = { + format = ""; }; - format = "{icon} {capacity}%"; - format-charging = "󰂄 {capacity}%"; - format-plugged = "󱘖 {capacity}%"; - format-icons = [ - "󰁺" - "󰁻" - "󰁼" - "󰁽" - "󰁾" - "󰁿" - "󰂀" - "󰂁" - "󰂂" - "󰁹" - ]; - on-click = ""; - tooltip = false; - }; - "custom/arrow1" = { - format = ""; - }; - "custom/arrow2" = { - format = ""; - }; - "custom/arrow3" = { - format = ""; - }; - "custom/arrow4" = { - format = ""; - }; - "custom/arrow5" = { - format = ""; - }; - "custom/arrow6" = { - format = ""; - }; - "custom/arrow7" = { - format = ""; - }; - } - ]; - style = concatStrings [ - '' - * { - font-family: JetBrainsMono Nerd Font Mono; - font-size: 14px; - border-radius: 0px; - border: none; - min-height: 0px; } - window#waybar { - background: #${config.lib.stylix.colors.base00}; - color: #${config.lib.stylix.colors.base05}; - } - #workspaces button { - padding: 0px 5px; - background: transparent; - color: #${config.lib.stylix.colors.base04}; - } - #workspaces button.active { - color: #${config.lib.stylix.colors.base08}; - } - #workspaces button:hover { - color: #${config.lib.stylix.colors.base08}; - } - tooltip { - background: #${config.lib.stylix.colors.base00}; - border: 1px solid #${config.lib.stylix.colors.base05}; - border-radius: 12px; - } - tooltip label { - color: #${config.lib.stylix.colors.base05}; - } - #window { - padding: 0px 10px; - } - #pulseaudio, #cpu, #memory, #idle_inhibitor { - padding: 0px 10px; - background: #${config.lib.stylix.colors.base04}; - color: #${config.lib.stylix.colors.base00}; - } - #custom-startmenu { - color: #${config.lib.stylix.colors.base02}; - padding: 0px 14px; - font-size: 20px; - background: #${config.lib.stylix.colors.base0B}; - } - #custom-hyprbindings, #network, #battery, - #custom-notification, #custom-exit { - background: #${config.lib.stylix.colors.base0F}; - color: #${config.lib.stylix.colors.base00}; - padding: 0px 10px; - } - #tray { - background: #${config.lib.stylix.colors.base02}; - color: #${config.lib.stylix.colors.base00}; - padding: 0px 10px; - } - #clock { - font-weight: bold; - padding: 0px 10px; - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base0E}; - } - #custom-arrow1 { - font-size: 24px; - color: #${config.lib.stylix.colors.base0E}; - background: #${config.lib.stylix.colors.base02}; - } - #custom-arrow2 { - font-size: 24px; - color: #${config.lib.stylix.colors.base02}; - background: #${config.lib.stylix.colors.base0F}; - } - #custom-arrow3 { - font-size: 24px; - color: #${config.lib.stylix.colors.base00}; - background: #${config.lib.stylix.colors.base0F}; - } - #custom-arrow4 { - font-size: 24px; - color: #${config.lib.stylix.colors.base0F}; - background: transparent; - } - #custom-arrow6 { - font-size: 24px; - color: #${config.lib.stylix.colors.base0B}; - background: #${config.lib.stylix.colors.base04}; - } - #custom-arrow7 { - font-size: 24px; - color: #${config.lib.stylix.colors.base04}; - background: transparent; - } - '' - ]; - }; -} + ]; + style = concatStrings [ + '' + * { + font-family: JetBrainsMono Nerd Font Mono; + font-size: 14px; + border-radius: 0px; + border: none; + min-height: 0px; + } + window#waybar { + background: #${config.lib.stylix.colors.base00}; + color: #${config.lib.stylix.colors.base05}; + } + #workspaces button { + padding: 0px 5px; + background: transparent; + color: #${config.lib.stylix.colors.base04}; + } + #workspaces button.active { + color: #${config.lib.stylix.colors.base08}; + } + #workspaces button:hover { + color: #${config.lib.stylix.colors.base08}; + } + tooltip { + background: #${config.lib.stylix.colors.base00}; + border: 1px solid #${config.lib.stylix.colors.base05}; + border-radius: 12px; + } + tooltip label { + color: #${config.lib.stylix.colors.base05}; + } + #window { + padding: 0px 10px; + } + #pulseaudio, #cpu, #memory, #idle_inhibitor { + padding: 0px 10px; + background: #${config.lib.stylix.colors.base04}; + color: #${config.lib.stylix.colors.base00}; + } + #custom-startmenu { + color: #${config.lib.stylix.colors.base02}; + padding: 0px 14px; + font-size: 20px; + background: #${config.lib.stylix.colors.base0B}; + } + #custom-hyprbindings, #network, #battery, + #custom-notification, #custom-exit { + background: #${config.lib.stylix.colors.base0F}; + color: #${config.lib.stylix.colors.base00}; + padding: 0px 10px; + } + #tray { + background: #${config.lib.stylix.colors.base02}; + color: #${config.lib.stylix.colors.base00}; + padding: 0px 10px; + } + #clock { + font-weight: bold; + padding: 0px 10px; + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base0E}; + } + #custom-arrow1 { + font-size: 24px; + color: #${config.lib.stylix.colors.base0E}; + background: #${config.lib.stylix.colors.base02}; + } + #custom-arrow2 { + font-size: 24px; + color: #${config.lib.stylix.colors.base02}; + background: #${config.lib.stylix.colors.base0F}; + } + #custom-arrow3 { + font-size: 24px; + color: #${config.lib.stylix.colors.base00}; + background: #${config.lib.stylix.colors.base0F}; + } + #custom-arrow4 { + font-size: 24px; + color: #${config.lib.stylix.colors.base0F}; + background: transparent; + } + #custom-arrow6 { + font-size: 24px; + color: #${config.lib.stylix.colors.base0B}; + background: #${config.lib.stylix.colors.base04}; + } + #custom-arrow7 { + font-size: 24px; + color: #${config.lib.stylix.colors.base04}; + background: transparent; + } + '' + ]; + }; + } diff --git a/modules/home/waybar/waybar-tony.nix b/modules/home/waybar/waybar-tony.nix index cb4cbc3..f01fdca 100644 --- a/modules/home/waybar/waybar-tony.nix +++ b/modules/home/waybar/waybar-tony.nix @@ -200,7 +200,7 @@ in }; "custom/weather" = { return-type = "json"; - exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.config/waybar/scripts/Weather.py'"; + exec = "sh -lc 'WEATHER_ICON_STYLE=emoji WEATHER_TOOLTIP_MARKUP=1 ~/.local/bin/weather'"; interval = 600; tooltip = true; }; diff --git a/modules/home/wlogout/default.nix b/modules/home/wlogout/default.nix index e51de04..efc67e6 100644 --- a/modules/home/wlogout/default.nix +++ b/modules/home/wlogout/default.nix @@ -1,6 +1,4 @@ -{ config, ... }: - -{ +{config, ...}: { programs.wlogout = { enable = true; layout = [ diff --git a/modules/home/xdg.nix b/modules/home/xdg.nix index b485c29..765260e 100644 --- a/modules/home/xdg.nix +++ b/modules/home/xdg.nix @@ -1,14 +1,45 @@ -{ pkgs, ... }: { +{pkgs, host, lib, ...}: let + vars = import ../../hosts/${host}/variables.nix; +in { xdg = { enable = true; mime.enable = true; mimeApps = { enable = true; + # If the host defines mimeDefaultApps in hosts/${host}/variables.nix, + # use it to set per-host default applications. + defaultApplications = lib.mkIf (vars ? mimeDefaultApps) vars.mimeDefaultApps; + + # Example: set default handlers for MIME types and URL schemes. + # Uncomment the block below and adjust .desktop IDs to your preferred apps. + # defaultApplications = { + # # PDFs + # "application/pdf" = ["okular.desktop"]; # change to your preferred reader + # "application/x-pdf" = ["okular.desktop"]; # legacy alias + # + # # Web browser + # "x-scheme-handler/http" = ["google-chrome.desktop"]; # or brave-browser.desktop, firefox.desktop, etc. + # "x-scheme-handler/https" = ["google-chrome.desktop"]; + # "text/html" = ["google-chrome.desktop"]; + # + # # Text files + # "text/plain" = ["nvim.desktop"]; # or code.desktop, org.gnome.TextEditor.desktop + # + # # Images and video + # "image/png" = ["imv.desktop"]; # or org.gnome.eog.desktop + # "video/mp4" = ["mpv.desktop"]; # or vlc.desktop + # + # # Archives + # "application/zip" = ["org.gnome.FileRoller.desktop"]; # or xarchiver.desktop, peazip.desktop + # + # # Folders (file manager) + # "inode/directory" = ["thunar.desktop"]; # or org.gnome.Nautilus.desktop, org.kde.dolphin.desktop + # }; }; portal = { enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - configPackages = [ pkgs.hyprland ]; + extraPortals = [pkgs.xdg-desktop-portal-hyprland]; + configPackages = [pkgs.hyprland]; }; }; } diff --git a/modules/home/yazi/default.nix b/modules/home/yazi/default.nix index 2b758e2..9364039 100644 --- a/modules/home/yazi/default.nix +++ b/modules/home/yazi/default.nix @@ -1,10 +1,8 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let settings = import ./yazi.nix; keymap = import ./keymap.nix; theme = import ./theme.nix; -in -{ +in { programs.yazi = { enable = true; enableZshIntegration = true; diff --git a/modules/home/yazi/keymap.nix b/modules/home/yazi/keymap.nix index d4e4267..c8e2561 100644 --- a/modules/home/yazi/keymap.nix +++ b/modules/home/yazi/keymap.nix @@ -92,7 +92,7 @@ desc = "Move cursor down one page"; } { - on = [ "g" "g" ]; + on = ["g" "g"]; run = "arrow top"; desc = "Move cursor to the top"; } @@ -133,7 +133,7 @@ } { on = ""; - run = [ "toggle" "arrow 1" ]; + run = ["toggle" "arrow 1"]; desc = "Toggle the current selection state"; } { @@ -297,52 +297,52 @@ desc = "Jump to a file/directory via fzf"; } { - on = [ "m" "s" ]; + on = ["m" "s"]; run = "linemode size"; desc = "Linemode: size"; } { - on = [ "m" "p" ]; + on = ["m" "p"]; run = "linemode permissions"; desc = "Linemode: permissions"; } { - on = [ "m" "b" ]; + on = ["m" "b"]; run = "linemode btime"; desc = "Linemode: btime"; } { - on = [ "m" "m" ]; + on = ["m" "m"]; run = "linemode mtime"; desc = "Linemode: mtime"; } { - on = [ "m" "o" ]; + on = ["m" "o"]; run = "linemode owner"; desc = "Linemode: owner"; } { - on = [ "m" "n" ]; + on = ["m" "n"]; run = "linemode none"; desc = "Linemode: none"; } { - on = [ "c" "c" ]; + on = ["c" "c"]; run = "copy path"; desc = "Copy the file path"; } { - on = [ "c" "d" ]; + on = ["c" "d"]; run = "copy dirname"; desc = "Copy the directory path"; } { - on = [ "c" "f" ]; + on = ["c" "f"]; run = "copy filename"; desc = "Copy the filename"; } { - on = [ "c" "n" ]; + on = ["c" "n"]; run = "copy name_without_ext"; desc = "Copy the filename without extension"; } @@ -372,87 +372,87 @@ desc = "Goto the previous found"; } { - on = [ "," "m" ]; - run = [ "sort mtime --reverse=no" "linemode mtime" ]; + on = ["," "m"]; + run = ["sort mtime --reverse=no" "linemode mtime"]; desc = "Sort by modified time"; } { - on = [ "," "M" ]; - run = [ "sort mtime --reverse" "linemode mtime" ]; + on = ["," "M"]; + run = ["sort mtime --reverse" "linemode mtime"]; desc = "Sort by modified time (reverse)"; } { - on = [ "," "b" ]; - run = [ "sort btime --reverse=no" "linemode btime" ]; + on = ["," "b"]; + run = ["sort btime --reverse=no" "linemode btime"]; desc = "Sort by birth time"; } { - on = [ "," "B" ]; - run = [ "sort btime --reverse" "linemode btime" ]; + on = ["," "B"]; + run = ["sort btime --reverse" "linemode btime"]; desc = "Sort by birth time (reverse)"; } { - on = [ "," "e" ]; + on = ["," "e"]; run = "sort extension --reverse=no"; desc = "Sort by extension"; } { - on = [ "," "E" ]; + on = ["," "E"]; run = "sort extension --reverse"; desc = "Sort by extension (reverse)"; } { - on = [ "," "a" ]; + on = ["," "a"]; run = "sort alphabetical --reverse=no"; desc = "Sort alphabetically"; } { - on = [ "," "A" ]; + on = ["," "A"]; run = "sort alphabetical --reverse"; desc = "Sort alphabetically (reverse)"; } { - on = [ "," "n" ]; + on = ["," "n"]; run = "sort natural --reverse=no"; desc = "Sort naturally"; } { - on = [ "," "N" ]; + on = ["," "N"]; run = "sort natural --reverse"; desc = "Sort naturally (reverse)"; } { - on = [ "," "s" ]; - run = [ "sort size --reverse=no" "linemode size" ]; + on = ["," "s"]; + run = ["sort size --reverse=no" "linemode size"]; desc = "Sort by size"; } { - on = [ "," "S" ]; - run = [ "sort size --reverse" "linemode size" ]; + on = ["," "S"]; + run = ["sort size --reverse" "linemode size"]; desc = "Sort by size (reverse)"; } { - on = [ "," "r" ]; + on = ["," "r"]; run = "sort random --reverse=no"; desc = "Sort randomly"; } { - on = [ "g" "h" ]; + on = ["g" "h"]; run = "cd ~"; desc = "Go home"; } { - on = [ "g" "c" ]; + on = ["g" "c"]; run = "cd ~/.config"; desc = "Goto ~/.config"; } { - on = [ "g" "d" ]; + on = ["g" "d"]; run = "cd ~/Downloads"; desc = "Goto ~/Downloads"; } { - on = [ "g" "" ]; + on = ["g" ""]; run = "cd --interactive"; desc = "Jump interactively"; } @@ -544,7 +544,7 @@ ]; prepend_keymap = [ { - on = [ "g" "i" ]; + on = ["g" "i"]; run = "plugin lazygit"; desc = "run lazygit"; } @@ -682,7 +682,7 @@ desc = "Swipe to the previous file"; } { - on = [ "c" "c" ]; + on = ["c" "c"]; run = "copy cell"; desc = "Copy selected cell"; } @@ -781,7 +781,7 @@ } { on = "I"; - run = [ "move first-char" "insert" ]; + run = ["move first-char" "insert"]; desc = "Move to the BOL, and enter insert mode"; } { @@ -791,7 +791,7 @@ } { on = "A"; - run = [ "move eol" "insert --append" ]; + run = ["move eol" "insert --append"]; desc = "Move to the EOL, and enter append mode"; } { @@ -806,17 +806,17 @@ } { on = "V"; - run = [ "move bol" "visual" "move eol" ]; + run = ["move bol" "visual" "move eol"]; desc = "Select from BOL to EOL"; } { on = ""; - run = [ "move eol" "visual" "move bol" ]; + run = ["move eol" "visual" "move bol"]; desc = "Select from EOL to BOL"; } { on = ""; - run = [ "move bol" "visual" "move eol" ]; + run = ["move bol" "visual" "move eol"]; desc = "Select from BOL to EOL"; } { @@ -976,7 +976,7 @@ } { on = "D"; - run = [ "delete --cut" "move eol" ]; + run = ["delete --cut" "move eol"]; desc = "Cut until the EOL"; } { @@ -986,12 +986,12 @@ } { on = "C"; - run = [ "delete --cut --insert" "move eol" ]; + run = ["delete --cut --insert" "move eol"]; desc = "Cut until the EOL, and enter insert mode"; } { on = "x"; - run = [ "delete --cut" "move 1 --in-operating" ]; + run = ["delete --cut" "move 1 --in-operating"]; desc = "Cut the current character"; } { @@ -1109,7 +1109,7 @@ } { on = ""; - run = [ "close --submit" "close_input --submit" ]; + run = ["close --submit" "close_input --submit"]; desc = "Submit the completion and input"; } { diff --git a/modules/home/yazi/theme.nix b/modules/home/yazi/theme.nix index 77bee22..392eb24 100644 --- a/modules/home/yazi/theme.nix +++ b/modules/home/yazi/theme.nix @@ -11,24 +11,24 @@ tab_width = 1; border_symbol = "│"; }; - mode = { }; + mode = {}; status = { - overall = { bold = true; }; - sep_left = [ "░▒▓" "▓▒░" ]; - sep_right = [ "░▒▓" "▓▒░" ]; + overall = {bold = true;}; + sep_left = ["░▒▓" "▓▒░"]; + sep_right = ["░▒▓" "▓▒░"]; }; which = { cols = 3; separator = "  "; }; confirm = { - border = { fg = "gray"; }; + border = {fg = "gray";}; title = { fg = "blue"; bold = true; }; - content = { }; - list = { }; + content = {}; + list = {}; btn_yes = { bg = "green"; fg = "black"; @@ -39,39 +39,39 @@ fg = "black"; bold = true; }; - btn_labels = [ " [Y]es " " (N)o " ]; + btn_labels = [" [Y]es " " (N)o "]; }; spot = { - border = { fg = "blue"; }; - title = { fg = "blue"; }; - tbl_col = { fg = "blue"; }; + border = {fg = "blue";}; + title = {fg = "blue";}; + tbl_col = {fg = "blue";}; tbl_cell = { fg = "yellow"; reversed = true; }; }; notify = { - title_info = { fg = "green"; }; - title_warn = { fg = "yellow"; }; - title_error = { fg = "red"; }; + title_info = {fg = "green";}; + title_warn = {fg = "yellow";}; + title_error = {fg = "red";}; icon_info = ""; icon_warn = ""; icon_error = ""; }; - pick = { }; - input = { }; + pick = {}; + input = {}; cmp = { - active = { reversed = true; }; - inactive = { }; + active = {reversed = true;}; + inactive = {}; icon_file = ""; icon_folder = ""; icon_command = ""; }; - tasks = { }; - help = { }; - filetype = { }; + tasks = {}; + help = {}; + filetype = {}; icon = { - globs = [ ]; + globs = []; dirs = [ { name = ".config"; diff --git a/modules/home/yazi/yazi.nix b/modules/home/yazi/yazi.nix index 1fe053b..71c8b74 100644 --- a/modules/home/yazi/yazi.nix +++ b/modules/home/yazi/yazi.nix @@ -1,7 +1,7 @@ { settings = { manager = { - ratio = [ 1 4 3 ]; + ratio = [1 4 3]; sort_by = "alphabetical"; sort_sensitive = false; sort_reverse = false; @@ -11,7 +11,7 @@ show_hidden = false; show_symlink = true; scrolloff = 5; - mouse_events = [ "click" "scroll" ]; + mouse_events = ["click" "scroll"]; title_format = "Yazi: {cwd}"; }; preview = { @@ -25,7 +25,7 @@ image_quality = 75; sixel_fraction = 15; ueberzug_scale = 1; - ueberzug_offset = [ 0 0 0 0 ]; + ueberzug_offset = [0 0 0 0]; }; opener = { edit = [ @@ -135,40 +135,39 @@ rules = [ { name = "*/"; - use = [ "edit" "open" "reveal" ]; + use = ["edit" "open" "reveal"]; } { mime = "text/*"; - use = [ "edit" "reveal" ]; + use = ["edit" "reveal"]; } { mime = "image/*"; - use = [ "open" "reveal" ]; + use = ["open" "reveal"]; } { mime = "{audio,video}/*"; - use = [ "play" "reveal" ]; + use = ["play" "reveal"]; } { - mime = - "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}"; - use = [ "extract" "reveal" ]; + mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}"; + use = ["extract" "reveal"]; } { mime = "application/{json,ndjson}"; - use = [ "edit" "reveal" ]; + use = ["edit" "reveal"]; } { mime = "*/javascript"; - use = [ "edit" "reveal" ]; + use = ["edit" "reveal"]; } { mime = "inode/empty"; - use = [ "edit" "reveal" ]; + use = ["edit" "reveal"]; } { name = "*"; - use = [ "open" "reveal" ]; + use = ["open" "reveal"]; } ]; }; @@ -177,16 +176,18 @@ macro_workers = 10; bizarre_retry = 3; image_alloc = 536870912; - image_bound = [ 0 0 ]; + image_bound = [0 0]; suppress_preload = false; }; plugin = { - fetchers = [{ - id = "mime"; - name = "*"; - run = "mime"; - prio = "high"; - }]; + fetchers = [ + { + id = "mime"; + name = "*"; + run = "mime"; + prio = "high"; + } + ]; spotters = [ { name = "*/"; @@ -278,13 +279,11 @@ run = "pdf"; } { - mime = - "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}"; + mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}"; run = "archive"; } { - mime = - "application/{debian*-package,redhat-package-manager,rpm,android.package-archive}"; + mime = "application/{debian*-package,redhat-package-manager,rpm,android.package-archive}"; run = "archive"; } { @@ -337,47 +336,46 @@ cursor_blink = false; cd_title = "Change directory:"; cd_origin = "top-center"; - cd_offset = [ 0 2 50 3 ]; - create_title = [ "Create:" "Create (dir):" ]; + cd_offset = [0 2 50 3]; + create_title = ["Create:" "Create (dir):"]; create_origin = "top-center"; - create_offset = [ 0 2 50 3 ]; + create_offset = [0 2 50 3]; rename_title = "Rename:"; rename_origin = "hovered"; - rename_offset = [ 0 1 50 3 ]; + rename_offset = [0 1 50 3]; filter_title = "Filter:"; filter_origin = "top-center"; - filter_offset = [ 0 2 50 3 ]; - find_title = [ "Find next:" "Find previous:" ]; + filter_offset = [0 2 50 3]; + find_title = ["Find next:" "Find previous:"]; find_origin = "top-center"; - find_offset = [ 0 2 50 3 ]; + find_offset = [0 2 50 3]; search_title = "Search via {n}:"; search_origin = "top-center"; - search_offset = [ 0 2 50 3 ]; - shell_title = [ "Shell:" "Shell (block):" ]; + search_offset = [0 2 50 3]; + shell_title = ["Shell:" "Shell (block):"]; shell_origin = "top-center"; - shell_offset = [ 0 2 50 3 ]; + shell_offset = [0 2 50 3]; }; confirm = { trash_title = "Trash {n} selected file{s}?"; trash_origin = "center"; - trash_offset = [ 0 0 70 20 ]; + trash_offset = [0 0 70 20]; delete_title = "Permanently delete {n} selected file{s}?"; delete_origin = "center"; - delete_offset = [ 0 0 70 20 ]; + delete_offset = [0 0 70 20]; overwrite_title = "Overwrite file?"; overwrite_content = "Will overwrite the following file:"; overwrite_origin = "center"; - overwrite_offset = [ 0 0 50 15 ]; + overwrite_offset = [0 0 50 15]; quit_title = "Quit?"; - quit_content = - "The following tasks are still running, are you sure you want to quit?"; + quit_content = "The following tasks are still running, are you sure you want to quit?"; quit_origin = "center"; - quit_offset = [ 0 0 50 15 ]; + quit_offset = [0 0 50 15]; }; pick = { open_title = "Open with:"; open_origin = "hovered"; - open_offset = [ 0 1 50 7 ]; + open_offset = [0 1 50 7]; }; which = { sort_by = "none"; diff --git a/modules/home/zoxide.nix b/modules/home/zoxide.nix index 9ab1845..153d85c 100644 --- a/modules/home/zoxide.nix +++ b/modules/home/zoxide.nix @@ -10,4 +10,3 @@ _: { }; }; } - diff --git a/modules/home/zsh/default.nix b/modules/home/zsh/default.nix index 50e0f7d..5df8b59 100644 --- a/modules/home/zsh/default.nix +++ b/modules/home/zsh/default.nix @@ -1,7 +1,9 @@ -{ profile -, pkgs -, lib -, ... +{ + profile, + pkgs, + lib, + config, + ... }: { imports = [ ./zshrc-personal.nix @@ -9,10 +11,11 @@ programs.zsh = { enable = true; + dotDir = config.home.homeDirectory; autosuggestion.enable = true; syntaxHighlighting = { enable = true; - highlighters = [ "main" "brackets" "pattern" "regexp" "root" "line" ]; + highlighters = ["main" "brackets" "pattern" "regexp" "root" "line"]; }; historySubstringSearch.enable = true; @@ -50,6 +53,7 @@ ''; shellAliases = { + nix-fmt-all = "nix fmt ./"; sv = "sudo nvim"; v = "nvim"; c = "clear"; diff --git a/modules/home/zsh/zshrc-personal.nix b/modules/home/zsh/zshrc-personal.nix index 545cfd2..cd3b820 100644 --- a/modules/home/zsh/zshrc-personal.nix +++ b/modules/home/zsh/zshrc-personal.nix @@ -1,20 +1,19 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ zsh ]; +{pkgs, ...}: { + home.packages = with pkgs; [zsh]; home.file."./.zshrc-personal".text = '' - # This file allows you to define your own aliases, functions, etc - # below are just some examples of what you can use this file for - - #!/usr/bin/env zsh - # Set defaults - # - #export EDITOR="nvim" - #export VISUAL="nvim" - - #alias c="clear" - + # This file allows you to define your own aliases, functions, etc + # below are just some examples of what you can use this file for + + #!/usr/bin/env zsh + # Set defaults + # + #export EDITOR="nvim" + #export VISUAL="nvim" + + #alias c="clear" + ''; } - diff --git a/profiles/amd-hybrid/default.nix b/profiles/amd-nvidia-hybrid/default.nix similarity index 85% rename from profiles/amd-hybrid/default.nix rename to profiles/amd-nvidia-hybrid/default.nix index fa239e4..783bca3 100644 --- a/profiles/amd-hybrid/default.nix +++ b/profiles/amd-nvidia-hybrid/default.nix @@ -1,9 +1,6 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../hosts/${host}/variables.nix) amdgpuID nvidiaID; - -in -{ +in { imports = [ ../../hosts/${host} ../../modules/drivers @@ -13,8 +10,8 @@ in # Enable AMD+NVIDIA hybrid drivers (Prime offload with AMD as primary) drivers.nvidia-amd-hybrid = { enable = true; - amdgpuBusID = "${amdgpuID}"; - nvidiaBusID = "${nvidiaID}"; + amdgpuBusId = "${amdgpuID}"; + nvidiaBusId = "${nvidiaID}"; }; # Ensure other driver toggles are off for this profile diff --git a/profiles/amd/default.nix b/profiles/amd/default.nix index 9c1d8ce..1b5506b 100644 --- a/profiles/amd/default.nix +++ b/profiles/amd/default.nix @@ -1,4 +1,4 @@ -{ host, ... }: { +{host, ...}: { imports = [ ../../hosts/${host} ../../modules/drivers diff --git a/profiles/intel/default.nix b/profiles/intel/default.nix index cc0d3d6..f99a114 100644 --- a/profiles/intel/default.nix +++ b/profiles/intel/default.nix @@ -1,4 +1,4 @@ -{ host, ... }: { +{host, ...}: { imports = [ ../../hosts/${host} ../../modules/drivers diff --git a/profiles/nvidia-laptop/default.nix b/profiles/nvidia-laptop/default.nix index 6d58b83..2c4444b 100644 --- a/profiles/nvidia-laptop/default.nix +++ b/profiles/nvidia-laptop/default.nix @@ -1,8 +1,6 @@ -{ host, ... }: -let +{host, ...}: let inherit (import ../../hosts/${host}/variables.nix) intelID nvidiaID; -in -{ +in { imports = [ ../../hosts/${host} ../../modules/drivers diff --git a/profiles/nvidia/default.nix b/profiles/nvidia/default.nix index 6beee5f..5b50370 100644 --- a/profiles/nvidia/default.nix +++ b/profiles/nvidia/default.nix @@ -1,4 +1,4 @@ -{ host, ... }: { +{host, ...}: { imports = [ ../../hosts/${host} ../../modules/drivers diff --git a/profiles/vm/default.nix b/profiles/vm/default.nix index cf51f94..130c1b7 100644 --- a/profiles/vm/default.nix +++ b/profiles/vm/default.nix @@ -1,4 +1,4 @@ -{ host, ... }: { +{host, ...}: { imports = [ ../../hosts/${host} ../../modules/drivers diff --git a/wallpapers/150883-799711528_small.mp4 b/wallpapers/150883-799711528_small.mp4 new file mode 100644 index 0000000..74ca43b Binary files /dev/null and b/wallpapers/150883-799711528_small.mp4 differ diff --git a/wallpapers/3d-door.webp b/wallpapers/3d-door.webp new file mode 100644 index 0000000..eb5eac9 Binary files /dev/null and b/wallpapers/3d-door.webp differ diff --git a/wallpapers/Anime-Lanscape.webp b/wallpapers/Anime-Lanscape.webp new file mode 100644 index 0000000..e605c2a Binary files /dev/null and b/wallpapers/Anime-Lanscape.webp differ diff --git a/wallpapers/Blue-Water-Cave.webp b/wallpapers/Blue-Water-Cave.webp new file mode 100644 index 0000000..ca3b9a0 Binary files /dev/null and b/wallpapers/Blue-Water-Cave.webp differ diff --git a/wallpapers/Earth-from-space-dark.mp4 b/wallpapers/Earth-from-space-dark.mp4 new file mode 100644 index 0000000..fdc8882 Binary files /dev/null and b/wallpapers/Earth-from-space-dark.mp4 differ diff --git a/wallpapers/Office-Rain-2k..mp4 b/wallpapers/Office-Rain-2k..mp4 new file mode 100644 index 0000000..2d4caeb Binary files /dev/null and b/wallpapers/Office-Rain-2k..mp4 differ diff --git a/wallpapers/Phonebooth-transporter.png b/wallpapers/Phonebooth-transporter.png new file mode 100644 index 0000000..88d1d87 Binary files /dev/null and b/wallpapers/Phonebooth-transporter.png differ diff --git a/wallpapers/Plasma Wallpaper 1955.jpg b/wallpapers/Plasma Wallpaper 1955.jpg new file mode 100644 index 0000000..f91984b Binary files /dev/null and b/wallpapers/Plasma Wallpaper 1955.jpg differ diff --git a/wallpapers/Purple-Nightmare.webp b/wallpapers/Purple-Nightmare.webp new file mode 100644 index 0000000..0e2350e Binary files /dev/null and b/wallpapers/Purple-Nightmare.webp differ diff --git a/wallpapers/River-Moutains-Cherry-Blosums.webp b/wallpapers/River-Moutains-Cherry-Blosums.webp new file mode 100644 index 0000000..fa72d94 Binary files /dev/null and b/wallpapers/River-Moutains-Cherry-Blosums.webp differ diff --git a/wallpapers/Smoky-rocks-by-sea.jpg b/wallpapers/Smoky-rocks-by-sea.jpg new file mode 100644 index 0000000..3d3b8f9 Binary files /dev/null and b/wallpapers/Smoky-rocks-by-sea.jpg differ diff --git a/wallpapers/Surf-n-rocks..mp4 b/wallpapers/Surf-n-rocks..mp4 new file mode 100644 index 0000000..1352e25 Binary files /dev/null and b/wallpapers/Surf-n-rocks..mp4 differ diff --git a/wallpapers/Waterfall-2..mp4 b/wallpapers/Waterfall-2..mp4 new file mode 100644 index 0000000..7505f43 Binary files /dev/null and b/wallpapers/Waterfall-2..mp4 differ diff --git a/wallpapers/Waterfall.mp4 b/wallpapers/Waterfall.mp4 new file mode 100644 index 0000000..712ecd2 Binary files /dev/null and b/wallpapers/Waterfall.mp4 differ diff --git a/wallpapers/a_rocky_beach_with_water_in_the_background.webp b/wallpapers/a_rocky_beach_with_water_in_the_background.webp new file mode 100644 index 0000000..6737f07 Binary files /dev/null and b/wallpapers/a_rocky_beach_with_water_in_the_background.webp differ diff --git a/wallpapers/alena-aenami-cold.webp b/wallpapers/alena-aenami-cold.webp new file mode 100644 index 0000000..a1e446d Binary files /dev/null and b/wallpapers/alena-aenami-cold.webp differ diff --git a/wallpapers/anime-girl-dragon-warrior-moewalls-com.mp4 b/wallpapers/anime-girl-dragon-warrior-moewalls-com.mp4 new file mode 100644 index 0000000..a2af1d6 Binary files /dev/null and b/wallpapers/anime-girl-dragon-warrior-moewalls-com.mp4 differ diff --git a/wallpapers/astralbed.webp b/wallpapers/astralbed.webp new file mode 100644 index 0000000..189102c Binary files /dev/null and b/wallpapers/astralbed.webp differ diff --git a/wallpapers/black-hole-universe-honkai-star-rail-moewalls-com.mp4 b/wallpapers/black-hole-universe-honkai-star-rail-moewalls-com.mp4 new file mode 100644 index 0000000..923adee Binary files /dev/null and b/wallpapers/black-hole-universe-honkai-star-rail-moewalls-com.mp4 differ diff --git a/wallpapers/cyber.webp b/wallpapers/cyber.webp new file mode 100644 index 0000000..4ea01b5 Binary files /dev/null and b/wallpapers/cyber.webp differ diff --git a/wallpapers/cyberpunk-2077-phantom-liberty-moewalls-com.mp4 b/wallpapers/cyberpunk-2077-phantom-liberty-moewalls-com.mp4 new file mode 100644 index 0000000..904d84a Binary files /dev/null and b/wallpapers/cyberpunk-2077-phantom-liberty-moewalls-com.mp4 differ diff --git a/wallpapers/fantasy-Landscape.webp b/wallpapers/fantasy-Landscape.webp new file mode 100644 index 0000000..5bb8b65 Binary files /dev/null and b/wallpapers/fantasy-Landscape.webp differ diff --git a/wallpapers/honkai-star-rail-penacony-dreams-edge-moewalls-com.mp4 b/wallpapers/honkai-star-rail-penacony-dreams-edge-moewalls-com.mp4 new file mode 100644 index 0000000..ff0e320 Binary files /dev/null and b/wallpapers/honkai-star-rail-penacony-dreams-edge-moewalls-com.mp4 differ diff --git a/wallpapers/lake-at-sunrise.mp4 b/wallpapers/lake-at-sunrise.mp4 new file mode 100644 index 0000000..f0889c0 Binary files /dev/null and b/wallpapers/lake-at-sunrise.mp4 differ diff --git a/wallpapers/lofi-Urban-Nightscape.webp b/wallpapers/lofi-Urban-Nightscape.webp new file mode 100644 index 0000000..9eb66e7 Binary files /dev/null and b/wallpapers/lofi-Urban-Nightscape.webp differ diff --git a/wallpapers/midnight-reflections-moonlit-sea.webp b/wallpapers/midnight-reflections-moonlit-sea.webp new file mode 100644 index 0000000..f312700 Binary files /dev/null and b/wallpapers/midnight-reflections-moonlit-sea.webp differ diff --git a/wallpapers/night-stars-mtn..mp4 b/wallpapers/night-stars-mtn..mp4 new file mode 100644 index 0000000..aac9415 Binary files /dev/null and b/wallpapers/night-stars-mtn..mp4 differ diff --git a/wallpapers/ocean-surf-2..mp4 b/wallpapers/ocean-surf-2..mp4 new file mode 100644 index 0000000..b790bfe Binary files /dev/null and b/wallpapers/ocean-surf-2..mp4 differ diff --git a/wallpapers/ocean-surf.mp4 b/wallpapers/ocean-surf.mp4 new file mode 100644 index 0000000..92bc26d Binary files /dev/null and b/wallpapers/ocean-surf.mp4 differ diff --git a/wallpapers/pastel-lake.webp b/wallpapers/pastel-lake.webp new file mode 100644 index 0000000..8a63721 Binary files /dev/null and b/wallpapers/pastel-lake.webp differ diff --git a/wallpapers/purple-circle-mountain.webp b/wallpapers/purple-circle-mountain.webp new file mode 100644 index 0000000..9c34857 Binary files /dev/null and b/wallpapers/purple-circle-mountain.webp differ diff --git a/wallpapers/purple-sky-rocks-water.webp b/wallpapers/purple-sky-rocks-water.webp new file mode 100644 index 0000000..b0e5e07 Binary files /dev/null and b/wallpapers/purple-sky-rocks-water.webp differ diff --git a/wallpapers/purple_gasstation_abstract_dark_night.jpg b/wallpapers/purple_gasstation_abstract_dark_night.jpg new file mode 100644 index 0000000..74e6733 Binary files /dev/null and b/wallpapers/purple_gasstation_abstract_dark_night.jpg differ diff --git a/wallpapers/river-rocks..mp4 b/wallpapers/river-rocks..mp4 new file mode 100644 index 0000000..a1041ca Binary files /dev/null and b/wallpapers/river-rocks..mp4 differ diff --git a/wallpapers/rocks-crashing-surf..mp4 b/wallpapers/rocks-crashing-surf..mp4 new file mode 100644 index 0000000..482dba8 Binary files /dev/null and b/wallpapers/rocks-crashing-surf..mp4 differ diff --git a/wallpapers/shiny-waves..mp4 b/wallpapers/shiny-waves..mp4 new file mode 100644 index 0000000..ae24a0e Binary files /dev/null and b/wallpapers/shiny-waves..mp4 differ diff --git a/wallpapers/space-warp-tunnel..mp4 b/wallpapers/space-warp-tunnel..mp4 new file mode 100644 index 0000000..5ae94e4 Binary files /dev/null and b/wallpapers/space-warp-tunnel..mp4 differ diff --git a/wallpapers/still-water-rocks.mp4 b/wallpapers/still-water-rocks.mp4 new file mode 100644 index 0000000..61d7808 Binary files /dev/null and b/wallpapers/still-water-rocks.mp4 differ diff --git a/wallpapers/the-shorekeeper-cosmic-meadow-wuthering-waves-moewalls-com.mp4 b/wallpapers/the-shorekeeper-cosmic-meadow-wuthering-waves-moewalls-com.mp4 new file mode 100644 index 0000000..f428a68 Binary files /dev/null and b/wallpapers/the-shorekeeper-cosmic-meadow-wuthering-waves-moewalls-com.mp4 differ