Skip to content

feat(wrapperModules.quickshell): add option to set component's module#553

Open
ormoyo wants to merge 2 commits into
BirdeeHub:mainfrom
ormoyo:quickshell-wrapper-module
Open

feat(wrapperModules.quickshell): add option to set component's module#553
ormoyo wants to merge 2 commits into
BirdeeHub:mainfrom
ormoyo:quickshell-wrapper-module

Conversation

@ormoyo
Copy link
Copy Markdown
Contributor

@ormoyo ormoyo commented May 23, 2026

Fixes the issue fixed on #552 but in a declarative manner.

Basically, to allow nested components inside sub-directories to be imported with import qs.xxx.xxx.

My extra solution is to add the option components.<name>.module and make components an attrset of specs. (To make no breaking changes)

@ormoyo ormoyo force-pushed the quickshell-wrapper-module branch from 5bc7250 to 5bd3d08 Compare May 23, 2026 19:38
@BirdeeHub
Copy link
Copy Markdown
Owner

BirdeeHub commented May 23, 2026

There are a lot of implications and possible ways to handle this, so give me a moment. I did not know about this either.

I wonder if we can do something recursive with just a bool for "capitalize me" or not? I can look into it too I have been interested in quickshell recently

I do prefer this over the other PR's approach that disables all the stuff

but I wonder what I can cook up if I think about it a bit. If I am drawing a blank, this design seems to address the issue and I am OK with going with it?

Except it is still capitalizing and suffixing .qml in the module case I think so that will need to be fixed

Comment thread wrapperModules/q/quickshell/module.nix Outdated
relPath = makeForce "${config.binName}-config/${capitalizedName}.qml";
relPath = makeForce "${config.binName}-config/${
if val.module != null then "${lib.replaceString "." "/" val.module}/" else ""
}${capitalizedName}.qml";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still doing this capitalize .qml thing in the module case.

@BirdeeHub
Copy link
Copy Markdown
Owner

BirdeeHub commented May 24, 2026

So, I'm somewhat drawing a blank, so, once we fix the autocapitalization thing, I think this is a fine approach, but I am thinking people who already have a quickshell config might not want to worry about all this.

To be fair, they don't have to use this module, they are free to provide a directory to quickshell themselves

{ config, lib, wlib, pkgs, ... }: {
  imports = [ wlib.modules.default ];
  package = pkgs.quickshell;
  flags."--path" = ./mypath;
}

But I anticipate that a good number of people won't really realize how simple that is and will just complain about the lack of an option to just use a dir.

Rather than passing config.generated.placeholder to --path directly, what we could do, is make a configDir option, and make config.generated.placeholder its default value, and pass config.configDir to --path instead. This way we dont have a bunch of conditional logic, the dir will still be generated so people can still include it if they wish from the dir the pass, and such, but people can easily just pass their own dir.

@ormoyo
Copy link
Copy Markdown
Contributor Author

ormoyo commented May 24, 2026

I think your recursive idea fits better. With it, external quickshell components can be imported like: components.external.foo = pkgs.fetchFromGithub { <some repo> }.

It's also more similar to the settings.foo.bar = "zoo" syntax used in most modules here.

My components.<name>.module solution doesn't solve components with the same name (For example, a night clock from import qs.night vs light mode clock from import qs.light).

Even if you deleted that comment, I think it has a lot of merit for the recursive type.

@ormoyo ormoyo force-pushed the quickshell-wrapper-module branch from 5bd3d08 to ef59977 Compare May 24, 2026 07:47
@ormoyo
Copy link
Copy Markdown
Contributor Author

ormoyo commented May 24, 2026

It the meantime, I've disabled auto capitalization for linked components (it's using builtins.baseNameOf now) with the added option components.<name>.name to allow the user to change when needed.

From what I saw, quickshell only imports components with a capital letter, so I kept that for inlined components.

@BirdeeHub
Copy link
Copy Markdown
Owner

BirdeeHub commented May 25, 2026

I went ahead and merged the other PR in the meantime. We should have an option like that, and they fixed up their implementation to be much less impactful on our logic for the option.

The problem I am having, is the recursive type I put there, I deleted because it was awkward to use.

I am thinking of a few different designs instead, which are less ambiguous as to what is a new layer of nesting and what is a value.

@ormoyo
Copy link
Copy Markdown
Contributor Author

ormoyo commented May 25, 2026

For me, what comes to mind is using <module>.freeformType.

I know it's still quite similar to your recursive type but I just don't see how is it worse then the generic settings option for most modules.

I made a commit for it as showcase

@ormoyo ormoyo force-pushed the quickshell-wrapper-module branch from 19f1f72 to 774a7c8 Compare May 26, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants