Waybar first layout

This commit is contained in:
2025-11-27 19:44:25 +01:00
parent fbf694a688
commit 907ee8cb4f
14 changed files with 652 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
{
"layer": "top",
// Using margin-bottom with a negative value in order to reduce the space between Hyprland window and waybar
"margin-bottom": 0,
"margin-top": 0,
"modules-left": ["custom/launcher", "cpu","memory", "network","custom/spotify", "tray"],
"modules-center": ["hyprland/workspaces"],
"modules-right": ["backlight","pulseaudio","clock", "battery", "custom/power"],
"pulseaudio": {
"tooltip": false,
"scroll-step": 5,
"format": "{icon} {volume}%",
"format-muted": "{icon} {volume}%",
"on-click":"pactl set-sink-mute @DEFAULT_SINK@ toggle",
"format-icons": {
"default": ["", "", ""]
}
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "",
"format-ethernet": "",
"tooltip-format": "{essid} ({signalStrength}%)",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"backlight": {
"tooltip": false,
"format": " {}%",
"interval":1,
"on-scroll-up": "light -A 5",
"on-scroll-down": "light -U 5"
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 20
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} {icon}",
"format-icons": ["", "", "", "", ""]
},
"tray":{
"icon-size":18,
"spacing": 10
},
"clock": {
"format": "{: %I:%M %p  %d/%m/%Y}"
},
"cpu": {
"interval": 15,
"format": " {}%",
"max-length": 10
},
"memory": {
"interval": 30,
"format": " {}%",
"max-length": 10
},
"custom/spotify": {
"interval": 1,
"return-type": "json",
"exec": "~/.config/waybar/scripts/spotify.sh",
"exec-if": "pgrep spotify",
"escape": true
},
"custom/launcher":{
"format": "\uef46",
"on-click": "rofi -show drun",
"on-click-right": "killall rofi"
},
"custom/power":{
"format": " ",
"on-click": "bash ~/.config/rofi/leave/leave.sh",
},
// The code following below is given in the great documentation for Waybar status bar under Useful Utilities in Hyprland wiki
"hyrpland/workspaces": {
"format": "{icon}",
"on-scroll-up": "hyprctl dispatch workspace e+1",
"on-scroll-down": "hyprctl dispatch workspace e-1",
"on-click": "activate"
}
}

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,79 @@
#!/bin/bash
cachedir=~/.cache/rbn
cachefile=${0##*/}-$1
if [ ! -d $cachedir ]; then
mkdir -p $cachedir
fi
if [ ! -f $cachedir/$cachefile ]; then
touch $cachedir/$cachefile
fi
# Save current IFS
SAVEIFS=$IFS
# Change IFS to new line.
IFS=$'\n'
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1))
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
fi
weather=($(cat $cachedir/$cachefile))
# Restore IFSClear
IFS=$SAVEIFS
temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g')
#echo ${weather[1]##*,}
# https://fontawesome.com/icons?s=solid&c=weather
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
"clear" | "sunny")
condition=""
;;
"partly cloudy")
condition=""
;;
"cloudy")
condition=""
;;
"overcast")
condition=""
;;
"mist" | "fog" | "freezing fog")
condition=""
;;
"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain")
condition=""
;;
"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower")
condition=""
;;
"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers")
condition=""
;;
"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers")
condition=""
;;
"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers")
condition=""
;;
"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
condition=""
;;
*)
condition=""
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
;;
esac
#echo $temp $condition
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"

View File

@@ -0,0 +1,24 @@
#!/bin/sh
mount="/"
warning=20
critical=10
df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical '
/\/.*/ {
text=$4
tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6
use=$5
exit 0
}
END {
class=""
gsub(/%$/,"",use)
if ((100 - use) < critical) {
class="critical"
} else if ((100 - use) < warning) {
class="warning"
}
print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}"
}
'

View File

@@ -0,0 +1,42 @@
#!/usr/bin/python
import os
import imaplib
import mailsecrets
def getmails(username, password, server):
imap = imaplib.IMAP4_SSL(server, 993)
imap.login(username, password)
imap.select('INBOX')
ustatus, uresponse = imap.uid('search', None, 'UNSEEN')
if ustatus == 'OK':
unread_msg_nums = uresponse[0].split()
else:
unread_msg_nums = []
fstatus, fresponse = imap.uid('search', None, 'FLAGGED')
if fstatus == 'OK':
flagged_msg_nums = fresponse[0].split()
else:
flagged_msg_nums = []
return [len(unread_msg_nums), len(flagged_msg_nums)]
ping = os.system("ping " + mailsecrets.server + " -c1 > /dev/null 2>&1")
if ping == 0:
mails = getmails(mailsecrets.username, mailsecrets.password, mailsecrets.server)
text = ''
alt = ''
if mails[0] > 0:
text = alt = str(mails[0])
if mails[1] > 0:
alt = str(mails[1]) + "  " + alt
else:
exit(1)
print('{"text":"' + text + '", "alt": "' + alt + '"}')
else:
exit(1)

View File

