diff --git a/.config/waybar/colors.css b/.config/waybar/colors.css new file mode 100644 index 0000000..45db4c3 --- /dev/null +++ b/.config/waybar/colors.css @@ -0,0 +1,11 @@ +@define-color background #2e3440; +@define-color foreground #eceff4; +@define-color white #e5e9f0; +@define-color black #3b4252; +@define-color red #bf616a; +@define-color blue #88c0d0; +@define-color green #a3be8c; +@define-color yellow #ebcb8b; +@define-color magenta #b48ead; +@define-color cyan #88c0d0; +@define-color orange #d08770; diff --git a/.config/waybar/config b/.config/waybar/config new file mode 100644 index 0000000..30d6251 --- /dev/null +++ b/.config/waybar/config @@ -0,0 +1,108 @@ +{ + // "layer": "top", // Waybar at top layer + "position": "top", + + "height": 39, + "width": 1895, + "spacing": 10, + + "modules-left": ["hyprland/window","pulseaudio"], + "modules-center": ["wlr/workspaces"], + "modules-right": ["custom/cmus", "custom/weather", "tray", "battery", "custom/language", "clock"], + + "wlr/workspaces": { + "format": "{icon}", + "on-scroll-up": "hyprctl dispatch workspace e+1", + "on-scroll-down": "hyprctl dispatch workspace e-1", + "on-click": "activate", + "all-outputs": false, + "format": "{icon}", + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + "5": "", + "6": "", + "urgent": "", + "focused": "", + "default": "" + } + }, + + "sway/mode": { + "format": "{}" + }, + + "tray": { + "spacing": 10, + "icon-size": 15 + }, + + "clock": { + "format": "{:%I:%M %p}", + "format-alt": "{:%Y-%m-%d %I:%M %p}" + }, + + "custom/cmus": { + "format": " {}", + "max-length": 45, + "interval": 10, + "exec": "cmus-remote -C \"format_print '%F'\"", + "exec-if": "pgrep cmus", + "on-click": "cmus-remote -u", + "on-scroll-up": "cmus-remote --next", + "on-scroll-down": "cmus-remote --prev", + "escape": true + }, + + "custom/weather": { + "format": "{}", + "exec": "~/.config/waybar/openweathermap-simple.sh", + // "exec": "curl 'https://wttr.in/?format=1'", + "interval": 3600 + }, + + "hyprland/window": { + "format": "{}", + "separate-outputs": false, + "max-length": 20 + }, + + "custom/language": { + "exec": "~/.config/hypr/scripts/kb_hypr", + "interval": 1, + "format": " {}", + }, + + "battery": { + "states": { + "good": 60, + "warning": 40, + "critical": 30 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-plugged": " {capacity}%", + "format-full": " full charged", + "format-warning": " {capacity}%", + "format-critical": " {capacity}%", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""] + }, + + "pulseaudio": { + "scroll-step": 1, + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon} ", + "format-bluetooth-muted": " {icon} ", + "format-muted": "", + "format-source": "", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "default": ["", "", ""] + }, + "on-click": "pkill pulsemixer; foot -e pulsemixer" + } +} diff --git a/.config/waybar/openweathermap-simple.sh b/.config/waybar/openweathermap-simple.sh new file mode 100644 index 0000000..4f5d77b --- /dev/null +++ b/.config/waybar/openweathermap-simple.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +get_icon() { + case $1 in + # Icons for weather-icons + 01d) icon="";; + 01n) icon="";; + 02d) icon="";; + 02n) icon="";; + 03*) icon="";; + 04*) icon="";; + 09d) icon="";; + 09n) icon="";; + 10d) icon="";; + 10n) icon="";; + 11d) icon="";; + 11n) icon="";; + 13d) icon="";; + 13n) icon="";; + 50d) icon="";; + 50n) icon="";; + *) icon=""; + + # Icons for Font Awesome 5 Pro + #01d) icon="";; + #01n) icon="";; + #02d) icon="";; + #02n) icon="";; + #03d) icon="";; + #03n) icon="";; + #04*) icon="";; + #09*) icon="";; + #10d) icon="";; + #10n) icon="";; + #11*) icon="";; + #13*) icon="";; + #50*) icon="";; + #*) icon=""; + esac + + echo $icon +} + +KEY="e434b5435a979de6e155570590bee89b" +CITY="Novosibirsk" +UNITS="metric" +SYMBOL="°" + +API="https://api.openweathermap.org/data/2.5" + +if [ -n "$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 [ -n "$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") + fi +fi + +if [ -n "$weather" ]; then + weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1) + weather_icon=$(echo "$weather" | jq -r ".weather[0].icon") + + echo "$(get_icon "$weather_icon")" "$weather_temp$SYMBOL" +fi diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..dace1a6 --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,199 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, JetBrainsMono, sans-serif; + font-size: 13px; +} + +@import "./colors.css"; + +window#waybar { + background-color: rgba(43, 48, 59, 0.0); + color: @foreground; + transition-property: background-color; + transition-duration: .5s; + padding: 0; + margin: 0; +} + +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + + +button { + margin: 0; + padding: 10px; + background-color: @background; + color: #d8dee8; + border-radius: 15px; +} + +button:hover { + margin: 0; + padding: 10px; + background-color: @background; + color: #d8dee8; + border-radius: 15px; +} + +button:focus { + margin: 0; + padding: 10px; + background-color: @background; + color: #d8dee8; + border-radius: 15px; +} + + +#workspaces { + margin: 0; +} + +#workspaces button { + padding: 0 5px; + margin: 5px; + background-color: @background; + color: #444b6a; + border-radius: 16px; +} + +#workspaces button:hover { + color: @background; +} + +#workspaces button.active { + background-color: @background; + color: @blue; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + + +#tray { + padding: 7px; + margin: 5px 0 5px 0; + background-color: @background; + color: #d8dee8; + border-radius: 12px; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; +} + + +#custom-cmus { + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + background-color: @background; + color: #b9f27c; + border-radius: 15px; +} + + +#window { + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + background-color: @background; + color: @white; + border-radius: 12px; +} + + +#clock { + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + background-color: @background; + color: @white; + border-radius: 12px; +} + + +#mode, +#custom-weather { + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + background-color: @background; + color: #d8dee8; + border-radius: 15px; +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +label:focus { + background-color: #ffffff; +} + +#custom-language { + background-color: @background; + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + border-radius: 12px; +} + + +/* #keyboard-state { */ +/* background: #97e1ad; */ +/* color: #000000; */ +/* padding: 0 0px; */ +/* margin: 0 5px; */ +/* min-width: 16px; */ +/* } */ +/**/ +/* #keyboard-state > label { */ +/* padding: 0 0px; */ +/* } */ +/**/ +/* #keyboard-state > label.locked { */ +/* background: rgba(0, 0, 0, 0.2); */ +/* } */ + +#pulseaudio { + background-color: @background; + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + border-radius: 12px; +} + +#battery { + padding: 0 15px 0 15px; + margin: 5px 0 5px 0; + border-radius: 12px; + color: @blue; + background: @background; +} + +#battery.charging, #battery.plugged { + color: @green; + background-color: @background; +} + +#battery.warning:not(.charging) { + background-color: @background; + color: @orange; +} + +#battery.critical:not(.charging) { + background-color: @barkground; + color: @red; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +}