I3wm not showing brightness notification

Hello,
I was wondering why nothing was being shown while I change my brightness. I found out this line:

bindsym XF86MonBrightnessUp exec xbacklight +5 && notify-send "Brightness - ${$(xbacklight -get)%.*}%" 
bindsym XF86MonBrightnessDown exec xbacklight -5 && notify-send "Brightness - ${$(xbacklight -get)%.*}%" 

But when I ran notify-send "Brightness - ${$(xbacklight -get)%.*}%" in terminal
I got this:
bash: Brightness - ${$(xbacklight -get)%.*}%: bad substitution
In fish shell it showed this:

fish: ${ is not a valid variable in fish.
notify-send "Brightness - ${$(xbacklight -get)%.*}%"

How should it be fixed?

That command works in zsh, although the syntax is new to me :sweat_smile:

Did you get this in endeavour os i3wm?

Use this command

notify-send "Brightness - $(xbacklight -get | cut -d'.' -f1-1)%"

This should work in bash.

1 Like

@hyper-dot You can blame me for the bug. I had added this functionality in a pull request here. Try now. This should work in both bash and zsh. Perhaps @joekamprad can fix this in the default i3 config.

notify-send "Brightness - $(xbacklight -get | cut -c1-2)%"
1 Like

give me a hint or do a PR if there is something I should change… i can not test this here.

1 Like

Let’s wait for the OP to verify if this works on their system or not.


@hyper-dot

#replace these
bindsym XF86MonBrightnessUp exec xbacklight +5 && notify-send "Brightness - ${$(xbacklight -get)%.*}%" 
bindsym XF86MonBrightnessDown exec xbacklight -5 && notify-send "Brightness - ${$(xbacklight -get)%.*}%" 

#by these
bindsym XF86MonBrightnessUp exec xbacklight +5 && notify-send "Brightness - $(xbacklight -get | cut -c1-2)%"
bindsym XF86MonBrightnessDown exec xbacklight -5 && notify-send "Brightness - $(xbacklight -get | cut -c1-2)%"
3 Likes

Hi @flyingcakes @ishaanbhimwal @joekamprad @ishaanbhimwal Everyone’s solution worked. Thank you so much. :grinning:

no problem :sweat_smile:

@joekamprad

1 Like

@ishaanbhimwal It’s kind of wierd that everytime I change brightness it shows up new notification and only 5 notification are shown and rest are hidden. Instead of showing notification I added a module in my bar.

yea i had the same with the value implementation… where we have a % shown in the bar too …

1 Like

Yeah it’s better.

or dunst need sto be set up to not hold the notifications … would be more like it needs osd and not dunst itself ?

Can you try with this:

bindsym XF86MonBrightnessUp exec xbacklight +5 && killall dunst && notify-send "Brightness - $(xbacklight -get | cut -c1-2)%"
bindsym XF86MonBrightnessDown exec xbacklight -5 && killall dunst && notify-send "Brightness - $(xbacklight -get | cut -c1-2)%"

Yes that’s seems to be a better approach. I had sent this pr some time ago for integrating a backlight module in i3blocks. Enabling this was meant to be optional though.

1 Like

Sorry If you felt bad about what I said. It’s awesome. I didn’t thought of killing dnust.
It was my lack of knowledge.
:grinning:

sadly… that got lost between the parts I didn’t want to integrate…

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.