ibhagwan / lemontify

A modular script for OSX inspired notifications based on lemonbar
16 stars 2 forks source link

Unable to determine platform|provider icon & level. #4

Closed NetMan134 closed 2 years ago

NetMan134 commented 2 years ago

Hi, I'm trying to run ./lemontify -p audio --text WithEmptyRects -e for example to see how this works, and I get following message:

./lemontify: 93: eval: 2: parameter not set
critical error: unable to determine platform|provider icon & level

I've installed the bar repository from your github (https://github.com/ibhagwan/bar) and I don't know what might be wrong? I would love to use this because it looks fantastic. I stumbled upon this by accident, but was earlier searching for similar solutions (volnoti for example) but they didn't appeal to me. This - does (or will, when it's going to work).

Using: Pipewire with PulseAudio server OS: Void Linux x86_64 Kernel: 5.10.128_1

Thanks for your response, Oskar

ibhagwan commented 2 years ago

Can you paste the output of the command if you also add -v --debug?

ibhagwan commented 2 years ago

Also, can you run this and paste the output:

pactl list sinks | grep -A 15 "Sink #0"
pactl list sinks | grep -A 15 "Sink #0" | grep "^[[:space:]]Mute:" | cut -f 2 -d ':' | tr -d ' '
NetMan134 commented 2 years ago

Can you paste the output of the command if you also add -v --debug?

Hi, Thanks for your response, here it is:

./git/lemontify/lemontify: 93: eval: 2: parameter not set
Platform:          Linux
Options:
    debug:         1
    verbose:       1
    duration:      1.5
    provider:      audio
    command:       NULL
    empty:         1
    ramp:          0
    line:          0
    step:          5
    text:          WithEmptyRects
Functions:
    Linux_audio_set() = 1
    Linux_audio_get() = 
    Linux_audio_status() = 
    audio_icon() = %{c}%{O-50}%{l}
critical error: unable to determine platform|provider icon & level

Also, can you run this and paste the output:

pactl list sinks | grep -A 15 "Sink #0"
pactl list sinks | grep -A 15 "Sink #0" | grep "^[[:space:]]Mute:" | cut -f 2 -d ':' | tr -d ' '

When I list sinks, I have Sink #50, #53 and #54, and searching #0 with grep is blank. I would also like to clarify, I'm using Sharkoon SGH2 USB headphones, and they are visible as Sink #50, so I ran these commands modifying Sink #0 to #50:

First command:

Sink #50
        State: IDLE
        Name: alsa_output.usb-Sharkoon_Technologies._Skiller_SGH2_3rd_Jun_2017-00.analog-stereo
        Description: Audio Adapter (Unitek Y-247A) Analog Stereo
        Driver: PipeWire
        Sample Specification: s16le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 30419 /  46% / -20,00 dB,   front-right: 30419 /  46% / -20,00 dB
                balance 0,00
        Base Volume: 65536 / 100% / 0,00 dB
        Monitor Source: alsa_output.usb-Sharkoon_Technologies._Skiller_SGH2_3rd_Jun_2017-00.analog-stereo.monitor
        Latency: 0 usec, configured 0 usec
        Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
        Properties:

Second command:

no

Again, thank you for the response, Oskar

ibhagwan commented 2 years ago

Can you try editing the script and changing the 2 locations where it uses sink #0 to sink #50 and run it again?

NetMan134 commented 2 years ago

Unfortunately I left my house and so my PC, but I've got my laptop (same OS, but slightly newer kernel - 5.18.9_1), installed lemonbar and lemontify, pactl list sinks shows Sink #0 on here, so there should be no problems ther-

A blank instance of lemonbar launches at the top for a second, and lemontify throws this message onto my screen: The geometry specified doesn't fit the screen!

Though it's a good thing we've got another error, am I right?

Thanks, Oskar

ibhagwan commented 2 years ago

Can you run it with -v --debug so we can see the output (should include the geometry)?

NetMan134 commented 2 years ago

Yep! Here it is:

netman@ARISTO git/lemontify (master) » ./lemontify -p audio --text WithEmptyRects -e -v --debug                    2 ↵
Platform:          Linux
Options:
    debug:         1
    verbose:       1
    duration:      1.5
    provider:      audio
    command:       NULL
    empty:         1
    ramp:          0
    line:          0
    step:          5
    text:          WithEmptyRects
Functions:
    Linux_audio_set() = 1
    Linux_audio_get() = 60
    Linux_audio_status() = no
    audio_icon() = %{c}%{O-50}%{T2}%{T1}%{l}
