Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the color of borders from within a script #482

Open
mrjpaxton opened this issue Jan 27, 2024 · 0 comments
Open

Change the color of borders from within a script #482

mrjpaxton opened this issue Jan 27, 2024 · 0 comments

Comments

@mrjpaxton
Copy link

Hey everyone,

Firstly, I already know it's possible to override the FG text color and BG color by specifying the 3rd and 4th lines with printf/echo doing something like this:

~/.local/share/i3blocks/volume

#!/bin/sh

#set -x

# Define output variables for Pipewire
volsrc="wpctl get-volume @DEFAULT_AUDIO_SINK@"
volume=$(eval "$volsrc" | awk '{print int($2*100)}')
muted=$(eval "$volsrc" | awk '{print $3}')

if [ "$muted" = "[MUTED]" ]; then
    printf "MUTE\n"
    printf "MUTE\n"
    printf "#ff0000\n"
    printf "#000000"
    exit
fi

# Print volume percentage levels (short then long format)
printf "%s%%\n" "$volume"
printf "%s%%\n" "$volume"

The block config is this:

~/.config/i3blocks/config

command=$SCRIPT_DIR/$BLOCK_NAME
separator_block_width=12
separator=true
markup=none
border_top=0
border_left=0
border_right=0
border_bottom=2

...

[volume]
label=VOL:
interval=1
border=#808080

But after learning about the borders, what I want to do next is maybe something more advanced like have the script change the color of the borders from within the script programmatically. Is there a way to do that? Do I need to switch to something more advanced like the JSON markup to be able to do that sort of thing?

@mrjpaxton mrjpaxton changed the title Change the color of borders or Change the color of borders from within a script Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant