diff options
| author | JaKooLit <ejhay.games@gmail.com> | 2025-02-03 19:57:00 +0900 |
|---|---|---|
| committer | JaKooLit <ejhay.games@gmail.com> | 2025-02-03 19:57:00 +0900 |
| commit | 6344db6cc19571df4d356784a05a4f2dea55c5e7 (patch) | |
| tree | 0d620ac65912f38e999604d6b242c762aff53e6c /copy.sh | |
| parent | 90fe32a08a1c6a9234916d5fab15c82851b0f0a2 (diff) | |
updated copy.sh
Diffstat (limited to 'copy.sh')
| -rwxr-xr-x | copy.sh | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -327,13 +327,19 @@ while true; do echo "${OK} 12H format set on waybar clocks succesfully." 2>&1 | tee -a "$LOG" - # Function to apply 12H format to SDDM themes + # Function to apply 12H format to SDDM themes apply_sddm_12h_format() { - local sddm_directory=$1 - echo "Editing $sddm_directory to 12H format" 2>&1 | tee -a "$LOG" + local sddm_directory=$1 - sudo sed -i 's|^## HourFormat="hh:mm AP"|HourFormat="hh:mm AP"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true - sudo sed -i 's|^HourFormat="HH:mm"|## HourFormat="HH:mm"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true + # Check if the directory exists + if [ -d "$sddm_directory" ]; then + echo "Editing $sddm_directory to 12H format" 2>&1 | tee -a "$LOG" + + sudo sed -i 's|^## HourFormat="hh:mm AP"|HourFormat="hh:mm AP"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true + sudo sed -i 's|^HourFormat="HH:mm"|## HourFormat="HH:mm"|' "$sddm_directory/theme.conf" 2>&1 | tee -a "$LOG" || true + else + echo "${ERROR} Directory $sddm_directory does not exist. Skipping..." 2>&1 | tee -a "$LOG" + fi } # Applying to different SDDM themes @@ -343,23 +349,17 @@ while true; do # for SDDM (sequoia_2) sddm_directory_3="/usr/share/sddm/themes/sequoia_2" - if [ -d "$sddm_directory_3" ]; then + if [ -d "$sddm_directory_3" ]; then echo "sddm sequoia_2 theme exists. Editing to 12H format" 2>&1 | tee -a "$LOG" + sudo sed -i 's|^clockFormat="HH:mm"|## clockFormat="HH:mm"|' "$sddm_directory_3/theme.conf" 2>&1 | tee -a "$LOG" || true - if ! grep -q 'clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf"; then - sudo sed -i '/^clockFormat=/a clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf" 2>&1 | tee -a "$LOG" || true - fi - echo "${OK} 12H format set to SDDM successfully." 2>&1 | tee -a "$LOG" - fi - break - elif [[ "$answer" == "n" ]]; then - echo "${NOTE} You chose not to change to 12H format." 2>&1 | tee -a "$LOG" - break - else - echo "${ERROR} Invalid choice. Please enter y for yes or n for no." + if ! grep -q 'clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf"; then + sudo sed -i '/^clockFormat=/a clockFormat="hh:mm AP"' "$sddm_directory_3/theme.conf" 2>&1 | tee -a "$LOG" || true + fi + + echo "${OK} 12H format set to SDDM successfully." 2>&1 | tee -a "$LOG" fi - done printf "\n" |
