initial commit x2
This commit is contained in:
62
old_rach/waybar/config.jsonc
Normal file
62
old_rach/waybar/config.jsonc
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"position": "bottom",
|
||||
"height": 45,
|
||||
"modules-left": [ "custom/workspace" ],
|
||||
"modules-right": [ "user", "hyprland/language", "pulseaudio", "clock" ],
|
||||
|
||||
"clock": {
|
||||
"interval": 60,
|
||||
"format": "{:%H:%M}",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"pulseaudio": {
|
||||
"scroll-step": "5",
|
||||
"format": "{icon} {volume}",
|
||||
"format-icons": {
|
||||
"default": [" ", " ", " "]
|
||||
},
|
||||
"on-click": "pavucontrol",
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"hyprland/language": {
|
||||
"format": "{}",
|
||||
"format-en": "us",
|
||||
"format-ru": "ru"
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
"interval": 10,
|
||||
"format": "{}% ",
|
||||
"max-length": 10
|
||||
},
|
||||
|
||||
"memory": {
|
||||
"interval": 30,
|
||||
"format": "{}% ",
|
||||
"max-length": 10
|
||||
},
|
||||
|
||||
"custom/menu": {
|
||||
"format": "{icon}",
|
||||
"format-icons": " ",
|
||||
"on-click": "rofi -show drun -config ~/.config/rofi/rofi.rasi",
|
||||
"escape": true,
|
||||
"tooltip": false
|
||||
},
|
||||
|
||||
"custom/workspace": {
|
||||
"format": "{text}",
|
||||
"exec": "~/.config/waybar/ws.sh",
|
||||
"markup": true
|
||||
},
|
||||
|
||||
"user": {
|
||||
"format": "{work_d} ",
|
||||
"interval": 60,
|
||||
"height": 30,
|
||||
"width": 30,
|
||||
"icon": true
|
||||
}
|
||||
}
|
||||
76
old_rach/waybar/style.css
Normal file
76
old_rach/waybar/style.css
Normal file
@@ -0,0 +1,76 @@
|
||||
@define-color bg #282828;
|
||||
@define-color fg #ebdbb2;
|
||||
@define-color bg2 #373633;
|
||||
@define-color fg2 #32302f;
|
||||
|
||||
* {
|
||||
font-family: JetBrains Mono NF;
|
||||
font-size: 14;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
border-top: 2px solid @fg2;
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
background-color: @bg;
|
||||
border-radius: 10;
|
||||
margin: 0px 10px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
background-color: @bg;
|
||||
color: @fg;
|
||||
padding: 0px 8px 0px 3px;
|
||||
margin: 7px 0px;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
#workspaces button:hover,
|
||||
#workspaces button.active {
|
||||
color: @fg;
|
||||
padding: 0px 8px 0px 3px;
|
||||
margin: 8px 0px;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.modules-right {
|
||||
padding: 2px 0px;
|
||||
margin: 6px 0px;
|
||||
}
|
||||
|
||||
#language {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 5px;
|
||||
background-color: @bg2;
|
||||
border-top: 2px solid @fg2;
|
||||
border-bottom: 2px solid @fg2;
|
||||
border-left: 2px solid @fg2;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
margin: 0px 5px 0px 0px;
|
||||
padding: 0px 5px;
|
||||
background-color: @bg2;
|
||||
border-top: 2px solid @fg2;
|
||||
border-bottom: 2px solid @fg2;
|
||||
border-right: 2px solid @fg2;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
|
||||
|
||||
#clock {
|
||||
background: @fg;
|
||||
color: @bg;
|
||||
border-radius: 6px;
|
||||
margin: 2px 10px 2px 5px;
|
||||
padding: 0px 4px;
|
||||
}
|
||||
|
||||
#user {
|
||||
margin: 0px 5px;
|
||||
}
|
||||
114
old_rach/waybar/waybar-wttr.py
Normal file
114
old_rach/waybar/waybar-wttr.py
Normal file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
WEATHER_CODES = {
|
||||
'113': '☀️',
|
||||
'116': '⛅️',
|
||||
'119': '☁️',
|
||||
'122': '☁️',
|
||||
'143': '🌫',
|
||||
'176': '🌦',
|
||||
'179': '🌧',
|
||||
'182': '🌧',
|
||||
'185': '🌧',
|
||||
'200': '⛈',
|
||||
'227': '🌨',
|
||||
'230': '❄️',
|
||||
'248': '🌫',
|
||||
'260': '🌫',
|
||||
'263': '🌦',
|
||||
'266': '🌦',
|
||||
'281': '🌧',
|
||||
'284': '🌧',
|
||||
'293': '🌦',
|
||||
'296': '🌦',
|
||||
'299': '🌧',
|
||||
'302': '🌧',
|
||||
'305': '🌧',
|
||||
'308': '🌧',
|
||||
'311': '🌧',
|
||||
'314': '🌧',
|
||||
'317': '🌧',
|
||||
'320': '🌨',
|
||||
'323': '🌨',
|
||||
'326': '🌨',
|
||||
'329': '❄️',
|
||||
'332': '❄️',
|
||||
'335': '❄️',
|
||||
'338': '❄️',
|
||||
'350': '🌧',
|
||||
'353': '🌦',
|
||||
'356': '🌧',
|
||||
'359': '🌧',
|
||||
'362': '🌧',
|
||||
'365': '🌧',
|
||||
'368': '🌨',
|
||||
'371': '❄️',
|
||||
'374': '🌧',
|
||||
'377': '🌧',
|
||||
'386': '⛈',
|
||||
'389': '🌩',
|
||||
'392': '⛈',
|
||||
'395': '❄️'
|
||||
}
|
||||
|
||||
data = {}
|
||||
|
||||
|
||||
weather = requests.get("https://wttr.in/?format=j1").json()
|
||||
|
||||
|
||||
def format_time(time):
|
||||
return time.replace("00", "").zfill(2)
|
||||
|
||||
|
||||
def format_temp(temp):
|
||||
return (hour['FeelsLikeC']+"°").ljust(3)
|
||||
|
||||
|
||||
def format_chances(hour):
|
||||
chances = {
|
||||
"chanceoffog": "Fog",
|
||||
"chanceoffrost": "Frost",
|
||||
"chanceofovercast": "Overcast",
|
||||
"chanceofrain": "Rain",
|
||||
"chanceofsnow": "Snow",
|
||||
"chanceofsunshine": "Sunshine",
|
||||
"chanceofthunder": "Thunder",
|
||||
"chanceofwindy": "Wind"
|
||||
}
|
||||
|
||||
conditions = []
|
||||
for event in chances.keys():
|
||||
if int(hour[event]) > 0:
|
||||
conditions.append(chances[event]+" "+hour[event]+"%")
|
||||
return ", ".join(conditions)
|
||||
|
||||
|
||||
data['text'] = WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
|
||||
" "+weather['current_condition'][0]['FeelsLikeC']+"°"
|
||||
|
||||
data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n"
|
||||
data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n"
|
||||
data['tooltip'] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n"
|
||||
data['tooltip'] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n"
|
||||
for i, day in enumerate(weather['weather']):
|
||||
data['tooltip'] += f"\n<b>"
|
||||
if i == 0:
|
||||
data['tooltip'] += "Today, "
|
||||
if i == 1:
|
||||
data['tooltip'] += "Tomorrow, "
|
||||
data['tooltip'] += f"{day['date']}</b>\n"
|
||||
data['tooltip'] += f"⬆️ {day['maxtempC']}° ⬇️ {day['mintempC']}° "
|
||||
data['tooltip'] += f"🌅 {day['astronomy'][0]['sunrise']} 🌇 {day['astronomy'][0]['sunset']}\n"
|
||||
for hour in day['hourly']:
|
||||
if i == 0:
|
||||
if int(format_time(hour['time'])) < datetime.now().hour-2:
|
||||
continue
|
||||
data['tooltip'] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
|
||||
|
||||
|
||||
print(json.dumps(data))
|
||||
47
old_rach/waybar/ws.sh
Executable file
47
old_rach/waybar/ws.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
#c_ws=$( hyprctl activeworkspace | grep "workspace ID" | awk '{print $3}' | head -1)
|
||||
#l_ws=""
|
||||
|
||||
#while true; do
|
||||
# if [[ "$c_ws" != "$l_ws" ]]; then
|
||||
# echo $c_ws
|
||||
# l_ws=$c_ws
|
||||
# fi
|
||||
#done
|
||||
|
||||
#prev_value_ws=""
|
||||
#while true; do
|
||||
# current_value_ws=$(hyprctl activeworkspace | grep "workspace ID" | awk '{print $3}' | head -1)
|
||||
# if [[ "$current_value_ws" != "$prev_value_ws" ]]; then
|
||||
# echo "$current_value_ws"
|
||||
# prev_value_ws="$current_value_ws"
|
||||
# fi
|
||||
#done
|
||||
|
||||
#prev_value_tl=""
|
||||
#while true; do
|
||||
# current_value_tl=$(hyprctl activewindow | grep title | awk 'NR == 2' | awk '{print $2}')
|
||||
# if [[ "$current_value_tl" != "$prev_value_tl" ]]; then
|
||||
# echo "$current_value_tl"
|
||||
# prev_value_ws="$current_value_tl"
|
||||
# fi
|
||||
#done
|
||||
|
||||
|
||||
prev_ws=""
|
||||
prev_tl=""
|
||||
output_file="/home/fox/.cache/waybar_output"
|
||||
|
||||
while true; do
|
||||
current_ws=$(hyprctl activeworkspace | grep "workspace ID" | awk '{print $3}' | head -n1)
|
||||
current_tl=$(hyprctl activewindow | grep -A1 "title" | tail -n1 | awk '{$1=""; print substr($0, 2)}')
|
||||
|
||||
if [[ "$current_ws" != "$prev_ws" || "$current_tl" != "$prev_tl" ]]; then
|
||||
echo "$current_ws"
|
||||
echo "$current_tl"
|
||||
prev_ws="$current_ws"
|
||||
prev_tl="$current_tl"
|
||||
fi
|
||||
|
||||
sleep 0.1
|
||||
done
|
||||
Reference in New Issue
Block a user