Created
December 21, 2022 13:24
-
-
Save anekos/9394dda8706ca535d9ecd1309f4e13de to your computer and use it in GitHub Desktop.
SDDM と GDM を切り替えるスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euC | |
# set -o pipefail | |
# exec 5>> /tmp/xmosh/shell-script-debug.out | |
# BASH_XTRACEFD="5" | |
# PS4='$LINENO: ' | |
# set -x | |
function sc() { | |
sudo systemctl "$@" | |
} | |
gdm_status="$( | |
systemctl is-active gdm ||: | |
)" | |
sddm_status="$( | |
systemctl is-active sddm ||: | |
)" | |
if [ "$gdm_status" = active ] | |
then | |
sc stop gdm | |
sleep 1 | |
sc start sddm | |
exit 0 | |
elif [ "$sddm_status" = active ] | |
then | |
sc stop sddm | |
sleep 1 | |
sc start gdm | |
exit 0 | |
fi | |
echo "Unknown state: gdm = ${gdm_status}, sddm = ${sddm_status}" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment