fix icon location
51
bin/mbx
|
@ -5,8 +5,9 @@
|
|||
# TODO Logout Dialog postponed
|
||||
# TODO Filebrowser standalone postponed
|
||||
|
||||
ME=${0##*/}
|
||||
VERSION="0.2.0"
|
||||
|
||||
ME=$(basename "$0")
|
||||
CNF_DIR="$HOME/.config/mbxutils"
|
||||
CNF_FILE="$CNF_DIR/$ME.conf"
|
||||
[ ! -d "$HOME/.config/jgmenu" ] && mkdir -p "$HOME/.config/jgmenu"
|
||||
|
@ -18,13 +19,13 @@ mbx setvar item_height_factor=200
|
|||
mbx setvar "font=\'Noto Sans\'"
|
||||
mbx setvar font_size=13
|
||||
mbx setvar color_menu_bg=#252525
|
||||
mbx ${1}
|
||||
mbx "${1}"
|
||||
}
|
||||
|
||||
|
||||
[ ! -d "$CNF_DIR" ] && mkdir -p "$CNF_DIR" && cp -r /usr/share/mbxutils/* "$CNF_DIR"/
|
||||
if [ ! -f $CNF_FILE ]; then
|
||||
cat <<EOF > ${CNF_FILE}
|
||||
if [ ! -f "$CNF_FILE" ]; then
|
||||
cat <<EOF > "${CNF_FILE}"
|
||||
apps_in=rootmenu
|
||||
menu_padding=5
|
||||
item_height_factor=200
|
||||
|
@ -33,10 +34,10 @@ font_size=13
|
|||
color_menu_bg=#252525
|
||||
EOF
|
||||
fi
|
||||
source <(grep = $CNF_FILE)
|
||||
source <(grep = "$CNF_FILE")
|
||||
|
||||
fg(){
|
||||
r=$(printf "%d" 0x${1:1:2}) g=$(printf "%d" 0x${1:3:2}) b=$(printf "%d" 0x${1:5:2})
|
||||
r=$(printf "%d" 0x"${1:1:2}") g=$(printf "%d" 0x"${1:3:2}") b=$(printf "%d" 0x"${1:5:2}")
|
||||
rgb="$((r*299+g*587+b*114))"
|
||||
[ "$rgb" -gt 138000 ] && fgcolor="#222222" color_title_fg="#111111" color_sel_fg="#111111" color_sep_fg="#222222 20"|| fgcolor="#EEEEEE" color_title_fg="#FFFFFF" color_sel_fg="#FFFFFF"
|
||||
[ "$rgb" -gt 200000 ] && color_sel_bg="#222222 8" color_sel_border="#222222 16" color_title_bg="#222222 8"
|
||||
|
@ -48,7 +49,7 @@ configure() {
|
|||
if [ -f /usr/share/mbxutils/mbxutils.inc ];then
|
||||
. /usr/share/mbxutils/mbxutils.inc
|
||||
else
|
||||
cat <<EOF > ${CONFIG_FILE}
|
||||
cat <<EOF > "${CONFIG_FILE}"
|
||||
position_mode = ${position_mode:-fixed}
|
||||
csv_cmd = apps
|
||||
stay_alive = 0
|
||||
|
@ -127,7 +128,7 @@ appsmenu() {
|
|||
rm -f ~/.config/jgmenu/append.csv
|
||||
if [[ $apps_in == "submenu" ]]
|
||||
then
|
||||
cat <<EOF > $HOME/.config/jgmenu/prepend.csv
|
||||
cat <<EOF > "$HOME"/.config/jgmenu/prepend.csv
|
||||
@text,,$((menu_padding+10)),$((menu_padding_top-font_size*item_height_factor/100+2)),150,$((font_size*item_height_factor/100)),0,left,top,auto,#000000,🔍
|
||||
@search,,$((menu_padding+32)),$((menu_padding_top-font_size*item_height_factor/100)),150,$((font_size*item_height_factor/100)),2,left,top,auto,#000000,<i> type to search </i>
|
||||
. ~/.config/mbxutils/inc/favorites.csv
|
||||
|
@ -142,14 +143,14 @@ About <b>mbxutils</b>,mbx
|
|||
^tag(apps)
|
||||
EOF
|
||||
else
|
||||
cat <<EOF > $HOME/.config/jgmenu/prepend.csv
|
||||
cat <<EOF > "$HOME"/.config/jgmenu/prepend.csv
|
||||
@text,,$((menu_padding+10)),$((menu_padding_top-font_size*item_height_factor/100+2)),150,$((font_size*item_height_factor/100)),0,left,top,auto,#000000,🔍
|
||||
@search,,$((menu_padding+32)),$((menu_padding_top-font_size*item_height_factor/100)),150,$((font_size*item_height_factor/100)),2,left,top,auto,#000000,<i> type to search </i>
|
||||
|
||||
. ~/.config/mbxutils/inc/favorites.csv
|
||||
^sep(Applications)
|
||||
EOF
|
||||
cat <<EOF > $HOME/.config/jgmenu/append.csv
|
||||
cat <<EOF > "$HOME"/.config/jgmenu/append.csv
|
||||
. ~/.config/mbxutils/inc/m_after_apps.csv
|
||||
^sep()
|
||||
Logout dialog,mb-jgtools mblogout,system-shutdown
|
||||
|
@ -161,7 +162,7 @@ About <b>mbxutils</b>,mbx
|
|||
EOF
|
||||
fi
|
||||
configure
|
||||
jgmenu --config-file=${CONFIG_FILE} --no-append 2>/dev/null
|
||||
jgmenu --config-file="${CONFIG_FILE}" --no-append 2>/dev/null
|
||||
}
|
||||
|
||||
distrologo() {
|
||||
|
@ -182,7 +183,7 @@ lpanel() {
|
|||
|
||||
CONFIG_FILE=$(mktemp)
|
||||
MENU_ITEMS=$(mktemp)
|
||||
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
|
||||
trap "rm -f '${CONFIG_FILE}' '${MENU_ITEMS}'" EXIT
|
||||
menu_padding_top=$((menu_padding+item_margin_y+48))
|
||||
menu_halign="left"
|
||||
distro="${distro:-$OSNAME}"
|
||||
|
@ -190,7 +191,7 @@ lpanel() {
|
|||
configure
|
||||
|
||||
#${HOSTNAME:-$(hostname)}@${USER}
|
||||
cat <<EOF > ${MENU_ITEMS}
|
||||
cat <<EOF > "${MENU_ITEMS}"
|
||||
@icon,,$((menu_padding+item_margin_x)),${menu_padding},48,48,0,left,top,,,/usr/share/mbxutils/logos/distributor-logo-${logo}.svg
|
||||
@text,,$((menu_padding+item_margin_x+50)),${menu_padding},180,32,0,left,top,${fgcolor},#DDDDDD,$distro ${OSVERSION} <sup><i>${OSCODE}</i></sup>
|
||||
@text,,$((menu_padding+item_margin_x+50)),$((menu_padding+20)),180,32,0,left,top,${fgcolor},#DDDDDD,<i>${XDG_SESSION_DESKTOP^}</i>
|
||||
|
@ -205,7 +206,7 @@ Preferences,mbx-preferences lpanel st
|
|||
|
||||
. ~/.config/mbxutils/inc/lbottom.csv
|
||||
EOF
|
||||
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
||||
jgmenu --config-file="${CONFIG_FILE}" --csv-file="${MENU_ITEMS}" 2>/dev/null
|
||||
}
|
||||
|
||||
rpanel() {
|
||||
|
@ -214,7 +215,7 @@ rpanel() {
|
|||
OSCODE=$(lsb_release -c | awk '{print $2}') # Geralt
|
||||
CONFIG_FILE=$(mktemp)
|
||||
MENU_ITEMS=$(mktemp)
|
||||
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
|
||||
trap "rm -f '${CONFIG_FILE}' '${MENU_ITEMS}'" EXIT
|
||||
menu_padding_top=$((menu_padding+item_margin_y+48))
|
||||
menu_halign="right"
|
||||
icon_size=$((font_size*item_height_factor/100-2))
|
||||
|
@ -222,7 +223,7 @@ rpanel() {
|
|||
distrologo
|
||||
|
||||
configure
|
||||
cat <<EOF > ${MENU_ITEMS}
|
||||
cat <<EOF > "${MENU_ITEMS}"
|
||||
@icon,,$((menu_padding+item_margin_x)),${menu_padding},48,48,0,left,top,,,/usr/share/mbxutils/logos/distributor-logo-${logo}.svg
|
||||
@text,,$((menu_padding+item_margin_x+50)),${menu_padding},180,32,0,left,top,${fgcolor},#DDDDDD,$distro ${OSVERSION} <sup><i>${OSCODE}</i></sup>
|
||||
@text,,$((menu_padding+item_margin_x+50)),$((menu_padding+20)),180,32,0,left,top,${fgcolor},#DDDDDD,<i>${XDG_SESSION_DESKTOP^}</i>
|
||||
|
@ -232,17 +233,17 @@ Preferences,^pipe(mbx-preferences rpanel)
|
|||
Preferences,mbx-preferences rpanel st
|
||||
. ~/.config/mbxutils/inc/rbottom.csv
|
||||
EOF
|
||||
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
||||
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
|
||||
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')"
|
||||
THUMB="$(DISPLAY=:0 scrot -t ${twidth}x${theight} -o "$HOME"/.config/mbxutils/mbx.png -e 'echo $m')"
|
||||
|
||||
columns=2
|
||||
icon_size=$((font_size*item_height_factor/100-2))
|
||||
|
@ -254,7 +255,7 @@ about() {
|
|||
menu_height_max=$((menu_padding_top+menu_padding+item_height*6+item_margin_y*10))
|
||||
#menu_height_min=$((menu_padding_top+menu_padding+item_height*6+item_margin_y*10))
|
||||
configure
|
||||
cat <<EOF > ${MENU_ITEMS}
|
||||
cat <<EOF > "${MENU_ITEMS}"
|
||||
@icon,,${menu_padding},${menu_padding},${twidth},${theight},4,left,top,,,$THUMB
|
||||
@text,,$((menu_padding+6)),$((menu_padding+theight+4)),${twidth},25,4,left,top,${fgcolor},#DDDDDD,<span font="28px"><b>mbxutils</b></span><span font="12px"> v0.2.0 (alpha)</span>
|
||||
@text,,$((menu_padding+40)),$((menu_padding+theight+26)),${twidth},25,4,left,top,${fgcolor} 60,${fgcolor} 12,<span font="12px"><i>a set of lightweight and handy utilities</i></span>
|
||||
|
@ -271,15 +272,15 @@ Configure keybindings,xdg-open https://mbxutils.maboxlinux.org,firefox
|
|||
Roadmap
|
||||
EOF
|
||||
|
||||
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
||||
jgmenu --config-file="${CONFIG_FILE}" --csv-file="${MENU_ITEMS}" 2>/dev/null
|
||||
}
|
||||
setvar() { # Może tu niepotrzebnie a tylko w mbx-preferences
|
||||
search="$(echo $1|cut -d= -f1)="
|
||||
if grep -Rq $search $CNF_FILE
|
||||
search="$(echo "$1"|cut -d= -f1)="
|
||||
if grep -Rq "$search" "$CNF_FILE"
|
||||
then #found
|
||||
sed -i s/^"$search".*$/"$1"/ $CNF_FILE
|
||||
sed -i s/^"$search".*$/"$1"/ "$CNF_FILE"
|
||||
else #not found
|
||||
echo $1 >> $CNF_FILE
|
||||
echo "$1" >> "$CNF_FILE"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
# mbx-preferences appsmenu|lpanel|rpanel|about - pipemenu
|
||||
# mbx-preferences appsmenu|lpanel|rpanel|about st - standalone
|
||||
ME=$(basename "$0")
|
||||
ME=${0##*/}
|
||||
|
||||
CNF_DIR="$HOME/.config/mbxutils"
|
||||
CNF_FILE="$CNF_DIR/mbx.conf"
|
||||
|
|
Before Width: | Height: | Size: 996 B After Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 943 B After Width: | Height: | Size: 943 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 401 B After Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 786 B After Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 698 B After Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 606 B |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 819 B |
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 762 B |