From 4f6edc223670d78ad3f2966eb38b798638fff8db Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sat, 1 Feb 2020 16:40:35 +0100 Subject: [PATCH] tryung to fix multimonitor behaviuor --- bin/mb-jgtools | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/bin/mb-jgtools b/bin/mb-jgtools index ed31386..8e1cc3b 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -92,14 +92,27 @@ trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT #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)"no to jest wszystko co potrzeba +#{ read WIDTH1; read WIDTH2; } <<< "$(xrandr --current | grep '*' | uniq | awk '{print $0}' | cut -d 'x' -f1)" + -POSX=$((SCREENWIDTH - JGWIDTH)) echo "JGWIDTH: $JGWIDTH SCREENWIDTH: $SCREENWIDTH POSX: $POSX" MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) @@ -354,30 +367,29 @@ MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT #Lokalne zmienne; -JGWIDTH="500" +JGWIDTH="300" MENU_HALIGN="center" MENU_VALIGN="center" MENU_HEIGHT_MIN="210" -MENU_HEIGHT_MAX="210" +#MENU_HEIGHT_MAX="210" TABS="280" ITEM_HEIGHT="50" FONT="Noto Sans Medium 12" -COLUMNS="2" +COLUMNS="1" mkconfigfile cat < ${MENU_ITEMS} @icon,,10,20,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/mbcc.png @text,,70,10,220,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION $OSCODE -@text,,70,30,240,20,4,left,top,#666666,#444444,Jądro: $KERNEL $HOSTTYPE -@text,,70,50,200,20,4,left,top,#666666,#444444,$USER@$HOSTNAME +@text,,70,30,240,20,4,left,top,#666666,#444444,$USER@$HOSTNAME +@text,,70,50,200,20,4,left,top,#666666,#444444,Panele dla Maboxa  Szybka nawigacja,mb-jgtools places - coś tu będzie,  System panel,mb-jgtools right - Wylogowanie,mb-jgtools mblogout + Menu główne,mb-jgtools main  Zrzuty ekranu,mb-jgtools screenshot - + Wylogowanie,mb-jgtools mblogout EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null }