Added waybar

This commit is contained in:
Trianta 2024-01-16 18:33:53 -06:00
parent f0e13819fb
commit 1a39ddde49
7 changed files with 321 additions and 0 deletions

View File

@ -6,3 +6,6 @@ echo "Syncing dotfiles with hypr..."
rsync --recursive ~/.config/hypr $(dirname "$0") rsync --recursive ~/.config/hypr $(dirname "$0")
echo "Syncing dotfiles with nvim..." echo "Syncing dotfiles with nvim..."
rsync --recursive ~/.config/nvim $(dirname "$0") rsync --recursive ~/.config/nvim $(dirname "$0")
echo "Syncing dotfiles with waybar..."
rsync --recursive ~/.config/waybar $(dirname "$0")
echo "Syncing complete!"

125
waybar/config.json Executable file
View File

@ -0,0 +1,125 @@
[
{
"name": "main",
"layer": "top",
"position": "top",
"height": 34,
"spacing": 4,
"margin-top": 10,
"margin-bottom": 0,
"output": "DP-2",
"modules-left": [
"wireplumber",
"disk",
"memory",
"cpu",
"temperature"
],
"modules-center": ["wlr/taskbar"],
"modules-right": [
"hyprland/workspaces",
"tray",
"custom/weather",
"network#ethernet",
"clock",
"custom/poweroff"
],
"clock": {
"interval": 1,
"format": "<b>{:%H:%M:%S}</b>",
"format-alt": "{:%Y-%m-%d}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
},
"cpu": {
"format": " {usage}%",
"tooltip": false
},
"disk": {
"format": " {}%",
"tooltip-format": "{used} / {total} used"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"memory": {
"format": " {}%",
"tooltip-format": "{used:0.1f}G / {total:0.1f}G used"
},
"temperature": {
"critical-threshold": 80,
"format": " {icon} {temperatureC}°C ",
"format-icons": ["", "", "", "", ""],
"hwmon-path": "/sys/class/thermal/thermal_zone2/temp"
},
"network#ethernet": {
"interface": "enp*",
"format-ethernet": "",
"format-wifi": "",
"format-linked": "",
"format-disconnected": "",
"tooltip-format": "{ifname}: {ipaddr}/{cidr}",
"on-click": "nm-connection-editor"
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"hyprland/workspaces": {
"format": "{name}",
"sort-by-number": true,
"all-outputs": true
},
"wlr/taskbar": {
"format": "{name}",
"icon-size": 32,
"tooltip": false,
"on-click": "activate",
"on-click-right": "close",
"all-outputs": true,
"ignore-list": [
"xwaylandvideobridge"
],
"rewrite": {
"(.*)Firefox Web Browser": "",
"(.*)Discord": "",
"(.*)Alacritty": "",
"Steam(.*)": "",
"(.*)Spotify": ""
}
},
"wireplumber": {
"format": " {volume}%",
"format-muted": " 0%",
"on-click": "pavucontrol",
"on-click-right": "helvum",
"max-volume": 100,
"scroll-step": 5
},
"tray": {
"icon-size": 21,
"spacing": 10
},
"custom/spotify": {
"interval": 1,
"return-type": "json",
"exec": "~/.config/waybar/scripts/spotify.sh",
"exec-if": "pgrep spotify",
"escape": true
},
"custom/poweroff": {
"tooltip": false,
"format": " ",
"on-click": "bash $HOME/.config/waybar/scripts/poweroff.sh"
},
"custom/weather": {
"exec": "$HOME/.config/waybar/scripts/get_weather.sh Belleville+Illinois",
"return-type": "json",
"format": "{}",
"tooltip": true,
"interval": 3600
}
}
]

37
waybar/mocha.css Executable file
View File

@ -0,0 +1,37 @@
/*
*
* Catppuccin Mocha palette
* Maintainer: rubyowo
*
*/
@define-color base #1e1e2e;
@define-color mantle #181825;
@define-color crust #11111b;
@define-color text #cdd6f4;
@define-color subtext0 #a6adc8;
@define-color subtext1 #bac2de;
@define-color surface0 #313244;
@define-color surface1 #45475a;
@define-color surface2 #585b70;
@define-color overlay0 #6c7086;
@define-color overlay1 #7f849c;
@define-color overlay2 #9399b2;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color sapphire #74c7ec;
@define-color sky #89dceb;
@define-color teal #94e2d5;
@define-color green #a6e3a1;
@define-color yellow #f9e2af;
@define-color peach #fab387;
@define-color maroon #eba0ac;
@define-color red #f38ba8;
@define-color mauve #cba6f7;
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;

19
waybar/scripts/get_weather.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# get_weather.sh
for i in {1..5}
do
text=$(curl -s "https://wttr.in/$1?format=1")
if [[ $? == 0 ]]
then
text=$(echo "$text" | sed -E "s/\s+/ /g")
tooltip=$(curl -s "https://wttr.in/$1?format=4")
if [[ $? == 0 ]]
then
tooltip=$(echo "$tooltip" | sed -E "s/\s+/ /g")
echo "{\"text\":\"$text\", \"tooltip\":\"$tooltip\"}"
exit
fi
fi
sleep 2
done
echo "{\"text\":\"error\", \"tooltip\":\"error\"}"

27
waybar/scripts/poweroff.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
case $(wofi -d -L 6 -l 3 -W 100 -x -100 -y 10 \
-D dynamic_lines=true << EOF | sed 's/^ *//'
Shutdown
Reboot
Log off
Sleep
Lock
Cancel
EOF
) in
"Shutdown")
systemctl poweroff
;;
"Reboot")
systemctl reboot
;;
"Sleep")
systemctl suspend
;;
"Lock")
loginctl lock-session
;;
"Log off")
hyprctl dispatch exit
;;
esac

18
waybar/scripts/spotify.sh Executable file
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"\"}"

92
waybar/style.css Executable file
View File

@ -0,0 +1,92 @@
@import "mocha.css";
* {
border: none;
border-radius: 0px;
min-height: 0;
font-size: 15px;
font-family: "Hack Nerd Font";
/*background: @base;*/
}
window#waybar {
background-color: transparent;
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces button {
border-radius: 20px;
}
#workspaces button:hover {
color: black;
border-bottom: 3px solid #ffffff;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
/* Sections */
.modules-left,
.modules-center,
.modules-right {
border-radius: 20px;
border: 3px solid @crust;
padding: 0 10px;
}
#clock,
#cpu,
#disk,
#memory,
#network,
#temperature,
#taskbar,
#tray,
#workspaces,
#wireplumber,
#custom-poweroff,
#custom-weather,
#custom-spotify {
padding: 0 10px;
}
.modules-left {
background-image: linear-gradient(90deg, @base, @surface0, @surface2);
}
.modules-center {
background-image: linear-gradient(270deg, @base, @overlay2, @base);
}
.modules-right {
background-image: linear-gradient(270deg, @base, @surface0, @surface2);
}
#wireplumber{
color: @sapphire;
}
#disk {
color: @peach;
}
#memory {
color: @teal;
}
#cpu {
color: @lavender;
}
#temperature {
color: @sky;
}
#taskbar button {
color: @rosewater;
}