home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

kconifg:init

Open pasqui23 opened this issue 3 years ago • 17 comments

Description

Fixes https://github.com/nix-community/home-manager/issues/607 by providing a way to programattically set kde configuration files. However as note that any theme changed with this module requires a logout, as the proper way would be to exec plasma-apply-* and those commands seem to require a working DBus and thus https://github.com/nix-community/home-manager/pull/2548 for testing on my setup.

Checklist

  • [x] Change is backwards compatible.

  • [ ] Code formatted with ./format.

  • [ ] Code tested through nix-shell --pure tests -A run.all.

  • [ ] Test cases updated/added. See example.

  • [x] Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • [ ] Added myself as module maintainer. See example.

    • [ ] Added myself and the module files to .github/CODEOWNERS.

pasqui23 avatar Dec 15 '21 17:12 pasqui23

Some thoughts after trying something like this locally:

Activate after linkGeneration rather than writeBoundary so if someone removes an old home-manager config for one of these files and then sets it up this way, the old link is removed before trying to set it. What does this script do if a file doesn't already exist, or if it can't be written to?

Ask KWin and KGlobalSettings to reload configs so they can apply immediately. Seems to work for me but not confident this reloads all configs:

      $DRY_RUN_CMD ${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.kde.KWin /KWin reconfigure || echo "KWin reconfigure failed"
      # the actual values are https://github.com/KDE/plasma-workspace/blob/c97dddf20df5702eb429b37a8c10b2c2d8199d4e/kcms/kcms-common_p.h#L13
      for changeType in {0..10}; do
        $DRY_RUN_CMD ${pkgs.dbus}/bin/dbus-send --type=signal /KGlobalSettings org.kde.KGlobalSettings.notifyChange int32:$changeType int32:0 || echo "KGlobalSettings.notifyChange failed"
      done

LunNova avatar Dec 15 '21 23:12 LunNova

Some thoughts after trying something like this locally:

What does this script do if a file doesn't already exist, or if it can't be written to?

The file is created without problems

Ask KWin and KGlobalSettings to reload configs so they can apply immediately. Seems to work for me but not confident this reloads all configs:

      $DRY_RUN_CMD ${pkgs.libsForQt5.qt5.qttools.bin}/bin/qdbus org.kde.KWin /KWin reconfigure || echo "KWin reconfigure failed"
      # the actual values are https://github.com/KDE/plasma-workspace/blob/c97dddf20df5702eb429b37a8c10b2c2d8199d4e/kcms/kcms-common_p.h#L13
      for changeType in {0..10}; do
        $DRY_RUN_CMD ${pkgs.dbus}/bin/dbus-send --type=signal /KGlobalSettings org.kde.KGlobalSettings.notifyChange int32:$changeType int32:0 || echo "KGlobalSettings.notifyChange failed"
      done

That requires dbus access, not aviable in nixos module until https://github.com/nix-community/home-manager/pull/2548 is merged

pasqui23 avatar Dec 16 '21 08:12 pasqui23

Strange, it works for me already, tested by toggling settings and confirming they are applied immediately with that change.

LunNova avatar Dec 16 '21 14:12 LunNova

@LunNova If you are using home-manager from the terminal and not as a NixOS module then it should work, yes.

pasqui23 avatar Dec 16 '21 15:12 pasqui23

Can we have a setting to wait until default kde configs are created? Here I set hotkeys in khotkeysrc but expect that default hotkeys are set by kde: https://github.com/kurnevsky/nixfiles/blob/0ba02c1adf544d6f635fe9d5a50046e93fbd4955/modules/kde.nix#L211 If config is created by kwriteconfig5 kde won't set defaults I suppose.

kurnevsky avatar Dec 31 '21 18:12 kurnevsky

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Mar 31 '22 23:03 stale[bot]

Still relevant

Can we have a setting to wait until default kde configs are created? Here I set hotkeys in khotkeysrc but expect that default hotkeys are set by kde: https://github.com/kurnevsky/nixfiles/blob/0ba02c1adf544d6f635fe9d5a50046e93fbd4955/modules/kde.nix#L211 If config is created by kwriteconfig5 kde won't set defaults I suppose.

kwriteconfig modifies the old configs without deleting them,so old configuration would not me modified if not opresent in the nix config

pasqui23 avatar Apr 02 '22 12:04 pasqui23

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Nov 25 '22 00:11 stale[bot]

I've been using this approach in my own configs for a while and it works well. It'd be nice to get this merged at some point.

Is there anything left that needs done?

LunNova avatar Nov 25 '22 17:11 LunNova

@LunNova this pr is for me feature complete, I'm just waiting for review

pasqui23 avatar Nov 27 '22 20:11 pasqui23

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Feb 26 '23 22:02 stale[bot]

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar May 31 '23 22:05 stale[bot]

Going to poke at this to keep it alive.

Prn-Ice avatar Aug 19 '23 11:08 Prn-Ice

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Nov 18 '23 07:11 stale[bot]

Still waiting for the review

pasqui23 avatar Nov 18 '23 22:11 pasqui23

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.
If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

stale[bot] avatar Feb 17 '24 11:02 stale[bot]

I added a minor fixup commit. Please have a look, if it seems fine then I'll squash it and merge.

rycee avatar Feb 18 '24 23:02 rycee

Thanks a lot for your patience and hard work! Finally merged to master now 🙂

rycee avatar Apr 19 '24 16:04 rycee