ncmpcpp-ueberzug icon indicating copy to clipboard operation
ncmpcpp-ueberzug copied to clipboard

Alternative/improvement to guess_terminal_pixelsize()

Open jjpprr opened this issue 3 years ago • 0 comments

Not really an issue but a possible improvement. I was having problems with the guess_terminal_pixelsize() function whereby no matter what I tried I was getting the Failed to guess font size message.

The following implementation using xwininfo makes it unnecessary to have to call python and create an additional tmp file. I also think it's more readable:

guess_terminal_pixelsize() {
    term_width=$(xwininfo -id $WINDOWID | grep Width | awk '{ print $2 }')
    term_height=$(xwininfo -id $WINDOWID | grep Height | awk '{ print $2 }')

    if ! is_font_size_successfully_computed; then
        echo "Failed to guess font size, try setting it in ncmpcpp_cover_art.sh settings"
    fi
}

jjpprr avatar Apr 30 '21 01:04 jjpprr