mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 08:52:49 -05:00
plugins: improve version check
This commit is contained in:
@@ -153,7 +153,7 @@ func (f *FedoraDistribution) getDmsMapping(variant deps.PackageVariant) PackageM
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *FedoraDistribution) getHyprlandMapping(_ deps.PackageVariant) PackageMapping {
|
func (f *FedoraDistribution) getHyprlandMapping(_ deps.PackageVariant) PackageMapping {
|
||||||
return PackageMapping{Name: "hyprland", Repository: RepoTypeCOPR, RepoURL: "solopasha/hyprland"}
|
return PackageMapping{Name: "hyprland", Repository: RepoTypeCOPR, RepoURL: "sdegler/hyprland"}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FedoraDistribution) getNiriMapping(variant deps.PackageVariant) PackageMapping {
|
func (f *FedoraDistribution) getNiriMapping(variant deps.PackageVariant) PackageMapping {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type Plugin struct {
|
|||||||
Compositors []string `json:"compositors"`
|
Compositors []string `json:"compositors"`
|
||||||
Distro []string `json:"distro"`
|
Distro []string `json:"distro"`
|
||||||
Screenshot string `json:"screenshot,omitempty"`
|
Screenshot string `json:"screenshot,omitempty"`
|
||||||
|
RequiresDMS string `json:"requires_dms,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitClient interface {
|
type GitClient interface {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ func HandleList(conn net.Conn, req models.Request) {
|
|||||||
Dependencies: p.Dependencies,
|
Dependencies: p.Dependencies,
|
||||||
Installed: installed,
|
Installed: installed,
|
||||||
FirstParty: strings.HasPrefix(p.Repo, "https://github.com/AvengeMedia"),
|
FirstParty: strings.HasPrefix(p.Repo, "https://github.com/AvengeMedia"),
|
||||||
|
RequiresDMS: p.RequiresDMS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ func HandleListInstalled(conn net.Conn, req models.Request) {
|
|||||||
Dependencies: plugin.Dependencies,
|
Dependencies: plugin.Dependencies,
|
||||||
FirstParty: strings.HasPrefix(plugin.Repo, "https://github.com/AvengeMedia"),
|
FirstParty: strings.HasPrefix(plugin.Repo, "https://github.com/AvengeMedia"),
|
||||||
HasUpdate: hasUpdate,
|
HasUpdate: hasUpdate,
|
||||||
|
RequiresDMS: plugin.RequiresDMS,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
result = append(result, PluginInfo{
|
result = append(result, PluginInfo{
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ func HandleSearch(conn net.Conn, req models.Request) {
|
|||||||
Dependencies: p.Dependencies,
|
Dependencies: p.Dependencies,
|
||||||
Installed: installed,
|
Installed: installed,
|
||||||
FirstParty: strings.HasPrefix(p.Repo, "https://github.com/AvengeMedia"),
|
FirstParty: strings.HasPrefix(p.Repo, "https://github.com/AvengeMedia"),
|
||||||
|
RequiresDMS: p.RequiresDMS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ type PluginInfo struct {
|
|||||||
FirstParty bool `json:"firstParty,omitempty"`
|
FirstParty bool `json:"firstParty,omitempty"`
|
||||||
Note string `json:"note,omitempty"`
|
Note string `json:"note,omitempty"`
|
||||||
HasUpdate bool `json:"hasUpdate,omitempty"`
|
HasUpdate bool `json:"hasUpdate,omitempty"`
|
||||||
|
RequiresDMS string `json:"requires_dms,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuccessResult struct {
|
type SuccessResult struct {
|
||||||
|
|||||||
@@ -409,6 +409,7 @@ FloatingWindow {
|
|||||||
property bool isSelected: root.keyboardNavigationActive && index === root.selectedIndex
|
property bool isSelected: root.keyboardNavigationActive && index === root.selectedIndex
|
||||||
property bool isInstalled: modelData.installed || false
|
property bool isInstalled: modelData.installed || false
|
||||||
property bool isFirstParty: modelData.firstParty || false
|
property bool isFirstParty: modelData.firstParty || false
|
||||||
|
property bool isCompatible: PluginService.checkPluginCompatibility(modelData.requires_dms)
|
||||||
color: isSelected ? Theme.primarySelected : Theme.withAlpha(Theme.surfaceVariant, 0.3)
|
color: isSelected ? Theme.primarySelected : Theme.withAlpha(Theme.surfaceVariant, 0.3)
|
||||||
border.color: isSelected ? Theme.primary : Theme.withAlpha(Theme.outline, 0.2)
|
border.color: isSelected ? Theme.primary : Theme.withAlpha(Theme.outline, 0.2)
|
||||||
border.width: isSelected ? 2 : 1
|
border.width: isSelected ? 2 : 1
|
||||||
@@ -512,14 +513,32 @@ FloatingWindow {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: installButton
|
id: installButton
|
||||||
width: 80
|
|
||||||
|
property string buttonState: {
|
||||||
|
if (isInstalled)
|
||||||
|
return "installed";
|
||||||
|
if (!isCompatible)
|
||||||
|
return "incompatible";
|
||||||
|
return "available";
|
||||||
|
}
|
||||||
|
|
||||||
|
width: buttonState === "incompatible" ? incompatRow.implicitWidth + Theme.spacingM * 2 : 80
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: isInstalled ? Theme.surfaceVariant : Theme.primary
|
color: {
|
||||||
opacity: isInstalled ? 1 : (installMouseArea.containsMouse ? 0.9 : 1)
|
switch (buttonState) {
|
||||||
border.width: isInstalled ? 1 : 0
|
case "installed":
|
||||||
border.color: Theme.outline
|
return Theme.surfaceVariant;
|
||||||
|
case "incompatible":
|
||||||
|
return Theme.withAlpha(Theme.warning, 0.15);
|
||||||
|
default:
|
||||||
|
return Theme.primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
opacity: buttonState === "available" && installMouseArea.containsMouse ? 0.9 : 1
|
||||||
|
border.width: buttonState !== "available" ? 1 : 0
|
||||||
|
border.color: buttonState === "incompatible" ? Theme.warning : Theme.outline
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
@@ -529,21 +548,58 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
id: incompatRow
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: isInstalled ? "check" : "download"
|
name: {
|
||||||
|
switch (installButton.buttonState) {
|
||||||
|
case "installed":
|
||||||
|
return "check";
|
||||||
|
case "incompatible":
|
||||||
|
return "warning";
|
||||||
|
default:
|
||||||
|
return "download";
|
||||||
|
}
|
||||||
|
}
|
||||||
size: 14
|
size: 14
|
||||||
color: isInstalled ? Theme.surfaceText : Theme.surface
|
color: {
|
||||||
|
switch (installButton.buttonState) {
|
||||||
|
case "installed":
|
||||||
|
return Theme.surfaceText;
|
||||||
|
case "incompatible":
|
||||||
|
return Theme.warning;
|
||||||
|
default:
|
||||||
|
return Theme.surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: isInstalled ? I18n.tr("Installed", "installed status") : I18n.tr("Install", "install action button")
|
text: {
|
||||||
|
switch (installButton.buttonState) {
|
||||||
|
case "installed":
|
||||||
|
return I18n.tr("Installed", "installed status");
|
||||||
|
case "incompatible":
|
||||||
|
return I18n.tr("Requires %1", "version requirement").arg(modelData.requires_dms);
|
||||||
|
default:
|
||||||
|
return I18n.tr("Install", "install action button");
|
||||||
|
}
|
||||||
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: isInstalled ? Theme.surfaceText : Theme.surface
|
color: {
|
||||||
|
switch (installButton.buttonState) {
|
||||||
|
case "installed":
|
||||||
|
return Theme.surfaceText;
|
||||||
|
case "incompatible":
|
||||||
|
return Theme.warning;
|
||||||
|
default:
|
||||||
|
return Theme.surface;
|
||||||
|
}
|
||||||
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,11 +608,9 @@ FloatingWindow {
|
|||||||
id: installMouseArea
|
id: installMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: isInstalled ? Qt.ArrowCursor : Qt.PointingHandCursor
|
cursorShape: installButton.buttonState === "available" ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
enabled: !isInstalled
|
enabled: installButton.buttonState === "available"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (isInstalled)
|
|
||||||
return;
|
|
||||||
const isDesktop = modelData.type === "desktop";
|
const isDesktop = modelData.type === "desktop";
|
||||||
root.installPlugin(modelData.name, isDesktop);
|
root.installPlugin(modelData.name, isDesktop);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user