This commit is contained in:
Marco Thomas
2020-10-28 22:40:43 +01:00
parent 3eb990104b
commit 1502082ae6
9 changed files with 105 additions and 445 deletions

View File

@@ -8,11 +8,11 @@ yellow = #d19a66
accent = #98c379
accent-alt = #98c379
############################## BARS
[bar/laptop]
monitor = ${env:MONITOR}
font-0 = "Heebo Medium:pixelsize=10;1"
#font-0 = "FiraCode Nerd Font Mono:pixelsize=9;2"
font-1 = "Noto Sans CJK JP:antialiase=false:pixelsize=9;1"
font-2 = "Siji:size=7;1"
font-3 = "Wuncon Siji:size=7;1"
@@ -45,23 +45,21 @@ wm-restack = i3
[bar/desktop]
inherit = bar/laptop
modules-right = update_yay volume date
modules-right = update_yay volume calendar
[bar/desktop_second]
inherit = bar/desktop
tray-position = none
modules-right = volume calendar
modules-right = volume date
############################## MODULES
[module/i3]
type = internal/i3
pin-workspaces = true
wrapping-scroll = false
format = <label-state> <label-mode>
format-NAME-font = 1
ws-icon-0 = 1;一
ws-icon-1 = 2;二
ws-icon-2 = 3;三
@@ -72,7 +70,6 @@ ws-icon-6 = 7;七
ws-icon-7 = 8;八
ws-icon-8 = 9;九
ws-icon-9 = 10;十
ws-icon-default = 
label-focused = "%icon%"
label-focused-foreground = ${colors.background}
@@ -96,12 +93,23 @@ label-mode-foreground = ${colors.urgent}
[module/xwindow]
type = internal/xwindow
label = %title%
label-underline = ${colors.accent}
label-maxlen = 100
label-underline = ${colors.accent}
[module/date]
type = internal/date
date = %a, %d.%b %Y %H:%M
format-prefix = " "
format-prefix-foreground = ${colors.accent-alt}
format-underline = ${colors.accent}
[module/calendar]
type = custom/script
exec = ~/.config/polybar/scripts/popup-calendar.sh
interval = 5
click-left = ~/.config/polybar/scripts/popup-calendar.sh --popup &
format-prefix = " "
format-prefix-foreground = ${colors.accent-alt}
format-underline = ${colors.accent}
@@ -111,6 +119,7 @@ type = internal/backlight
#ls -1 /sys/class/backlight
card = amdgpu_bl0
label = %percentage%%
format-prefix = " "
format-prefix-foreground = ${colors.accent-alt}
format-underline = ${colors.accent}
@@ -121,20 +130,19 @@ battery = BAT0
apdapter = ADP1
format-charging = <animation-charging> <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full = <ramp-capacity> <label-full>
label-charging = %percentage%%
animation-charging-foreground = ${colors.accent-alt}
format-charging-underline = ${colors.yellow}
format-discharging = <ramp-capacity> <label-discharging>
label-discharging = %percentage%%
format-discharging-underline = ${colors.accent}
format-full = <ramp-capacity> <label-full>
label-full = %percentage%%
format-full-underline = ${colors.accent}
ramp-capacity-foreground = ${colors.accent-alt}
animation-charging-foreground = ${colors.accent-alt}
label-charging = %percentage%%
label-discharging = %percentage%%
label-full = %percentage%%
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
@@ -150,33 +158,28 @@ animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-framerate = 750
[module/volume]
type = internal/pulseaudio
format-volume = <ramp-volume> <label-volume>
format-volume = <label-volume>
click-right = pavucontrol &
bar-volume-width = 10
bar-volume-indicator = |
bar-volume-fill = ─
bar-volume-empty = ─
bar-volume-fill-foreground = #ffffff
ramp-volume-0 = " "
ramp-volume-1 = " "
ramp-volume-2 = " "
ramp-volume-3 = " "
ramp-volume-4 = " "
ramp-headphones-0 = 
ramp-headphones-1 = 
ramp-volume-foreground = ${colors.accent-alt}
#bar-volume-width = 10
#bar-volume-indicator = |
#bar-volume-fill =
#bar-volume-empty =
#bar-volume-fill-foreground = #ffffff
#
#ramp-volume-0 = " "
#ramp-volume-1 = " "
#ramp-volume-2 = " "
#ramp-volume-3 = " "
#ramp-volume-4 = " "
#ramp-volume-foreground = ${colors.accent-alt}
label-volume = %percentage%%
#format-volume-prefix = " "
#format-volume-prefix-foreground = ${colors.accent-alt}
format-volume-prefix = " "
format-volume-prefix-foreground = ${colors.accent-alt}
format-volume-underline = ${colors.accent}
format-muted-prefix = " "
@@ -189,34 +192,31 @@ interface = wlo1
interval = 3.0
accumulate-stats = true
unknown-as-up = true
label-connected = %essid%
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.accent-alt}
format-connected-underline = ${colors.accent}
label-disconnected = "No Wifi"
format-disconnected-underline = ${colors.urgent}
[module/networkupdown]
type = internal/network
interface = enp24s0
interval = 3.0
accumulate-stats = true
unknown-as-up = true
label-connected =  %upspeed%  %downspeed%
[module/update_yay]
type = custom/script
exec = ~/.config/polybar/scripts/yay_updates.sh
tail = true
interval = 60
click-left = alacritty -e yay &
format-prefix = " "
format-prefix-foreground = ${colors.accent-alt}
format-underline = ${colors.accent}
interval = 60
[module/spotify]
type = custom/script
exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist}: {song}'
interval = 1
format-prefix = " "
format-prefix-foreground = ${colors.accent-alt}
format-underline = ${colors.accent}
exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist}: {song}'

