Closed sillen102 closed 5 years ago
Just to be clear when I connect my monitor it is initialized and set up correctly as it should in the profile. It's just the postswitch that isn't executed.
Does executing the script manually work? In line 974,
all_ok &= subprocess.call(script, env=env) != 0
try prepending a line
print("Command: ", script, " Env: ", env)
and share the output, please.
Command: /etc/xdg/autorandr/predetect Env: {'COLORTERM': 'truecolor', 'GDMSESSION': 'i3-with-shmlog', 'LANG': 'sv_SE.UTF-8', 'TERM': 'xterm-termite', 'LC_IDENTIFICATION': 'sv_SE.UTF-8', 'WINDOWID': '35651587', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/silvio', 'LC_MEASUREMENT': 'sv_SE.UTF-8', 'DESKTOP_SESSION': 'i3-with-shmlog', 'USER': 'silvio', 'XDG_SESSION_PATH': '/org/freedesktop/DisplayManager/Session0', 'HOME': '/home/silvio', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'XDG_VTNR': '7', 'XDG_SEAT': 'seat0', 'LC_NUMERIC': 'sv_SE.UTF-8', 'MAVEN_OPTS': '-Xmx512m', '_': '/usr/bin/autorandr', 'GTK_MODULES': 'canberra-gtk-module', 'VTE_VERSION': '5402', 'XDG_SESSION_DESKTOP': 'i3-with-shmlog', 'BROWSER': '/usr/bin/firefox', 'LC_TIME': 'sv_SE.UTF-8', 'MAIL': '/var/spool/mail/silvio', 'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0', 'LOGNAME': 'silvio', 'LC_PAPER': 'sv_SE.UTF-8', 'PATH': '/home/silvio/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl', 'XDG_RUNTIME_DIR': '/run/user/1000', 'CALIBRE_USE_SYSTEM_THEME': '1', 'XDG_SESSION_ID': '2', 'SHELL': '/bin/zsh', 'LC_MONETARY': 'sv_SE.UTF-8', 'GTK2_RC_FILES': '/home/silvio/.gtkrc-2.0', 'LC_TELEPHONE': 'sv_SE.UTF-8', 'EDITOR': '/usr/bin/vim', 'XDG_SESSION_TYPE': 'x11', 'QT_QPA_PLATFORMTHEME': 'qt5ct', 'PWD': '/home/silvio', 'XAUTHORITY': '/home/silvio/.Xauthority', 'MOZ_PLUGIN_PATH': '/usr/lib/mozilla/plugins', 'SHLVL': '2', 'DISPLAY': ':0', 'XDG_SESSION_CLASS': 'user', 'LC_NAME': 'sv_SE.UTF-8', 'LC_ADDRESS': 'sv_SE.UTF-8', 'OLDPWD': '/home/silvio/work/autoliv/src/processing', 'ZSH': '/home/silvio/.oh-my-zsh', 'PAGER': 'less', 'LESS': '-R', 'LC_CTYPE': 'sv_SE.UTF-8', 'LSCOLORS': 'Gxfxcxdxbxegedabagacad', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'}
Command: /home/silvio/.config/autorandr/docked-work/preswitch Env: {'COLORTERM': 'truecolor', 'GDMSESSION': 'i3-with-shmlog', 'LANG': 'sv_SE.UTF-8', 'TERM': 'xterm-termite', 'LC_IDENTIFICATION': 'sv_SE.UTF-8', 'WINDOWID': '35651587', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/silvio', 'LC_MEASUREMENT': 'sv_SE.UTF-8', 'DESKTOP_SESSION': 'i3-with-shmlog', 'USER': 'silvio', 'XDG_SESSION_PATH': '/org/freedesktop/DisplayManager/Session0', 'HOME': '/home/silvio', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'XDG_VTNR': '7', 'XDG_SEAT': 'seat0', 'LC_NUMERIC': 'sv_SE.UTF-8', 'MAVEN_OPTS': '-Xmx512m', '_': '/usr/bin/autorandr', 'GTK_MODULES': 'canberra-gtk-module', 'VTE_VERSION': '5402', 'XDG_SESSION_DESKTOP': 'i3-with-shmlog', 'BROWSER': '/usr/bin/firefox', 'LC_TIME': 'sv_SE.UTF-8', 'MAIL': '/var/spool/mail/silvio', 'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0', 'LOGNAME': 'silvio', 'LC_PAPER': 'sv_SE.UTF-8', 'PATH': '/home/silvio/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl', 'XDG_RUNTIME_DIR': '/run/user/1000', 'CALIBRE_USE_SYSTEM_THEME': '1', 'XDG_SESSION_ID': '2', 'SHELL': '/bin/zsh', 'LC_MONETARY': 'sv_SE.UTF-8', 'GTK2_RC_FILES': '/home/silvio/.gtkrc-2.0', 'LC_TELEPHONE': 'sv_SE.UTF-8', 'EDITOR': '/usr/bin/vim', 'XDG_SESSION_TYPE': 'x11', 'QT_QPA_PLATFORMTHEME': 'qt5ct', 'PWD': '/home/silvio', 'XAUTHORITY': '/home/silvio/.Xauthority', 'MOZ_PLUGIN_PATH': '/usr/lib/mozilla/plugins', 'SHLVL': '2', 'DISPLAY': ':0', 'XDG_SESSION_CLASS': 'user', 'LC_NAME': 'sv_SE.UTF-8', 'LC_ADDRESS': 'sv_SE.UTF-8', 'OLDPWD': '/home/silvio/work/autoliv/src/processing', 'ZSH': '/home/silvio/.oh-my-zsh', 'PAGER': 'less', 'LESS': '-R', 'LC_CTYPE': 'sv_SE.UTF-8', 'LSCOLORS': 'Gxfxcxdxbxegedabagacad', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:', 'AUTORANDR_CURRENT_PROFILE': 'docked-work', 'AUTORANDR_PROFILE_FOLDER': '/home/silvio/.config/autorandr/docked-work', 'AUTORANDR_MONITORS': 'eDP1:DP3'}
Failed to apply profile 'docked-work' (line 958):
Failed to execute user command: /home/silvio/.config/autorandr/postswitch (line 958)
I have two scripts. One "master" postswitch that is located in the ~/.config/autorandr folder that lookes like this:
#!bin/bash` -x
# Restore wallpaper
nitrogen --restore
And one located in the folder for the profile (that I've pasted in my first post).
I tried removing the one in the ~/.config/autorandr folder. And the message then is that the one in the profile folder couldn't be executed instead.
Hmm. Weird that there's no additional Command
line saying that postswitch
will be executed. Anyway: Could it just be that the script is executed and it's just that nitrogen --restore
returns with a non-zero exit code?
No, it's not running because the workspaces aren't being moved between the monitors in i3wm either. I tried adding a command like: echo "something"
before everything else as the first command, but that didn't work either.
The weird part is also that the error message says that the profile failed to apply, when clearly it has been applied. The external monitor is initialized, switched on and set up correctly to the left of my laptop's internal monitor.
I also just now tried two more things:
Failed to apply profile 'docked-work' (line 968):
Failed to execute user command: /home/silvio/.config/autorandr/postswitch (line 968)
The weird part is also that the error message says that the profile failed to apply, when clearly it has been applied.
Executing the hooks is part of the process of applying the profile. If that fails, autorandr considers applying the profile to have failed.
You didn't respond to that part earlier, so let me ask again: If you run /home/silvio/.config/autorandr/postswitch
manually then that works? I also notice that you have a trailing '`' in your pasted code above.
(Other than that, I'm out of ideas right now.)
Hmm it didn't work to just run the script. I figured out that I had made a typo in the first line defining the interpreter. There was a '/' missing. It seems to be working now. Thanks for the help!
I'm having the same problem. I have two configurations: one with my external monitor plugged in and one without.
No matter how much I have tried, the postswitch
script is not executed when I disconnect the external monitor or plug it back in again.
This is the content of the script:
#!/bin/sh
echo "$AUTORANDR_CURRENT_PROFILE" > ~/.temp
echo "$AUTORANDR_MONITORS" >> ~/.temp
killall conky
am-conky-session
As you can see, I am writing to a file as a way to check if the script ran or not and everytime I check the file does not exist
I figured out the problem was that this program does not run automatically by itself when a display change occurs. Fortunately, there was already a c
script in the in the contrib folder which already attempts to relaunch the program once such a change was detected. I took the liberty of turning that script into it's own project, and this is currently what I am using to now fully automate the entire process.
Check it out here: https://github.com/smac89/autorandr-launcher
I was trying to set up a postswitch but can't get it running.
The script is placed in ~/.config/autorandr/docked-work/ // docked-work is my profile name
When connecting nothing happens. So I tried to manually load the profile and got the following error:
This is what my postswitch script lookes like:
The script is also made executable.