DelusionalLogic / bard

System for managing lemonboy bar
GNU General Public License v3.0
11 stars 2 forks source link

DBus listener not working (I think?) #8

Closed SevereOverfl0w closed 7 years ago

SevereOverfl0w commented 7 years ago

I don't seem to be having much luck with the DBus listener for monitor events. I might be removing screens incorrectly or similar though.

For example, today I removed my attached screen (and only used my laptop), and now I have a lemonbar which is oversized for my screen.

I connect/disconnect monitors via xrandr, this might be what I'm doing wrong, so I'm just asking to double check how this feature is supposed to work?


A related feature might be to have a way to force a manual refresh, similar to how nginx used to respond to HUP as a signal it should reload.

DelusionalLogic commented 7 years ago

The dbus feature is actually a dbus server. You need to manually message it whenever you use randr.

I don't think there's any system service that fires a dbus event on randr automatically, if there is I'd be happy to know about it. What I have is a script that fires a dbus event to bard, making it reload, when I fiddle with randr.

If you want to see what's available you can inspect the dk.slashwin.bard session bus with d-feet.

Basically what you propose is already what the dbus server is. It's a way to manually restart lemonbar within bard.

SevereOverfl0w commented 7 years ago

I've not had much luck using dbus directly:

❯ dbus-send --session --dest='dk.slashwin.bard' /dk/slashwin/bard/ dk.slashwin.bard.BarReload
process 5822: arguments to dbus_message_new_signal() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1456.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace
zsh: abort (core dumped)  dbus-send --session --dest='dk.slashwin.bard' /dk/slashwin/bard/ 

❯ dbus-send --session --dest='dk.slashwin.bard' /dk/slashwin/bard/ dk.slashwin.bard.Reload   
process 5908: arguments to dbus_message_new_signal() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1456.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace
zsh: abort (core dumped)  dbus-send --session --dest='dk.slashwin.bard' /dk/slashwin/bard/ 

https://www.x.org/releases/X11R7.7/doc/man/man3/xcb_randr_screen_change_notify_event_t.3.xhtml this appears to be a way to listen for randr screen changes, could this be a good event to listen for reloads?

SevereOverfl0w commented 7 years ago

Oops, I just realised I just can't use dbus-send. d-feet has an execute, that works for me.


dbus-send --session --print-reply --dest='dk.slashwin.bard' '/dk/slashwin/bard' dk.slashwin.bard.BarReload

This was the working command for me.

DelusionalLogic commented 7 years ago

Glad it worked. I guess the trailing slash matters.

I debated setting up an X event loop, to catch randr events, but decided against it because of the inflexibility. I thought that a dbus event, that the user could fire whenever they felt like it, would be much more powerful.

Since it's working I'm going to close this.