Skip to content

Updates for GNOME Shell 49 and improves logging #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ChrisLauinger77
Copy link
Owner

Updates the extension to be compatible with GNOME Shell 49.

  • Updates metadata to reflect compatibility with GNOME Shell 49.
  • Replaces console.error and console.log calls with the extension's logger for better consistency and control over logging.

Applies formatting changes based on updated Prettier configuration.

Refactors code for improved readability and maintainability
by removing unnecessary imports and simplifying code structures.
@ChrisLauinger77 ChrisLauinger77 marked this pull request as draft June 26, 2025 13:24
Updates metadata to support GNOME Shell version 49.

Replaces direct `console.error` and `console.log` calls with the extension's logger for better debugging and consistency.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the extension for GNOME Shell 49 compatibility and standardizes logging through the extension’s logger.

  • Bumps shell-version and version-name in metadata for Shell 49 support
  • Replaces all console.log/console.error calls with this.getLogger().log/.error
  • Applies one-line formatting to several .connect() calls and adds editor/formatter configs

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
prefs.js Swapped out console.* for this.getLogger() and inlined connects
extension.js Replaced console.error with this.getLogger().error and inlined calls
menu_items.js Condensed if and removed formatting around array splices
metadata.json Updated shell-version to include "49" and bumped version-name
.prettierrc Added printWidth and bracketSameLine options
.editorconfig Introduced basic EditorConfig rules with indent settings
Comments suppressed due to low confidence (1)

[email protected]/prefs.js:265

  • [nitpick] Variable buttonfilechooser uses inconsistent casing compared to other camelCase identifiers. Rename to buttonFileChooser for clarity and consistency.
        buttonfilechooser.set_tooltip_text(_("Usually located in '/usr/share/applications'"));

_(_settings.get_string("label-menu")),
""
);
this.menu.setHeader("preferences-other-symbolic", _(_settings.get_string("label-menu")), "");
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] You’ve wrapped a translated string in another translation call (_(_settings.get_string(...))). Consider using a single _() invocation or passing the already translated string directly.

Copilot uses AI. Check for mistakes.

(posRel < 0 && index > 0) ||
(posRel > 0 && index < items.length - 1)
) {
if ((posRel < 0 && index > 0) || (posRel > 0 && index < items.length - 1)) {
let temp = items[index];
items.splice(index, 1);
items.splice(parseInt(index) + posRel, 0, temp);
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using parseInt on index (already a number) is unnecessary. You can simplify to items.splice(index + posRel, 0, temp);.

Suggested change
items.splice(parseInt(index) + posRel, 0, temp);
items.splice(index + posRel, 0, temp);

Copilot uses AI. Check for mistakes.

Comment on lines +270 to 277
const errorLog = (...args) => {
this.getLogger().error("Error:", ...args);
};
const handleError = (error) => {
errorLog(error);
return null;
};
const appRow = await myAppChooser.showChooser().catch(handleError);
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’ve redefined errorLog and handleError inside this click handler only. Consider extracting them into a shared helper or method to avoid duplication and improve reuse.

Suggested change
const errorLog = (...args) => {
this.getLogger().error("Error:", ...args);
};
const handleError = (error) => {
errorLog(error);
return null;
};
const appRow = await myAppChooser.showChooser().catch(handleError);
const appRow = await myAppChooser.showChooser().catch(this._handleError.bind(this));

Copilot uses AI. Check for mistakes.

Extends the install script to allow creating a zip file
through the "pack" argument, mirroring the functionality
of the "zip" argument. This provides more flexibility
in how the extension is packaged.
@ChrisLauinger77 ChrisLauinger77 force-pushed the gnome49 branch 4 times, most recently from 6a1269a to 32d95a3 Compare July 5, 2025 16:17
Corrects the extension installation process by using the correct zip file name, ensuring proper installation and activation.

Simplifies menu item parsing by directly accessing the split data, improving code readability and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant