Added Polybar config

This commit is contained in:
dbroqua 2020-11-17 13:58:04 +01:00
parent ad74391beb
commit 57b4642ed0
10 changed files with 483 additions and 0 deletions

6
Bin/device_battery.sh Executable file
View file

@ -0,0 +1,6 @@
#! /bin/bash
MOUSE_PATH=`qdbus --system org.freedesktop.UPower|grep $1`
PERCENTAGE=`qdbus --system org.freedesktop.UPower ${MOUSE_PATH} org.freedesktop.UPower.Device.Percentage`
echo ${PERCENTAGE}%

19
config/polybar/colors Normal file
View file

@ -0,0 +1,19 @@
; vim:ft=dosini
[colors]
nord0 = #2E3440
nord1 = #3B4252
nord2 = #434C5E
nord3 = #4C566A
nord4 = #D8DEE9
nord5 = #E5E9F0
nord6 = #ECEFF4
nord7 = #8FBCBB
nord8 = #88C0D0
nord9 = #81A1C1
nord10= #5E81AC
nord11= #BF616A
nord12= #D08770
nord13= #EBCB8B
nord14= #A3BE8C
nord15= #B48EAD

66
config/polybar/config Normal file
View file

@ -0,0 +1,66 @@
; vim:ft=dosini
include-file = $HOME/.config/polybar/colors
include-file = $HOME/.config/polybar/global
include-file = $HOME/.config/polybar/modules
include-file = $HOME/.config/polybar/settings
[global-wm]
margin-top = 4
margin-bottom = 4
[bar/base]
width = ${global.width}
height = ${global.height}
radius = ${global.radius}
fixed-center = ${global.fixed-center}
background = ${global.background}
foreground = ${global.foreground}
line-size = ${global.line-size}
line-color = ${global.line-color}
border-size = ${global.border-size}
border-color = ${global.border-color}
padding-left = ${global.padding-left}
padding-right = ${global.padding-right}
module-margin-left = ${global.module-margin-left}
module-margin-right = ${global.module-margin-right}
font-0 = ${global.font-0}
font-1 = ${global.font-1}
font-2 = ${global.font-2}
separator = ${global.separator}
cursor-click = ${global.cursor-click}
cursor-scroll = ${global.cursor-scroll}
[bar/top]
inherit = bar/base
bottom = false
modules-left = i3
modules-right = filesystem vpn wlan eth cpu memory battery hhkb logitech lcd_brightness pulseaudio bluetooth_headphones_status multimedia_previous multimedia_current multimedia_next imap tmux date
[bar/bottom]
inherit = bar/base
bottom = true
modules-left = i3
modules-right = filesystem vpn wlan eth battery hhkb logitech lcd_brightness pulseaudio bluetooth_headphones_status multimedia_previous multimedia_current multimedia_next date
; disabled modules
; imap tmux cpu memory temperature-wifi
tray-position = right
tray-padding = 2
tray-background = ${global.background}
tray-detached = false

33
config/polybar/global Normal file
View file

@ -0,0 +1,33 @@
; vim:ft=dosini
[global]
width = 100%
height = 26
radius = 0
fixed-center = false
background = ${colors.nord0}
foreground = ${colors.nord10}
line-size = 4
line-color = ${colors.nord10}
border-size = 0
border-color = ${colors.nord0}
padding-left = 0
padding-right = 4
module-margin-left = 2
module-margin-right = 2
font-0 = DejaVu Sans Mono for Powerline Book:size=9
font-1 = FontAwesome:pixelsize=9;0
font-2 = ProFontIIx Nerd Font:pixelsize=9;0
separator = ❱
cursor-click = pointer
cursor-scroll = ns-resize

303
config/polybar/modules Normal file
View file

@ -0,0 +1,303 @@
; vim:ft=dosini
[module/filesystem]
type = internal/fs
interval = 120
mount-0 = /home
label-mounted = " %mountpoint%: %percentage_used%%"
label-unmounted =  %mountpoint% not mounted
label-unmounted-foreground = ${colors.nord11}
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
label-focused-foreground = ${colors.nord0}
label-focused-background = ${colors.nord8}
label-focused-underline= ${colors.nord10}
label-focused-padding = 2
label-unfocused-foreground = ${colors.nord5}
label-unfocused-background = ${colors.nord3}
label-unfocused-padding = 2
label-visible-foreground = ${colors.nord5}
label-visible-background = ${colors.nord3}
label-visible-underline = ${colors.nord10}
label-visible-padding = 2
label-urgent-foreground = ${colors.nord5}
label-urgent-background = ${colors.nord12}
label-urgent-underline = ${colors.nord11}
label-urgent-padding = 2
[module/vpn]
type = custom/script
exec = ~/.config/polybar/scripts/vpn-networkmanager-status.sh
interval = 5
[module/wlan]
type = internal/network
interface = wlp59s0
interval = 3.0
format-connected = 直 <label-connected>
label-connected = %essid%
format-connected-underline = ${colors.nord14}
format-disconnected = 睊
format-disconnected-underline = ${colors.nord11}
[module/eth]
type = internal/network
interface = enp0s31f6
interval = 3.0
format-connected-underline = ${colors.nord14}
label-connected =  %linkspeed%
format-disconnected = 
format-disconnected-underline = ${colors.nord11}
[module/date]
type = internal/date
interval = 30
date = %d/%m
time = %H:%M
label =  %date% %time%
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = ♪ %percentage%%
label-muted =  -
label-muted-foreground = ${colors.nord11}
bar-volume-width = 10
bar-volume-foreground-0 = ${colors.nord14}
bar-volume-foreground-1 = ${colors.nord14}
bar-volume-foreground-2 = ${colors.nord14}
bar-volume-foreground-3 = ${colors.nord14}
bar-volume-foreground-4 = ${colors.nord13}
bar-volume-foreground-5 = ${colors.nord13}
bar-volume-foreground-6 = ${colors.nord12}
bar-volume-foreground-7 = ${colors.nord12}
bar-volume-foreground-8 = ${colors.nord11}
bar-volume-foreground-9 = ${colors.nord11}
bar-volume-gradient = true
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.nord6}
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 100
format-charging = <animation-charging> <label-charging>
format-charging-underline = ${colors.nord14}
format-discharging = <animation-discharging> <label-discharging>
format-discharging-underline = ${colors.nord13}
format-full-prefix = " "
format-full-underline = ${colors.nord10}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-5 = 
animation-charging-framerate = 750
animation-discharging-0 = 
animation-discharging-1 = 
animation-discharging-2 = 
animation-discharging-3 = 
animation-discharging-4 = 
animation-discharging-5 = 
animation-discharging-framerate = 750
[module/logitech]
type = custom/script
exec = ~/Bin/device_battery.sh mouse 2>/dev/null
format =  <label>
label = %output%
[module/hhkb]
type = custom/script
exec = ~/Bin/device_battery.sh keyboard 2>/dev/null
format =  <label>
label = %output%
[module/lcd_brightness]
type = custom/script
exec = ~/Bin/brightness.sh read 2>/dev/null
format =  <label>
label = %output%%
[module/bluetooth_headphones_status]
type = custom/script
exec = ~/Bin/bluetooth_headphones_status.sh
format =  <label>
label = %output%
click-left = ~/Bin/bluetooth_headphones_status.sh toggle_profile
[module/multimedia_previous]
type = custom/text
content = 
click-left = ~/Bin/music.sh Previous
[module/multimedia_next]
type = custom/text
content = 
click-left = ~/Bin/music.sh Next
[module/multimedia_current]
type = custom/script
exec = ~/Bin/nowPlaying.sh
format = <label>
label = %output%
click-left = ~/Bin/music.sh PlayPause
[module/imap]
type = custom/script
exec = ~/.config/polybar/scripts/inbox-imap-shellnetrc.sh
interval = 60
format =  <label>
label = %output%
[module/tmux]
type = custom/script
exec = ~/.config/polybar/scripts/info-tmux-sessions.sh
interval = 5
[module/cpu]
type = internal/cpu
format = <label> <ramp-coreload>
label = CPU %percentage%%
ramp-coreload-spacing = 0
ramp-coreload-0 = ▁
ramp-coreload-1 = ▂
ramp-coreload-2 = ▃
ramp-coreload-3 = ▄
ramp-coreload-4 = ▅
ramp-coreload-5 = ▆
ramp-coreload-6 = ▇
ramp-coreload-7 = █
[module/memory]
type = internal/memory
format = <label> <ramp-used>
label = RAM %percentage_used%%
ramp-used-0 = ▁
ramp-used-1 = ▂
ramp-used-2 = ▃
ramp-used-3 = ▄
ramp-used-4 = ▅
ramp-used-5 = ▆
ramp-used-6 = ▇
ramp-used-7 = █
[module/temperature-cpu]
type = internal/temperature
interval = 0.5
thermal-zone = 0
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
base-temperature = 20
warn-temperature = 60
format = <ramp> <label>
format-warn = <ramp> <label-warn>
label = CPU %temperature-c%
label-warn = TEMP %temperature-c%
label-warn-foreground = ${colors.nord11}
ramp-0 = ▁
ramp-1 = ▄
ramp-2 = █
[module/temperature-wifi]
type = internal/temperature
interval = 0.5
thermal-zone = 5
hwmon-path = /sys/devices/virtual/thermal/thermal_zone5/hwmon7/temp1_input
base-temperature = 20
warn-temperature = 60
format = <ramp> <label>
format-warn = <ramp> <label-warn>
label = WIFI %temperature-c%
label-warn = TEMP %temperature-c%
label-warn-foreground = ${colors.nord11}
ramp-0 = ▁
ramp-1 = ▄
ramp-2 = █

View file

@ -0,0 +1,12 @@
#!/bin/sh
SERVER="mail.darkou.fr"
NETRC=".netrc"
inbox=$(curl -sf --netrc-file "$NETRC" -X "STATUS INBOX (UNSEEN)" imaps://"$SERVER"/INBOX | tr -d -c "[:digit:]")
if [ "$inbox" ] && [ "$inbox" -gt 0 ]; then
echo "# $inbox"
else
echo "0 unread"
fi

View file

@ -0,0 +1,21 @@
#! /bin/sh
if sessionlist=$(tmux ls 2>/dev/null); then
printf "# "
echo "$sessionlist" | while read -r line; do
session=$(echo "$line" | cut -d ':' -f 1)
if echo "$line" | grep -q "(attached)"; then
status="(a)"
else
status=""
fi
printf "%s%s " "$session" "$status"
done
printf "\n"
else
printf "# none\n"
fi

View file

@ -0,0 +1,9 @@
#!/bin/sh
vpn="$(nmcli -t -f name,type connection show --order name --active 2>/dev/null | grep vpn | head -1 | cut -d ':' -f 1)"
if [ -n "$vpn" ]; then
echo "$vpn"
else
echo ""
fi

View file

@ -0,0 +1,9 @@
#!/bin/sh
connection=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1)
if [ -n "$connection" ]; then
echo "On"
else
echo "Off"
fi

5
config/polybar/settings Normal file
View file

@ -0,0 +1,5 @@
; vim:ft=dosini
[settings]
screenchange-reload = true
pseudo-transparency = true