Issues with xdotool and getting window IDs

Freddy060

New Member
Joined
Sep 29, 2025
Messages
4
Reaction score
0
Credits
38
Environment:
Ubuntu 24.04.2 LTS
xdotool version 3.20160805.1
LibreOffice Writer 24.2.7.2

Goal
I want to schedule LibreOffice writer to key CTRL+S then CTRL+Q to save then quit a file on a shared workstation. It's necessary to ensure notes are passed from night shift to day shift as a restart is scheduled every morning for stability which closes the file without saving.

Problem:
I'm using xdotool to try to accomplish this. I am a very basic user so I don't understand a lot of the functionalities of the terminal but from what I can understand I need a window id from libreoffice to focus the window I want it to key.
I tried using an example line
xdotool search --class libreoffice
to get a window id for libreoffice but it returns nothing I've tried a few other options for xdotool search but it either returns nothing or the help menu. I've also tried
xdotool getwindowname
xdotool getwindowpid
xdotool getwindowfocus
The first two return no windows in the stack even if I specify [window=%@] and the third gives me a window id that I can't match to any window
 


Environment:
Ubuntu 24.04.2 LTS
xdotool version 3.20160805.1
LibreOffice Writer 24.2.7.2

Goal
I want to schedule LibreOffice writer to key CTRL+S then CTRL+Q to save then quit a file on a shared workstation. It's necessary to ensure notes are passed from night shift to day shift as a restart is scheduled every morning for stability which closes the file without saving.

Problem:
I'm using xdotool to try to accomplish this. I am a very basic user so I don't understand a lot of the functionalities of the terminal but from what I can understand I need a window id from libreoffice to focus the window I want it to key.
I tried using an example line
xdotool search --class libreoffice
to get a window id for libreoffice but it returns nothing I've tried a few other options for xdotool search but it either returns nothing or the help menu. I've also tried
xdotool getwindowname
xdotool getwindowpid
xdotool getwindowfocus
The first two return no windows in the stack even if I specify [window=%@] and the third gives me a window id that I can't match to any window
Welcome!

The issue evidently is embedded in this extract from your text:
"ensure notes are passed from night shift to day shift as a restart is scheduled every morning for stability which closes the file without saving."
It's not quite clear from this that using xdotool and libreoffice would be the most effective, efficient or useful tools for that passing of notes. You may have particular reasons for the use of those apps, but readers would be helped if you could explain in more detail what the situation is.

For example, is the issue about a message being written in a night shift which needs to be saved on computer shutdown, so that it can be read by the day shift after the computer has been restarted?
What is the nature of the message? Is it text alone, or does it include images, diagrams, specially formatted text?

I ask because if by chance it's just text that needs to be saved and reproduced for the next shift, using libreoffice and xdotool would really be a rather large and unnecessary over-resourcing on a linux machine. Perhaps the issue is more complex and I have missed the intent, but please feel free to expand on the matter and surely help will be provided.
 
Welcome!

The issue evidently is embedded in this extract from your text:

It's not quite clear from this that using xdotool and libreoffice would be the most effective, efficient or useful tools for that passing of notes. You may have particular reasons for the use of those apps, but readers would be helped if you could explain in more detail what the situation is.

For example, is the issue about a message being written in a night shift which needs to be saved on computer shutdown, so that it can be read by the day shift after the computer has been restarted?
What is the nature of the message? Is it text alone, or does it include images, diagrams, specially formatted text?

I ask because if by chance it's just text that needs to be saved and reproduced for the next shift, using libreoffice and xdotool would really be a rather large and unnecessary over-resourcing on a linux machine. Perhaps the issue is more complex and I have missed the intent, but please feel free to expand on the matter and surely help will be provided.
No you got the intent spot, saving the message needs to be saved on shutdown and while being able to pass images or other specialized texts it's not manadatory.
 
I'm also not too concerned about resource strain. The machine isn't used for very much more than spotify notes and some lightweight browsing.
 
While much different than what you're asking for, is there anything preventing you from simply telling LibreOffice Writer to automatically save every minute and to automatically save backups at that same interval? Then, when the next person comes in for the day shift, they'll see the most recent version of the document.

It's less complex but should achieve prettty much what you're asking for. Just, you know, don't change the document within a minute of the end of their shift -- which is something that's unlikely to happen already.
 
I have been using xdotool for things. It works great as long as the window has focus. Supposedly you can set it to go to a specific window but I have yet to make it work. If you get that info please share it.
 
While much different than what you're asking for, is there anything preventing you from simply telling LibreOffice Writer to automatically save every minute and to automatically save backups at that same interval? Then, when the next person comes in for the day shift, they'll see the most recent version of the document.

It's less complex but should achieve prettty much what you're asking for. Just, you know, don't change the document within a minute of the end of their shift -- which is something that's unlikely to happen already.
Idk why I was over complicating this, this more or less achieved exactly what I was looking for. Although with the caveat that according to my opening coworker it displays an error that the file is corrupt in the morning despite opening perfectly fine.
 
Idk why I was over complicating this, this more or less achieved exactly what I was looking for. Although with the caveat that according to my opening coworker it displays an error that the file is corrupt in the morning despite opening perfectly fine.

Well, I'm glad it'll work but I have no idea why it'd give you that error. You'd have to look for that or ask that question somewhere. That's an error that I've never seen.
 


Follow Linux.org

Staff online

Members online


Top