[Solved] What is the easiest way to fix a window position in Cinnamon?

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
Dan-cer
Level 6
Level 6
Posts: 1161
Joined: Fri Jul 29, 2022 4:56 pm
Location: Germany, Lower Saxony

[Solved] What is the easiest way to fix a window position in Cinnamon?

Post by Dan-cer »

While most windows open in the same place when restarted, a few windows do not. For example, AisleRiot Solitaire opens in the default dimensions, but directly on the left edge, while I want to start it shifted a few pixels to the right.
Devilspie is too complicated for me, or I just haven't found the right one.
What about wmctrl?
What should the starter command look like? For AisleRiot Solitaire it is simply

Code: Select all

sol

With this code I have determined the position I have set for AisleRiot Solitaire:

Code: Select all

wmctrl -l -G ... 0x06000008 0 241 167 1207 911 rainer-OptiPlex Spider
Thank you in advance for your suggestions and links to tutorials.
Last edited by Dan-cer on Sat Mar 30, 2024 1:11 am, edited 1 time in total.
How you get better results when searching for yourself.
mikeflan
Level 17
Level 17
Posts: 7162
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: What is the easiest way to fix a window position in Cinnamon?

Post by mikeflan »

Try this in a terminal and see if it does what you want:

Code: Select all

wmctrl -r "Spider" -e 0,500,167,1207,911
User avatar
Dan-cer
Level 6
Level 6
Posts: 1161
Joined: Fri Jul 29, 2022 4:56 pm
Location: Germany, Lower Saxony

Re: What is the easiest way to fix a window position in Cinnamon?

Post by Dan-cer »

mikeflan wrote: Wed Mar 27, 2024 9:50 am Try this in a terminal and see if it does what you want:

Code: Select all

wmctrl -r "Spider" -e 0,500,167,1207,911
It doesn't. With "sol" or "Spinne" (German interface) neither.
How you get better results when searching for yourself.
mikeflan
Level 17
Level 17
Posts: 7162
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: What is the easiest way to fix a window position in Cinnamon?

Post by mikeflan »

Open the program and use the first 1 or 2 words in the Title Bar.
For instance, I use "trailsearch.pl" for this window:
.
hdr.png
User avatar
Dan-cer
Level 6
Level 6
Posts: 1161
Joined: Fri Jul 29, 2022 4:56 pm
Location: Germany, Lower Saxony

Re: What is the easiest way to fix a window position in Cinnamon?

Post by Dan-cer »

That doesn't work either. The first and only name is "Spinne" (German for spider). I had already tried that before, with and w/o quotation marks.
And also with a ' at the end, as it is described in a tutorial.
How you get better results when searching for yourself.
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: What is the easiest way to fix a window position in Cinnamon?

Post by Koentje »

Try this bash script and see if it works..

Code: Select all

#!/bin/bash
#################################################
#                                               #
#  Start an application on a certain position.  #
#                                               #
#  Koentje  (remon@cobrasoft.nl)                #
#                                               #
#################################################

# Window name
wname="Klondike"

# Application name
appname=$(which sol)

# Horizontal position
hpos="1000"

# Vertical position
vpos="1200"


########################################################################
########################################################################
killall "$appname"
wait
exec $appname &
while [ "$(wmctrl -l | grep $wname)" = "" ]
do
    echo "Waiting..." > /dev/null
    if [[ $x -gt 30 ]]; then exit; fi
    x=$((x+1))
    sleep 1
done
xdotool search --onlyvisible --name "$wname" windowmove "$hpos" "$vpos"
Image
User avatar
PaulL
Level 6
Level 6
Posts: 1089
Joined: Mon Apr 24, 2023 10:57 am
Location: Connecticut

Re: What is the easiest way to fix a window position in Cinnamon?

Post by PaulL »

Try System Settings > Windows > Behavior, and look for the "Location of newly opened windows" option. There are four choices: Automatic, Cursor, Manual, and Center.

How the applications respond to this setting seems to be application dependent. I find that on Automatic, Aisleriot, GIMP, and Xviewer go to the left side of the window where my cursor is. New terminals open wherever my cursor happens to be, if I use the launcher, or slightly offset if I use File > New Window. On Cursor, Aisleriot centers itself on my cursor, and so do other apps. On Manual, the application opens underneath my cursor, and I have to put it somewhere. Center causes new windows to appear in the center of the monitor where my cursor is.

LibreOffice and Vivaldi (Web browser), however, always open where the last window was when I shut down the app, regardless of the Location setting.

Hope this helps.
User avatar
Dan-cer
Level 6
Level 6
Posts: 1161
Joined: Fri Jul 29, 2022 4:56 pm
Location: Germany, Lower Saxony

Re: What is the easiest way to fix a window position in Cinnamon?

Post by Dan-cer »

@Koentje
Thank you! That is working well. I then set "sleep 0,1" for less delay. That works too.
BTW: I saved the script as spider.sh in /home/<user>/ and made it executable.
@PaulL
Thank you, I tried already these settings. "Cursor" is the best solution for most cases. However, I wrote this thread because I want a solution for the few other cases.
Last edited by Dan-cer on Sat Mar 30, 2024 8:11 am, edited 1 time in total.
How you get better results when searching for yourself.
User avatar
Koentje
Level 7
Level 7
Posts: 1581
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: [Solved] What is the easiest way to fix a window position in Cinnamon?

Post by Koentje »

You're welcome!
Image
User avatar
PaulL
Level 6
Level 6
Posts: 1089
Joined: Mon Apr 24, 2023 10:57 am
Location: Connecticut

Re: What is the easiest way to fix a window position in Cinnamon?

Post by PaulL »

Dan-cer wrote: Sat Mar 30, 2024 12:24 am Thank you, I tried already these settings. "Cursor" is the best solution for most cases. However, I wrote this thread because I want a solution for the few other cases.
Ah, well that makes sense. Sorry not to be of more help.
User avatar
Dan-cer
Level 6
Level 6
Posts: 1161
Joined: Fri Jul 29, 2022 4:56 pm
Location: Germany, Lower Saxony

Re: What is the easiest way to fix a window position in Cinnamon?

Post by Dan-cer »

PaulL wrote: Sat Mar 30, 2024 2:16 pm Sorry not to be of more help.
That's not important at all to me. I'm very happy when help is offered, even if it doesn't include the solution.

Thank you very much!
How you get better results when searching for yourself.
Post Reply

Return to “Cinnamon”