upd
parent
869d6238f9
commit
667bc04125
25
bin/deskgrid
25
bin/deskgrid
|
@ -34,12 +34,29 @@ COLUMNS=${columns:-12}
|
||||||
ROWS=${rows:-6}
|
ROWS=${rows:-6}
|
||||||
TITLEBAR_HEIGHT=${titlebar_height:-18}
|
TITLEBAR_HEIGHT=${titlebar_height:-18}
|
||||||
|
|
||||||
|
case "$LANG" in
|
||||||
|
pl*)
|
||||||
|
TITLE1="DesktopGrid"
|
||||||
|
TEXT1="\n\nNarysuj myszą prostokąt na pulpicie aby ustalić nową pozycję i rozmiar dla okna.\nPodczas rysowania możesz wcisnąć Spację aby przesuwać zaznaczenie.\n"
|
||||||
|
DRAWGRID="Pokaż obrazek pomocniczy jako tło"
|
||||||
|
DISABLE_NOTIFICATIONS="Wyłącz podpowiedzi"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
TITLE1="DesktopGrid"
|
||||||
|
TEXT1="\nDraw rectangle by mouse to set new window positon and size.\nWhile drawing you may hold Space key to move selection.\nNew window will be bigger than selection."
|
||||||
|
DRAWGRID="Show helper image as background"
|
||||||
|
DISABLE_NOTIFICATIONS="Disable this hint"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
eval $(xdotool getmouselocation --shell)
|
eval $(xdotool getmouselocation --shell)
|
||||||
# we have window id now as $WINDOW
|
# we have window id now as $WINDOW
|
||||||
HEX_ID=$(printf '0x%x\n' $WINDOW)
|
HEX_ID=$(printf '0x%x\n' $WINDOW)
|
||||||
CHILD_ID=$(xwininfo -id $HEX_ID -children|grep "\"" | awk '{print $1}')
|
CHILD_ID=$(xwininfo -id $HEX_ID -children|grep "\"" | awk '{print $1}')
|
||||||
if xwininfo -id $CHILD_ID -wm |grep Dock ; then exit 0 ;fi # Ignore Dock eg. tint2
|
if xwininfo -id $CHILD_ID -wm |grep Dock ; then exit 0 ;fi # Ignore Dock eg. tint2
|
||||||
|
|
||||||
|
##Calculate TITLEBAR_HEIGHT - should be rewrited to use frame extends
|
||||||
|
# xprop _NET_FRAME_EXTENTS
|
||||||
if xwininfo -id $CHILD_ID -wm |grep Undecorated ; then # Undecorated
|
if xwininfo -id $CHILD_ID -wm |grep Undecorated ; then # Undecorated
|
||||||
T="0"
|
T="0"
|
||||||
else # Decorated
|
else # Decorated
|
||||||
|
@ -61,11 +78,11 @@ MARGIN_Y="${MARGINS#*,}"
|
||||||
|
|
||||||
#Show notify
|
#Show notify
|
||||||
if [ $notifications = true ]; then
|
if [ $notifications = true ]; then
|
||||||
notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Welcome to DeskGrid (experimental)" "\nDraw rectangle by mouse to set new window positon and size.\nWhile drawing you may hold Space key to move selection.\nNew window will be bigger than selection."
|
notify-send.sh -t 20000 --icon=mbcc "$TITLE1" "$TEXT1" -o "$DRAWGRID:drawgrid" -o "$DISABLE_NOTIFICATIONS:mb-setvar notifications=false $CONFIG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Take selection
|
# Take selection
|
||||||
slop=$(slop --highlight -b 4 --tolerance=0 --color=0.3,0.4,0.6,0.4 -f "%x %y %w %h") || exit 1
|
slop=$(slop --highlight -b 3 --tolerance=0 --color=0.3,0.4,0.6,0.4 -f "%x %y %w %h") || exit 1
|
||||||
read -r X Y W H < <(echo $slop)
|
read -r X Y W H < <(echo $slop)
|
||||||
|
|
||||||
start_x="$(((X-MARGIN_X)/(AVAIL_X/COLUMNS)))"
|
start_x="$(((X-MARGIN_X)/(AVAIL_X/COLUMNS)))"
|
||||||
|
@ -93,7 +110,3 @@ xdotool windowmove $WINDOW $POSITION
|
||||||
|
|
||||||
xdotool windowmap $WINDOW
|
xdotool windowmap $WINDOW
|
||||||
|
|
||||||
if [ $notifications = true ]; then
|
|
||||||
notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Info" "You can disable those notifications or edit config file using buttons below.\n\n" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit DeskGrid config file:geany ~/.config/deskgrid/deskgrid.conf"
|
|
||||||
#notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Success notification" "You can disable those notifications by editing config file. Button below.\nScreensize: $SCREENSIZE\nMargins: $MARGINS\nAvailable size: $AVAILSIZE\nGrid: $((AVAIL_X/COLUMNS)) x $((AVAIL_Y/ROWS)) Selection: $slop\nPosition: <b>$POSITION</b>\n($start_x*$AVAIL_X/$COLUMNS+$GAP_X+$MARGIN_X)\n($start_y*$AVAIL_Y/$ROWS+$GAP_Y+$MARGIN_Y) \nSize: $SIZE" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit config file:geany ~/.config/deskgrid/deskgrid.conf"
|
|
||||||
fi
|
|
||||||
|
|
10
bin/drawgrid
10
bin/drawgrid
|
@ -43,8 +43,14 @@ rectangles=""
|
||||||
rectangles+="rectangle $((tile*TILE_WIDTH)),$((row*TILE_HEIGHT)) $((tile*TILE_WIDTH+TILE_WIDTH)),$((row*TILE_HEIGHT+TILE_HEIGHT)) ";
|
rectangles+="rectangle $((tile*TILE_WIDTH)),$((row*TILE_HEIGHT)) $((tile*TILE_WIDTH+TILE_WIDTH)),$((row*TILE_HEIGHT+TILE_HEIGHT)) ";
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
name="text 24,96 DeskGrid"
|
name="text 24,96 DesktopGrid"
|
||||||
text="text 30,120 \"Hello I'm here to help you get familiar with DeskGrid ;)\nGrid: $COLUMNS columns, $ROWS rows\nSingle tile size: $TILE_WIDTH x $TILE_HEIGHT\n\nUse mousewheel on taskbar to show/hide me\nTo close: middle click on taskbar or click here, then hit q key\""
|
case $LANG in
|
||||||
|
pl*)
|
||||||
|
text="text 30,128 \"Ten obrazek ma pomóc ci zaprzyjaźnić się z siatką pulpitu DesktopGrid.\nDesktopGrid pozwala na dokładne ułożenie okien na pulpicie z opcjonalnym (konfigurowalnym) odstępem.\nJak to działa?\n1. Trzymając klawisz super(windows), kliknij wewnątrz okna które chcesz przemieścić. Okno zostanie zminimalizowane.\n2. Wyznacz myszą nową pozycję dla okna zaznaczając prostokąt\n3. Okno jest ustawiane wewnątrz siatki obliczonej na podstawie zaznaczenia.\n\nUżyj paska zadań aby schować/pokazać tło.\nAby wyłączyć tło: klik środkowym myszy na pasku zadań lub kliknięcie na obrazku i klawisz q\n\nSiatka: kolumny:$COLUMNS, wiersze:$ROWS, odstęp:$GAP\nRozmiar pojedyńczej komórki: $TILE_WIDTH x $TILE_HEIGHT\"";;
|
||||||
|
*)
|
||||||
|
text="text 30,128 \"This bacground image is here to help you get familiar with DesktopGrid.\nDesktopGrid allows you to accurately arrange windows on the desktop with optional gap (configurable).\nHow it's working?\n1. While holding down the super (windows) key, click inside the window you want to move. The window will be minimized.\n2. Use the mouse to mark a new position for the window by selecting the rectangle\n3. The window is positioned within the computed grid from the selection.\n\nCurrent Grid settings: $COLUMNS columns, $ROWS rows, gap:$GAP\nSingle tile size: $TILE_WIDTH x $TILE_HEIGHT\n\nUse mousewheel on taskbar to show/hide this background.\nTo close: middle click on taskbar or click here, then hit q key\""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
magick -size $AVAILSIZE xc:LavenderBlush3 -stroke LavenderBlush2 -strokewidth 1 \
|
magick -size $AVAILSIZE xc:LavenderBlush3 -stroke LavenderBlush2 -strokewidth 1 \
|
||||||
-fill LavenderBlush3 \
|
-fill LavenderBlush3 \
|
||||||
-draw "$rectangles" \
|
-draw "$rectangles" \
|
||||||
|
|
Loading…
Reference in New Issue