From df1d328de9bb414ce2635e31928eb83f983cebd0 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 14 May 2021 10:11:22 -0400 Subject: [PATCH] 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). --- polybar/.config/polybar/config | 106 ++++++++++++++++++++++++++++++ polybar/.config/polybar/launch.sh | 56 ++++++++++++++++ polybar/README.md | 17 +++++ 3 files changed, 179 insertions(+) create mode 100644 polybar/.config/polybar/config create mode 100755 polybar/.config/polybar/launch.sh create mode 100644 polybar/README.md diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config new file mode 100644 index 00000000..5669d344 --- /dev/null +++ b/polybar/.config/polybar/config @@ -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-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 =  + +[module/volume] +type = internal/alsa +label-volume =  %percentage%% + +[module/window] +type = internal/xwindow +label-maxlen = 120 +label-empty = /usr/bin/bspwm + +; vim:ft=dosini diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh new file mode 100755 index 00000000..0ea3db20 --- /dev/null +++ b/polybar/.config/polybar/launch.sh @@ -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 < $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 & diff --git a/polybar/README.md b/polybar/README.md new file mode 100644 index 00000000..0e1a13d5 --- /dev/null +++ b/polybar/README.md @@ -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