better colorpicker,various improvements

master 0.2.6
Daniel Napora 2022-06-02 23:46:52 +02:00
parent 1d5546e993
commit 5e1e8dbd31
6 changed files with 86 additions and 41 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
out+=("^sep(Mabox Colorizer)") out+=("^sep(Mabox Colorizer)")
out+=("OBTHEME,^pipe(colorizer-ob)") out+=("Openbox Theme,^pipe(colorizer-ob)")
out+=("MENUPANELS,^pipe(colorizer-menus)") out+=("Menus/Panels,^pipe(colorizer-menus)")
#out+=("TINT2,^pipe(colorizer-tint2)") #out+=("TINT2,^pipe(colorizer-tint2)")
out+=("CONKY,^pipe(colorizer-conky)") out+=("Conky,^pipe(colorizer-conky)")
#out+=("Systray HW monitor,^pipe(colorizer-phwmon)") #out+=("Systray HW monitor,^pipe(colorizer-phwmon)")
out+=("Terminal color scheme,^term(theme.sh -i2;/bin/bash)") out+=("Terminal color scheme,^term(theme.sh -i2;/bin/bash)")
#out+=("GTKTHEME,^pipe(colorizer-gtktheme)") #out+=("GTKTHEME,^pipe(colorizer-gtktheme)")

View File

@ -36,6 +36,11 @@ getvalues () {
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}" [[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
read CLR2 <<< "$(grep color2 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" read CLR2 <<< "$(grep color2 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}" [[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
read OUTLINE <<< "$(grep draw_outline ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
read SHADES <<< "$(grep draw_shades ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
SHADOWS="no"
[[ "$OUTLINE" == "true" ]] && SHADOWS="outline"
[[ "$SHADES" == "true" ]] && SHADOWS="shadow"
read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
@ -48,10 +53,10 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then
out+=("^sep(Colorize Conky)") out+=("^sep(Colorize Conky)")
out+=("^sep(<small><i>Global settings (apply to all)</i></small>)") out+=("^sep(<small><i>Global settings (apply to all)</i></small>)")
out+=("<small><span bgcolor='$CLR'> </span><span ${BG} fgcolor='$CLR'> AbCd </span></small> Default color,^pipe(mbclr '$CLR' conkyctl default_color_all DEFAULT_COLOR '$me')") out+=("<small><span bgcolor='$CLR'> </span><span ${BG} fgcolor='$CLR'> AbCd </span></small> Default color <small>(normal text and border)</small>,^pipe(mbclr '$CLR' conkyctl default_color_all DEFAULT_COLOR '$me')")
out+=("<small><span bgcolor='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> AbCd </span></small> Color 0,^pipe(mbclr '$CLR0' conkyctl color0_all COLOR_0 '$me')") out+=("<small><span bgcolor='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> AbCd </span></small> Color 0 <small>(normal text2)</small>,^pipe(mbclr '$CLR0' conkyctl color0_all COLOR_0 '$me')")
out+=("<small><span bgcolor='$CLR1'> </span><span ${BG} fgcolor='$CLR1'> AbCd </span></small> Color 1,^pipe(mbclr '$CLR1' conkyctl color1_all COLOR_1 '$me')") out+=("<small><span bgcolor='$CLR1'> </span><span ${BG} fgcolor='$CLR1'> AbCd </span></small> Color 1 <small>(bigger text)</small>,^pipe(mbclr '$CLR1' conkyctl color1_all COLOR_1 '$me')")
out+=("<small><span bgcolor='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> AbCd </span></small> Color 2,^pipe(mbclr '$CLR2' conkyctl color2_all COLOR_2 '$me')") out+=("<small><span bgcolor='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> AbCd </span></small> Color 2 <small>(bars/graphs)</small>,^pipe(mbclr '$CLR2' conkyctl color2_all COLOR_2 '$me')")
out+=("^sep()") out+=("^sep()")
if [ "$WINTRANS" == false ];then if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(trans)") out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(trans)")
@ -72,6 +77,8 @@ if pgrep -af "conky.*mbcolor" >/dev/null; then
out2+=("^sep()") out2+=("^sep()")
out2+=("<tt>++</tt> Increase,conkyctl basefont_inc_all;$me") out2+=("<tt>++</tt> Increase,conkyctl basefont_inc_all;$me")
out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec_all;$me") out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec_all;$me")
out+=("Outline/Shadow [ $SHADOWS ],^checkout(outline)")
out2+=("^tag(outline)")
out2+=("^sep(Outline/Shadow)") out2+=("^sep(Outline/Shadow)")
out2+=("No,conkyctl shades_all no;$me") out2+=("No,conkyctl shades_all no;$me")
out2+=("^sep()") out2+=("^sep()")

