places and right important fixes

master
Daniel Napora 2020-02-09 16:52:47 +01:00
parent 54326f88be
commit 6b4e2d3fc0
2 changed files with 23 additions and 64 deletions

View File

@ -6,29 +6,28 @@
DIRECTORY=${1:-$HOME} DIRECTORY=${1:-$HOME}
# If '$PWD' is '/', unset it to avoid '//'. # If '$DIRECTORY' is '/', unset it to avoid '//'.
[[ $DIRECTORY == / ]] && DIRECTORY= [[ $DIRECTORY == / ]] && DIRECTORY=
for item in "$DIRECTORY"/*; do for item in "$DIRECTORY"/*; do
if [[ -d $item ]]; then if [[ -d $item ]]; then
dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")") dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")")
#((item_index++))
# Find the position of the child directory in the
# parent directory list.
#[[ $item == "$OLDPWD" ]] &&
# ((previous_index=item_index))
else else
if [[ -f $item ]]; then
files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"") files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"")
fi fi
fi
done done
printf "%b\n" "^sep(<small><i>${DIRECTORY}</i></small>)" printf "%b\n" "^sep(<small><i>${DIRECTORY:-/}</i></small>)"
printf "%b\n" "  Otwórz w menadżerze plików,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\"" printf "%b\n" "  Otwórz w menadżerze plików,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\""
printf "%b\n" "  Otwórz w termianlu,terminator --working-directory=\"${DIRECTORY:-/}\"" printf "%b\n" "  Otwórz w termianlu,terminator --working-directory=\"${DIRECTORY:-/}\""
printf "%b\n" "^sep()" printf "%b\n" "^sep()"
if [ ${#dirs[@]} -ne 0 ]; then
printf "%b\n" "^sep(Katalogi)" printf "%b\n" "^sep(Katalogi)"
printf '%s\n' "${dirs[@]}" printf '%s\n' "${dirs[@]}"
fi
if [ ${#files[@]} -ne 0 ]; then
printf "%b\n" "^sep(Pliki)" printf "%b\n" "^sep(Pliki)"
printf '%s\n' "${files[@]}" printf '%s\n' "${files[@]}"
#list=("${dirs[@]}" "${files[@]}") fi

View File

@ -3,11 +3,11 @@
# Get colors from config file # Get colors from config file
#. $HOME/.config/mb-jgtools/mb-jgtools.colorrc #. $HOME/.config/mb-jgtools/mb-jgtools.colorrc
JGWIDTH="300" JGWIDTH="280"
[ $(pidof picom) ] && RADIUS="12" [ $(pidof picom) ] && RADIUS="4"
SCREENWIDTH=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f1) #SCREENWIDTH=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f1)
OSNAME=$(lsb_release -d | awk '{print $2}') OSNAME=$(lsb_release -d | awk '{print $2}')
OSVERSION=$(lsb_release -r | awk '{print $2}') OSVERSION=$(lsb_release -r | awk '{print $2}')
@ -23,8 +23,8 @@ stay_alive = 0
hide_back_items = ${HIDE_BACK_ITEMS:-0} hide_back_items = ${HIDE_BACK_ITEMS:-0}
terminal_exec = terminator terminal_exec = terminator
terminal_args = -e terminal_args = -e
tabs = ${TABS:-240} tabs = ${TABS:-220}
menu_margin_x = $POSX menu_margin_x = 0
menu_margin_y = 0 menu_margin_y = 0
menu_width = $JGWIDTH menu_width = $JGWIDTH
menu_height_min = ${MENU_HEIGHT_MIN:-0} menu_height_min = ${MENU_HEIGHT_MIN:-0}
@ -35,10 +35,11 @@ menu_padding_bottom = ${MENU_PADDING_BOTTOM:-10}
menu_padding_left = ${MENU_PADDING_LEFT:-10} menu_padding_left = ${MENU_PADDING_LEFT:-10}
menu_radius = ${MENU_RADIUS:-0} menu_radius = ${MENU_RADIUS:-0}
menu_valign = ${MENU_VALIGN:-top} menu_valign = ${MENU_VALIGN:-top}
menu_halign = ${MENU_HALIGN:-0} menu_halign = ${MENU_HALIGN:-left}
item_height = ${ITEM_HEIGHT:-25} item_height = ${ITEM_HEIGHT:-25}
item_halign = left item_halign = left
item_radius = 2
columns = ${COLUMNS:-1} columns = ${COLUMNS:-1}
@ -81,54 +82,19 @@ mkconfigfile
jgmenu --config-file=${CONFIG_FILE} 2>/dev/null jgmenu --config-file=${CONFIG_FILE} 2>/dev/null
} }
# PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC # PANEL PO PRAWEJ AKTUALIZACE-USTAWIENIA-POMOC
right() { right() {
CONFIG_FILE=$(mktemp) CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp) MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
## WAŻNE MENU_HALIGN="right"
#monitor = integer (default 0)
#Specify a particular monitor as an index starting from 1.
#If 0, the menu will be launched on the monitor where the mouse is.
#Liczba onitorów
#xrandr --listmonitors | grep Monitors |awk '{print $2}'
if [ $(xrandr --listmonitors | grep Monitors |awk '{print $2}') -gt "1" ]
then
{ read WIDTH1; read WIDTH2; } <<< "$(xrandr --current | grep '*' | uniq | awk '{print $0}' | cut -d 'x' -f1)"
MOUSEPOS=$(xdotool getmouselocation | awk '{print $1}'|cut -d ':' -f2)
if [ "$MOUSEPOS" -gt "$WIDTH1" ]
then
POSX=$((WIDTH2 - JGWIDTH))
else
POSX=$((WIDTH1 - JGWIDTH))
fi
else
POSX=$((SCREENWIDTH - JGWIDTH))
fi
#Pozycja myszy
#xdotool getmouselocation | awk '{print $1}'|cut -d ':' -f2
#WIDTH1 i WIDTH2
#{ read WIDTH1; read WIDTH2; } <<< "$(xrandr --current | grep '*' | uniq | awk '{print $0}' | cut -d 'x' -f1)"
echo "JGWIDTH: $JGWIDTH SCREENWIDTH: $SCREENWIDTH POSX: $POSX"
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
mkconfigfile mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}
@icon,,245,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png @icon,,225,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png
@text,,20,10,200,20,4,left,top,#EEEEEE,#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup> @text,,20,10,200,20,4,left,top,#EEEEEE,#111111,<big>$OSNAME $OSVERSION</big> <sup> $OSCODE</sup>
@text,,20,30,200,20,4,left,top,#666666,#444444,<small>Jądro:</small> $KERNEL $HOSTTYPE @text,,20,30,200,20,4,left,top,#666666,#444444,<small>Jądro:</small> $KERNEL $HOSTTYPE
@text,,20,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small> @text,,20,50,200,20,4,left,top,#666666,#444444,<small>$USER@$HOSTNAME</small>
@ -168,8 +134,6 @@ cat <<EOF > ${MENU_ITEMS}
. $HOME/.config/mabox/right-append.csv . $HOME/.config/mabox/right-append.csv
^tag(system) ^tag(system)
^sep(System i sprzęt) ^sep(System i sprzęt)
@ -204,7 +168,6 @@ Kompozytor,^pipe(jgmenu_run ob --cmd='mabox-compositor' --tag='Kompo'),compton
Menadżer schematów,mb-obthemes Menadżer schematów,mb-obthemes
 wróć,^back()  wróć,^back()
^tag(shortcuts) ^tag(shortcuts)
^sep(Domyślne skróty klawiszowe) ^sep(Domyślne skróty klawiszowe)
^sep() ^sep()
@ -251,7 +214,7 @@ MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2)
JGWIDTH=280 JGWIDTH=260
mkconfigfile mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}
@ -289,8 +252,7 @@ mblogout() {
CONFIG_FILE=$(mktemp) CONFIG_FILE=$(mktemp)
MENU_ITEMS=$(mktemp) MENU_ITEMS=$(mktemp)
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS};wmctrl -k off" EXIT trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS};wmctrl -k off" EXIT
xdotool
#Lokalne zmienne;
JGWIDTH="340" JGWIDTH="340"
MENU_HALIGN="center" MENU_HALIGN="center"
MENU_VALIGN="center" MENU_VALIGN="center"
@ -300,10 +262,8 @@ ITEM_HEIGHT="30"
FONT="Noto Sans Medium 10" FONT="Noto Sans Medium 10"
MENU_RADIUS=${RADIUS:-0} MENU_RADIUS=${RADIUS:-0}
mkconfigfile mkconfigfile
wmctrl -k on wmctrl -k on
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o /tmp/mblogout.png -e 'echo $m')" THUMB="$(DISPLAY=:0 scrot -t 340x213 -o /tmp/mblogout.png -e 'echo $m')"
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}