@@ -0,0 +1,18 @@
#!/bin/sh
class=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
icon=""
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
if [[ ${#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
fi
text=$info" "$icon
elif [[ $class == "paused" ]]; then
text=$icon
elif [[ $class == "stopped" ]]; then
text=""
fi
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"

Binary file not shown.

View File

@@ -0,0 +1,42 @@
#!/usr/bin/python
import os
import imaplib
import mailsecrets
def getmails(username, password, server):
imap = imaplib.IMAP4_SSL(server, 993)
imap.login(username, password)
imap.select('INBOX')
ustatus, uresponse = imap.uid('search', None, 'UNSEEN')
if ustatus == 'OK':
unread_msg_nums = uresponse[0].split()
else:
unread_msg_nums = []
fstatus, fresponse = imap.uid('search', None, 'FLAGGED')
if fstatus == 'OK':
flagged_msg_nums = fresponse[0].split()
else:
flagged_msg_nums = []
return [len(unread_msg_nums), len(flagged_msg_nums)]
ping = os.system("ping " + mailsecrets.server + " -c1 > /dev/null 2>&1")
if ping == 0:
mails = getmails(mailsecrets.username, mailsecrets.password, mailsecrets.server)
text = ''
alt = ''
if mails[0] > 0:
text = alt = str(mails[0])
if mails[1] > 0:
alt = str(mails[1]) + "" + alt
else:
exit(1)
print('{"text":"' + text + '", "alt": "' + alt + '"}')
else:
exit(1)

View File

@@ -0,0 +1,18 @@
#!/bin/sh
class=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
icon=""
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}')
if [[ ${#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
fi
text=$info" "$icon
elif [[ $class == "paused" ]]; then
text=$icon
elif [[ $class == "stopped" ]]; then
text=""
fi
echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}"

View File

@@ -0,0 +1,24 @@
#!/bin/sh
mount="/"
warning=20
critical=10
df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical '
/\/.*/ {
text=$4
tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6
use=$5
exit 0
}
END {
class=""
gsub(/%$/,"",use)
if ((100 - use) < critical) {
class="critical"
} else if ((100 - use) < warning) {
class="warning"
}
print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}"
}
'

View File

@@ -0,0 +1,79 @@
#!/bin/bash
cachedir=~/.cache/rbn
cachefile=${0##*/}-$1
if [ ! -d $cachedir ]; then
mkdir -p $cachedir
fi
if [ ! -f $cachedir/$cachefile ]; then
touch $cachedir/$cachefile
fi
# Save current IFS
SAVEIFS=$IFS
# Change IFS to new line.
IFS=$'\n'
cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1))
echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
fi
weather=($(cat $cachedir/$cachefile))
# Restore IFSClear
IFS=$SAVEIFS
temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g')
#echo ${weather[1]##*,}
# https://fontawesome.com/icons?s=solid&c=weather
case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
"clear" | "sunny")
condition=""
;;
"partly cloudy")
condition=""
;;
"cloudy")
condition=""
;;
"overcast")
condition=""
;;
"mist" | "fog" | "freezing fog")
condition=""
;;
"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain")
condition=""
;;
"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower")
condition=""
;;
"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers")
condition=""
;;
"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers")
condition=""
;;
"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers")
condition=""
;;
"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
condition=""
;;
*)
condition=""
echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
;;
esac
#echo $temp $condition
echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"

View File

@@ -0,0 +1,235 @@
* {
border: none;
border-radius: 10px;
font-family: "JetbrainsMono Nerd Font";
font-size: 12px;
min-height: 10px;
}
window#waybar {
background: transparent;
}
window#waybar.hidden {
opacity: 0.2;
}
#window {
margin-top: 6px;
padding-left: 10px;
padding-right: 10px;
border-radius: 10px;
transition: none;
color: transparent;
background: transparent;
}
#workspaces {
margin-top: 6px;
margin-left: 12px;
font-size: 4px;
margin-bottom: 0px;
border-radius: 10px;
background: #161320;
transition: none;
}
#workspaces button {
transition: none;
color: #444;
background: transparent;
font-size: 12px;
border-radius: 2px;
}
#workspaces button.occupied {
transition: none;
color: #f28fad;
background: transparent;
font-size: 4px;
}
#workspaces button.active {
color: #abe9b3;
}
#workspaces button:hover {
transition: none;
box-shadow: inherit;
text-shadow: inherit;
color: #fae3b0;
border-color: #e8a2af;
color: #e8a2af;
}
#workspaces button.active:hover {
color: #e8a2af;
}
#network {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 18px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #bd93f9;
}
#pulseaudio {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #1a1826;
background: #fae3b0;
}
#battery {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #b5e8e0;
}
#battery.charging,
#battery.plugged {
color: #161320;
background-color: #b5e8e0;
}
#battery.critical:not(.charging) {
background-color: #b5e8e0;
color: #161320;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes blink {
to {
background-color: #bf616a;
color: #b5e8e0;
}
}
#backlight {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #f8bd96;
}
#clock {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #abe9b3;
/*background: #1A1826;*/
}
#memory {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
margin-bottom: 0px;
padding-right: 10px;
border-radius: 10px;
transition: none;
color: #161320;
background: #ddb6f2;
}
#cpu {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
margin-bottom: 0px;
padding-right: 10px;
border-radius: 10px;
transition: none;
color: #161320;
background: #96cdfb;
}
#tray {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
margin-bottom: 0px;
padding-right: 10px;
border-radius: 10px;
transition: none;
color: #b5e8e0;
background: #161320;
}
#custom-launcher {
font-size: 24px;
margin-top: 6px;
margin-left: 8px;
padding-left: 8px;
padding-right: 15px;
border-radius: 10px;
transition: none;
color: #89dceb;
background: #161320;
}
#custom-power {
font-size: 20px;
margin-top: 6px;
margin-left: 8px;
margin-right: 8px;
padding-left: 10px;
padding-right: 5px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #f28fad;
}
#custom-wallpaper {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #c9cbff;
}
#custom-spotify {
margin-top: 6px;
margin-left: 8px;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0px;
border-radius: 10px;
transition: none;
color: #161320;
background: #f2cdcd;
}