Add waybar config

This commit is contained in:
q3aql 2025-08-03 15:07:48 +02:00
parent b52b158c56
commit 737f8b1d3b
6 changed files with 99 additions and 240 deletions

View File

@ -1,143 +1,85 @@
{ {
// "layer": "top", // Waybar at top layer
"position": "top", // Waybar position (top|bottom|left|right) "position": "top", // Waybar position (top|bottom|left|right)
"height": 24, // Waybar height (to be removed for auto height) "height": 28, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width "modules-left": ["custom/desktop-icon", "sway/workspaces"],
// Choose the order of the modules "modules-right": ["custom/checkupdates", "custom/kernel", "custom/cpu", "custom/memory", "custom/getvolume", "sway/language", "custom/currentdate", "tray"],
// "modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
"modules-left": ["sway/workspaces"],
// "modules-center": ["sway/window"],
//"modules-right": ["pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "sway/language", "battery", "battery#bat2", "clock", "tray"],
//"modules-right": ["custom/kernel", "custom/cpu", "custom/memory", "custom/disk", "pulseaudio", "sway/language", "network", "custom/clock", "tray"],
"modules-right": ["custom/checkupdates", "custom/kernel", "custom/cpu", "custom/memory", "custom/getvolume", "sway/language", "custom/currentdate","tray"],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"sway/workspaces": { "sway/workspaces": {
"all-outputs": false, "all-outputs": false,
//"format": "{name}: {icon}", "format": "{icon}",
"format": "{name}", "icons-only": true,
"format-icons": { "format-icons": {
// "1": "", "1: ": " ",
// "2": "", "2:,": ",",
// "3": "", "3: ": " ",
// "4": "", "4: ": " ",
// "5": "", "5: ": " ",
"urgent": "", "6: ": " ",
"focused": "", "7: ": " ",
"default": "" "8: ": " ",
"9: ": " ",
"10: ": " ",
"11: ": " ",
"12: ": " ",
//"urgent": " ",
//"focused": " ",
"default": " ",
} }
}, },
"sway/mode": { "custom/desktop-icon": {
"format": "<span style=\"italic\">{}</span>" "format": "{}",
"interval": 10,
"exec": "~/.config/waybar/scripts/show_desktop_icon.sh",
}, },
"custom/kernel": { "custom/kernel": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 10, "interval": 10,
"exec": "~/.config/waybar/iscripts/kernel_version.sh", "exec": "~/.config/waybar/scripts/kernel_version.sh",
},
"custom/clock": {
"format": "{}",
//"max-length": 12,
"interval": 20,
"exec": "date '+%h %d, %H:%M'",
}, },
"custom/currentdate": { "custom/currentdate": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 2, "interval": 2,
"exec": "~/.config/waybar/iscripts/current_date.sh", "exec": "~/.config/waybar/scripts/current_date.sh",
}, },
"custom/getvolume": { "custom/getvolume": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 2, "interval": 2,
"exec": "~/.config/waybar/iscripts/get_volume.sh", "exec": "~/.config/waybar/scripts/get_volume.sh",
}, },
"custom/checkupdates": { "custom/checkupdates": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 1800, "interval": 1800,
"exec": "~/.config/waybar/iscripts/checkUpdates.sh", "exec": "~/.config/waybar/scripts/checkUpdates.sh",
}, },
"custom/cpu": { "custom/cpu": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 2, "interval": 2,
"exec": "~/.config/waybar/iscripts/cpu_info.sh", "exec": "~/.config/waybar/scripts/cpu_info.sh",
}, },
"custom/memory": { "custom/memory": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 5, "interval": 5,
"exec": "~/.config/waybar/iscripts/mem_info.sh", "exec": "~/.config/waybar/scripts/mem_info.sh",
}, },
"custom/disk": { "custom/disk": {
"format": "{}", "format": "{}",
//"max-length": 12,
"interval": 10, "interval": 10,
"exec": "~/.config/waybar/iscripts/disk_info.sh", "exec": "~/.config/waybar/scripts/disk_info.sh",
}, },
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": { "tray": {
// "icon-size": 21, // "icon-size": 21,
"spacing": 5 "spacing": 5
}, },
"clock": {
// "timezone": "America/New_York",
"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": { "battery": {
"states": { "states": {
// "good": 95, // "good": 95,
@ -151,48 +93,5 @@
// "format-good": "", // An empty format will hide the module // "format-good": "", // An empty format will hide the module
// "format-full": "", // "format-full": "",
"format-icons": ["", "", "", "", ""] "format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon}",
//"format": "{volume}% {icon} {format_source}",
//"format-bluetooth": "{volume}% {icon} {format_source}",
//"format-bluetooth-muted": " {icon} {format_source}",
//"format-muted": " {format_source}",
//"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
} }
} }

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Variables
checkupdates_file=/tmp/checkupdates
checkupdates_run="7200" # 2 hours
# checkupdates file init
if [ ! -f ${checkupdates_file} ] ; then
touch ${checkupdates_file}
echo "0" > ${checkupdates_file}
else
checkupdates_value=$(cat ${checkupdates_file})
checkupdates_incr=$(expr ${checkupdates_value} + 1)
echo "${checkupdates_incr}" > ${checkupdates_file}
fi
# Check updates on Arch Linux
checkupdate=$(cat ${checkupdates_file})
if [ -f /usr/bin/pacman ] ; then
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
sudo -A pacman -Syy > /dev/null 2>&1
echo "0" > ${checkupdates_file}
fi
num_packages=$(pacman -Qu | wc -l)
echo "${num_packages} "
# Check updates on Ubuntu/Debian/Devuan
elif [ -f /usr/bin/apt ] ; then
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
sudo -A apt-get update > /dev/null 2>&1
echo "0" > ${checkupdates_file}
fi
num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^)
num_packages=$(expr ${num_packages} - 1)
echo "${num_packages} "
# Disable for other distros
else
echo " 0 "
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
current_date=$(date "+%d/%m/%Y %H:%M")
echo "${current_date}"

