master
Daniel Napora 2022-05-15 03:25:01 +02:00
parent 56693fd754
commit 1e3c3cce52
9 changed files with 1605 additions and 0 deletions

16
Makefile 100644
View File

@ -0,0 +1,16 @@
NAME=mabox-colorizer
VERSION=0.0.1
DIRS=bin share
INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null`
INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null`
PREFIX?=/usr
install:
for dir in $(INSTALL_DIRS); do mkdir -p $(PREFIX)/$$dir; done
for file in $(INSTALL_FILES); do cp $$file $(PREFIX)/$$file; done
uninstall:
for file in $(INSTALL_FILES); do rm -f $(PREFIX)/$$file; done
rm -r $(PREFIX)/share/$(NAME)

61
bin/colorizer 100755
View File

@ -0,0 +1,61 @@
#!/bin/bash
out+=("^sep(Mabox Colorizer)")
out+=("OBTHEME,^pipe(colorizer-ob)")
out+=("MENUPANELS,^pipe(colorizer-menus)")
#out+=("TINT2,^pipe(colorizer-tint2)")
out+=("CONKY,^pipe(colorizer-conky)")
out+=("Systray HW monitor,^pipe(colorizer-phwmon)")
out+=("Terminal color scheme,^term(theme.sh -i2;/bin/bash)")
#out+=("GTKTHEME,^pipe(colorizer-gtktheme)")
out+=("^sep()")
out+=("WALLPAPER,^pipe(jgwallpaperchanger)")
out+=("MBX Colors,mbxcolors")
out+=("^sep()")
out+=("PREFERENCES")
out+=("ABOUT and Help,yhtml ${HOME}/.config/colorizer/help/colorizer.html 'Colorizer - OBtheme'")
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
#out+=("^sep()")
#out+=(" ⮜ $LEFTPANEL,mb-jgtools places")
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
jgmenu_icon_size=0
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 128))
#TEMP POSITION:
MENU_VALIGN="top"
MENU_MARGIN_Y="100"
mkconfigfile
#THUMB="$(DISPLAY=:0 scrot -t 220x100 -o $HOME/.config/mabox/colorizer.png -e 'echo $m')"
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,120,4,left,top,,,$HOME/.config/mabox/colorizer.png
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"

194
bin/colorizer-conky 100755
View File

