diff options
25 files changed, 121 insertions, 57 deletions
@@ -74,7 +74,24 @@ "inputs": { "base16": "base16", "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "tt-schemes": "tt-schemes" + } + }, + "tt-schemes": { + "flake": false, + "locked": { + "lastModified": 1725746347, + "narHash": "sha256-qfuu/o1pi4pImwMq+sQ85wy1g7ngPr9tFi5WfkoVGr4=", + "owner": "tinted-theming", + "repo": "schemes", + "rev": "e43188f3bba5fb31d199cc82b542b13579977cb6", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "schemes", + "type": "github" } } }, @@ -8,9 +8,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; base16.url = "github:SenchoPens/base16.nix"; + tt-schemes = { + url = "github:tinted-theming/schemes"; + flake = false; + }; }; - outputs = { nixpkgs, home-manager, base16, ... }: + outputs = { nixpkgs, home-manager, base16, ... }@inputs: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; @@ -22,7 +26,7 @@ ./modules base16.homeManagerModule { - scheme = "${pkgs.base16-schemes}/share/themes/classic-dark.yaml"; + scheme = "${inputs.tt-schemes}/base16/onedark-dark.yaml"; } ]; }; @@ -6,12 +6,12 @@ home.stateVersion = "23.11"; # Desktop + desktop.display-server.x11.xinit.enable = true; desktop.popup-manager.rofi.enable = true; desktop.status-bar.polybar.enable = true; desktop.terminal.alacritty.enable = true; desktop.window-manager.bspwm.enable = true; desktop.window-manager.sxhkd.enable = true; - desktop.display-server.x11.xinit.enable = true; # Shell shell.bash.enable = true; diff --git a/modules/desktop/display-server/x11/xinit/default.nix b/modules/desktop/display-server/x11/xinit/default.nix index e3f10f1..0dda25a 100644 --- a/modules/desktop/display-server/x11/xinit/default.nix +++ b/modules/desktop/display-server/x11/xinit/default.nix @@ -11,7 +11,9 @@ source = pkgs.writeText ".xinitrc" '' #!/bin/sh -${if config.desktop.status-bar.polybar.enable then "polybar main &" else ""} +${if config.desktop.status-bar.polybar.enable then + config.desktop.status-bar.polybar.command +else ""} ${if config.desktop.window-manager.sxhkd.enable then "sxhkd &" else ""} exec ${config.desktop.window-manager.default} ''; diff --git a/modules/desktop/popup-manager/rofi/default.nix b/modules/desktop/popup-manager/rofi/default.nix index 009db89..be22bcd 100644 --- a/modules/desktop/popup-manager/rofi/default.nix +++ b/modules/desktop/popup-manager/rofi/default.nix @@ -10,7 +10,7 @@ programs.rofi.enable = true; programs.rofi.font = "FiraCode Nerd Font 16"; programs.rofi.theme = config.scheme { - template = builtins.readFile ./theme.rasi.mustache; + template = builtins.readFile ./theme.mustache.rasi; }; }; } diff --git a/modules/desktop/popup-manager/rofi/theme.rasi.mustache b/modules/desktop/popup-manager/rofi/theme.mustache.rasi index 02cdaf3..02cdaf3 100644 --- a/modules/desktop/popup-manager/rofi/theme.rasi.mustache +++ b/modules/desktop/popup-manager/rofi/theme.mustache.rasi diff --git a/modules/desktop/status-bar/polybar/bar/main.nix b/modules/desktop/status-bar/polybar/bar/main.nix new file mode 100644 index 0000000..34858d8 --- /dev/null +++ b/modules/desktop/status-bar/polybar/bar/main.nix @@ -0,0 +1,38 @@ +{ config }: + +with config.scheme.withHashtag; +{ + width = "\${env:POLYBAR_WIDTH}"; + fixed-center = false; + height = 35; + + border-top-size = 1; + border-bottom-size = 1; + border-left-size = 1; + border-right-size = 1; + border-color = base02; + + background = base00; + foreground = base05; + + line-size = 3; + line-color = base08; + + padding-left = 1; + padding-right = 1; + + module-margin-left = 2; + module-margin-right = 2; + + offset-x = "\${env:POLYBAR_OFFSET}"; + offset-y = "\${env:POLYBAR_OFFSET}"; + + font-0 = "FiraCode Nerd Font:pixelsize=16;3"; + + modules-left = + if config.desktop.window-manager.bspwm.enable then + "bspwm" + else null; + modules-center = "xwindow"; + modules-right = "memory cpu battery time date kernel-version"; +} diff --git a/modules/desktop/status-bar/polybar/bars/main.nix b/modules/desktop/status-bar/polybar/bars/main.nix deleted file mode 100644 index a36f97a..0000000 --- a/modules/desktop/status-bar/polybar/bars/main.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config }: - -with config.scheme.withHashtag; -{ - width = "100%"; - height = 30; - radius = 3; - fixed-center = false; - - background = "${base00}"; - foreground = "${base05}"; - - line-size = 3; - line-color = "${base08}"; - - border-size = 4; - padding-left = 2; - padding-right = 2; - - module-margin-left = 2; - module-margin-right = 2; - - font-0 = "FiraCode Nerd Font:pixelsize=16;3"; - - modules-left = "bspwm"; - modules-center = "xwindow"; - modules-right = "memory cpu battery time date kernel-version"; -} diff --git a/modules/desktop/status-bar/polybar/default.nix b/modules/desktop/status-bar/polybar/default.nix index 4f7ace3..b8e1907 100644 --- a/modules/desktop/status-bar/polybar/default.nix +++ b/modules/desktop/status-bar/polybar/default.nix @@ -3,25 +3,35 @@ { options.desktop.status-bar.polybar = { enable = lib.mkEnableOption "Enables polybar."; + command = lib.mkOption { + type = lib.types.str; + description = "Command to run polybar."; + # This command calculates the width of the polybar to create those gaps + default = '' +MONITOR_WIDTH=$(xrandr | grep '*' | awk '{print $1}' | cut -d'x' -f1 | head -n1); \ +OFFSET=${toString config.desktop.window-manager.gap}; \ +POLYBAR_WIDTH=$((MONITOR_WIDTH - 2 * OFFSET)) POLYBAR_OFFSET=$OFFSET polybar main & +''; + }; }; config = lib.mkIf config.desktop.status-bar.polybar.enable { services.polybar.enable = true; - services.polybar.script = "polybar main &"; + services.polybar.script = config.desktop.status-bar.polybar.command; services.polybar.config = { - "bar/main" = import ./bars/main.nix { inherit config; }; - "module/xwindow" = import ./modules/xwindow.nix { inherit config; }; + "bar/main" = import ./bar/main.nix { inherit config; }; + "module/xwindow" = import ./module/xwindow.nix { inherit config; }; "module/bspwm" = if config.desktop.window-manager.bspwm.enable then - import ./modules/bspwm.nix { inherit config; } + import ./module/bspwm.nix { inherit config; } else null; - "module/cpu" = import ./modules/cpu.nix { inherit config; }; - "module/memory" = import ./modules/memory.nix { inherit config; }; - "module/date" = import ./modules/date.nix { inherit config; }; - "module/time" = import ./modules/time.nix { inherit config; }; - "module/battery" = import ./modules/battery.nix { inherit config; }; - "module/kernel-version" = import ./modules/kernel-version.nix { inherit config; }; + "module/cpu" = import ./module/cpu.nix { inherit config; }; + "module/memory" = import ./module/memory.nix { inherit config; }; + "module/date" = import ./module/date.nix { inherit config; }; + "module/time" = import ./module/time.nix { inherit config; }; + "module/battery" = import ./module/battery.nix { inherit config; }; + "module/kernel-version" = import ./module/kernel-version.nix { inherit config; }; }; }; } diff --git a/modules/desktop/status-bar/polybar/modules/battery.nix b/modules/desktop/status-bar/polybar/module/battery.nix index 6d4aef9..6d4aef9 100644 --- a/modules/desktop/status-bar/polybar/modules/battery.nix +++ b/modules/desktop/status-bar/polybar/module/battery.nix diff --git a/modules/desktop/status-bar/polybar/modules/bspwm.nix b/modules/desktop/status-bar/polybar/module/bspwm.nix index 0eaac30..c6671e7 100644 --- a/modules/desktop/status-bar/polybar/modules/bspwm.nix +++ b/modules/desktop/status-bar/polybar/module/bspwm.nix @@ -5,7 +5,6 @@ with config.scheme.withHashtag; type = "internal/bspwm"; label-focused = "%index%"; - label-focused-background = "${base01}"; label-focused-underline = "${base0D}"; label-focused-padding = 2; @@ -13,7 +12,7 @@ with config.scheme.withHashtag; label-occupied-padding = 2; label-urgent = "%index%!"; - label-urgent-background = "${base08}"; + label-urgent-underline = "${base08}"; label-urgent-padding = 2; label-empty = "%index%"; diff --git a/modules/desktop/status-bar/polybar/modules/cpu.nix b/modules/desktop/status-bar/polybar/module/cpu.nix index 403add3..403add3 100644 --- a/modules/desktop/status-bar/polybar/modules/cpu.nix +++ b/modules/desktop/status-bar/polybar/module/cpu.nix diff --git a/modules/desktop/status-bar/polybar/modules/date.nix b/modules/desktop/status-bar/polybar/module/date.nix index 9ebfd77..9ebfd77 100644 --- a/modules/desktop/status-bar/polybar/modules/date.nix +++ b/modules/desktop/status-bar/polybar/module/date.nix diff --git a/modules/desktop/status-bar/polybar/modules/kernel-version.nix b/modules/desktop/status-bar/polybar/module/kernel-version.nix index e6822fa..e6822fa 100644 --- a/modules/desktop/status-bar/polybar/modules/kernel-version.nix +++ b/modules/desktop/status-bar/polybar/module/kernel-version.nix diff --git a/modules/desktop/status-bar/polybar/modules/memory.nix b/modules/desktop/status-bar/polybar/module/memory.nix index a09d4a8..a09d4a8 100644 --- a/modules/desktop/status-bar/polybar/modules/memory.nix +++ b/modules/desktop/status-bar/polybar/module/memory.nix diff --git a/modules/desktop/status-bar/polybar/modules/time.nix b/modules/desktop/status-bar/polybar/module/time.nix index f3e0054..f3e0054 100644 --- a/modules/desktop/status-bar/polybar/modules/time.nix +++ b/modules/desktop/status-bar/polybar/module/time.nix diff --git a/modules/desktop/status-bar/polybar/modules/xwindow.nix b/modules/desktop/status-bar/polybar/module/xwindow.nix index 833899e..833899e 100644 --- a/modules/desktop/status-bar/polybar/modules/xwindow.nix +++ b/modules/desktop/status-bar/polybar/module/xwindow.nix diff --git a/modules/desktop/window-manager/bspwm/default.nix b/modules/desktop/window-manager/bspwm/default.nix index 96df979..e70842b 100644 --- a/modules/desktop/window-manager/bspwm/default.nix +++ b/modules/desktop/window-manager/bspwm/default.nix @@ -10,7 +10,7 @@ xsession.windowManager.bspwm.enable = true; xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; { - window_gap = 5; + window_gap = config.desktop.window-manager.gap; split_ratio = 0.5; single_monocle = true; borderless_monocle = false; @@ -31,6 +31,9 @@ "popup" = { state = "floating"; sticky = true; + rectangle = "1000x600+0+0"; + center = true; + follow = true; }; }; diff --git a/modules/desktop/window-manager/default.nix b/modules/desktop/window-manager/default.nix index 23c5d6e..de8034b 100644 --- a/modules/desktop/window-manager/default.nix +++ b/modules/desktop/window-manager/default.nix @@ -11,5 +11,11 @@ type = lib.types.str; description = "Path to the default window manager program."; }; + + gap = lib.mkOption { + type = lib.types.number; + default = 5; + description = "The spacing between windows."; + }; }; } diff --git a/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh index 5e6b356..aa3ff05 100644 --- a/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh +++ b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh @@ -1,4 +1,5 @@ #!/bin/sh + awk ' /^#/ { desc = substr($0, 3) diff --git a/modules/tools/editor/neovim/plugins/base16.lua b/modules/tools/editor/neovim/plugins/base16.lua deleted file mode 100644 index 9843b76..0000000 --- a/modules/tools/editor/neovim/plugins/base16.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.o.termguicolors = true; -vim.opt.termguicolors = true; -vim.o.background = "dark"; -vim.g.base16colorspace = 256 -vim.cmd.colorscheme("base16-scheme"); -vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" }); -- disable the background of line numbers diff --git a/modules/tools/editor/neovim/plugins/base16.mustache.lua b/modules/tools/editor/neovim/plugins/base16.mustache.lua new file mode 100644 index 0000000..3c13fcc --- /dev/null +++ b/modules/tools/editor/neovim/plugins/base16.mustache.lua @@ -0,0 +1,12 @@ +vim.o.termguicolors = true; +vim.opt.termguicolors = true; +vim.o.background = "dark"; +vim.g.base16colorspace = 256 +vim.cmd.colorscheme("base16-scheme"); + +-- Overrides +-- disable the background of line numbers +vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" }); + +-- change the color of the pane separator +vim.api.nvim_set_hl(0, "WinSeparator", { fg = "#{{base02-hex}}", bg = "None" }); diff --git a/modules/tools/editor/neovim/plugins/default.nix b/modules/tools/editor/neovim/plugins/default.nix index 2df4e4a..ace5379 100644 --- a/modules/tools/editor/neovim/plugins/default.nix +++ b/modules/tools/editor/neovim/plugins/default.nix @@ -4,6 +4,8 @@ ${builtins.readFile ./comment.lua} ${builtins.readFile ./lualine.lua} ${import ./treesitter.nix { inherit config; }} -${builtins.readFile ./base16.lua} +${builtins.readFile (config.scheme { + template = builtins.readFile ./base16.mustache.lua; +})} ${builtins.readFile ./nvim-tree.lua} '' diff --git a/modules/tools/viewer/bat/default.nix b/modules/tools/viewer/bat/default.nix index 73bdefd..ec68eb7 100644 --- a/modules/tools/viewer/bat/default.nix +++ b/modules/tools/viewer/bat/default.nix @@ -7,12 +7,16 @@ config = lib.mkIf config.tools.viewer.bat.enable { programs.bat.enable = true; - programs.bat.config.theme = "custom-theme"; - shell.alias."cbat" = "${pkgs.bat}/bin/bat -pp"; + programs.bat.config = { + tabs = "4"; + theme = "custom-theme"; + }; + shell.alias."bc" = "${pkgs.bat}/bin/bat -pp"; + shell.alias."bp" = "${pkgs.bat}/bin/bat --paging always"; home.sessionVariables."PAGER" = "${pkgs.bat}/bin/bat --paging always"; xdg.configFile."bat/themes/custom-theme.tmTheme".source = config.scheme { - template = builtins.readFile ./theme.tmTheme.mustache; + template = builtins.readFile ./theme.mustache.tmTheme; }; }; } diff --git a/modules/tools/viewer/bat/theme.tmTheme.mustache b/modules/tools/viewer/bat/theme.mustache.tmTheme index 844b80d..844b80d 100644 --- a/modules/tools/viewer/bat/theme.tmTheme.mustache +++ b/modules/tools/viewer/bat/theme.mustache.tmTheme |
