Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- picker ()
- {
- echo "Pick background color"
- back=$(yad --color --title "Choose background color")
- echo "Pick foreground color"
- forg=$(yad --color --title "Choose foreground color")
- }
- adjust ()
- {
- ##backgr
- printf "XCalc.ti.Command.background: $back
- " >> ~/.xapps-col
- printf "XCal*background: $back
- " >> ~/.xapps-col
- printf "XFontSel*background: $back
- " >> ~/.xapps-col
- printf "display.background: $back
- " >> ~/.xapps-col
- printf "Xman*background: $back
- " >> ~/.xapps-col
- ##forg
- printf "XCalc.ti.Command.foreground: $forg
- " >> ~/.xapps-col
- printf "XCal*foreground: $forg
- " >> ~/.xapps-col
- printf "Xman*foreground: $forg
- " >> ~/.xapps-col
- printf "XFontSel*foreground: $forg
- " >> ~/.xapps-col
- printf "display.foreground: $forg
- " >> ~/.xapps-col
- }
- grepcol ()
- {
- ### First locate theme dir
- cat ~/.gtkrc-2.0 | grep gtk-theme-name | awk -F= '/gtk-theme-name/ {print $2}' >> /tmp/theme
- theme=$(sed 's/.//;s/.$//' /tmp/theme)
- (cat /tmp/theme)
- rm /tmp/theme
- #### then extract the colors
- if [ ! -f ~/.themes/$theme/gtk-2.0/gtkrc ]
- then
- col_bg=$(cat /usr/share/themes/$theme/gtk-2.0/gtkrc | grep scheme | head -n1 | awk -Fnbg_color: '/#/ {print $2}' | head -c 7)
- col_fg=$(cat /usr/share/themes/$theme/gtk-2.0/gtkrc | grep scheme | head -n1 | awk -Ffg_color: '/#/ {print $2}' | head -c 7)
- path=/usr/share/themes/$theme/gtk-2.0/gtkrc
- echo $path
- else
- col_bg=$(cat ~/.themes/$theme/gtk-2.0/gtkrc | grep scheme | head -n1 | awk -Fnbg_color: '/#/ {print $2}' | head -c 7)
- col_fg=$(cat ~/.themes/$theme/gtk-2.0/gtkrc | grep scheme | head -n1 | awk -Ffg_color: '/#/ {print $2}' | head -c 7)
- path=~/.themes/$theme/gtk-2.0/gtkrc
- echo $path
- fi
- echo $col_bg
- echo $col_fg
- if [[ -z $col_bg || -z $col_fg ]]; then
- echo 'One or more colors are undefined, please set it manually'
- leafpad $path &
- echo "Please enter background color : "
- read col_bg
- echo "You entered: $col_bg"
- echo "Please enter foreground color : "
- read col_fg
- echo "You entered: $col_fg"
- fi
- back=$col_bg
- forg=$col_fg
- }
- grepx ()
- {
- back=#$(colr bg)
- echo $back
- forg=#$(colr fg)
- echo $forg
- }
- read -p "Do you want to adjust the Xapp's look manually (y) , or apply GTK-colors (n) , or add the Xcolors (x) ? (y/n/x)?" choice
- case "$choice" in
- y|Y )rm ~/.xapps-col
- picker
- adjust
- xrdb load ~/.Xdefaults
- echo "Added the colors of your choise"
- exit 0
- ;;
- n|N )rm ~/.xapps-col
- grepcol
- adjust
- xrdb load ~/.Xdefaults
- echo "Added the GTK colors"
- exit 0
- ;;
- x|X )rm ~/.xapps-col
- grepx
- adjust
- xrdb load ~/.Xdefaults
- echo "added Xcolors"
- exit 0
- ;;
- * ) echo "Fuck you bastard. RTFM."
- exit 1
- esac
- exit
Advertisement
Add Comment
Please, Sign In to add comment