Commit a8393397 authored by root's avatar root
Browse files

Improve desktop toggling

parent 304caf8b
......@@ -954,8 +954,18 @@ function jobs ()
--yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?;
if [[ $exitstatus = 0 ]]; then
service lightdm stop >/dev/null 2>&1 && systemctl disable lightdm.service >/dev/null 2>&1
service nodm stop >/dev/null 2>&1 && systemctl disable nodm.service >/dev/null 2>&1
function stop_display()
{
bash -c "service lightdm stop >/dev/null 2>&1
systemctl disable lightdm.service >/dev/null 2>&1
service nodm stop >/dev/null 2>&1
systemctl disable nodm.service >/dev/null 2>&1"
}
if xhost >& /dev/null ; then
stop_display &
else
stop_display
fi
fi
else
if ! is_package_manager_running; then
......@@ -981,6 +991,8 @@ function jobs ()
ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service >/dev/null 2>&1
service lightdm start >/dev/null 2>&1
fi
# kill this bash script after desktop is up and if executed on console
[[ $(tty | sed -e "s:/dev/::") == tty* ]] && kill -9 $$
fi
fi
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment