Skip to content

Hot reload settings and plugin settings with IPC command #1659

@Silzinc

Description

@Silzinc

Feature Description

Hello!

I have seen in the docs that the command settings set [key] [value] only works for non object entries, which is related to a limitation in the way quickshell parses arguments in IPC calls. I have seen in DMSShellIPC.qml that devs are not sure as to whether users should be able to put whatever string they want in the command or not, without validation.

A way to circumvent this without having to answer that tedious question could be to add an IPC command to reload settings as it is done at startup.

Use Case

I originally wanted a way to change my widget transparency as I switched from dark to light theme using shell hooks. Right now, modifying that little setting is impossible (from what I understood) without a full dms restart which I would like to avoid.

With this feature, I can just call sed on .config/DankMaterialShell/settings.json and dms ipc settings reload.

Compositor(s)

  • All compositors
  • Niri
  • Hyprland
  • MangoWC (dwl)
  • Sway
  • Other (specify below)

Proposed Solution

This amounts to adding this to the settings IPC commands:

function reload(): string {             
    SettingsData.settingsFile.reload(); 
    SettingsData.loadSettings();        
    return "SETTINGS_RELOAD_SUCCESS";   
}                                       

Of course, this comes with several issues, and since I am not a QML wizard I would like to know your opinion on this:

  • The function always returns success even if there is a reading/parsing error, although the latter is still visible in the quickshell logs. I did not take the initiative to modify the logic in settings loading to also return the eventual error string, but it could be a possibility I guess.
  • This goes against the recommendation in the quickshell docs regarding the use of blockLoading in FileView, as this reload does not happen at startup (although in my tests the reload is pretty much instant, so perhaps the risk is low).
  • This is just dodging the problem, as there still is no real way to check if granular modifications are correct.
  • I have not read thoroughly the content of loadSettings. Perhaps there is something that should not be called again after startup?

Thanks in advance for considering this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions