Initial commit

This commit is contained in:
2020-04-23 14:50:36 +02:00
commit 0c743950ac
47 changed files with 3838 additions and 0 deletions

159
.config/polybar/config Normal file
View File

@@ -0,0 +1,159 @@
; vi: ft=dosini
[colors]
background = #202020
background-alt = #444
foreground = #fff
foreground-alt = #fff
primary = #fff
secondary = #fff
alert = #f00
[bar/main]
monitor = eDP1
bottom = false
fixed-center = true
width = 100%
height = 32
padding-left = 1
padding-right = 1
module-margin-left = 1
module-margin-right = 2
modules-left = i3 pulseaudio xbacklight
modules-center = datetime
modules-right = battery-custom vpn wlan powermenu
tray-position = right
tray-detached = false
tray-scale = 1.0
font-0 = MesloLGS NF:style=Regular:size=18;4
; used for the colume ramp
font-1 = MesloLGS NF:style=Regular:size=10;2
; used for the dots in module/powermenu
font-2 = MesloLGS NF:size=18;-2
; used for small space in scripts/battery.sh
font-3 = MesloLGS NF:size=8
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = ${colors.primary}
;#################################################
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 1
; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = ${self.label-focused-padding}
; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-underline = ${colors.secondary}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${colors.alert}
label-urgent-padding = ${self.label-focused-padding}
;#################################################
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <bar-volume>
label-volume = VOL: %percentage%%
label-muted = VOL: muted
bar-volume-width = 10
bar-volume-empty = -
bar-volume-fill = -
bar-volume-indicator = |
;format-volume = <ramp-volume> <label-volume>
;format-volume-font = 2
;label-muted = muted
;
;ramp-volume-0 =  
;ramp-volume-1 = █ 
;ramp-volume-2 = ██ 
;ramp-volume-3 = ███ 
;ramp-volume-4 = ████ 
;ramp-volume-5 = █████ 
;ramp-volume-6 = ██████ 
;ramp-volume-7 = ███████ 
;ramp-volume-8 = ████████ 
;ramp-volume-9 = █████████ 
;ramp-volume-10 = ██████████
;#################################################
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = BL: %percentage%%
bar-width = 10
bar-empty = -
bar-fill = -
bar-indicator = |
;#################################################
;#################################################
;#################################################
[module/datetime]
type = internal/date
interval = 1
date = %Y-%m-%d%
time = "%H:%M:%S "
label = "%date% - %time%"
;#################################################
;#################################################
;#################################################
[module/battery-custom]
type = custom/script
exec = ~/.config/polybar/scripts/battery.sh
interval = 5
;#################################################
[module/vpn]
type = custom/script
exec = ~/.config/polybar/scripts/running-vpn.sh
click-left = ~/.config/polybar/scripts/pub-ipv4.sh &
interval = 5
;#################################################
[module/wlan]
type = internal/network
interface = wlp58s0
interval = 3
format-connected = <label-connected>
label-connected = %{A1:gnome-terminal -x nmtui connect:} %essid:0:20:...%:%signal%% %{A}
fomat-disconnected = <label-disconnected>
label-disconnected = %{A1:gnome-terminal -x nmtui connect:} %ifname% disconnected %{A}
;#################################################
[module/powermenu]
type = custom/text
content = %{A1:~/.config/rofi/powermenu.sh &:}%{T3}...%{T-}%{A}

12
.config/polybar/launch.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done
# Launch Polybar
polybar -c "$HOME/.config/polybar/config" main &
echo "Polybar launched..."

View File

@@ -0,0 +1,27 @@
#!/bin/sh
## config
full=80
low=20
############################
red='%{F#f00}'
green='%{F#0f0}'
end='%{F-}'
# hack to put a little space between the lightning and the percentage
smallspace='%{T4} %{T-}'
bat="$(cat /sys/class/power_supply/BAT0/capacity)"
ac="$(cat /sys/class/power_supply/AC/online)"
# display in red when under $low and no charger is connected
[ "$bat" -gt "$low" ] || [ "$ac" -eq 1 ] || color="$red"
# display in green when over $full and a charger is connected
[ "$bat" -lt "$full" ] || [ "$ac" -eq 0 ] || color="$green"
prefix=" "
[ "$ac" -eq 0 ] || prefix="⚡"
echo "${color}${prefix}${smallspace}${bat}%"

View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo $(curl -s https://ipinfo.io/ip)

View File

@@ -0,0 +1,13 @@
#!/bin/sh
connection="$(nmcli con show --active | awk '$3 == "vpn" { print $1 }')"
if [ -n "$connection" ]; then
echo "VPN: $connection"
exit 0
fi
# [o] is a hack to not grep the grep-command
# see: https://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep
! ps ax | grep -q "[o]penvpn" || echo -n "VPN"
echo