Prevent GUI's opening on loading project

MusE is a DAW for Linux with both MIDI and Audio editing. https://muse-sequencer.github.io

Moderators: MattKingUSA, khz, spamatica

Post Reply
User avatar
Impostor
Established Member
Posts: 1336
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 345 times

Prevent GUI's opening on loading project

Post by Impostor »

Sometimes I have five or six plugin GUIs open when saving a project (hidden behind the MusE window, and forgotten). By default, all those GUIs will be opened when loading the project again. I'd prefer that all plugin GUIs stay closed when loading projects. Could such a (global) option be added?

Like, setting
<nativeGuiVisible>1</nativeGuiVisible>
to
<nativeGuiVisible>0</nativeGuiVisible>
by default in all projects?

I could include

Code: Select all

find "/home/orbit/Muziek/MusE/Projects" -type f -name "*.med" -exec sed -i 's/<nativeGuiVisible>1/<nativeGuiVisible>0/g' {} \;

in the script starting MusE, but an undesired result hereof is that all my project files get the same modification date and time.

User avatar
Impostor
Established Member
Posts: 1336
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 345 times

Re: Prevent GUI's opening on loading project

Post by Impostor »

Problem with my command is that it results in a file modification date change whether or not sed replaces something. I used the following to only feed sed those files which actually need modification:

Code: Select all

#! /bin/bash
grep -rl --include *.med '<nativeGuiVisible>1' /home/orbit/Muziek/MusE/Projects >> ~/tempfile &&
<~/tempfile xargs -d\\n -n1 sed -i 's/<nativeGuiVisible>1/<nativeGuiVisible>0/g'
rm ~/tempfile

I had to use an intermediate file since I couldn't get xargs to output multiple arguments to sed correctly.

And the above works fine for synth GUIs, but for effect GUIs the setting to be changed is <nativegui>1</nativegui>.
Using option -e 'expression1' -e 'expression2' for both grep and sed fixed that too. What else is there? Generic GUIs!

I think I have all of them with grep -e 'uiVisible>1' -e 'gui>1'....

User avatar
Impostor
Established Member
Posts: 1336
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 345 times

Re: Prevent GUI's opening on loading project

Post by Impostor »

Okay, found a one-liner which works without an intermediate file. I still let it create a log though to see what projects are edited:

Code: Select all

grep -rl --include *.med -e 'uiVisible>1' -e 'gui>1' /home/orbit/Muziek/MusE/Projects | tee ~/muse.log | xargs -d \\n -r sed -i -e 's/uiVisible>1/uiVisible>0/g' -e 's/gui>1/gui>0/g'

For the interested, the command above is a string of four commands:

  1. grep, which searches for the two specified strings (each one preceded by option -e) inside any .med files (the --include option) within the specified path (including submaps, option -r), and outputs the filenames (option -l) in which any of them is found.
  2. tee, which writes those filenames to the given file, and passes them on to the next command
  3. xargs, which reads the input it gets from tee (where filenames are separated by newline characters: option -d \\n), and (I think) passes them on one by one to
  4. sed, which replaces 1's by 0's in the right places.

Edit: added -r to xargs options, which prevents the sed command from being executed when there are no files to edit. And as written, I think sed is called only one time and processes all files in sequence. Adding -n 1 to xargs options would result in sed being called once for every file.

Post Reply