diff --git a/flakes/common/hm_modules/de_i3/default.nix b/flakes/common/hm_modules/de_i3/default.nix index 7924e53..7af8291 100644 --- a/flakes/common/hm_modules/de_i3/default.nix +++ b/flakes/common/hm_modules/de_i3/default.nix @@ -1,4 +1,4 @@ { ... }: { - imports = [ ./i3.nix ]; + imports = [ ./i3.nix ./polybar.nix ]; } diff --git a/flakes/common/hm_modules/de_i3/i3.nix b/flakes/common/hm_modules/de_i3/i3.nix index 9355719..14b5404 100644 --- a/flakes/common/hm_modules/de_i3/i3.nix +++ b/flakes/common/hm_modules/de_i3/i3.nix @@ -81,13 +81,7 @@ "Print" = "exec sh -c 'maim -s | xclip -selection clipboard -t image/png'"; }; - bars = [ - # { - # position = "top"; - # statusCommand = "${pkgs.i3status}/bin/i3status"; - # } - ]; - + bars = [ ]; startup = [ ]; }; }; diff --git a/flakes/common/hm_modules/de_i3/polybar.nix b/flakes/common/hm_modules/de_i3/polybar.nix new file mode 100644 index 0000000..e19f86b --- /dev/null +++ b/flakes/common/hm_modules/de_i3/polybar.nix @@ -0,0 +1,306 @@ +{ lib, pkgs, ... }: +let + mf = "#3b3b3bcc"; + bg = "#00000000"; + fg = "#FFFFFF"; + + polybarRun = pkgs.writeShellScriptBin "pbr" '' + polybar -m | while IFS=: read -r mon rest; do + if echo "$rest" | ${pkgs.gnugrep}/bin/grep -q "(primary)"; then + MONITOR="$mon" polybar -r primary & + else + MONITOR="$mon" polybar -r others & + fi + done + wait + ''; +in +{ + services.polybar = { + enable = true; + package = pkgs.polybar.override { + i3Support = true; + iwSupport = true; + pulseSupport = true; + }; + script = "${polybarRun}/bin/pbr"; + settings = { + "global/wm" = { + margin-bottom = 0; + margin-top = 5; + }; + + "bar/main" = { + monitor = "\${env:MONITOR}"; + width = "100%"; + height = 20; + radius = 0; + background = bg; + foreground = fg; + font-0 = "JetBrainsMono Nerd Font:size=11;2"; + font-1 = "Noto Sans CJK JP:size=11;2"; + + cursor-click = "pointer"; + enable-ipc = true; + }; + + "bar/primary" = { + "inherit" = "bar/main"; + modules-left = "i3"; + modules-center = "clock temperature cpu memory filesystem"; + modules-right = "volume tray powermenu"; + # modules-right = "volume network bluetooth backlight tray powermenu"; + }; + + "bar/others" = { + "inherit" = "bar/main"; + modules-left = "i3"; + modules-center = "clock temperature cpu memory filesystem"; + modules-right = ""; + }; + + "settings" = { + screenchange-reload = true; + + compositing-background = "source"; + compositing-foreground = "over"; + compositing-overline = "over"; + comppositing-underline = "over"; + compositing-border = "over"; + + pseudo-transparency = true; + }; + + "module/i3" = { + type = "internal/i3"; + index-sort = true; + pin-workspaces = true; + strip-wsnumbers = true; + wrapping-scroll = false; + format = ""; + + ws-icon-0 = "1;一"; + ws-icon-1 = "2;二"; + ws-icon-2 = "3;三"; + ws-icon-3 = "4;四"; + ws-icon-4 = "5;五"; + ws-icon-5 = "6;六"; + ws-icon-6 = "7;七"; + ws-icon-7 = "8;八"; + ws-icon-8 = "9;九"; + ws-icon-9 = "10;十"; + + label-unfocused = "%icon%"; + label-focused = "%icon%"; + label-focused-background = mf; + label-visible = "%icon%"; + label-urgent = "%icon%"; + label-occupied = "%icon%"; + + label-unfocused-padding = 1; + label-focused-padding = 1; + label-visible-padding = 1; + label-urgent-padding = 1; + label-occupied-padding = 1; + }; + + "module/clock" = { + type = "internal/date"; + interval = 10; + date = "%b %d, %H:%M"; + format = "