@ -0,0 +1,194 @@
#!/bin/bash
me="colorizer-conky -s"
CONKYDIR="$HOME/.config/conky"
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
if [ !-f "${BASECONKY}" ]; then
rsync -a /usr/share/mabox-colorizer/conky/* ${CONKYDIR}/
fi
getvalues () {
read WINTRANS <<< "$(grep own_window_transparent ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
read WINCLR <<< "$(grep own_window_colour ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}"
read CLR <<< "$(grep default_color ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
read CLR0 <<< "$(grep color0 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}"
read CLR1 <<< "$(grep color1 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
read CLR2 <<< "$(grep color2 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)"
}
if pgrep -af "conky.*mbcolor" >/dev/null; then
getvalues
[[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG=""
out+=("^sep(Colorize Conky)")
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='$CLR0'> </span><span ${BG} fgcolor='$CLR0'> AbCd </span></small> Color 0,^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='$CLR2'> </span><span ${BG} fgcolor='$CLR2'> AbCd </span></small> Color 2,^pipe(mbclr '$CLR2' conkyctl color2_all COLOR_2 '$me')")
out+=("^sep()")
if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(trans)")
else
out+=("<small><span>transparent </span></small> Background,^checkout(trans)")
fi
out2+=("^tag(trans)")
out2+=("^sep(TRANSPARENT?)")
out2+=("Yes,conkyctl transparent_all true;$me")
out2+=("No,conkyctl transparent_all false;$me")
out2+=("^sep()")
out2+=("<small><span bgcolor='$WINCLR'> </span></small> Background color,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all WIN_BGCOLOR '$me')")
out+=("^sep()")
out+=("FONTS [ $FONT $FONTSIZE ],^checkout(font)")
out2+=("^tag(font)")
out2+=("^sep(BASE_FONT)")
out2+=("<tt>++</tt> Increase,conkyctl basefont_inc_all;$me")
out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec_all;$me")
out2+=("^sep(Outline/Shadow)")
out2+=("No,conkyctl shades_all no;$me")
out2+=("^sep()")
out2+=("Draw shades,conkyctl shades_all shadow;$me")
out2+=("Draw outline,conkyctl shades_all outline;$me")
out+=("^sep()")
out+=("BORDERS [ $BORD $STIP ],^checkout(border)")
out2+=("^tag(border)")
out2+=("^sep(DRAW BORDERS?)")
out2+=("Yes,conkyctl draw_borders_all true;$me")
out2+=("No,conkyctl draw_borders_all false;$me")
out2+=("^sep(STIPPLED BORDERS?)")
out2+=("0,conkyctl stippled_borders_all 0;$me")
out2+=("1,conkyctl stippled_borders_all 1;$me")
out2+=("2,conkyctl stippled_borders_all 2;$me")
out2+=("3,conkyctl stippled_borders_all 3;$me")
out2+=("4,conkyctl stippled_borders_all 4;$me")
#while read -r pid b c confpath
#do
# filename=${confpath##*/}
# name=${filename%%_mb*}
# out+=("${name^},^pipe(conkyctl single ${confpath})")
#done < <(pgrep -af "conky.*mbcolor")
# array with running conkies - only filenames with full path
readarray -t running < <(pgrep -af "conky.*mbcolor" | cut -d' ' -f4)
#array with all supported conkies
for i in "$CONKYDIR"/*_mbcolor*; do
supported+=("$i")
done
#array with not started conkies
notstarted=($(echo ${running[@]} ${supported[@]} | tr ' ' '\n' | sort | uniq -u))
if [[ ${#running[@]} > 0 ]];then
out+=("^sep(<small><i>Individual settings</i></small>)")
for c in ${running[@]};do
filename=${c##*/}
name=${filename%%_mb*}
title=${name//_/ }
out+=("${title^},^pipe(conkyctl single ${c})")
done
if [[ ${#notstarted[@]} > 0 ]];then
out+=("^sep(More Conkies Available)")
out+=("^sep(<small><i>click to start</i></small>)")
for c in ${notstarted[@]};do
filename=${c##*/}
name=${filename%%_mb*}
title=${name//_/ }
out+=("${title^},conkyctl startone ${c};$me")
done
if [[ ${#notstarted[@]} > 1 ]];then
out+=("^sep()")
out+=("Start all (${#notstarted[@]}),conkyctl startall;$me")
fi
fi
fi
#out+=("RESET")
else
out+=("^sep(No supported Conky running)")
out+=("^sep(<small><i>click to start some</i></small>)")
for confpath in "$CONKYDIR"/*_mb*;
do
filename=${confpath##*/}
name=${filename%%_mb*}
title=${name//_/ }
out+=("${title^},conkyctl startone ${confpath};$me")
done
out+=("^sep()")
out+=("Start all,conkyctl startall;$me")
fi
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
out+=("^sep()")
out+=(" ⮜ Back to Colorizer,colorizer -s")
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
MENU_HALIGN="left"
jgmenu_icon_size=0
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158))
#WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
#TEMP POSITION:
MENU_VALIGN="top"
MENU_MARGIN_Y="100"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB}
#@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,$HOME/.config/mabox/colorizer-conky.png
@rect,,$((jgtools_padding + 244)),$((jgtools_padding + 6)),29,60,0,left,top,#FFFFFF 30,${WINCLR} 60,
@rect,,$((jgtools_padding + 5)),$((jgtools_padding + 82)),29,40,0,left,top,#FFFFFF 30,${WINCLR} 60,
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"

201
bin/colorizer-menus 100755
View File

@ -0,0 +1,201 @@
#!/bin/bash
me="colorizer-menus -s"
. $HOME/.config/mabox/mabox.conf
case "$jgmenu_theme" in
obtheme)
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml");
#echo "$OBTHEME"
THEMERC="$HOME/.config/mabox/jgobthemes/${OBTHEME}.colorrc"
jgmenu_theme="$OBTHEME";; #only to show real theme name in menu
*)
THEMERC="$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc";;
esac
# Backup original theme file
if [ ! -f "${THEMERC}.bak" ]; then
cp ${THEMERC} ${THEMERC}.bak
fi
getvalues () {
read MBG MBGA<<< "$(grep 'color_menu_bg ' ${THEMERC} | cut -d'=' -f2)"
read MBGT MBGTA<<< "$(grep 'color_menu_bg_to' ${THEMERC} | cut -d'=' -f2)"
read MBORDER MBORDERA<<< "$(grep 'color_menu_border' ${THEMERC} | cut -d'=' -f2)"
read GRADIENT<<< "$(grep 'menu_gradient_pos' ${THEMERC} | cut -d'=' -f2)"
if [ "$GRADIENT" == "" ]; then
mb-setvar menu_gradient_pos=none ${THEMERC}
read GRADIENT<<< "$(grep 'menu_gradient_pos' ${THEMERC} | cut -d'=' -f2)"
fi
read SEPHALIGN<<< "$(grep 'sep_halign' ${THEMERC} | cut -d'=' -f2)"
read SEPFG SEPFGA<<< "$(grep 'color_sep_fg' ${THEMERC} | cut -d'=' -f2)"
read TBG TBGA<<< "$(grep 'color_title_bg' ${THEMERC} | cut -d'=' -f2)"
read TFG TFGA<<< "$(grep 'color_title_fg' ${THEMERC} | cut -d'=' -f2)"
read TBORDER TBORDERA<<< "$(grep 'color_title_border' ${THEMERC} | cut -d'=' -f2)"
read NORMBG NORMBGA<<< "$(grep color_norm_bg ${THEMERC} | cut -d'=' -f2)"
read NFG NFGA<<< "$(grep color_norm_fg ${THEMERC} | cut -d'=' -f2)"
read SBG SBGA<<< "$(grep 'color_sel_bg' ${THEMERC} | cut -d'=' -f2)"
read SFG SFGA<<< "$(grep 'color_sel_fg' ${THEMERC} | cut -d'=' -f2)"
read SBORDER SBORDERA<<< "$(grep 'color_sel_border' ${THEMERC} | cut -d'=' -f2)"
read IBORDER<<< "$(grep 'item_border' ${THEMERC} | cut -d'=' -f2)"
read IRADIUS<<< "$(grep 'item_radius' ${THEMERC} | cut -d'=' -f2)"
}
getvalues
#color_menu_bg = #ECE9E6 90
#color_menu_bg_to = #ffffff 90
#color_menu_border = #ECE9E6 100
#menu_gradient_pos=bottom_left
#sep_height = 0
#sep_halign = right
#color_sep_fg = #222222 40
#color_title_bg = #222222 30
#color_title_fg = #EEEEEE 100
#color_title_border = #222222 3
#item_border = 1
#item_radius = 2
#color_norm_bg = #222222 0
#color_norm_fg = #222222 100
#color_sel_bg = #222222 60
#color_sel_fg = #EEEEEE 90
#color_sel_border = #222222 50
out+=("^sep(Menu theme: <i>${jgmenu_theme}</i>)")
out+=("<tt><small>$(printf '%3s' "$MBGA")</small> <span bgcolor='$MBG' bgalpha='${MBGA/#[0]/1}%'> </span><span bgcolor='$MBG'> </span></tt> COLOR_MENU_BG,^pipe(mbclr '$MBG' jgctl color_menu_bg COLOR_MENU_BG '$me')")
out+=("<tt><small>$(printf '%3s' "$MBGTA")</small> <span bgcolor='$MBGT' bgalpha='${MBGTA/#[0]/1}%'> </span><span bgcolor='$MBGT'> </span></tt> COLOR_MENU_BG_TO,^pipe(mbclr '$MBGT' jgctl color_menu_bg_to COLOR_MENU_BG_TO '$me')")
out+=("<tt><small>$(printf '%3s' "$MBORDERA")</small> <span bgcolor='$MBORDER' bgalpha='${MBORDERA/#[0]/1}%'> </span><span bgcolor='$MBORDER'> </span></tt> COLOR_MENU_BORDER,^pipe(mbclr '$MBORDER' jgctl color_menu_border COLOR_MENU_BORDER '$me')")
out+=("^sep()")
out+=("GRADIENT_POS [ $GRADIENT ],^checkout(gradientpos)")
out+=("^sep(separator/title)")
out+=("<tt><small>$(printf '%3s' "$TBGA")</small> <span bgcolor='$TBG' bgalpha='${TBGA}%'> </span><span bgcolor='$TBG'> </span></tt> COLOR_TITLE_BG,^pipe(mbclr '$TBG' jgctl color_title_bg COLOR_TITLE_BG '$me')")
out+=("<tt><small>$(printf '%3s' "$TFGA")</small> <span weight='bold' bgcolor='$TBG' bgalpha='${TBGA/#[0]/1}%' fgcolor='$TFG' fgalpha='${TFGA}%'> AbCd </span></tt> COLOR_TITLE_FG,^pipe(mbclr '$TFG' jgctl color_title_fg COLOR_TITLE_FG '$me')")
out+=("<tt><small>$(printf '%3s' "$TBORDERA")</small> <span bgcolor='$TBORDER' bgalpha='${TBORDERA/#[0]/1}%'> </span><span bgcolor='$TBORDER'> </span></tt> COLOR_TITLE_BORDER,^pipe(mbclr '$TBORDER' jgctl color_title_border COLOR_TITLE_BORDER '$me')")
out+=("^sep()")
out+=("SEP_HALIGN [ $SEPHALIGN ],^checkout(sephalign)")
out+=("^sep()")
out+=("<tt><small>$(printf '%3s' "$SEPFGA")</small> <span fgcolor='$SEPFG' fgalpha='${SEPFGA/#[0]/1}%'>------</span></tt> COLOR_SEP_FG,^pipe(mbclr '$SEPFG' jgctl color_sep_fg COLOR_SEP_FG '$me')")
out+=("^sep(item)")
out+=("<tt><small>$(printf '%3s' "$NFGA")</small> <span weight='bold' fgcolor='$NFG' fgalpha='${NFGA/#[0]/1}%'> AbCd </span></tt> COLOR_NORM_FG,^pipe(mbclr '$NFG' jgctl color_norm_fg COLOR_NORM_FG '$me')")
out+=("<tt><small>$(printf '%3s' "$SBGA")</small> <span bgcolor='$SBG' bgalpha='${SBGA/#[0]/1}%'> </span><span bgcolor='$SBG'> </span></tt> COLOR_SEL_BG,^pipe(mbclr '$SBG' jgctl color_sel_bg COLOR_SEL_BG '$me')")
out+=("<tt><small>$(printf '%3s' "$SFGA")</small> <span weight='bold' bgcolor='$SBG' bgalpha='${SBGA/#[0]/1}%' fgcolor='$SFG' fgalpha='${SFGA/#[0]/1}%'> AbCd </span></tt> COLOR_SEL_FG,^pipe(mbclr '$SFG' jgctl color_sel_fg COLOR_SEL_FG '$me')")
out+=("<tt><small>$(printf '%3s' "$SBORDERA")</small> <span bgcolor='$SBORDER' bgalpha='${SBORDERA/#[0]/1}%'> </span><span bgcolor='$SBORDER'> </span></tt> COLOR_SEL_BORDER,^pipe(mbclr '$SBORDER' jgctl color_sel_border COLOR_SEL_BORDER '$me')")
out+=("ITEM_BORDER [ $IBORDER ],^checkout(itemborder)")
out+=("ITEM_RADIUS [ $IRADIUS ],^checkout(itemradius)")
out+=("^sep()")
[[ ! -z "$NORMBG" ]] && out+=("<tt><small>$(printf '%3s' "$NORMBGA")</small> <span bgcolor='${NORMBG}' bgalpha='${NORMBGA/#[0]/1}%'> </span><span bgcolor='${NORMBG}'> </span></tt> COLOR_NORM_BG,^pipe(mbclr '$NORMBG' jgctl color_norm_bg COLOR_NORM_BG '$me')")
out2+=("^tag(gradientpos)")
out2+=("^sep(GRADIENT_POS <small>$GRADIENT</small>)")
out2+=("none,jgctl menu_gradient_pos none;$me")
out2+=("^sep()")
out2+=("top,jgctl menu_gradient_pos top;$me")
out2+=("right,jgctl menu_gradient_pos right;$me")
out2+=("bottom,jgctl menu_gradient_pos bottom;$me")
out2+=("left,jgctl menu_gradient_pos left;$me")
out2+=("top_left,jgctl menu_gradient_pos top_left;$me")
out2+=("top_right,jgctl menu_gradient_pos top_right;$me")
out2+=("bottom_left,jgctl menu_gradient_pos bottom_left;$me")
out2+=("bottom_right,jgctl menu_gradient_pos bottom_right;$me")
out2+=("^tag(sephalign)")
out2+=("^sep(SEP_HALIGN)")
out2+=("left,jgctl sep_halign left;$me")
out2+=("center,jgctl sep_halign center;$me")
out2+=("right,jgctl sep_halign right;$me")
out2+=("^tag(itemborder)")
out2+=("^sep(ITEM_BORDER)")
out2+=("0,jgctl item_border 0;$me")
out2+=("^sep()")
out2+=("1,jgctl item_border 1;$me")
out2+=("2,jgctl item_border 2;$me")
out2+=("^tag(itemradius)")
out2+=("^sep(ITEM_RADIUS)")
out2+=("0,jgctl item_radius 0;$me")
out2+=("^sep()")
out2+=("1,jgctl item_radius 1;$me")
out2+=("2,jgctl item_radius 2;$me")
out2+=("3,jgctl item_radius 3;$me")
out2+=("4,jgctl item_radius 4;$me")
out2+=("5,jgctl item_radius 5;$me")
out2+=("6,jgctl item_radius 6;$me")
out+=("")
out+=("^sep()")
if [ -f "${THEMERC}.bak" ]; then
out+=("RESET,jgctl reset;$me")
fi
out+=("EDIT FILE...,xdg-open $THEMERC")
out+=("rand,mb-setvar jgmenu_theme=$(basename -s .colorrc $(ls ~/.config/mabox/jgobthemes/*.colorrc | shuf -n 1));$me")
out+=("^sep(GLOBAL MENU SETTINGS)")
### COPIED FROM jgmenusettings-pipe for now
out+=("FONT_CUSTOM [ <b>${menu_font_family:-0} ${menu_font_size:-0}</b> ],mb-setfont menu;$me")
out+=("BORDER [ <b>${jgtools_border:-0}</b> ],^checkout(mborder)")
out+=("PADDING [ <b>${jgtools_padding:-0}</b> ],^checkout(mpadding)")
out+=("RADIUS [ <b>${jgtools_radius:-0}</b> ],^checkout(mradius)")
out+=("SUBSPACING [ <b>${submenu_spacing:-0}</b> ],^checkout(subspacing)")
out2+=("^tag(mborder)")
for i in 0 1 2 3 4 5 6 8 10 12; do out2+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar jgtools_border=${i};$me")");done
out2+=("^tag(mpadding)")
for i in 0 2 4 6 8 10 12 14 16 18 20 22 24 28 32 40; do out2+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar jgtools_padding=${i};$me")");done
out2+=("^tag(mradius)")
for i in 0 1 2 3 4 6 8 12 14 16 18 20 40; do out2+=("$(printf "<tt>%3s</tt>,%s" "$i" "mb-setvar jgtools_radius=${i};$me")");done
out2+=("^tag(subspacing)")
for i in -20 -8 -6 -4 -2 0 1 2 4 6 8 10 12 14 16 18 20; do out2+=("$(printf "<tt>%4s</tt>,%s" "$i" "mb-setvar submenu_spacing=${i};$me")");done
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
out+=("^sep()")
out+=(" ⮜ Back to Colorizer,colorizer -s")
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
jgmenu_icon_size=0
JGWIDTH=40
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158))
#WALLPAPER
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
#TEMP POSITION:
MENU_VALIGN="top"
MENU_MARGIN_Y="100"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB}
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"

