Skip to content

Commit

Permalink
[SpicesUpdate@claudiux] v7.4.7: Now compatible with Cinnamon on Gentoo (
Browse files Browse the repository at this point in the history
#6741)

* v7.4.7: Now compatible with Cinnamon on Gentoo

* v7.4.7: Let the user enter commands when dependencies are missing

* v7.4.7: Updates CHANGELOG
  • Loading branch information
claudiux authored Jan 5, 2025
1 parent 6bdead2 commit b291237
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 22 deletions.
70 changes: 51 additions & 19 deletions SpicesUpdate@claudiux/files/SpicesUpdate@claudiux/6.0/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ class SpicesUpdate extends IconApplet {
file_new_for_path("/usr/share/fonts/TTF/Symbola.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/truetype/Symbola.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/gdouros-symbola/Symbola.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/ttf-ancient-fonts/Symbola_hint.ttf").query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola_Hinted.ttf".format(HOME_DIR)).query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola.ttf".format(HOME_DIR)).query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola.otf".format(HOME_DIR)).query_exists(null);
Expand All @@ -1216,7 +1217,9 @@ class SpicesUpdate extends IconApplet {
let _isArchlinux = _ArchlinuxWitnessFile.query_exists(null);
let _openSUSEWitnessFile = file_new_for_path("/usr/share/licenses/openSUSE-release");
let _isopenSUSE = _openSUSEWitnessFile.query_exists(null);
if (_isArchlinux || _isopenSUSE) {
let _GentoWitnessFile = file_new_for_path("/etc/gentoo-release"); // Gentoo
let _isGentoo = _GentoWitnessFile.query_exists(null);
if (_isArchlinux || _isopenSUSE || _isGentoo) {
Util.spawnCommandLineAsync("/bin/sh -c \"%s/install_symbola_on_Arch.sh\"".format(SCRIPTS_DIR), null, null);
_fonts_installed = true
}
Expand All @@ -1227,19 +1230,43 @@ class SpicesUpdate extends IconApplet {
} // End of are_dependencies_installed

get_terminal() {
let _SETTINGS_SCHEMA = "org.cinnamon.desktop.default-applications.terminal";
let _SETTINGS_KEY = "exec";
let gsettings = new Settings({ schema_id: _SETTINGS_SCHEMA });
var term_found = "";
var _terminals = ["gnome-terminal", "tilix", "konsole", "guake", "qterminal", "terminator", "uxterm", "xterm"];
var t;
let _terminals_length = _terminals.length;
for (t=0; t < _terminals_length ; t++) {
if (find_program_in_path(_terminals[t])) {
term_found = find_program_in_path(_terminals[t]);
break
term_found = gsettings.get_string(_SETTINGS_KEY);
if (term_found.length === 0) {
var _terminals = ["gnome-terminal", "tilix", "konsole", "guake", "qterminal", "terminator", "uxterm", "xterm"];
var t;
let _terminals_length = _terminals.length;
for (t=0; t < _terminals_length ; t++) {
if (find_program_in_path(_terminals[t])) {
term_found = find_program_in_path(_terminals[t]);
break
}
}
}
return term_found;
} // End of get_terminal

get_terminal_separator() {
let _SETTINGS_SCHEMA = "org.cinnamon.desktop.default-applications.terminal";
let _SETTINGS_KEY = "exec-arg";
let gsettings = new Settings({ schema_id: _SETTINGS_SCHEMA });
var sep_found = "";
sep_found = gsettings.get_string(_SETTINGS_KEY);
if (sep_found.length === 0) {
const _terminals_with_double_dashes = ["gnome-terminal"];
const _terminals_with_e = ["tilix", "konsole", "guake", "qterminal", "terminator", "uxterm", "xterm"];
let terminal = this.get_terminal();
if (_terminals_with_double_dashes.indexOf(terminal) > -1)
return "--";
if (_terminals_with_e.indexOf(terminal) > -1)
return "-e";
}
return sep_found;
} // End of get_terminal_separator

check_dependencies() {
if (!this.dependenciesMet && this.are_dependencies_installed()) {
// At this time, the user just finished to install all dependencies.
Expand All @@ -1266,8 +1293,9 @@ class SpicesUpdate extends IconApplet {
icon_size: 36 });
// Got a terminal used on this system:
let terminal = this.get_terminal();
// apturl is it present?
let _is_apturl_present = find_program_in_path("apturl");
let term_sep = this.get_terminal_separator();
// xdg-open is it present?
let _is_xdg_open_present = find_program_in_path("xdg-open");
// Detects the distrib in use and make adapted message and notification:
let _isFedora = find_program_in_path("dnf");
let _ArchlinuxWitnessFile = file_new_for_path("/etc/arch-release");
Expand All @@ -1281,22 +1309,26 @@ class SpicesUpdate extends IconApplet {
//var _apt_install = _isFedora ? "sudo dnf install libnotify gdouros-symbola-fonts" : _isArchlinux ? "sudo pacman -Syu libnotify" : _isDebian ? "apt install fonts-symbola" : "sudo apt install fonts-symbola";
var _apt_install = _isFedora ? "sudo dnf install gdouros-symbola-fonts" : _isArchlinux ? "" : _isDebian ? "apt install fonts-symbola" : _isopenSUSE ? "sudo yast2 --install gdouros-symbola-fonts" : "sudo apt install fonts-symbola";
let criticalMessagePart1 = _("You appear to be missing some of the programs required for this applet to have all its features.");
let criticalMessage = _is_apturl_present ? criticalMessagePart1 : criticalMessagePart1+"\n\n"+_("Please execute, in the just opened terminal, the commands:")+"\n "+ _apt_update +" \n "+ _apt_install +"\n\n";
let criticalMessage = _is_xdg_open_present ? criticalMessagePart1 : criticalMessagePart1+"\n\n"+_("Please execute, in the just opened terminal, the commands:")+"\n "+ _apt_update +" \n "+ _apt_install +"\n\n";
this.notification = criticalNotify(_("Some dependencies are not installed!"), criticalMessage, icon);

if (!_is_apturl_present) {
if (terminal != "") {
if (!_is_xdg_open_present) {
if (terminal.length > 0) {
Util.spawnCommandLineAsync(terminal);
// TRANSLATORS: The next messages should not be translated.
if (_isDebian === true) {
Util.spawnCommandLineAsync(terminal + " -e '/bin/sh -c \"echo Spices Update message: Some packages needed!; echo To complete the installation, please become root with su then execute the command: ; echo "+ _apt_update + _and + _apt_install + "; sleep 1; exec bash\"'", null, null);
} else {
Util.spawnCommandLineAsync(terminal + " -e '/bin/sh -c \"echo Spices Update message: Some packages needed!; echo To complete the installation, please enter and execute the command: ; echo "+ _apt_update + _and + _apt_install + "; sleep 1; exec bash\"'", null, null);
}
//~ if (_isDebian === true) {
//~ Util.spawnCommandLineAsync(terminal + " " + term_sep + " " + " '/bin/bash -c \"echo Spices Update message: Some packages needed!; echo To complete the installation, please become root with su then execute the command: ; echo "+ _apt_update + _and + _apt_install + "; sleep 1; exec bash\"'", null, null);
//~ } else {
//~ Util.spawnCommandLineAsync(terminal + " " + term_sep + " " + `'/bin/bash -c \"echo Spices Update message: Some packages needed!; echo To complete the installation, please enter and execute the command: ; echo ${_apt_update} ${_and} ${_apt_install}; sleep 1; exec bash\"'`, null, null);
//~ }
}
} else {
if (!this.fonts_installed)
Util.spawnCommandLineAsync("/usr/bin/apturl apt://fonts-symbola");
Util.spawnCommandLineAsync("/usr/bin/xdg-open apt://fonts-symbola");
}
//~ if (_is_xdg_open_present && !this.fonts_installed) {
//~ Util.spawnCommandLineAsync("/usr/bin/xdg-open apt://fonts-symbola");
//~ }
this.dependenciesMet = false;
}
// End of check_dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v7.4.7~20250105
* Now compatible with Cinnamon on Gentoo.
* Replaces apturl with xdg-open.
* Lets the user enter commands when dependencies are missing.

### v7.4.6~20241230
* Spices not selected in the lists of settings are displayed first.

Expand Down
3 changes: 2 additions & 1 deletion SpicesUpdate@claudiux/files/SpicesUpdate@claudiux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ So you should not have to run any of the commands listed below.
|Linux Mint, Ubuntu|`sudo apt install fonts-symbola`|`sudo apt install libnotify-bin`|
|Debian (with root rights)|`apt install fonts-symbola`|`apt install libnotify-bin`|
|openSUSE|`sudo yast2 --install gdouros-symbola-fonts`|`sudo yast2 --install libnotify-tools`|
|Gentoo|`sudo emerge media-fonts/ttf-ancient-fonts::guru`|`sudo emerge x11-libs/libnotify`|

**(*) Useless for Spices Update version 6.0.0 and more.**
**(*) Not required for Spices Update version 6.0.0 and higher, except for Gentoo.**

## Settings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Spices Update",
"max-instances": "1",
"hide-configuration": false,
"version": "7.4.6",
"version": "7.4.7",
"description": "Warns you when installed Spices (actions, applets, desklets, extensions, themes) require an update or new Spices are available.",
"multiversion": true,
"cinnamon-version": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ then
curl -s -o Symbola.tar.gz ${URLDOWNLOAD} && {
tar xzf Symbola.tar.gz
cp "Symbola.otf" "${USRFONTSDIR}"
fc-cache -f
[[ -f /etc/gentoo-release ]] || {
fc-cache -f
}
rm -f Symbola.tar.gz
}
fi

if [ -f /etc/gentoo-release ]
then
fc-cache -f
fi

exit 0

0 comments on commit b291237

Please sign in to comment.