View File

@ -70,7 +70,7 @@ out+=("^sep(Openbox theme: <i>$OBTHEME</i>)")
out+=("^sep(TITLEBAR)") out+=("^sep(TITLEBAR)")
out+=("<tt><span bgcolor='$ABG'> </span></tt> ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg ACTIVE_BG '$me')") out+=("<tt><span bgcolor='$ABG'> </span></tt> ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg ACTIVE_BG '$me')")
out+=("<tt><span bgcolor='$NBG'> </span></tt> INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg INACTIVE_BG '$me')") out+=("<tt><span bgcolor='$NBG'> </span></tt> INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg INACTIVE_BG '$me')")
out+=("TEXT,^checkout(titletext)") out+=("<tt><span bgcolor='$ABG' fgcolor='$AFG'> <b>AbCd</b> </span></tt> TITLEBAR TEXT,^checkout(titletext)")
out+=("GRADIENT [ ${REST##* } ],^checkout(gradient)") out+=("GRADIENT [ ${REST##* } ],^checkout(gradient)")
out+=("PADDING [ $PHEIGHT $PWIDTH ],^checkout(padding)") out+=("PADDING [ $PHEIGHT $PWIDTH ],^checkout(padding)")
@ -82,11 +82,13 @@ out+=("HANDLEWIDTH [ $HANDLE ],^checkout(handlewidth)")
out+=("^sep(EFFECTS)") out+=("^sep(EFFECTS)")
out+=("RAISED? [ $WINRAISED ],^checkout(raised)") out+=("RAISED? [ $WINRAISED ],^checkout(raised)")
out+=("ACTIVEHANDLE? [ $AHANDLE ],^checkout(handle)") out+=("ACTIVEHANDLE? [ $AHANDLE ],^checkout(handle)")
out+=("^sep()")
if [ -f "${THEMERC}.bak" ]; then if [ -f "${THEMERC}.bak" ]; then
out+=("^sep()")
out+=("RESET TO DEFAULTS,obtctl reset;$me") out+=("RESET TO DEFAULTS,obtctl reset;$me")
fi fi
out+=("Edit...,xdg-open ${THEMERC}") #out+=("Edit...,xdg-open ${THEMERC}")
#out2+=("^tag(themes)") #out2+=("^tag(themes)")
#out2+=("^sep(themes)") #out2+=("^sep(themes)")
#for i in $(ls $HOME/.themes);do #for i in $(ls $HOME/.themes);do
@ -96,7 +98,7 @@ out+=("Edit...,xdg-open ${THEMERC}")
#done #done
#TEXT #TEXT
out2+=("^tag(titletext)") out2+=("^tag(titletext)")
out2+=("^sep(TITLE_BAR)") out2+=("^sep(TITLE_BAR TEXT)")
out2+=("FONT...,mb-setfont obtitle;$me") out2+=("FONT...,mb-setfont obtitle;$me")
out2+=("TEXTALIGN [ $TXTJUST ],^checkout(talign)") out2+=("TEXTALIGN [ $TXTJUST ],^checkout(talign)")
out2+=("SHADOW,^checkout(shadow)") out2+=("SHADOW,^checkout(shadow)")
@ -155,7 +157,7 @@ out2+=("1 (raised),obtctl raised 1;$me")
#GRADIENT #GRADIENT
out2+=("^tag(gradient)") out2+=("^tag(gradient)")
out2+=("^sep(GRADIENT)") out2+=("^sep(GRADIENT)")
out2+=("solid,obtctl gradient solid;$me") out2+=("Solid color (no gradient),obtctl gradient solid;$me")
out2+=("^sep()") out2+=("^sep()")
out2+=("Vertical,obtctl gradient vertical;$me") out2+=("Vertical,obtctl gradient vertical;$me")
out2+=("Horizontal,obtctl gradient horizontal;$me") out2+=("Horizontal,obtctl gradient horizontal;$me")

View File

