mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-10 07:28:30 -04:00
core: some fixes for embedded distribution, VERSION file, matugen
scripts, and embed scripts
This commit is contained in:
+11
-5
@@ -38,17 +38,23 @@ endif
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
# Copy the quickshell UI into the embed dir (gitignored) so tagged builds
|
# Copy the quickshell UI into the embed dir (gitignored) so tagged builds
|
||||||
# can bake it into the binary. Dev-only files are stripped. tar -h dereferences
|
# can bake it into the binary. Dev-only files are stripped; scripts/ is kept
|
||||||
# the DankCommon submodule symlink; go:embed rejects symlinks. .qmlls.ini is
|
# minus its dev entries, since Theme.qml and BluetoothService.qml run
|
||||||
# excluded at copy time: it's a symlink into the quickshell runtime VFS and
|
# gtk.sh/qt.sh/bluez-card-profile.lua out of the resolved shell dir.
|
||||||
# dereferencing it fails whenever the shell isn't running.
|
# tar -h dereferences the DankCommon submodule symlink; go:embed rejects
|
||||||
|
# symlinks. .qmlls.ini is excluded at copy time: it's a symlink into the
|
||||||
|
# quickshell runtime VFS and dereferencing it fails whenever the shell isn't
|
||||||
|
# running.
|
||||||
sync-shell:
|
sync-shell:
|
||||||
@test -e $(SHELL_SRC)/DankCommon/Widgets/DankIcon.qml || { echo "DankCommon missing: run git submodule update --init"; exit 1; }
|
@test -e $(SHELL_SRC)/DankCommon/Widgets/DankIcon.qml || { echo "DankCommon missing: run git submodule update --init"; exit 1; }
|
||||||
@rm -rf $(EMBED_DIR)
|
@rm -rf $(EMBED_DIR)
|
||||||
@mkdir -p $(EMBED_DIR)
|
@mkdir -p $(EMBED_DIR)
|
||||||
@tar -C $(SHELL_SRC) --exclude=.qmlls.ini -chf - . | tar -C $(EMBED_DIR) -xf -
|
@tar -C $(SHELL_SRC) --exclude=.qmlls.ini -chf - . | tar -C $(EMBED_DIR) -xf -
|
||||||
@rm -rf $(EMBED_DIR)/scripts $(EMBED_DIR)/.claude $(EMBED_DIR)/.git* $(EMBED_DIR)/.github
|
@rm -rf $(EMBED_DIR)/.git* $(EMBED_DIR)/.github
|
||||||
|
@find $(EMBED_DIR) -type d \( -name .claude -o -name .vscode \) -prune -exec rm -rf {} +
|
||||||
@rm -f $(EMBED_DIR)/AGENTS.md $(EMBED_DIR)/qmlformat-all.sh
|
@rm -f $(EMBED_DIR)/AGENTS.md $(EMBED_DIR)/qmlformat-all.sh
|
||||||
|
@rm -f $(EMBED_DIR)/scripts/i18nsync.py $(EMBED_DIR)/scripts/build-vscode-vsix.sh $(EMBED_DIR)/scripts/qmllint-entrypoints.sh
|
||||||
|
@rm -f $(EMBED_DIR)/scripts/spam-notifications.sh $(EMBED_DIR)/scripts/verify-notifications.sh
|
||||||
@rm -f $(EMBED_DIR)/translations/*.py $(EMBED_DIR)/translations/WORKFLOW.md
|
@rm -f $(EMBED_DIR)/translations/*.py $(EMBED_DIR)/translations/WORKFLOW.md
|
||||||
@cd $(EMBED_DIR) && find . -type f -print0 | LC_ALL=C sort -z | xargs -0 sha256sum | sha256sum | cut -c1-16 > .dankrev
|
@cd $(EMBED_DIR) && find . -type f -print0 | LC_ALL=C sort -z | xargs -0 sha256sum | sha256sum | cut -c1-16 > .dankrev
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
||||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/plugins"
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/plugins"
|
||||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/server"
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/server"
|
||||||
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/shellembed"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -206,29 +207,41 @@ func formatVersion(version string) string {
|
|||||||
return fmt.Sprintf("dms %s", version)
|
return fmt.Sprintf("dms %s", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var baseVersionRe = regexp.MustCompile(`^([\d.]+)`)
|
||||||
|
|
||||||
|
// Installed UI trees, for builds without an embedded UI.
|
||||||
|
var shellVersionPaths = []string{
|
||||||
|
"/usr/share/quickshell/dms/VERSION",
|
||||||
|
"/usr/local/share/quickshell/dms/VERSION",
|
||||||
|
"/etc/xdg/quickshell/dms/VERSION",
|
||||||
|
}
|
||||||
|
|
||||||
func getBaseVersion() string {
|
func getBaseVersion() string {
|
||||||
paths := []string{
|
if ver := parseBaseVersion(shellembed.Version()); ver != "" {
|
||||||
"/usr/share/quickshell/dms/VERSION",
|
return ver
|
||||||
"/usr/local/share/quickshell/dms/VERSION",
|
|
||||||
"/etc/xdg/quickshell/dms/VERSION",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, path := range paths {
|
for _, path := range shellVersionPaths {
|
||||||
if content, err := os.ReadFile(path); err == nil {
|
content, err := os.ReadFile(path)
|
||||||
ver := strings.TrimSpace(string(content))
|
if err != nil {
|
||||||
ver = strings.TrimPrefix(ver, "v")
|
continue
|
||||||
if re := regexp.MustCompile(`^([\d.]+)`); re.MatchString(ver) {
|
}
|
||||||
if matches := re.FindStringSubmatch(ver); matches != nil {
|
if ver := parseBaseVersion(string(content)); ver != "" {
|
||||||
return matches[1]
|
return ver
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback
|
|
||||||
return "1.0.2"
|
return "1.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseBaseVersion(raw string) string {
|
||||||
|
matches := baseVersionRe.FindStringSubmatch(strings.TrimPrefix(strings.TrimSpace(raw), "v"))
|
||||||
|
if matches == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return matches[1]
|
||||||
|
}
|
||||||
|
|
||||||
func startDebugServer() error {
|
func startDebugServer() error {
|
||||||
server.CLIVersion = Version
|
server.CLIVersion = Version
|
||||||
return server.Start(true)
|
return server.Start(true)
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ package shellembed
|
|||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/AvengeMedia/dankgo/shellapp/shellfs"
|
"github.com/AvengeMedia/dankgo/shellapp/shellfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
distRoot = "dist"
|
distRoot = "dist"
|
||||||
shellEntry = "shell.qml"
|
shellEntry = "shell.qml"
|
||||||
|
versionFile = "VERSION"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Available reports whether this binary was built with the embedded UI
|
// Available reports whether this binary was built with the embedded UI
|
||||||
@@ -23,6 +25,15 @@ func Available() bool {
|
|||||||
return err == nil && !info.IsDir()
|
return err == nil && !info.IsDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Version reports the embedded UI's VERSION, empty when unavailable.
|
||||||
|
func Version() string {
|
||||||
|
data, err := fs.ReadFile(distFS, path.Join(distRoot, versionFile))
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(string(data))
|
||||||
|
}
|
||||||
|
|
||||||
func Extract(baseDir string) (string, error) {
|
func Extract(baseDir string) (string, error) {
|
||||||
sub, err := fs.Sub(distFS, distRoot)
|
sub, err := fs.Sub(distFS, distRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -142,7 +142,9 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Quickshell.execDetached(["mkdir", "-p", stateDir]);
|
Quickshell.execDetached(["mkdir", "-p", stateDir]);
|
||||||
Quickshell.execDetached([shellDir + "/scripts/gtk.sh", configDir, "", shellDir, "assets-only"]);
|
// shellDir may be an embedded-UI extraction, which is read-only and
|
||||||
|
// unexecutable (dankgo shellapp/shellfs makeReadOnly chmods 0444)
|
||||||
|
Quickshell.execDetached(["bash", shellDir + "/scripts/gtk.sh", configDir, "", shellDir, "assets-only"]);
|
||||||
Proc.runCommand("matugenCheck", ["sh", "-c", "command -v matugen"], (output, code) => {
|
Proc.runCommand("matugenCheck", ["sh", "-c", "command -v matugen"], (output, code) => {
|
||||||
matugenAvailable = (code === 0) && !envDisableMatugen;
|
matugenAvailable = (code === 0) && !envDisableMatugen;
|
||||||
|
|
||||||
@@ -1933,7 +1935,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
||||||
Proc.runCommand("gtkApplier", [shellDir + "/scripts/gtk.sh", configDir, isLight, shellDir], (output, exitCode) => {
|
Proc.runCommand("gtkApplier", ["bash", shellDir + "/scripts/gtk.sh", configDir, isLight, shellDir], (output, exitCode) => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) {
|
if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) {
|
||||||
ToastService.showInfo(I18n.tr("GTK colors applied successfully"));
|
ToastService.showInfo(I18n.tr("GTK colors applied successfully"));
|
||||||
@@ -1954,7 +1956,7 @@ Singleton {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Proc.runCommand("qtApplier", [shellDir + "/scripts/qt.sh", configDir], (output, exitCode) => {
|
Proc.runCommand("qtApplier", ["bash", shellDir + "/scripts/qt.sh", configDir], (output, exitCode) => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
if (typeof ToastService !== "undefined") {
|
if (typeof ToastService !== "undefined") {
|
||||||
ToastService.showInfo(I18n.tr("Qt colors applied successfully"));
|
ToastService.showInfo(I18n.tr("Qt colors applied successfully"));
|
||||||
|
|||||||
Reference in New Issue
Block a user