[solved] pop-up notifications (dunst, lemonbar, i3)

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

[solved] pop-up notifications (dunst, lemonbar, i3)

Unread post by rhowaldt » Wed Apr 22, 2015 12:02 am

hello my friends.

because it seems i3-bar won't let me update it whenever i change volume, it is thus not perfectly suiting my needs. so i decided to make a volume change popup with dunst. however, i run into a problem that i cannot find a solution for through Google. so, i come to you.

the simplest way to test dunst-commands is through the cli. but:

Code: Select all

[02:43:35]$ dunst "bla"
BadAccess (attempt to access private resource denied)
BadAccess (attempt to access private resource denied)
Unable to grab key "ctrl+grave"
Name Lost. Is Another notification daemon running?
so i check for another notification daemon, and all that is running is dunst itself.

when i try it with "sudo", it does work.
when i do notify-send "bla", it does work.

i have found out that on Bork! dunst is started through dbus:

Code: Select all

[02:03:30]$ cat /usr/share/dbus-1/services/org.knopwob.dunst.service 
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/bin/dunst
that is all the information i've been able to gather so far. i am still no closer to why it is throwing an error. from what i've read online people seem to say "dunst is a daemon, no need to start it" and give notify-send as an option to make it work. however, notify-send doesnt take the commandline options that dunst does, which i want to use... am i missing something here?
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: dunst (on Bork!)

Unread post by pidsley » Wed Apr 22, 2015 12:54 am

I can't help with dunst (dkeg should be along shortly) but osd_cat can be used as a nice on-screen volume display.

http://linuxbbq.org/bbs/viewtopic.php?f ... vol#p18826
http://linuxbbq.org/bbs/viewtopic.php?f ... vol#p27466

(requisite asshole pidsley comment) -- I don't really "get" volume level in a status bar, and definitely don't understand running another daemon process (dunst) to see volume level. Can't you tell how loud it is by, um, how loud it is? Sorry if that's too snarky; I'm just puzzled.

Maybe it would be better to address the problems you are having with i3bar?

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: dunst (on Bork!)

Unread post by dkeg » Wed Apr 22, 2015 1:02 am

rho, try with just plain old

Code: Select all

notify-send blah
Edit: you also need dbus and dbus-x11, and I believe libnotify

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 3:59 am

What the bros said above, dunst is just broadcasting what it gets from notify-send. The command 'dunst "whatever"' will fail, because dunst interprets "whatever" as option, but not as what it should display. So, feed notify-send.

Code: Select all

notify-send `amixer get PCM | sed -ne '/Front Left/s/.*\[\(.*\)%\].*/\1/p'` 
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: dunst (on Bork!)

Unread post by rhowaldt » Wed Apr 22, 2015 11:24 am

pids, thanks for osd_cat option, will look into that.

drew & jules: thanks, that means what i want is probably not possible with dunst. will look into osd_cat instead.
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 12:25 pm

rho, just use the line I wrote there and put it into the osd_vol script (replacing the osd_cat line), and you have dunst doing what you want (I suppose: showing the actual volume of the PCM or Master channel)

Looks like this by default:
rholume.png
rholume.png (5.09 KiB) Viewed 7707 times
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: dunst (on Bork!)

Unread post by dkeg » Wed Apr 22, 2015 12:46 pm

Sorry rho, I don't think I was totally coherent when I read your post.
What is it you want to do exactly?

Work hard; Complain less

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: dunst (on Bork!)

Unread post by wuxmedia » Wed Apr 22, 2015 1:21 pm

^ Bacon's sorted it, unless Rhow wants a vol icon, maybe just put vol wheel on it. was that not already on bork?
pidsley comment wrote:I don't really "get" volume level in a status bar, and definitely don't understand running another daemon process (dunst) to see volume level. Can't you tell how loud it is by, um, how loud it is? Sorry if that's too snarky; I'm just puzzled.
I know what you mean, I don't have/need one.
But imagine you have 2 volume controls, one on the 'amp' and one on the computer.
Someone comes and turns the volume down on the computer (youtube too loud), so someone else comes along later and turns it up on the amp, because its quiet. they have to turn the amp up all the way, as the cpu is half vol. Now it sounds all hissy and over-amped, then you reboot and hurt your ears after the vol is reset.

I get the same thing using mocp which controls all the sound. (now i just use the lappy media keys bound to alsamixer)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: dunst (on Bork!)

Unread post by dkeg » Wed Apr 22, 2015 1:33 pm

Right pidsley, the problem with dunst is it spawns dbus. There are several ways to spit out volume level without an extra process.

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 1:38 pm

wux, For these cases (volume reset after reboot), there's alsactl store/restore function. The file in which the volume settings are saved is /var/lib/alsa/asound.state

But yup, there's volumeicon-alsa, which should - if added in .xinitrc as 'volumeicon &' before the exec line of the WM - show in i3. It's even preconfigured to open 'x-terminal-emulator -e alsamixer' for the preferences, provided the ~/.config/volumeicon/volumeicon wasn't altered or removed.
..gnutella..

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 1:46 pm

