update
This commit is contained in:
257
dotconfig/polybar/config.ini.model
Normal file
257
dotconfig/polybar/config.ini.model
Normal file
@@ -0,0 +1,257 @@
|
||||
[color]
|
||||
background = #2f4a36
|
||||
background-alt = #375740
|
||||
foreground = #e8e8e8
|
||||
foreground-dim = #b8c0b8
|
||||
accent = #a3be8c
|
||||
alert = #ff6b6b
|
||||
|
||||
; =========================
|
||||
; BASES
|
||||
; =========================
|
||||
|
||||
[bar/base]
|
||||
monitor = ${env:MONITOR:}
|
||||
width = 100%
|
||||
height = 20
|
||||
offset-x = 0
|
||||
foreground = ${color.foreground}
|
||||
border-size = 0
|
||||
line-size = 0
|
||||
padding-left = 1
|
||||
padding-right = 1
|
||||
module-margin = 1
|
||||
separator = " · "
|
||||
separator-foreground = ${color.foreground-dim}
|
||||
font-0 = "DejaVuSansM Nerd Font Mono:size=10;2"
|
||||
font-1 = "Noto Sans CJK JP:size=10;2"
|
||||
font-2 = "Noto Color Emoji:size=10;2"
|
||||
radius = 10
|
||||
enable-ipc = true
|
||||
|
||||
[module/temp-base]
|
||||
type = internal/temperature
|
||||
warn-temperature = 80
|
||||
format = <label>
|
||||
label-warn-foreground = ${color.alert}
|
||||
|
||||
[fs-base]
|
||||
type = internal/fs
|
||||
interval = 30
|
||||
fixed-values = true
|
||||
format-mounted = <label-mounted>
|
||||
|
||||
; =========================
|
||||
; BARS
|
||||
; =========================
|
||||
|
||||
[bar/top]
|
||||
inherit = bar/base
|
||||
offset-y = 0
|
||||
background = ${color.background}
|
||||
modules-left =
|
||||
modules-center = date-time
|
||||
modules-right = battery
|
||||
radius-bottom = 0
|
||||
|
||||
[bar/middle]
|
||||
inherit = bar/base
|
||||
offset-y = 20
|
||||
background = ${color.background-alt}
|
||||
modules-left = cpu memory
|
||||
modules-center = cpu-temp gpu-temp nvme-temp fan
|
||||
modules-right = dns
|
||||
radius = 0
|
||||
|
||||
[bar/bottom]
|
||||
inherit = bar/base
|
||||
offset-y = 40
|
||||
background = ${color.background}
|
||||
modules-left = net-wireless
|
||||
modules-center = fs-system
|
||||
modules-right = volume
|
||||
radius-top = 0
|
||||
|
||||
; =========================
|
||||
; FOOTER
|
||||
; =========================
|
||||
|
||||
[bar/tray-bottom]
|
||||
inherit = bar/base
|
||||
bottom = true
|
||||
offset-y = 0
|
||||
background = ${color.background-alt}
|
||||
modules-left = desktops
|
||||
modules-center = ping-amaury
|
||||
modules-right = spotify spotify-prev spotify-play-pause spotify-next tray
|
||||
|
||||
[bar/bottom-b]
|
||||
inherit = bar/base
|
||||
bottom = true
|
||||
offset-y = 0
|
||||
background = ${color.background-alt}
|
||||
modules-left = desktops
|
||||
modules-center =
|
||||
modules-right =
|
||||
|
||||
|
||||
; =========================
|
||||
; MODULES
|
||||
; =========================
|
||||
|
||||
[module/desktops]
|
||||
type = internal/i3
|
||||
pin-workspaces = true
|
||||
enable-click = true
|
||||
enable-scroll = true
|
||||
scroll-up = "#i3.prev"
|
||||
scroll-down = "#i3.next"
|
||||
|
||||
label-focused = %name%
|
||||
label-focused-padding = 1
|
||||
label-focused-background = ${color.accent}
|
||||
label-focused-foreground = #1f2a1f
|
||||
|
||||
label-unfocused = %name%
|
||||
label-unfocused-padding = 1
|
||||
label-unfocused-foreground = ${color.foreground-dim}
|
||||
|
||||
label-visible = %name%
|
||||
label-visible-padding = 1
|
||||
|
||||
label-urgent = %name%
|
||||
label-urgent-padding = 1
|
||||
label-urgent-background = ${color.alert}
|
||||
label-urgent-foreground = #ffffff
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 2
|
||||
format = <label>
|
||||
label = CPU %percentage%%
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
interval = 2
|
||||
format = <label>
|
||||
label = RAM %percentage_used%% %used%
|
||||
|
||||
[module/cpu-temp]
|
||||
inherit = module/temp-base
|
||||
hwmon-path = /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon@HW@/temp1_input
|
||||
label = CPU %temperature-c%
|
||||
label-warn = CPU %temperature-c%
|
||||
|
||||
[module/gpu-temp]
|
||||
inherit = module/temp-base
|
||||
hwmon-path = /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon@HW@/temp2_input
|
||||
label = GPU %temperature-c%
|
||||
label-warn = GPU %temperature-c%
|
||||
|
||||
[module/nvme-temp]
|
||||
inherit = module/temp-base
|
||||
hwmon-path = /sys/devices/pci0000:00/0000:00:06.0/0000:01:00.0/nvme/nvme0/hwmon0/temp1_input
|
||||
label = NVMe %temperature-c%
|
||||
label-warn = NVMe %temperature-c%
|
||||
|
||||
[module/fan]
|
||||
type = custom/script
|
||||
exec = cat /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/fan1_input
|
||||
label = Fan %output% RPM
|
||||
|
||||
[module/date-time]
|
||||
type = internal/date
|
||||
interval = 1
|
||||
date = %a %d %b
|
||||
time = %H:%M:%S
|
||||
label = %date% · %time%
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = AC
|
||||
poll-interval = 1
|
||||
low-at = 15
|
||||
full-at = 100
|
||||
time-format = %Hh %Mm
|
||||
|
||||
format-charging = <label-charging>
|
||||
label-charging = %percentage%% %time% %consumption%W
|
||||
|
||||
format-discharging = <label-discharging>
|
||||
label-discharging = %percentage%% %time% %consumption%W
|
||||
|
||||
format-full = <label-full>
|
||||
label-full = %percentage%%
|
||||
|
||||
format-low = <label-low>
|
||||
label-low = %percentage%%
|
||||
label-low-foreground = ${color.alert}
|
||||
|
||||
[module/net-wireless]
|
||||
type = internal/network
|
||||
interface-type = wireless
|
||||
interval = 3
|
||||
speed-unit = B/s
|
||||
format-connected = <label-connected>
|
||||
label-connected = %essid% · %local_ip% · U %upspeed% · D %downspeed%
|
||||
format-disconnected = <label-disconnected>
|
||||
label-disconnected = Wi-Fi down
|
||||
label-disconnected-foreground = ${color.foreground-dim}
|
||||
|
||||
[module/fs-system]
|
||||
inherit = fs-base
|
||||
mount-0 = /
|
||||
label-mounted = / %used% on %total%
|
||||
|
||||
[module/dns]
|
||||
type = custom/script
|
||||
exec = nslookup amauryjoly.fr | sed -n '2p' | awk '{print $2}'
|
||||
interval = 30
|
||||
label = DNS %output%
|
||||
|
||||
[module/volume]
|
||||
type = internal/pulseaudio
|
||||
format-volume = <label-volume>
|
||||
label-volume = VOL %percentage%%
|
||||
format-muted = <label-muted>
|
||||
label-muted = VOL mute
|
||||
label-muted-foreground = ${color.foreground-dim}
|
||||
|
||||
[module/tray]
|
||||
type = internal/tray
|
||||
format-margin = 2
|
||||
tray-spacing = 0
|
||||
|
||||
[module/ping-amaury]
|
||||
type = custom/script
|
||||
exec = sh -c 'v=$(ping -c 1 -W 1 amauryjoly.fr 2>/dev/null | sed -n "s/.*temps=\\([0-9.]*\\).*/\\1/p"); [ -n "$v" ] && echo "$v ms" || echo "down"'
|
||||
interval = 60
|
||||
format = <label>
|
||||
label = LAT %output%
|
||||
|
||||
[module/spotify]
|
||||
type = custom/script
|
||||
tail = true
|
||||
interval = 5
|
||||
; prefix symbol is shown before the text
|
||||
format-prefix = " "
|
||||
format = <label>
|
||||
exec = ~/.config/polybar/scroll_spotify_status.sh
|
||||
|
||||
[module/spotify-prev]
|
||||
type = custom/text
|
||||
format = ""
|
||||
click-left = playerctl previous -p spotify
|
||||
|
||||
[module/spotify-play-pause]
|
||||
type = custom/ipc
|
||||
hook-0 = echo ''
|
||||
hook-1 = echo ''
|
||||
initial = 1
|
||||
click-left = playerctl play-pause -p spotify
|
||||
|
||||
[module/spotify-next]
|
||||
type = custom/text
|
||||
format = ""
|
||||
click-left = playerctl next -p spotify
|
||||
51
dotconfig/polybar/get_spotify_status.sh
Executable file
51
dotconfig/polybar/get_spotify_status.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
# https://github.com/PrayagS/polybar-spotify/blob/master/get_spotify_status.sh
|
||||
|
||||
# The name of polybar bar which houses the main spotify module and the control modules.
|
||||
PARENT_BAR="tray-bottom"
|
||||
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
|
||||
|
||||
# Set the source audio player here.
|
||||
# Players supporting the MPRIS spec are supported.
|
||||
# Examples: spotify, vlc, chrome, mpv and others.
|
||||
# Use `playerctld` to always detect the latest player.
|
||||
# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control
|
||||
PLAYER="spotify"
|
||||
|
||||
# Format of the information displayed
|
||||
# Eg. {{ artist }} - {{ album }} - {{ title }}
|
||||
# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata
|
||||
FORMAT="{{ title }} - {{ artist }}"
|
||||
|
||||
# Sends $2 as message to all polybar PIDs that are part of $1
|
||||
update_hooks() {
|
||||
while IFS= read -r id
|
||||
do
|
||||
polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1
|
||||
done < <(echo "$1")
|
||||
}
|
||||
|
||||
PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null)
|
||||
EXIT_CODE=$?
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
STATUS=$PLAYERCTL_STATUS
|
||||
else
|
||||
STATUS="No player is running"
|
||||
fi
|
||||
|
||||
if [ "$1" == "--status" ]; then
|
||||
echo "$STATUS"
|
||||
else
|
||||
if [ "$STATUS" = "Stopped" ]; then
|
||||
echo "No music is playing"
|
||||
elif [ "$STATUS" = "Paused" ]; then
|
||||
update_hooks "$PARENT_BAR_PID" 2
|
||||
playerctl --player=$PLAYER metadata --format "$FORMAT"
|
||||
elif [ "$STATUS" = "No player is running" ]; then
|
||||
echo "$STATUS"
|
||||
else
|
||||
update_hooks "$PARENT_BAR_PID" 1
|
||||
playerctl --player=$PLAYER metadata --format "$FORMAT"
|
||||
fi
|
||||
fi
|
||||
12
dotconfig/polybar/scroll_spotify_status.sh
Executable file
12
dotconfig/polybar/scroll_spotify_status.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# see man zscroll for documentation of the following parameters
|
||||
zscroll -l 30 \
|
||||
--delay 1 \
|
||||
--scroll-padding " " \
|
||||
--match-command "`dirname $0`/get_spotify_status.sh --status" \
|
||||
--match-text "Playing" "--scroll 1" \
|
||||
--match-text "Paused" "--scroll 0" \
|
||||
--update-check true "`dirname $0`/get_spotify_status.sh" &
|
||||
|
||||
wait
|
||||
40
dotconfig/polybar/start.sh
Executable file
40
dotconfig/polybar/start.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
killall -q polybar
|
||||
|
||||
while pgrep -x polybar >/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
hw=""
|
||||
for h in /sys/class/hwmon/hwmon*; do
|
||||
if grep -qx 'thinkpad' "$h/name"; then
|
||||
hw=${h##*/hwmon}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -n "$hw" ] || {
|
||||
echo "Capteur thinkpad introuvable" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
polybar_dir="/home/alice/.config/polybar"
|
||||
|
||||
tmpconf="$polybar_dir/config.ini"
|
||||
sed "s/@HW@/$hw/g" $polybar_dir/config.ini.model > "$tmpconf"
|
||||
|
||||
primary=$(xrandr --query | grep " primary" | cut -d" " -f1)
|
||||
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR="$m" HW="$hw" polybar top &
|
||||
sleep 0.1
|
||||
MONITOR="$m" HW="$hw" polybar middle &
|
||||
sleep 0.1
|
||||
MONITOR="$m" HW="$hw" polybar bottom &
|
||||
if [ "$m" = "$primary" ]; then
|
||||
MONITOR="$m" HW="$hw" polybar tray-bottom &
|
||||
else
|
||||
MONITOR="$m" HW="$hw" polybar bottom-b &
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user