@ -202,6 +202,12 @@ single () {
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}" [[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
read CLR2 <<< "$(grep color2 ${1} | cut -d'=' -f2 | cut -d"'" -f2)" read CLR2 <<< "$(grep color2 ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}" [[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
read OUTLINE <<< "$(grep draw_outline ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read SHADES <<< "$(grep draw_shades ${1} | cut -d'=' -f2 | cut -d"," -f1)"
SHADOWS="no"
[[ "$OUTLINE" == "true" ]] && SHADOWS="outline"
[[ "$SHADES" == "true" ]] && SHADOWS="shadow"
read BORD <<< "$(grep draw_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)" read BORD <<< "$(grep draw_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read STIP <<< "$(grep stippled_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)"
@ -246,11 +252,13 @@ single () {
fi fi
out+=("^sep(COLORS)") out+=("^sep(COLORS)")
if [[ "$1" != *"logo_mbcolor"* ]]; then
[[ "$CLR" != "#" ]] && out+=("<small><span bgcolor='$CLR'> </span><span ${BG} fgcolor='$CLR'> AbCd </span></small> Default color,^pipe(mbclr '$CLR' conkyctl default_color DEFAULT_COLOR '$me' ${1})") [[ "$CLR" != "#" ]] && out+=("<small><span bgcolor='$CLR'> </span><span ${BG} fgcolor='$CLR'> AbCd </span></small> Default color,^pipe(mbclr '$CLR' conkyctl default_color DEFAULT_COLOR '$me' ${1})")
[[ "$CLR0" != "#" ]] && out+=("<small><span bgcolor='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> AbCd </span></small> Color 0,^pipe(mbclr '$CLR0' conkyctl color0 COLOR_0 '$me' ${1})") [[ "$CLR0" != "#" ]] && out+=("<small><span bgcolor='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> AbCd </span></small> Color 0,^pipe(mbclr '$CLR0' conkyctl color0 COLOR_0 '$me' ${1})")
[[ "$CLR1" != "#" ]] && out+=("<small><span bgcolor='$CLR1'> </span><span ${BG} fgcolor='$CLR1'> AbCd </span></small> Color 1,^pipe(mbclr '$CLR1' conkyctl color1 COLOR_1 '$me' ${1})") [[ "$CLR1" != "#" ]] && out+=("<small><span bgcolor='$CLR1'> </span><span ${BG} fgcolor='$CLR1'> AbCd </span></small> Color 1,^pipe(mbclr '$CLR1' conkyctl color1 COLOR_1 '$me' ${1})")
[[ "$CLR2" != "#" ]] && out+=("<small><span bgcolor='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> AbCd </span></small> Color 2,^pipe(mbclr '$CLR2' conkyctl color2 COLOR_2 '$me' ${1})") [[ "$CLR2" != "#" ]] && out+=("<small><span bgcolor='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> AbCd </span></small> Color 2,^pipe(mbclr '$CLR2' conkyctl color2 COLOR_2 '$me' ${1})")
out+=("^sep()") out+=("^sep()")
fi
if [ "$WINTRANS" == false ];then if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(transsingle)") out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(transsingle)")
else else
@ -263,23 +271,26 @@ single () {
out2+=("^sep()") out2+=("^sep()")
out2+=("<small><span bgcolor='$WINCLR'> </span></small> Background color,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor WIN_BGCOLOR '$me' ${1})") out2+=("<small><span bgcolor='$WINCLR'> </span></small> Background color,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor WIN_BGCOLOR '$me' ${1})")
out+=("FONTS [ $FONT $FONTSIZE ],^checkout(fontsingle)") if [[ "$1" != *"logo_mbcolor"* ]]; then
if [[ "$1" != *"quoter_mbcolor"* ]]; then
out+=("FONT [ $FONT $FONTSIZE ],^checkout(fontsingle)")
out2+=("^tag(fontsingle)") out2+=("^tag(fontsingle)")
out2+=("^sep(BASE_FONT)") out2+=("^sep(BASE_FONT)")
# if "$1" not quote
out2+=("Set custom basefont...,mb-setfont conky_single ${1};$me") out2+=("Set custom basefont...,mb-setfont conky_single ${1};$me")
out2+=("^sep()") out2+=("^sep()")
# fi
out2+=("<tt>++</tt> Increase,conkyctl basefont_inc ${1};$me") out2+=("<tt>++</tt> Increase,conkyctl basefont_inc ${1};$me")
out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec ${1};$me") out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec ${1};$me")
fi
out+=("Outline/Shadow [ $SHADOWS ],^checkout(outline2)")
out2+=("^tag(outline2)")
out2+=("^sep(Outline/Shadow)") out2+=("^sep(Outline/Shadow)")
out2+=("No,conkyctl shades no ${1};$me") out2+=("No,conkyctl shades no ${1};$me")
out2+=("^sep()") out2+=("^sep()")
out2+=("Draw shades,conkyctl shades shadow ${1};$me") out2+=("Draw shades,conkyctl shades shadow ${1};$me")
out2+=("Draw outline,conkyctl shades outline ${1};$me") out2+=("Draw outline,conkyctl shades outline ${1};$me")
out+=("^sep()") out+=("^sep()")
fi
out+=("BORDERS [ $BORD $STIP ],^checkout(bordersingle)") out+=("BORDERS [ $BORD $STIP ],^checkout(bordersingle)")
out2+=("^tag(bordersingle)") out2+=("^tag(bordersingle)")
out2+=("^sep(DRAW BORDERS?)") out2+=("^sep(DRAW BORDERS?)")
@ -293,9 +304,9 @@ single () {
out2+=("4,conkyctl stippled_borders 4 ${1};$me") out2+=("4,conkyctl stippled_borders 4 ${1};$me")
out+=("^sep()") out+=("^sep()")
out+=("EDIT...,xdg-open ${1}") out+=(" Edit ${1##*/},xdg-open ${1}")
out+=("^sep()") out+=("^sep()")
out+=("Kill ${1##*/},conkyctl kill ${1##*/};${me}") out+=("Kill ${1##*/},conkyctl kill ${1##*/};${me}")
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"

View File

@ -65,7 +65,8 @@ fi
#Current #Current
out+=("^sep(SELECT_COLOR)") out+=("^sep(SELECT_COLOR)")
out+=(" Select or pick from screen,mbclr pick $2 $3 ${5} ${6}") out+=(" Pick color from screen,mbclr pixelcolor $2 $3 ${5} ${6}")
out+=(" Select or pick from screen,mbclr pick $2 $3 ${5} ${6}")
out+=("^sep()") out+=("^sep()")
out+=("<tt><span bgcolor='$1'> </span></tt> shades of current,^checkout(curshades)") out+=("<tt><span bgcolor='$1'> </span></tt> shades of current,^checkout(curshades)")
@ -140,15 +141,29 @@ printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"
} }
pickcolor () { pickcolor () {
#notify-send.sh -t 50000 "From pickcolor" "1: $1\n2: $2\n3: $3\n4: $4\n5: $5\n6: $6"
color=$(gcolor3 2>/dev/null) color=$(gcolor3 2>/dev/null)
if [ "$color" ]; then if [ "$color" ]; then
mycmd=("$1 $2 '${color}' ${4};${3} -s") mycmd=("$1 $2 '${color}' ${4};${3}")
fi
eval "${mycmd[@]}"
}
pixelcolor() {
picker=${picker:-gpick}
if [ "$picker" == "gpick" ]; then
command="gpick -pso 2>/dev/null"
else
command="xcolor --preview-size ${size} --scale ${scale}"
fi
color="$(${command})"
if [ -n "${color}" ]; then
mycmd=("$1 $2 '${color}' ${4};${3}")
fi fi
eval "${mycmd[@]}" eval "${mycmd[@]}"
#notify-send.sh "Qpa $1" "${mycmd[@]}"
} }
case "$1" in case "$1" in
pick) pickcolor "$2" "${3}" "${5}" "${6}";; pick) pickcolor "$2" "${3}" "${4} ${5}" "${6}";;
pixelcolor) pixelcolor "$2" "${3}" "${4} ${5}" "${6}";;
*) main "$@" ;; *) main "$@" ;;
esac esac

