Skip to content

Commit

Permalink
Update polybar config
Browse files Browse the repository at this point in the history
  • Loading branch information
charlespwd committed Apr 12, 2020
1 parent 27ab622 commit d401c19
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 27 deletions.
51 changes: 45 additions & 6 deletions config/polybar/config
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ modules-left = i3
modules-center =
; modules-right = filesystem xbacklight volume xkeyboard memory cpu wifi eth battery temperature date powermenu
; modules-right = recording vpn ip memory root home volume xkeyboard bluetooth battery calories slu date wifi
modules-right = server task recording vpn ip memory root home volume xkeyboard bluetooth battery slu date wifi
modules-right = mic-muted server task recording vpn ip cpu memory root home volume xkeyboard battery slu date

tray-position = right
tray-padding = 0
tray-transparent = false
tray-background = ${colors.background}
tray-maxsize = 24
tray-maxsize = 30
enable-ipc = true

;wm-restack = i3
Expand Down Expand Up @@ -95,6 +95,12 @@ label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
; label-indicator-underline = ${colors.secondary}

[module/mic-muted]
type = custom/script
exec = /home/charles/.config/polybar/is-muted
label-foreground = ${colors.red}
interval = 1

[module/server]
type = custom/script
exec = /home/charles/.config/polybar/server-indicator
Expand Down Expand Up @@ -291,8 +297,8 @@ card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix = " "
; format-prefix-foreground = ${colors.foreground-alt}
; format-underline = #f90000
label = %percentage%%

Expand Down Expand Up @@ -374,16 +380,49 @@ time-alt = %H:%M

label = %date%  %time%

; [module/volume]
; type = internal/volume
;
; format-volume = <label-volume> <bar-volume>
; label-volume = 
; label-volume-foreground = ${colors.foreground-dim}
;
; format-muted-prefix = " "
; format-muted-foreground = ${colors.foreground-alt}
; label-muted = sound muted
;
; bar-volume-width = 8
; bar-volume-foreground-0 = #55aa55
; bar-volume-foreground-1 = #55aa55
; bar-volume-foreground-2 = #55aa55
; bar-volume-foreground-3 = #55aa55
; bar-volume-foreground-4 = #55aa55
; bar-volume-foreground-5 = #f5a70a
; bar-volume-foreground-6 = #ff5555
; bar-volume-gradient = false
; bar-volume-indicator = |
; bar-volume-indicator-font = 2
; bar-volume-fill = ─
; bar-volume-fill-font = 2
; bar-volume-empty = ─
; bar-volume-empty-font = 2
; bar-volume-empty-foreground = ${colors.foreground-alt}

[module/volume]
type = internal/volume
type = internal/pulseaudio
; sink = alsa_output

format-volume = <label-volume> <bar-volume>
label-volume = 
label-volume-foreground = ${colors.foreground-dim}

;; use 153%
use-ui-max = true
click-right = pavucontrol &

format-muted-prefix = ""
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
label-muted = muted

bar-volume-width = 8
bar-volume-foreground-0 = #55aa55
Expand Down
7 changes: 7 additions & 0 deletions config/polybar/is-muted
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if pactl list sources | grep -q Mute:.yes; then
echo ""
else
echo ""
fi
27 changes: 13 additions & 14 deletions config/polybar/server-indicator
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash

source /home/charles/.config/colors.sh
# TICK="✓"
# CROSS="✗"

session="build"

lower() {
Expand All @@ -12,21 +8,24 @@ lower() {

has() {
name="$1"
symbol_up="$2"
symbol_down="$3"
target="$session:$name"
if tmux has-session -t "$target/iso" &> /dev/null; then
echo "2"
echo "$symbol_up$symbol_up"
elif tmux has-session -t "$target" &> /dev/null; then
echo "1"
echo "$symbol_up"
else
echo "0"
echo "$symbol_down"
fi
}

C=$(has "start/composer")
A=$(has "start/aldoshoes")
I=$(has "start/callitspring")
G=$(has "start/globoshoes")
R=$(has "start/redis")
N=$(has "start/nginx")
A=$(has "start/aldoshoes" "A")
I=$(has "start/callitspring" "C")
G=$(has "start/globoshoes" "G")
C=$(has "start/composer" "C")
R=$(has "start/redis" "R")
N=$(has "start/nginx" "N")
S=$(has "start/simplified" "")

echo "$C$A$I$G$R$N"
echo -n "$A$I$G$R$N$C$S"
4 changes: 1 addition & 3 deletions config/polybar/since-update
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cat /var/log/pacman.log \
script="
const moment = require('moment')
const a = moment('$date', 'YYYY-MM-DD')
const b = moment()
const b = moment().startOf('day')
const diff = moment.duration(b.diff(a))
const red = x => console.log('%{F#cc241d}' + x + '%{F-}')
const orange = x => console.log('%{F#fe8019}' + x + '%{F-}')
Expand All @@ -24,8 +24,6 @@ if (diff.asDays() > 30) {
orange(Math.floor(diff.asWeeks()) + 'W')
} else if (diff.asDays() > 1) {
green(Math.ceil(diff.asDays()) + 'D')
} else if (diff.asHours() > 1) {
green(Math.ceil(diff.asHours()) + 'H')
}
"

Expand Down
24 changes: 20 additions & 4 deletions config/polybar/task-indicator
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,33 @@ source /home/charles/.config/colors.sh
# CROSS="✗"

# echo $neutral_orange
OVERDUE="%{F$neutral_red}"
URGENT="%{F$neutral_orange}"
DUETODAY="%{F$bright_yellow}"
DUETOMORROW="%{F$bright_yellow}"
OVERDUE=" %{F$neutral_red}"
URGENT=" %{F$neutral_orange}"
DUETODAY=" %{F$bright_yellow}"
DUETOMORROW=" %{F$bright_yellow}"
RECYCLING=" %{F$neutral_blue}"
COMPOST=" %{F$neutral_yellow}"
TRASH=" %{F$neutral_green}"
task="task rc.context=none"

has_at_least_1() {
count=$($task +READY "$@" count 2> /dev/null)
[[ $count -gt "0" ]]
}

trash_is_due() {
count=$($task +READY project:trash "$@" count 2> /dev/null)
[[ $count -gt "0" ]]
}

if trash_is_due recycling; then
echo -n "$RECYCLING"
elif trash_is_due trash; then
echo -n "$TRASH"
elif trash_is_due compost; then
echo -n "$COMPOST"
fi

if has_at_least_1 +OVERDUE; then
echo "$OVERDUE"
elif has_at_least_1 +DUETODAY; then
Expand Down

0 comments on commit d401c19

Please sign in to comment.