Added polybar module

This commit is contained in:
Julien Malka 2021-12-19 19:26:27 +01:00
parent 5381c1b837
commit 89c429169d
3 changed files with 460 additions and 14 deletions

View file

@ -0,0 +1,434 @@
;-------------------------------------------------
; ;
; Polybar config for Cranium ;
; ;
;-------------------------------------------------
[colors]
;background = ${xrdb:color0:#222}
;background = #212E36
background = #cf172a47
;it's ARGB so "cfl" is for transparency
;background-alt = #cf3C5A46
background-unf = #2D4058
;background-unf = #cf2E463E
background-alt = #405C7D
background-mod0 = #cf3C5A46
background-mod1 = #cf546E53
background-mod2 = #cf708963
background-alrt = #cfA1BB76
;foreground = ${xrdb:color7:#222}
foreground = #F3F3BA
foreground-alt = #F3F3BA
primary = #F3F3BA
secondary = #F3F3BA
[bar/PolybarTony]
;monitor = ${env:MONITOR:HDMI-1}
;monitor = ${env:MONITOR:}
width = 100%
height = 30
offset-x = 0%
;offset-y = 10%
radius = 0.0
fixed-center = true
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 0
line-color = #f00
border-size = 0
border-color = #00000000
padding-left = 0
padding-right = 0
module-margin-left = 0
module-margin-right = 0
font-0 = Misc Termsyn:size=8;1
;font-0 = Ubuntu:size=10;1
font-1 = FontAwesome:fontformat=truetype:size=12;1
font-3 = Font Awesome 5 Free:style=Regular:pixelsize=8;1
font-4 = Font Awesome 5 Free:style=Solid:pixelsize=8;1
font-5 = Font Awesome 5 Brands:pixelsize=8;1
font-2 = sm4tik:pixelsize=10;1
modules-left = i3
modules-center = date
modules-right = wireless-network memory cpu battery powermenu
tray-position = right
tray-padding = 11
tray-transparent = false
tray-offset-y = 0
tray-offset-x = 0
tray-maxsize = 18
tray-detached = false
tray-background = colors.background
;wm-restack = bspwm
wm-restack = i3
override-redirect = false
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev
[module/weather]
type = custom/script
interval = 60
;format-background = ${colors.background-alt}
format = <label>
format-prefix = "  "
format-suffix = " "
format-prefix-foreground = ${colors.foreground-alt}
exec = python ~/.config/polybar/weather.py
[module/music]
type = custom/script
interval = 1
bar-width = 50%
;format-background = ${colors.background-alt}
;format-foreground = ${colors.foreground-alt}
label = " %output% "
exec = ~/.config/polybar/mpris.sh
[module/i3]
pin-workspaces = true
type = internal/i3
;
;strip-wsnumbers = true
;
;label-focused-padding = 3
;label-unfocused-padding = 3
;
;label-focused-background = ${colors.background-alt}
label-unfocused-background = ${colors.background-unf}
;
;label-mode-padding = 0
;label-mode-background = ${colors.background-unf}
;
;label-visible-underline = #555555
;label-visible-padding = 4
; Available tokens:
; %mode%
; Default: %mode%
label-mode = %mode%
label-mode-padding = 2
label-mode-background = #e60053
; Available tokens:
; %name%
; %icon%
; %index%
; %output%
; Default: %icon% %name%
label-focused = %name%
label-focused-foreground = #ffffff
label-focused-background = ${colors.background-alt}
label-focused-underline = #fba922
label-focused-padding = 4
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-unfocused = %name%
label-unfocused-padding = 4
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-visible = %name%
label-visible-underline = #555555
label-visible-padding = 4
; Available tokens:
; %name%
; %icon%
; %index%
; Default: %icon% %name%
label-urgent = %name%
label-urgent-foreground = #000000
label-urgent-background = ${colors.background-alrt}
label-urgent-padding = 4
[module/wireless-network]
type = internal/network
interface = wlp3s0
interval = 3.0
format-connected-prefix = " "
format-connected-background = ${colors.background-alt}
format-connected = " <ramp-signal> <label-connected> "
format-connected-underline = #9f78e1
label-connected =
format-disconnected = " no wifi :( "
format-disconnected-background = ${colors.background-alt}
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-0 = "  0%"
ramp-signal-1 = "  25%"
ramp-signal-2 = "  50%"
ramp-signal-3 = "  75%"
ramp-signal-4 = "  100%"
ramp-signal-foreground = ${colors.foreground-alt}
[module/wired-network]
type = internal/network
interface = enp0s25
interval = 3.0
format-connected-underline = #55aa55
format-connected-prefix = ""
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date =
date-alt = " %d/%m"
time = "  %a %b %d  %I:%M %p "
time-alt = %H:%M:%S
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5
label = %date% %time%
;lable = %time%
[module/volume]
type = internal/pulseaudio
;type = internal/alsa
sink = alsa_output.pci-0000_00_1f.3.analog-stereo
; Soundcard to be used
; Usually in the format hw:#
master-soundcard = hw:1
speaker-soundcard = hw:1
headphone-soundcard = hw:1
; Name of the master mixer
; Default: Master
master-mixer = Master
; Optionally define speaker and headphone mixers
; Use the following command to list available mixer controls:
; $ amixer scontrols | sed -nr "s/.*'([[:alnum:]]+)'.*/\1/p"
; Default: none
speaker-mixer = Speaker
; Default: none
headphone-mixer = Headphone
; NOTE: This is required if headphone_mixer is defined
; Use the following command to list available device controls
; $ amixer controls | sed -r "/CARD/\!d; s/.*=([0-9]+).*name='([^']+)'.*/printf '%3.0f: %s\n' '\1' '\2'/e" | sort
; Default: none
headphone-id = 9
; Use volume mapping (similar to amixer -M and alsamixer), where the increase in volume is linear to the ear
; Default: false
mapped = true
format-muted-background = ${colors.background-unf}
format-volume-background = ${colors.background-alt}
format-volume = " <ramp-volume> <label-volume> "
format-volume-prefix = " "
label-muted = " mute "
;label-muted = "   "
; Only applies if <ramp-volume> is used
ramp-volume-0 = 
ramp-volume-1 = 
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 97
format-full-background = ${colors.background-mod2}
format-charging-background = ${colors.background-alt}
format-charging = " <animation-charging> <label-charging>"
format-charging-underline = #ffb52a
format-charging-suffix = " "
format-discharging-background = ${colors.background-alt}
format-discharging = " <ramp-capacity> <label-discharging> "
format-discharging-underline = ${self.format-charging-underline}
format-full =
format-full-prefix-foreground = ${colors.foreground-alt}
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
[module/powermenu]
type = custom/menu
format-spacing = 1
label-open = "  "
label-open-background = ${colors.background-unf}
label-open-foreground = ${colors.secondary}
label-close = "  cancel "
label-close-background = ${colors.background-unf}
label-close-foreground = ${colors.secondary}
label-separator = " "
label-separator-foreground = ${colors.foreground-alt}
menu-0-0 = reboot
menu-0-0-exec = menu-open-1
menu-0-1 = "power off "
menu-0-1-exec = menu-open-2
menu-1-0 = cancel
menu-1-0-exec = menu-open-0
menu-1-1 = reboot
menu-1-1-exec = sudo reboot
menu-2-0 = power off
menu-2-0-exec = shutdown now
menu-2-1 = cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
[global/wm]
margin-top = 5
margin-bottom = 5
;
; [module/xkeyboard]
; type = internal/xkeyboard
; blacklist-0 = num lock
;
; format-prefix = " "
; format-prefix-foreground = ${colors.foreground-alt}
; format-prefix-underline = ${colors.secondary}
;
; label-layout = %layout%
; label-layout-underline = ${colors.secondary}
;
; label-indicator-padding = 2
; label-indicator-margin = 1
; label-indicator-background = ${colors.secondary}
; label-indicator-underline = ${colors.secondary}
;
; [module/filesystem]
; type = internal/fs
; interval = 25
;
; mount-0 = /
;
; label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
; label-unmounted = %mountpoint% not mounted
; label-unmounted-foreground = ${colors.foreground-alt}
;
;
;[module/xbacklight]
;type = internal/xbacklight
;
;format = <label> <bar>
;label = BL
;
;bar-width = 10
;bar-indicator = |
;bar-indicator-foreground = #ff
;bar-indicator-font = 2
;bar-fill = -
;bar-fill-font = 2
;bar-fill-foreground = #9f78e1
;bar-empty = -
;bar-empty-font = 2
;bar-empty-foreground = ${colors.foreground-alt}
;bar-empty-background = ${colors.foreground-mod}
;
;[module/backlight-acpi]
;inherit = module/xbacklight
;type = internal/backlight
;card = intel_backlight
;
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "  "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-background = ${colors.background-alt}
format-underline = #f90000
label = %percentage%%
format-background = ${colors.background-alt}
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #4bffdc
label = %percentage_used%%
format-background = ${colors.background-alt}
; vim:ft=dosini

View file

@ -0,0 +1,25 @@
{ config, pkgs, lib, ... }:
let
cfg = config.luj.polybar;
in
with lib; {
options.luj.polybar = {
enable = mkEnableOption "Enable polybar";
};
config = mkIf cfg.enable {
services.polybar = {
enable = true;
package = pkgs.polybar.override {
i3GapsSupport = true;
};
script = "polybar -q PolybarTony &";
};
xdg.configFile."polybar/config".source = lib.mkForce ./config;
};
}

View file

@ -107,6 +107,7 @@ programs.dconf.enable = true;
luj.hmgr.julien = {
luj.programs.neovim.enable = true;
luj.i3.enable = true;
luj.polybar.enable = true;
home.packages = with pkgs; [
feh
meld
@ -149,20 +150,6 @@ home.keyboard = {
fonts.fontconfig.enable = true;
services.polybar = {
enable = true;
package = pkgs.polybar.override {
i3GapsSupport = true;
#i3Support = true;
};
script = "polybar -q PolybarTony &";
};
xsession.enable = true;
programs.rofi.enable = true;