diff --git a/.config/waybar/config b/.config/waybar/config index f4c7a6f..3187f51 100644 --- a/.config/waybar/config +++ b/.config/waybar/config @@ -8,7 +8,8 @@ "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/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, @@ -49,7 +50,7 @@ "format": "{}", //"max-length": 12, "interval": 10, - "exec": "~/.config/waybar/scripts/kernel_version.sh", + "exec": "~/.config/waybar/iscripts/kernel_version.sh", }, "custom/clock": { @@ -59,25 +60,46 @@ "exec": "date '+%h %d, %H:%M'", }, + "custom/currentdate": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/iscripts/current_date.sh", + }, + + "custom/getvolume": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/iscripts/get_volume.sh", + }, + + "custom/checkupdates": { + "format": "{}", + //"max-length": 12, + "interval": 1800, + "exec": "~/.config/waybar/iscripts/checkUpdates.sh", + }, + "custom/cpu": { "format": "{}", //"max-length": 12, "interval": 2, - "exec": "~/.config/waybar/scripts/cpu_info.sh", + "exec": "~/.config/waybar/iscripts/cpu_info.sh", }, "custom/memory": { "format": "{}", //"max-length": 12, "interval": 5, - "exec": "~/.config/waybar/scripts/mem_info.sh", + "exec": "~/.config/waybar/iscripts/mem_info.sh", }, "custom/disk": { "format": "{}", //"max-length": 12, "interval": 10, - "exec": "~/.config/waybar/scripts/disk_info.sh", + "exec": "~/.config/waybar/iscripts/disk_info.sh", }, "idle_inhibitor": { diff --git a/.config/waybar/config.icons b/.config/waybar/config.icons new file mode 100644 index 0000000..3187f51 --- /dev/null +++ b/.config/waybar/config.icons @@ -0,0 +1,198 @@ +{ + // "layer": "top", // Waybar at top layer + "position": "top", // Waybar position (top|bottom|left|right) + "height": 28, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + // Choose the order of the modules + // "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": { + "all-outputs": false, + //"format": "{name}: {icon}", + "format": "{name}", + "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + "urgent": "", + "focused": "", + "default": "" + } + }, + + "sway/mode": { + "format": "{}" + }, + + "custom/kernel": { + "format": "{}", + //"max-length": 12, + "interval": 10, + "exec": "~/.config/waybar/iscripts/kernel_version.sh", + }, + + "custom/clock": { + "format": "{}", + //"max-length": 12, + "interval": 20, + "exec": "date '+%h %d, %H:%M'", + }, + + "custom/currentdate": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/iscripts/current_date.sh", + }, + + "custom/getvolume": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/iscripts/get_volume.sh", + }, + + "custom/checkupdates": { + "format": "{}", + //"max-length": 12, + "interval": 1800, + "exec": "~/.config/waybar/iscripts/checkUpdates.sh", + }, + + "custom/cpu": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/iscripts/cpu_info.sh", + }, + + "custom/memory": { + "format": "{}", + //"max-length": 12, + "interval": 5, + "exec": "~/.config/waybar/iscripts/mem_info.sh", + }, + + "custom/disk": { + "format": "{}", + //"max-length": 12, + "interval": 10, + "exec": "~/.config/waybar/iscripts/disk_info.sh", + }, + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 5 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "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": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "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 + } +} diff --git a/.config/waybar/config.simple b/.config/waybar/config.simple new file mode 100644 index 0000000..f4c7a6f --- /dev/null +++ b/.config/waybar/config.simple @@ -0,0 +1,176 @@ +{ + // "layer": "top", // Waybar at top layer + "position": "top", // Waybar position (top|bottom|left|right) + "height": 28, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + // Choose the order of the modules + // "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 configuration + // "sway/workspaces": { + // "disable-scroll": true, + // "all-outputs": true, + // "format": "{name}: {icon}", + // "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + // "urgent": "", + // "focused": "", + // "default": "" + // } + // }, + "sway/workspaces": { + "all-outputs": false, + //"format": "{name}: {icon}", + "format": "{name}", + "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + "urgent": "", + "focused": "", + "default": "" + } + }, + + "sway/mode": { + "format": "{}" + }, + + "custom/kernel": { + "format": "{}", + //"max-length": 12, + "interval": 10, + "exec": "~/.config/waybar/scripts/kernel_version.sh", + }, + + "custom/clock": { + "format": "{}", + //"max-length": 12, + "interval": 20, + "exec": "date '+%h %d, %H:%M'", + }, + + "custom/cpu": { + "format": "{}", + //"max-length": 12, + "interval": 2, + "exec": "~/.config/waybar/scripts/cpu_info.sh", + }, + + "custom/memory": { + "format": "{}", + //"max-length": 12, + "interval": 5, + "exec": "~/.config/waybar/scripts/mem_info.sh", + }, + + "custom/disk": { + "format": "{}", + //"max-length": 12, + "interval": 10, + "exec": "~/.config/waybar/scripts/disk_info.sh", + }, + + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 5 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "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": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "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 + } +} diff --git a/.config/waybar/iscripts/checkUpdates.sh b/.config/waybar/iscripts/checkUpdates.sh new file mode 100755 index 0000000..59ae3f2 --- /dev/null +++ b/.config/waybar/iscripts/checkUpdates.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Check updates on Arch Linux +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/pacman -Sy +# 30 * * * * root /usr/bin/pacman -Sy +if [ -f /usr/bin/pacman ] ; then + num_packages=$(pacman -Qu | wc -l) + echo " ${num_packages} " + +# Check updates on Ubuntu/Debian/Devuan +# Note: Create cron on /etc/cron.d/checkupdates with the following lines: +# 0 * * * * root /usr/bin/aptitude update +# 30 * * * * root /usr/bin/aptitude update +elif [ -f /usr/bin/aptitude ] ; then + num_packages=$(aptitude search "~U" | wc -l) + echo " ${num_packages} " + +# Disable for other distros +else + echo " 0 " +fi diff --git a/.config/waybar/iscripts/cpu_info.sh b/.config/waybar/iscripts/cpu_info.sh new file mode 100755 index 0000000..be0aa3d --- /dev/null +++ b/.config/waybar/iscripts/cpu_info.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +check_sensor=$(sensors | grep "Tdie:" 2> /dev/null) +if [ -z "${check_sensor}" ] ; then + check_sensor=$(sensors | grep "Tctl:" 2> /dev/null) + if [ -z "${check_sensor}" ] ; then + CPU_USAGE=$(~/.config/polybar/iscripts/cpu_load.sh -p) + echo "$CPU_USAGE" | awk '{ printf("%6s \n"), $1, $2 }' + else + TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o) + #CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}') + CPU_USAGE=$(~/.config/polybar/scripts/cpu_load.sh -p) + echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }' + fi +else + TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o) + #CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}') + CPU_USAGE=$(~/.config/polybar/iscripts/cpu_load.sh -p) + echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }' +fi diff --git a/.config/waybar/iscripts/cpu_load.sh b/.config/waybar/iscripts/cpu_load.sh new file mode 100755 index 0000000..57fc7e5 --- /dev/null +++ b/.config/waybar/iscripts/cpu_load.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Script to show cpu +# Created by q3aql (q3aql@protonmail.ch) +# Licensed by GPL v.2 +# Date: 10-01-2020 +# -------------------------------------- +VERSION="1.0" + + +# Variables +cpuPercentage=$(top -b -n1 | grep \%Cpu | awk '{print 100-$8}') +showCpuPercentage=$(echo ${cpuPercentage}) +showCpuPercentageInteger=$(echo ${showCpuPercentage} | cut -d "." -f 1) + +# Show percentage bar +if [ ${showCpuPercentageInteger} -ge 0 ] ; then + showCpuPercentageBar="=" +fi +if [ ${showCpuPercentageInteger} -ge 3 ] ; then + showCpuPercentageBar="==" +fi +if [ ${showCpuPercentageInteger} -ge 12 ] ; then + showCpuPercentageBar="===" +fi +if [ ${showCpuPercentageInteger} -ge 18 ] ; then + showCpuPercentageBar="====" +fi +if [ ${showCpuPercentageInteger} -ge 25 ] ; then + showCpuPercentageBar="=====" +fi +if [ ${showCpuPercentageInteger} -ge 35 ] ; then + showCpuPercentageBar="======" +fi +if [ ${showCpuPercentageInteger} -ge 40 ] ; then + showCpuPercentageBar="=======" +fi +if [ ${showCpuPercentageInteger} -ge 45 ] ; then + showCpuPercentageBar="========" +fi +if [ ${showCpuPercentageInteger} -ge 50 ] ; then + showCpuPercentageBar="==========" +fi +if [ ${showCpuPercentageInteger} -ge 62 ] ; then + showCpuPercentageBar="=============" +fi +if [ ${showCpuPercentageInteger} -ge 75 ] ; then + showCpuPercentageBar="===============" +fi +if [ ${showCpuPercentageInteger} -ge 85 ] ; then + showCpuPercentageBar="=================" +fi +if [ ${showCpuPercentageInteger} -ge 90 ] ; then + showCpuPercentageBar="==================" +fi +if [ ${showCpuPercentageInteger} -ge 95 ] ; then + showCpuPercentageBar="===================" +fi +if [ ${showCpuPercentageInteger} -ge 100 ] ; then + showCpuPercentageBar="====================" +fi + +# Show results +if [ "$1" == "-p" ]; then + echo ${showCpuPercentage}% +elif [ "$1" == "-b" ]; then + echo ${showCpuPercentageBar} +else + echo "" + echo " cpuinfo v$VERSION" + echo " ------------" + echo "" + echo " CpuPercentage Use:" + echo " ${showCpuPercentageBar} ${showCpuPercentage}%" + echo "" + echo " Available commands:" + echo "" + echo " cpuinfo.sh -p | Show CpuPercentage" + echo " cpuinfo.sh -b | Show CpuPercentage Bar" + echo "" + echo " Note: Conky require 'maximum_width = 240'" + echo "" +fi diff --git a/.config/waybar/iscripts/current_date.sh b/.config/waybar/iscripts/current_date.sh new file mode 100755 index 0000000..f223d60 --- /dev/null +++ b/.config/waybar/iscripts/current_date.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +current_date=$(date "+%d/%m/%Y %H:%M") +echo "  ${current_date}" diff --git a/.config/waybar/iscripts/disk_info.sh b/.config/waybar/iscripts/disk_info.sh new file mode 100755 index 0000000..da3f2b2 --- /dev/null +++ b/.config/waybar/iscripts/disk_info.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +df -h / | awk '/\//{ printf(" %4s / %s \n", $4, $2) }' diff --git a/.config/waybar/iscripts/get_volume.sh b/.config/waybar/iscripts/get_volume.sh new file mode 100755 index 0000000..a501178 --- /dev/null +++ b/.config/waybar/iscripts/get_volume.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +get_volume=$(amixer | grep "%" | head -1 | cut -d "%" -f 1 | cut -d "[" -f 2) +echo " ${get_volume}% " diff --git a/.config/waybar/iscripts/kernel_version.sh b/.config/waybar/iscripts/kernel_version.sh new file mode 100755 index 0000000..390a687 --- /dev/null +++ b/.config/waybar/iscripts/kernel_version.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Parameters +longNumber=2 +kernelCommand="uname -r" +archCommand=$(uname -m) + +# Kernel version +kernelVersion="" +count=1 + +# Extract numbers of kernel version +kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot="${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) + +while [ ${count} -le ${longNumber} ] ; do + kernelVersionTemp=$(uname -r | cut -d "." -f ${count}) + kernelVersionTempDot=".${kernelVersionTemp}" + kernelVersion="${kernelVersion}${kernelVersionTempDot}" + count=$(expr ${count} + 1) +done + +kernelVersionTemp=$(uname -r | cut -d "." -f ${count} | cut -d "-" -f 1) +kernelVersionTempDot=".${kernelVersionTemp}" +kernelVersion=${kernelVersion}${kernelVersionTempDot} + +# Apply arch +#kernelVersion=${kernelVersion}-${archCommand} +kernelVersion=${kernelVersion} +#echo "Kernel: Linux ${kernelVersion} " +echo " Linux ${kernelVersion} " + diff --git a/.config/waybar/iscripts/mem_info.sh b/.config/waybar/iscripts/mem_info.sh new file mode 100755 index 0000000..6c8eeec --- /dev/null +++ b/.config/waybar/iscripts/mem_info.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +mem_info=$(free -h | awk '/Mem:/ { printf(" %5s/%s \n", $3, $2) }') +echo -n " " +echo -n ${mem_info} +echo " " diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 9c10439..6bd6bd3 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -2,8 +2,8 @@ border: none; border-radius: 0; /* `otf-font-awesome` is required to be installed for icons */ - font-family: Noto Sans, Roboto, Helvetica, Arial, sans-serif; - font-size: 13px; + font-family: UbuntuMono Nerd Font, Noto Sans, Roboto, Helvetica, Arial, sans-serif; + font-size: 15px; min-height: 0; } @@ -108,6 +108,11 @@ window#waybar.chromium { margin: 0 1px; } +#custom-currentdate { + color: #C14F3F; + margin: 0 1px; +} + #custom-kernel { color: #51A6E3; margin: 0 1px; @@ -123,6 +128,16 @@ window#waybar.chromium { margin: 0 1px; } +#custom-checkupdates { + color: #CADD8A; + margin: 0 1px; +} + +#custom-getvolume { + color: #DDAA33; + margin: 0 1px; +} + #custom-clock { color: #51A6E3; margin: 0 1px; diff --git a/README-sway.md b/README-sway.md index 47a30e2..36aaef3 100644 --- a/README-sway.md +++ b/README-sway.md @@ -29,6 +29,7 @@ dotfiles - My tiling sway configuration (for Arch/Devuan/Debian) $ cd dotfiles $ chmod +x install-config.sh $ ./install-config.sh + $ cp -rfv ~/.config/waybar/config.icons ~/.config/waybar/config ```` ### Configuration: diff --git a/examples/sway.png b/examples/sway.png index 44743df..7014bb8 100644 Binary files a/examples/sway.png and b/examples/sway.png differ