 Welcome to my talk about using configuration extensions to automate some preferred defaults. And I'm going to be demonstrating on another screen, so I'm just going to start off and look at my notes for the first slide, and then I'll go without notes for the rest. But I wanted to get this introduction read. We're good. Okay, so a good sysadmin makes sure that his computers are consistently set up and minimizes helpdesk calls by providing good default settings and eliminating pop-ups that confuses users. Writing LibreOffice configuration extensions is a great way to ensure that your favorite tweaks are always set. Simply install the shared extension along with LibreOffice, and all users on that computer will use those settings as the default options. So that's the focus of this session today. So what we're going to do is we're just going to look at the details of a simple example just so that we see what we're talking about. Then I'm also going to share some of the scripts that I use to automatically install it, because when I install LibreOffice, I just use a PowerShell script or something, install the application, the help, and then any extensions that I want. And it happens all without any user interaction really. Some advantages and disadvantages of using these configuration extensions, and then we'll look at building. How do you find the settings and add new ones into your own configuration example? So the impetus for this talk and the focus of this first one comes from one of the bug reports. And there's a computer shop that's selling computers and they preload LibreOffice on all the computers that they sell their customers. And that's awesome. And they were asking in the bug report if we could provide a UI choice that had both the menu, the traditional menu, and the notebook bar active at the same time. And that's not great from what we want because the whole point of the notebook bar is to replace the menu, not have both available. But they found that a lot of their customers, they said the wife prefers one way and the husband prefers the other way. And so that's what they were asking for. And apparently they must be setting up that LibreOffice, they must be customizing it manually for every computer that they set up. And so a configuration extension would do exactly what they want for the bug report and also simplify any other changes that they want to do. So another type of person for this configuration extension could be useful would be an IT guy for a small office 10 or 50 to 100 computers if you're managing that. I can see a QA person wanting this because they're often going to be deleting the profile or moving from one instance to another and they can put in default settings to not have the tip of the day pop up every time, for example, when they start up a computer. Someone who's a LibreOffice migrator might be interested in this as well or anybody who's often installing LibreOffice for friends and family and providing support. Okay, so an extension, a LibreOffice extension is really just a zip file. So whatever is in there, we can just unzip it. And it contains basically two pieces. There's XML configuration changes and then a manifest that tells LibreOffice what each of those XCU files does. So let's just take a look at the contents of the extension that I did that sets both the menu and the notebook bar active at the same time. Okay, so here of course we have the traditional menu with the toolbars and if we install the extension that I'm talking about, a tab UI along with the menu. And now you can see that we have our tab notebook bar and the menu is also available at the same time. So what they are asking for is easily solved with one of these configuration examples. And let me just go back again and unzip it and we'll see the contents of it, what it looks like. Okay, so I'm just extracting the zip file and this is what the extension looks like. So we have a few configuration XCU files and then the manifest that says what each of those is supposed to be doing. Okay, and this is the contents of the toolbar.xcu file. And so it's just a, oops, I should not have hit enter and press. Okay, so we have a path applications writer and the active interface is notebookbar.ui and the tabs mode has menu bar set to true. And so that's just what we've seen. Okay, so that is basically all that it takes. It's fairly simple to create one of these extensions. I talked about installing everything automatically with PowerShell and so I've just copied and pasted the relevant part of it for extensions. So this UNO package command is what you can do to programmatically add an extension and if you make it shared then it will be for all users. And here's the same thing for Debian based. The two parts in blue are really the only important parts. You could also use the same UNO package command that's available for Windows. It's also available for Linux. But this is another way you can do it, simply unzipping into the Debian distributions. It's user live, blue graph, share extensions. You can simply uninstall it there. This one is again just a copy and paste of what I use. This one's a little more complicated because I have a folder where I just drop extensions into and I don't have to modify any scripts that way. Just the script will look for every extension that's in the folder and automatically install it. So if I want to make any changes, all I have to do is drop a new extension into the folder. And so I just pasted these here in case this would be helpful for anybody who was interested in doing this themselves. But none of this is important. You can install them like I did originally with the UI. No command line is required. Okay, so now let's talk a little bit about some of the advantages of configuration extensions. First, I think you can see they're very fast and easy and consistent to deploy. And this is also using an extension is also the way that LibreOffice was designed to be managed. Before I was using this, we were just kind of hacking around doing a search and replace on XML files. And then I wrote some code to submit to LibreOffice to make that process a little nicer and Staphon and some of the others said, no, there's a proper way to do that. Get rid of your stuff. So early on, a month of my time was wasted and a good lesson learned. Another advantage is that this is a middle layer of settings. Okay, so what I mean by that is that the end user can override it. We're not enforcing this with our extensions. We're just providing a default over top of LibreOffice defaults. You see LibreOffice is a lower priority and then our IT admin settings is a middle priority and the end user can override your settings. There is also an option where you can enforce it. So you can make it so that the end user cannot override. And that will be a nice debugging tip as well for us and we'll use that for debugging. And lastly, an advantage is you can apply this after a user has already started LibreOffice after their profiles already been created. So it applies on top unless the end user has already provided settings for that specific one. Your defaults will still come into effect. You don't have to delete the profile for this to come into play. Some disadvantages. First, of course, it's not any kind of central management. Every computer is going to need to have the extension installed themselves. And if you do need central management, then you'd want to look into group policies, which would be the other supported way of making these kind of changes. And also, I said it's fairly easy to create these, but if you make any kind of mistake, a typo, upper case when it should be lower case, anything like that, there's not a lot of feedback. There's not very many hints about what you did wrong. And so it can be difficult to figure out what you did wrong when you're making an extension. One way to avoid or to work around that is by enforcing the setting. Then in the UI, that will often disable it. And so you can get visual confirmation that you've got the right configuration setting because now it's disabled and locked to your setting. And another way would be to just run it in a LibreOffice development environment with the debugged symbols turned on. And that might give you some clues as to what's not working. Okay, so now we'll go back and talk about actually how let's add a few more settings to this. How would you actually create one and develop it for your own? And there is a configuration extension guide on the Wiki, which is linked below. And there's also a sample that accompanies the guide. So you have a starting point to look at on the Wiki. So the example that I want to look at is something that's new for 24.2. And that is that creating a backup is going to always be turned on. So every time you modify a document, it's gonna save a copy of that document in your backup folder and it's gonna stay there forever. Most people probably don't, they won't realize that that's happening and they won't ever see it because that backup folder is kind of hidden away in your profile, so most of the time you'd never even notice that it's there. And this might be a concern, privacy or security concern for people. And guys, so what we're going to do is we're just gonna try to identify it, like how do we know what path, what are the commands to do? So we're going to look to see how we find that. And so I'm going to just go back into LibreOffice and we're going to go into the options, advanced options and just search for the word backup. Actually, let me just show it to you here first. So under load save, we have always create a backup copy. And of course, we could just manually turn it off, but if we want to develop an automated approach, we can search the word backup. And we have a quite manageable list with the fairly obvious create backup, which is set to the true value. So if we just say false, then we can see, yes, that is the right one. It changed our always create backup copy to false. Let's go back again and find out that path. So this is in the common save document called create backup. So that's all that we need. And now we just have to translate or put that into our XML file. So let me, I have that on the next slide. So yes, I'm supposed to be doing that manually. So let me put the mic down again and actually put this into our common file. Actually, I'm going to cheat because my Bifocals are bothering me doing this. I'm just going to copy the example that I already made earlier instead of doing it manually. So we've added the common XU to our manifest and we've added a common XU file with the save document create backup set to false. And let me do my debugging technique by finalizing it, basically making it so that the user is not allowed to change that. So now we just need to zip this up and install it. So that was the common file. And now I'm just going to zip it up and it's easiest to do it from a command line. So this is the command line that I'm going to be running on the other screen. So with that command line, I've created the extension, deleted the old one and reinstalled it on the new one. Now when we go to the options, we should see a disabled backup, automatically backup so the user can't change it and it's turned off. So it did exactly what we want and we're sure that we have the right setting. So one final example then. Again, something new for LibreOffice. We've started supporting forms much better in PDFs. So if you have a form in LibreOffice, ODF format, when you create a PDF, it'll actually be a fill in form. But a lot of users probably just don't want it to be a real form, they just want it to be like a print out of a paper thing. And so we probably just want to not create a form when we're exporting a PDF. And so I'm just going to guess because that's typically the way that I work as a normal system administrators, you don't actually know what it is. You just guess, try it out and figure it out. So we're going to guess at a few terms like create PDF or PDF form and see what happens. Okay, so create PDF form only has one entry, warn, create, that doesn't sound right. We search for PDF form, nothing. But guessing usually does pretty good. I haven't really run into very many problems with it. This one gives quite a few examples, but it's not an unmanageable number. And when we look through it, and we can see the entry here in gray, export form fields is set to false. And so the path that we saw there was that I didn't specify what it was there, the same as before, filter PDF export, export form fields. And we'll set it to false so that it's not disabled and that the user is allowed to change it back. We'll zip it up and install it again and restart LibreOffice. And when we export as a PDF, then create PDF form is set to false. Notice this time that the UI is not disabled. So perhaps there's a little bit of UI work that could gray this out since the user really isn't allowed to change it. I don't think it works. It certainly doesn't remember it on the next time that you do it. So I think you can check it, but it's not actually allowed, at least when it's disabled by IT. So the Wiki sample has a few more examples of things that might typically want to be done. A lot of people like to save as a Microsoft format by default, especially family and friends who interact mostly with other Microsoft users. You really don't want to send a Microsoft person an ODF file because they can't handle that very well. And then also if you're doing that, you probably don't want to warn them about saving in doc formats or other alien formats. At least typical users have no idea what that is saying and they just get confused about it. Fonts and locale can be other things that can be useful to be set in a configuration example. So that's the end of my presentation. If there's any questions or any ideas. If anybody wants to share, what is one of the first things that you ever changed on LibreOffice when you started the new instance? So any questions or confirmations of things that I've already said? Okay, so the first example is perfect for you then. So for a QA person, using Bibisect or something can be nice because you can just unzip it into the folder and you can still delete the profile and the extension will still be there. But if you manually install the extension, it'll be in your profile and every time you delete your profile to clean out the Bibisect, it'll be deleted. So this could be something useful there. Anybody else have anything that they changed right away?