From f3e2b5c264cd871fe60c43520add0f47523192be Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Wed, 26 Jul 2023 19:52:39 +0700 Subject: [PATCH] panel waybar --- rockethype/config/waybar/config | 150 ++++++++++++++ rockethype/config/waybar/scripts/lstempcpu | 13 ++ rockethype/config/waybar/scripts/lstempgpu | 13 ++ rockethype/config/waybar/scripts/wgstatus | 25 +++ rockethype/config/waybar/style.css | 228 +++++++++++++++++++++ 5 files changed, 429 insertions(+) create mode 100755 rockethype/config/waybar/config create mode 100755 rockethype/config/waybar/scripts/lstempcpu create mode 100755 rockethype/config/waybar/scripts/lstempgpu create mode 100755 rockethype/config/waybar/scripts/wgstatus create mode 100755 rockethype/config/waybar/style.css diff --git a/rockethype/config/waybar/config b/rockethype/config/waybar/config new file mode 100755 index 0000000..2758eb5 --- /dev/null +++ b/rockethype/config/waybar/config @@ -0,0 +1,150 @@ +{ + "position": "top", + "layer": "top", + "modules-left": [ + "custom/launch", + "cpu", + "memory", + "custom/tempcpu", + "custom/tempgpu" + ], + "modules-center": ["wlr/workspaces"], + "modules-right": [ + "tray", + "custom/wgstatus", + "hyprland/language", + "pulseaudio", + "clock", + "custom/notify", + "custom/off" + ], + "custom/launch": { + "format": " ", + "on-click": "sleep 0.1 && menurun", + "tooltip": false, + "escape": true + }, + + "custom/tempcpu": { + "interval": 3, + "exec": "~/.config/waybar/scripts/lstempcpu", + "format": " {}°C", + "tooltip": true, + "return-type": "json" + }, + + "custom/tempgpu": { + "interval": 3, + "exec": "~/.config/waybar/scripts/lstempgpu", + "format": "󰢮 {}°C", + "tooltip": false, + "return-type": "json" + }, + + "wlr/workspaces": { + "disable-scroll": true, + "format": " {icon} ", + "on-click": "activate", + "all-outputs": false, + "sort-by-number": true, + "persistent_workspaces": { + "1": [], + "2": [], + "3": [], + "4": [], + "5": [], + "6": [], + "7": [], + "8": [] + }, + "format-icons": { + "1": " ", + "2": " ", + "3": " ", + "4": " ", + "5": " ", + "6": " ", + "7": "󰗃 ", + "8": "󰾲 ", + "urgent": " ", + "focused": " ", + "default": " " + } + }, + + "tray": { + "icon-size": 16, + "spacing": 10, + "tooltip": false + }, + + "custom/wgstatus": { + "interval": 1, + "exec": "~/.config/waybar/scripts/wgstatus", + "format": "  {} ", + "tooltip": false, + "on-click": "sleep 0.1 && ~/.config/waybar/scripts/wgstatus -toggle" + }, + + "hyprland/language": { + "format": " {} ", + "format-en": "Eng", + "format-ru": "Rus", + "on-click": "sleep 0.1 && hyprctl switchxkblayout compx-2.4g-wireless-receiver next", + }, + + "pulseaudio": { + "scroll-step": 5, + "format": "{icon} {volume}", + "format-bluetooth": "{icon} {volume}", + "format-bluetooth-muted": "  ", + "format-muted": " ", + "format-icons": { + "default": ["", "", " "] + }, + "on-click": "sleep 0.1 && pavucontrol &", + "on-click-middle": "sleep 0.1 && loopback_toggle", + "on-scroll-up": "swayosd --output-volume raise", + "on-scroll-down": "swayosd --output-volume lower", + "tooltip": false + }, + + "cpu": { + "format": "󰻠 {usage}%", + "tooltip": true, + "tooltip-format": "{tooltip}" + }, + + "memory": { + "interval": 3, + "format": "󰍛 {}%", + "max-length": 6, + "tooltip": true, + "tooltip-format": "{tooltip}" + }, + + "clock": { + "interval": 1, + "format": " {:%I:%M %p}", + "format-alt": " {:%b %d, %G}", + "tooltip-format": "{calendar}", + "calendar": { + "mode" : "month", + "mode-mon-col" : 3, + "format": { + "months": "{}", + "days": "{}", + "weekdays": "{}", + "today": "{}" + } + }, + }, + + "custom/off": { + "format": " ", + "on-click": "sleep 0.1 && menupower", + "tooltip": false, + "escape": true + } + +} diff --git a/rockethype/config/waybar/scripts/lstempcpu b/rockethype/config/waybar/scripts/lstempcpu new file mode 100755 index 0000000..da4c49e --- /dev/null +++ b/rockethype/config/waybar/scripts/lstempcpu @@ -0,0 +1,13 @@ +#!/bin/bash + +CPUTEMP=$(cat /sys/class/hwmon/hwmon3/temp1_input) +CRITEMP=70 +let "REZ=$CPUTEMP / 1000" +if [ $REZ -ge $CRITEMP ]; then + JSON_FMT='{"text":"%s","class":"%s","tooltip": "cpu"}\n' + printf "$JSON_FMT" "$REZ" "crit" +else + JSON_FMT='{"text":"%s","tooltip": "cpu"}\n' + printf "$JSON_FMT" "$REZ" +fi + diff --git a/rockethype/config/waybar/scripts/lstempgpu b/rockethype/config/waybar/scripts/lstempgpu new file mode 100755 index 0000000..fa1c154 --- /dev/null +++ b/rockethype/config/waybar/scripts/lstempgpu @@ -0,0 +1,13 @@ +#!/bin/bash + +GPUTEMP=$(cat /sys/class/hwmon/hwmon2/temp2_input) +CRITEMP=80 +let "REZ=$GPUTEMP / 1000" +if [ $REZ -ge $CRITEMP ]; then + JSON_FMT='{"text":"%s","class":"%s","tooltip":"gpu"}\n' + printf "$JSON_FMT" "$REZ" "crit" +else + JSON_FMT='{"text":"%s","tooltip":"gpu"}\n' + printf "$JSON_FMT" "$REZ" +fi + diff --git a/rockethype/config/waybar/scripts/wgstatus b/rockethype/config/waybar/scripts/wgstatus new file mode 100755 index 0000000..b93c14e --- /dev/null +++ b/rockethype/config/waybar/scripts/wgstatus @@ -0,0 +1,25 @@ +#!/bin/bash + +WGIFACE=kz.totmin.ru + +WGON(){ + echo "VPN" + WGS='true' +} + +WGOFF(){ +# echo "Off" + WGS='false' +} + +ifconfig $WGIFACE &>/dev/null && WGON ||WGOFF + +if [ "$1" = '-toggle' ]; then + if [ "$WGS" = 'true' ]; then + sudo wg-quick down $WGIFACE &>/dev/null + else + sudo wg-quick up $WGIFACE &>/dev/null + fi +fi + +exit 0 diff --git a/rockethype/config/waybar/style.css b/rockethype/config/waybar/style.css new file mode 100755 index 0000000..535d6f9 --- /dev/null +++ b/rockethype/config/waybar/style.css @@ -0,0 +1,228 @@ +/* + +Color Pallete + +foreground: '#abb2bf' +background: '#303030' +alt-background: '#282c34' +alt-foreground: '#1f2227' + +black: '#282c34' +red: '#e06c75' +green: '#98c379' +yellow: '#e5c07b' +blue: '#81A1C1' +magenta: '#c678dd' +cyan: '#56b6c2' +white: '#c8ccd4' + +*/ + +* { + border: 0px solid rgba(40, 44, 52, 0); + border-radius: 6px; + font-family: Iosevka Nerd Font, Font Awesome,Material Icons, Arial, sans-serif; + font-weight: 700; + font-size: 13px; + min-height: 18px; + padding: 1px; +} + +tooltip { + background: #303030; + font-family: Iosevka Nerd Font; + border: 1px solid rgba(100, 114, 125, 0.5); +} + +tooltip label { + color: #c8ccd4; +} + +window#waybar { + background-color: #303030; + background: transparent; + color: #303030; + transition-property: background-color; + transition-duration: 0.5s; + border-radius: 6px; + +} + +window > box { + margin-left: 12.5px; + margin-right: 12.5px; + margin-top: 12.5px; + background: #303030; + color: #c8ccd4; +} + +window#waybar.hidden { + opacity: 0.2; +} + +label:focus { + background-color: #282c34; +} + +@keyframes blink { + to { + background-color: #c8ccd4; + color: #282c34; + } +} + +#battery, +#cpu, +#memory, +#disk, +#backlight, +#network, +#pulseaudio, +#workspaces, +#clock, +#tray, +#mode, +#idle_inhibitor, +#mpd { + padding: 0 10px; + margin: 4px 4px 4px 4px; + color: #1f2227; +} + +#custom-launch { + margin-right: 10px; + margin-left: 4px; + padding-left: 10px; + padding-right: 10px; + margin-top: 4px; + margin-bottom: 4px; + font-size: 17px; + background-color: #81a1c1; + color: #1f2227; +} + +#custom-tempcpu { + color: #81A1C1; + margin-left: 8px; +} + +#custom-tempcpu.crit { + color: #e06c75; + margin-left: 8px; +} + +#custom-tempgpu { + color: #81A1C1; + margin-left: 18px; +} + +#custom-tempgpu.crit { + color: #e06c75; + margin-left: 18px; +} + +#workspaces button { + padding: 5px 5px; + background-color: transparent; + border-radius: 6px; + margin-left: 1px; + color: #abb2bf; +} + +#workspaces button:hover { + background-color: transparent; + color: #c678dd; +} + +#workspaces button.active { + background-color: transparent; + color: #e06c75; +} + +#workspaces button.urgent { + background-color: transparent; + color: #e06c75; +} + +#custom-spotify { + padding-left: 10px; + padding-right: 10px; + margin-top: 4px; + margin-bottom: 4px; + font-size: 17px; + font-weight: 500; + background-color: #98c379; + color: #1f2227; +} + +#custom-wgstatus { +color: #e06c75; +margin-right: 18px; +} + +#language { + color: #c678dd; +} + +#pulseaudio { + color: #e5c07b; +} + +#pulseaudio.muted { + background-color: #81a1c1; + color: #282c34; +} + +#backlight { + color: #e5c07b; +} + +#network { + color: #81a1c1; +} + +#memory { + color: #81A1C1; +} + +#cpu { + color: #81A1C1; +} + +#battery { + color: #e5c07b; +} + +#battery.charging, +#battery.plugged { + color: #e06c75; +} + +#battery.critical:not(.charging) { + color: #e06c75; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#clock { + color: #98c379; +} + +#custom-notify { + color: #56b6c2; +} + +#custom-off { + margin-right: 4px; + margin-left: 11px; + padding-left: 10px; + padding-right: 8px; + margin-top: 4px; + margin-bottom: 4px; + font-size: 17px; + background-color: #e06c75; + color: #272727; +}