This commit is contained in:
Yannick Reiß 2024-02-05 18:35:04 +01:00
commit ce05b9abc7
No known key found for this signature in database
GPG Key ID: 5A3AF456F0A0338C
7 changed files with 643 additions and 0 deletions

180
config.jsonc Normal file
View File

@ -0,0 +1,180 @@
{
"layer": "top",
"position": "top",
"mod": "dock",
"exclusive": true,
"passthrough": false,
"gtk-layer-shell": true,
"height": 50,
"modules-left": ["custom/launch_wofi","wlr/workspaces","cpu","memory","disk","hyprland/window"],
"modules-center": ["custom/lock_screen","custom/updates","clock","custom/power_btn"],
"modules-right": ["temperature","custom/power_profile","battery","backlight","pulseaudio","pulseaudio#microphone","tray","custom/weather","custom/light_dark"],
"hyprland/window": {
"format": "{}"
},
"custom/launch_wofi": {
"format": "",
"on-click": "pkill wofi; wofi -n",
"tooltip": false
},
"custom/lock_screen": {
"format": "",
"on-click": "sh -c '(sleep 0.5s; swaylock)' & disown",
"tooltip": false
},
"custom/light_dark": {
"format": "💡",
"on-click": "~/.config/waybar/scripts/baraction light",
"tooltip": false
},
"custom/power_btn": {
"format": "",
"on-click": "sh -c '(sleep 0.5s; wlogout --protocol layer-shell)' & disown",
"tooltip": false
},
"cpu": {
"interval": 10,
"format": " {usage}%",
"max-length": 10,
"on-click": "kitty --start-as=fullscreen --title btop sh -c 'btop'"
},
"disk": {
"interval": 30,
"format": "💾 {percentage_used}%",
"path": "/",
"tooltip": true,
"tooltip-format": "HDD - {used} used out of {total} on {path} ({percentage_used}%)",
"on-click": "kitty --start-as=fullscreen --title btop sh -c 'btop'"
},
"memory": {
"interval": 30,
"format": " {}%",
"max-length": 10,
"tooltip": true,
"tooltip-format": "Memory - {used:0.1f}GB used",
"on-click": "kitty --start-as=fullscreen --title btop sh -c 'btop'"
},
"custom/updates": {
"format": "{}",
"exec": "~/.config/waybar/scripts/update-sys",
"on-click": "~/.config/waybar/scripts/update-sys update",
"interval": 300,
"tooltip": true
},
"wlr/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"on-click": "activate",
"persistent_workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
"6": [],
"7": [],
"8": [],
"9": [],
"10": []
}
},
"custom/power_profile": {
//shows the current power profile and switches to next on click
"exec": "asusctl profile -p | sed s:'Active profile is'::",
"interval": 30,
"format": "💻{}",
"on-click": "asusctl profile -n; pkill -SIGRTMIN+8 waybar",
"signal": 8
},
"custom/weather": {
//shows the current weather and forecast
"tooltip" : true,
"format" : "{}",
"interval" : 30,
"exec" : "~/.config/waybar/scripts/waybar-wttr.py",
"return-type" : "json"
},
"tray": {
"icon-size": 18,
"spacing": 10
},
"clock": {
"format": "{:%H:%M %p}",
"tooltip": true,
"tooltip-format": "{: %A, %e %B %Y}"
},
"backlight": {
"device": "intel_backlight",
"format": "{icon} {percent}%",
"format-icons": ["○", "◐", "●"],
"on-scroll-up": "brightnessctl set 1%+",
"on-scroll-down": "brightnessctl set 1%-",
"min-length": 6
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 20
},
"format": "🔋 {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} 🔋",
"format-icons": ["", "", "", "", "", "", "", "", "", "", ""]
},
"pulseaudio": {
"format": "{icon} {volume}%",
"format-muted": "",
"on-click": "pamixer -t",
"on-click-right": "pavucontrol",
"on-scroll-up": "pamixer -i 5",
"on-scroll-down": "pamixer -d 5",
"scroll-step": 5,
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
}
},
"pulseaudio#microphone": {
"format": "{format_source}",
"format-source": " {volume}%",
"format-source-muted": "",
"on-click": "pamixer --default-source -t",
"on-click-right": "pavucontrol",
"on-scroll-up": "pamixer --default-source -i 5",
"on-scroll-down": "pamixer --default-source -d 5",
"scroll-step": 5
},
"temperature": {
"thermal-zone": 1,
"format": " {temperatureC}°C",
"critical-threshold": 80,
"format-critical": " {temperatureC}°C",
"on-click": "kitty --start-as=fullscreen --title btop sh -c 'btop'"
}
}

