From bd49911eca17e1dc691a85c9781c58431a25ca32 Mon Sep 17 00:00:00 2001 From: Le-foucheur <38878602+Le-foucheur@users.noreply.github.com> Date: Sat, 14 Sep 2024 19:27:37 +0200 Subject: [PATCH] add --- waybar/config | 144 ++++++++++++++++++++++++++++++++++++++ waybar/config_eco | 43 ++++++++++++ waybar/modules/spotify.sh | 25 +++++++ waybar/style.css | 110 +++++++++++++++++++++++++++++ 4 files changed, 322 insertions(+) create mode 100644 waybar/config create mode 100644 waybar/config_eco create mode 100644 waybar/modules/spotify.sh create mode 100644 waybar/style.css diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..352eb79 --- /dev/null +++ b/waybar/config @@ -0,0 +1,144 @@ +{ + "layer": "bottom", + "position": "bottom", + "height": 30, + "modules-center": [ + "sway/workspaces", + "sway/mode" + ], + "modules-left": [ + "cpu", + "custom/separator", + "disk", + "custom/separator", + "memory", + "custom/separator", + "temperature", + "custom/separator", + "sway/language" + ], + "modules-right": [ + "custom/spotify", + "network", + "custom/separator", + "pulseaudio", + "bluetooth", + "custom/separator", + "battery", + "custom/separator", + "custom/clock" + ], + "sway/mode": { + "format": "{}" + }, + "sway/workspaces": { + "format": "{name}", + "disable-scroll": true + }, + "custom/separator": { + "format": "¦", + "tooltip": false + }, + "clock": { + "interval": 5, + "format": "{:%H:%M:%S | %d %a %Y}", + "timezone": "Europe/Paris" + }, + "custom/clock": { + "interval": 5, + "exec": "date +' %H:%M:%S | %d %a %Y '" + }, + "battery": { + "format": "{icon} {capacity}%", + "format-alt": "{time}", + "format-charging": "{icon} {capacity}%", + "format-icons":{ + "default":["󰂎", "󰁺", "󰁻", "󰁼", "󰁽","󰁾","󰁿","󰂀","󰂁","󰂁","󰂂","󰁹"], + "charging":["󰢟", "󰢜","󰂆", "󰂇", "󰂈", "󰢝", "󰢝","󰂉","󰢞", "󰂊","󰂋","󰂅"], + "full":"󰁹" + }, + "format-full": "{icon}", + "interval": 1, + "states": { + "good": 80, + "warning": 30, + "critical": 15 + }, + "tooltip": false + }, + "network": { + "interval": 15, + "format": "{signalStrength}% {icon}", + "format-disconnected": "⚠ Déconécté", + "tooltip": true, + "states": { + "nice": 80, + "good": 30, + "bad": 15 + }, + "tooltip-format": " {essid} \n ↑ - {bandwidthUpOctets} \n ↓ - {bandwidthDownOctets} \n {ipaddr}", + "format-icons": ["\udb82\udd2f", "\udb82\udd1f", "\udb82\udd22", "\udb82\udd25", "\udb82\udd28"], + "on-click": "exec nmcli d w c Gas" + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": "", + "scroll-step": 1, + "format-icons":["", "", ""], + "on-click": "process=$(pidof pavucontrol) ; if [[ -z $process ]]; then pavucontrol& else swaymsg '[app_id=pavucontrol]' focus; fi", + "on-click-right": "if [[ $(bluetoothctl show | grep PowerState | cut -c14-) = 'on' ]]; then bluetoothctl power off; else bluetoothctl power on; fi", + "tooltip": false + }, + "bluetooth": { + "format": "", + "format-on": "\uf293", + "format-connected": "\uf293", + "format-connected-battery": "\uf293", + "on-click": "exec alacritty -T 'Alacritty - bluetoothctl' -e bluetoothctl&", + "on-click-right": "if [[ $(bluetoothctl show | grep PowerState | cut -c14-) = 'on' ]]; then bluetoothctl power off; else bluetoothctl power on; fi", + "tooltip": true, + "tooltip-format-connected": "{device_alias}", + "tooltip-format-connected-battery": "{device_alias} {device_battery_percentage}%" + }, + "custom/spotify": { + "format": "{} ¦", + "interval": 1, + "return-type": "json", + "exec": "~/.config/waybar/modules/spotify.sh", + "exec-if": "pgrep deezer-enhanced", + "escape": true, + "on-click": "swaymsg '[title=\"Deezer Enhanced\"]' focus" + }, + "disk": { + "interval": 30, + "tooltip": false, + "format": "{free}", + "path": "/" + }, + "memory": { + "interval": 15, + "format": "{used:.1f} GiB/{total:.1f} GiB", + "tooltip": false, + "on-click": "process=$(pidof htop) ; if [[ -z $process ]]; then exec alacritty -T 'Alacritty - htop' -e htop& else swaymsg '[title=\"Alacritty - htop\"]' focus; fi" + }, + "cpu": { + "interval": 5, + "format": "cpu {usage:02}%", + "states": { + "warning": 80, + "critical": 95 + }, + "on-click": "process=$(pidof htop) ; if [[ -z $process ]]; then exec alacritty -T 'Alacritty - htop' -e htop& else swaymsg '[title=\"Alacritty - htop\"]' focus; fi" + }, + "temperature": { + "interval": 10, + "format": "{icon} {temperatureC}°C", + "tooltip": false, + "critical-threshold": 90, + "format-icons":["","", "","",""], + "on-click": "process=$(pidof watch sensors) ; if [[ -z $process ]]; then exec alacritty -T 'Alacritty - sensors' -e watch sensors& else swaymsg '[title=\"Alacritty - sensors\"]' focus; fi" + }, + "sway/language": { + "format": " {variant}" + } +} \ No newline at end of file diff --git a/waybar/config_eco b/waybar/config_eco new file mode 100644 index 0000000..082ba96 --- /dev/null +++ b/waybar/config_eco @@ -0,0 +1,43 @@ +{ + "layer": "bottom", + "position": "bottom", + "height": 30, + "modules-left": [ + "sway/workspaces", + "sway/mode" + ], + "modules-right": [ + "battery", + "custom/separator", + "clock" + ], + "sway/mode": { + "format": "{}" + }, + "sway/workspaces": { + "format": "{name}", + "disable-scroll": true + }, + "custom/separator": { + "format": "|", + "tooltip": false + }, + "clock": { + "interval": 60, + "format": "{:%d-%m-%Y %H:%M:%S}", + "tooltip": false + }, + "battery": { + "format": "BAT {capacity}%", + "format-alt": "{time}", + "format-charging": "CHR {capacity}%", + "format-full": "FULL", + "interval": 120, + "states": { + "good": 80, + "warning": 30, + "critical": 15 + }, + "tooltip": false + } +} \ No newline at end of file diff --git a/waybar/modules/spotify.sh b/waybar/modules/spotify.sh new file mode 100644 index 0000000..5e48d75 --- /dev/null +++ b/waybar/modules/spotify.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +class=$(playerctl metadata --player=Deezer --format '{{lc(status)}}') +icon="" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --player=Deezer --format '{{title}} - {{artist}}') + info=$(echo ${info//\"/\\\"}) # Escape quote with \" + if [[ ${#info} -ge 33 ]]; then + info=$(playerctl metadata --player=Deezer --format '{{title}}') + info=$(echo ${info//\"/\\\"}) # Escape quote with \" + fi + if [[ ${#info} -ge 33 ]]; then + info=$(echo $info | cut -c1-30)"..." + fi + tooltip=$(playerctl metadata --format "{{duration(position)}}/{{duration(mpris:length)}}") + text=$info" "$icon + tooltip="🜁 "$tooltip" 🜃" +elif [[ $class == "paused" ]]; then + text="󰏤 "$icon +elif [[ $class == "stopped" ]]; then + text="" +fi + +echo -e "{\"text\":\""$text"\", \"tooltip\":\""$tooltip"\"}, \"class\":\""$class"\"}" \ No newline at end of file diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..903c5e1 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,110 @@ +* { + border: none; + border-radius: 0; + font-size: 12px; + font-family: "JetBrainsMono Nerd Font Mono","MesloLGS Nerd Font", "Cantarell", "Mononoki Nerd Font", "Font Awesome", "Icons"; + box-shadow: none; + text-shadow: none; + transition-duration: 0s; +} + +window { + color: rgb(255, 255, 255); + background: rgb(0, 0, 0); +} + +#workspaces { + margin: 0 5px; +} + +#workspaces button { + padding: 0 5px; + color: rgba(217, 216, 216, 0.6); +} + +#workspaces button.visible { + color: rgba(217, 216, 216, 1); +} + +#workspaces button.focused { + border-top: 3px solid rgba(217, 216, 216, 1); + border-bottom: 3px solid transparent; + color: #fc9867; +} + +#workspaces button.urgent { + color: rgba(238, 46, 36, 1); +} + +#mode, +#battery, +#cpu, +#temperature, +#memory, +#network, +#pulseaudio, +#disk { + margin: 0px 6px 0px 5px; +} + +#custom-spotify { + margin: 0px 0px 0px 5px; +} + +#custom-separator { + color: rgba(217, 216, 216, 0.5); + font-weight: bold; +} + +#clock, #custom-clock { + margin: 0px 10px 0px 5px; + font-weight: bold; +} + +#tray { + margin: 0px 5px 0px 0px; +} + +#cpu.warning, #battery.warning { + color: #FFD866; +} + +#cpu.critical, #temperature.critical { + color: #FF6188; +} + +#battery.critical { + color: #FF6188; +} + +#battery.good { + color: #759f02; +} + +#battery, #battery.full { + color: #349f02; +} + +#battery.charging { + color: #b3b305; +} + +#network { + color:#349f02 +} + +#network.nice { + color:#7a9f02 +} + +#network.good { + color:#959f02 +} + +#network.bad { + color:#9f0702 +} + +#network.disconnected { + color:#9f0702 +} \ No newline at end of file