Skip to content

Change the color of borders from within a script #482

@mrjpaxton

Description

@mrjpaxton

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions