summaryrefslogtreecommitdiff
path: root/polybar
diff options
context:
space:
mode:
Diffstat (limited to 'polybar')
-rwxr-xr-xpolybar/config.ini247
-rwxr-xr-xpolybar/launcher.sh9
-rwxr-xr-xpolybar/playerctl.sh30
3 files changed, 286 insertions, 0 deletions
diff --git a/polybar/config.ini b/polybar/config.ini
new file mode 100755
index 0000000..71720a2
--- /dev/null
+++ b/polybar/config.ini
@@ -0,0 +1,247 @@
+[colors]
+background = #8a263434
+background-alt = #1e1e2e00
+foreground = #C5C8C6
+primary = #EAEAEA
+secondary = #9C9C9C
+alert = #A54242
+disabled = #707880
+
+[bar/mainbar]
+width = 100%
+height = 24pt
+radius = 0
+
+dpi = 96
+
+background = ${colors.background}
+foreground = ${colors.foreground}
+
+line-size = 3pt
+
+tray-position = right
+
+border-size = 0pt
+border-color = #00000000
+
+padding-left = 0
+padding-right = 1
+
+module-margin = 1
+
+separator = |
+separator-foreground = ${colors.disabled}
+
+font-0 = IntoneMono NFM
+
+modules-left = xworkspaces xwindow
+modules-center = date playerctl
+modules-right = pulseaudio systray battery
+
+cursor-click = pointer
+cursor-scroll = ns-resize
+
+enable-ipc = true
+
+wm-restack = generic
+; wm-restack = bspwm
+; wm-restack = i3
+
+; override-redirect = true
+
+; This module is not active by default (to enable it, add it to one of the
+; modules-* list above).
+; Please note that only a single tray can exist at any time. If you launch
+; multiple bars with this module, only a single one will show it, the others
+; will produce a warning. Which bar gets the module is timing dependent and can
+; be quite random.
+; For more information, see the documentation page for this module:
+; https://polybar.readthedocs.io/en/stable/user/modules/tray.html
+[module/systray]
+type = internal/tray
+
+format-margin = 8pt
+tray-spacing = 16pt
+
+[module/backlight]
+type = internal/backlight
+
+; Use the following command to list available cards:
+; $ ls -1 /sys/class/backlight/
+; Default: first usable card in /sys/class/backlight (new in version 3.7.0)
+card = intel_backlight
+
+; Use the `/sys/class/backlight/.../actual-brightness` file
+; rather than the regular `brightness` file.
+; New in version 3.6.0
+; Changed in version: 3.7.0: Defaults to true also on amdgpu backlights
+; Default: true
+use-actual-brightness = true
+
+; Interval in seconds after which after which the current brightness is read
+; (even if no update is detected).
+; Use this as a fallback if brightness updates are not registering in polybar
+; (which happens if the use-actual-brightness is false).
+; There is no guarantee on the precisio of this timing.
+; Set to 0 to turn off
+; New in version 3.7.0
+; Default: 0 (5 if use-actual-brightness is false)
+poll-interval = 5
+
+; Enable changing the backlight with the scroll wheel
+; NOTE: This may require additional configuration on some systems. Polybar will
+; write to `/sys/class/backlight/${self.card}/brightness` which requires polybar
+; to have write access to that file.
+; DO NOT RUN POLYBAR AS ROOT.
+; The recommended way is to add the user to the
+; `video` group and give that group write-privileges for the `brightness` file.
+; See the ArchWiki for more information:
+; https://wiki.archlinux.org/index.php/Backlight#ACPI
+; Default: false
+enable-scroll = false
+
+; Interval for changing the brightness (in percentage points).
+; New in version 3.7.0
+; Default: 5
+scroll-interval = 10
+
+[module/battery]
+type = internal/battery
+
+; This is useful in case the battery never reports 100% charge
+; Default: 100
+full-at = 100
+
+; format-low once this charge percentage is reached
+; Default: 10
+; New in version 3.6.0
+low-at = 25
+
+; Use the following command to list batteries and adapters:
+; $ ls -1 /sys/class/power_supply/
+battery = BAT0
+adapter = ADP1
+
+; If an inotify event haven't been reported in this many
+; seconds, manually poll for new values.
+;
+; Needed as a fallback for systems that don't report events
+; on sysfs/procfs.
+;
+; Disable polling by setting the interval to 0.
+;
+; Default: 5
+poll-interval = 5
+
+[module/xworkspaces]
+type = internal/xworkspaces
+
+label-active = %name%
+label-active-background = ${colors.background-alt}
+label-active-underline= ${colors.primary}
+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 =
+label-empty-foreground = ${colors.disabled}
+label-empty-padding = 1
+
+[module/xwindow]
+type = internal/xwindow
+label = %title:0:60:...%
+label-maxlen = 45
+
+[module/filesystem]
+type = internal/fs
+interval = 25
+
+mount-0 = /
+
+label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
+
+label-unmounted = %mountpoint% not mounted
+label-unmounted-foreground = ${colors.disabled}
+
+[module/pulseaudio]
+type = internal/pulseaudio
+
+format-volume-prefix = "󰕾 "
+format-volume-prefix-foreground = ${colors.primary}
+format-volume = <label-volume>
+
+label-volume = %percentage%%
+
+label-muted = "󰖁 "
+label-muted-foreground = ${colors.disabled}
+
+[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
+format-prefix = "RAM "
+format-prefix-foreground = ${colors.primary}
+label = %percentage_used:2%%
+
+[module/cpu]
+type = internal/cpu
+interval = 2
+format-prefix = "CPU "
+format-prefix-foreground = ${colors.primary}
+label = %percentage:2%%
+
+[network-base]
+type = internal/network
+interval = 5
+format-connected = <label-connected>
+format-disconnected = <label-disconnected>
+; label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
+label-disconnected = 󰤭
+
+[module/wlan]
+inherit = network-base
+interface-type = wireless
+; label-connected = %{F#F0C674}%ifname%%{F-} %essid%
+label-connected = 󰖩 %essid%
+
+[module/eth]
+inherit = network-base
+interface-type = wired
+label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
+
+[module/date]
+type = internal/date
+interval = 1
+
+date = %H:%M
+date-alt = %Y-%m-%d %H:%M:%S
+
+label = %date%
+label-foreground = #FFFFFF
+
+[settings]
+screenchange-reload = true
+pseudo-transparency = false
+
+; vim:ft=dosini
+[module/playerctl]
+type = custom/script
+exec = /home/anand/dots/polybar/playerctl.sh
+interval = 0.5
+label-foreground = #ffffff
diff --git a/polybar/launcher.sh b/polybar/launcher.sh
new file mode 100755
index 0000000..e68e728
--- /dev/null
+++ b/polybar/launcher.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Terminate already running bar instances
+killall -q polybar
+# If all your bars have ipc enabled, you can also use
+# polybar-msg cmd quit
+
+# Launch Polybar, using default config location ~/.config/polybar/config.ini
+polybar mainbar 2>&1 | tee -a /tmp/polybar.log & disown
diff --git a/polybar/playerctl.sh b/polybar/playerctl.sh
new file mode 100755
index 0000000..4646652
--- /dev/null
+++ b/polybar/playerctl.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+CONFIG="$HOME/.config/polybar/config.ini"
+color=$(awk '
+ $0 ~ /^\[module\/playerctl\]/ { in_section=1 }
+ in_section && $0 ~ /^label-foreground/ {
+ gsub(/[ \t]+/, "", $0); split($0, a, "="); print a[2]; exit
+ }
+' "$CONFIG")
+
+color=${color:-#ffffff} # fallback
+
+icon_color="%{F$color}"
+reset_color="%{F-}"
+
+playerctlstatus=$(playerctl status 2>/dev/null)
+song=$(playerctl metadata title 2>/dev/null)
+artist=$(playerctl metadata artist 2>/dev/null)
+
+if [[ -z "$playerctlstatus" ]]; then
+ echo ""
+elif [[ "$playerctlstatus" =~ "Playing" ]]; then
+ if [[ -z "$artist" ]]; then
+ echo "%{A1:playerctl pause:}$icon_color⏸️$reset_color $song%{A}"
+ else
+ echo "%{A1:playerctl pause:}$icon_color⏸️$reset_color $song%{A}"
+ fi
+else
+ echo "%{A1:playerctl play:}$icon_color▶️$reset_color $song%{A}"
+fi