Revert "Remove polybar"

I don't actually need to get rid of my old config files if I ever want
to have easy access to them in the future. Although I intend on using
Wayland, having a nice interface for traditional X applications may not
be a bad idea (some graphically intensive programs also run better there,
apparently).
This commit is contained in:
Donovan Glover 2021-05-14 10:11:22 -04:00
parent 02ebbd69b1
commit df1d328de9
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,106 @@
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
[color]
background = ${xrdb:background}
red = ${xrdb:color1}
green = ${xrdb:color2}
yellow = ${xrdb:color3}
blue = ${xrdb:color4}
magenta = ${xrdb:color5}
cyan = ${xrdb:color6}
text = ${xrdb:color7}
background-alt = ${xrdb:color8}
[bar/main]
modules-left = bspwm
modules-center = window
modules-right = cpu ram volume date time
monitor = VGA-1
wm-restack = bspwm
include-file = $HOME/.cache/polybar/config
foreground = ${color.background-alt}
background = ${color.background}
border-color = ${color.text}
font-0 = "Fira Mono:style=Bold:size=10"
font-1 = "Noto Sans CJK JP:size=10"
font-2 = "Font Awesome 5 Free:style=Solid:size=10"
font-3 = "Font Awesome 5 Free:style=Regular:size=10"
font-4 = "Font Awesome 5 Brands:style=Regular:size=10"
padding-left = 1
padding-right = 2
module-margin = 1
[module/bspwm]
type = internal/bspwm
pin-workspaces = true
format = <label-state> <label-mode>
label-monocle =  monocle mode
label-locked =  Locked
label-private =  Private
label-sticky =  Sticky
label-monocle-padding = 1
label-locked-padding = 1
label-private-padding = 1
label-sticky-padding = 1
label-monocle-foreground = ${color.yellow}
label-focused-padding = 1
label-urgent-padding = 1
label-occupied-padding = 1
label-empty-padding = 1
label-focused-foreground = ${color.text}
label-urgent-foreground = ${color.yellow}
[module/cpu]
type = internal/cpu
label =  %percentage%%
[module/ram]
type = internal/memory
label =  %gb_used%
[module/date]
type = internal/date
date =  %d.%m.%y
#date =  %B %d, %Y
#date =  %A
[module/time]
type = internal/date
date =  %H:%M
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 98
label-full = %percentage%%
label-charging = %percentage%%
label-discharigng = %percentage%
[module/mpd]
type = internal/mpd
format-offline = No song is currently playing.
label-song-maxlen = 100
label-song-ellipsis = true
format-online =  <label-song>
[module/volume]
type = internal/alsa
label-volume =  %percentage%%
[module/window]
type = internal/xwindow
label-maxlen = 120
label-empty = /usr/bin/bspwm
; vim:ft=dosini

View File

@ -0,0 +1,56 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
POLYBAR_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
POLYBAR_SCALE=$(($POLYBAR_DPI / 96))
# Terminate any previous instances of polybar
killall -q polybar
bspc_config() {
bspc config top_padding $1 &
bspc config border_width $2 &
bspc config window_gap $3 &
}
# Set defaults
POLYBAR_HEIGHT=$((35 * $POLYBAR_SCALE))
HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width')
# Make the bar float
if [ "$1" == "float" ]; then
POLYBAR_BORDER_SIZE=$((1 * $POLYBAR_SCALE)) # Later set to bspwm's border_width
POLYBAR_OFFSET_XY=$((30 * $POLYBAR_SCALE)) # Later set to bspwm's window_gap
POLYBAR_WIDTH=$(($HOST_WIDTH - $POLYBAR_OFFSET_XY * 2))
else
POLYBAR_WIDTH=$HOST_WIDTH
fi
# Set the bspwm variables
BSPWM_TOP_PADDING=$(($POLYBAR_HEIGHT + ${POLYBAR_OFFSET_XY:-0} + ${POLYBAR_BORDER_SIZE:-0} * 2))
BSPWM_BORDER_WIDTH=${POLYBAR_BORDER_SIZE:-0}
BSPWM_WINDOW_GAP=${POLYBAR_OFFSET_XY:-0}
bspc_config $BSPWM_TOP_PADDING $BSPWM_BORDER_WIDTH $BSPWM_WINDOW_GAP
# Make the polybar config
mkdir -p $HOME/.cache/polybar
cat >$HOME/.cache/polybar/config <<EOL
width = $POLYBAR_WIDTH
height = $POLYBAR_HEIGHT
offset-x = ${POLYBAR_OFFSET_XY:-0}
offset-y = ${POLYBAR_OFFSET_XY:-0}
border-size = ${POLYBAR_BORDER_SIZE:-0}
dpi = $POLYBAR_DPI
EOL
# Save the top_padding amount for use by other scripts
echo $BSPWM_TOP_PADDING > $HOME/.cache/polybar/bspwm_top_padding
# Wait until there are no more polybar instances running
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Start polybar
polybar main &

17
polybar/README.md Normal file
View File

@ -0,0 +1,17 @@
# polybar
[polybar][polybar] is an information panel for your desktop.
## Use Cases
polybar can be used to:
- Show the current desktop, empty desktops, and occupied desktops
- Show the date, time, volume, CPU statistics, and other information
- Show the current playing song or anything else you want
You should not use polybar if:
- You already use a desktop environment that has an information panel
[polybar]: https://github.com/jaagr/polybar