256
bin/colorizer-ob 100755
View File

@ -0,0 +1,256 @@
#!/bin/bash
MBCOLORSDIR="$HOME/.themes/MBcolors/openbox-3/"
if [ !-f "${MBCOLORSDIR}" ]; then
mkdir -p ${MBCOLORSDIR}
rsync -a /usr/share/mabox-colorizer/themes/MBcolors/openbox-3/* ${MBCOLORSDIR}/
fi
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml")
THEMERC="$HOME/.themes/$OBTHEME/openbox-3/themerc"
me="colorizer-ob -s"
if [ -f "$THEMERC" ]; then
if [ ! -f "${THEMERC}.bak" ]; then
cp ${THEMERC} ${THEMERC}.bak
#check if lines, and add missing
# colorTo
# handle
# grip
# text.justify
# window.active.label.text.font:shadow=n:shadowtint=70:shadowoffset=1
#grep -qF -- "$LINE" "$FILE" || echo "$LINE" >> "$FILE"
grep ^[^#] "$THEMERC" | grep -qiF -- .active.title.bg.colorTo || echo "window.active.title.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.title.bg.colorTo || echo "window.inactive.title.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- handle.width: || echo "window.handle.width: 0" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .handle.bg: || echo "window.*.handle.bg: parentrelative" >> "$THEMERC"
################################################################################################################################## Kolory poniżej obliczyć
grep ^[^#] "$THEMERC" | grep -qiF -- .active.handle.bg.color: || echo "window.active.handle.bg.color: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .active.handle.bg.colorTo: || echo "window.active.handle.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.handle.bg.color: || echo "window.inactive.handle.bg.color: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.handle.bg.colorTo: || echo "window.inactive.handle.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .grip.bg: || echo "window.*.grip.bg: parentrelative" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .active.grip.bg.color: || echo "window.active.grip.bg.color: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .active.grip.bg.colorTo: || echo "window.active.grip.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.grip.bg.color: || echo "window.inactive.grip.bg.color: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.grip.bg.colorTo: || echo "window.inactive.grip.bg.colorTo: #222222" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .text.justify: || echo "window.*.text.justify: center" >> "$THEMERC"
grep ^[^#] "$THEMERC" | grep -qiF -- .text.font: || echo "window.*.text.font: shadow=n:shadowtint=70:shadowoffset=1" >> "$THEMERC"
fi
getvalues () {
read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read ABGTO <<< "$(grep .active.title.bg.colorTo ${THEMERC} | cut -d':' -f2)"
read NBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read NBGTO <<< "$(grep .inactive.title.bg.colorTo ${THEMERC} | cut -d':' -f2)"
read AFG <<< "$(grep .active.label.text.color ${THEMERC} | cut -d':' -f2)"
read NFG <<< "$(grep .inactive.label.text.color ${THEMERC} | cut -d':' -f2)"
read ALINE <<< "$(grep .active.border.color ${THEMERC} | cut -d':' -f2)"
read NLINE <<< "$(grep inactive.border.color ${THEMERC} | cut -d':' -f2)"
read PHEIGHT <<< "$(grep ^padding.height: ${THEMERC} | cut -d':' -f2)"
read PWIDTH <<< "$(grep ^padding.width: ${THEMERC} | cut -d':' -f2)"
read TXTJUST <<< "$(grep text.justify ${THEMERC} | cut -d':' -f2)"
read HANDLE <<< "$(grep handle.width ${THEMERC} | cut -d':' -f2)"
read BORD <<< "$(grep border.width ${THEMERC} | cut -d':' -f2)"
read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)"
if [ "$ABG" == "$AHBG" ];then
AHANDLE="yes"
else
AHANDLE="no"
fi
}
getvalues
out+=("^sep(Openbox theme: <i>$OBTHEME</i>)")
out+=("SELECT,^checkout(themes)")
out+=("^sep(TITLEBAR)")
out+=("<tt><span bgcolor='$ABG'> </span></tt> ACTIVEBG,^pipe(mbclr '$ABG' obtctl clractivebg ACTIVE_BG '$me')")
out+=("<tt><span bgcolor='$NBG'> </span></tt> NORMALBG,^pipe(mbclr '$NBG' obtctl clrnormalbg NORMAL_BG '$me')")
out+=("TEXT,^checkout(titletext)")
out+=("PADDING [ $PHEIGHT $PWIDTH ],^checkout(padding)")
out+=("^sep(BORDER)")
out+=("<tt><span bgcolor='$ALINE'> </span></tt> ACTIVELINE,^pipe(mbclr '$ALINE' obtctl activeborderColor ACTIVE_BORDER_COLOR '$me')")
out+=("<tt><span bgcolor='$NLINE'> </span></tt> NORMALLINE,^pipe(mbclr '$NLINE' obtctl inactiveborderColor INACTIVE_BORDER_COLOR '$me')")
out+=("BORDER [ $BORD ],^checkout(border)")
out+=("HANDLEWIDTH [ $HANDLE ],^checkout(handlewidth)")
out+=("^sep(EFFECTS)")
out+=("GRADIENT [ ${REST##* } ],^checkout(gradient)")
out+=("RAISED? [ $WINRAISED ],^checkout(raised)")
out+=("ACTIVEHANDLE? [ $AHANDLE ],^checkout(handle)")
out+=("^sep()")
if [ -f "${THEMERC}.bak" ]; then
out+=("RESET TO DEFAULTS,obtctl reset;$me")
fi
out+=("Edit...,xdg-open ${THEMERC}")
out2+=("^tag(themes)")
out2+=("^sep(themes)")
for i in $(ls $HOME/.themes);do
if [ -f "$HOME/.themes/${i}/openbox-3/themerc" ]; then
out2+=("$i,obtctl theme $i;$me")
fi
done
#TEXT
out2+=("^tag(titletext)")
out2+=("^sep(TITLE_BAR)")
out2+=("FONT...,mb-setfont obtitle;$me")
out2+=("TEXTALIGN [ $TXTJUST ],^checkout(talign)")
out2+=("SHADOW,^checkout(shadow)")
out2+=("^sep()")
out2+=("<tt><span bgcolor='$AFG'> </span></tt> ACTIVEFG,^pipe(mbclr '$AFG' obtctl activetextcolor ACTIVE_COLOR '$me')")
out2+=("<tt><span bgcolor='$NFG'> </span></tt> NORMALFG,^pipe(mbclr '$NFG' obtctl inactivetextcolor INACTIVE_COLOR '$me')")
#TEXTALIGN
out2+=("^tag(talign)")
out2+=("^sep(TEXTALIGN)")
out2+=("center,obtctl textjustify center;$me")
out2+=("left,obtctl textjustify left;$me")
out2+=("right,obtctl textjustify right;$me")
out2+=("^tag(shadow)")
out2+=("^sep(SHADOW)")
out2+=("no shadow,obtctl shadow 0;$me")
out2+=("^sep()")
out2+=("Dark,obtctl shadow 1;$me")
out2+=("Light,obtctl shadow 2;$me")
#PADDING
out2+=("^tag(padding)")
out2+=("^sep(VERTICAL)")
out2+=("0,obtctl paddingHeight 0;$me")
out2+=("^sep()")
out2+=("1,obtctl paddingHeight 1;$me")
out2+=("2,obtctl paddingHeight 2;$me")
out2+=("3,obtctl paddingHeight 3;$me")
out2+=("4,obtctl paddingHeight 4;$me")
out2+=("5,obtctl paddingHeight 5;$me")
out2+=("6,obtctl paddingHeight 6;$me")
out2+=("7,obtctl paddingHeight 7;$me")
out2+=("8,obtctl paddingHeight 8;$me")
out2+=("10,obtctl paddingHeight 10;$me")
out2+=("^sep(HORIZONTAL)")
out2+=("0,obtctl paddingWidth 0;$me")
out2+=("^sep()")
out2+=("1,obtctl paddingWidth 1;$me")
out2+=("2,obtctl paddingWidth 2;$me")
out2+=("3,obtctl paddingWidth 3;$me")
out2+=("4,obtctl paddingWidth 4;$me")
out2+=("5,obtctl paddingWidth 5;$me")
#BORDER
out2+=("^tag(border)")
out2+=("^sep(border)")
out2+=("0,obtctl borderWidth 0;$me")
out2+=("^sep()")
out2+=("1,obtctl borderWidth 1;$me")
out2+=("2,obtctl borderWidth 2;$me")
out2+=("3,obtctl borderWidth 3;$me")
out2+=("4,obtctl borderWidth 4;$me")
out2+=("5,obtctl borderWidth 5;$me")
#RAISED
out2+=("^tag(raised)")
out2+=("^sep(raised)")
out2+=("0 (flat),obtctl raised 0;$me")
out2+=("1 (raised),obtctl raised 1;$me")
#GRADIENT
out2+=("^tag(gradient)")
out2+=("^sep(GRADIENT)")
out2+=("solid,obtctl gradient solid;$me")
out2+=("^sep()")
out2+=("Vertical,obtctl gradient vertical;$me")
out2+=("Horizontal,obtctl gradient horizontal;$me")
out2+=("MirrorHorizontal,obtctl gradient mirrorhorizontal;$me")
out2+=("SplitVertical,obtctl gradient splitvertical;$me")
out2+=("Diagonal,obtctl gradient diagonal;$me")
out2+=("CrossDiagonal,obtctl gradient crossdiagonal;$me")
out2+=("Pyramid,obtctl gradient pyramid;$me")
out2+=("^sep(COLORS)")
[[ ! -z "$ABGTO" ]] && out2+=("<tt><span bgcolor='$ABGTO'> </span></tt> ACTIVEBGTO,^pipe(mbclr '$ABGTO' obtctl clractivebgto ACTIVE_BG_TO '$me')")
[[ ! -z "$ABGTO" ]] && out2+=("<tt><span bgcolor='$NBGTO'> </span></tt> NORMALBGTO,^pipe(mbclr '$NBGTO' obtctl clrnormalbgto INACTIVE_BG_TO '$me')")
#HANDLE
out2+=("^tag(handle)")
out2+=("^sep(ACTIVEHANDLE)")
out2+=("NO,obtctl activehandle no;$me")
out2+=("YES,obtctl activehandle yes;$me")
out2+=("GRIPONLY,obtctl activehandle grip;$me")
#HANDLE
out2+=("^tag(handlewidth)")
out2+=("^sep(HANDLEWIDTH)")
out2+=("0,obtctl handlewidth 0;$me")
out2+=("^sep()")
out2+=("2,obtctl handlewidth 2;$me")
out2+=("3,obtctl handlewidth 3;$me")
out2+=("4,obtctl handlewidth 4;$me")
out2+=("6,obtctl handlewidth 6;$me")
out2+=("8,obtctl handlewidth 8;$me")
out2+=("10,obtctl handlewidth 10;$me")
else
out+=("^sep(NOT WRITABLE)")
for i in $(ls $HOME/.themes);do
if [ -f "$HOME/.themes/${i}/openbox-3/themerc" ]; then
out+=("$i,obtctl theme $i;$me")
fi
done
fi
### RUN
if [[ "$1" == "-s" ]]; then
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
. $HOME/.config/mabox/mabox.conf
out+=("^sep()")
out+=(" ⮜ Back to Colorizer,colorizer -s")
if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top"
MENU_MARGIN_Y=${panels_topmargin:-0}
elif [[ $panels_heightpos == "bottom" ]]; then
MENU_VALIGN="bottom"
MENU_MARGIN_Y=${panels_topmargin:-0}
else
MENU_VALIGN="center"
fi
MENU_PADDING_TOP=${jgtools_padding:-0}
MENU_HALIGN="left"
jgmenu_icon_size=0
JGWIDTH=40
menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0
JGWIDTH=$((jgtools_padding + 278 + jgtools_padding))
MENU_PADDING_TOP=$((jgtools_padding + 158))
# WALLPAPER IMAGE
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
THUMBDIR="$HOME/.config/mabox/wallthumbs"
mkdir -p ${THUMBDIR}
THUMB="${THUMBDIR}/${WALLPAPER}.png"
if [[ ! -f "$THUMB" ]]
then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi
#TEMP POSITION:
MENU_VALIGN="top"
MENU_MARGIN_Y="100"
mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,$HOME/.config/mabox/colorizer-ob.png
$(printf '%s\n' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0
fi
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"

316
bin/conkyctl 100755
View File

@ -0,0 +1,316 @@
#!/bin/bash
#
# conkyctl
CONKYDIR="$HOME/.config/conky"
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
SESSIONFILE="$CONKYDIR/conky-sessionfile"
update_session () {
:> "${SESSIONFILE}"
while read -r pid b c confpath
do
echo "$b $c ${confpath} & sleep .5" >> ${SESSIONFILE}
done < <(pgrep -af "conky .*mbcolor")
}
transparent_all () {
sd "own_window_transparent.*$" "own_window_transparent = ${1}," ${CONKYDIR}/*mbcolor.conkyrc
}
transparent () {
sd "own_window_transparent.*$" "own_window_transparent = ${1}," ${2}
}
win_bgcolor_all () {
sd "own_window_colour .*=.*$" "own_window_colour = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc
sd "own_window_transparent.*$" "own_window_transparent = false," ${CONKYDIR}/*mbcolor.conkyrc
}
win_bgcolor () {
sd "own_window_colour .*=.*$" "own_window_colour = '${1}'," ${2}
sd "own_window_transparent.*$" "own_window_transparent = false," ${2}
}
draw_borders_all () {
sd "draw_borders.*$" "draw_borders = ${1}," ${CONKYDIR}/*mbcolor.conkyrc
}
draw_borders () {
sd "draw_borders.*$" "draw_borders = ${1}," ${2}
}
stippled_borders_all () {
sd "stippled_borders.*$" "stippled_borders = ${1}," ${CONKYDIR}/*mbcolor.conkyrc
sd "draw_borders.*$" "draw_borders = true," ${CONKYDIR}/*mbcolor.conkyrc
}
stippled_borders () {
sd "stippled_borders.*$" "stippled_borders = ${1}," ${2}
sd "draw_borders.*$" "draw_borders = true," ${2}
}
default_color_all () {
sd "default_color .*=.*$" "default_color = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc
}
color0_all () {
sd "color0 .*=.*$" "color0 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc
}
color1_all () {
sd "color1 .*=.*$" "color1 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc
}
color2_all () {
sd "color2 .*=.*$" "color2 = '${1}'," ${CONKYDIR}/*mbcolor.conkyrc
}
default_color () {
sd "default_color .*=.*$" "default_color = '${1}'," ${2}
}
color0 () {
sd "color0 .*=.*$" "color0 = '${1}'," ${2}
}
color1 () {
sd "color1 .*=.*$" "color1 = '${1}'," ${2}
}
color2 () {
sd "color2 .*=.*$" "color2 = '${1}'," ${2}
}
basefont_inc_all () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE++))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
}
basefont_dec_all () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE--))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
}
basefont_inc () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE++))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${1}
}
basefont_dec () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE--))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${1}
}
shades_all () {
case "$1" in
shadow)
sd "draw_shades .*=.*,$" "draw_shades = true," ${CONKYDIR}/*mbcolor.conkyrc
sd "draw_outline .*=.*,$" "draw_outline = false," ${CONKYDIR}/*mbcolor.conkyrc
;;
outline)
sd "draw_shades .*=.*,$" "draw_shades = false," ${CONKYDIR}/*mbcolor.conkyrc
sd "draw_outline .*=.*,$" "draw_outline = true," ${CONKYDIR}/*mbcolor.conkyrc
;;
*)
sd "draw_shades .*=.*,$" "draw_shades = false," ${CONKYDIR}/*mbcolor.conkyrc
sd "draw_outline .*=.*,$" "draw_outline = false," ${CONKYDIR}/*mbcolor.conkyrc
;;
esac
}
shades () {
case "$1" in
shadow)
sd "draw_shades .*=.*,$" "draw_shades = true," ${2}
sd "draw_outline .*=.*,$" "draw_outline = false," ${2}
;;
outline)
sd "draw_shades .*=.*,$" "draw_shades = false," ${2}
sd "draw_outline .*=.*,$" "draw_outline = true," ${2}
;;
*)
sd "draw_shades .*=.*,$" "draw_shades = false," ${2}
sd "draw_outline .*=.*,$" "draw_outline = false," ${2}
;;
esac
}
pos () {
def_x=${conky_gap_x:-30}
def_y=${conky_gap_y:-60}
sd "alignment .*=.*,$" "alignment = '${1}'," ${2}
### jak po środku to wyzerować gaps
case "$1" in
top_left|top_right|bottom_left|bottom_right)
sd "gap_x .*=.*,$" "gap_x = ${def_x}," ${2}
sd "gap_y .*=.*,$" "gap_y = ${def_y}," ${2}
;;
top_middle|bottom_middle)
sd "gap_x .*=.*,$" "gap_x = 0," ${2}
sd "gap_y .*=.*,$" "gap_y = ${def_y}," ${2}
;;
middle_left|middle_right)
sd "gap_x .*=.*,$" "gap_x = ${def_x}," ${2}
sd "gap_y .*=.*,$" "gap_y = 0," ${2}
;;
middle_middle)
sd "gap_x .*=.*,$" "gap_x = 0," ${2}
sd "gap_y .*=.*,$" "gap_y = 0," ${2}
;;
esac
}
gap_x () {
sd "gap_x .*=.*,$" "gap_x = ${1}," ${2}
}
gap_y () {
sd "gap_y .*=.*,$" "gap_y = ${1}," ${2}
}
startone () {
conky -c "${1}"
update_session
}
startall () {
for i in "$CONKYDIR"/*_mbcolor*; do
if pgrep -af "conky .*${i}" >/dev/null; then
:
else
conky -c "${i}"
fi
done
update_session
}
kill () {
pkill -f "conky .*${1}"
update_session
}
single () {
me="colorizer-conky -s"
read POS <<< "$(grep alignment ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
read GAPX <<< "$(grep gap_x ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read GAPY <<< "$(grep gap_y ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read WINTRANS <<< "$(grep own_window_transparent ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read FONTDEF <<< "$(grep "font .*=.*,$" ${1} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
read WINCLR <<< "$(grep own_window_colour ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${1}"
read CLR <<< "$(grep default_color ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}"
read CLR0 <<< "$(grep color0 ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}"
read CLR1 <<< "$(grep color1 ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}"
read CLR2 <<< "$(grep color2 ${1} | cut -d'=' -f2 | cut -d"'" -f2)"
[[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}"
read BORD <<< "$(grep draw_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)"
read STIP <<< "$(grep stippled_borders ${1} | cut -d'=' -f2 | cut -d"," -f1)"
[[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG=""
out+=("^sep(POSITION)")
out+=("Alignment [ $POS ],^checkout(pos)")
out2+=("^tag(pos)")
out2+=("^sep(POSITION)")
out2+=("TopLeft,conkyctl pos top_left ${1};$me")
out2+=("Top,conkyctl pos top_middle ${1};$me")
out2+=("TopRight,conkyctl pos top_right ${1};$me")
out2+=("Left,conkyctl pos middle_left ${1};$me")
out2+=("Center,conkyctl pos middle_middle ${1};$me")
out2+=("Right,conkyctl pos middle_right ${1};$me")
out2+=("BottomLeft,conkyctl pos bottom_left ${1};$me")
out2+=("Bottom,conkyctl pos bottom_middle ${1};$me")
out2+=("BottomRight,conkyctl pos bottom_right ${1};$me")
out+=("HORIZONTAL GAP [ $GAPX ],^checkout(gapx)")
out2+=("^tag(gapx)")
out2+=("^sep(HORIZONTAL_GAP)")
for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 ; do
out2+=("${i},conkyctl gap_x ${i} ${1};$me")
done
out+=("VERTICAL GAP [ $GAPY ],^checkout(gapy)")
out2+=("^tag(gapy)")
out2+=("^sep(VERTICAL_GAP)")
for i in 0 10 20 30 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340; do
out2+=("${i},conkyctl gap_y ${i} ${1};$me")
done
out+=("^sep(COLORS)")
[[ "$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})")
[[ "$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})")
out+=("^sep()")
if [ "$WINTRANS" == false ];then
out+=("<small><span bgcolor='$WINCLR'> </span><span ${BG} fgcolor='$WINCLR'> AbCd </span></small> Background,^checkout(transsingle)")
else
out+=("<small><span>transparent </span></small> Background,^checkout(transsingle)")
fi
out2+=("^tag(transsingle)")
out2+=("^sep(TRANSPARENT?)")
out2+=("Yes,conkyctl transparent true ${1};$me")
out2+=("No,conkyctl transparent false ${1};$me")
out2+=("^sep()")
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)")
out2+=("^tag(fontsingle)")
out2+=("^sep(BASE_FONT)")
out2+=("<tt>++</tt> Increase,conkyctl basefont_inc ${1};$me")
out2+=("<tt>--</tt> Decrease,conkyctl basefont_dec ${1};$me")
out2+=("^sep(Outline/Shadow)")
out2+=("No,conkyctl shades no ${1};$me")
out2+=("^sep()")
out2+=("Draw shades,conkyctl shades shadow ${1};$me")
out2+=("Draw outline,conkyctl shades outline ${1};$me")
out+=("^sep()")
out+=("BORDERS [ $BORD $STIP ],^checkout(bordersingle)")
out2+=("^tag(bordersingle)")
out2+=("^sep(DRAW BORDERS?)")
out2+=("Yes,conkyctl draw_borders true ${1};$me")
out2+=("No,conkyctl draw_borders false ${1};$me")
out2+=("^sep(STIPPLED BORDERS?)")
out2+=("0,conkyctl stippled_borders 0 ${1};$me")
out2+=("1,conkyctl stippled_borders 1 ${1};$me")
out2+=("2,conkyctl stippled_borders 2 ${1};$me")
out2+=("3,conkyctl stippled_borders 3 ${1};$me")
out2+=("4,conkyctl stippled_borders 4 ${1};$me")
out+=("^sep()")
out+=("EDIT...,xdg-open ${1}")
out+=("^sep()")
out+=("Kill ${1##*/},conkyctl kill ${1##*/};${me}")
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
exit 0
}
case "$1" in
transparent_all) transparent_all "$2";;
transparent) transparent "$2" "$3";;
win_bgcolor_all) win_bgcolor_all "$2";;
win_bgcolor) win_bgcolor "$2" "$3";;
draw_borders_all) draw_borders_all "$2" ;;
draw_borders) draw_borders "$2" "$3";;
stippled_borders_all) stippled_borders_all "$2" ;;
stippled_borders) stippled_borders "$2" "$3";;
default_color_all) default_color_all "$2";;
color0_all) color0_all "$2";;
color1_all) color1_all "$2";;
color2_all) color2_all "$2";;
default_color) default_color "$2" "$3";;
color0) color0 "$2" "$3";;
color1) color1 "$2" "$3";;
color2) color2 "$2" "$3";;
basefont_inc_all) basefont_inc_all;;
basefont_dec_all) basefont_dec_all;;
basefont_inc) basefont_inc "$2";;
basefont_dec) basefont_dec "$2";;
shades_all) shades_all "$2";;
shades) shades "$2" "$3";;
single) single "$2";;
pos) pos "$2" "$3";;
gap_x) gap_x "$2" "$3";;
gap_y) gap_y "$2" "$3";;
startone) startone "$2";;
startall) startall;;
kill) kill "$2";;
reset) reset ;;
*) : ;;
esac

