From 978cb01c7794ca6aabc613810b23698f94fad298 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 1 Jan 2024 12:54:29 +0900 Subject: adjust copy.sh to use localectl first then setxkbmap next if localectl not available Introduce wallpaper rofi menu --- copy.sh | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 20a1c704..917e5554 100755 --- a/copy.sh +++ b/copy.sh @@ -50,25 +50,17 @@ if hostnamectl | grep -q 'Chassis: vm'; then sed -i '/monitor = Virtual-1, 1920x1080@60,auto,1/s/^#//' config/hypr/UserConfigs/Monitors.conf fi -# Preparing hyprland.conf to check for current keyboard layout -# Function to detect keyboard layout in an X server environment -detect_x_layout() { - if command -v setxkbmap >/dev/null 2>&1; then - layout=$(setxkbmap -query | grep layout | awk '{print $2}') +# Function to detect keyboard layout using localectl or setxkbmap +detect_layout() { + if command -v localectl >/dev/null 2>&1; then + layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}') if [ -n "$layout" ]; then echo "$layout" else echo "unknown" fi - else - echo "unknown" - fi -} - -# Function to detect keyboard layout in a tty environment -detect_tty_layout() { - if command -v localectl >/dev/null 2>&1; then - layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}') + elif command -v setxkbmap >/dev/null 2>&1; then + layout=$(setxkbmap -query | grep layout | awk '{print $2}') if [ -n "$layout" ]; then echo "$layout" else @@ -79,22 +71,14 @@ detect_tty_layout() { fi } -# Detect the current keyboard layout based on the environment -if [ -n "$DISPLAY" ]; then - # System is in an X server environment - layout=$(detect_x_layout) -else - # System is in a tty environment - layout=$(detect_tty_layout) -fi - -echo "Keyboard layout: $layout" +# Detect the current keyboard layout +layout=$(detect_layout) printf "${NOTE} Detecting keyboard layout to prepare necessary changes in hyprland.conf before copying\n\n" # Prompt the user to confirm whether the detected layout is correct while true; do - read -p "$ORANGE Detected keyboard layout or keymap: $layout. Is this correct? [y/n] " confirm + read -p "$ORANGE Detected current keyboard layout is: $layout. Is this correct? [y/n] " confirm case $confirm in [yY]) -- cgit v1.2.3 From 6f3b8439303e3488aeba19f8cb3eb7b1c3c9d329 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 1 Jan 2024 23:31:44 +0900 Subject: the downloading of additional wallpaper is set towards the end --- copy.sh | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index 917e5554..f78ede07 100755 --- a/copy.sh +++ b/copy.sh @@ -186,6 +186,27 @@ chmod +x ~/.config/hypr/scripts/* 2>&1 | tee -a "$LOG" chmod +x ~/.config/hypr/UserScripts/* 2>&1 | tee -a "$LOG" # Set executable for initial-boot.sh chmod +x ~/.config/hypr/initial-boot.sh 2>&1 | tee -a "$LOG" +printf "\n%.0s" {1..3} + +# Detect machine type and set Waybar configurations accordingly, logging the output +if hostnamectl | grep -q 'Chassis: desktop'; then + # Configurations for a desktop + ln -sf "$HOME/.config/waybar/configs/[TOP] Default" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" + rm -r "$HOME/.config/waybar/configs/[TOP] Default Laptop" "$HOME/.config/waybar/configs/[BOT] Default Laptop" 2>&1 | tee -a "$LOG" +else + # Configurations for a laptop or any system other than desktop + ln -sf "$HOME/.config/waybar/configs/[TOP] Default Laptop" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" + rm -r "$HOME/.config/waybar/configs/[TOP] Default" "$HOME/.config/waybar/configs/[BOT] Default" 2>&1 | tee -a "$LOG" +fi + +# symlinks for waybar style +ln -sf "$Waybar_Style" "$HOME/.config/waybar/style.css" && \ + +# initialize pywal to avoid config error on hyprland +wal -i $wallpaper -s -t 2>&1 | tee -a "$LOG" + +#initial symlink for Pywal Dark and Light for Rofi Themes +ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" printf "\n%.0s" {1..3} @@ -222,29 +243,6 @@ while true; do esac done - -printf "\n%.0s" {1..3} - -# Detect machine type and set Waybar configurations accordingly, logging the output -if hostnamectl | grep -q 'Chassis: desktop'; then - # Configurations for a desktop - ln -sf "$HOME/.config/waybar/configs/[TOP] Default" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" - rm -r "$HOME/.config/waybar/configs/[TOP] Default Laptop" "$HOME/.config/waybar/configs/[BOT] Default Laptop" 2>&1 | tee -a "$LOG" -else - # Configurations for a laptop or any system other than desktop - ln -sf "$HOME/.config/waybar/configs/[TOP] Default Laptop" "$HOME/.config/waybar/config" 2>&1 | tee -a "$LOG" - rm -r "$HOME/.config/waybar/configs/[TOP] Default" "$HOME/.config/waybar/configs/[BOT] Default" 2>&1 | tee -a "$LOG" -fi - -# symlinks for waybar style -ln -sf "$Waybar_Style" "$HOME/.config/waybar/style.css" && \ - -# initialize pywal to avoid config error on hyprland -wal -i $wallpaper -s -t 2>&1 | tee -a "$LOG" - -#initial symlink for Pywal Dark and Light for Rofi Themes -ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" - printf "\n%.0s" {1..2} printf "\n${OK} Copy Completed!\n\n\n" printf "${ORANGE} ATTENTION!!!! \n" -- cgit v1.2.3 From 90294039ee6bf463f07606e8f15560991130d9f6 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 1 Jan 2024 23:35:54 +0900 Subject: it seems that it causes issue when moved the wallpaper download at the end --- copy.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'copy.sh') diff --git a/copy.sh b/copy.sh index f78ede07..9bdd16ff 100755 --- a/copy.sh +++ b/copy.sh @@ -199,15 +199,6 @@ else rm -r "$HOME/.config/waybar/configs/[TOP] Default" "$HOME/.config/waybar/configs/[BOT] Default" 2>&1 | tee -a "$LOG" fi -# symlinks for waybar style -ln -sf "$Waybar_Style" "$HOME/.config/waybar/style.css" && \ - -# initialize pywal to avoid config error on hyprland -wal -i $wallpaper -s -t 2>&1 | tee -a "$LOG" - -#initial symlink for Pywal Dark and Light for Rofi Themes -ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" - printf "\n%.0s" {1..3} # additional wallpapers @@ -243,6 +234,16 @@ while true; do esac done +# symlinks for waybar style +ln -sf "$Waybar_Style" "$HOME/.config/waybar/style.css" && \ + +# initialize pywal to avoid config error on hyprland +wal -i $wallpaper -s -t 2>&1 | tee -a "$LOG" + +#initial symlink for Pywal Dark and Light for Rofi Themes +ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" + + printf "\n%.0s" {1..2} printf "\n${OK} Copy Completed!\n\n\n" printf "${ORANGE} ATTENTION!!!! \n" -- cgit v1.2.3