View File

@@ -1,352 +0,0 @@
; vim: ft=dosini
[colors]
transparent = #00000000
red = #BF616A
orange = #D08770
yellow = #EBCB8B
green = #A3BE8C
purple = #B48EAD
blue0 = #8FBCBB
blue1 = #88C0D0
blue2 = #81A1C1
blue3 = #5E81AC
nord0 = #2E3440
nord1 = #3b4252
nord2 = #434c5e
nord3 = #4C566A
frost0 = #d8dee9
frost1 = #e5e9f0
frost2 = #ECEFF4
accent = ${colors.green}
foreground = ${colors.frost2}
background = ${colors.nord0}
################################################################################
[bar/global]
monitor = ${env:MONITOR}
font-0 = "FiraCode Nerd Font Mono:pixelsize=9;3"
font-1 = "IPAGothic:fontformat=truetype:antialias=false:pixelsize=11;2"
font-2 = "Siji:size=7;2"
bottom = false
radius = 12
height = 27px
foreground = ${colors.foreground}
background = #2e3440
module-margin= 0
wm-name = i3
wm-restack = i3
################################################################################
[bar/all]
inherit = bar/global
width = 80%
override-redirect = true
padding = 3
offset-x = 10%:-8px
offset-y = 8px
modules-left = i3
modules-center = spotify
modules-right = update backlight volume date
################################################################################
[bar/workspaces]
inherit = bar/global
width = 10%
override-redirect = true
offset-x = 8px
offset-y = 8px
line-size = 3
modules-center = i3
################################################################################
[bar/music]
inherit = bar/global
width = 22%
override-redirect = true
offset-x = 11.5%-8px
offset-y = 8px
modules-center = spotify
################################################################################
[bar/status]
inherit = bar/global
width = 20%
override-redirect = true
fixed-center = true
offset-x = 80%:-8px
offset-y = 8px
module-margin = 1
line-size = 3
modules-center = backlight volume battery date
################################################################################
[bar/tray]
inherit = bar/global
width = 7%
override-redirect = true
fixed-center = true
bottom = true
offset-x = 93%:-8px
offset-y = 8px
tray-position = center
tray-padding = 2
modules-center = update
###############################################################################
[module/i3]
type = internal/i3
pin-workspaces = true
wrapping-scroll = false
format = <label-state> <label-mode>
foreground = ${colors.foreground}
ws-icon-0 = 1;一
ws-icon-1 = 2;二
ws-icon-2 = 3;三
ws-icon-3 = 4;四
ws-icon-4 = 5;五
ws-icon-5 = 6;六
ws-icon-6 = 7;七
ws-icon-7 = 8;八
ws-icon-8 = 9;九
ws-icon-9 = 10;十
ws-icon-default = 
#label-focused = ""
label-focused = "%icon%"
label-focused-padding = 1
label-focused-underline = ${colors.green}
#label-unfocused = ""
label-unfocused = "%icon%"
label-unfocused-padding = 1
label-urgent = "%icon%"
label-urgent-foreground = ${colors.red}
label-urgent-padding = 1
###############################################################################
[module/date]
type = internal/date
interval = 1.0
#time =  %I:%M %p - %A, %d %B %Y
time =  %I:%M %p %d.%m.%Y
time-alt =  %I:%M %p
format = <label>
format-underline = ${colors.blue1}
label = %time%
###############################################################################
[module/title]
type = internal/xwindow
label = %title%
format = <label>
label-maxlen = 80
label-empty = "Yoroshiku!"
###############################################################################
[module/cpu]
type = internal/cpu
interval = 5
format = <label>
format-prefix = 
label = " %percentage%%"
###############################################################################
[module/memory]
type = internal/memory
interval = 3
format = <label>
format-prefix = 
label = " %mb_used%"
###############################################################################
[module/battery]
type = internal/battery
full-at = 99
battery = BAT0
apdapter = ADP1
format-charging = <animation-charging> <label-charging>
format-charging-underline = ${colors.green}
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${colors.green}
format-full = <ramp-capacity> <label-full>
format-full-underline = ${colors.green}
label-charging = %percentage%%
label-discharging = %percentage%%
label-full = 100%
; Only applies if <ramp-capacity> is used
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
ramp-capacity-5 = 
ramp-capacity-6 = 
ramp-capacity-7 = 
ramp-capacity-8 = 
ramp-capacity-9 = 
; Only applies if <animation-charging> is used
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
; Framerate in milliseconds
animation-charging-framerate = 750
###############################################################################
[module/volume]
type = internal/pulseaudio
format-volume = <ramp-volume> <label-volume>
format-volume-underline = ${colors.orange}
label-volume = %percentage%%
format-muted-prefix = " "
label-muted = "Muted"
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-volume-3 = 
ramp-volume-4 = 
ramp-headphones-0 = 
ramp-headphones-1 = 
###############################################################################
[module/network]
type = internal/network
interface = wlo1
interval = 1.0
accumulate-stats = true
unknown-as-up = true
#format-connected = <ramp-signal> <label-connected>
format-connected =  <label-connected>
format-disconnected = <label-disconnected>
label-connected = %essid%
label-disconnected =  Disconnected
; Only applies if <ramp-signal> is used
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
###############################################################################
[module/backlight]
type = internal/backlight
# ls -1 /sys/class/backlight
card = amdgpu_bl0
format = <label>
format-prefix = ""
label = " %percentage%%"
format-underline = ${colors.yellow}
bar-width = 10
bar-indicator = |
bar-fill = ─
bar-empty= ─
###############################################################################
[module/load]
type = custom/script
exec = ~/.config/polybar/scripts/load.sh
interval = 5.0
###############################################################################
[module/spotify]
type = custom/script
format-prefix = " "
exec = ~/.config/polybar/scripts/song.sh 2>/dev/null || echo "No song is playing"
tail = true
interval = 2
###############################################################################
[module/hostname]
type = custom/script
exec = ~/.config/polybar/scripts/hostname.sh
tail = true
interval = 60
###############################################################################
[module/ip]
type = custom/script
format-prefix = "直 "
exec = ~/.config/polybar/scripts/ip.sh
tail = true
interval = 20
###############################################################################
[module/update]
type = custom/script
exec = echo ' '
interval = 5
tail = true
click-left = alacritty -e bash -c "echo 'Upgrading packages...' && sudo dnf upgrade"

