You are not logged in.
Hi,
I try to figure this out since hours... I'd really appreciate if someone could help me with my issue.
What I want to do:
I have a laptop with a docking station.
If I put it on the dock I want only the external monitor to be used.
And if I pull it off the dock I want only the internal monitor to be used.
Switching between this should work automatically.
I've tried to accomplish this with autorandr.
I created a "mobile" and a "dock" profile.
That seems to work perfectly fine. Automatically switching works great!
My problem:
The above approach only works if the Xserver is already running.
If I start it manually with startx, then my bspwm goes crazy.
I guess this is because it can't figure out which monitor to use.
What I've tried:
With autorandr --current I can list the currently active profile.
So I thought it would be smart to put the following in my bspwmrc:
autorandr -c
[...]
if [[ $(autorandr --current) == "dock" ]]; then
bspc monitor DP-2-2 -d 1 2 3 4 5 6 7 8 9 10
elif [[ $(autorandr --current) == "mobile" ]]; then
bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8 9 10
fiBut this doesn't work since autorandr --current also works only if the Xserver is already running.
And that's not the case when bspwm is launched from startx.
Any ideas?
Last edited by SpeedCola (2020-05-02 14:56:18)
Offline
But this doesn't work since autorandr --current also works only if the Xserver is already running.
And that's not the case when bspwm is launched from startx.
Yes, it is the case. The server starts first, then your xinitrc is read, then (presumably) bspwm is started from the xinitrc, and only then is the bspwmrc even read.
You have not defined what "doesn't work" means, nor have you described symptoms other that saying bspwm "goes crazy" which is not useful. I suspect you have it backwards, its not that autorandr tries to run too soon, but rather that it's too late: bspwm has already started. Put the autorandr commands in your xinitrc before bspwm.
I suspect `autorandr -c` in your xinitrc would be sufficient, then get rid of all of that from bspwmrc.
Last edited by Trilby (2020-05-02 13:53:03)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
lol yes you are right.
Indeed it works if I put "autorandr -c" in my ".xinitrc" file and just leave "bspc monitor -d 1 2 3 4 5 6 7 8 9 10" in the bspwmrc file...
Yes I didnt went into detail for the "bspwm goes crazy" because I already knew these errors are related to the autorandr thing.
But just for the protocol:
- Polybar didn't display my bspwm workspaces
- In bspwm I couldn't switch workspaces. If I go to workspace 2 I still have to windows from workspace 1 there and so on. It was like every workspace was stacked on each other.
hmm... I guess the problem is solved now.
Thank you very much! Didn't expect such a simple solution. ![]()
Offline
You're welcome. Please edit your first post which will allow you to prepend [SOLVED] to the title.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline