From 907ee8cb4f3085dbd97b6138139191d1992b48ae Mon Sep 17 00:00:00 2001 From: Patrick Fraley Date: Thu, 27 Nov 2025 19:44:25 +0100 Subject: [PATCH] Waybar first layout --- waybar/.config/waybar/config | 89 +++++++ waybar/.config/waybar/scripts/.svn/entries | 1 + waybar/.config/waybar/scripts/.svn/format | 1 + ...840c986ed4a31eb635879fb5acd7fe1e8.svn-base | 79 ++++++ ...17b70d6c5f7ad57f42186fa340118f800.svn-base | 24 ++ ...9f25cbbc3801c1d2c85c4c63a6267bc9a.svn-base | 42 ++++ ...de716bb78d2787a984181ecf7090ba656.svn-base | 18 ++ waybar/.config/waybar/scripts/.svn/wc.db | Bin 0 -> 122880 bytes .../.config/waybar/scripts/.svn/wc.db-journal | 0 waybar/.config/waybar/scripts/mail.py | 42 ++++ waybar/.config/waybar/scripts/spotify.sh | 18 ++ waybar/.config/waybar/scripts/storage.sh | 24 ++ waybar/.config/waybar/scripts/weather.sh | 79 ++++++ waybar/.config/waybar/style.css | 235 ++++++++++++++++++ 14 files changed, 652 insertions(+) create mode 100644 waybar/.config/waybar/config create mode 100644 waybar/.config/waybar/scripts/.svn/entries create mode 100644 waybar/.config/waybar/scripts/.svn/format create mode 100644 waybar/.config/waybar/scripts/.svn/pristine/2e/2e39186840c986ed4a31eb635879fb5acd7fe1e8.svn-base create mode 100644 waybar/.config/waybar/scripts/.svn/pristine/4f/4f3769717b70d6c5f7ad57f42186fa340118f800.svn-base create mode 100644 waybar/.config/waybar/scripts/.svn/pristine/72/72a9c879f25cbbc3801c1d2c85c4c63a6267bc9a.svn-base create mode 100644 waybar/.config/waybar/scripts/.svn/pristine/cf/cfe11b6de716bb78d2787a984181ecf7090ba656.svn-base create mode 100644 waybar/.config/waybar/scripts/.svn/wc.db create mode 100644 waybar/.config/waybar/scripts/.svn/wc.db-journal create mode 100755 waybar/.config/waybar/scripts/mail.py create mode 100755 waybar/.config/waybar/scripts/spotify.sh create mode 100755 waybar/.config/waybar/scripts/storage.sh create mode 100755 waybar/.config/waybar/scripts/weather.sh create mode 100644 waybar/.config/waybar/style.css diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config new file mode 100644 index 0000000..ac75668 --- /dev/null +++ b/waybar/.config/waybar/config @@ -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" + } +} diff --git a/waybar/.config/waybar/scripts/.svn/entries b/waybar/.config/waybar/scripts/.svn/entries new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/entries @@ -0,0 +1 @@ +12 diff --git a/waybar/.config/waybar/scripts/.svn/format b/waybar/.config/waybar/scripts/.svn/format new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/format @@ -0,0 +1 @@ +12 diff --git a/waybar/.config/waybar/scripts/.svn/pristine/2e/2e39186840c986ed4a31eb635879fb5acd7fe1e8.svn-base b/waybar/.config/waybar/scripts/.svn/pristine/2e/2e39186840c986ed4a31eb635879fb5acd7fe1e8.svn-base new file mode 100644 index 0000000..303e938 --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/pristine/2e/2e39186840c986ed4a31eb635879fb5acd7fe1e8.svn-base @@ -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]}"\"}" diff --git a/waybar/.config/waybar/scripts/.svn/pristine/4f/4f3769717b70d6c5f7ad57f42186fa340118f800.svn-base b/waybar/.config/waybar/scripts/.svn/pristine/4f/4f3769717b70d6c5f7ad57f42186fa340118f800.svn-base new file mode 100644 index 0000000..ae2a5ce --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/pristine/4f/4f3769717b70d6c5f7ad57f42186fa340118f800.svn-base @@ -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"\"}" +} +' diff --git a/waybar/.config/waybar/scripts/.svn/pristine/72/72a9c879f25cbbc3801c1d2c85c4c63a6267bc9a.svn-base b/waybar/.config/waybar/scripts/.svn/pristine/72/72a9c879f25cbbc3801c1d2c85c4c63a6267bc9a.svn-base new file mode 100644 index 0000000..abc36ec --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/pristine/72/72a9c879f25cbbc3801c1d2c85c4c63a6267bc9a.svn-base @@ -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) diff --git a/waybar/.config/waybar/scripts/.svn/pristine/cf/cfe11b6de716bb78d2787a984181ecf7090ba656.svn-base b/waybar/.config/waybar/scripts/.svn/pristine/cf/cfe11b6de716bb78d2787a984181ecf7090ba656.svn-base new file mode 100644 index 0000000..c00622b --- /dev/null +++ b/waybar/.config/waybar/scripts/.svn/pristine/cf/cfe11b6de716bb78d2787a984181ecf7090ba656.svn-base @@ -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"\"}" diff --git a/waybar/.config/waybar/scripts/.svn/wc.db b/waybar/.config/waybar/scripts/.svn/wc.db new file mode 100644 index 0000000000000000000000000000000000000000..b6b0262b4fffd161e4c5b8a8d8e080f8ce144010 GIT binary patch literal 122880 zcmeI)TWlQHVFutC?u|>D96Am)rWu*TN~yS(MDFZucI^uGiX6#XQCykiniAq*FjsM{ z#?0z$f=1?kPWQj!yzLhiVGw`-1Rwwb2tWV=5P$##AOHaf zJQ{%sZiFPva(}^)|M7wV1Rwwb2tWV=5P$##AOHafK;UT-sIhUT-dOMVH+!$o&E0JF z*SEA;y|Xdb)!NP8oYCo9&6e5A>t#{2boG2r*VOa*yqZ5RSyukMZWbj?GBioEtRYe_ zmirMy{>KXf5P$##AOHafKmY;|fB*y_0D)&u;B>5>K5~tKe*Pche#mhD$^DqT;ROK* zKmY;|fB*y_009U<00Izzz%wH-8jDS{YxU(T$~z6YA;;4Lv5EBB{Bpg%I>N@L)64R; z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config/waybar/scripts/.svn/wc.db-journal b/waybar/.config/waybar/scripts/.svn/wc.db-journal new file mode 100644 index 0000000..e69de29 diff --git a/waybar/.config/waybar/scripts/mail.py b/waybar/.config/waybar/scripts/mail.py new file mode 100755 index 0000000..abc36ec --- /dev/null +++ b/waybar/.config/waybar/scripts/mail.py @@ -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) diff --git a/waybar/.config/waybar/scripts/spotify.sh b/waybar/.config/waybar/scripts/spotify.sh new file mode 100755 index 0000000..c00622b --- /dev/null +++ b/waybar/.config/waybar/scripts/spotify.sh @@ -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"\"}" diff --git a/waybar/.config/waybar/scripts/storage.sh b/waybar/.config/waybar/scripts/storage.sh new file mode 100755 index 0000000..ae2a5ce --- /dev/null +++ b/waybar/.config/waybar/scripts/storage.sh @@ -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"\"}" +} +' diff --git a/waybar/.config/waybar/scripts/weather.sh b/waybar/.config/waybar/scripts/weather.sh new file mode 100755 index 0000000..303e938 --- /dev/null +++ b/waybar/.config/waybar/scripts/weather.sh @@ -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]}"\"}" diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css new file mode 100644 index 0000000..487ef91 --- /dev/null +++ b/waybar/.config/waybar/style.css @@ -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; +}