From d92696ba14f8c9f18a9be8988def4501cdfb981a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Montero?= Date: Fri, 5 Aug 2022 22:50:20 -0600 Subject: [PATCH] reescribe configuracion de polybar --- home/desktop/default.nix | 8 +- home/desktop/i3.nix | 1 - home/desktop/polybar.nix | 477 +++++++++++++++++++++++++++++ home/desktop/polybar/config.nix | 448 --------------------------- home/desktop/polybar/launch.sh.nix | 12 - 5 files changed, 478 insertions(+), 468 deletions(-) create mode 100644 home/desktop/polybar.nix delete mode 100644 home/desktop/polybar/config.nix delete mode 100755 home/desktop/polybar/launch.sh.nix diff --git a/home/desktop/default.nix b/home/desktop/default.nix index cf229c3..977ae15 100644 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: with lib; { - imports = [ ./i3.nix ]; + imports = [ ./i3.nix ./polybar.nix ]; xsession.enable = true; @@ -8,12 +8,6 @@ enable = true; }; - services.polybar = { - enable = true; - script = import ./polybar/launch.sh.nix; - extraConfig = import ./polybar/config.nix; - }; - services.dunst = { enable = true; }; diff --git a/home/desktop/i3.nix b/home/desktop/i3.nix index 1a688e9..94e1ee4 100644 --- a/home/desktop/i3.nix +++ b/home/desktop/i3.nix @@ -23,7 +23,6 @@ window = { hideEdgeBorders = "both"; - titlebar = false; }; # mkOptionDefault hace que se ponga la config por default diff --git a/home/desktop/polybar.nix b/home/desktop/polybar.nix new file mode 100644 index 0000000..922cdca --- /dev/null +++ b/home/desktop/polybar.nix @@ -0,0 +1,477 @@ +{ config, pkgs, lib, ... }: with lib; { + services.polybar = { + enable = true; + package = pkgs.polybarFull; + script = '' + # Terminate already running bar instances + killall -q polybar + + # Wait until the processes have been shut down + while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done + + # Launch Polybar, using default config location ~/.config/polybar/config + polybar -r main & polybar -r secondary & + ''; + + settings = { + "colors" = { + # background = "\${xrdb:color0:#222}"; + background = "#AA000000"; + background-alt = "#00000000"; + # foreground = "\${xrdb:color7:#222}"; + foreground = "#ffffff"; + foreground-alt = "#ffffff"; + primary = "#ffffff"; + secondary = "#e60053"; + alert = "#bd2c40"; + }; + + "bar/main" = { + monitor = "\${env:MONITOR:DisplayPort-0}"; + # monitor = "\${env:MONITOR:HDMI-A-0}"; + width = "100%"; + height = 30; + offset-x = "0%"; + offset-y = "0%"; + radius = 0.0; + fixed-center = false; + + background = "\${colors.background}"; + foreground = "\${colors.floating"; + padding-right = 0; + + module-margin-left = 1; + module-margin-right = 1; + + # font-0 = "fixed:pixelsize=10;1"; + font-0 = "JetBrains Mono Light:size=10;0"; + font-1 = "unifont:fontformat=truetype:size=8:antialias=false;0"; + font-2 = "siji:pixelsize=10;1"; + # font-2 = "FontAwesome5Free:style=Regular:size=10;4"; + + modules-left = "i3"; + modules-center = "xwindow"; + modules-right = "xkeyboard pulseaudio filesystem memory cpu temperature gputemperature nvmetemperature wlan eth date semanatec"; + separator = "|"; + + tray-position = "right"; + tray-padding = 2; + # tray-background = "#0063ff"; + + # wm-restack = "i3"; + + # override-redirect = true; + + # scroll-up = "i3wm-wsnext"; + # scroll-down = "i3wm-wsprev"; + + cursor-click = "pointer"; + cursor-scroll = "ns-resize"; + }; + + "bar/secondary" = { + monitor = "\${env:MONITOR:DisplayPort-1}"; + # monitor = "\${env:MONITOR:HDMI-A-0}"; + width = "100%"; + height = 30; + offset-x = "0%"; + offset-y = "0%"; + radius = 0.0; + fixed-center = false; + + background = "\${colors.background}"; + foreground = "\${colors.foreground}"; + + line-size = 1; + line-color = "#f00"; + + border-size = 0; + border-color = "#00000000"; + + padding-left = 0; + padding-right = 0; + + module-margin-left = 1; + module-margin-right = 1; + + # font-0 = "fixed:pixelsize=10;1"; + font-0 = "JetBrains Mono Light:size=10;0"; + font-1 = "unifont:fontformat=truetype:size=8:antialias=false;0"; + font-2 = "siji:pixelsize=10;1"; + # font-2 = "FontAwesome5Free:style=Regular:size=10;4"; + + modules-left = "i3"; + modules-center = "xwindow"; + modules-right = "xkeyboard pulseaudio date"; + separator = "|"; + + # wm-restack = "i3"; + + # override-redirect = true; + + # scroll-up = "i3wm-wsnext"; + # scroll-down = "i3wm-wsprev"; + + cursor-click = "pointer"; + cursor-scroll = "ns-resize"; + }; + + "module/xwindow" = { + type = "internal/xwindow"; + label = "%title:0:30:...%"; + }; + + "module/xkeyboard" = { + type = "internal/xkeyboard"; + blacklist-0 = "num lock"; + + format-prefix = ""; + format-prefix-foreground = "\${colors.foreground-alt}"; + + label-layout = "%layout%"; + + label-indicator-padding = 2; + label-indicator-margin = 1; + label-indicator-background = "\${colors.secondary}"; + }; + + "module/filesystem" = { + type = "internal/fs"; + interval = 10; + + mount-0 = "/mnt"; + mount-5 = "/"; + + label-mounted = "%{F#0a81f5}%mountpoint%%{F-}: %used%/%total%"; + label-unmounted = ""; + }; + + "module/i3" = { + type = "internal/i3"; + format = " "; + index-sort = true; + wrapping-scroll = false; + + # Only show workspaces on the same output as the bar + # pin-workspaces = true + + label-mode-padding = 1; + label-mode-foreground = "#000"; + label-mode-background = "\${colors.primary}"; + + # focused = Active workspace on focused monitor + label-focused = "%index%"; + label-focused-background = "\${colors.background}"; + label-focused-underline = "\${colors.primary}"; + label-focused-padding = 1; + + # unfocused = Inactive workspace on any monitor + label-unfocused = "%index%"; + label-unfocused-padding = 1; + + # visible = Active workspace on unfocused monitor + label-visible = "%index%"; + label-visible-background = "\${self.label-focused-background}"; + label-visible-underline = "\${self.label-focused-underline}"; + label-visible-padding = "\${self.label-focused-padding}"; + + # urgent = Workspace with urgency hint set + label-urgent = "%index%"; + label-urgent-background = "\${colors.alert}"; + label-urgent-padding = 1; + }; + + "module/xbacklight" = { + type = "internal/xbacklight"; + + format = "