5 # Email : hayao@fascode.net
7 # (c) 2019-2021 Fascode Network.
11 # LICENSE: THE SUSHI-WARE LICENSE
12 # https://github.com/MakeNowJust/sushi-ware
16 # https://qiita.com/laikuaut/items/4bc07eabce56ee30812d
17 # https://qiita.com/t_nakayama0714/items/80b4c94de43643f4be51
20 echo "usage: dmc [options] [command]"
22 echo "A simple tool for switching LightDM Greeters"
24 echo " LightDM command:"
25 echo " autologin [username] [session] Set up automatic login (with blank username to disable)"
26 echo " greeter Run greeter setup wizard"
27 echo " greeter-create [file] Set the specified executable file as Greeter"
28 echo " greeter-change [greeter] Specify the greeter to use"
29 echo " greeter-edit [greeter] Edit the greeter configs"
30 echo " greeter-list Show a list of currently installed Greeters"
31 echo " remove Removes all changes made by this command"
32 echo " edit Edit lightdm config"
33 echo " show-config Show current settings"
36 echo " autologin [username] [session] Set up automatic login (with blank username to disable)"
37 echo " cursor Run cursor selection wizard"
38 #echo " cursor-change [cursor] Specify the cursor theme"
39 echo " cursor-list Show a list of cursor theme"
40 echo " sound [true or false] Toggle the sound when an event occurs"
41 echo " logo [image] Specify the logo of the login screen"
42 echo " tap [true or false] Toggle whether to recognize the tap as a click"
43 echo " accessibility [true or false] Toggle whether to show accessibility menu"
44 echo " root-login [true or false] Toggle whether to enable root login"
46 echo " Webkit2 command:"
47 echo " theme Run theme selection wizard"
48 echo " theme-change [theme] Specify the theme"
50 echo " Qtquick command:"
51 echo " back Specify the background image"
53 echo " General option:"
54 echo " -m | --mode Specifiy the target you want to set"
55 echo " -e | --editer Specifiy the editor to use for editing"
56 echo " -h | --help This help message and exit"
57 echo " --non-interactive Run in non-interactive mode"
58 echo " --noroot No check root permission"
59 echo " --write-all-files Allows rewriting of all configuration files"
61 echo " Supported modes:"
62 echo " Display managers: lightdm, gdm"
63 echo " LightDM greeters: webkit2, qtquick"
81 if [[ "${NOROOT}" = false ]] && (( "${UID}" != 0 )); then
82 msg_error "You have to run as root"
90 #if (( "$(expr "${1}" + 1 >/dev/null 2>&1; printf "${?}")" < 2 )); then
91 if printf "${1}" | grep -E "^[0-9]+$" 1>/dev/null 2>&1; then
101 if [[ -n "${1}" ]] && ([[ "${1}" = "true" ]] ||[[ "${1}" = "false" ]]); then
110 local _command="${1}"
112 if which "${_command}" >/dev/null 2>&1; then
113 $(which "${_command}") ${*}
115 msg_error "${_command} was not found"
132 # 参考: https://wiki.archlinux.jp/index.php/%E3%82%AB%E3%83%BC%E3%82%BD%E3%83%AB%E3%83%86%E3%83%BC%E3%83%9E
133 # 参考: https://wiki.archlinux.jp/index.php/GDM
134 #echo "Searching cursor themes..." 1>&2
135 local _dir _cursor_theme_dir_list _find_cursor_dir_list=("/usr/share/icons" "${HOME}/.local/share/icons" "${HOME}/.icons")
136 for _dir in "${_find_cursor_dir_list[@]}"; do
137 if [[ -d "${_dir}" ]]; then
138 _cursor_theme_dir_list=($(find "${_dir}" -type d -name "cursors" | xargs -i dirname {} | sort))
142 local _cursor_theme _cursor_theme_name _temp
143 for _cursor_theme in "${_cursor_theme_dir_list[@]}"; do
144 _temp+=("$(cat "${_cursor_theme}/cursor.theme" 2> /dev/null | grep -E "^Name=" | sed "s|^Name=||g")")
145 if [[ -z "${_temp}" ]]; then
146 _cursor_theme_name+=("$(basename "${_cursor_theme}")")
149 echo "${_cursor_theme_name[@]}"
152 #== LightDM用の汎用関数 ==#
154 lightdm_get_source_file(){
156 local source_name="$(lightdm --show-config 2>&1 | grep -E "^[A-Z] ${key}=" | cut -d ' ' -f 1)"
157 local source_path="$(lightdm --show-config 2>&1 | grep -x -A "$(lightdm --show-config 2>&1 | wc -l)" "Sources:" | grep -xv "Sources" | grep -E "^${source_name} " | sed "s|^${source_name} ||g")"
158 if [[ -n "${source_path}" ]]; then
159 echo -n "${source_path}"
167 lightdm_set_config(){
168 local key="${1}" value="${2}" file=${3-${LIGHTDM_CONFIG}}
169 if [[ "${WRITE_ALL_FILES}" = true ]] && [[ -n "$(lightdm_get_source_file "${1}")" ]]; then
170 crudini --set "$(lightdm_get_source_file "${1}")" 'Seat:*' "${1}" "${2}"
172 crudini --set "${file}" 'Seat:*' "${1}" "${2}"
175 if [[ ! "$(lightdm_get_value "${1}")" = "${2}" ]]; then
176 msg_error "Failed to change the setting value. A value has already been set for $(lightdm_get_source_file "${1}")"
177 msg_error "lightdm-config does not manipulate other configuration files for safety. Comment out the settings in that file."
182 lightdm_remove_key(){
183 local key="${1}" _config
184 if cat "${LIGHTDM_CONFIG}" | grep -E "^ ?${key}.+" > /dev/null; then
185 sed -i -r "s|^ ?${key} ?=.+||g" "${LIGHTDM_CONFIG}"
186 sed -i '/^$/d' "${LIGHTDM_CONFIG}"
191 lightdm_init_configs(){
193 if [[ ! -f "${LIGHTDM_CONFIG}" ]]; then
194 mkdir -p "$(dirname "${LIGHTDM_CONFIG}")"
195 touch "${LIGHTDM_CONFIG}"
196 echo "[Seat:*]" > "${LIGHTDM_CONFIG}"
202 local _current_value="$(lightdm --show-config 2>&1 | grep -E "^[A-Z] ${1}=" | sed "s|^[A-Z] ||g" | cut -d "=" -f "2")"
203 if [[ "${_current_value}" ]]; then
204 echo -n "${_current_value}"
214 command_lightdm_greeter_change() {
216 if [[ -z "${1}" ]]; then
217 msg_error "Please specify Greeter."
222 # 指定されたGreeterが正しいか確認
223 if ! printf "%s\n" "${LIGHTDM_GREETERS[@]}" | grep -x "${1}" > /dev/null 2>&2; then
224 msg_error "The greeter (${1}) doesn't exist."
227 lightdm_set_config "greeter-session" "${1}"
232 command_lightdm_greeter_create(){
233 if [[ -z "${1}" ]]; then
234 msg_error "Please specify Greeter."
238 if [[ ! -f "${1}" ]]; then
239 msg_error "${1} does not exist."
243 if [[ ! -x "${1}" ]]; then
244 msg_error "hoge is not an executable file."
250 local filename="$(basename "${1}")"
252 if [[ -f "/usr/share/xgreeters/${filename}.desktop" ]]; then
253 msg_error "Greeter with the same name already exists."
256 cat > "/usr/share/xgreeters/${filename}.desktop" <<EOF
258 Name=LightDM custom Greeter ${filename}
259 Comment=LightDM Greeter
266 command_lightdm_greeter_list() {
267 echo "Available Lightdm greeter list:"
269 for _greeter in "${LIGHTDM_GREETERS[@]}"; do
270 if [[ "${_greeter}" = "${LIGHTDM_CURRENT_GREETER}" ]]; then
271 echo " * ${_greeter}"
279 run_greeter_wizard(){
281 if (( ${#LIGHTDM_GREETERS[@]} < 1 )); then
282 msg_error "LightDM Greeter was not found."
288 echo "Please select the greeter to use."
289 for (( _c=1; _c<=${#LIGHTDM_GREETERS[@]}; _c++)); do
290 _greeter="${LIGHTDM_GREETERS[$(( _c - 1 ))]}"
291 if [[ "${_greeter}" = "${LIGHTDM_CURRENT_GREETER}" ]]; then
292 echo " * ${_c}: ${_greeter}"
294 echo " ${_c}: ${_greeter}"
298 echo -n "(1 ~ ${#LIGHTDM_GREETERS[@]}) > "
303 echo "Please enter the correct value."
309 if check_int "${_input}"; then
311 if (( 1 <= _input)) && (( _input <= ${#LIGHTDM_GREETERS[@]} )); then
312 _greeter="${LIGHTDM_GREETERS[$(( _input - 1 ))]}"
318 if printf "%s\n" "${LIGHTDM_GREETERS[@]}" | grep -x "${_input}" 1>/dev/null 2>&1; then
326 if [[ -n "${_greeter}" ]]; then
327 command_lightdm_greeter_change "${_greeter}"
332 echo "Changed greeter to ${_greeter}"
336 command_lightdm_remove(){
337 if [[ ! -f "${LIGHTDM_CONFIG}" ]]; then
341 echo -ne "Are you sure you want to delete all settings?\nThis change is irreversible.\n (y or n) > "
342 read -r -n 1 _yes_or_no
343 if [[ "${_yes_or_no}" = "y" ]]; then
344 mv "${LIGHTDM_CONFIG}" "${LIGHTDM_CONFIG}.disabled"
350 command_lightdm_greeter_edit(){
351 if [[ "${NON_INTERACTIVE}" = true ]]; then
352 msg_error "You cannot use this command in non-interactive mode."
355 local _greeter="${1:-${LIGHTDM_CURRENT_GREETER}}"
356 if [[ -z "${GREETER_CONFIG["${_greeter}"]+SET}" ]]; then
357 msg_error "This Greeter is not currently supported."
358 msg_error "Please report the problem here."
359 msg_error "https://github.com/FascodeNet/lightdm-config/issues"
362 if [[ -z ${1} ]]; then
363 msg_warn "Greeter was not specified. Open the currently configured Greeter configuration file."
364 echo -n "(Enter to continue) > "
368 bash -c "${USE_EDITOR} ${GREETER_CONFIG["${_greeter}"]}"
374 command_lightdm_edit(){
375 if [[ "${NON_INTERACTIVE}" = true ]]; then
376 msg_error "You cannot use this command in non-interactive mode."
379 for _config in "${LIGHTDM_LOADED_CONFIG[@]}"; do
380 echo -ne "Edit ${_config} ? (y or n)> "
381 read -r -n 1 _yes_or_no
383 if [[ "${_yes_or_no}" = "y" ]]; then
384 bash -c "${USE_EDITOR} ${_config}"
390 command_lightdm_auto_login(){
391 if [[ -z "${1+SET}" ]]; then
392 # 既に自動ログインが設定されているかを確認
393 local autologin_user="$(lightdm_get_value autologin-user)"
394 if [[ -n "${autologin_user}" ]]; then
396 for _autologin in "autologin-guest" "autologin-user" "autologin-user-timeout" "autologin-in-background" "autologin-session"; do
397 remove_key "${_autologin}"
399 echo "Canceled automatic login of ${autologin_user}"
402 local autologin_user="${1}" autologin_session
404 autologin_session="${2}"
408 if ! getent passwd "${autologin_user}" 1> /dev/null 2>&1; then
409 echo "${autologin_user} is a non-existent user."
414 if [[ -z "${autologin_session+SET}" ]]; then
415 if (( $(ls "/usr/share/xsessions" 2> /dev/null | wc -l) <= 1 )); then
416 autologin_session="$(ls "/usr/share/xsessions" | sed 's|.desktop$||g')"
417 elif [[ "${NON_INTERACTIVE}" = true ]]; then
420 autologin_session="$(cat "${HOME}/.dmrc" | grep -E '^Session=' | cut -d '=' -f 2)"
421 if [[ -z "${autologin_session}" ]]; then
422 msg_error "Failed to set the session."
423 msg_error "Not specified and ~/.dmrc does not exist either."
427 echo "Select the desktop session to autologin"
429 for session in "/usr/share/xsessions/"*; do
432 echo -n "(session name) > "
434 if [[ -f "/usr/share/xsessions/${session}.desktop" ]]; then
435 autologin_session="${session}"
437 msg_error "Please enter the correct session name."
443 if [[ ! -f "/usr/share/xsessions/${autologin_session}.desktop" ]]; then
445 msg_error "This is a session (${autologin_session}) that does not exist."
451 if ! getent group "autologin" 1> /dev/null 2>&1; then
452 LANG=C groupadd -r "autologin"
454 LANG=C gpasswd -a "${autologin_user}" "autologin"
457 lightdm_set_config "autologin-guest" "false"
458 lightdm_set_config "autologin-user" "${autologin_user}"
459 lightdm_set_config "autologin-user-timeout" "0"
460 lightdm_set_config "autologin-in-background" "false"
461 lightdm_set_config "autologin-session" "${autologin_session}"
463 echo "${autologin_user} will automatically log in with ${autologin_session}"
469 command_lightdm_show_config(){
470 lightdm --show-config 2>&1
476 if [[ ! -f "/etc/dconf/profile/gdm" ]]; then
477 mkdir -p "/etc/dconf/profile"
478 touch "/etc/dconf/profile/gdm"
479 echo -e "user-db:user\nsystem-db:gdm\nfile-db:/usr/share/gdm/greeter-dconf-defaults" > "/etc/dconf/profile/gdm"
483 for _file in "${DISPLAY_MANAGER_CONFIG["gdm-dconf"]}" "${DISPLAY_MANAGER_CONFIG["gdm-custom"]}"; do
484 if [[ ! -f "${_file}" ]]; then
485 mkdir -p "$(dirname "${_file}")"
491 # gdm_dconf_set_config <dconf path> <key> <value>
492 gdm_dconf_set_config(){
493 if check_int "${3}" || check_bool "${3}"; then
494 crudini --set "${DISPLAY_MANAGER_CONFIG["gdm-dconf"]}" "${1}" "${2}" "${3}"
496 crudini --set "${DISPLAY_MANAGER_CONFIG["gdm-dconf"]}" "${1}" "${2}" "\"${3}\""
501 # gdm_dconf_get_value <dconf path> <key>
502 gdm_dconf_get_value(){
503 dconf dump / | crudini --get - "${1}" "${2}"
506 # gdm_custom_get_value <section> <key>
507 gdm_custom_get_value(){
508 crudini --get "${DISPLAY_MANAGER_CONFIG["gdm-custom"]}" "${1}" "${2}"
511 # gdm_custom_set_config <section> <key> <value>
512 gdm_custom_set_config(){
513 if check_int "${3}" || check_bool "${3}"; then
514 crudini --set "${DISPLAY_MANAGER_CONFIG["gdm-custom"]}" "${1}" "${2}" "${3}"
516 crudini --set "${DISPLAY_MANAGER_CONFIG["gdm-custom"]}" "${1}" "${2}" "\"${3}\""
528 if [[ -z "${1+SET}" ]]; then
529 msg_error "Please specify the image of background"
532 if [[ ! -f "${1}" ]]; then
533 msg_error "${1} was not found."
537 local _backgrounf_file="/usr/share/backgrounds/gdm/background"
538 mkdir -p "$(dirname "${_backgrounf_file}")"
539 cp "${1}" "${_backgrounf_file}"
540 chmod 644 "${_backgrounf_file}"
542 gdm_dconf_set_config "org/gnome/login-screen" "logo" "${_backgrounf_file}"
545 command_gdm_cursor_wizard(){
549 echo "Please select the cursor theme to use."
550 for (( _c=1; _c<=${#CURSOR_THEMES[@]}; _c++)); do
551 _cursor_theme="${CURSOR_THEMES[$(( _c - 1 ))]}"
552 echo " ${_c}: ${_cursor_theme}"
558 echo -n "(1 ~ ${#CURSOR_THEMES[@]}) > "
563 echo "Please enter the correct value."
564 command_gdm_cursor_wizard
569 if check_int "${_input}"; then
571 if (( 1 <= _input)) && (( _input <= ${#CURSOR_THEMES[@]} )); then
572 _cursor_theme="${CURSOR_THEMES[$(( _input - 1 ))]}"
578 if printf "%s\n" "${CURSOR_THEMES[@]}" | grep -x "${_input}" 1>/dev/null 2>&1; then
579 _cursor_theme="${_input}"
585 if [[ -n "${_cursor_theme}" ]]; then
586 command_gdm_cursor_change "${_cursor_theme}"
588 command_gdm_cursor_wizard
591 echo "Changed cursor to ${_cursor_theme}"
594 command_gdm_cursor_change(){
595 if [[ -z "${1+SET}" ]]; then
596 msg_error "Please specify the cursor theme"
599 if ! printf "%s\n" "${CURSOR_THEMES[@]}" | grep -x "${1}" 1>/dev/null 2>&1; then
600 msg_error "The cursor theme (${1}) was not found"
603 gdm_dconf_set_config "org/gnome/desktop/interface" "cursor-theme" "${1}"
607 local _arg="$(echo "${1-""}" | tr A-Z a-z)"
608 if ! check_bool "${_arg}"; then
609 msg_error "Please specify true or false"
613 gdm_dconf_set_config "org/gnome/desktop/sound" "event-sounds" "${_arg}"
617 local _arg="$(echo "${1-""}" | tr A-Z a-z)"
618 if ! check_bool "${_arg}"; then
619 msg_error "Please specify true or false"
623 gdm_dconf_set_config "org/gnome/desktop/peripherals/touchpad" "tap-to-click" "${_arg}"
627 command_gdm_auto_login(){
628 if [[ -z "${1+SET}" ]]; then
629 # 既に自動ログインが設定されているかを確認
630 local autologin="$(gdm_custom_get_value daemon AutomaticLoginEnable)"
631 if [[ "${autologin}" = "True" ]]; then
632 gdm_custom_set_config "daemon" "AutomaticLoginEnable" "False"
633 echo "Canceled automatic login of $(gdm_custom_get_value "daemon" "AutomaticLogin")"
636 local autologin_user="${1}" autologin_session
638 autologin_session="${2}"
642 if ! getent passwd "${autologin_user}" 1> /dev/null 2>&1; then
643 echo "${autologin_user} is a non-existent user."
647 # セッションを設定 (WayLandのセッションは現在サポートされていません)
648 if [[ -z "${autologin_session+SET}" ]]; then
649 if (( $(ls "/usr/share/xsessions" 2> /dev/null | wc -l) <= 1 )); then
650 autologin_session="$(ls "/usr/share/xsessions" | sed 's|.desktop$||g')"
651 elif [[ "${NON_INTERACTIVE}" = true ]]; then
654 autologin_session="$(cat "${HOME}/.dmrc" | grep -E '^Session=' | cut -d '=' -f 2)"
655 if [[ -z "${autologin_session}" ]]; then
656 msg_error "Failed to set the session."
657 msg_error "Not specified and ~/.dmrc does not exist either."
661 echo "Select the desktop session to autologin"
663 for session in "/usr/share/xsessions/"*; do
664 echo " $(basename ${session} | sed "s|.desktop$||g")"
666 echo -n "(session name) > "
668 if [[ -f "/usr/share/xsessions/${session}.desktop" ]]; then
669 autologin_session="${session}"
671 msg_error "Please enter the correct session name."
677 if [[ ! -f "/usr/share/xsessions/${autologin_session}.desktop" ]]; then
679 msg_error "This is a session (${autologin_session}) that does not exist."
685 if ! getent group "autologin" 1> /dev/null 2>&1; then
686 LANG=C groupadd -r "autologin"
688 LANG=C gpasswd -a "${autologin_user}" "autologin"
691 gdm_custom_set_config "daemon" "AutomaticLoginEnable" "True"
692 gdm_custom_set_config "daemon" "AutomaticLogin" "${autologin_user}"
695 crudini --set "/var/lib/AccountsService/users/${autologin_user}" "User" "Session" "${autologin_session}"
696 crudini --set "/var/lib/AccountsService/users/${autologin_user}" "User" "XSession" "${autologin_session}"
698 echo "${autologin_user} will automatically log in with ${autologin_session}"
704 command_gdm_accessibility(){
705 local _arg="$(echo "${1-""}" | tr A-Z a-z)"
706 if ! check_bool "${_arg}"; then
707 msg_error "Please specify true or false"
711 gdm_dconf_set_config "org/gnome/desktop/interface" "toolkit-accessibility" "${_arg}"
715 command_gdm_root_login(){
716 local _arg="$(echo "${1-""}" | tr A-Z a-z)"
717 if ! check_bool "${_arg}"; then
718 msg_error "Please specify true or false"
722 gdm_custom_set_config "daemon" "AllowRoot" "${_arg}"
725 #== Webkit2用の汎用関数 ==#
726 webkit2_init_configs(){
728 if [[ ! -f "${GREETER_CONFIG["lightdm-webkit2-greeter"]}" ]]; then
729 mkdir -p "$(dirname "${GREETER_CONFIG["lightdm-webkit2-greeter"]}")"
730 touch "${GREETER_CONFIG["lightdm-webkit2-greeter"]}"
734 # webkit2_get_value <section> <key>
736 crudini --get "${GREETER_CONFIG["lightdm-webkit2-greeter"]}" "${1}" "${2}"
739 # webkit2_set_config <section> <key> <value>
740 webkit2_set_config(){
741 crudini --set "${GREETER_CONFIG["lightdm-webkit2-greeter"]}" "${1}" "${2}" "${3}"
745 command_webkit2_theme_wizard(){
746 local _theme_list=($(ls /usr/share/lightdm-webkit/themes))
747 local _current_theme=$(webkit2_get_value greeter webkit_theme | sed "s|\"||g")
749 echo "Please select the theme to use."
750 for (( _c=1; _c<=${#_theme_list[@]}; _c++)); do
751 _theme="${_theme_list[$(( _c - 1 ))]}"
752 if [[ "${_theme}" = "${_current_theme}" ]]; then
753 echo " * ${_c}: ${_theme}"
755 echo " ${_c}: ${_theme}"
762 echo -n "(1 ~ ${#_theme_list[@]}) > "
767 echo "Please enter the correct value."
768 command_webkit2_theme_wizard
773 if check_int "${_input}"; then
775 if (( 1 <= _input)) && (( _input <= ${#_theme_list[@]} )); then
776 _theme="${_theme_list[$(( _input - 1 ))]}"
782 if printf "%s\n" "${_theme_list[@]}" | grep -x "${_input}" 1>/dev/null 2>&1; then
789 if [[ -n "${_theme}" ]]; then
790 command_webkit2_theme_change "${_theme}"
791 echo "Changed the theme to ${_theme}"
793 command_webkit2_theme_wizard
799 command_webkit2_theme_change(){
800 if [[ -z "${1+SET}" ]]; then
801 msg_error "Please specify the theme name"
804 if [[ ! -d "/usr/share/lightdm-webkit/themes/${1}" ]]; then
805 msg_error "The specified theme (${1}) does not exist"
809 webkit2_set_config "greeter" "webkit_theme" "${1}"
812 #== Qtquick用の汎用関数 ==#
813 qtquick_init_configs(){
815 if [[ ! -f "${GREETER_CONFIG["lightdm-qtquick-greeter"]}" ]] || [[ -z "$(cat "${GREETER_CONFIG["lightdm-qtquick-greeter"]}")" ]]; then
816 mkdir -p "$(dirname "${GREETER_CONFIG["lightdm-qtquick-greeter"]}")"
817 touch "${GREETER_CONFIG["lightdm-qtquick-greeter"]}"
818 #echo -e "{\n\n}\n" > "${GREETER_CONFIG["lightdm-qtquick-greeter"]}"
819 qtquick_set_config background_path "file:///hoge/fuga.png"
820 qtquick_set_config theme "qrc:/Login.qml"
824 #qtquick_get_value <key>
826 cat "${GREETER_CONFIG["lightdm-qtquick-greeter"]}" | jq ".${1}"
829 # command_qtquick_back <key> <value>
830 qtquick_set_config(){
831 local _tempfile="/tmp/$(basename "${GREETER_CONFIG["lightdm-qtquick-greeter"]}")-$(cat /dev/urandom | base64 | fold -w 10 | head -n 1)"
832 cp "${GREETER_CONFIG["lightdm-qtquick-greeter"]}" "${_tempfile}"
833 cat "${_tempfile}" | jq -r ".${1}|=\"${2}\"" > "${GREETER_CONFIG["lightdm-qtquick-greeter"]}"
834 chmod 644 "${GREETER_CONFIG["lightdm-qtquick-greeter"]}"
838 command_qtquick_back(){
839 if [[ -z "${1+SET}" ]]; then
840 msg_error "Please specify the image of background"
843 if [[ ! -f "${1}" ]]; then
844 msg_error "${1} was not found."
848 local _backgrounf_file="/usr/share/backgrounds/lightdm/qtquick-greeter"
849 mkdir -p "$(dirname "${_backgrounf_file}")"
850 cp "${1}" "${_backgrounf_file}"
851 chmod 644 "${_backgrounf_file}"
853 qtquick_set_config "background_path" "file://${_backgrounf_file}"
858 declare -A GREETER_CONFIG=(
859 ["lightdm-webkit2-greeter"]="/etc/lightdm/lightdm-webkit2-greeter.conf"
860 ["lightdm-slick-greeter"]="/etc/lightdm/slick-greeter.conf"
861 ["lightdm-gtk-greeter"]="/etc/lightdm/lightdm-gtk-greeter.conf"
862 ["io.elementary.greeter"]="/etc/lightdm/io.elementary.greeter.conf"
863 ["lightdm-mini-greeter"]="/etc/lightdm/lightdm-mini-greeter.conf"
864 ["lightdm-qtquick-greeter"]="/etc/lightdm/lightdm-qtquick-greeter.json"
867 declare -A DISPLAY_MANAGER_CONFIG=(
868 ["lightdm"]="/etc/lightdm/lightdm.conf.d/00-dmc-lightdm.conf"
869 ["gdm-dconf"]="/etc/dconf/db/gdm.d/00-dmc-gdm"
870 ["gdm-custom"]="/etc/gdm/custom.conf"
877 LIGHTDM_CONFIG="${DISPLAY_MANAGER_CONFIG["lightdm"]}"
879 # LightDM - Greeterのディレクトリ
880 LIGHTDM_GREETERS_DIR="$(lightdm_get_value "greeters-directory")"
881 : "${LIGHTDM_GREETERS_DIR:="/usr/share/xgreeters"}"
883 # LightDM - Greeter一覧
884 LIGHTDM_GREETERS=( $( (ls "${LIGHTDM_GREETERS_DIR}" | sed "s|.desktop$||g") 2> /dev/null ))
886 # LightDM - 現在設定されているGreeter
887 LIGHTDM_CURRENT_GREETER="$(lightdm --show-config 2>&1 | grep "greeter-session" | cut -d "=" -f 2)"
888 : "${LIGHTDM_CURRENT_GREETER:="lightdm-gtk-greeter"}"
890 # LightDM - 読み込まれた設定ファイルの一覧
891 LIGHTDM_LOADED_CONFIG=()
892 while read -r line; do
893 LIGHTDM_LOADED_CONFIG+=("${line}")
894 done < <(printf "%s\n" $(lightdm --show-config 2>&1 | grep -x -A "$(lightdm --show-config 2>&1 | wc -l)" "Sources:" | grep -v "Sources") | sed -E "s|^[A-Z]$||g" | tr -d " ")
897 CURSOR_THEMES=($(get_cursor_theme))
898 USE_EDITOR="${EDITOR:-vi}"
899 DISPLAY_MANAGER="lightdm"
902 NON_INTERACTIVE=false
903 WRITE_ALL_FILES=false
910 OPTL="mode:,editor:,help,non-interactive,noroot,write-all-files"
911 if ! OPT="$(getopt -o ${OPTS} -l ${OPTL} -- ${ARGUMENT})"; then
921 DISPLAY_MANAGER="${2}"
952 if (( "${#}" >= 1 )); then
956 : ${COMMAND_ARGS-""} # サブコマンドの引数が何も指定されなかった場合に空文字を代入
958 if [[ "${COMMAND}" = "null" ]]; then
963 case "${DISPLAY_MANAGER}" in
968 command_lightdm_auto_login ${COMMAND_ARGS}
976 command_lightdm_greeter_change ${COMMAND_ARGS}
980 command_lightdm_greeter_create ${COMMAND_ARGS}
983 command_lightdm_greeter_list
987 command_lightdm_greeter_edit ${COMMAND_ARGS}
991 command_lightdm_remove
998 command_lightdm_show_config
1001 msg_error "Undefined commnad(${COMMAND})"
1006 case "${COMMAND}" in
1009 command_gdm_auto_login ${COMMAND_ARGS}
1013 command_gdm_cursor_wizard
1017 command_gdm_sound ${COMMAND_ARGS}
1021 command_gdm_logo ${COMMAND_ARGS}
1025 command_gdm_tap ${COMMAND_ARGS}
1029 command_gdm_accessibility ${COMMAND_ARGS}
1033 command_gdm_root_login ${COMMAND_ARGS}
1036 msg_error "Undefined commnad(${COMMAND})"
1041 case "${COMMAND}" in
1043 webkit2_init_configs
1044 command_webkit2_theme_wizard
1047 webkit2_init_configs
1048 command_webkit2_theme_change ${COMMAND_ARGS}
1051 msg_error "Undefined commnad(${COMMAND})"
1056 case "${COMMAND}" in
1058 qtquick_init_configs
1059 command_qtquick_back ${COMMAND_ARGS}
1064 msg_error "A display manager that is not currently supported."