182
bin/jgctl 100755
View File

@ -0,0 +1,182 @@
#!/bin/bash
# jgctl - menu config actions
# jgctl variable value config_file
. $HOME/.config/mabox/mabox.conf
case "$jgmenu_theme" in
obtheme)
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml");
THEMERC="$HOME/.config/mabox/jgobthemes/${OBTHEME}.colorrc";;
*)
THEMERC="$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc";;
esac
reset () {
rm ${THEMERC}
mv ${THEMERC}.bak ${THEMERC}
}
color_menu_bg () {
read MBG MBGA<<< "$(grep 'color_menu_bg ' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_menu_bg .*$" "color_menu_bg = $1 $MBGA" ${THEMERC}
;;
*)
sd "color_menu_bg .*$" "color_menu_bg = $MBG $1" ${THEMERC}
;;
esac
}
color_menu_bg_to () {
read MBGT MBGTA<<< "$(grep 'color_menu_bg_to ' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_menu_bg_to.*$" "color_menu_bg_to = $1 $MBGTA" ${THEMERC}
;;
*)
sd "color_menu_bg_to.*$" "color_menu_bg_to = $MBGT $1" ${THEMERC}
;;
esac
}
color_menu_border () {
read MBORDER MBORDERA<<< "$(grep 'color_menu_border' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_menu_border.*$" "color_menu_border = $1 $MBORDERA" ${THEMERC}
;;
*)
sd "color_menu_border.*$" "color_menu_border = $MBORDER $1" ${THEMERC}
;;
esac
}
menu_gradient_pos () {
sd "menu_gradient_pos.*$" "menu_gradient_pos = $1" ${THEMERC}
}
sep_halign () {
sd "sep_halign.*$" "sep_halign = $1" ${THEMERC}
}
color_sep_fg () {
read SFG SFGA<<< "$(grep 'color_sep_fg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_sep_fg.*$" "color_sep_fg = $1 $SFGA" ${THEMERC}
;;
*)
sd "color_sep_fg.*$" "color_sep_fg = $SFG $1" ${THEMERC}
;;
esac
}
color_title_bg () {
read TBG TBGA<<< "$(grep 'color_title_bg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_title_bg.*$" "color_title_bg = $1 $TBGA" ${THEMERC}
;;
*)
sd "color_title_bg.*$" "color_title_bg = $TBG $1" ${THEMERC}
;;
esac
}
color_title_fg () {
read TFG TFGA<<< "$(grep 'color_title_fg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_title_fg.*$" "color_title_fg = $1 $TFGA" ${THEMERC}
;;
*)
sd "color_title_fg.*$" "color_title_fg = $TFG $1" ${THEMERC}
;;
esac
}
color_title_border () {
read TBORDER TBORDERA<<< "$(grep 'color_title_border' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_title_border.*$" "color_title_border = $1 $TBORDERA" ${THEMERC}
;;
*)
sd "color_title_border.*$" "color_title_border = $TBORDER $1" ${THEMERC}
;;
esac
}
item_border () {
sd "item_border.*$" "item_border = $1" ${THEMERC}
}
item_radius () {
sd "item_radius.*$" "item_radius = $1" ${THEMERC}
}
color_norm_bg () {
read NBG NBGA<<< "$(grep 'color_norm_bg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_norm_bg.*$" "color_norm_bg = $1 $NBGA" ${THEMERC}
;;
*)
sd "color_norm_bg.*$" "color_norm_bg = $NBG $1" ${THEMERC}
;;
esac
}
color_norm_fg () {
read NFG NFGA<<< "$(grep 'color_norm_fg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_norm_fg.*$" "color_norm_fg = $1 $NFGA" ${THEMERC}
;;
*)
sd "color_norm_fg.*$" "color_norm_fg = $NFG $1" ${THEMERC}
;;
esac
}
color_sel_bg () {
read SBG SBGA<<< "$(grep 'color_sel_bg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_sel_bg.*$" "color_sel_bg = $1 $SBGA" ${THEMERC}
;;
*)
sd "color_sel_bg.*$" "color_sel_bg = $SBG $1" ${THEMERC}
;;
esac
}
color_sel_fg () {
read SFG SFGA<<< "$(grep 'color_sel_fg' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_sel_fg.*$" "color_sel_fg = $1 $SFGA" ${THEMERC}
;;
*)
sd "color_sel_fg.*$" "color_sel_fg = $SFG $1" ${THEMERC}
;;
esac
}
color_sel_border () {
read SBORDER SBORDERA<<< "$(grep 'color_sel_border' ${THEMERC} | cut -d'=' -f2)"
case "${#1}" in
7) #color
sd "color_sel_border.*$" "color_sel_border = $1 $SBORDERA" ${THEMERC}
;;
*)
sd "color_sel_border.*$" "color_sel_border = $SBORDER $1" ${THEMERC}
;;
esac
}
case "$1" in
reset) reset ;;
color_menu_bg) color_menu_bg "$2";;
color_menu_bg_to) color_menu_bg_to "$2";;
color_menu_border) color_menu_border "$2";;
menu_gradient_pos) menu_gradient_pos "$2";;
sep_halign) sep_halign "$2";;
color_sep_fg) color_sep_fg "$2";;
color_title_bg) color_title_bg "$2";;
color_title_fg) color_title_fg "$2";;
color_title_border) color_title_border "$2";;
item_border) item_border "$2";;
item_radius) item_radius "$2";;
color_norm_bg) color_norm_bg "$2";;
color_norm_fg) color_norm_fg "$2";;
color_sel_bg) color_sel_bg "$2";;
color_sel_fg) color_sel_fg "$2";;
color_sel_border) color_sel_border "$2";;
*) : ;;
esac

