LemonBoy / bar

A featherweight, lemon-scented, bar based on xcb
MIT License
1.62k stars 194 forks source link

Added -o option for writing a startup message on stdout #195

Closed mavaa closed 7 years ago

mavaa commented 7 years ago

Not sure if you want this, or if this is a good implementation of what I want to accomplish;

Basically what I want to do is to run some code AFTER the bar has been initialized, more spesifically after the WM_NAME has been set and can be queried by other tools like baskerville/xdo. For instance the example code in bspwm forces the bar to go behind fullscreen windows by running a loop until you can get the window ID from the WM_NAME: https://github.com/baskerville/bspwm/blob/master/examples/panel/panel

I use nodejs to do basically the same (I can't do bash scripts for the life of me...), but I don't like having to do the while loop and check multiple times to see if the window is up or not. With this change I can have the parent process wait for lemonbar to print out "started\n" and then run the xdo code. It's working for me, but like I said, I'm not sure if this is the best way to implement this.

LemonBoy commented 7 years ago

Thanks for the PR but I'm goint to reject the changes as the use case is pretty specific and am not convinced it's going to be useful to someone else.

mavaa commented 7 years ago

No problem, I see your point :+1:

cpixl commented 7 years ago

@marza91: the following script can be set to bspc config external_rules_command before creating the bar to automagically handle its stacking layer:

#!/usr/bin/env bash

wid=$1
class=$2
instance=$3
name="$(xprop -id $wid WM_NAME | sed -n 's|.*"\(.*\)"$|\1|p')"

if [[ $name = bar ]]; then
  xdo below -t "$(xdo id -N Bspwm -n root)" "$wid"
fi

NOTE: Didn't test the script, but I'm pretty sure it should work as my current setup uses a similar script.

mavaa commented 7 years ago

Wow, that's even better than my current solution, didn't know about this feature. Thanks!