Lemonbar:
    text:          %%{c}%%{O-50}%%{T2}%%{T1}%%{l} %%{l} %%{T4} ▉▉▉▉▉▉▉▉▉▉▉▉%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T3}□%%{T1}%%{T1}%%{l} %%{c}%%{T1}WithEmptyRects%%{T1}%%{l}
    cmd:           lemonbar -m -d -g 400x350+483+431 -F#87FFAF -B#64000000 -o -215  -f DejaVuSans:style:Bold:size=14 -o -20  -f InputMonoNerdFont:pixelsize=180:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold
The geometry specified doesn't fit the screen!
ibhagwan commented 2 years ago

What is your screen resolution? The attempted geometry seems quite small 400x350+483+431, I have no idea why the error message would appear.

This project was never meant to be working as is on many systems, as you’ve noticed it has hard coded audio sink, hard coded fonts and probably other very specific adjustments to my systems, if you wish to further debug this what you can do is work backwards without the script and then figure out what went wrong.

Lemonbar is very simple, it takes piped text displays it, I.e. echo text | lemonbar …, try and figure out the program first and see how to make it work on your machine, what geometry works and what doesn’t and then you can adjust the script (which just builds the text that will get piped into lemonbar).

NetMan134 commented 2 years ago

My screen on this laptop a 15-inch panel with 1366x768 resolution set

ibhagwan commented 2 years ago

My screen on this laptop a 15-inch panel with 1366x768 resolution set

Confirming this geometry should be contained within the screen.

Try running echo text | lemonbar -g … with different numbers and figure out what values it’s willing to accept.

NetMan134 commented 2 years ago

I took the: lemonbar -m -d -g 400x350+483+431 -F#87FFAF -B#64000000 -o -215 -f DejaVuSans:style:Bold:size=14 -o -20 -f InputMonoNerdFont:pixelsize=180:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold command and changed 400x350+483+431 to 300x300, and I've got a transparent black square at top left of my screen with no text, nor icon image

NetMan134 commented 2 years ago

Max value lemonbar accepts is: 400x400+966+368

NetMan134 commented 2 years ago

And when I did this again:

I took the: lemonbar -m -d -g 400x350+483+431 -F#87FFAF -B#64000000 -o -215 -f DejaVuSans:style:Bold:size=14 -o -20 -f InputMonoNerdFont:pixelsize=180:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold -o 40 -f InputMonoNerdFont:pixelsize=26:Style:Bold command and changed 400x350+483+431 to 300x300, and I've got a transparent black square at top left of my screen with no text, nor icon image

But with the -g 400x400+966+368, it does appear in the bottom right corner, as suppose to the top left image

NetMan134 commented 2 years ago

I managed to somewhat place it in the center with 200x200+483+184 (launched a white program to show lemonbar because this wallpaper is dark at just the center) ![image] (https://user-images.githubusercontent.com/46296255/179367365-a33a2997-f5b8-476e-9155-947775b5c7a6.png)

Edit: To not create new comments about the same thing, I'm doing an edit to the pre-existing one: I managed to figure out how this geometry works and it's in the center! But still, unfortunately no icon, no text, indicator. I've got all necessery dependencies and fonts installed. image

ibhagwan commented 2 years ago

This is the part of the script that determines the geometry based on screen dimensions: https://github.com/ibhagwan/lemontify/blob/ab1f6c100d00948e6d89a7bff75067c7cdc287fb/lemontify#L621-L629

Maybe you can try hard coding the center geometry you found at line 629 and try running the script like that?

NetMan134 commented 2 years ago

Yeah, I'm just looking at it, will give an update in a sec

ibhagwan commented 2 years ago

Yeah, I'm just looking at it, will give an update in a sec

Don’t worry, if you’re dedicated enough we’ll make it work :)

NetMan134 commented 2 years ago

It works! Still though, everything else is missing :I

https://user-images.githubusercontent.com/46296255/179367972-0e667ef9-7bd2-4ce9-9ab7-ea91936e9fdb.mp4

NetMan134 commented 2 years ago

I don't know why the screen recorder didn't record the switch to another workspace? Nonetheless it works.

ibhagwan commented 2 years ago

I don't know why the screen recorder didn't record the switch to another workspace? Nonetheless it works.

So does it work now or are the icons missing?

NetMan134 commented 2 years ago

Icons are missing, sorry for misunderstanding

ibhagwan commented 2 years ago

Did you adjust the fonts in the script to ones that exist in your machine?

Use fc-match to see if you have the right fonts or change the fonts (top of the script) to the ones you have installed:

# fc-match InputMonoNerdFont:pixelsize=26:Style:Bold
InputMono Bold Nerd Font Complete.ttf: "InputMono Nerd Font" "Bold"
# fc-match DejaVuSans:style:Bold:size=14 
DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"

