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
dbee2b25
Verified
Commit
dbee2b25
authored
May 22, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add status command
parent
912b6b8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
5 deletions
+69
-5
README.md
README.md
+2
-0
main.go
main.go
+43
-0
runner.go
runner.go
+24
-5
No files found.
README.md
View file @
dbee2b25
...
...
@@ -19,6 +19,8 @@ user-facing configuration UI is expected to live in `ximperconf shell panel`.
ximper-shell-panel list-modules
ximper-shell-panel list-modules
-o
json
ximper-shell-panel start
ximper-shell-panel status
ximper-shell-panel status
-o
json
ximper-shell-panel stop
ximper-shell-panel toggle
ximper-shell-panel restart
...
...
main.go
View file @
dbee2b25
...
...
@@ -48,6 +48,19 @@ func main() {
Action
:
startCommand
,
},
{
Name
:
"status"
,
Usage
:
"Show panel runtime status"
,
Action
:
statusCommand
,
Flags
:
[]
cli
.
Flag
{
&
cli
.
StringFlag
{
Name
:
"format"
,
Usage
:
"output format (text, json)"
,
Value
:
"text"
,
Aliases
:
[]
string
{
"o"
},
},
},
},
{
Name
:
"stop"
,
Usage
:
"Stop the running panel"
,
Action
:
stopCommand
,
...
...
@@ -131,6 +144,36 @@ func startCommand(ctx context.Context, cmd *cli.Command) error {
return
StartWaybar
()
}
func
statusCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
status
:=
GetPanelStatus
()
switch
cmd
.
String
(
"format"
)
{
case
"json"
:
data
,
err
:=
json
.
MarshalIndent
(
status
,
""
,
" "
)
if
err
!=
nil
{
return
err
}
fmt
.
Println
(
string
(
data
))
case
"text"
:
running
:=
"no"
if
status
.
Running
{
running
=
"yes"
}
fmt
.
Println
(
"Running:"
,
running
)
if
status
.
PID
!=
nil
{
fmt
.
Println
(
"PID:"
,
*
status
.
PID
)
}
fmt
.
Println
(
"Runtime dir:"
,
status
.
RuntimeDir
)
safeMode
:=
"no"
if
status
.
SafeMode
{
safeMode
=
"yes"
}
fmt
.
Println
(
"Safe mode:"
,
safeMode
)
default
:
return
fmt
.
Errorf
(
"unsupported output format %q"
,
cmd
.
String
(
"format"
))
}
return
nil
}
func
stopCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
return
StopWaybar
()
}
...
...
runner.go
View file @
dbee2b25
...
...
@@ -12,6 +12,13 @@ import (
"time"
)
type
PanelStatus
struct
{
Running
bool
`json:"running"`
PID
*
int
`json:"pid"`
RuntimeDir
string
`json:"runtime_dir"`
SafeMode
bool
`json:"safe_mode"`
}
func
StartWaybar
()
error
{
if
PanelIsRunning
()
{
return
nil
...
...
@@ -65,15 +72,27 @@ func RestartWaybar() error {
}
func
PanelIsRunning
()
bool
{
return
GetPanelStatus
()
.
Running
}
func
GetPanelStatus
()
PanelStatus
{
status
:=
PanelStatus
{
RuntimeDir
:
RuntimeDir
(),
SafeMode
:
SafeMode
(),
}
pid
,
err
:=
readPID
()
if
err
!=
nil
{
return
false
return
status
}
if
isPanelProcess
(
pid
)
{
return
true
if
!
isPanelProcess
(
pid
)
{
_
=
os
.
Remove
(
RuntimePIDPath
())
return
status
}
_
=
os
.
Remove
(
RuntimePIDPath
())
return
false
status
.
Running
=
true
status
.
PID
=
&
pid
return
status
}
func
stopWaybar
()
error
{
...
...
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