phillipberndt / autorandr

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr
2.51k stars 124 forks source link

~/.config/autorandr/postswitch doesn't execute when profile has postswitch #356

Open alirezaalavi87 opened 1 year ago

alirezaalavi87 commented 1 year ago

Hi, thanks for the great project.

I have a ~/.config/autorandr/postswitch with the content:

#!/bin/bash

i3-msg "restart"
notify-send -i video-display-symbolic.symbolic "Display profile" "$AUTORANDR_CURRENT_PROFILE"
killall conky
conky --quiet --daemonize && conky --quiet --daemonize -c $HOME/.config/conky/Rischa/Rischa.conf

notify-send "TEEEEEEEEST"

and a postswitch in my profile ~/.config/autorandr/office/postswitch with content:

#!/bin/bash

bluetooth on
i3-msg "exec --no-startup-id lmc"
notify-send "office postswitch"

when I use this profile, first file doesn't get executed and only the second file gets executed. is this the default behaviour? how can I have a script that always gets executed?

proudhon commented 1 year ago

Same problem here but with configuration-specific postswitch scripts (i.e. .config/autorandr/profile1/postswitch) The weirdest thing is that if I manually run the script once it then gets executed all the times with no problem.

gjcooper commented 4 months ago

I think that is the expected (documented behaviour). From the README

As a concrete example, suppose you have the files

/etc/xdg/autorandr/postswitch
~/.config/autorandr/postswitch
~/.config/autorandr/postswitch.d/notify-herbstluftwm
~/.config/autorandr/docked/postswitch

and switch from mobile to docked. Then ~/.config/autorandr/docked/postswitch is executed, since the profile specific configuration takes precedence, and ~/.config/autorandr/postswitch.d/notify-herbstluftwm is executed, since it has a unique name.

If you switch back from docked to mobile, ~/.config/autorandr/postswitch is executed instead of the docked specific postswitch.