diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2024-01-02 01:21:53 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 01:21:53 +0900 |
| commit | 1acea95602ecd292f4c806ce946c0ab33176e4ce (patch) | |
| tree | a43d4ccfd313a4effa92919fef8d96934c23bac8 /copy.sh | |
| parent | 3d0283f6c0f323bf504d99aadb0019e6357048a8 (diff) | |
| parent | e2bcb89ce79d0a0469e3eb362cc0cc802ddac208 (diff) | |
Merge pull request #116 from JaKooLit/development
Development
Diffstat (limited to 'copy.sh')
| -rwxr-xr-x | copy.sh | 61 |
1 files changed, 22 insertions, 39 deletions
@@ -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]) @@ -202,6 +186,18 @@ 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 printf "\n%.0s" {1..3} @@ -238,20 +234,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" && \ @@ -261,6 +243,7 @@ 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" |
