nixos-private-dots/modules/home-manager/wm/polybar.nix
2024-08-09 18:23:09 +03:00

472 lines
20 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Про единицы измерения
# Если просто написать число, то это будет количество пробелом в прямом смысле. Размер зависит от шрифта
# Если указать pt (points), то это 1/72 часть дюйма, которая преобразуется в количество пикселей в зависимости от DPI монитора
# Если указывать px, то это пиксели, логично
# Интересные готовые скрипты для polybar https://github.com/polybar/polybar-scripts
# Указание цветов из темы stylix
# color0 = "${config.lib.stylix.colors.base00}";
# В случае с gruvbox это будет цвет "#282828"
# Ниже цвета просто dark-meduim, после него material-dark-medium
# base00: "#282828" "#292828"
# base01: "#3c3836" "#32302f"
# base02: "#504945" "#504945"
# base03: "#665c54" "#665c54"
# base04: "#bdae93" "#bdae93"
# base05: "#d5c4a1" "#ddc7a1"
# base06: "#ebdbb2" "#ebdbb2"
# base07: "#fbf1c7" "#fbf1c7"
# base08: "#fb4934" "#ea6962"
# base09: "#fe8019" "#e78a4e"
# base0A: "#fabd2f" "#d8a657"
# base0B: "#b8bb26" "#a9b665"
# base0C: "#8ec07c" "#89b482"
# base0D: "#83a598" "#7daea3"
# base0E: "#d3869b" "#d3869b"
# base0F: "#d65d0e" "#bd6f3e"
# Если в коммент коде цвет указан напрямую, то это дотсы zproger с левой темой
# Варианты кликов мыши
# click-left
# click-middle
# click-right
# scroll-up
# scroll-down
# double-click-left
# double-click-middle
# double-click-right
# { config, ... }: let
# gruvbox = {
# black = "#000000";
# dark = "#1d1d1d";
# disabled = "${config.lib.stylix.colors.base00}"; # #282828
# red = "${config.lib.stylix.colors.base08}"; # #fb4934
# red-alt = "#b22222";
# orange = "${config.lib.stylix.colors.base09}"; # #fe8019
# orange-mat = "#e78a4e";
# yellow = "${config.lib.stylix.colors.base0A}"; # #fabd2f
# yellow-mat = "#d8a657";
# green = "${config.lib.stylix.colors.base0B}"; # #b8bb26
# green-alt = "#98971a";
# aqua = "${config.lib.stylix.colors.base0C}"; # #8ec07c
# aqua-alt = "#689d6a";
# blue = "#458588";
# blue-alt = "${config.lib.stylix.colors.base0D}"; # #83a598
# grey = "#313131";
# dark-grey = "#222222";
# cream = "${config.lib.stylix.colors.base07}"; # #fbf1c7
# white = "#FFFFFF";
# transparent = "#00000000";
# Stransparent = "#CC000000";
# };
# in
{ # Статус бар внизу
services.polybar = {
enable = true;
script = "polybar bottom &";
settings = {
"global/wm" = {
margin-bottom = 0;
};
"bar/bottom" = {
monitor = "polybar -M | cut -d ':' -f 1"; # содержит список мониторов
fixed-center = true; # Мидл модуль будет по центру экрана. При false будет между левым и правым модулями
};
};
# settings = { # Или переимоневать в "config"? Не понял в чём разница
# # "colors" = {};
# "global/wm" = {
# margin-bottom = 0;
# };
# # bottom это просто имя, это не говорит бару быть внизу, можно написать что угодно
# "bar/bottom" = {
# monitor = "polybar -M | cut -d ':' -f 1"; # содержит список мониторов
# monitor-strict = false; # Require the monitor to be in connected state
# monitor-exact = true; # Зачем? Нечёткий поиск мониторов, если они называются по разному с разными драйверами
# bottom = true; # Put the bar at the bottom of the screen
# fixed-center = true; # Мидл модуль будет по центру экрана. При false будет между левым и правым модулями
# width = "100%"; # Ширина относительно ширины монитора
# height = "20pt"; # Высота относительно высоты монитора. Не ебу что значит pt
# offset-x = 0; # Offset the bar window in the x and/or y direction.
# offset-y = 0; # Supports any percentage with offset relative to the monitor width or height
# padding = 0; # Padding to add at the beginning/end of the bar. Можно юзать padding-{left,right}
# enable-ipc = true; # Enable support for inter-process messaging
# double-click-interval = 400; # If two clicks are received within this interval (ms), they are recognized as a double click.
# module-margin = 1; # Margin to add before/after each module. Можно юзать module-margin-{left,right}
# # separator = " "; # The separator will be inserted between the output of each module
# # separator-foreground = gruvbox.transparent;
# # background = gruvbox.transparent; # Фон бара
# # foreground = gruvbox.cream; # Передний план
# # border-color = gruvbox.transparent; # Цвет контура
# # border-size = "3pt"; # Размер контура
# # line-color = "#f00"; # Under-/overline argb color. Может быть {overline,underline}-color
# # line-size = 0; # Under-/overline pixel size. Может быть {overline,underline}-size
# # If you don't explicitly set the font-index for a tag,
# # the bar will iterate the font list and pick the first one that is able to draw the character
# # font-0 = "JetBrainsMono Nerd Font";
# modules-left = "bspwm title";
# modules-center = "time";
# modules-right = "cpu cpu-temp gpu-temp battery memory pulseaudio tray xkeyboard rofi";
# # Restack the bar window and put it above the selected window manager's root
# # Fixes the issue where the bar is being drawn on top of fullscreen window's
# # Currently supported values:
# # generic (Tries the ewmh strategy and falls back to the bottom strategy.
# # This is a best-effort strategy and may change and be tweaked in
# # the future, the individual strategies are available on their own)
# # (New in version 3.6.0)
# # (Changed in version 3.7.0: Tries the ewmh strategy instead of just the bottom strategy)
# # bspwm (Moves the bar window above all bspwm root windows)
# # bottom (Moves the bar window above the first window in the window stack.
# # Works in xmonad, may not work on other WMs
# # New in version 3.7.0)
# # ewmh (Moves the bar above the window specified in _NET_SUPPORTING_WM_CHECK, if it is set
# # New in version 3.7.0)
# # i3 (requires `override-redirect = true`)
# wm-restack = "bspwm";
# };
# "module/rofi" = {
# type = "custom/text";
# click-left = "exec rofi -show drun";
# label = " ";
# };
# "module/bspwm" = { # Воркспейсы bspwm
# type = "internal/bspwm";
# pin-workspaces = true; # Only show workspaces defined on the same output as the bar
# inline-mode = true; # Output mode flags after focused state label. Не понял что значит
# enable-click = true; # Create click handler used to focus workspace
# enable-scroll = false; # Create scroll handlers used to cycle workspaces
# reverse-scroll = false; # Set the scroll cycle direction
# occupied-scroll = true; # Only scroll through occupied workspaces
# ws-icon-0 = "0;0";
# ws-icon-1 = "1;1";
# ws-icon-2 = "2;2";
# ws-icon-3 = "3;3";
# ws-icon-4 = "4;4";
# ws-icon-5 = "5;5";
# ws-icon-6 = "6;6";
# ws-icon-7 = "7;7";
# ws-icon-8 = "8;8";
# ws-icon-9 = "9;9";
# ws-icon-10 = "10;10";
# format = "<label-state> <label-mode>"; # Это невозможно описать. Я сам не до конца понял
# # label-mode = "%mode%";
# # label-mode-padding = 1;
# # label-mode-background = gruvbox.red-alt;
# # label-mode-foreground = gruvbox.white;
# # label-separator = "";
# # label-separator-padding = 0;
# # label-separator-foreground = gruvbox.transparen;
# # label-focused = "%icon% %name%";
# # label-focused-font = 5;
# # label-focused-foreground = gruvbox.yellow;
# # label-focused-underline = "#565c64";
# # label-focused-padding = 1;
# # label-focused-background = gruvbox.black;
# # label-occupied = "%icon%";
# # label-occupied-foreground = "#646870";
# # label-occupied-background = "#2b2f37";
# # label-occupied-padding = 1;
# # label-empty = "%icon%";
# # label-empty-foreground = gruvbox.yellow;
# # label-empty-padding = 1;
# # label-empty-background = "#2b2f37";
# # label-unfocused = "%icon%";
# # label-unfocused-font = 5;
# # label-unfocused-foreground = gruvbox.cream;
# # label-unfocused-background= gruvbox.black;
# # label-unfocused-padding = 2;
# # label-visible = "%icon%";
# # label-visible-padding = 2;
# # label-urgent = "%icon%";
# # label-urgent-font = 5
# # label-urgent-foreground = gruvbox.red-alt;
# # label-urgent-background = gruvbox.black;
# # label-urgent-padding = 2;
# };
# "module/title" = { # Отображение имени окна
# type = "internal/xwindow";
# format-prefix = "  ";
# # format-prefix-foreground = gruvbox.yellow-mat;
# # format-prefix-background = gruvbox.black;
# # format-background = "#f00";
# # format-foreground = "#000";
# # format-padding = 4;
# # label = "%title%";
# label = "%class%";
# label-maxlen = 60;
# # label-foreground = gruvbox.cream;
# # label-background = gruvbox.dark;
# label-padding-left = 2;
# label-padding-right = 2;
# };
# # %A: Полное название дня недели (например, "Monday")
# # %d: День месяца в формате двух цифр (например, "01")
# # %b или %B: Сокращённое или полное название месяца ("Jan", "January")
# # %m: Месяц в формате двух цифр (например, "01" для января)
# "module/time" = {
# type = "internal/date";
# interval = 1;
# # format = "🕓 <label>";
# # format-prefix = "  ";
# # format-prefix-foreground = gruvbox.aqua;
# # format-prefix-background = gruvbox.black;
# # date = "%A %d %b %Y | %H:%M:%S";
# date = "%d %B %Y";
# time = "%H:%M:%S";
# date-alt = "%d-%m-%Y"; # If defined, clicking will toggle between formats
# # time-alt = "%H:%M:%S"; # If defined, clicking will toggle between formats
# label = "%date% %time%";
# # label-foreground = gruvbox.cream;
# # label-background = gruvbox.dark;
# # label-font = 3;
# label-padding-left = 2;
# label-padding-right = 2;
# };
# "module/xkeyboard" = {
# type = "internal/xkeyboard";
# blacklist-0 = "num lock";
# blacklist-1 = "scroll lock";
# format = "<label-layout> <label-indicator>";
# label-layout-padding = 1;
# # label-layout-foreground = "#fff";
# label-indicator-on = "%name%";
# # layout-icon-default = "some-icon";
# layout-icon-0 = "RU";
# layout-icon-1 = "EN";
# label-indicator-on-capslock = "!";
# label-indicator-off-capslock = "";
# };
# "module/tray" = {
# type = "internal/tray";
# format = "<tray>";
# # format-prefix = " 󱊖 ";
# # format-prefix-foreground = gruvbox.orange;
# # format-prefix-background = gruvbox.black;
# tray-spacing = "8px";
# # tray-size = "66%"; # relative to bar height, non-negative
# format-padding = "5px";
# # format-background = gruvbox.black;
# # tray-background = gruvbox.black;
# # tray-foreground = gruvbox.cream; # сам добавил
# };
# "module/pulseaudio" = {
# type = "internal/pulseaudio";
# format-volume-prefix = "  ";
# # format-volume-prefix-foreground = gruvbox.blue-alt;
# # format-volume-prefix-background= gruvbox.black;
# format-volume = "<label-volume>";
# label-volume = "%percentage%%";
# # label-volume-foreground= gruvbox.cream;
# # label-volume-background= gruvbox.dark;
# label-volume-padding-left=2;
# label-volume-padding-right=2;
# format-muted-prefix = "  ";
# # format-muted-foreground = gruvbox.orange;
# # format-muted-background = gruvbox.black;
# label-muted = "muted";
# # label-muted-foreground = gruvbox.orange-mat;
# # label-muted-background = gruvbox.dark;
# label-muted-padding = 2;
# };
# "module/memory" = {
# type = "internal/memory";
# interval = 3;
# # format-prefix = "  ";
# # format-prefix-foreground = gruvbox.blue;
# # format-prefix-background = gruvbox.black;
# label = "RAM: %gb_used%/%gb_total% | SWAP: %gb_swap_used%/%gb_swap_total%";
# # label-foreground = gruvbox.cream;
# # label-background = gruvbox.dark;
# label-padding-left = 2;
# label-padding-right = 2;
# };
# "module/battery" = {
# type = internal/battery;
# full-at = 98;
# low-at = 20;
# battery = "BAT0";
# adapter = "ADP1";
# poll-interval = 5;
# time-format = "%H:%M";
# format-charging = "<animation-charging><label-charging>";
# # format-charging-foreground = gruvbox.green;
# # format-charging-background = gruvbox.black;
# label-charging = "%percentage%%";
# # label-charging-foreground = gruvbox.cream;
# # label-charging-background = gruvbox.dark;
# label-charging-padding= 2;
# format-discharging = "<ramp-capacity><label-discharging>";
# # format-discharging-foreground = gruvbox.green-alt;
# # format-discharging-background = gruvbox.black;
# label-discharging = "%percentage%%";
# # label-discharging-foreground = gruvbox.cream;
# # label-discharging-background = gruvbox.dark;
# label-discharging-padding = 2;
# format-full-prefix = "  ";
# # format-full-foreground = gruvbox.aqua;
# # format-full-background = gruvbox.black;
# label-full = "%percentage%%";
# # label-full-foreground = gruvbox.cream;
# # label-full-background = gruvbox.dark;
# label-full-padding = 2;
# label-low = "[ BATTERY LOW ] %percentage%%";
# # label-low-foreground = gruvbox.black;
# # label-low-background = gruvbox.red-alt;
# label-low-padding = 2;
# # Only applies if <ramp-capacity> is used
# ramp-capacity-0 = "  ";
# ramp-capacity-1 = "  ";
# ramp-capacity-2 = "  ";
# ramp-capacity-3 = "  ";
# ramp-capacity-4 = "  ";
# ramp-capacity-0-padding = 3;
# ramp-capacity-1-padding = 3;
# ramp-capacity-2-padding = 3;
# ramp-capacity-3-padding = 3;
# ramp-capacity-4-padding = 3;
# # ramp-capacity-0-foreground = gruvbox.red-alt;
# # ramp-capacity-1-foreground = gruvbox.green-alt;
# # ramp-capacity-2-foreground = gruvbox.green-alt;
# # ramp-capacity-3-foreground = gruvbox.green-alt;
# # ramp-capacity-4-foreground = gruvbox.green-alt;
# # ramp-capacity-0-background = gruvbox.black;
# # ramp-capacity-1-background = gruvbox.black;
# # ramp-capacity-2-background = gruvbox.black;
# # ramp-capacity-3-background = gruvbox.black;
# # ramp-capacity-4-background = gruvbox.black;
# # Only applies if <bar-capacity> is used
# bar-capacity-width = 10;
# # Only applies if <animation-charging> is used
# animation-charging-0 = "  ";
# animation-charging-1 = "  ";
# animation-charging-2 = "  ";
# animation-charging-3 = "  ";
# animation-charging-4 = "  ";
# animation-charging-framerate = 750;
# animation-charging-0-padding = 3;
# animation-charging-1-padding = 3;
# animation-charging-2-padding = 3;
# animation-charging-3-padding = 3;
# animation-charging-4-padding = 3;
# # Animation-charging color
# # animation-charging-0-foreground = gruvbox.green;
# # animation-charging-1-foreground = gruvbox.green;
# # animation-charging-2-foreground = gruvbox.green;
# # animation-charging-3-foreground = gruvbox.green;
# # animation-charging-4-foreground = gruvbox.green;
# # animation-charging-0-background = gruvbox.black;
# # animation-charging-1-background = gruvbox.black;
# # animation-charging-2-background = gruvbox.black;
# # animation-charging-3-background = gruvbox.black;
# # animation-charging-4-background = gruvbox.black;
# # Only applies if <animation-discharging> is used;
# animation-discharging-0 = "[  ]";
# animation-discharging-1 = "[  ]";
# animation-discharging-2 = "[  ]";
# animation-discharging-3 = "[  ]";
# animation-discharging-4 = "[  ]";
# animation-discharging-framerate = 500;
# animation-discharging-0-padding = 1;
# animation-discharging-1-padding = 1;
# animation-discharging-2-padding = 1;
# animation-discharging-3-padding = 1;
# animation-discharging-4-padding = 1;
# # Animation discharging color
# # animation-discharging-0-foreground = gruvbox.cream;
# # animation-discharging-1-foreground = gruvbox.cream;
# # animation-discharging-2-foreground = gruvbox.cream;
# # animation-discharging-3-foreground = gruvbox.cream;
# # animation-discharging-4-foreground = gruvbox.cream;
# # animation-discharging-0-background = gruvbox.green-alt;
# # animation-discharging-1-background = gruvbox.green-alt;
# # animation-discharging-2-background = gruvbox.green-alt;
# # animation-discharging-3-background = gruvbox.green-alt;
# # animation-discharging-4-background = gruvbox.green-alt;
# animation-low-0 = "!";
# animation-low-1 = "!!";
# animation-low-framerate = 200;
# };
# "module/cpu" = {
# type = "internal/cpu";
# warn-percentage = 95;
# label = "CPU %percentage%%";
# label-warn = "CPU %percentage%%";
# };
# # Full path of temperature sysfs path
# # Use `sensors` to find preferred temperature source, then run
# # $ for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done
# # to find path to desired file
# # Default reverts to thermal zone setting
# "module/cpu-temp" = {
# type = "internal/temperature";
# hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input";
# warn-temperature = 80;
# label = "%temperature-c% °C";
# label-warn = "%temperature-c% °C";
# # label-warn-foreground = "#f00";
# };
# "module/gpu-temp" = {
# type = "internal/temperature";
# hwmon-path = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:00.0/0000:03:00.0/hwmon/hwmon5/temp3_input";
# warn-temperature = 80;
# label = "GPU %temperature-c% °C";
# label-warn = "GPU %temperature-c% °C";
# # label-warn-foreground = "#f00";
# };
# };
};
}
# При наведении на имя окна сделать скрол фул имени через zscroll