View File

@ -1,13 +1,23 @@
#!/bin/bash #!/bin/bash
DIR="$HOME/.config/quoter" DIR="$HOME/.config/quoter"
mkdir -p "$DIR" mkdir -p "$DIR"
CNF_FILE="$DIR/quoter.cfg"
if [ ! -f $CNF_FILE ]; then
cat <<EOF > ${CNF_FILE}
quote_fontsize=18
author_fontsize=12
EOF
fi
source <(grep = $CNF_FILE)
qfsize=${quote_fontsize:-18}
afsize=${author_fontsize:-12}
export Q=$(curl -s "http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en" | sed 's|\\||g' ) export Q=$(curl -s "http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en" | sed 's|\\||g' )
QUOTE=$(echo $Q | jq .quoteText) QUOTE=$(echo $Q | jq .quoteText)
AUTOR=$(echo $Q | jq .quoteAuthor | tr -d '"') AUTOR=$(echo $Q | jq .quoteAuthor | tr -d '"')
echo "${QUOTE}|${AUTOR}" >> "${DIR}"/forismatic.txt echo "${QUOTE}|${AUTOR}" >> "${DIR}"/forismatic.txt
printf "\${font Droid Sans:size=18}\${color}" printf "\${font Droid Sans:size=$qfsize}\${color}"
echo ${QUOTE} | fmt -80 echo ${QUOTE} | fmt -80
printf "\${font Droid Sans:size=12}\${alignr}\${color0}" printf "\${font Droid Sans:size=$afsize}\${alignr}\${color0}"
echo "${AUTOR}" echo "${AUTOR}"