183 lines
5.0 KiB
Bash
Executable File
183 lines
5.0 KiB
Bash
Executable File
#!/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
|