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 # colors
black=#1E1D2D rosewater=#f4dbd6
green=#ABE9B3 flamingo=#f0c6c6
white=#D9E0EE pink=#f5bde6
grey=#282737 mauve=#c6a0f6
blue=#96CDFB red=#ed8796
red=#F28FAD maroon=#ee99a0
darkblue=#83bae8 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() {
cpu_val=$(grep -o "^[^ ]*" /proc/loadavg) cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
printf "^c$black^ ^b$green^ 󰇄 " printf "^c$crust^ ^b$yellow^ 󰇄 "
printf "^c$black^ ^b$green^$cpu_val" printf "^c$crust^ ^b$yellow^$cpu_val"
} }
pkg_updates() { pkg_updates() {
@@ -38,37 +57,42 @@ pkg_updates() {
} }
battery() { battery() {
get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)" capacity_0="$(cat /sys/class/power_supply/BAT0/capacity)"
printf "^c$blue^  $get_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() { brightness() {
printf "^c$red^  " printf "^c$crust^^b$peach^  "
printf "^c$red^%.0f\n" $(cat /sys/class/backlight/*/brightness) printf "^c$crust^^b$peach^%.0f\n" $(cat /sys/class/backlight/*/brightness)
} }
mem() { mem() {
printf "^c$black^^b$red^  " printf "^c$crust^^b$green^  "
printf "^c$black^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)" printf "^c$crust^^b$green^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)"
} }
wlan() { wlan() {
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
up) printf "^c$black^ ^b$blue^ 󰤨 ^d^%s" " ^c$blue^Connected" ;; up) printf "^c$crust^ ^b$blue^ 󰤨 ^c$crust^ ^b$blue^Connected" ;;
down) printf "^c$black^ ^b$blue^ 󰤭 ^d^%s" " ^c$blue^Disconnected" ;; down) printf "^c$crust^ ^b$blue^ 󰤭 ^c$crust^ ^b$blue^Disconnected" ;;
esac esac
} }
clock() { clock() {
printf "^c$black^ ^b$blue^ 󱑁 " printf "^c$crust^ ^b$mauve^ 󱑁 "
printf "^c$black^^b$blue^ $(date '+%r') " printf "^c$crust^ ^b$mauve^$(date '+%r') "
} }
while true; do while true; do
[ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates) # [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
interval=$((interval + 1)) # interval=$((interval + 1))
# sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)" # 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 done

View File

@@ -1,5 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */ /* appearance */
#if ROUNDED_CORNERS_PATCH #if ROUNDED_CORNERS_PATCH
static const unsigned int borderpx = 0; /* border pixel of windows */ static const unsigned int borderpx = 0; /* border pixel of windows */
@@ -202,6 +204,19 @@ static char urgbgcolor[] = "#222222";
static char urgbordercolor[] = "#ff0000"; static char urgbordercolor[] = "#ff0000";
static char urgfloatcolor[] = "#db8fd9"; 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 #if RENAMED_SCRATCHPADS_PATCH
static char scratchselfgcolor[] = "#FFF7D4"; static char scratchselfgcolor[] = "#FFF7D4";
static char scratchselbgcolor[] = "#77547E"; static char scratchselbgcolor[] = "#77547E";
@@ -892,6 +907,19 @@ static const Key on_empty_keys[] = {
static const Key keys[] = { static const Key keys[] = {
/* modifier key function argument */ /* 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 #if KEYMODES_PATCH
{ MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} }, { MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} },
#endif // KEYMODES_PATCH #endif // KEYMODES_PATCH