initial
This commit is contained in:
182
.config/waybar/config
Normal file
182
.config/waybar/config
Normal file
@ -0,0 +1,182 @@
|
||||
{
|
||||
"layer": "top", // Waybar at top layer
|
||||
"position": "bottom", // Waybar position (top|bottom|left|right)
|
||||
"margin-bottom": 0,
|
||||
"margin-left": 0,
|
||||
"margin-right": 0,
|
||||
"height": 10, // Waybar height (to be removed for auto height)
|
||||
// "width": 1280, // Waybar width
|
||||
"spacing": 10, // Gaps between modules (4px)
|
||||
// Choose the order of the modules
|
||||
"modules-left": [
|
||||
"hyprland/workspaces",
|
||||
],
|
||||
"modules-center": ["mpd"],
|
||||
"modules-right": [
|
||||
"hyprland/language",
|
||||
"pulseaudio",
|
||||
"cpu",
|
||||
"memory",
|
||||
"custom/weather",
|
||||
"clock",
|
||||
],
|
||||
"hyprland/language": {
|
||||
"format": "{}",
|
||||
"format-en": "en",
|
||||
"format-ru": "ru",
|
||||
"keyboard-name": "keychron-keychron-q1-keyboard"
|
||||
},
|
||||
// Modules configuration
|
||||
"custom/weather": {
|
||||
"exec": "$HOME/.config/waybar/weather-plugin.sh",
|
||||
"interval": 600,
|
||||
"signal": "8",
|
||||
},
|
||||
"hyprland/workspaces": {
|
||||
"format": "{name}",
|
||||
"tooltip": false,
|
||||
"on-click": "activate",
|
||||
"sort-by-number": true,
|
||||
"all-outputs": true,
|
||||
"disable-scroll": true,
|
||||
"show-special": true,
|
||||
"format-icons": {
|
||||
"active": "",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
"format": "{name} {icon}",
|
||||
"format-icons": {
|
||||
"locked": "",
|
||||
"unlocked": ""
|
||||
}
|
||||
},
|
||||
"mpd": {
|
||||
"on-click": "mpc toggle",
|
||||
"tooltip": false,
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {title}",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
|
||||
"unknown-tag": "N/A",
|
||||
"interval": 2,
|
||||
"consume-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"random-icons": {
|
||||
"off": "<span color=\"#f53c3c\"></span> ",
|
||||
"on": " "
|
||||
},
|
||||
"repeat-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"single-icons": {
|
||||
"on": "1 "
|
||||
},
|
||||
"state-icons": {
|
||||
"paused": "",
|
||||
"playing": ""
|
||||
},
|
||||
"max-length": 40,
|
||||
"tooltip-format": "MPD (connected)",
|
||||
"tooltip-format-disconnected": "MPD (disconnected)",
|
||||
},
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": "",
|
||||
"deactivated": ""
|
||||
}
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10
|
||||
},
|
||||
"clock": {
|
||||
// "timezone": "America/New_York",
|
||||
"format": "{:%a, %b %d %H:%M}",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"format-alt": "{:%Y-%m-%d}"
|
||||
},
|
||||
"cpu": {
|
||||
"format": "{usage}% ",
|
||||
"tooltip": false
|
||||
},
|
||||
"memory": {
|
||||
"format": "{}% "
|
||||
},
|
||||
"temperature": {
|
||||
// "thermal-zone": 2,
|
||||
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
// "format-critical": "{temperatureC}°C {icon}",
|
||||
"format": "{temperatureC}°C {icon}",
|
||||
"format-icons": ["", "", ""]
|
||||
},
|
||||
"backlight": {
|
||||
// "device": "acpi_video1",
|
||||
"format": "{percent}% {icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""]
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
// "good": 95,
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
// "format-good": "", // An empty format will hide the module
|
||||
// "format-full": "",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"battery#bat2": {
|
||||
"bat": "BAT2"
|
||||
},
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": "{essid} ({signalStrength}%) ",
|
||||
"format-ethernet": "{ipaddr}/{cidr} ",
|
||||
"tooltip-format": "{ifname} via {gwaddr} ",
|
||||
"format-linked": "{ifname} (No IP) ",
|
||||
"format-disconnected": "Disconnected ⚠",
|
||||
"format-alt": "{ifname}: {ipaddr}/{cidr}"
|
||||
},
|
||||
"pulseaudio": {
|
||||
"tooltip": false,
|
||||
// "scroll-step": 1, // %, can be a float
|
||||
//"format": "{volume}% {icon} {format_source}",
|
||||
"format": "{volume}% {icon}",
|
||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth-muted": " {icon} {format_source}",
|
||||
"format-muted": "",
|
||||
"format-source": "{volume}% ",
|
||||
"format-source-muted": "",
|
||||
"format-icons": {
|
||||
"headphone": "",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pavucontrol"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"spotify": "",
|
||||
"default": "🎜"
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||
}
|
||||
}
|
||||
48
.config/waybar/style.css
Normal file
48
.config/waybar/style.css
Normal file
@ -0,0 +1,48 @@
|
||||
*, body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: 'Input Mono', 'Symbols Nerd Font Mono';
|
||||
font-size: 13px;
|
||||
min-height: 1.5em;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: rgba(0, 0, 0, 0.87);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
#workspaces button {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
border-bottom: 2px solid #05a4c4;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
#workspaces button.active {
|
||||
border-bottom: 2px solid white;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#backlight,
|
||||
#pulseaudio,
|
||||
#bluetooth,
|
||||
#network,
|
||||
#battery,
|
||||
#mpd,
|
||||
#cpu,
|
||||
#memory,
|
||||
#custom-weather,
|
||||
#language {
|
||||
border-bottom: 2px solid #05a4c4;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
288
.config/waybar/weather-plugin.sh
Executable file
288
.config/waybar/weather-plugin.sh
Executable file
@ -0,0 +1,288 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SETTINGS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
|
||||
# API settings ________________________________________________________________
|
||||
|
||||
APIKEY=`cat $HOME/.owm-key`
|
||||
CITY_NAME='Tyumen'
|
||||
COUNTRY_CODE='RUS'
|
||||
# Desired output language
|
||||
LANG="en"
|
||||
# UNITS can be "metric", "imperial" or "kelvin". Set KNOTS to "yes" if you
|
||||
# want the wind in knots:
|
||||
|
||||
# | temperature | wind
|
||||
# -----------------------------------
|
||||
# metric | Celsius | km/h
|
||||
# imperial | Fahrenheit | miles/hour
|
||||
# kelvin | Kelvin | km/h
|
||||
|
||||
UNITS="metric"
|
||||
|
||||
# Color Settings ______________________________________________________________
|
||||
|
||||
COLOR_CLOUD="#606060"
|
||||
COLOR_THUNDER="#d3b987"
|
||||
COLOR_LIGHT_RAIN="#73cef4"
|
||||
COLOR_HEAVY_RAIN="#b3deef"
|
||||
COLOR_SNOW="#FFFFFF"
|
||||
COLOR_FOG="#606060"
|
||||
COLOR_TORNADO="#d3b987"
|
||||
COLOR_SUN="#ffc24b"
|
||||
COLOR_MOON="#FFFFFF"
|
||||
COLOR_ERR="#f43753"
|
||||
COLOR_WIND="#73cef4"
|
||||
COLOR_COLD="#b3deef"
|
||||
COLOR_HOT="#f43753"
|
||||
COLOR_NORMAL_TEMP="#FFFFFF"
|
||||
|
||||
# Leave "" if you want the default polybar color
|
||||
COLOR_TEXT=""
|
||||
# Polybar settings ____________________________________________________________
|
||||
|
||||
# Font for the weather icons
|
||||
WEATHER_FONT_CODE=4
|
||||
|
||||
# Font for the thermometer icon
|
||||
TEMP_FONT_CODE=2
|
||||
|
||||
# Wind settings _______________________________________________________________
|
||||
|
||||
# Display info about the wind or not. yes/no
|
||||
DISPLAY_WIND="yes"
|
||||
|
||||
# Display in knots. yes/no
|
||||
KNOTS="no"
|
||||
|
||||
# How many decimals after the floating point
|
||||
DECIMALS=0
|
||||
|
||||
# Min. wind force required to display wind info (it depends on what
|
||||
# measurement unit you have set: knots, m/s or mph). Set to 0 if you always
|
||||
# want to display wind info. It's ignored if DISPLAY_WIND is false.
|
||||
|
||||
MIN_WIND=0
|
||||
|
||||
# Display the numeric wind force or not. If not, only the wind icon will
|
||||
# appear. yes/no
|
||||
|
||||
DISPLAY_FORCE="yes"
|
||||
|
||||
# Display the wind unit if wind force is displayed. yes/no
|
||||
DISPLAY_WIND_UNIT="yes"
|
||||
|
||||
# Thermometer settings ________________________________________________________
|
||||
|
||||
# When the thermometer icon turns red
|
||||
HOT_TEMP=25
|
||||
|
||||
# When the thermometer icon turns blue
|
||||
COLD_TEMP=0
|
||||
|
||||
# Other settings ______________________________________________________________
|
||||
|
||||
# Display the weather description. yes/no
|
||||
DISPLAY_LABEL="yes"
|
||||
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
if [ "$COLOR_TEXT" != "" ]; then
|
||||
COLOR_TEXT_BEGIN="%{F$COLOR_TEXT}"
|
||||
COLOR_TEXT_END="%{F-}"
|
||||
fi
|
||||
|
||||
RESPONSE=""
|
||||
ERROR=0
|
||||
ERR_MSG=""
|
||||
if [ $UNITS = "kelvin" ]; then
|
||||
UNIT_URL=""
|
||||
else
|
||||
UNIT_URL="&units=$UNITS"
|
||||
fi
|
||||
URL="api.openweathermap.org/data/2.5/weather?appid=$APIKEY$UNIT_URL&lang=$LANG&q=$CITY_NAME,$COUNTRY_CODE"
|
||||
|
||||
function getData {
|
||||
ERROR=0
|
||||
# For logging purposes
|
||||
# echo " " >> "$HOME/.weather.log"
|
||||
# echo `date`" ################################" >> "$HOME/.weather.log"
|
||||
RESPONSE=`curl -s $URL`
|
||||
if [ "$1" = "-d" ]; then
|
||||
echo $RESPONSE
|
||||
echo ""
|
||||
fi
|
||||
CODE="$?"
|
||||
# echo "Response: $RESPONSE" >> "$HOME/.weather.log"
|
||||
RESPONSECODE=0
|
||||
if [ $CODE -eq 0 ]; then
|
||||
RESPONSECODE=`echo $RESPONSE | jq .cod`
|
||||
fi
|
||||
if [ $CODE -ne 0 ] || [ $RESPONSECODE -ne 200 ]; then
|
||||
if [ $CODE -ne 0 ]; then
|
||||
ERR_MSG="curl Error $CODE"
|
||||
# echo "curl Error $CODE" >> "$HOME/.weather.log"
|
||||
else
|
||||
ERR_MSG="Conn. Err. $RESPONSECODE"
|
||||
# echo "API Error $RESPONSECODE" >> "$HOME/.weather.log"
|
||||
fi
|
||||
ERROR=1
|
||||
# else
|
||||
# echo "$RESPONSE" > "$HOME/.weather-last"
|
||||
# echo `date +%s` >> "$HOME/.weather-last"
|
||||
fi
|
||||
}
|
||||
function setIcons {
|
||||
if [ $WID -le 232 ]; then
|
||||
#Thunderstorm
|
||||
ICON_COLOR=$COLOR_THUNDER
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON=""
|
||||
else
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -le 311 ]; then
|
||||
#Light drizzle
|
||||
ICON_COLOR=$COLOR_LIGHT_RAIN
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON=""
|
||||
else
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -le 321 ]; then
|
||||
#Heavy drizzle
|
||||
ICON_COLOR=$COLOR_HEAVY_RAIN
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON=""
|
||||
else
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -le 531 ]; then
|
||||
#Rain
|
||||
ICON_COLOR=$COLOR_HEAVY_RAIN
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON=""
|
||||
else
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -le 622 ]; then
|
||||
#Snow
|
||||
ICON_COLOR=$COLOR_SNOW
|
||||
ICON=""
|
||||
elif [ $WID -le 771 ]; then
|
||||
#Fog
|
||||
ICON_COLOR=$COLOR_FOG
|
||||
ICON=""
|
||||
elif [ $WID -eq 781 ]; then
|
||||
#Tornado
|
||||
ICON_COLOR=$COLOR_TORNADO
|
||||
ICON=""
|
||||
elif [ $WID -eq 800 ]; then
|
||||
#Clear sky
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON_COLOR=$COLOR_SUN
|
||||
ICON=""
|
||||
else
|
||||
ICON_COLOR=$COLOR_MOON
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -eq 801 ]; then
|
||||
# Few clouds
|
||||
if [ $DATE -ge $SUNRISE -a $DATE -le $SUNSET ]; then
|
||||
ICON_COLOR=$COLOR_SUN
|
||||
ICON=""
|
||||
else
|
||||
ICON_COLOR=$COLOR_MOON
|
||||
ICON=""
|
||||
fi
|
||||
elif [ $WID -le 804 ]; then
|
||||
# Overcast
|
||||
ICON_COLOR=$COLOR_CLOUD
|
||||
ICON=""
|
||||
else
|
||||
ICON_COLOR=$COLOR_ERR
|
||||
ICON=""
|
||||
fi
|
||||
WIND=""
|
||||
WINDFORCE=`echo "$RESPONSE" | jq .wind.speed`
|
||||
if [ $KNOTS = "yes" ]; then
|
||||
case $UNITS in
|
||||
"imperial")
|
||||
# The division by one is necessary because scale works only for divisions. bc is stupid.
|
||||
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 0.8689762419 / 1" | bc`
|
||||
;;
|
||||
*)
|
||||
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 1.943844 / 1" | bc`
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if [ $UNITS != "imperial" ]; then
|
||||
# Conversion from m/s to km/h
|
||||
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE * 3.6 / 1" | bc`
|
||||
else
|
||||
WINDFORCE=`echo "scale=$DECIMALS;$WINDFORCE / 1" | bc`
|
||||
fi
|
||||
fi
|
||||
if [ "$DISPLAY_WIND" = "yes" ] && [ `echo "$WINDFORCE >= $MIN_WIND" |bc -l` -eq 1 ]; then
|
||||
WIND=""
|
||||
if [ $DISPLAY_FORCE = "yes" ]; then
|
||||
WIND="$WIND $COLOR_TEXT_BEGIN$WINDFORCE$COLOR_TEXT_END"
|
||||
if [ $DISPLAY_WIND_UNIT = "yes" ]; then
|
||||
if [ $KNOTS = "yes" ]; then
|
||||
WIND="$WIND ${COLOR_TEXT_BEGIN}kn$COLOR_TEXT_END"
|
||||
elif [ $UNITS = "imperial" ]; then
|
||||
WIND="$WIND ${COLOR_TEXT_BEGIN}mph$COLOR_TEXT_END"
|
||||
else
|
||||
WIND="$WIND ${COLOR_TEXT_BEGIN}km/h$COLOR_TEXT_END"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
WIND="$WIND |"
|
||||
fi
|
||||
if [ "$UNITS" = "metric" ]; then
|
||||
TEMP_ICON="糖"
|
||||
elif [ "$UNITS" = "imperial" ]; then
|
||||
TEMP_ICON="宅"
|
||||
else
|
||||
TEMP_ICON="洞"
|
||||
fi
|
||||
|
||||
TEMP=`echo "$TEMP" | cut -d "." -f 1`
|
||||
|
||||
if [ "$TEMP" -le $COLD_TEMP ]; then
|
||||
TEMP=" $COLOR_TEXT_BEGIN$TEMP$TEMP_ICON$COLOR_TEXT_END"
|
||||
elif [ `echo "$TEMP >= $HOT_TEMP" | bc` -eq 1 ]; then
|
||||
TEMP=" $COLOR_TEXT_BEGIN$TEMP$TEMP_ICON$COLOR_TEXT_END"
|
||||
else
|
||||
TEMP=" $COLOR_TEXT_BEGIN$TEMP$TEMP_ICON$COLOR_TEXT_END"
|
||||
fi
|
||||
}
|
||||
|
||||
function outputCompact {
|
||||
OUTPUT="$WIND $ICON $ERR_MSG$COLOR_TEXT_BEGIN$DESCRIPTION$COLOR_TEXT_END| $TEMP"
|
||||
# echo "Output: $OUTPUT" >> "$HOME/.weather.log"
|
||||
echo "$OUTPUT"
|
||||
}
|
||||
|
||||
getData $1
|
||||
if [ $ERROR -eq 0 ]; then
|
||||
MAIN=`echo $RESPONSE | jq .weather[0].main`
|
||||
WID=`echo $RESPONSE | jq .weather[0].id`
|
||||
DESC=`echo $RESPONSE | jq .weather[0].description`
|
||||
SUNRISE=`echo $RESPONSE | jq .sys.sunrise`
|
||||
SUNSET=`echo $RESPONSE | jq .sys.sunset`
|
||||
DATE=`date +%s`
|
||||
WIND=""
|
||||
TEMP=`echo $RESPONSE | jq .main.temp`
|
||||
if [ $DISPLAY_LABEL = "yes" ]; then
|
||||
DESCRIPTION=`echo "$RESPONSE" | jq .weather[0].description | tr -d '"' | sed 's/.*/\L&/; s/[a-z]*/\u&/g'`" "
|
||||
else
|
||||
DESCRIPTION=""
|
||||
fi
|
||||
PRESSURE=`echo $RESPONSE | jq .main.pressure`
|
||||
HUMIDITY=`echo $RESPONSE | jq .main.humidity`
|
||||
setIcons
|
||||
outputCompact
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
Reference in New Issue
Block a user