1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

dotfiles: move .config/* to root

This seems to make more sense. Almost all files were within .config
anyway.

Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
2020-08-10 22:29:05 +01:00
parent 20f48e25b4
commit 60bf423556
89 changed files with 4 additions and 3 deletions

327
polybar/config Normal file
View File

@ -0,0 +1,327 @@
[colours]
background = transparent
text = #eceff1
icon = #147a82
warning = #ffcb00
critical = #bd2c40
urgent = #e53935
[settings]
format-foreground = ${colours.text}
format-background = ${colours.background}
format-spacing = 0
format-margin = 2.5
format-offset = 0
screenchange-reload = true
[bar/i3bar]
monitor = ${env:MONITOR:HDMI-0}
dpi = ${xrdb:Xft.dpi:96}
fixed-center = false
enable-ipc = true
width = 100%
#offset-x = 18px
height = 16pt
bottom = true
radius = 0
font-0 = sans:pixelsize=9;2
font-1 = FontAwesome5ProLight:pixelsize=10;2
foreground = ${colours.text}
background = ${colours.background}
padding-left = 0
padding-right = 2pt
border-size = 0
border-left-size = 16pt
border-right-size = 16pt
border-bottom-size = 8pt
line-size = 0
line-colour = #f00
modules-left = i3
modules-center =
# modules-right = volume updates weather xkeyboard wlan gateway eth memory cpu xbacklight battery cputemp gputemp date
modules-right = volume updates weather wlan gateway eth memory cpu xbacklight battery cputemp gputemp date
tray-position = right
tray-detached = false
tray-background = ${colours.background}
#tray-offset-x = -20
#tray-offset-y = 0
tray-maxsize = 16
tray-padding = 8pt
tray-scale = 1.0
cursor-click = pointer
cursor-scroll = ns-resize
[module/updates]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/update.sh
tail = true
format-prefix = " "
format-prefix-foreground = ${colours.icon}
click-left = systemd-run --user --no-block -- i3-sensible-terminal --class floating-term -e sh -c "yay; kill -USR1 %pid%; sleep 1"
[module/weather]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/weather.sh
interval = 120
click-left = systemd-run --user --no-block -- i3-sensible-terminal --class floating-term -d 125 40 --hold -e sh -c "curl wttr.in"
[module/gateway]
type = custom/script
exec = for v in 4 6; do ip -$v r show default | xargs -rL1 sh -c 'fping --retry=1 --quiet --iface "$4" "$2"'; done && echo  || echo '%{F#f41f1c}%{F-}'
interval = 2
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/xkeyboard]
type = internal/xkeyboard
format = <label-layout> <label-indicator>
format-prefix = " "
format-prefix-foreground = ${colours.icon}
format-prefix-underline = ${colours.background}
label-layout = %name%
label-indicator = %name%
[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 = ${colours.text}
label-mode-background = ${colours.background}
; focused = Active workspace on focused monitor
label-focused = %index%
label-focused-padding = ${self.label-mode-padding}
label-focused-foreground = ${colours.text}
label-focused-background = ${colours.background}
label-focused-underline = ${colours.background}
; unfocused = Inactive workspace on any monitor
label-unfocused = ${self.label-focused}
label-unfocused-padding = ${self.label-focused-padding}
label-unfocused-foreground= ${colours.icon}
label-unfocused-underline = ${self.label-focused-underline}
; visible = Active workspace on unfocused monitor
label-visible = ${self.label-focused}
label-visible-foreground= ${colours.icon}
label-visible-padding = ${self.label-focused-padding}
label-visible-background = ${self.label-focused-background}
label-visible-underline = ${self.label-focused-underline}
; urgent = Workspace with urgency hint set
label-urgent = ${self.label-focused}
label-urgent-foreground = ${colours.urgent}
label-urgent-padding = ${self.label-focused-padding}
[module/xbacklight]
type = internal/xbacklight
label = %percentage%
format = <label>
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/backlight-acpi]
inherit = module/xbacklight
type = internal/backlight
card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colours.icon}
format-underline = ${colours.background}
label = %percentage%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colours.icon}
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp1s0
interval = 3.0
format-connected = <ramp-signal> <label-connected>
format-connected-underline = ${colours.background}
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colours.icon}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-foreground = ${colours.icon}
[module/eth]
type = internal/network
interface = eth0
interval = 3.0
label-connected = %local_ip%
format-connected-prefix = " "
format-connected-prefix-foreground = ${colours.icon}
format-connected-underline = ${colours.background}
;format-disconnected = RIP
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
label-disconnected-foreground = ${colours.critical}
[module/date]
type = internal/date
interval = 1
label = %{A3:systemd-run --user --no-block -- i3-sensible-terminal --class floating-term -d 66 35 -qq --hold -e sh -c "cal -y $(date +%Y)":}%date% %time%%{A}
time = %H:%M
time-alt = %a %e %b %Y %H:%M:%S
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/volume]
type = internal/pulseaudio
label-volume = %percentage%
format-volume = %{A3:systemd-run --user --no-block -- pavucontrol:}<ramp-volume> <label-volume>%{A}
format-muted = %{A3:systemd-run --user --no-block -- pavucontrol:}<label-muted>%{A}
label-volume-foreground = ${root.foreground}
format-muted-foreground = ${colours.icon}
ramp-volume-foreground = ${colours.icon}
label-muted = ""
ramp-volume-0 = ""
ramp-volume-1 = ""
ramp-volume-2 = ""
ramp-volume-3 = ""
ramp-volume-4 = ""
ramp-volume-5 = ""
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC0
full-at = 98
format-full = <label-full>
format-charging = <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full-underline = ${self.format-charging-underline}
format-charging-underline = ${colours.background}
format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = " "
format-charging-prefix = " "
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
format-full-prefix-foreground = ${colours.icon}
format-charging-prefix-foreground = ${colours.icon}
ramp-capacity-foreground = ${colours.icon}
ramp-capacity-0-foreground = ${colours.critical}
ramp-capacity-1-foreground = ${colours.warning}
[module/cputemp]
type = internal/temperature
hwmon-path = /sys/devices/platform/nct6775.656/hwmon/hwmon1/temp2_input
base-temperature = 25
format = <ramp> <label>
format-warn = <ramp> <label-warn>
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colours.background}
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-3 = 
ramp-4 = 
ramp-5 = 
ramp-foreground = ${colours.icon}
[module/gputemp]
type = custom/script
exec = nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits
interval = 10
label = %output%°C
format-prefix = " "
format-prefix-foreground = ${colours.icon}
[module/powermenu]
type = custom/menu
expand-right = true
label-open = 
label-close = cancel
label-separator = |
label-open-foreground = ${colours.icon}
label-close-foreground = ${colours.background}
label-separator-foreground = ${colours.icon}
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
; vim:ft=dosini

11
polybar/update.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
dothething() { count=$( (checkupdates & yay -Qum) 2>/dev/null | wc -l); test $count -gt 0 && echo $count || echo; }
trap 'true' HUP USR1
while true; do
dothething
sleep 120 &
wait
done

136
polybar/weather.sh Executable file
View File

@ -0,0 +1,136 @@
#!/bin/sh
get_icon_day() {
case $1 in
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
500) echo;; # light rain
721) echo;; # haze
800) echo;; # clear sky
801) echo;; # few clouds
802) echo;; # scattered clouds
803) echo;; # broken clouds
804) echo;; # overcast clouds
*) return 1;;
esac
}
get_icon_night() {
case $1 in
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
500) echo;; # light rain
800) echo;; # clear sky
801) echo;; # few clouds
802) echo;; # scattered clouds
803) echo;; # broken clouds
804) echo;; # overcast clouds
*) return 1;;
esac
}
get_icon() {
case $1 in
d) fn=get_icon_day;;
n) fn=get_icon_night;;
esac
if $fn $2; then
return
fi
case $2 in
200) echo;; # thunderstorm with light rain
201) echo;; # thunderstorm with rain
202) echo;; # thunderstorm with heavy rain
210) echo;; # light thunderstorm
211) echo;; # thunderstorm
212) echo;; # heavy thunderstorm
221) echo;; # ragged thunderstorm
230) echo;; # thunderstorm with light drizzle
231) echo;; # thunderstorm with drizzle
232) echo;; # thunderstorm with heavy drizzle
300) echo;; # light intensity drizzle
301) echo;; # drizzle
302) echo;; # heavy intensity drizzle
310) echo;; # light intensity drizzle rain
311) echo;; # drizzle rain
312) echo;; # heavy intensity drizzle rain
313) echo;; # shower rain and drizzle
314) echo;; # heavy shower rain and drizzle
321) echo;; # shower drizzle
500) echo;; # light rain
501) echo;; # moderate rain
502) echo;; # heavy intensity rain
503) echo;; # very heavy rain
504) echo;; # extreme rain
511) echo;; # freezing rain
520) echo;; # light intensity shower rain
521) echo;; # shower rain
522) echo;; # heavy intensity shower rain
531) echo;; # ragged shower rain
600) echo;; # light snow
601) echo;; # snow
602) echo;; # heavy snow
611) echo;; # sleet
612) echo;; # shower sleet
615) echo;; # light rain and snow
616) echo;; # rain and snow
620) echo;; # light shower snow
621) echo;; # shower snow
622) echo;; # heavy shower snow
701) echo;; # mist
711) echo;; # smoke
721) echo;; # haze
741) echo;; # fog
762) echo;; # volcanic ash
781) echo;; # tornado
# 731) echo ;; # sand, dust whirls
# 751) echo ;; # sand
# 761) echo ;; # dust
# 771) echo ;; # squalls
*) echo;;
esac
}
KEY="$OPENWEATHERMAP_API_KEY"
CITY=""
UNITS="metric"
SYMBOL="°"
ICON_COL="147a82"
API="https://api.openweathermap.org/data/2.5"
if [ ! -z $CITY ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
weather=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ ! -z "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
weather=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
else
echo "%{F#$ICON_COL}%{F-}"
fi
fi
if [ ! -z "$weather" ]; then
# weather_desc=$(echo "$weather" | jq -r ".weather[0].description")
weather_temp=$(echo "$weather" | jq '.main.temp' | cut -d "." -f 1)
weather_code=$(echo "$weather" | jq -r '.weather[0].id')
time_of_day=$(echo "$weather" | jq -r '.weather[0].icon | split("") | last')
icon=$(get_icon "$time_of_day" "$weather_code")
echo "%{F#$ICON_COL}$icon%{F-} $weather_temp$SYMBOL"
fi