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
f6fe4f0e
Verified
Commit
f6fe4f0e
authored
May 22, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add safe mode
parent
2df20d57
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
README.md
README.md
+6
-0
config.go
config.go
+12
-0
generate.go
generate.go
+21
-6
No files found.
README.md
View file @
f6fe4f0e
...
...
@@ -29,6 +29,12 @@ Hidden debug command:
ximper-shell-panel generate
```
Safe mode ignores user config, user modules, and user styles:
```
sh
XIMPER_SHELL_SAFEMODE
=
1 ximper-shell-panel restart
```
Supported positions:
```
text
...
...
config.go
View file @
f6fe4f0e
...
...
@@ -7,6 +7,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
)
const
(
...
...
@@ -15,6 +16,7 @@ const (
ModulesFile
=
SystemWaybarDir
+
"/modules.json"
StyleFile
=
SystemWaybarDir
+
"/style.css"
DarkStyleFile
=
SystemWaybarDir
+
"/style-dark.css"
SafeModeEnv
=
"XIMPER_SHELL_SAFEMODE"
)
type
Config
struct
{
...
...
@@ -91,6 +93,16 @@ func UserDarkStylePath() string {
return
filepath
.
Join
(
os
.
Getenv
(
"HOME"
),
".config"
,
"ximper-shell"
,
"panel"
,
"style-dark.css"
)
}
func
SafeMode
()
bool
{
value
:=
strings
.
ToLower
(
strings
.
TrimSpace
(
os
.
Getenv
(
SafeModeEnv
)))
switch
value
{
case
""
,
"0"
,
"false"
,
"no"
,
"off"
:
return
false
default
:
return
true
}
}
func
RuntimeDir
()
string
{
return
filepath
.
Join
(
os
.
TempDir
(),
"ximper-shell"
,
"panel"
)
}
...
...
generate.go
View file @
f6fe4f0e
...
...
@@ -109,26 +109,31 @@ func WriteRuntimeStyles() error {
if
err
:=
os
.
MkdirAll
(
RuntimeWaybarDir
(),
0755
);
err
!=
nil
{
return
err
}
if
err
:=
writeRuntimeStyle
(
RuntimeStylePath
(
"style.css"
),
StyleFile
,
UserStylePath
());
err
!=
nil
{
return
err
}
userStyle
:=
UserStylePath
()
userDarkStyle
:=
UserStylePath
()
if
fileExists
(
UserDarkStylePath
())
{
if
SafeMode
()
{
userStyle
=
""
userDarkStyle
=
""
}
else
if
fileExists
(
UserDarkStylePath
())
{
userDarkStyle
=
UserDarkStylePath
()
}
if
err
:=
writeRuntimeStyle
(
RuntimeStylePath
(
"style.css"
),
StyleFile
,
userStyle
);
err
!=
nil
{
return
err
}
return
writeRuntimeStyle
(
RuntimeStylePath
(
"style-dark.css"
),
DarkStyleFile
,
userDarkStyle
)
}
func
writeRuntimeStyle
(
runtimePath
,
systemPath
,
userPath
string
)
error
{
data
:=
"@import url(
\"
"
+
systemPath
+
"
\"
);
\n
"
if
fileExists
(
userPath
)
{
if
userPath
!=
""
&&
fileExists
(
userPath
)
{
data
+=
"@import url(
\"
"
+
userPath
+
"
\"
);
\n
"
}
return
os
.
WriteFile
(
runtimePath
,
[]
byte
(
data
),
0644
)
}
func
loadInputs
()
(
Config
,
Registry
,
error
)
{
cfg
,
err
:=
LoadConfig
(
UserConfigPath
()
)
cfg
,
err
:=
loadConfig
(
)
if
err
!=
nil
{
return
Config
{},
Registry
{},
err
}
...
...
@@ -140,7 +145,17 @@ func loadInputs() (Config, Registry, error) {
return
cfg
,
registry
,
nil
}
func
loadConfig
()
(
Config
,
error
)
{
if
SafeMode
()
{
return
DefaultConfig
(),
nil
}
return
LoadConfig
(
UserConfigPath
())
}
func
loadRegistry
()
(
Registry
,
error
)
{
if
SafeMode
()
{
return
LoadRegistry
(
ModulesFile
)
}
return
LoadMergedRegistry
(
ModulesFile
,
UserModulesPath
())
}
...
...
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