View File

@ -0,0 +1,4 @@
#!/bin/bash
get_volume=$(amixer | grep "%" | head -1 | cut -d "%" -f 1 | cut -d "[" -f 2)
echo "${get_volume}% "

View File

@ -0,0 +1,3 @@
#!/bin/bash
echo " SWAY"

View File

@ -2,13 +2,13 @@
border: none; border: none;
border-radius: 0; border-radius: 0;
/* `otf-font-awesome` is required to be installed for icons */ /* `otf-font-awesome` is required to be installed for icons */
font-family: UbuntuMono Nerd Font, Noto Sans, Roboto, Helvetica, Arial, sans-serif; font-family: UbuntuMono Nerd Font, Noto Sans, sans-serif;
font-size: 15px; font-size: 15px;
min-height: 0; min-height: 0;
} }
window#waybar { window#waybar {
background-color: rgba(43, 48, 59, 1); background-color: #222133;
border-bottom: 1px solid rgba(100, 114, 125, 0.5); border-bottom: 1px solid rgba(100, 114, 125, 0.5);
color: #ffffff; color: #ffffff;
transition-property: background-color; transition-property: background-color;
@ -19,17 +19,8 @@ window#waybar.hidden {
opacity: 1; opacity: 1;
} }
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite { window#waybar.termite {
background-color: #3F3F3F; background-color: #222133;
} }
window#waybar.chromium { window#waybar.chromium {
@ -40,21 +31,20 @@ window#waybar.chromium {
#workspaces button { #workspaces button {
padding: 0 5px; padding: 0 5px;
background-color: transparent; background-color: transparent;
color: #ffffff; color: #cccccc;
/* Use box-shadow instead of border so the text isn't offset */ /* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent; box-shadow: inset 0 -3px transparent;
border-radius: 0.5; border-radius: 0.5px;
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover { #workspaces button:hover {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
box-shadow: inset 0 -3px #ffffff; box-shadow: inset 0 -3px #cccccc;
} }
#workspaces button.focused { #workspaces button.focused {
background-color: #64727D; background-color: #664477;
box-shadow: inset 0 -3px #ffffff; box-shadow: inset 0 -3px #cccccc;
} }
#workspaces button.urgent { #workspaces button.urgent {
@ -62,23 +52,13 @@ window#waybar.chromium {
} }
#mode { #mode {
background-color: #64727D; background-color: #664477;
border-bottom: 3px solid #ffffff; border-bottom: 3px solid #cccccc;
} }
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media, #custom-media,
#tray, #tray,
#mode, #mode {
#idle_inhibitor,
#mpd {
padding: 0 10px; padding: 0 10px;
margin: 0 4px; margin: 0 4px;
color: #ffffff; color: #ffffff;
@ -89,37 +69,31 @@ window#waybar.chromium {
margin: 0 4px; margin: 0 4px;
} }
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces { .modules-left > widget:first-child > #workspaces {
margin-left: 0; margin-left: 0;
} }
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces { .modules-right > widget:last-child > #workspaces {
margin-right: 0; margin-right: 0;
} }
#clock {
background-color: #64727D;
}
#custom-disk { #custom-disk {
color: #C14F3F; color: #C14F3F;
margin: 0 1px; margin: 0 1px;
} }
#custom-currentdate { #custom-currentdate {
color: #C14F3F; color: #eb4d4b;
margin: 0 1px; margin: 0 1px;
} }
#custom-kernel { #custom-kernel {
color: #51A6E3; color: #62bbfa;
margin: 0 1px; margin: 0 1px;
} }
#custom-cpu { #custom-cpu {
color: #B63CEC; color: #d26bff;
margin: 0 1px; margin: 0 1px;
} }
@ -144,7 +118,7 @@ window#waybar.chromium {
} }
#battery { #battery {
background-color: #ffffff; background-color: #cccccc;
color: #000000; color: #000000;
} }
@ -155,7 +129,7 @@ window#waybar.chromium {
@keyframes blink { @keyframes blink {
to { to {
background-color: #ffffff; background-color: #cccccc;
color: #000000; color: #000000;
} }
} }
@ -174,35 +148,6 @@ label:focus {
background-color: #000000; background-color: #000000;
} }
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#backlight {
background-color: #90b1b1;
}
#network {
color: #328fff;
}
#network.disconnected {
color: #f53c3c;
}
#pulseaudio {
color: #d8c60d;
}
#pulseaudio.muted {
color: #90b1b1;
}
#custom-media { #custom-media {
background-color: #66cc99; background-color: #66cc99;
color: #2a5c45; color: #2a5c45;
@ -217,46 +162,12 @@ label:focus {
background-color: #ffa000; background-color: #ffa000;
} }
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray { #tray {
/*background-color: #2980b9;*/ /*background-color: #2980b9;*/
} }
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language { #language {
color: #00b093; color: #26ec6d;
padding: 0 1px; padding: 0 1px;
margin: 0 1px; margin: 0 1px;
min-width: 16px; min-width: 16px;