Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximperconf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximperconf
Commits
6de1ba64
Verified
Commit
6de1ba64
authored
Mar 01, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hyprland/module: rewrite filter system with categories
parent
bcbdfca7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
18 deletions
+63
-18
commands.go
hyprland/commands.go
+8
-9
manager.go
hyprland/manager.go
+55
-9
No files found.
hyprland/commands.go
View file @
6de1ba64
...
...
@@ -71,21 +71,21 @@ func CommandList() *cli.Command {
ArgsUsage
:
"module"
,
Flags
:
[]
cli
.
Flag
{
config
.
FormatFlag
},
Action
:
HyprlandModuleCheckCommand
,
ShellComplete
:
ShellCompleteModule
(
"
all
"
),
ShellComplete
:
ShellCompleteModule
(
""
),
},
{
Name
:
"edit"
,
Usage
:
locale
.
T
(
"Edit module file"
),
ArgsUsage
:
"module"
,
Action
:
HyprlandModuleEditCommand
,
ShellComplete
:
ShellCompleteModule
(
"
all
"
),
ShellComplete
:
ShellCompleteModule
(
""
),
},
{
Name
:
"status"
,
Usage
:
locale
.
T
(
"Hyprland module status"
),
ArgsUsage
:
"module"
,
Action
:
HyprlandModuleStatusCommand
,
ShellComplete
:
ShellCompleteModule
(
"
all
"
),
ShellComplete
:
ShellCompleteModule
(
""
),
},
{
Name
:
"show"
,
...
...
@@ -95,7 +95,7 @@ func CommandList() *cli.Command {
config
.
FormatFlag
,
},
Action
:
HyprlandModuleShowCommand
,
ShellComplete
:
ShellCompleteModule
(
"
all
"
),
ShellComplete
:
ShellCompleteModule
(
""
),
},
{
Name
:
"info"
,
...
...
@@ -103,9 +103,8 @@ func CommandList() *cli.Command {
Flags
:
[]
cli
.
Flag
{
&
cli
.
StringFlag
{
Name
:
"filter"
,
Usage
:
locale
.
T
(
"
status filter
"
),
Usage
:
locale
.
T
(
"
module filter (e.g. status:enabled, type:user, group:themes)
"
),
Aliases
:
[]
string
{
"f"
},
Value
:
"all"
,
},
config
.
FormatFlag
,
},
...
...
@@ -116,7 +115,7 @@ func CommandList() *cli.Command {
Usage
:
locale
.
T
(
"enable module"
),
ArgsUsage
:
"module"
,
Action
:
HyprlandModuleEnableCommand
,
ShellComplete
:
ShellCompleteModule
(
"disabled"
),
ShellComplete
:
ShellCompleteModule
(
"
status:
disabled"
),
},
{
Name
:
"disable"
,
...
...
@@ -131,14 +130,14 @@ func CommandList() *cli.Command {
},
ArgsUsage
:
"module"
,
Action
:
HyprlandModuleDisableCommand
,
ShellComplete
:
ShellCompleteModule
(
"enabled"
),
ShellComplete
:
ShellCompleteModule
(
"
status:
enabled"
),
},
{
Name
:
"toggle"
,
Usage
:
locale
.
T
(
"toggle module"
),
ArgsUsage
:
"module"
,
Action
:
HyprlandToggleModuleCommand
,
ShellComplete
:
ShellCompleteModule
(
"
all
"
),
ShellComplete
:
ShellCompleteModule
(
""
),
},
},
},
...
...
hyprland/manager.go
View file @
6de1ba64
...
...
@@ -358,8 +358,7 @@ func (m *HyprlandManager) GetModulesList(filter string) []HyprModule {
}
}
groupFilter
:=
strings
.
TrimPrefix
(
filter
,
"group:"
)
isGroupFilter
:=
groupFilter
!=
filter
filters
:=
parseModuleFilter
(
filter
)
var
res
[]
HyprModule
for
_
,
module
:=
range
allModules
{
...
...
@@ -369,17 +368,64 @@ func (m *HyprlandManager) GetModulesList(filter string) []HyprModule {
continue
}
if
filter
==
""
||
filter
==
"all"
||
info
.
Status
.
Label
==
filter
||
(
filter
==
"user"
&&
info
.
User
)
||
(
filter
==
"system"
&&
!
info
.
User
)
||
(
isGroupFilter
&&
info
.
Meta
!=
nil
&&
info
.
Meta
.
Group
==
groupFilter
)
{
res
=
append
(
res
,
info
)
if
!
matchModuleFilter
(
info
,
filters
)
{
continue
}
res
=
append
(
res
,
info
)
}
return
res
}
func
parseModuleFilter
(
raw
string
)
map
[
string
]
string
{
filters
:=
make
(
map
[
string
]
string
)
for
_
,
part
:=
range
strings
.
Split
(
raw
,
","
)
{
part
=
strings
.
TrimSpace
(
part
)
if
part
==
""
||
part
==
"all"
{
continue
}
cat
,
val
,
_
:=
strings
.
Cut
(
part
,
":"
)
filters
[
cat
]
=
val
}
return
filters
}
func
matchModuleFilter
(
info
HyprModule
,
filters
map
[
string
]
string
)
bool
{
if
len
(
filters
)
==
0
{
return
true
}
if
v
,
ok
:=
filters
[
"status"
];
ok
{
if
strings
.
HasPrefix
(
v
,
"no"
)
{
if
info
.
Status
.
Label
==
v
[
2
:
]
{
return
false
}
}
else
{
if
info
.
Status
.
Label
!=
v
{
return
false
}
}
}
if
v
,
ok
:=
filters
[
"type"
];
ok
{
if
(
v
==
"user"
)
!=
info
.
User
{
return
false
}
}
if
v
,
ok
:=
filters
[
"group"
];
ok
{
group
:=
""
if
info
.
Meta
!=
nil
{
group
=
info
.
Meta
.
Group
}
if
group
!=
v
{
return
false
}
}
return
true
}
func
(
m
*
HyprlandManager
)
SetModule
(
action
,
module
string
,
onlyNew
bool
)
(
string
,
error
)
{
info
:=
m
.
GetModuleInfo
(
module
)
...
...
@@ -406,7 +452,7 @@ func (m *HyprlandManager) SetModule(action, module string, onlyNew bool) (string
// отключить другие модули той же группы (кросс-типовое)
var
disabledGroup
[]
string
if
info
.
Meta
!=
nil
&&
info
.
Meta
.
Group
!=
""
{
for
_
,
other
:=
range
m
.
GetModulesList
(
"enabled"
)
{
for
_
,
other
:=
range
m
.
GetModulesList
(
"
status:
enabled"
)
{
if
other
.
Name
==
module
{
continue
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment