mirrorwitch / moon-phases

Fast command-line application to show the moon phase
Other
7 stars 0 forks source link

Polybar #1

Closed ktnlikeasmallcat closed 2 months ago

ktnlikeasmallcat commented 3 months ago

Hi Hi! I suddenly can't seem to get moon-phases with --text-emoji, --face-emoji, or --emoji to show anything on polybar. --number and the flagless option works normally, and I get the expected output for everything on the command line. Also using the long and short flags have the same behavior.

I've used a few fonts, Spleen, Noto Sans, Unifont, undefined, and some nerd fonts, as well as miscellaneous other fonts. With Noto Color Emoji font and -e, there's a huge oversized color emoji there. I've also tried putting the full path in exec = and making a wrapper script.

I'm using the following module, which can output -n on the bar correctly:

[module/moon]
type = custom/script
exec = moon-phases -t 
label = %output%

Other variations include:

[module/moon]
type = custom/script
exec = moon-phases -e
label = %{T5}%{O-35}%output%%{O-20}
format-padding = 1
interval = 20000

It only stopped working after doing a fresh install, and I've also cargo installed the moon-phases binary since then to attempt to solve the problem. Is there any troubleshooting I can do to find what's going sideways, or more information that might be helpful in diagnosing the issue I'm running into? I suspect it might be some obscure issue with my polybar, so I'll check that with a default config file later on tonight.

Thank you!

ktnlikeasmallcat commented 2 months ago

Still getting warn: Dropping unmatched character '🌘' (U+1f318) in '🌘'. with an otherwise clean polybar config.

I fiddled around with the code not knowing what I'm doing and came up with this, if you ever want to implement nerd font support this might make the process easier (alternatively, i really don't know what I'm doing and it will not make anything easier lol):

const NORTH_NERD: [&str; 29] = [

    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
];
const SOUTH_NERD: [&str; 29] = [

    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
    " ",
];
fn to_nerd(phase: f64,
            south_hemisphere: bool)
    -> String {
        let nerd_set = if south_hemisphere {
            SOUTH_NERD
        } else {
            NORTH_NERD
        };
        let nerd = match phase {
            x if x <  0.01 => nerd_set[0],
            x if x <  0.02 => nerd_set[1],
            x if x <  0.03 => nerd_set[2],
            x if x <  0.06 => nerd_set[3],
            x if x <  0.10 => nerd_set[4],
            x if x <  0.13 => nerd_set[5],
            x if x <  0.17 => nerd_set[6],
            x if x <  0.20 => nerd_set[7],
            x if x <  0.24 => nerd_set[8],
            x if x <  0.27 => nerd_set[9],
            x if x <  0.31 => nerd_set[10],
            x if x <  0.34 => nerd_set[11],
            x if x <  0.37 => nerd_set[12],
            x if x <  0.41 => nerd_set[13],
            x if x <  0.44 => nerd_set[14],
            x if x <  0.48 => nerd_set[15],
            x if x <  0.51 => nerd_set[16],
            x if x <  0.55 => nerd_set[17],
            x if x <  0.58 => nerd_set[18],
            x if x <  0.62 => nerd_set[19],
            x if x <  0.65 => nerd_set[20],
            x if x <  0.68 => nerd_set[21],
            x if x <  0.72 => nerd_set[22],
            x if x <  0.75 => nerd_set[23],
            x if x <  0.79 => nerd_set[24],
            x if x <  0.82 => nerd_set[25],
            x if x <  0.86 => nerd_set[26],
            x if x <  0.89 => nerd_set[27],
            x if x <  0.93 => nerd_set[28],
            x if x <  0.96 => nerd_set[29],
            x if x <  1.00 => nerd_set[29],
            _ => nerd_set[0]
        };

    }

ofc these changes don't compile at all, even with the other obvious changes to the code, but this math might make some dull parts simpler if you do choose to go that route.

anyway cheers, if you've got any ideas about how to get the output onto polybar or what I might be doing wrong pls lmk. thank youu.

ktnlikeasmallcat commented 2 months ago

The solution was to specify Unifont Upper in the config.