mlterm icon indicating copy to clipboard operation
mlterm copied to clipboard

Apply configuration file changes on runtime

Open holytrousers opened this issue 1 year ago • 6 comments

Thank you @arakiken for this great piece of software, it is a real treat.

I have been writing about it in the arch wiki and i'm still discovering its features.

One of the features it lacks however ( and i hope i'm not being rude, it is really hard to find a missing feature here ) is that it doesn't apply settings realtime when they are changed in main config file.

I suppose it should be an easy thing to implement since it already has the ability to apply changes from mlconfig, and yet i believe many users will appreciate the possibility to configure it by directly changing the config files.

Greetings from Tunisia !

holytrousers avatar May 05 '23 17:05 holytrousers

Thanks. It might not be fully functional for you, but I wrote a tiny script to support the feature. https://github.com/arakiken/mlterm/blob/master/tool/accessories/applycfg.sh It simply reads ~/.mlterm/main and applies its changes. (Dynamically changeable options: https://github.com/arakiken/mlterm/blob/master/doc/en/PROTOCOL)

arakiken avatar May 21 '23 07:05 arakiken

Thank you, the script works. It can only parse the main file, i suppose changing fonts doesn't work because of how they declared.

holytrousers avatar May 26 '23 15:05 holytrousers

I add applyfontcfg.sh which parses ~/.mlterm/*font files. https://github.com/arakiken/mlterm/blob/master/tool/accessories/applyfontcfg.sh

arakiken avatar Jun 03 '23 11:06 arakiken

That's nice, thanks! I tried setting your script as an autocmd in vim that would be run each time i update the config files but the escape sequences get printed instead, i also tried running it inside a vim terminal but these escape sequences don't seem to work. i suppose it's because vim's terminal shell intercepts them. PS. Is it possible to run these scripts by assigning them to a key in the key file ? The man page addresses this issue by suggesting that escape sequences should be delivered directly by using proto:STRING

holytrousers avatar Jun 04 '23 23:06 holytrousers

Adding a following line to ~/.vimrc makes vim apply configrations of ~/.mlterm/main automatically after updating it in my environment. autocmd BufWritePost ~/.mlterm/main !applycfg.sh

applycfg.sh uses OSC 5379. If you execute applycfg.sh in vim :terminal, mlterm can't receive it, beucase vim :terminal discards it.

It is possible to send escape sequences to mlterm by setting ~/.mlterm/key, but impossible to execute shell scripts.

arakiken avatar Jun 18 '23 03:06 arakiken

I have tried that autocmd actually on neovim, that's why i said it wasn't working. It works only with vim. Sorry i wasn't precise enough, i didn't think it made any difference.

Neovim converts these escape codes and outputs this :

".mlterm/aafont" 1 line, 24 bytes written
:!applyfontcfg.sh
^[]5379;aafont:DEFAULT=SF Mono Light
shell returned 1

I have switched back to vim because of this one. Thanks for your assistance.

holytrousers avatar Jun 18 '23 12:06 holytrousers