154
bin/mbclr 100755
View File

@ -0,0 +1,154 @@
#!/bin/bash
#
# mbclr current polecenie funkcja argument backprg [config_file]
# mbclr
main () {
#read WALLPAPER<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPALDIR="$HOME/.config/mbxcolors/palettes/wallp"
mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
WALLPAPER=${WALLPATH##*/}
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr"
fi
mapfile -t wallcolors < "$WALLPALDIR/$WALLPAPER.clr"
dark=("#000000" "#111111" "#222222" "#333333" "#444444" "#555555" "#666666")
light=("#FFFFFF" "#EEEEEE" "#DDDDDD" "#CCCCCC" "#BBBBBB" "#AAAAAA" "#999999")
yt=("#181818" "#212121" "#3d3d3d" "#FFFFFF" "#AAAAAA")
plasma=("#e93a9a" "#e93d58" "#e9643a" "#e8cb2d" "#3dd425" "#00d3b8" "#3daee9" "#b875dc" "#926ee4" "#686b6f",)
#ubuntu
ubuntu=("#E95420" "#18b0b0" "#3584e4" "#0e8420" "#c748ba" "#77216f" "#c7162b" "#f4a100")
#linuxmint
mint+=("#6cabcd" "#5b73c4" "#aa876a" "#9d9d9d" "#db9d61" "#c76199" "#8c6ec9" "#c15b58" "#c8ac69" "#5aaa9a")
w8+=("#a4c400" "#60a917" "#008a00" "#00aba9" "#1ba1e2" "#3e65ff" "#0050ef" "#6a00ff" "#aa00ff" "#f472d0" "#d80073" "#a20025" "#e51400" "#fa6800" "#f0a30a" "#e3c800" "#825a2c" "#6d8764" "#647687" "#76608a" "#87794e" "#a0522d")
#for i in $(theme.sh -p |cut -d':' -f2)
#do
#colors+=("$i")
#done
out+=("^sep($4)")
if [[ "$2" == "jgctl" ]]; then
. $HOME/.config/mabox/mabox.conf
case "$jgmenu_theme" in
obtheme)
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml");
THEMERC="$HOME/.config/mabox/jgobthemes/${OBTHEME}.colorrc";;
*)
THEMERC="$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc";;
esac
read COLOR OP<<< $(grep "${3}" ${THEMERC} | cut -d'=' -f2)
out+=("^sep(OPACITY)")
out+=("OPACITY <small>[ $OP ]</small>,^checkout(opacity)")
out2+=("^tag(opacity)")
out2+=("^sep(OPACITY <small>[ $OP ]</small>")
out2+=("<tt><small>100</small> <span bgcolor='$1' bgalpha='100%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 100;${5}")
out2+=("<tt><small> 95</small> <span bgcolor='$1' bgalpha='95%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 95 ;${5}")
out2+=("<tt><small> 90</small> <span bgcolor='$1' bgalpha='90%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 90 ;${5}")
out2+=("<tt><small> 80</small> <span bgcolor='$1' bgalpha='80%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 80 ;${5}")
out2+=("<tt><small> 70</small> <span bgcolor='$1' bgalpha='70%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 70 ;${5}")
out2+=("<tt><small> 60</small> <span bgcolor='$1' bgalpha='60%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 60 ;${5}")
out2+=("<tt><small> 50</small> <span bgcolor='$1' bgalpha='50%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 50 ;${5}")
out2+=("<tt><small> 40</small> <span bgcolor='$1' bgalpha='40%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 40 ;${5}")
out2+=("<tt><small> 30</small> <span bgcolor='$1' bgalpha='30%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 30 ;${5}")
out2+=("<tt><small> 20</small> <span bgcolor='$1' bgalpha='20%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 20 ;${5}")
out2+=("<tt><small> 10</small> <span bgcolor='$1' bgalpha='10%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 10 ;${5}")
out2+=("<tt><small> 5</small> <span bgcolor='$1' bgalpha='5%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 5 ;${5}")
out2+=("<tt><small> 0</small> <span bgcolor='$1' bgalpha='1%'> </span><span bgcolor='$1'> </span></tt>,jgctl $3 0 ;${5}")
fi
#Current
out+=("^sep(SELECT_COLOR)")
out+=(" Select or pick from screen,mbclr pick $2 $3 ${5}")
out+=("^sep()")
out+=("<tt><span bgcolor='$1'> </span></tt> shades of current,^checkout(curshades)")
out+=("^sep(Wallpaper colors)")
for i in "${wallcolors[@]}"
do
out+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}")
done
out+=("^sep(ACCENT COLORS)")
out+=("Ubuntu,^checkout(ubuntu)")
out2+=("^tag(ubuntu)" "^sep(Ubuntu)")
for i in ${ubuntu[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done
out+=("Mint,^checkout(mint)")
out2+=("^tag(mint)" "^sep(Mint)")
for i in ${mint[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done
out+=("Plasma,^checkout(plasma)")
out2+=("^tag(plasma)" "^sep(Plasma)")
for i in ${plasma[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done
out+=("W8,^checkout(w8)")
out2+=("^tag(w8)" "^sep(W8)")
for i in ${w8[@]};do out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}");done
out+=("^sep()")
out+=("<tt><span bgcolor='#DDDDDD'> </span></tt> Light colors..,^checkout(light)")
out2+=("^tag(light)")
out2+=("^sep(LIGHT)")
for i in "${light[@]}"
do
out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}")
done
out+=("^sep()")
out+=("<tt><span bgcolor='#222222'> </span></tt> Dark colors..,^checkout(dark)")
out2+=("^tag(dark)")
out2+=("^sep(DARK)")
for i in "${dark[@]}"
do
out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}")
done
out+=("^sep()")
out+=("<tt><span bgcolor='#181818'> </span></tt> YT colors..,^checkout(yt)")
out2+=("^tag(yt)")
out2+=("^sep(yt)")
for i in "${yt[@]}"
do
out2+=("<tt><small>$i</small> <span bgcolor='$i'> </span></tt>,$2 $3 '${i}' ${6};${5}")
done
#Shades
out2+=("^tag(curshades)")
out2+=("^sep(Shades of $1)")
for i in 3 25 2 15 1 05; do
clr=$(pastel lighten 0.$i "${1}" | pastel format hex)
if [ "${clr}" != "#ffffff" ];then
out2+=("<tt><small>$clr</small> <span bgcolor='$clr'> </span></tt>,$2 $3 '${clr}' ${6};${5}")
fi
done
out2+=("^sep()")
out2+=("<tt><small>$1</small> <span bgcolor='$1'> </span></tt>,$2 $3 '${1}' ${6};${5}")
out2+=("^sep()")
for i in 05 1 15 2 25 3; do
clr=$(pastel darken 0.$i "${1}" | pastel format hex)
if [ "${clr}" != "#000000" ];then
out2+=("<tt><small>$clr</small> <span bgcolor='$clr'> </span></tt>,$2 $3 '${clr}' ${6};${5}")
fi
done
printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"
}
pickcolor () {
color=$(gcolor3 2>/dev/null)
if [ "$color" ]; then
mycmd=("$1 $2 '${color}';${3} -s")
fi
eval "${mycmd[@]}"
#notify-send.sh "Qpa $1" "${mycmd[@]}"
}
case "$1" in
pick) pickcolor "$2" "${3}" "${5}";;
*) main "$@" ;;
esac

