Skip to content

Instantly share code, notes, and snippets.

@anekos
Created December 21, 2022 13:24
Show Gist options
  • Save anekos/9394dda8706ca535d9ecd1309f4e13de to your computer and use it in GitHub Desktop.
Save anekos/9394dda8706ca535d9ecd1309f4e13de to your computer and use it in GitHub Desktop.
SDDM と GDM を切り替えるスクリプト
#!/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