deskgrid, deskmngr update
parent
64668524da
commit
afce9e0ebc
|
@ -96,7 +96,7 @@ if [[ $start_y = "0" ]]; then GAP_Y="$((GAP*GF))" ; else GAP_Y=$((GAP/2)) ; fi
|
||||||
if [[ $end_x = $((COLUMNS-1)) ]]; then GAP_X_END="$((GAP/2))" ; else GAP_X_END=$((GAP/2)) ; fi
|
if [[ $end_x = $((COLUMNS-1)) ]]; then GAP_X_END="$((GAP/2))" ; else GAP_X_END=$((GAP/2)) ; fi
|
||||||
if [[ $end_y = $((ROWS-1)) ]]; then GAP_Y_END="$((GAP/2))" ; else GAP_Y_END=$((GAP/2)) ; fi
|
if [[ $end_y = $((ROWS-1)) ]]; then GAP_Y_END="$((GAP/2))" ; else GAP_Y_END=$((GAP/2)) ; fi
|
||||||
|
|
||||||
SIZE="$(((end_x-start_x+1)*(AVAIL_X/COLUMNS)-GAP_X/2-GAP_X_END)) $(((end_y-start_y+1)*(AVAIL_Y/ROWS)-GAP_Y/2-GAP_Y_END-BORDERCOMP_Y))"
|
SIZE="$(((end_x-start_x+1)*(AVAIL_X/COLUMNS)-GAP_X/2-GAP_X_END-BORDERCOMP_X)) $(((end_y-start_y+1)*(AVAIL_Y/ROWS)-GAP_Y/2-GAP_Y_END-BORDERCOMP_Y))"
|
||||||
|
|
||||||
POSITION="$((start_x*AVAIL_X/COLUMNS+GAP_X/2+MARGIN_X)) $((start_y*AVAIL_Y/ROWS+GAP_Y/2+MARGIN_Y))"
|
POSITION="$((start_x*AVAIL_X/COLUMNS+GAP_X/2+MARGIN_X)) $((start_y*AVAIL_Y/ROWS+GAP_Y/2+MARGIN_Y))"
|
||||||
|
|
||||||
|
|
17
bin/deskmngr
17
bin/deskmngr
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright (C) Daniel Napora 2021 <napcok@gmail.com>
|
# Copyright (C) Daniel Napora 2021-22 <napcok@gmail.com>
|
||||||
|
# https://maboxlinux.org
|
||||||
#: deskmngr - save all programs (windows) running on current desktop in session file.
|
#: deskmngr - save all programs (windows) running on current desktop in session file.
|
||||||
#: With windows positions and state (decorated or not)
|
#: With windows positions and state (decorated or not)
|
||||||
#: Usage:
|
#: Usage:
|
||||||
|
@ -21,8 +22,17 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
SESSIONDIR="$HOME/.config/deskmngr/"
|
SESSIONDIR="$HOME/.config/deskmngr/"
|
||||||
|
CONFIG_FILE="$SESSIONDIR/deskmngr.conf"
|
||||||
mkdir -p $SESSIONDIR
|
mkdir -p $SESSIONDIR
|
||||||
|
# If config file not exist create one with defaults
|
||||||
|
if [ ! -f $CONFIG_FILE ]; then
|
||||||
|
cat <<EOF > ${CONFIG_FILE}
|
||||||
|
waitsec=1
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
source <(grep = $CONFIG_FILE)
|
||||||
|
waittime=${waitsec:-1}
|
||||||
case "$LANG" in
|
case "$LANG" in
|
||||||
pl*)
|
pl*)
|
||||||
TITLE="Nie ma nic do zapisania"
|
TITLE="Nie ma nic do zapisania"
|
||||||
|
@ -107,12 +117,11 @@ restoresession() {
|
||||||
read -r D width height x y cmdline< <(echo $line)
|
read -r D width height x y cmdline< <(echo $line)
|
||||||
wmctrl -s ${DESK}
|
wmctrl -s ${DESK}
|
||||||
${cmdline} > /dev/null 2>&1 &
|
${cmdline} > /dev/null 2>&1 &
|
||||||
|
# We need to wait for window to appear
|
||||||
sleep 5
|
sleep ${waittime}
|
||||||
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz
|
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz
|
||||||
if [[ "$D" = "u" ]]; then xdotool key super+b; fi
|
if [[ "$D" = "u" ]]; then xdotool key super+b; fi
|
||||||
wmctrl -r :ACTIVE: -e 0,${x},${y},${width},${height}
|
wmctrl -r :ACTIVE: -e 0,${x},${y},${width},${height}
|
||||||
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
bin/snapwin
14
bin/snapwin
|
@ -69,7 +69,7 @@ _movewin() {
|
||||||
#echo "Width WIDE: $WIDTH_WIDE"
|
#echo "Width WIDE: $WIDTH_WIDE"
|
||||||
|
|
||||||
case $POS_CODE in
|
case $POS_CODE in
|
||||||
00|topleft) # top-left
|
00|"topleft") # top-left
|
||||||
#echo "xdotool getwindowgeometry --shell $WINDOW"
|
#echo "xdotool getwindowgeometry --shell $WINDOW"
|
||||||
#eval xdotool getwindowgeometry --shell "$WINDOW"
|
#eval xdotool getwindowgeometry --shell "$WINDOW"
|
||||||
W=$((AVAIL_X/2-OUT_GAP-GAP/2-BORDERCOMP_X)) H=$((AVAIL_Y/2-BORDERCOMP_Y-OUT_GAP-GAP/2)) XPOS=$((OFF_X+OUT_GAP)) YPOS=$((OFF_Y+OUT_GAP));
|
W=$((AVAIL_X/2-OUT_GAP-GAP/2-BORDERCOMP_X)) H=$((AVAIL_Y/2-BORDERCOMP_Y-OUT_GAP-GAP/2)) XPOS=$((OFF_X+OUT_GAP)) YPOS=$((OFF_Y+OUT_GAP));
|
||||||
|
@ -131,23 +131,23 @@ if [ $activate_window == "true" ]; then xdotool windowactivate $WINDOW; fi
|
||||||
_getwin() { #get active window (only when invoked by keyboard)
|
_getwin() { #get active window (only when invoked by keyboard)
|
||||||
_config
|
_config
|
||||||
WIN=$(xdotool getactivewindow)
|
WIN=$(xdotool getactivewindow)
|
||||||
echo "Win: $WIN"
|
#echo "Win: $WIN"
|
||||||
HEX_ID=$(printf '0x%x\n' $WIN)
|
HEX_ID=$(printf '0x%x\n' $WIN)
|
||||||
echo $HEX_ID
|
#echo $HEX_ID
|
||||||
#####echo "$HEX_ID"
|
#####echo "$HEX_ID"
|
||||||
wmctrl -i -r $HEX_ID -b remove,maximized_vert,maximized_horz
|
wmctrl -i -r $HEX_ID -b remove,maximized_vert,maximized_horz
|
||||||
|
|
||||||
WINDOW=$(xwininfo -id $(xdotool getactivewindow) -int -tree | awk '/^ *Parent/ {print $4}')
|
WINDOW=$(xwininfo -id $(xdotool getactivewindow) -int -tree | awk '/^ *Parent/ {print $4}')
|
||||||
echo "WINDOW: $WINDOW"
|
#echo "WINDOW: $WINDOW"
|
||||||
#WINDOW=$(xwininfo -id $WIN -int -tree | awk '/^ *Parent/ {print $4}')
|
#WINDOW=$(xwininfo -id $WIN -int -tree | awk '/^ *Parent/ {print $4}')
|
||||||
#WINDOW=$WIN
|
#WINDOW=$WIN
|
||||||
winFRAME=$(xprop -id $WIN _NET_FRAME_EXTENTS | awk ' {gsub(/,/,"");print $3,$4,$5,$6}')
|
winFRAME=$(xprop -id $WIN _NET_FRAME_EXTENTS | awk ' {gsub(/,/,"");print $3,$4,$5,$6}')
|
||||||
read BORDER_L BORDER_R BORDER_T BORDER_B <<< "$winFRAME"
|
read BORDER_L BORDER_R BORDER_T BORDER_B <<< "$winFRAME"
|
||||||
echo "winFRAME: $winFRAME"
|
#echo "winFRAME: $winFRAME"
|
||||||
BORDERCOMP_X=$((BORDER_L+BORDER_R))
|
BORDERCOMP_X=$((BORDER_L+BORDER_R))
|
||||||
BORDERCOMP_Y=$((BORDER_T+BORDER_B))
|
BORDERCOMP_Y=$((BORDER_T+BORDER_B))
|
||||||
echo "BORDERCOMP_X $BORDERCOMP_X"
|
#echo "BORDERCOMP_X $BORDERCOMP_X"
|
||||||
echo "Przekazuję ID OKNA: $WINDOW"
|
#echo "Przekazuję ID OKNA: $WINDOW"
|
||||||
_movewin
|
_movewin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue