remove hard-coded layout names
This commit is contained in:
@@ -8,4 +8,18 @@ struct PHConfig: Decodable {
|
||||
case theme, window, layout
|
||||
case monitors = "monitor"
|
||||
}
|
||||
|
||||
var layouts: Set<String> {
|
||||
var layouts = Set<String>()
|
||||
layouts.insert(layout)
|
||||
|
||||
guard let monitors else { return layouts }
|
||||
for monitor in monitors.values {
|
||||
if let layout = monitor.layout {
|
||||
layouts.insert(layout)
|
||||
}
|
||||
}
|
||||
|
||||
return layouts
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import TOML
|
||||
extension PHLayout {
|
||||
/// Load the specified layouts from the resolved config directory (see `PHPaths`).
|
||||
/// If any of theme doesn't exist or fails to parse, the execution is interrupted.
|
||||
static func load(_ layouts: [String]) throws -> [String: PHLayout] {
|
||||
static func load(_ layouts: Set<String>) throws -> [String: PHLayout] {
|
||||
var dictionary = [String: PHLayout]()
|
||||
|
||||
for layout in layouts {
|
||||
@@ -29,8 +29,8 @@ extension PHLayout {
|
||||
Make sure to have a file named `\(layout)` inside the
|
||||
directory: `\(PHPaths.layoutsDirectory.relativePath)`
|
||||
|
||||
Tip: If you've never used phbar before, run the `phbar install` command
|
||||
to automatically generate all the required configuration files.
|
||||
Tip: If you've never used phbar before, run `phbar generate config`
|
||||
to automatically generate the required configuration files.
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user