master
Daniel Napora 2021-10-21 01:14:20 +02:00
parent c6156d5efe
commit ba9cd67d25
2 changed files with 38 additions and 3 deletions

33
bin/mbx
View File

@ -6,6 +6,7 @@
# TODO Preferences standalone
# TODO Logout Dialog postponed
# TODO Filebrowser standalone postponed
# FIXME Remove devel-helpers - move them to another tool
ME=$(basename "$0")
@ -125,8 +126,9 @@ color_title_fg = ${color_title_fg:-}
color_menu_bg = ${bgcolor:-#0F2437}
color_menu_border = #eeeeee 8
color_title_bg = ${color_title_bg:-"$fgcolor 12"}
color_title_border = ${color_title_border:-}
color_title_border = ${color_title_border:-}
color_sep_fg = ${color_sep_fg:-}
icon_theme = ${icon_theme:-}
icon_size = ${icon_size:-0}
icon_norm_alpha = 70
icon_sel_alpha = 100
@ -184,6 +186,9 @@ cat <<EOF > $HOME/.config/jgmenu/append.csv
. ~/.config/mbxutils/inc/m_after_apps.csv
^sep()
Preferences,^pipe($ME preferences mmenu),firefox
^sep()
About <b>mbxutils</b>,mbx
^sep()
Logout dialog,mb-jgtools mblogout,system-shutdown
^sep(rgb: $rgb)
^sep(rel: $rel)
@ -230,6 +235,32 @@ Right Panel,,terminal
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
about() {
CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
eval $(xdotool getdisplaygeometry --shell)
twidth=$((WIDTH/4))
theight=$((HEIGHT/4))
THUMB="$(DISPLAY=:0 scrot -t ${twidth}x${theight} -o $HOME/.config/mbxutils/mbx.png -e 'echo $m')"
menu_halign=center
menu_padding=8
menu_width=$((twidth+menu_padding*2))
menu_padding_top=$((theight+menu_padding*2))
configure
cat <<EOF > ${MENU_ITEMS}
@icon,,${menu_padding},${menu_padding},${twidth},${theight},4,left,top,,,$THUMB
^sep(About mbxutils)
Visit website,xdg-open https://maboxlinux.org
EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}
setvar() {
search="$(echo $1|cut -d= -f1)="

View File

@ -1,5 +1,7 @@
#!/bin/bash
# mbxinit - initialize/update config files needed by mbxutils
# TODO check for GUI package managers
# TODO generate favorites here
CNF_DIR="$HOME/.config/mbxutils"
CNF_FILE="$CNF_DIR/mbx.conf"
@ -19,7 +21,7 @@ check_fonts() {
}
check_terminals() {
search_terminals=(terminator lxterminal xfce4-terminal alacritty konsole qterminal )
search_terminals=(terminator lxterminal xfce4-terminal alacritty gnome-terminal konsole qterminal )
for i in "${search_terminals[@]}"
do
if hash ${i} 2>/dev/null; then
@ -27,6 +29,7 @@ check_terminals() {
fi
done
printf '%s\n' "${terminals[@]}" > "$CNF_DIR"/inc/terminals.inc
mbx setvar terminal=${terminals[0]}
}
check_browsers() {
@ -41,7 +44,7 @@ check_browsers() {
}
check_file_managers() {
search_file_managers=(xdg-open pcmanfm thunar caja nautilus dolphin)
search_file_managers=(xdg-open pcmanfm thunar pcmanfm-qt caja nautilus dolphin)
for i in "${search_file_managers[@]}"
do
if hash ${i} 2>/dev/null; then
@ -49,6 +52,7 @@ check_file_managers() {
fi
done
printf '%s\n' "${file_managers[@]}" > "$CNF_DIR"/inc/file_managers.inc
mbx setvar filemanager=${file_managers[0]}
}