Advertisement
constantin-net

theme_terminals

Aug 5th, 2021 (edited)
1,080
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. #!/bin/bash
  2. #awful.spawn.with_shell("theme_terminals.sh '" .. string.sub(theme_gtk.bg_color,0,7) .. "' '" .. string.sub(theme_gtk.fg_color,0,7) .. "'" )
  3.  
  4. [ -z "$1" ] && bg="#3e3e3e" && fg="#fefefe" || bg="$1"
  5. [ -z "$2" ] && fg="#fefefe" || fg="$2"
  6.  
  7. # lxterminal
  8. sed -i -r  "s/bgcolor=.*$/bgcolor=$bg/" $HOME/.config/lxterminal/lxterminal.conf
  9. sed -i -r  "s/fgcolor=.*$/fgcolor=$fg/" $HOME/.config/lxterminal/lxterminal.conf
  10.  
  11. # Xterm
  12. sed -i -r  "s/XTerm\*background\:.*$/XTerm*background: $bg/" $HOME/.Xdefaults
  13. sed -i -r  "s/XTerm\*foreground\:.*$/XTerm*foreground: $fg/" $HOME/.Xdefaults
  14. xrdb -merge $HOME/.Xdefaults
  15.  
  16. # sakura
  17. hex2srgb(){
  18.   hex=$(echo "${1^^}" | sed 's/#//g')
  19.   a=$(echo $hex | cut -c-2)
  20.   b=$(echo $hex | cut -c3-4)
  21.   c=$(echo $hex | cut -c5-6)
  22.   r=$(echo "ibase=16; $a" | bc)
  23.   g=$(echo "ibase=16; $b" | bc)
  24.   b=$(echo "ibase=16; $c" | bc)
  25.   sed -i -r "s/$2.*$/$2=rgb($r,$g,$b)/" $3
  26. }
  27.  
  28. hex2srgb $fg "colorset1_fore" $HOME/.config/sakura/sakura.conf
  29. hex2srgb $bg "colorset1_back" $HOME/.config/sakura/sakura.conf
  30.  
  31. exit 0
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement