This commit is contained in:
2018-07-16 21:22:48 +02:00
commit 21427254e0
51 changed files with 3535 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
#!/bin/sh
battery_print() {
path_ac="/sys/class/power_supply/AC"
path_battery_0="/sys/class/power_supply/BAT0"
path_battery_1="/sys/class/power_supply/BAT1"
ac=0
battery_level_0=0
battery_level_1=0
battery_max_0=0
battery_max_1=0
if [ -f "$path_ac/online" ]; then
ac=$(cat "$path_ac/online")
fi
if [ -f "$path_battery_0/energy_now" ]; then
battery_level_0=$(cat "$path_battery_0/energy_now")
fi
if [ -f "$path_battery_0/energy_full" ]; then
battery_max_0=$(cat "$path_battery_0/energy_full")
fi
if [ -f "$path_battery_1/energy_now" ]; then
battery_level_1=$(cat "$path_battery_1/energy_now")
fi
if [ -f "$path_battery_1/energy_full" ]; then
battery_max_1=$(cat "$path_battery_1/energy_full")
fi
battery_level=$(("$battery_level_0 + $battery_level_1"))
battery_max=$(("$battery_max_0 + $battery_max_1"))
battery_percent=$(("$battery_level * 100"))
battery_percent=$(("$battery_percent / $battery_max"))
if [ "$ac" -eq 1 ]; then
icon="#1"
if [ "$battery_percent" -gt 97 ]; then
echo "$icon"
else
echo "$icon $battery_percent %"
fi
else
if [ "$battery_percent" -gt 85 ]; then
icon="#21"
elif [ "$battery_percent" -gt 60 ]; then
icon="#22"
elif [ "$battery_percent" -gt 35 ]; then
icon="#23"
elif [ "$battery_percent" -gt 10 ]; then
icon="#24"
else
icon="#25"
fi
echo "$icon $battery_percent %"
fi
}
case "$1" in
--update)
pid=$(pgrep -xf "/bin/sh /home/felix/.config/polybar/battery-combined-udev.sh")
if [ "$pid" != "" ]; then
kill -10 "$pid"
fi
;;
*)
trap exit INT
trap "echo" USR1
while true; do
battery_print
sleep 30 &
wait
done
;;
esac

329
.config/polybar/config Normal file
View File

