Forum › Forums › General › Tips and Tricks › Autostart applications help please
- This topic has 40 replies, 7 voices, and was last updated Oct 25-12:32 pm by ModdIt.
-
AuthorPosts
-
May 29, 2020 at 2:13 am #36459Member
ModdIt
::Rather than answer makcnm_070900 in his new thread reminder and additional information is here in
this thread, it is up to date.New users please do a search before posting, the more threads on same subject the harder it is to
find pertinent information.First you will need to install packet wmctrl
In home .icewm startup file which you may have to create add what you need, format as below.
Reason for norestore is to get LO to start correctly in my context. Without that parameter
LO goes haywire.For completeness I have added sample how to assign desktop, size and position for applications,
for most applications it works reliably.Further samples are present in this thread including correct format for firefox esr.
I just start my machine an can get to work without delay, very efficient. Love it.
#!/bin/bash
wmctrl -s 3 #Switches to workspace =4th workspace
libreoffice –norestore –calc &
sleep 4
wmctrl -s 2 #Switches to workspace =3rd workspace
libreoffice –norestore –writer &
sleep 4
wmctrl -s 1 #Switches to workspace 1=2nd workspace
palemoon &
sleep 2
wmctrl -s 0 #Switches to workspace 0=1st workspace
claws-mail &in the .icewm winoptions file last entrys are in my case as below.
libreoffice.libreoffice-calc.geometry: 1003×1180+908+0
libreoffice.libreoffice-calc.workspace: 4
libreoffice.libreoffice-writer.geometry: 1350×1155+0+0
libreoffice.libreoffice-writer.workspace: 3
Navigator.Pale moon.geometry: 941×1173+0+0
Navigator.Pale moon.workspace: 1
claws-mail.Claws-mail.geometry: 941×1173+0+0
claws-mail.Claws-mail.workspace: 0September 15, 2020 at 6:01 am #41714MemberPPC
::I’m not sure if I should revive this old thread, but answering a question on Mx forum, made me think that position application windows on predeterminate positions sounded a bit familar…
Anyway, a general solition to make an application window automaticaly jump to a certain position and size (than can set at the startup or used as an hot key:If, for some reason you want to always start an application with a particular window size and position, use this variable instead (this example manipulates “firefox”‘s already open window):
#automatically set current window size and position
WINDOW_ID=$(xdotool search –onlyvisible –name firefox)
x_position=1
y_position=1
x_size=550
y_size=350
wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_sizeP.
- This reply was modified 2 years, 7 months ago by PPC.
- This reply was modified 2 years, 7 months ago by PPC.
October 19, 2020 at 12:38 pm #43300MemberModdIt
::Hi PPC,
Actual problem with opening Libreoffice 7xx windows at given geometry on specified desktop.Where should we put above variable. Up to now LO 7 defys all attempts to make it autostart the way we want.
Calc on one desktop, writer on next.The whole theme is important for a school.
Logging in to a ready for work standard environment is a big argument for move to Antix. The school hardware is
mostly T410, T420, T430 so should run without much issue for a lot more years.October 19, 2020 at 2:51 pm #43309MemberPPC
::@Moddit:
My post was a script, you can paste it to the command line, or save it as an .sh file and make it executable…
The forum software mangled it- before the “onlyvisible” part, it’s supposed to have two minus signs…Anyway, I tested this command, and it works with LibreOffice 7:
wmctrl -r "Writer" -t 0
the number at the end is the workspace number- it starts at “0”, so this command sends Writer to the first workspace.another example:
wmctrl -r "Calc" -t 1
this sends Calc to the second workspace…EDIT:
Example of the script to put at startup:
(note: correct the libreoffice flags to a double minus sign, because the forum code mangles that)#!/bin/bash ### Start libreoffice writer and calc: libreoffice --norestore --writer & libreoffice --norestore --calc & ### wait for writer and calc finish loading: sleep 12 ### Send libreoffice writer and calc's windows to the desired workspaces (the number after -t: 0 is the first workspace; 1, the second, etc... wmctrl -r "Writer" -t 1 wmctrl -r "Calc" -t 0Adapt the commands as needed and place them in your startup file. Probably you’ll need do place a sleep (like “sleep 5 &&” to wait 5 seconds) before the commands, to give it time for the LibreOffice Windows to load… in a very similiar way to how your previous script works…
This was tested in fluxbox and works fine, moving applications between workspaces…
P.
- This reply was modified 2 years, 6 months ago by PPC.
October 21, 2020 at 12:06 pm #43415MemberModdIt
::Hi all
First off we are on ICEWM as standard. No reason seen to change that because it is in our opinion a near perfect tool.In the end I hacked up autostarting as below, unfortunately xprop readout did not include the version number of LO needed
on our setup. Without that addition no way would Writer and calc autostart.The background is that LO can be installed more than once, for example if user wishes for old version and latest for
testing or better compatibility to MS formats.
Differentiation of the versions is as far as I have seen up to now, the version number.
Autostart script: May not work on all installations, ours is intended for some pretty special needs. Sleep will be too short
on older systems.
As always minus minus before norestore and writer will be mangled by forum software.
#!/bin/bash
wmctrl -s 3
libreoffice7.0 – -norestore – -writer &
sleep 3
wmctrl -s 2
libreoffice7.0 – -norestore – -calc &
sleep 3
### wait for writer and calc finish loading:
wmctrl -s 1 #Switches to workspace 1=2nd workspace
palemoon &
sleep 2
wmctrl -s 0 #Switches to workspace 0=1st workspace
claws-mail &Window sizing is still an issue for libreoffice, all other applications working as wished for.
I am still fighting with that, any ideas very welcome.
I was unable to get the PPC suggestion below to work for me, maybe my last two tired rusty old neurons missed something.
Have not given up yet.#automatically set current window size and position
WINDOW_ID=$(xdotool search –onlyvisible –name firefox)
x_position=1
y_position=1
x_size=550
y_size=350
wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_sizeOctober 22, 2020 at 12:08 am #43445ModeratorBobC
::Moddit,
When entering script code, use the CODE and /CODE in the heading bar of the text entry box to tell the forum software it should be left alone as much as possible. That fixes your double minus problem.
Note how i put the sleep command followed by the && and then the next command on the same line (as PPC suggested) to better control the timing for each command.
#!/bin/bash wmctrl -s 3 sleep 3 && libreoffice7.0 --norestore --writer & wmctrl -s 2 sleep 3 && libreoffice7.0 --norestore --calc & ### wait for writer and calc finish loading: wmctrl -s 1 #Switches to workspace 1=2nd workspace sleep 2 && palemoon & wmctrl -s 0 #Switches to workspace 0=1st workspace sleep 2 && claws-mail &I will look at the sizing thing, but not sure if there is something we can do there or not…
Window sizing is still an issue for libreoffice, all other applications working as wished for.
I am still fighting with that, any ideas very welcome.
I was unable to get the PPC suggestion below to work for me, maybe my last two tired rusty old neurons missed something.
Have not given up yet.#automatically set current window size and position WINDOW_ID=$(xdotool search –onlyvisible –name firefox) x_position=1 y_position=1 x_size=550 y_size=350 wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_size- This reply was modified 2 years, 6 months ago by BobC.
- This reply was modified 2 years, 6 months ago by BobC.
October 22, 2020 at 12:42 am #43447ModeratorBobC
::Moddit,
Tell me for the libreoffice applications that you want to autostart, which workspace number, window size and position are desired for each one
October 22, 2020 at 5:53 am #43458ModeratorBobC
::Moddit,
I am attempting to help resolve this, so help me help you, please…
Tell me what antiX you have installed, and how you got both versions of LibreOffice loaded at the same time so I can duplicate your setup?
Maybe just make an ISO of your general install if it’s in English (or can easily be switched to it) and upload it to MediaFire or someplace?
October 22, 2020 at 1:22 pm #43466MemberModdIt
::Hallo BobC,
thanks for coming in,
the autostart as you gave me does not put LO on the correct desktops, calc 3 writer 4.
The original version I have been using for months does, so might as well stay that way.
——————————————————————————————
The method for default sizing of windows is it seems, an absolutely appalling feature of
Libreoffice, with no logical way to override the behaviour.The problem is subject of posts on LO org and as it seems there is no intent to resolve,
seems that users who ask for usable behaviour in the age of wide screens and 4K are being treated as
menial idiotic gripers. reminds of Mozilla where same often applies..Key is the so called start center, somehow that is reading screen size and opens at full screen,
that behaviour is saved in the config and causes all applications in the office suite to open the same way.Logical for the user, who wrote it that idiotic way, microsoft ????. Making users and Forum members waste
hours of their lives to work around this crap. I am disgusted and very angry.
——————————————————————————————————————–
To get LO to open Calc, Writer other parts of the suite at a given size and position.
1/ Close LO completely.
2/ Using a file manager set to showing hidden files open /home/.config. Delete the folder libreoffice.
3/ Open the Libreoffice start center on the desktop you wish to use Calc on. Resize the START CENTER WINDOW
to the proportions you wish for. Open calc. Close it using the Menu, close the start center using the menu.
4/ Do proceedure as above substituting writer/draw/impress/math for calc.Bob would you please follow and confirm, or we need to correct so this can be used by others.
I will compare config files, new and corrected to see how the changes are stored.
Maybe we can come up with an easier way to set some sensible defaults. And lock them.Once this is quality checked we can put it in wiki and on MX forum. I found no solution there.
October 22, 2020 at 6:19 pm #43491MemberModdIt
::Thanks to all, who like me tried and failed to get LO autostarting with fixed workspace, window and size with AntiX.,
I am sorry to say the reason behind trouble with LO autostart has only hit me after update to 7.
Reading in other forums I find this must have been an issue before.Why we were or felt unaffected I do not know.
Next job for me, maybe with assistance is to figure out how we can controll the behaviour in future so AntiX MX LO users
do not have to suffer the frustration this has caused for all involved.- This reply was modified 2 years, 6 months ago by ModdIt.
October 22, 2020 at 7:14 pm #43498Member
Xecure
::A question, Moddit (I may be wrong, but maybe we can figure out what is going on).
Are you using Libreoffice 7 from the backport repos or is this an App Image?
If, after loading libreoffice writer even if it is placed in the wrong workspace and the wrong size, can you move the window using the wmctrl commands?For example, save the script into a file and make it executable (I named mine move-writer.sh):
#automatically set current window size and position (based on PPC and BobC script) WINDOW_ID=$(xdotool search --onlyvisible --name Writer) WORKSPACE=1 #Count your workspaces from 0 x_position=1 y_position=1 x_size=550 y_size=550 wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_size -t $WORKSPACENow, launch libreoffice writer (at least in english its name appears as “Untittle 1 – Libreoffice Writer”)
Run the script (move-writer.sh)
Does libreoffice move to the correct workspace? (I set it to move to the second workspace in the previous script.What PPC and BobC were trying to explain as that you can first launch libreoffice in the autostart script, then launch the script to move it to a diferent workspace.
In the previous experiment it worked for me.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.October 23, 2020 at 4:50 am #43527ModeratorBobC
::My concept is a little different, that is to have a generic wmadjust script that you call to adjust the window position and size after giving the program time to load. It uses a tweaked version of PPC’s little resize/reposition script, and calls it from startup (or anywhere) for each application that you want to adjust after its loaded. You will need to know the exact window name to feed it for it to work and that name cannot have any spaces in it:
Moddit, Warning, I haven’t tried this yet, so unless you like to live dangerously let us script kiddies (bobC, PPC, Xecure, others?) here play and come up with a solution that works before you attempt it.
Regardless who’s solution is chosen as best, I think we all want your project to be a success, and we don’t want to let it be perceived a failure, substandard or half baked just because we couldn’t spare a few hours to make it magical for you and your kids. Maybe you can post a pic with antiX screen laptops to show people that this effort has gone to a good cause?
PS1: I think trying to do it by name could be a problem. I will use class similar to winoptions.
PS2: I was successful moving the program from one workspace to another using a parameter of calc and then matching it with both name and class to get a window id, but I was unsuccessful changing the window position or size using wmctrl. I experimented by resizing and moving the calc window, and then seeing what files changed on my disk drive, and finding the code that changes each time I move or resize the window. This is essentially what Moddit was suggesting. I found that it saves a value in an xml file to tell it the size and position of the window to open in the current workspace. It saves the latest value there when you close the program and then uses it to control size and position the next time you open it, opening it in the current workspace. I see that it also had a line there for the writer program. I would hope there is a better way to change it than by changing the values to defaults before starting libreoffice using a script, but at least that is one possible solution. I will keep looking. Here was the line I found for calc:
~/.config/libreoffice/4/user/registrymodifications.xcu <item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.sheet.SpreadsheetDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>88,22,860,799;1;0,0,0,0;</value></prop></item>PS3: I will try with libreoffice 7 next, but it would be nice to know which libreoffice 7 you installed so that I am working with the same one.
Scripts….
#!/bin/bash ### ~/.icewm/startup libreoffice7.0 --norestore --writer & libreoffice7.0 --norestore --calc & ### wait for writer and calc finish loading, then move/resize them using new program called wmadjust ### call with 6 parameters with numbers in same sequence as geometry ### wmadjust WindowClassAndName WorkSpaceNumber XWidth YHeight XPosition YPosition sleep 5 ### winoptions (if it would work) strings shown to illustrate example ###libreoffice.libreoffice-writer.geometry: 1350×1155+0+0 ###libreoffice.libreoffice-writer.workspace: 3 wmadjust writer 3 1350 1155 0 0 ###libreoffice.libreoffice-calc.geometry: 1003×1180+908+0 ###libreoffice.libreoffice-calc.workspace: 2 wmadjust calc 2 1003 1180 908 0 ### load other autostart apps wmctrl -s 1 #Switches to workspace 1=2nd workspace sleep 2 && palemoon & wmctrl -s 0 #Switches to workspace 0=1st workspace sleep 2 && claws-mail &#!/bin/bash ### /usr/local/bin/wmadjust ### call with 6 parameters with numbers in same sequence as geometry ### wmadjust WindowClassAndName WorkSpaceNumber XWidth YHeight XPosition YPosition #automatically set current window size and position (based on PPC and BobC script) WINDOW_ID=$(xdotool search --name --class $1) WORKSPACE=$2 #Count your workspaces from 0 x_size=$3 y_size=$4 x_position=$5 y_position=$6 wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_size -t $WORKSPACE- This reply was modified 2 years, 6 months ago by BobC.
- This reply was modified 2 years, 6 months ago by BobC.
- This reply was modified 2 years, 6 months ago by BobC.
October 23, 2020 at 8:31 am #43542MemberModdIt
::Thanks again to all who are in on this, I have no issue with the actual autostart as it is working reliably now, has done so for all
except LO7 for months. I will leave that in place until both autostart and desktop assignment with position size is workingPlease excuse me giving some reasoning for what I am trying to do and why, the technical stuff is at bottom of post.
Window sizing is only an issue with Libreoffice. I now have the version from Backports as standard, no issue there as long as it is
up to date. For wider acceptance the base system is, as a hidden item for most users OT. They do want the latest in front of them,
often for good reason, in many cases it is psychology caused by ad industry, I do some lipstick and flashy hairdo job on antiX, they
are happy.A nice final autostart size to desktop setup tool for all antix/MX users is one aim though. Maybe in the end including a desktop
creation if not already setup. We are using 6. Reasoning behind that came from getting calls after confusion with window stacking.
Tilers were not appreciated so I used a food/houshold storage space analogy. That got things working even for a chronicly sick person
who locks up when things get harder to understand, person lost in stacked windows. it is not an unintelligent person, just can not cope
in some situations.i am somewhat reluctant to have windows moving to different workspaces after opening, long term I would like them to open on other desktops
without displaying during startup of the individual users workspace. Pretty sure ice can do that easily, that though is for final icing on the cake.Right now the delay time is useful to slow things down on fast computers and prevent triggers for epilepsy. Schools here are integrated
migrane and epeleptic fits can be quickly initiated by a flashing screen, if we autostart with an M2 drive or ssd in a fast computer the effect
is worrying. Older non computer orientated citizens are also very irritated by all the action.Bobc wrote:
PS2: I was successful moving the program from one workspace to another using a parameter of calc and then matching it with both name and class to get a window id, but I was unsuccessful changing the window position or size using wmctrl. I experimented by resizing and moving the calc window, and then seeing what files changed on my disk drive, and finding the code that changes each time I move or resize the window. This is essentially what Moddit was suggesting. I found that it saves a value in an xml file to tell it the size and position of the window to open in the current workspace. It saves the latest value there when you close the program and then uses it to control size and position the next time you open it, opening it in the current workspace. I see that it also had a line there for the writer program. I would hope there is a better way to change it than by changing the values to defaults before starting libreoffice using a script, but at least that is one possible solution. I will keep looking. Here was the line I found for calc:
—————————————————————————————————————————————————————————————–
~/.config/libreoffice/4/user/registrymodifications.xcu<item oor:path=”/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory[‘com.sun.star.sheet.SpreadsheetDocument’]”><prop oor:name=”ooSetupFactoryWindowAttributes” oor:op=”fuse”><value>88,22,860,799;1;0,0,0,0;</value></prop></item>
—————————————————————————————————————————————————————————————–This is where a final LO solution is waiting, using the second option seems best to me as
the user file can easily be changed by accident, and setup factory attributes can i think more easily work reliably on any desktop or WM- This reply was modified 2 years, 6 months ago by ModdIt.
October 23, 2020 at 10:07 am #43546Member
Xecure
::Thanks again to all who are in on this, I have no issue with the actual autostart as it is working reliably now, has done so for all
except LO7 for months.Window sizing is only an issue with Libreoffice. I now have the version from Backports as standard,
Bobc wrote:
PS2: I was successful moving the program from one workspace to another using a parameter of calc and then matching it with both name and class to get a window id, but I was unsuccessful changing the window position or size using wmctrl.So, let me understand this. Ignoring your previous experience.
Since libreoffice 7, writer launches in the correct workspace at startup, but doesn’t resize at launch using the saved parameters for icewm. Correct?
Does libreoffice writer launch fullscreen perhaps, and that is why it ignores the window size parameters?
We need to know this information.
Using BobC’s script wmadjust, it would look like:#!/bin/bash ### /usr/local/bin/wmadjust ### call with 6 parameters with numbers in same sequence as geometry ### wmadjust WindowClassAndName WorkSpaceNumber XWidth YHeight XPosition YPosition #automatically set current window size and position (based on PPC and BobC script) WINDOW_ID=$(xdotool search --name --class $1) WORKSPACE=$2 #Count your workspaces from 0 x_size=$3 y_size=$4 x_position=$5 y_position=$6 wmctrl -i -r $WINDOW_ID -b remove,maximized_horz wmctrl -i -r $WINDOW_ID -b remove,maximized_vert wmctrl -i -r $WINDOW_ID -e 1,$x_position,$y_position,$x_size,$y_size -t $WORKSPACEThe new important parts being:
wmctrl -i -r $WINDOW_ID -b remove,maximized_horz wmctrl -i -r $WINDOW_ID -b remove,maximized_vertWhich, if the window is maximized, will remove the maximized property.
This script by BobC would let you load each program in the background, without a visual “Move from one workspace to another”, so the people with special needs won’t suffer from any of the visual stimulus. It would also load much faster, without having to spend time waiting for everything to load, and if someone is very impatient, them moving to different workspaces won’t affect the programs that are loading. But if you prefer the other way that has always worked for you, remove the WORKSPACE entries from that script (it is best we know if you want to keep the way that has always worked for you or if you think the new way will help out).Your startup script (which you shared in a preious comment) would look like (removing extra comments from BobC):
#!/bin/bash wmctrl -s 3 libreoffice7.0 --norestore --writer & sleep 3; wmadjust writer 3 1350 1155 0 0 wmctrl -s 2 libreoffice7.0 --norestore --calc & sleep 3; wmadjust writer 2 1003 1180 908 0 ### wait for writer and calc finish loading: wmctrl -s 1 #Switches to workspace 1=2nd workspace palemoon & sleep 2 wmctrl -s 0 #Switches to workspace 0=1st workspace claws-mail &antiX Live system enthusiast.
General Live Boot Parameters for antiX.October 23, 2020 at 12:58 pm #43553MemberModdIt
::Hi xsecure,
You ask, Does libreoffice writer launch fullscreen perhaps, and that is why it ignores the window size parameters?no it follows below, the start center saves parameter in 1. the other LO modules are controlled in a same manner.
Modifying those parameters is effective. it also works fine with two calcand one writer window on my daughters monster widescreen.
she opens 3 A4 sized windows while working and has space to share.1/ ~/.config/libreoffice/4/user/registrymodifications.xcu
2/ <item oor:path=”/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory[‘com.sun.star.sheet.SpreadsheetDocument’]”><prop oor:name=”ooSetupFactoryWindowAttributes” oor:op=”fuse”><value>88,22,860,799;1;0,0,0,0;</value></prop></item>
dreaming maybe. If these settings could be controlled with a gui controlled bash script that would provide a WM agnostic solution, work on other linux flavours too.
Hopefuly that could then be included in future antix full version, maybe MX too.I will try the latest startup version from your post this evening. I am by the way in Berlin time.
-
AuthorPosts
- You must be logged in to reply to this topic.