225
bin/obtctl 100755
View File

@ -0,0 +1,225 @@
#!/bin/bash
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml")
#echo "$OBTHEME"
THEMERC="$HOME/.themes/$OBTHEME/openbox-3/themerc"
if [ ! -f "${THEMERC}.bak" ]; then
cp ${THEMERC} ${THEMERC}.bak
fi
theme () {
xmlstarlet ed -L -N o="http://openbox.org/3.4/rc" -u '/o:openbox_config/o:theme/o:name' -v "$1" "$HOME/.config/openbox/rc.xml"
openbox --reconfigure
}
reset () {
rm ${THEMERC}
mv ${THEMERC}.bak ${THEMERC}
openbox --reconfigure
}
borderWidth () {
sd "^border.width:.*$" "border.width: $1" ${THEMERC}
openbox --reconfigure
}
activeborderColor () {
sd "\.active.border.color:.*$" ".active.border.color: $1" ${THEMERC}
openbox --reconfigure
}
inactiveborderColor () {
sd "\.inactive.border.color:.*$" ".inactive.border.color: $1" ${THEMERC}
openbox --reconfigure
}
paddingHeight () {
sd "^padding.height:.*$" "padding.height: $1" ${THEMERC}
openbox --reconfigure
}
paddingWidth () {
sd "^padding.width:.*$" "padding.width: $1" ${THEMERC}
openbox --reconfigure
}
textjustify () {
sd "\.text.justify:.*$" ".text.justify: $1" ${THEMERC}
openbox --reconfigure
}
shadow () {
case "$1" in
0)
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=n:shadowtint=70:shadowoffset=1" ${THEMERC}
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=n:shadowtint=20:shadowoffset=1" ${THEMERC}
;;
1)
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=y:shadowtint=70:shadowoffset=1" ${THEMERC}
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=y:shadowtint=20:shadowoffset=1" ${THEMERC}
;;
2)
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=y:shadowtint=-70:shadowoffset=1" ${THEMERC}
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=y:shadowtint=-20:shadowoffset=1" ${THEMERC}
;;
esac
openbox --reconfigure
}
handlewidth () {
sd "\.handle.width:.*$" ".handle.width: $1" ${THEMERC}
openbox --reconfigure
}
raised () {
#flat or raised
read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
case "$1" in
0)
sd "\.title.bg:.*$" ".title.bg: flat ${REST}" ${THEMERC}
sd "\.handle.bg:.*$" ".handle.bg: flat ${REST}" ${THEMERC}
sd "\.grip.bg:.*$" ".grip.bg: flat ${REST}" ${THEMERC}
openbox --reconfigure;;
1)
sd "\.title.bg:.*$" ".title.bg: raised ${REST}" ${THEMERC}
sd "\.handle.bg:.*$" ".handle.bg: raised ${REST}" ${THEMERC}
sd "\.grip.bg:.*$" ".grip.bg: raised ${REST}" ${THEMERC}
openbox --reconfigure;;
esac
}
gradient () {
#solid or gradient gradient-type
read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
case "$1" in
solid)
sd "\.title.bg:.*$" ".title.bg: ${WINRAISED} solid" ${THEMERC}
sd "\.handle.bg:.*$" ".handle.bg: ${WINRAISED} solid" ${THEMERC}
sd "\.grip.bg:.*$" ".grip.bg: ${WINRAISED} solid" ${THEMERC}
openbox --reconfigure;;
*)
sd "\.title.bg:.*$" ".title.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
sd "\.handle.bg:.*$" ".handle.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
sd "\.grip.bg:.*$" ".grip.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
openbox --reconfigure;;
esac
}
activehandle () {
case "$1" in
no) #no
read NBG <<< "$(grep inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read NBGTO <<< "$(grep inactive.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
#notify-send.sh "Normal" "${NBG} ${NBGTO}"
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${NBG}" ${THEMERC}
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${NBGTO}" ${THEMERC}
sd "\.active.grip.bg:.*$" ".active.grip.bg: parentrelative" ${THEMERC}
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${NBG}" ${THEMERC}
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${NBGTO}" ${THEMERC}
;;
yes) #yes
read ABG <<< "$(grep window.active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read ABGTO <<< "$(grep window.active.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
#notify-send.sh "Active" "${ABG} ${ABGTO}"
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${ABG}" ${THEMERC}
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${ABGTO}" ${THEMERC}
sd "\.active.grip.bg:.*$" ".active.grip.bg: parentrelative" ${THEMERC}
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${ABG}" ${THEMERC}
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${ABGTO}" ${THEMERC}
;;
grip)
read GRAD <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
read ABG <<< "$(grep window.active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read ABGTO <<< "$(grep window.active.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
read NBG <<< "$(grep inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read NBGTO <<< "$(grep inactive.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
sd "\.active.grip.bg:.*$" ".active.grip.bg: ${GRAD}" ${THEMERC}
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${ABG}" ${THEMERC}
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${ABGTO}" ${THEMERC}
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${NBG}" ${THEMERC}
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${NBGTO}" ${THEMERC}
;;
esac
#openbox --reconfigure
}
clractivebg () {
colorTo=$(pastel darken 0.1 "${1}"|pastel format hex)
#activehandle?
read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)"
if [ "$ABG" == "$AHBG" ];then
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${1}" ${THEMERC}
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${colorTo}" ${THEMERC}
fi
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${1}" ${THEMERC}
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${colorTo}" ${THEMERC}
sd "^window.active.title.bg.color:.*$" "window.active.title.bg.color: ${1}" ${THEMERC}
sd "\.active.border.color:.*$" ".active.border.color: ${1}" ${THEMERC}
sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${colorTo}" ${THEMERC}
openbox --reconfigure
}
clrnormalbg () {
colorTo=$(pastel darken 0.1 "${1}"|pastel format hex)
#normalhandle?
read IBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read IHBG <<< "$(grep .inactive.handle.bg.color: ${THEMERC} | cut -d':' -f2)"
if [ "$IBG" == "$IHBG" ];then
sd "\.inactive.handle.bg.color:.*$" ".inactive.handle.bg.color: ${1}" ${THEMERC}
sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${colorTo}" ${THEMERC}
fi
sd "\.inactive.grip.bg.color:.*$" ".inactive.grip.bg.color: ${1}" ${THEMERC}
sd "\.inactive.grip.bg.colorTo:.*$" ".inactive.grip.bg.colorTo: ${colorTo}" ${THEMERC}
sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${1}" ${THEMERC}
sd "\.inactive.border.color:.*$" ".inactive.border.color: ${1}" ${THEMERC}
sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${colorTo}" ${THEMERC}
openbox --reconfigure
}
clractivebgto () {
sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${1}" ${THEMERC}
#activehandle?
read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)"
if [ "$ABG" == "$AHBG" ];then
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${1}" ${THEMERC}
fi
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${1}" ${THEMERC}
openbox --reconfigure
}
clrnormalbgto () {
sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${1}" ${THEMERC}
#normalhandle?
read IBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
read IHBG <<< "$(grep .inactive.handle.bg.color: ${THEMERC} | cut -d':' -f2)"
if [ "$IBG" == "$IHBG" ];then
sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${1}" ${THEMERC}
fi
sd "\.inactive.grip.bg.colorTo:.*$" ".inactive.grip.bg.colorTo: ${1}" ${THEMERC}
openbox --reconfigure
}
activetextcolor () {
sd "\.active.label.text.color:.*$" ".active.label.text.color: ${1}" ${THEMERC}
openbox --reconfigure
}
inactivetextcolor () {
sd "\.inactive.label.text.color:.*$" ".inactive.label.text.color: ${1}" ${THEMERC}
openbox --reconfigure
}
case "$1" in
theme) theme "$2";;
reset) reset;;
borderWidth) borderWidth "$2";;
activeborderColor) activeborderColor "$2";;
inactiveborderColor) inactiveborderColor "$2";;
paddingHeight) paddingHeight "$2";;
paddingWidth) paddingWidth "$2";;
textjustify) textjustify "$2";;
shadow) shadow "$2";;
handlewidth) handlewidth "$2";;
raised) raised "$2";;
gradient) gradient "$2";;
activehandle) activehandle "$2"
openbox --reconfigure
;;
clractivebg) clractivebg "$2";;
clractivebgto) clractivebgto "$2";;
clrnormalbg) clrnormalbg "$2";;
clrnormalbgto) clrnormalbgto "$2";;
activetextcolor) activetextcolor "$2";;
inactivetextcolor) inactivetextcolor "$2";;
*) : ;;
esac