drew, I think dbus isn't required for dunst. I have started a session now with a simple 'exec WM' (without dbus-launch) and dunst works. I even removed older .dbus session files and flushed the sockets:

Code: Select all

user@grill:~$ dbus-cleanup-sockets 
Cleaned up 0 sockets in /tmp; 0 sockets are still in use; 0 in unknown state
user@grill:~$ notify-send test
user@grill:~$ 
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: dunst (on Bork!)

Unread post by rhowaldt » Wed Apr 22, 2015 1:46 pm

pids, didnt notice your snarky comment ;)
you are right, i might be going about this entirely wrong and inefficient.
the reason i want a volume level is mainly so i have less risk of having my volume really loud when i dont want it to be that loud. my GF goes to bed about 2-3 hours before i do, and i watch films and listen to music during that time and dont want to wake her up with loud shit, so i'd rather know the level beforehand. that is why i figured that maybe a popup thing would be nice, and considered it a challenge to find out how to make it. indeed, i can just query amixer and pipe it to i3bar as i have been doing until now. i just thought i was doing something wrong with dunst that it didnt work, but turns out i want it to do things that it can't, such as using a different config file for a different notification (dunst -c /home/rhowaldt/dunstconfigvolume, for example).

so all things considered, i think if i want a simple notification of the volume level, Jules' idea works. if i want an actual bar, osd_cat works. otherwise, i3bar still displays my current level, and when i change it updates within 3 seconds to reflect the new one. this is probably fine for me. it was more an experiment than an actual need.
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: dunst (on Bork!)

Unread post by GekkoP » Wed Apr 22, 2015 1:50 pm

Wouldn't it be simpler to use headphones?

(joking)

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: dunst (on Bork!)

Unread post by rhowaldt » Wed Apr 22, 2015 1:51 pm

^ true :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 1:53 pm

If I understand you correctly, you want the volume level to be shown all the time in the bar, and actually not (just) as popup when the volume is being changed. I just ask myself (sorry to be thick as a brick), what dunst should actually do there. What should dunstconfigvolume do? Display the volume change in another color?

Is volumeicon-alsa not good for you? :)
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: dunst (on Bork!)

Unread post by rhowaldt » Wed Apr 22, 2015 1:56 pm

nah, didnt explain it very well i suppose. i have it in i3bar now permanently, which works. but because i3bar doesnt update with every change to the volume, but rather every 3 seconds (tried setting it to 1 secs, seemed slower and felt a bit pointless to have that just for those cases i change the damn volume), i figured it would be nicer to be able to have a popup notification instead.

volumeicon-alsa? i dont do icons, but yeah, that would probably work as well :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Wed Apr 22, 2015 2:03 pm

Oh I see, it does make sense now!

Do the volumeicon, good Sir! It even handles keyboard hotkeys. And White Gnome as icon looks delicious.
Attachments
volumeicon.png
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: dunst (on Bork!)

Unread post by dkeg » Thu Apr 23, 2015 1:03 am

machinebacon wrote:drew, I think dbus isn't required for dunst. I have started a session now with a simple 'exec WM' (without dbus-launch) and dunst works. I even removed older .dbus session files and flushed the sockets:
Not required as in a dependency of, but rather required as in it won't work without dbus dbus-x11 installed. Example is used to have dbus and used dunst on this install. Got rid of dbus, now dunst won't work. No errors, just now notification. My experience is that does not need to be running, but after launch of dunst, dbus-daemon and dbus-launch both run.

So with no dbus running, and you call dunst, check your pstree. Is dbus now running?

On a side note, I admit I do not fully understand what exactly dbus does. And wierdly applications would spawn dbus, and since I've purged both dbus and dbus-x11, those applications continue to run no problem. So why did they spawn dbus then? Made me hate it even more, and happier I got rid of it.

Back to the topic. Rho, you can create popup notifications with lemonbar, which spawns no process, and as such long ago replaced dunst with it. Also you can get rid of i3-bar, replace with conky or lemonbar and have more real-time stats. I have my script update every 0.5 second.

I see you found a solution, but I was at work and for sure wasn't going to type this on a phone.

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: dunst (on Bork!)

Unread post by machinebacon » Thu Apr 23, 2015 3:57 am

Drew, you are right. dunst needs dbus to get the info that is sent over dbus /if an application makes use of the dbus (as a unified system)/, but it does work without it if somebody send info to dunst via some kind of notification daemon (which does not necessarily need dbus, like a pipe, for example). Of course dbus/dbus-x11 is a load of shit. One of these org.freedesktop.rapeyourdesktop things that were the starting point for other great inventions like pam, policykit, udev or ... yup, I don't even mention certain init system.
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: dunst (on Bork!)

Unread post by rhowaldt » Thu Apr 23, 2015 9:04 am

@drew: thanks for the lemonbar tip, will look into that!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

Post Reply