View File

@@ -1,18 +0,0 @@
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
if type "xrandr"; then
for mon in $(xrandr --query | grep " connected" | cut -d" " -f1); do
if [ "$1" = "laptop" ]; then
MONITOR=$mon polybar --reload workspaces &
# MONITOR=$mon polybar --reload music &
MONITOR=$mon polybar --reload status &
MONITOR=$mon polybar --reload tray &
fi
if [ "$1" = "all" ]; then
MONITOR=$mon polybar --reload all &
fi
done
else
echo "No Bars loaded."
fi

View File

@@ -0,0 +1,41 @@
#!/bin/sh
BAR_HEIGHT=27 # polybar height
BORDER_SIZE=10 # border size from your wm settings
YAD_WIDTH=222 # 222 is minimum possible value
YAD_HEIGHT=193 # 193 is minimum possible value
DATE="$(date +"%a, %d.%b %Y %H:%M")"
case "$1" in
--popup)
if [ "$(xdotool getwindowfocus getwindowname)" = "yad-calendar" ]; then
exit 0
fi
eval "$(xdotool getmouselocation --shell)"
eval "$(xdotool getdisplaygeometry --shell)"
# X
if [ "$((X + YAD_WIDTH / 2 + BORDER_SIZE))" -gt "$WIDTH" ]; then #Right side
: $((pos_x = WIDTH - YAD_WIDTH - BORDER_SIZE))
elif [ "$((X - YAD_WIDTH / 2 - BORDER_SIZE))" -lt 0 ]; then #Left side
: $((pos_x = BORDER_SIZE))
else #Center
: $((pos_x = X - YAD_WIDTH / 2))
fi
# Y
if [ "$Y" -gt "$((HEIGHT / 2))" ]; then #Bottom
: $((pos_y = HEIGHT - YAD_HEIGHT - BAR_HEIGHT - BORDER_SIZE))
else #Top
: $((pos_y = BAR_HEIGHT + BORDER_SIZE))
fi
yad --calendar --undecorated --fixed --close-on-unfocus --no-buttons \
--width="$YAD_WIDTH" --height="$YAD_HEIGHT" --posx="$pos_x" --posy="$pos_y" \
--title="yad-calendar" --borders=0 >/dev/null &
;;
*)
echo "$DATE"
;;
esac