32
scripts/baraction Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# Check which waybar theme is set
THEMEIS=$(readlink -f ~/.config/waybar/style.css | cut -d '-' -f2)
#if the theme is not dark then we need to switch to it
if [ $THEMEIS != "dark.css" ]; then
SWITCHTO="-dark"
fi
#set the waybar theme
ln -sf ~/.config/waybar/style/style$SWITCHTO.css ~/.config/waybar/style.css
#set the wofi theme
ln -sf ~/.config/wofi/style/style$SWITCHTO.css ~/.config/wofi/style.css
#set the xfce theme
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita$SWITCHTO"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Adwaita$SWITCHTO"
#set the GTK theme
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita$SWITCHTO"
gsettings set org.gnome.desktop.interface icon-theme "Adwaita$SWITCHTO"
#change the background image and be cool about it ;)
swww img ~/.config/hypr/wallpaper$SWITCHTO.jpg --transition-fps 60 --transition-type wipe --transition-duration 2
#update the sddm image
ln -sf /usr/share/sddm/themes/sdt/Backgrounds/wallpaper$SWITCHTO.jpg /usr/share/sddm/themes/sdt/wallpaper.jpg
#restart the waybar
killall -SIGUSR2 waybar

41
scripts/update-sys Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Original script by @speltriao on GitHub
# https://github.com/speltriao/Pacman-Update-for-GNOME-Shell
# If the operating system is not Arch Linux, exit the script successfully
if [ ! -f /etc/arch-release ]; then
exit 0
fi
# Calculate updates for each service
AUR=$(yay -Qua | wc -l)
OFFICIAL=$(checkupdates | wc -l)
# Case/switch for each service updates
case $1 in
aur) echo " $AUR";;
official) echo " $OFFICIAL";;
esac
# If the parameter is "update", update all services
if [ "$1" = "update" ]; then
kitty --title update-sys sh -c 'yay -Syu'
fi
# If there aren't any parameters, return the total number of updates
if [ "$1" = "" ]; then
# Calculate total number of updates
COUNT=$((OFFICIAL+AUR))
# If there are updates, the script will output the following:  Updates
# If there are no updates, the script will output nothing.
if [[ "$COUNT" = "0" ]]
then
echo ""
else
# This Update symbol is RTL. So ‭ is left-to-right override.
echo " $COUNT"
fi
exit 0
fi

119
scripts/waybar-wttr.py Executable file
View File

@ -0,0 +1,119 @@
#!/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)
tempint = int(weather['current_condition'][0]['FeelsLikeC'])
extrachar = ''
if tempint > 0 and tempint < 10:
extrachar = '+'
data['text'] = ''+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
" "+extrachar+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))

1
style.css Symbolic link
View File

@ -0,0 +1 @@
/home/nick/.config/waybar/style/style-dark.css

135
style/style-dark.css Normal file
View File

