Add polybar config to pianocat theme
This commit is contained in:
parent
b16e7a0111
commit
aae79d06e3
336
themes/pianocat/polybar/config
Normal file
336
themes/pianocat/polybar/config
Normal file
|
@ -0,0 +1,336 @@
|
|||
[colors]
|
||||
bg = ${xrdb:background}
|
||||
fg = ${xrdb:foreground}
|
||||
black = ${xrdb:color0}
|
||||
bblack = ${xrdb:color8}
|
||||
red = ${xrdb:color1}
|
||||
bred = ${xrdb:color9}
|
||||
green = ${xrdb:color2}
|
||||
bgreen = ${xrdb:color10}
|
||||
yellow = ${xrdb:color3}
|
||||
byellow = ${xrdb:color11}
|
||||
blue = ${xrdb:color4}
|
||||
bblue = ${xrdb:color12}
|
||||
magenta = ${xrdb:color5}
|
||||
bmagenta = ${xrdb:color13}
|
||||
cyan = ${xrdb:color6}
|
||||
bcyan = ${xrdb:color14}
|
||||
white = ${xrdb:color7}
|
||||
bwhite = ${xrdb:color15}
|
||||
|
||||
bg-alt = #0F1013
|
||||
fg-alt = #25282a
|
||||
icons = #555856
|
||||
alert = ${colors.red}
|
||||
|
||||
[global/wm]
|
||||
margin-top = 0
|
||||
margin-bottom = 24
|
||||
|
||||
[bar/main]
|
||||
monitor = ${env:MONITOR}
|
||||
monitor-strict = true
|
||||
enable-ipc = true
|
||||
wm-restack = bspwm
|
||||
# REQUIRED to move the window with hideit.sh
|
||||
override-redirect = true
|
||||
|
||||
background =
|
||||
foreground = ${colors.fg}
|
||||
|
||||
width = 100%
|
||||
height = 24
|
||||
offset-x = 0
|
||||
offset-y = 8
|
||||
bottom = 1
|
||||
|
||||
overline-size = 0
|
||||
overline-color = #f00
|
||||
underline-size = 0
|
||||
underline-color = #00f
|
||||
|
||||
border-bottom-size = 0
|
||||
|
||||
padding-left = 2
|
||||
padding-right = 2
|
||||
module-margin-left = 0
|
||||
module-margin-right = 0
|
||||
|
||||
font-0 = "Fira Code:pixelsize=9;2"
|
||||
font-1 = "Wuncon Siji:pixelsize=12;2"
|
||||
font-2 = "Siji:pixelsize=10;2"
|
||||
|
||||
; modules-left = volume pad cpu memory pad pkg mail
|
||||
modules-left = volume pad cpu memory
|
||||
modules-center = bspwm
|
||||
; modules-right = battery wlan app-rslsync app-redshift pad date
|
||||
modules-right = battery wlan app-redshift pad date
|
||||
|
||||
;tray-position = center
|
||||
;tray-padding = 2
|
||||
;tray-transparent = true
|
||||
;tray-background = #0063ff
|
||||
|
||||
[module/bspwm]
|
||||
type = internal/bspwm
|
||||
pin-workspaces = true
|
||||
enable-click = true
|
||||
|
||||
ws-icon-0 = 1;
|
||||
ws-icon-1 = 2;
|
||||
ws-icon-2 = 3;
|
||||
ws-icon-3 = 4;
|
||||
ws-icon-4 = 5;
|
||||
ws-icon-default = x
|
||||
|
||||
format = <label-state> <label-mode>
|
||||
label-padding = 1
|
||||
|
||||
label-focused = %icon%
|
||||
label-focused-background = #33000000
|
||||
label-focused-foreground = ${colors.green}
|
||||
; label-focused-underline = ${colors.magenta}
|
||||
; label-focused-foreground = ${xrdb:color2}
|
||||
label-focused-padding = 1
|
||||
|
||||
label-occupied = %icon%
|
||||
label-occupied-foreground = ${colors.icons}
|
||||
label-occupied-padding = 1
|
||||
|
||||
; label-urgent = %icon%
|
||||
label-urgent-foreground = ${colors.red}
|
||||
; label-urgent-background = ${colors.alert}
|
||||
label-urgent-padding = 1
|
||||
|
||||
label-empty = %icon%
|
||||
label-empty-foreground = ${colors.fg-alt}
|
||||
label-empty-padding = 1
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 5
|
||||
|
||||
label = %date% %time%
|
||||
date = %A, %h %d
|
||||
date-alt = %Y-%m-%d
|
||||
time = %I:%M %p
|
||||
time-alt = %H:%M:%S
|
||||
format-prefix = ""
|
||||
format-prefix-padding = 1
|
||||
; format-prefix-background = ${colors.bg-alt}
|
||||
format-prefix-foreground = ${colors.icons}
|
||||
; format-underline = ${xrdb:color4}
|
||||
|
||||
[module/xwindow]
|
||||
type = internal/xwindow
|
||||
label = %title:0:80:...%
|
||||
label-padding-left = 2
|
||||
|
||||
; [module/mpd]
|
||||
; type = internal/mpd
|
||||
; host = /home/hlissner/.config/mpd/mpd.sock
|
||||
;
|
||||
; format-online = <label-song> <toggle>
|
||||
; format-padding = 5
|
||||
;
|
||||
; label-song-maxlen = 45
|
||||
; label-song-ellipsis = true
|
||||
;
|
||||
; icon-prev =
|
||||
; icon-seekb =
|
||||
; icon-stop =
|
||||
; icon-play =
|
||||
; icon-pause =
|
||||
; icon-next =
|
||||
; icon-seekf =
|
||||
;
|
||||
; icon-random =
|
||||
; icon-repeat =
|
||||
;
|
||||
; toggle-on-foreground = ${colors.fg}
|
||||
; toggle-off-foreground = #66
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format = <bar-load>
|
||||
format-prefix = ""
|
||||
format-foreground = ${colors.icons}
|
||||
; format-underline = #f90000
|
||||
; label = %percentage%%
|
||||
format-padding = 1
|
||||
|
||||
bar-load-indicator =
|
||||
bar-load-width = 6
|
||||
bar-load-foreground-0 = ${colors.green}
|
||||
bar-load-foreground-1 = ${colors.green}
|
||||
bar-load-foreground-2 = ${colors.yellow}
|
||||
bar-load-foreground-3 = ${colors.red}
|
||||
bar-load-foreground-4 = ${colors.red}
|
||||
bar-load-fill = |
|
||||
bar-load-empty = ¦
|
||||
bar-load-empty-foreground = ${colors.fg-alt}
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 3
|
||||
format = <bar-used>
|
||||
format-prefix = ""
|
||||
format-prefix-foreground = ${colors.icons}
|
||||
; format-underline = #4bffdc
|
||||
; label = %percentage_used%%
|
||||
format-padding-left = 1
|
||||
|
||||
; Only applies if <bar-used> is used
|
||||
bar-used-indicator =
|
||||
bar-used-width = 6
|
||||
bar-used-foreground-0 = ${colors.green}
|
||||
bar-used-foreground-1 = ${colors.green}
|
||||
bar-used-foreground-2 = ${colors.yellow}
|
||||
bar-used-foreground-3 = ${colors.red}
|
||||
bar-used-foreground-4 = ${colors.red}
|
||||
bar-used-fill = |
|
||||
bar-used-empty = ¦
|
||||
bar-used-empty-foreground = ${colors.fg-alt}
|
||||
|
||||
[module/wlan]
|
||||
type = internal/network
|
||||
interface = ${env:WLP:wlp3s0}
|
||||
interval = 3.0
|
||||
|
||||
format-connected = <ramp-signal>
|
||||
format-disconnected = !
|
||||
format-disconnected-foreground = ${colors.red}
|
||||
|
||||
; label-connected =
|
||||
; label-disconnected = !
|
||||
; label-disconnected-foreground = ${colors.red}
|
||||
|
||||
ramp-signal-0 =
|
||||
ramp-signal-0-foreground = ${colors.yellow}
|
||||
ramp-signal-1 =
|
||||
ramp-signal-1-foreground = ${colors.yellow}
|
||||
ramp-signal-2 =
|
||||
ramp-signal-2-foreground = ${colors.yellow}
|
||||
ramp-signal-3 =
|
||||
ramp-signal-3-foreground = ${colors.icons}
|
||||
ramp-signal-4 =
|
||||
ramp-signal-4-foreground = ${colors.icons}
|
||||
|
||||
; [module/eth]
|
||||
; type = internal/network
|
||||
; interface = ${env:ETH:enp2s0}
|
||||
; interval = 4.0
|
||||
;
|
||||
; ; format-connected-underline = #55aa55
|
||||
; ; format-connected-prefix = " "
|
||||
; format-connected-foreground-foreground = ${colors.fg-alt}
|
||||
; label-connected = %local_ip%
|
||||
;
|
||||
; format-disconnected-underline = ${self.format-connected-underline}
|
||||
; label-disconnected = %ifname% disconnected
|
||||
; label-disconnected-foreground = ${colors.fg-alt}
|
||||
|
||||
[module/volume]
|
||||
type = internal/volume
|
||||
|
||||
; format-volume = <label-volume> <bar-volume>
|
||||
format-volume = <ramp-volume> <bar-volume>
|
||||
; label-volume = " "
|
||||
label-volume-foreground = ${colors.fg}
|
||||
|
||||
; format-muted-prefix = " "
|
||||
format-muted-foreground = ${colors.red}
|
||||
label-muted =
|
||||
|
||||
bar-volume-width = 8
|
||||
bar-volume-foreground-0 = ${colors.blue}
|
||||
bar-volume-foreground-1 = ${colors.blue}
|
||||
bar-volume-foreground-2 = ${colors.blue}
|
||||
bar-volume-foreground-3 = ${colors.blue}
|
||||
bar-volume-foreground-4 = ${colors.blue}
|
||||
bar-volume-foreground-5 = ${colors.blue}
|
||||
bar-volume-foreground-6 = ${colors.blue}
|
||||
bar-volume-gradient = false
|
||||
bar-volume-indicator = |
|
||||
bar-volume-indicator-font = 2
|
||||
bar-volume-indicator-foreground = #ff
|
||||
bar-volume-fill = ─
|
||||
bar-volume-fill-font = 2
|
||||
bar-volume-empty = ─
|
||||
bar-volume-empty-font = 2
|
||||
bar-volume-empty-foreground = ${colors.fg-alt}
|
||||
|
||||
; Only applies if <ramp-volume> is used
|
||||
ramp-volume-0 =
|
||||
ramp-volume-1 =
|
||||
ramp-volume-2 =
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = ADP1
|
||||
full-at = 98
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-charging-underline = #ffb52a
|
||||
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
format-discharging-underline = ${self.format-charging-underline}
|
||||
|
||||
format-full-prefix = " "
|
||||
format-full-prefix-foreground = ${colors.fg-alt}
|
||||
format-full-underline = ${self.format-charging-underline}
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-foreground = ${colors.fg-alt}
|
||||
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-foreground = ${colors.fg-alt}
|
||||
animation-charging-framerate = 750
|
||||
|
||||
|
||||
;=====================================================
|
||||
; Custom scripts
|
||||
;=====================================================
|
||||
|
||||
[module/pad]
|
||||
type = custom/text
|
||||
content = " "
|
||||
content-foreground = ${colors.fg-alt}
|
||||
|
||||
[module/pkg]
|
||||
type = custom/ipc
|
||||
hook-0 = ~/.config/polybar/modules/updates
|
||||
initial = 1
|
||||
click-left = polybar-msg -p %pid% hook pkg 1
|
||||
format-padding = 1
|
||||
|
||||
[module/mail]
|
||||
type = custom/ipc
|
||||
hook-0 = ~/.config/polybar/modules/mail
|
||||
initial = 1
|
||||
click-left = polybar-msg -p %pid% hook mail 1
|
||||
format-padding-right = 1
|
||||
|
||||
[module/app-redshift]
|
||||
type = custom/script
|
||||
exec = echo 1
|
||||
exec-if = pgrep -x redshift
|
||||
format = ""
|
||||
format-foreground = ${colors.icons}
|
||||
interval = 2
|
||||
|
||||
[module/app-rslsync]
|
||||
type = custom/script
|
||||
exec = echo 1
|
||||
exec-if = pgrep -x rslsync
|
||||
format = ""
|
||||
format-foreground = ${colors.icons}
|
||||
interval = 60
|
||||
|
||||
; vim:ft=dosini
|
21
themes/pianocat/polybar/modules/app-redshift
Executable file
21
themes/pianocat/polybar/modules/app-redshift
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Specifying the icon(s) in the script
|
||||
# This allows us to change its appearance conditionally
|
||||
pgrep -x redshift &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
|
||||
temp=${temp//K/}
|
||||
fi
|
||||
|
||||
# OPTIONAL: Append ' ${temp}K' after $icon
|
||||
if [[ -z $temp ]]; then
|
||||
echo "%{F#65737E}$icon" # Greyed out (not running)
|
||||
elif [[ $temp -ge 5000 ]]; then
|
||||
echo "%{F#8FA1B3}$icon" # Blue
|
||||
elif [[ $temp -ge 4000 ]]; then
|
||||
echo "%{F#EBCB8B}$icon" # Yellow
|
||||
else
|
||||
echo "%{F#D08770}$icon" # Orange
|
||||
fi
|
||||
|
9
themes/pianocat/polybar/modules/app-rslsync
Executable file
9
themes/pianocat/polybar/modules/app-rslsync
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
icon=""
|
||||
|
||||
if pgrep -x rslsync &> /dev/null; then
|
||||
echo "%{F#e5e8e6}$icon"
|
||||
else
|
||||
echo "%{F#65737E}$icon"
|
||||
fi
|
92
themes/pianocat/polybar/modules/mail
Executable file
92
themes/pianocat/polybar/modules/mail
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import imaplib
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
from subprocess import Popen
|
||||
|
||||
CONFIG_FILE = os.path.expanduser("~/.secrets/email")
|
||||
CACHE_FILE = "/tmp/polybar-mail"
|
||||
ICON = ""
|
||||
|
||||
try:
|
||||
import gnupg
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
print("%{{F{}}}*".format("#555856", ICON))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
#
|
||||
def internet_is_on():
|
||||
try:
|
||||
host = socket.gethostbyname("www.google.com")
|
||||
socket.create_connection((host, 80), 2)
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def unread_count(address, password):
|
||||
imap = imaplib.IMAP4_SSL('imap.gmail.com', 993)
|
||||
imap.login(address, password)
|
||||
imap.select('INBOX')
|
||||
|
||||
status, resp = imap.search(None, 'UNSEEN')
|
||||
imap.close()
|
||||
imap.logout()
|
||||
|
||||
return len(resp[0].split())
|
||||
|
||||
|
||||
def ding():
|
||||
Popen(["{}/bin/ding".format(os.getenv("DOTFILES", os.expanduser("~/.dotfiles")))])
|
||||
|
||||
#
|
||||
def main():
|
||||
try:
|
||||
if not internet_is_on():
|
||||
raise IOError("Internet is off")
|
||||
|
||||
secrets = Path(CONFIG_FILE)
|
||||
if not secrets.exists():
|
||||
raise IOError("Can't find secrets")
|
||||
|
||||
gpg = gnupg.GPG()
|
||||
gpgdata = gpg.decrypt(secrets.read_bytes())
|
||||
if not gpgdata.ok:
|
||||
raise IOError("Couldn't decrypt secrets: {}".format(gpgdata.status))
|
||||
accounts = [line.split(':') for line in gpgdata.data.decode('utf-8').strip().split('\n')]
|
||||
|
||||
last_total = 0
|
||||
cache = Path(CACHE_FILE)
|
||||
if cache.exists():
|
||||
cache_text = cache.read_text()
|
||||
last_total = int(cache.read_text())
|
||||
|
||||
total = 0
|
||||
for addr, pwd in accounts:
|
||||
total += unread_count(addr, pwd)
|
||||
|
||||
if total != last_total:
|
||||
ding()
|
||||
if total != 0:
|
||||
print("%{{F{}}}{}{}".format("#f0c674", ICON, total))
|
||||
else:
|
||||
print("%{{F{}}}{}".format("#555856", ICON))
|
||||
|
||||
cache.write_text(str(total))
|
||||
except IOError as e:
|
||||
print("ERROR: {}".format(e), file=sys.stderr)
|
||||
print("%{{F{}}}{}!".format("#cc6666", ICON))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
if sys.argv[1:]:
|
||||
print("%{{F{}}}{}".format("#555856", ICON))
|
||||
else:
|
||||
main()
|
22
themes/pianocat/polybar/modules/updates
Executable file
22
themes/pianocat/polybar/modules/updates
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env zsh
|
||||
icon=""
|
||||
if [[ $1 == "1" ]]; then
|
||||
echo "%{F#555856}${icon}%{F-}"
|
||||
exit
|
||||
fi
|
||||
|
||||
pac=$(checkupdates 2>/dev/null | wc -l)
|
||||
aur=$(yay -Pn 2>/dev/null)
|
||||
|
||||
[[ -f /tmp/polybar-updates ]] && last=$(</tmp/polybar-updates)
|
||||
check=$((pac + aur))
|
||||
if [[ "$check" != "0" ]]; then
|
||||
echo "%{F#b5bd68}${icon}$pac+$aur%{F-}"
|
||||
if [[ $last != "$pac$aur" ]]; then
|
||||
notify-send "$((pac+aur)) updates available"
|
||||
ding updates
|
||||
echo "$pac$aur" >/tmp/polybar-updates
|
||||
fi
|
||||
else
|
||||
echo "%{F#555856}${icon}%{F-}"
|
||||
fi
|
7
themes/pianocat/polybar/run.sh
Executable file
7
themes/pianocat/polybar/run.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
killall -q polybar
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
polybar main >>$XDG_DATA_HOME/polybar.log 2>&1 &
|
||||
echo 'Polybar launched...'
|
Loading…
Reference in a new issue