View File

@@ -1,23 +0,0 @@
#!/bin/sh
main() {
if ! pgrep -x spotify >/dev/null; then
echo ""; exit
fi
cmd="org.freedesktop.DBus.Properties.Get"
domain="org.mpris.MediaPlayer2"
path="/org/mpris/MediaPlayer2"
meta=$(dbus-send --print-reply --dest=${domain}.spotify \
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:${domain}.Player string:Metadata)
artist=$(echo "$meta" | sed -nr '/xesam:artist"/,+2s/^ +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g' | sed 's#\/#\\/#g')
album=$(echo "$meta" | sed -nr '/xesam:album"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1| sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
title=$(echo "$meta" | sed -nr '/xesam:title"/,+2s/^ +variant +string "(.*)"$/\1/p' | tail -1 | sed 's/\&/\\&/g'| sed 's#\/#\\/#g')
echo "${*:-%artist% - %title%}" | sed "s/%artist%/$artist/g;s/%title%/$title/g;s/%album%/$album/g"i | sed "s/\&/\&/g" | sed "s#\/#\/#g"
}
main "$@"

View File

@@ -1,3 +1,11 @@
#!/bin/sh
yay -Qu | wc -l
if ! updates=$(yay -Qum 2> /dev/null | wc -l); then
updates=0
fi
if [ "$updates" -gt 0 ]; then
echo "$updates"
else
echo ""
fi