Mailinglist Archive: opensuse-factory (188 mails)

< Previous Next >
[opensuse-factory] Start displaymanager only if monitor is connected
I have built a HTPC on Tumbleweed, that I use either for watching
movies using Kodi or listen to music using mpd. I have enabled
autologin so that the PC boots up without having to give the password.
When I want to just listen to songs, I boot the PC without the monitor
switched on. Next time I boot the PC with monitor switched on, the
plasma desktop icon placement gets screwed up. The clock applet, the
weather applet goes almost to the center instead of my preferred
placement on the right side of the monitor. The only thing that works
is to have autologin turned off in /etc/sysconfig/displaymanager. But
this defeats the purpose of automatically logging in when the monitor
is switched on.

So I was thinking of a way the boot process can boot in runlevel 3 if
monitor is not switched on. I found a way to detect this by installing
the application monitor-get-edid. This program returns 0 if monitor is
connected and switched on. It returns 1 if the monitor is not switched
on. But I have not figured out a way to boot to graphical target
automatically when monitor is switched on and boot to
multi-user.target when monitor is switched off. So I have given up on
the runlevel switching idea. Now I am thinking of another way to do
it. Write a systemd service script that calls monitor-get-edid and
runs the following script

#!/bin/sh
/usr/sbin/monitor-get-edid > /dev/null 2>&1
if [ $? -eq 0 ] ; then
sed -i
's}.*DISPLAYMANAGER_AUTOLOGIN=.*}DISPLAYMANAGER_AUTOLOGIN="mbhangui"}g'
/etc/sysconfig/displaymanager
else # comment out DISPLAYMANAGER_AUTOLOGIN
sed -i
's}.*DISPLAYMANAGER_AUTOLOGIN=.*}#DISPLAYMANAGER_AUTOLOGIN="mbhangui"}g'
/etc/sysconfig/displaymanager
fi

Now how do I run this script before graphical.target ?
Alternatively, is there a way that the graphical.target can wait
forever wait till monitor-get-edid returns 0
--
Regards Manvendra - http://www.indimail.org
GPG Pub Key
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC7CBC760014D250C
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >