You are not logged in.
Pages: 1
How does xfwm4 handle window position & size? Current behaviour is odd:
- open thunar
- resize window
- drag window to another position
- close thunar
- open thunar again
- window has new size but old position
Even after a reboot positions for thunar, firefox, thunderbird and other programs are always the same. Is this normal behaviour or should I change some settings?
Thanks
Offline
Position and/or size should be remembered if the application supports it. If not, xfwm4 uses Smart Placement (QA #2 and #3). You can adjust smart placement settings at Settings Manager > Window Manager Tweaks > Placement.
Smart placement cannot be disabled. If you need more precise placement, you need to use tools like wmctrl or devilspie.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Exactly, it depends on the program. Which program supports it, thunar?
Offline
Looking closer, I see that thunar supports size, but not position. You can see this in the settings editor in the Thunar channel - window height and width are saved (and subsequently restored). I imagine most apps would leave the window placement to the window manager, and xfwm4 uses smart placement.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I see. Every morning I need to rearrange my windows (dual screen). In the very beginning window position for every application was set somewhere in the system. And this position seems to be the same every day. A few months ago I used docky to open applications and changed to cairo. Maybe they influence window position as well. It's a pitty position is not remembered. The only way seems to write a custom script which needs much more time than just close a window ;-)
Thanks for your help.
Last edited by amjafuso (2016-09-02 14:48:29)
Offline
Use devilspie... it will place your windows exactly where you want and how you want...
Offline
This is sort of a way around this.
Starts Thunar, uses xev to monitor the position and Destroy event.
On destroy event saves the thunar's position and size in one temp file in the other workspace.
If this script is relaunched it will read from those files and move the thunar with xdotool. If thunar was closed on another workspace it will open in that workspace with the sam position and size.
#!/bin/bash
# Temp file to store absolute position and dimensions (change this)
DimFile="/home/misko/Desktop/ThunarXYWH"
# Temp file to store the workspace number (change this)
WorkspFile="/home/misko/Desktop/Thunarworkspace"
[[ ! -f "$DimFile" ]] && >"${DimFile}"
grep -q '[^[:space:]]' < "$DimFile" && readarray -t START <"$DimFile"
app=thunar
$app
# Check for running instances of $app on current desktop/workspace.
until xdotool getwindowname "$(xdotool search --desktop $(xdotool get_desktop) --class $app 2>/dev/null | tail -1 2>/dev/null)" &>/dev/null; do
# sleep until the window opens
sleep .1
done
#Decimal
WindowID="$(xdotool search --desktop $(xdotool get_desktop) --class $app 2>/dev/null | tail -1)"
workspace="$(cat "${WorkspFile}" 2>/dev/null)"
if [[ ${workspace} != "" ]]; then
# change desktop
xdotool set_desktop "${workspace: -1}"
# change desktop for window
xdotool set_desktop_for_window $WindowID "${workspace: -1}"
fi
if [[ ${START[@]} != "" ]]; then
xdotool windowsize --sync $WindowID ${START[2]} ${START[3]}
xdotool windowmove --sync $WindowID ${START[0]} ${START[1]}
fi
#Hexadecimal
WindowIDHex=$(printf "0x%08x" ${WindowID})
#Base seven
WindowBSeven=$(printf "0x%07x" ${WindowID})
#Get starting position and size: x, y, width, height
XWININFO=$(xwininfo -id $WindowIDHex)
ARRAY=(${XWININFO#* X: })
AX=${ARRAY[0]}
AY=${ARRAY[4]}
RX=${ARRAY[8]}
RY=${ARRAY[12]}
W=${ARRAY[14]}
H=${ARRAY[16]}
X=$((AX))
Y=$((AY))
# This monitors the window absolute-top-left x, y, width and height for changes
# If the window is moved - this will get new pos and size
# On destroy event, saves X,Y, W, and H
xev -event structure -id ${WindowIDHex} 2>/dev/null |
while IFS=$',' read -a A;do
if [[ "${A[0]#"${A%%[![:space:]]*}"}" =~ "event ${WindowBSeven}" && "${A[1]}${A[2]:1:1}${A[3]: -1}" =~ "window ${WindowBSeven}()" ]]; then
X="${A[2]//" ("/}"
Y="${A[3]%")"}"
W="${A[4]//" width "/}"
H="${A[5]//" height "/}"
# On destroy event
elif [[ "${A[0]}" =~ "DestroyNotify event" ]]; then
>"${DimFile}"
X=$((X-RX))
Y=$((Y-RY))
# Exports dimensions
echo "$X" >> "${DimFile}"
echo "$Y" >> "${DimFile}"
echo "$W" >> "${DimFile}"
echo "$H" >> "${DimFile}"
# save current workspace
workspace="$(xprop -root -notype _NET_CURRENT_DESKTOP 2>/dev/null)"
echo "${workspace:-1}" > "${WorkspFile}"
# xev dies hard
XevPID="$(ps -eo pid,cmd | grep "xev -event structure -id $WindowIDHex" | grep -v "grep" | awk '{ print $1 }')"
kill $XevPID 2> /dev/null
fi
A=()
done
exit 0
Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c
Offline
Pages: 1
[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 549.03 KiB (Peak: 549.88 KiB) ]