Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-panel
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
ximper-shell-panel
Commits
45dd72ed
Verified
Commit
45dd72ed
authored
May 22, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add list selectable modules
parent
f6fe4f0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
main.go
main.go
+9
-1
registry.go
registry.go
+51
-0
No files found.
main.go
View file @
45dd72ed
...
@@ -30,6 +30,10 @@ func main() {
...
@@ -30,6 +30,10 @@ func main() {
Value
:
"text"
,
Value
:
"text"
,
Aliases
:
[]
string
{
"o"
},
Aliases
:
[]
string
{
"o"
},
},
},
&
cli
.
BoolFlag
{
Name
:
"all"
,
Usage
:
"show full Waybar module names"
,
},
},
},
},
},
{
{
...
@@ -87,7 +91,11 @@ func listModulesCommand(ctx context.Context, cmd *cli.Command) error {
...
@@ -87,7 +91,11 @@ func listModulesCommand(ctx context.Context, cmd *cli.Command) error {
return
err
return
err
}
}
names
:=
registry
.
Names
()
names
:=
registry
.
SelectableNames
()
if
cmd
.
Bool
(
"all"
)
{
names
=
registry
.
Names
()
}
switch
cmd
.
String
(
"format"
)
{
switch
cmd
.
String
(
"format"
)
{
case
"json"
:
case
"json"
:
data
,
err
:=
json
.
MarshalIndent
(
names
,
""
,
" "
)
data
,
err
:=
json
.
MarshalIndent
(
names
,
""
,
" "
)
...
...
registry.go
View file @
45dd72ed
...
@@ -113,6 +113,19 @@ func (r Registry) Names() []string {
...
@@ -113,6 +113,19 @@ func (r Registry) Names() []string {
return
names
return
names
}
}
func
(
r
Registry
)
SelectableNames
()
[]
string
{
names
:=
make
(
map
[
string
]
struct
{},
len
(
r
.
Modules
))
wm
:=
currentWM
()
for
name
:=
range
r
.
Modules
{
selectableName
:=
selectableModuleName
(
name
,
wm
)
if
selectableName
!=
""
{
names
[
selectableName
]
=
struct
{}{}
}
}
return
sortedKeys
(
names
)
}
func
(
r
Registry
)
Resolve
(
name
,
position
string
)
(
string
,
error
)
{
func
(
r
Registry
)
Resolve
(
name
,
position
string
)
(
string
,
error
)
{
explicit
:=
strings
.
Contains
(
name
,
"/"
)
||
strings
.
Contains
(
name
,
"#"
)
explicit
:=
strings
.
Contains
(
name
,
"/"
)
||
strings
.
Contains
(
name
,
"#"
)
if
explicit
{
if
explicit
{
...
@@ -154,6 +167,44 @@ func (r Registry) Resolve(name, position string) (string, error) {
...
@@ -154,6 +167,44 @@ func (r Registry) Resolve(name, position string) (string, error) {
return
""
,
fmt
.
Errorf
(
"module %q not found"
,
name
)
return
""
,
fmt
.
Errorf
(
"module %q not found"
,
name
)
}
}
func
selectableModuleName
(
name
,
wm
string
)
string
{
namespace
,
base
,
hasNamespace
:=
strings
.
Cut
(
name
,
"/"
)
if
!
hasNamespace
{
return
trimVerticalVariant
(
name
)
}
if
isKnownWM
(
namespace
)
{
if
wm
!=
""
&&
namespace
!=
wm
{
return
""
}
return
trimVerticalVariant
(
base
)
}
return
trimVerticalVariant
(
name
)
}
func
trimVerticalVariant
(
name
string
)
string
{
return
strings
.
TrimSuffix
(
name
,
"#vertical"
)
}
func
isKnownWM
(
name
string
)
bool
{
switch
name
{
case
"hyprland"
,
"niri"
:
return
true
default
:
return
false
}
}
func
sortedKeys
(
values
map
[
string
]
struct
{})
[]
string
{
keys
:=
make
([]
string
,
0
,
len
(
values
))
for
key
:=
range
values
{
keys
=
append
(
keys
,
key
)
}
sort
.
Strings
(
keys
)
return
keys
}
func
(
r
Registry
)
suffixMatches
(
name
string
)
[]
string
{
func
(
r
Registry
)
suffixMatches
(
name
string
)
[]
string
{
suffix
:=
"/"
+
name
suffix
:=
"/"
+
name
var
matches
[]
string
var
matches
[]
string
...
...
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