@@ -0,0 +1,329 @@
[bar/top]
monitor = DP2-1
width = 100%
height = 27
background = #00000000
foreground = #ccffffff
line-color = ${bar/bottom.background}
line-size = 16
spacing = 2
padding-right = 5
module-margin = 4
font-0 = "Noto Sans:size=8"
font-1 = "RobotoMono Nerd Font:pixelsize=10;1"
font-2 = "Symbola:style=Regular"
# todo mpd? or spotify?
modules-left = powermenu player-mpris
modules-center = date
modules-right = pulseaudio backlight touchpad-indicator openvpn-indicator wireless-network wired-network battery
[bar/bottom]
monitor = DP2-1
bottom = true
width = 100%
height = 27
background = ${bar/top.background}
foreground = ${bar/top.foreground}
line-color = ${bar/top.background}
line-size = 2
spacing = 3
padding-right = 4
module-margin-left = 0
module-margin-right = 6
font-0 = "Noto Sans:size=8"
font-1 = "RobotoMono Nerd Font:pixelsize=10;1"
font-2 = "Symbola:style=Regular"
modules-left =
modules-center = i3
modules-right = cpu memory
tray-position = left
tray-padding = 2
tray-transparent = true
tray-background = #0063ff
;tray-detached = false
[module/pulseaudio]
type = internal/pulseaudio
; Sink to be used, if it exists (find using `pacmd list-sinks`, name field)
; If not, uses default sink
sink = alsa_output.pci-0000_00_1f.3.analog-stereo
; Use PA_VOLUME_UI_MAX (~153%) if true, or PA_VOLUME_NORM (100%) if false
; Default: true
use-ui-max = true
format-volume = %{A3:pavucontrol:}<ramp-volume> <label-volume> %{A}
; Available tokens:
; %percentage% (default)
label-muted = 婢 muted
label-muted-foreground = #666
; Only applies if <ramp-volume> is used
ramp-volume-0 = 奄
ramp-volume-1 = 奔
ramp-volume-2 = 墳
[module/backlight]
type = internal/xbacklight
format = <ramp> <bar>
output = eDP1
ramp-0 = 
ramp-1 = 
ramp-2 = 
bar-width = 5
bar-indicator = |
#bar-indicator-font = 3
bar-indicator-foreground = #ff
bar-fill = ─
#bar-fill-font = 3
bar-fill-foreground = #c9665e
bar-empty = ─
#bar-empty-font = 3
bar-empty-foreground = #44
[module/openvpn-indicator]
type = custom/script
exec = ~/.config/polybar/openvpn-indicator.sh
interval = 5
[module/battery-combined-udev]
type = custom/script
exec = ~/.config/polybar/battery-combined-udev.sh
tail = true
[module/player-mpris]
type = custom/script
exec = ~/.config/polybar/player-mpris-simple.sh
interval = 3
label = "%output%"
[module/touchpad-indicator]
type = custom/script
exec = ~/.config/polybar/touchpad-indicator.sh
[module/battery]
type = internal/battery
full-at = 96
format-charging = <animation-charging> <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full = <ramp-capacity> <label-full>
ramp-capacity-0 = 
ramp-capacity-0-foreground = #f53c3c
ramp-capacity-1 = 
ramp-capacity-1-foreground = #ffa900
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
bar-capacity-width = 10
bar-capacity-format = %{+u}%{+o}%fill%%empty%%{-u}%{-o}
bar-capacity-fill = █
bar-capacity-fill-foreground = #ddffffff
#bar-capacity-fill-font = 3
bar-capacity-empty = █
#bar-capacity-empty-font = 3
bar-capacity-empty-foreground = #44ffffff
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 750
[module/i3]
type = internal/i3
; Only show workspaces defined on the same output as the bar
;
; Useful if you want to show monitor specific workspaces
; on different bars
;
; Default: false
pin-workspaces = false
; This will split the workspace name on ':'
; Default: false
strip-wsnumbers = true
; Sort the workspaces by index instead of the default
; sorting that groups the workspaces by output
; Default: false
index-sort = false
; Create click handler used to focus workspace
; Default: true
enable-click = true
; Create scroll handlers used to cycle workspaces
; Default: true
enable-scroll = false
; Wrap around when reaching the first/last workspace
; Default: true
wrapping-scroll = false
; Set the scroll cycle direction
; Default: true
reverse-scroll = false
; Use fuzzy (partial) matching on labels when assigning
; icons to workspaces
; Example: code;♚ will apply the icon to all workspaces
; containing 'code' in the label
; Default: false
fuzzy-match = true
[module/wireless-network]
type = internal/network
interface = wlp3s0
interval = 3.0
ping-interval = 10
format-connected = <label-connected> <ramp-signal>
label-connected = 直 %essid%
label-disconnected = 睊 not connected
label-disconnected-foreground = #66
format-packetloss = <animation-packetloss> <label-connected>
ramp-signal-0 = 😱
ramp-signal-1 = 😠
ramp-signal-2 = 😒
ramp-signal-3 = 😊
ramp-signal-4 = 😃
ramp-signal-5 = 😈
animation-packetloss-0 = 
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 = 
animation-packetloss-1-foreground = ${bar/top.foreground}
animation-packetloss-framerate = 500
[module/cpu]
type = internal/cpu
interval = 0.5
format = <label> <ramp-coreload>
label = CPU
ramp-coreload-0 = ▁
#ramp-coreload-0-font = 2
ramp-coreload-0-foreground = #aaff77
ramp-coreload-1 = ▂
#ramp-coreload-1-font = 2
ramp-coreload-1-foreground = #aaff77
ramp-coreload-2 = ▃
#ramp-coreload-2-font = 2
ramp-coreload-2-foreground = #aaff77
ramp-coreload-3 = ▄
#ramp-coreload-3-font = 2
ramp-coreload-3-foreground = #aaff77
ramp-coreload-4 = ▅
#ramp-coreload-4-font = 2
ramp-coreload-4-foreground = #fba922
ramp-coreload-5 = ▆
#ramp-coreload-5-font = 2
ramp-coreload-5-foreground = #fba922
ramp-coreload-6 = ▇
#ramp-coreload-6-font = 2
ramp-coreload-6-foreground = #ff5555
ramp-coreload-7 = █
#ramp-coreload-7-font = 2
ramp-coreload-7-foreground = #ff5555
[module/wired-network]
type = internal/network
interface = enp0s31f6
interval = 3.0
label-connected =  %{T3}%local_ip%%{T-}
label-disconnected-foreground = #66
[module/date]
type = internal/date
date =  %%{F#99}%d.%m.%Y%%{F-}  %%{F#fff}%H:%M%%{F-}
date-alt = %%{F#fff}%A, %d %B %Y %%{F#fff}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-}
[module/memory]
type = internal/memory
format = <label> <bar-used>
label = RAM
bar-used-width = 30
bar-used-foreground-0 = #aaff77
bar-used-foreground-1 = #aaff77
bar-used-foreground-2 = #fba922
bar-used-foreground-3 = #ff5555
bar-used-indicator = |
#bar-used-indicator-font = 6
bar-used-indicator-foreground = #ff
bar-used-fill = ─
#bar-used-fill-font = 6
bar-used-empty = ─
#bar-used-empty-font = 6
bar-used-empty-foreground = #444444
[module/mpd]
type = internal/mpd
format-online = <icon-prev> <icon-stop> <toggle> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
icon-play = 
icon-pause = 
icon-stop = 
icon-prev = 
icon-next = 
icon-random = 
icon-repeat = 
toggle-on-foreground =
toggle-off-foreground = #55
bar-progress-width = 45
bar-progress-format = %{A4:mpdseek+2: A5:mpdseek-2:}%fill%%indicator%%empty%%{A A}
bar-progress-indicator = |
bar-progress-indicator-foreground = #ff
#bar-progress-indicator-font = 3
bar-progress-fill = ─
bar-progress-fill-foreground = #bb
#bar-progress-fill-font = 3
bar-progress-empty = ─
#bar-progress-empty-font = 3
bar-progress-empty-foreground = #44
[module/powermenu]
type = custom/menu
format-padding = 5
label-open = 
#label-close = x
label-separator = " | "
menu-0-0 = Terminate i3
menu-0-0-foreground = #fba922
menu-0-0-exec = i3-msg exit
menu-0-1 = Reboot
menu-0-1-foreground = #fba922
menu-0-1-exec = reboot
menu-0-2 = Power off
menu-0-2-foreground = #fba922
menu-0-2-exec = poweroff
; vim:ft=dosini

View File

@@ -0,0 +1,374 @@
;=====================================================
;
; To learn more about how to configure Polybar
; go to https://github.com/jaagr/polybar
;
; The README contains alot of information
;
;=====================================================
[colors]
;background = ${xrdb:color0:#222}
background = #222
background-alt = #444
;foreground = ${xrdb:color7:#222}
foreground = #dfdfdf
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
[bar/example]
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 27
;offset-x = 1%
;offset-y = 1%
radius = 6.0
fixed-center = false
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = #f00
border-size = 4
border-color = #00000000
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
modules-left = bspwm i3
modules-center =
modules-right = filesystem xbacklight volume xkeyboard memory cpu wlan eth battery temperature date powermenu
tray-position = right
tray-padding = 2
;tray-transparent = true
;tray-background = #0063ff
;wm-restack = bspwm
;wm-restack = i3
;override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev
cursor-click = pointer
cursor-scroll = ns-resize
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt}
[module/bspwm]
type = internal/bspwm
label-focused = %index%
label-focused-background = ${colors.background-alt}
label-focused-underline= ${colors.primary}
label-focused-padding = 2
label-occupied = %index%
label-occupied-padding = 2
label-urgent = %index%!
label-urgent-background = ${colors.alert}
label-urgent-padding = 2
label-empty = %index%
label-empty-foreground = ${colors.foreground-alt}
label-empty-padding = 2
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
; Only show workspaces on the same output as the bar
;pin-workspaces = true
label-mode-padding = 2
label-mode-foreground = #000
label-mode-background = ${colors.primary}
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-background = ${module/bspwm.label-focused-background}
label-focused-underline = ${module/bspwm.label-focused-underline}
label-focused-padding = ${module/bspwm.label-focused-padding}
; unfocused = Inactive workspace on any monitor
label-unfocused = %index%
label-unfocused-padding = ${module/bspwm.label-occupied-padding}
; visible = Active workspace on unfocused monitor
label-visible = %index%
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
label-visible-padding = ${self.label-focused-padding}
; urgent = Workspace with urgency hint set
label-urgent = %index%
label-urgent-background = ${module/bspwm.label-urgent-background}
label-urgent-padding = ${module/bspwm.label-urgent-padding}
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
icon-prev = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 
label-song-maxlen = 25
label-song-ellipsis = true
[module/xbacklight]
type = internal/xbacklight
format = <label> <bar>
label = BL
bar-width = 10
bar-indicator = |
bar-indicator-foreground = #ff
bar-indicator-font = 2
bar-fill = ─
bar-fill-font = 2
bar-fill-foreground = #9f78e1
bar-empty = ─
bar-empty-font = 2
bar-empty-foreground = ${colors.foreground-alt}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #f90000
label = %percentage:2%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #4bffdc
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp3s0
interval = 3.0
format-connected = <ramp-signal> <label-connected>
format-connected-underline = #9f78e1
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
ramp-signal-foreground = ${colors.foreground-alt}
[module/eth]
type = internal/network
interface = enp0s31f6
interval = 3.0
format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date =
date-alt = " %Y-%m-%d"
time = %H:%M
time-alt = %H:%M:%S
format-prefix = 
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5
label = %date% %time%
[module/volume]
type = internal/volume
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
bar-volume-width = 10
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/battery]
type = internal/battery
battery = BAT0
adapter = AC
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.foreground-alt}
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <ramp> <label>
format-underline = #f50a4d
format-warn = <ramp> <label-warn>
format-warn-underline = ${self.format-underline}
label = %temperature%
label-warn = %temperature%
label-warn-foreground = ${colors.secondary}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = ${colors.foreground-alt}
[module/powermenu]
type = custom/menu
expand-right = true
format-spacing = 1
label-open = 
label-open-foreground = ${colors.secondary}
label-close =  cancel
label-close-foreground = ${colors.secondary}
label-separator = |
label-separator-foreground = ${colors.foreground-alt}
menu-0-0 = reboot
menu-0-0-exec = menu-open-1
menu-0-1 = power off
menu-0-1-exec = menu-open-2
menu-1-0 = cancel
menu-1-0-exec = menu-open-0
menu-1-1 = reboot
menu-1-1-exec = sudo reboot
menu-2-0 = power off
menu-2-0-exec = sudo poweroff
menu-2-1 = cancel
menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
[global/wm]
margin-top = 5
margin-bottom = 5
; vim:ft=dosini

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

@@ -0,0 +1,13 @@
#!/usr/bin/env sh
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch bar1 and bar2
polybar bottom &
polybar top &
echo "Bars launched..."

View File

@@ -0,0 +1,7 @@
#!/bin/sh
if [ "$(nmcli | grep 'Dahoam VPN connection')" ]; then
echo "%{A1:nmcli con down Dahoam:}旅%{A}"
else
echo "%{A1:nmcli con up Dahoam:}%{F#404040}旅%{F-} %{A}"
fi

View File

@@ -0,0 +1,11 @@
#!/bin/sh
player_status=$(playerctl status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
echo "$(playerctl metadata artist) - $(playerctl metadata title) %{A1:playerctl previous:}玲%{A} %{A1:playerctl play-pause:} %{A} %{A1:playerctl next:}怜%{A}"
elif [ "$player_status" = "Paused" ]; then
echo "$(playerctl metadata artist) - $(playerctl metadata title) %{A1:playerctl previous:}玲%{A} %{A1:playerctl play-pause:} 契%{A} %{A1:playerctl next:}怜%{A}"
else
echo ""
fi

View File

@@ -0,0 +1,58 @@
#!/bin/sh
sink=0
volume_up() {
pactl set-sink-volume $sink +1%
}
volume_down() {
pactl set-sink-volume $sink -1%
}
volume_mute() {
pactl set-sink-mute $sink toggle
}
volume_print() {
if pacmd list-sinks | grep active | head -n 1 | grep -q speaker; then
icon="#1"
elif pacmd list-sinks | grep active | head -n 1 | grep headphones; then
icon="#2"
else
icon="#3"
fi
muted=$(pamixer --sink $sink --get-mute)
if [ "$muted" = true ]; then
echo "$icon --"
else
echo "$icon $(pamixer --sink $sink --get-volume)"
fi
}
listen() {
volume_print
pactl subscribe | while read -r event; do
if echo "$event" | grep -q "#$sink"; then
volume_print
fi
done
}
case "$1" in
--up)
volume_up
;;
--down)
volume_down
;;
--mute)
volume_mute
;;
*)
listen
;;
esac

View File

@@ -0,0 +1,11 @@
#!/bin/sh
touchpad_status=$(synclient | grep Touchpad | tail -c 2 | head -c 1 2> /dev/null)
if [ "$touchpad_status" = "1" ]; then
echo "%{A1:synclient TouchpadOff=0:}%{F#404040}ﳶ%{F-} %{A}"
elif [ "$touchpad_status" = "0" ]; then
echo "%{A1:synclient TouchpadOff=1:}ﳶ %{A}"
else
echo ""
fi