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
982051be
Verified
Commit
982051be
authored
Aug 25, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the output style
parent
f079c7dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
13 deletions
+80
-13
actions.go
hyprland/actions.go
+36
-8
commands.go
hyprland/commands.go
+11
-3
var-actions.go
hyprland/var-actions.go
+33
-2
No files found.
hyprland/actions.go
View file @
982051be
...
...
@@ -187,7 +187,7 @@ func HyprlandToggleModuleCommand(ctx context.Context, cmd *cli.Command) error {
return
nil
}
func
hyprlandListModules
(
user
bool
,
filter
string
)
{
func
hyprlandListModules
(
user
bool
,
filter
string
)
[]
string
{
var
dir
string
if
user
{
dir
=
config
.
Env
.
Hyprland
.
UserModulesDir
...
...
@@ -196,8 +196,7 @@ func hyprlandListModules(user bool, filter string) {
}
entries
,
err
:=
os
.
ReadDir
(
dir
)
if
err
!=
nil
{
fmt
.
Printf
(
"Каталог с модулями не найден: %s"
,
dir
)
return
return
nil
}
skip
:=
map
[
string
]
bool
{
"hyprland"
:
true
,
"hypridle"
:
true
,
...
...
@@ -205,6 +204,7 @@ func hyprlandListModules(user bool, filter string) {
"hyprsunset"
:
true
,
"xdph"
:
true
,
}
var
modules
[]
string
for
_
,
e
:=
range
entries
{
if
e
.
IsDir
()
||
!
strings
.
HasSuffix
(
e
.
Name
(),
".conf"
)
{
continue
...
...
@@ -220,18 +220,46 @@ func hyprlandListModules(user bool, filter string) {
if
filter
==
"disabled"
&&
status
!=
"disabled"
{
continue
}
modules
=
append
(
modules
,
module
)
}
return
modules
}
func
hyprlandInfoModules
(
user
bool
,
filter
string
)
{
modules
:=
hyprlandListModules
(
user
,
filter
)
if
len
(
modules
)
==
0
{
color
.
Red
(
"Нет доступных модулей"
)
return
}
color
.
Blue
(
"Modules:"
)
for
i
,
module
:=
range
modules
{
status
:=
hyprlandModuleStatus
(
module
,
user
)
coloredStatus
:=
""
coloredModule
:=
""
switch
status
{
case
"enabled"
:
color
.
Green
(
module
)
coloredStatus
=
color
.
GreenString
(
"●"
)
coloredModule
=
color
.
GreenString
(
module
)
case
"disabled"
:
color
.
Yellow
(
module
)
coloredStatus
=
color
.
RedString
(
"○"
)
coloredModule
=
color
.
RedString
(
module
)
default
:
color
.
Red
(
module
)
coloredStatus
=
color
.
HiBlackString
(
"○"
)
coloredModule
=
color
.
HiBlackString
(
module
)
}
prefix
:=
"├──"
if
i
==
len
(
modules
)
-
1
{
prefix
=
"└──"
}
fmt
.
Printf
(
"%s %s %s
\n
"
,
prefix
,
coloredStatus
,
coloredModule
)
}
}
func
Hyprland
List
ModulesCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
hyprland
ListModules
(
cmd
.
Bool
(
"user"
),
"all"
)
func
Hyprland
Info
ModulesCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
hyprland
InfoModules
(
cmd
.
Bool
(
"user"
),
cmd
.
String
(
"filter"
)
)
return
nil
}
hyprland/commands.go
View file @
982051be
...
...
@@ -36,9 +36,17 @@ func CommandList() *cli.Command {
Action
:
HyprlandModuleStatusCommand
,
},
{
Name
:
"list"
,
Usage
:
"list modules"
,
Action
:
HyprlandListModulesCommand
,
Name
:
"info"
,
Usage
:
"Information about modules"
,
Flags
:
[]
cli
.
Flag
{
&
cli
.
StringFlag
{
Name
:
"filter"
,
Usage
:
"status filter"
,
Aliases
:
[]
string
{
"f"
},
Value
:
"all"
,
},
},
Action
:
HyprlandInfoModulesCommand
,
},
{
Name
:
"enable"
,
...
...
hyprland/var-actions.go
View file @
982051be
...
...
@@ -2,6 +2,7 @@ package hyprland
import
(
"context"
"sort"
"ximperconf/config"
"bufio"
...
...
@@ -80,9 +81,39 @@ func hyprlandVarInfo() (map[string]string, error) {
func
HyprlandVarInfoCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
info
,
_
:=
hyprlandVarInfo
()
for
k
,
v
:=
range
info
{
fmt
.
Printf
(
"%s = %s
\n
"
,
k
,
v
)
if
len
(
info
)
==
0
{
color
.
Yellow
(
"Нет переменных в конфигурации"
)
return
nil
}
color
.
Blue
(
"Vars:"
)
keys
:=
make
([]
string
,
0
,
len
(
info
))
for
k
:=
range
info
{
keys
=
append
(
keys
,
k
)
}
sort
.
Strings
(
keys
)
for
i
,
k
:=
range
keys
{
prefix
:=
"├──"
if
i
==
len
(
keys
)
-
1
{
prefix
=
"└──"
}
v
:=
info
[
k
]
fmt
.
Printf
(
"%s %s: %s
\n
"
,
prefix
,
color
.
YellowString
(
k
),
func
()
string
{
if
v
==
""
{
return
color
.
HiBlackString
(
"<empty>"
)
}
return
color
.
GreenString
(
v
)
}(),
)
}
return
nil
}
...
...
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