Guest User

Untitled

a guest
Dec 5th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.80 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # Get current time in HHMM format
  4. current_time=$(date +%H%M)
  5.  
  6. # Win Terminal profile path
  7.  
  8. wsl_path="/mnt/c/Users/marcos.souza/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json"
  9.  
  10. # Define start and end times in HHMM format
  11. start_time=$(hdate -s -T -l s3 -L w38 --timezone -3 | tail -n 1 | awk -F ',' '{print $(NF-1)}' | tr -d ':')
  12. end_time=$(hdate -s -T -l s3 -L w38 --timezone -3 | tail -n 1 | awk -F ',' '{print $(NF)}' | tr -d ':')
  13.  
  14. # Check if current time is between start and end times
  15. if [[ "$current_time" > "$start_time" && "$current_time" < "$end_time" ]]; then
  16.     sed -i '/"defaults":/,/"list":/s/"Solarized Dark"/"Solarized Light"/' $wsl_path
  17. else
  18.     sed -i '/"defaults":/,/"list":/s/"Solarized Light"/"Solarized Dark"/' $wsl_path
  19. fi
Advertisement
Add Comment
Please, Sign In to add comment