Skip to content

Commit

Permalink
Add openSoftwareCenter Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean 28518 committed Mar 16, 2024
1 parent 754e73d commit da9b04b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions features.csv
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ makeCurrentUserToAdministrator,?,yes,yes,yes,yes,yes,yes,yes,yes,?,yes,yes,yes,y
setupSnapAndInstallSnapStore,?,yes,yes,yes,yes,yes,yes,yes,yes,no,yes,yes,?,?,-,-,-,-,
Commands in Searchbar,?,-,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,yes,yes,
AutomaticRepairOfPackageManager,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,no,no,no,-,-,-,-,
openSoftwareCenter,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
12 changes: 11 additions & 1 deletion lib/content/basic_entries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ List<ActionEntry> getBasicEntries(BuildContext context) {
disableEntryIf: () {
return Linux.hasCurrentUserAdministratorRights();
},
)
),
ActionEntry(
name: AppLocalizations.of(context)!.openSoftwareCenter,
description: AppLocalizations.of(context)!.openSoftwareCenterDescription,
action: "open_software_center",
iconWidget: Icon(
Icons.store,
size: 48,
color: MintY.currentColor,
),
),
];
}
2 changes: 2 additions & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@
"makeAdministrator": "Aktuellen Benutzer zum Administrator machen",
"makeAdministratorDescription": "Füge den aktuellen Benutzer zur Gruppe 'sudo' hinzu, um Root-Rechte zu erhalten. Dafür ist das Passwort des Root-Benutzers nötig.\nDanach ist ein Neustart des Rechners empfohlen.",
"yayInstalled": "Es wurde Yay gefunden. Yay ist ein AUR-Helper, der Dir das Installieren von AUR-Paketen erleichtert. Das AUR ist ein Community-Repository, in dem viele Pakete von der Community gepflegt werden und eventuell schädlich sein könnten.",
"openSoftwareCenter": "Öffne Software-Center",
"openSoftwareCenterDescription": "Öffne das Software-Center, um weitere Anwendungen/Apps zu installieren.",
"@helloWorld": {
"placeholders": {},
"description": "",
Expand Down
2 changes: 2 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@
"makeAdministrator": "Make the current user an administrator",
"makeAdministratorDescription": "Add the current user to the 'sudo' group to obtain root rights. The password of the root user is required for this.\nAfterwards a restart of the computer is recommended.",
"yayInstalled": "Yay was found. Yay is an AUR helper that makes it easier for you to install AUR packages. The AUR is a community repository where many packages are maintained by the community and could be potentially harmful.",
"openSoftwareCenter": "Open Software Center",
"openSoftwareCenterDescription": "Open the Software Center to install additional applications/apps.",
"@helloWorld": {
"placeholders": {},
"description": "The conventional newborn programmer greeting",
Expand Down
5 changes: 5 additions & 0 deletions lib/services/action_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -413,5 +413,10 @@ class ActionHandler {
if (actionEntry.action.startsWith("make_administrator")) {
Linux.makeCurrentUserToAdministrator(context);
}

if (actionEntry.action.startsWith("open_software_center")) {
Linux.openSoftwareCenter(context);
callback();
}
}
}
35 changes: 35 additions & 0 deletions lib/services/linux.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2695,4 +2695,39 @@ class Linux {
route: MainSearchLoader()),
));
}

static Future<void> openSoftwareCenter(context) async {
switch (currentenvironment.distribution) {
case DISTROS.LINUX_MINT:
case DISTROS.LMDE:
runCommand("/usr/bin/mintinstall");
break;
case DISTROS.UBUNTU:
case DISTROS.ZORINOS:
case DISTROS.POPOS:
runCommand("/usr/bin/gnome-software");
break;
case DISTROS.FEDORA:
runCommand("/usr/bin/gnome-software");
break;
case DISTROS.OPENSUSE:
if (currentenvironment.desktop == DESKTOPS.KDE) {
runCommand("/usr/bin/plasma-discover");
} else {
runCommand("/usr/bin/gnome-software");
}
break;
case DISTROS.MXLINUX:
runCommand("/usr/bin/mx-packageinstaller");
break;
case DISTROS.KDENEON:
runCommand("/usr/bin/plasma-discover");
break;
case DISTROS.DEBIAN:
runCommand("/usr/bin/synaptic");
break;
default:
runCommand("/usr/bin/gnome-software");
}
}
}

0 comments on commit da9b04b

Please sign in to comment.