bar customisation, xf86 btns

This commit is contained in:
2023-02-26 23:30:06 +01:00
parent 1c6f192142
commit 0e7ec80eac
2 changed files with 74 additions and 22 deletions

View File

@@ -10,19 +10,38 @@ interval=0
# colors
black=#1E1D2D
green=#ABE9B3
white=#D9E0EE
grey=#282737
blue=#96CDFB
red=#F28FAD
darkblue=#83bae8
rosewater=#f4dbd6
flamingo=#f0c6c6
pink=#f5bde6
mauve=#c6a0f6
red=#ed8796
maroon=#ee99a0
peach=#f5a97f
yellow=#eed49f
green=#a6da95
teal=#8bd5ca
sky=#91d7e3
sapphire=#7dc4e4
blue=#8aadf4
lavender=#b7bdf8
text=#cad3f5
subtext1=#b8c0e0
subtext0=#a5adcb
overlay2=#939ab7
overlay1=#8087a2
overlay0=#6e738d
surface2=#5b6078
surface1=#494d64
surface0=#363a4f
base=#24273a
mantle=#1e2030
crust=#181926
cpu() {
cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
printf "^c$black^ ^b$green^ 󰇄 "
printf "^c$black^ ^b$green^$cpu_val"
printf "^c$crust^ ^b$yellow^ 󰇄 "
printf "^c$crust^ ^b$yellow^$cpu_val"
}
pkg_updates() {
@@ -38,37 +57,42 @@ pkg_updates() {
}
battery() {
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
printf "^c$blue^  $get_capacity"
capacity_0="$(cat /sys/class/power_supply/BAT0/capacity)"
capacity_1="$(cat /sys/class/power_supply/BAT1/capacity)"
capacity=$(((capacity_0 + capacity_1) / 2))
printf "^c$crust^ ^b$red^  ^b$red^ $capacity"
}
brightness() {
printf "^c$red^  "
printf "^c$red^%.0f\n" $(cat /sys/class/backlight/*/brightness)
printf "^c$crust^^b$peach^  "
printf "^c$crust^^b$peach^%.0f\n" $(cat /sys/class/backlight/*/brightness)
}
mem() {
printf "^c$black^^b$red^  "
printf "^c$black^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
printf "^c$crust^^b$green^  "
printf "^c$crust^^b$green^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
}
wlan() {
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
up) printf "^c$black^ ^b$blue^ 󰤨 ^d^%s" " ^c$blue^Connected" ;;
down) printf "^c$black^ ^b$blue^ 󰤭 ^d^%s" " ^c$blue^Disconnected" ;;
up) printf "^c$crust^ ^b$blue^ 󰤨 ^c$crust^ ^b$blue^Connected" ;;
down) printf "^c$crust^ ^b$blue^ 󰤭 ^c$crust^ ^b$blue^Disconnected" ;;
esac
}
clock() {
printf "^c$black^ ^b$blue^ 󱑁 "
printf "^c$black^^b$blue^ $(date '+%r') "
printf "^c$crust^ ^b$mauve^ 󱑁 "
printf "^c$crust^ ^b$mauve^$(date '+%r') "
}
while true; do
[ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
interval=$((interval + 1))
# [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
# interval=$((interval + 1))
# sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
sleep 1 && xsetroot -name "$(cpu) $(mem) $(clock)"
sleep 1 && xsetroot -name "$(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
# sleep 1 && xsetroot -name "$(cpu) $(mem) $(clock)"
done

View File

@@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
#if ROUNDED_CORNERS_PATCH
static const unsigned int borderpx = 0; /* border pixel of windows */
@@ -202,6 +204,19 @@ static char urgbgcolor[] = "#222222";
static char urgbordercolor[] = "#ff0000";
static char urgfloatcolor[] = "#db8fd9";
static const char *mutevol[] = {"/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL};
static const char *downvol[] = {"/usr/bin/pactl", "set-sink-volume", "0", "-3%", NULL};
static const char *upvol[] = {"/usr/bin/pactl", "set-sink-volume", "0", "+3%", NULL};
static const char *mutemic[] = {"/usr/bin/pactl", "set-source-mute", "0", "toggle", NULL};
static const char *downbrt[] = {"xbacklight", "-dec", "5", NULL};
static const char *upbrt[] = {"xbacklight", "-inc", "5", NULL};
static const char *displ[] = {"arandr", NULL};
static const char *wlan[] = {"alacritty", "-e", "nmtui", NULL};
static const char *tools[] = {"lxappearance"};
static const char *search[] = {"rofi", "-show", "drun", NULL};
// static const char *launcha[] = {alttabstart};
static const char *explorer[] = {"nemo", NULL};
#if RENAMED_SCRATCHPADS_PATCH
static char scratchselfgcolor[] = "#FFF7D4";
static char scratchselbgcolor[] = "#77547E";
@@ -892,6 +907,19 @@ static const Key on_empty_keys[] = {
static const Key keys[] = {
/* modifier key function argument */
{0, XF86XK_AudioMute, spawn, {.v = mutevol}},
{0, XF86XK_AudioLowerVolume, spawn, {.v = downvol}},
{0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol}},
{0, XF86XK_AudioMicMute, spawn, {.v = mutemic}},
{0, XF86XK_MonBrightnessDown, spawn, {.v = downbrt}},
{0, XF86XK_MonBrightnessUp, spawn, {.v = upbrt}},
{0, XF86XK_Display, spawn, {.v = displ}},
{0, XF86XK_WLAN, spawn, {.v = wlan}},
{0, XF86XK_Tools, spawn, {.v = tools}},
{0, XF86XK_Search, spawn, {.v = search}},
{0, XF86XK_LaunchA, alttabstart, {0}},
{0, XF86XK_Explorer, spawn, {.v = explorer}},
#if KEYMODES_PATCH
{ MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} },
#endif // KEYMODES_PATCH