@ -0,0 +1,135 @@
* {
border: none;
border-radius: 0;
font-family: "JetBrainsMono Nerd Font";
font-weight: bold;
font-size: 14px;
min-height: 0;
}
window#waybar {
background: rgba(21, 18, 27, 0);
color: #cdd6f4;
}
tooltip {
background: #1e1e2e;
opacity: 0.8;
border-radius: 10px;
border-width: 2px;
border-style: solid;
border-color: #11111b;
}
tooltip label{
color: #cdd6f4;
}
#workspaces button {
padding: 5px;
color: #313244;
margin-right: 5px;
}
#workspaces button.active {
color: #a6adc8;
}
#workspaces button.focused {
color: #a6adc8;
background: #eba0ac;
border-radius: 10px;
}
#workspaces button.urgent {
color: #11111b;
background: #a6e3a1;
border-radius: 10px;
}
#workspaces button:hover {
background: #11111b;
color: #cdd6f4;
border-radius: 10px;
}
#custom-launch_wofi,
#custom-lock_screen,
#custom-light_dark,
#custom-power_btn,
#custom-power_profile,
#custom-weather,
#window,
#cpu,
#disk,
#custom-updates,
#memory,
#clock,
#battery,
#pulseaudio,
#network,
#tray,
#temperature,
#workspaces,
#backlight {
background: #1e1e2e;
opacity: 0.8;
padding: 0px 10px;
margin: 3px 0px;
margin-top: 10px;
border: 0px;
}
#tray, #custom-lock_screen, #temperature, #backlight, #custom-launch_wofi, #cpu {
border-radius: 10px 0px 0px 10px;
}
#custom-light_dark, #custom-power_btn, #workspaces, #pulseaudio.microphone, #battery, #disk {
border-radius: 0px 10px 10px 0px;
margin-right: 10px;
}
#temperature.critical {
color: #e92d4d;
}
#workspaces {
padding-right: 0px;
padding-left: 5px;
}
#custom-power_profile {
color: #a6e3a1;
border-left: 0px;
border-right: 0px;
}
#window {
border-radius: 10px;
margin-left: 20px;
margin-right: 20px;
}
#custom-launch_wofi {
color: #89b4fa;
margin-left: 10px;
border-right: 0px;
}
#pulseaudio {
color: #89b4fa;
border-left: 0px;
border-right: 0px;
}
#pulseaudio.microphone {
color: #cba6f7;
border-left: 0px;
border-right: 0px;
}
#battery {
color: #a6e3a1;
border-left: 0px;
}

135
style/style.css Normal file
View File

@ -0,0 +1,135 @@
* {
border: none;
border-radius: 0;
font-family: "JetBrainsMono Nerd Font";
font-weight: bold;
font-size: 16px;
min-height: 0;
}
window#waybar {
background: rgba(21, 18, 27, 0);
color: #2b2b2c;
}
tooltip {
background: #e7e7ec;;
opacity: 0.8;
border-radius: 10px;
border-width: 2px;
border-style: solid;
border-color: #11111b;
}
tooltip label{
color: #2b2b2c;
}
#workspaces button {
padding: 5px;
color: #313244;
margin-right: 5px;
}
#workspaces button.active {
color: #a6adc8;
}
#workspaces button.focused {
color: #a6adc8;
background: #eba0ac;
border-radius: 10px;
}
#workspaces button.urgent {
color: #11111b;
background: #a6e3a1;
border-radius: 10px;
}
#workspaces button:hover {
background: #11111b;
color: #cdd6f4;
border-radius: 10px;
}
#custom-launch_wofi,
#custom-lock_screen,
#custom-light_dark,
#custom-power_btn,
#custom-power_profile,
#custom-weather,
#window,
#cpu,
#disk,
#custom-updates,
#memory,
#clock,
#battery,
#pulseaudio,
#network,
#tray,
#temperature,
#workspaces,
#backlight {
background: #e7e7ec;
opacity: 0.8;
padding: 0px 10px;
margin: 3px 0px;
margin-top: 10px;
border: 0px;
}
#tray, #custom-lock_screen, #temperature, #backlight, #custom-launch_wofi, #cpu {
border-radius: 10px 0px 0px 10px;
}
#custom-light_dark, #custom-power_btn, #workspaces, #pulseaudio.microphone, #battery, #disk{
border-radius: 0px 10px 10px 0px;
margin-right: 10px;
}
#temperature.critical {
color: #e92d4d;
}
#workspaces {
padding-right: 0px;
padding-left: 5px;
}
#custom-power_profile {
color: #1d7715;
border-left: 0px;
border-right: 0px;
}
#window {
border-radius: 10px;
margin-left: 20px;
margin-right: 20px;
}
#custom-launch_wofi {
color: #407cdd;
margin-left: 10px;
border-right: 0px;
}
#pulseaudio {
color: #407cdd;
border-left: 0px;
border-right: 0px;
}
#pulseaudio.microphone {
color: #ad6bfd;
border-left: 0px;
border-right: 0px;
}
#battery {
color: #1d7715;
border-left: 0px;
}