feat: add polybar

This commit is contained in:
Jacob Bachmann 2024-08-03 20:05:49 +02:00
parent 83500bb049
commit 13dc2f983e
Signed by: bchmnn
GPG key ID: 732A612DAD28067D
2 changed files with 186 additions and 0 deletions

View file

@ -5,17 +5,25 @@ let
# common = (import ../common.nix) { pkgs = pkgs; lib = lib; };
common = (import ../common.nix) { inherit pkgs; inherit lib; };
start-polybar = pkgs.writeShellScript "start-polybar" ''
${pkgs.polybarFull}/bin/polybar-msg cmd quit
echo "---" | tee -a /tmp/polybar.log
${pkgs.polybarFull}/bin/polybar 2>&1 | tee -a /tmp/polybar.log & disown
'';
in
{
imports = [
./autorandr.nix
./polybar.nix
./rofi.nix
];
home.packages = with pkgs; [
alacritty
dmenu
xclip # tool to access the x clipboard from a console application
wireplumber
feh # lightweight image viewer (also sets wallpaper)
brightnessctl # control screen brightness
@ -34,9 +42,11 @@ in
enable = true;
config = {
modifier = "Mod4";
bars = [ ];
terminal = "${pkgs.alacritty}/bin/alacritty";
menu = "${config.programs.rofi.package}/bin/rofi -show drun";
startup = with pkgs; [
{ command = "${start-polybar}"; }
{ command = "${gnome.gnome-keyring}/bin/gnome-keyring-daemon --start --components=ssh,secrets,pkcs11"; }
{ command = "${autorandr}/bin/autorandr -c"; }
{ command = "${feh}/bin/feh --bg-fill ${common.wallpaper.default}"; }

View file

@ -0,0 +1,176 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
polybarFull
];
xdg.configFile."polybar/config.ini" = {
text = ''
[colors]
background = #FFFFFF
background-alt = #D3D3D3
foreground = #000000
primary = #F0C674
secondary = #8ABEB7
blue = #4276b9
alert = #A54242
disabled = #707880
[bar/main]
width = 100%
height = 24pt
radius = 10
background = ''${colors.background}
foreground = ''${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator =
separator-foreground = ''${colors.disabled}
font-0 = DejaVuSansM Nerd Font:pixelsize=12;3
modules-left = xworkspaces xwindow
modules-right = systray wlan eth pulseaudio filesystem cpu temperature memory date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 4pt
tray-size = 55%
tray-background = ''${colors.blue}
format-background = ''${colors.blue}
format-padding = 10px
format-radius = 5.0
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ''${colors.background-alt}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ''${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ''${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /home
label-mounted = %free%
format-mounted = <label-mounted>
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <ramp-volume>
label-volume = %percentage%%
label-muted = 󰖁
ramp-volume-0 = 󰕿
ramp-volume-1 = 󰖀
ramp-volume-2 = 󰕾
click-right = pavucontrol
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ''${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ''${colors.background}
label-indicator-background = ''${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
label = %gb_used:2%
format = <label>
format-margin = 5px
[module/temperature]
type = internal/temperature
internal = 1
warn-temperature = 80
format-warn-padding = 10px
format = <label> <ramp>
format-warn = <label-warn> <ramp>
format-warn-background = #eb4d4b
format-warn-foreground = #ffffff
ramp-0 =
ramp-1 =
ramp-2 =
[module/cpu]
type = internal/cpu
interval = 2
label = %percentage:2%%
format = <label>
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %signal%
label-disconnected = 󰖪
[module/eth]
inherit = network-base
interface-type = wired
label-connected = eth 󰈁
label-disconnected = 󰈂
[module/date]
type = internal/date
interval = 1
date = %a %b %d %H:%M
label = %date%
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini
'';
};
}