Also try running without the multi line support just to see if this is the issue:

lemontify -p audio -l -v --debug
NetMan134 commented 2 years ago

It looks like I don't have a "Input Mono Nerd Font", cause the output says DejaVuSans, but all of the other Nerd Fonts appear in the gucharmap though

ibhagwan commented 2 years ago

It looks like I don't have a "Input Mono Nerd Font", cause the output says DejaVuSans, but all of the other Nerd Fonts appear in the gucharmap though

Why don’t you change line 24 to any random nerd font that’s installed on your laptop?

icon_font="JetBrainsMonoNerdFont"
NetMan134 commented 2 years ago

I just did that, modified the muted icon, changed temporarily to MaterialIcons font I use with polybar, and yet here it is! image

ibhagwan commented 2 years ago

I just did that, modified the muted icon, changed temporarily to MaterialIcons font I use with polybar, and yet here it is!

Wohoo! :)

Does it control the volume levels properly? Do the empty/full level squares show up as well? Did you also try controlling the brightness/backlight?

NetMan134 commented 2 years ago

1 - I guess I have to add it to my media keys bind in i3 config, because I didn't try that yet Edit: and this (probably, i guess?), has the connection to control audio/brightness? image

2 - No (not yet) 3 - Adnotation to 1

ibhagwan commented 2 years ago

1 - I guess I have to add it to my media keys bind in i3 config, because I didn't try that yet Edit: and this (probably, i guess?), has the connection to control audio/brightness?

Before you add this to your keybinds, make sure it works from the command line with debug prints and that the correct popup shows when you mute/unmute and increase/decrease volume

NetMan134 commented 2 years ago

When I do lemontify -p audio --inc 10 or --dec 10 or with -i/-d, i get error: unrecgonized option

NetMan134 commented 2 years ago

Oh nevermind, I had to put -s in the middle of --dec [here -s] <value>

NetMan134 commented 2 years ago

It did bring my audio level from 85% to 75% so it's working! Brightness also works

ibhagwan commented 2 years ago

It did bring my audio level from 85% to 75% so it's working! Brightness also works

Great :)

NetMan134 commented 2 years ago

I'm gonna have a break for now, I'll be back in a while

NetMan134 commented 2 years ago

I managed to achieve this: image Edit: I'm going to tweak it more later, midnight's coming, so that's it for today!

NetMan134 commented 2 years ago

Oh, and also you can use @DEFAULT_SINK@ in pactl instead of manually hard-coding sinks, you know - if in the meantime you're gonna change your output to speakers/headphones, and to make this piece of script work in a bit more obscure environments with external USB, or PCI audio cards

Thanks for the amazing help, Oskar

ibhagwan commented 2 years ago

I managed to achieve this:

Beautiful work!

Oh, and also you can use @DEFAULT_SINK@ in pactl instead of manually hard-coding sinks.

Good find! I never needed much modifications as long as it worked on my system and this isn’t really one of my most used projects.

Happy we managed achieved your goal.

NetMan134 commented 2 years ago

@ibhagwan Sorry to bother again, at line 570 echo "" | lemonbar -m 2>&1 | grep invalid verifying if your fork of lemonbar is installed, causes lemonbar to appear for a split second at the top of the screen, which in result arranges my bar and windows a bit, adding -d to lemonbar arguments there resolves this.

Edit: Also, are you considering adding a license? For this use case you can use primarily MIT or WTFPL, check out https://choosealicense.com/

Thank you, Oskar

ibhagwan commented 2 years ago

@ibhagwan Sorry to bother again, at line 570 echo "" | lemonbar -m 2>&1 | grep invalid verifying if your fork of lemonbar is installed, causes lemonbar to appear for a split second at the top of the screen, which in result arranges my bar and windows a bit, adding -d to lemonbar arguments there resolves this.

Good catch, doesn’t happen on AwesomeWM.

Edit: Also, are you considering adding a license? For this use case you can use primarily MIT or WTFPL, check out https://choosealicense.com/

Thank you, Oskar

I don’t think it’s needed, it’s been up for over 2 years you’re probably the only one who used it :)

NetMan134 commented 2 years ago

Ah, alright then!

NetMan134 commented 2 years ago

@ibhagwan Just one more thing, I forked this project and want to ask you if you permit me distributing it and changing the code, you know - I don't want to steal your property.

Thank you, Oskar

ibhagwan commented 2 years ago

@ibhagwan Just one more thing, I forked this project and want to ask you if you permit me distributing it and changing the code, you know - I don't want to steal your property.

Thank you, Oskar

Have at it @NetMan134, it’s all yours!