From 22dcc2aca2eeec7010dabdf553a39fdbaa955b5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Tue, 13 Aug 2024 12:10:14 -0400
Subject: [PATCH] cleanup: Fix various comments and code typos

---
 appIconIndicators.js | 26 +++++++++++++-------------
 appIcons.js          | 25 +++++++++++++------------
 docking.js           | 42 +++++++++++++++++++++---------------------
 3 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/appIconIndicators.js b/appIconIndicators.js
index 448b76b5ce..f9729bb8ab 100644
--- a/appIconIndicators.js
+++ b/appIconIndicators.js
@@ -32,7 +32,7 @@ const MAX_WINDOWS_CLASSES = 4;
 
 
 /*
- * This is the main indicator class to be used. The desired bahviour is
+ * This is the main indicator class to be used. The desired behavior is
  * obtained by composing the desired classes below based on the settings.
  *
  */
@@ -134,7 +134,7 @@ class IndicatorBase {
 }
 
 /*
- * A base indicator class for running style, from which all other EunningIndicators should derive,
+ * A base indicator class for running style, from which all other RunningIndicators should derive,
  * providing some basic methods, variables definitions and their update,  css style classes handling.
  *
  */
@@ -224,7 +224,7 @@ class RunningIndicatorBase extends IndicatorBase {
     }
 }
 
-// We add a css class so third parties themes can limit their indicaor customization
+// We add a css class so third parties themes can limit their indicator customization
 // to the case we do nothing
 class RunningIndicatorDefault extends RunningIndicatorBase {
     constructor(source) {
@@ -266,7 +266,7 @@ class RunningIndicatorDots extends RunningIndicatorBase {
         });
 
         // We draw for the bottom case and rotate the canvas for other placements
-        // set center of rotatoins to the center
+        // set center of rotations to the center
         this._area.set_pivot_point(0.5, 0.5);
 
         switch (this._side) {
@@ -307,7 +307,7 @@ class RunningIndicatorDots extends RunningIndicatorBase {
         }, this);
 
         // Apply glossy background
-        // TODO: move to enable/disableBacklit to apply itonly to the running apps?
+        // TODO: move to enable/disableBacklit to apply it only to the running apps?
         // TODO: move to css class for theming support
         const {extension} = Docking.DockManager;
         this._glossyBackgroundStyle = `background-image: url('${extension.path}/media/glossy.svg');` +
@@ -342,7 +342,7 @@ class RunningIndicatorDots extends RunningIndicatorBase {
         this._width = height;
         this._height = width;
 
-        // By defaut re-use the style - background color, and border width and color -
+        // By default re-use the style - background color, and border width and color -
         // of the default dot
         const themeNode = this._source._dot.get_theme_node();
         this._borderColor = themeNode.get_border_color(this._side);
@@ -779,7 +779,7 @@ class UnityIndicator extends IndicatorBase {
             'dash-max-icon-size').unpack();
 
         if (!fontDesc.get_size_is_absolute()) {
-            // fontSize was exprimed in points, so convert to pixel
+            // fontSize was expressed in points, so convert to pixel
             fontSize /= 0.75;
         }
 
@@ -894,9 +894,9 @@ class UnityIndicator extends IndicatorBase {
             }
         }
 
-        const [hasOffsetStart, offsetStartvalue] = node.lookup_color(`${elementName}-offset-start`, false);
+        const [hasOffsetStart, offsetStartValue] = node.lookup_color(`${elementName}-offset-start`, false);
         if (hasOffsetStart)
-            output.offsetStart = offsetStartvalue;
+            output.offsetStart = offsetStartValue;
 
         const [hasOffsetEnd, offsetEndValue] = node.lookup_color(`${elementName}-offset-end`, false);
         if (hasOffsetEnd)
@@ -1041,7 +1041,7 @@ const  BATCH_SIZE_TO_DELETE = 50;
 // The icon size used to extract the dominant color
 const DOMINANT_COLOR_ICON_SIZE = 64;
 
-// Compute dominant color frim the app icon.
+// Compute dominant color from the app icon.
 // The color is cached for efficiency.
 class DominantColorExtractor {
     constructor(app) {
@@ -1118,8 +1118,8 @@ class DominantColorExtractor {
         // We resample icons larger than twice the desired size, as the resampling
         // to a size s
         // DOMINANT_COLOR_ICON_SIZE < s < 2*DOMINANT_COLOR_ICON_SIZE,
-        // most of the case exactly DOMINANT_COLOR_ICON_SIZE as the icon size is tipycally
-        // a multiple of it.
+        // most of the case exactly DOMINANT_COLOR_ICON_SIZE as the icon size is
+        // typically a multiple of it.
         const width = pixBuf.get_width();
         const height = pixBuf.get_height();
 
@@ -1189,7 +1189,7 @@ class DominantColorExtractor {
     }
 
     /**
-     * Downsample large icons before scanning for the backlight color to
+     * Downscale large icons before scanning for the backlight color to
      * improve performance.
      *
      * @param pixBuf
diff --git a/appIcons.js b/appIcons.js
index 356061ade6..5df899c683 100644
--- a/appIcons.js
+++ b/appIcons.js
@@ -141,7 +141,7 @@ const DockAbstractAppIcon = GObject.registerClass({
             this._onWindowDemandsAttention(window));
 
         // In Wayland sessions, this signal is needed to track the state of windows dragged
-        // from one monitor to another. As this is triggered quite often (whenever a new winow
+        // from one monitor to another. As this is triggered quite often (whenever a new window
         // of any application opened or moved to a different desktop),
         // we restrict this signal to  the case when 'isolate-monitors' is true,
         // and if there are at least 2 monitors.
@@ -246,7 +246,7 @@ const DockAbstractAppIcon = GObject.registerClass({
 
         // This is necessary due to an upstream bug
         // https://bugzilla.gnome.org/show_bug.cgi?id=757556
-        // It can be safely removed once it get solved upstrea.
+        // It can be safely removed once it get solved upstream.
         if (this._menu)
             this._menu.close(false);
     }
@@ -491,10 +491,10 @@ const DockAbstractAppIcon = GObject.registerClass({
         // Only consider SHIFT and CONTROL as modifiers (exclude SUPER, CAPS-LOCK, etc.)
         modifiers &= Clutter.ModifierType.SHIFT_MASK | Clutter.ModifierType.CONTROL_MASK;
 
-        // We don't change the CTRL-click behaviour: in such case we just chain
+        // We don't change the CTRL-click behavior: in such case we just chain
         // up the parent method and return.
         if (modifiers & Clutter.ModifierType.CONTROL_MASK) {
-            // Keep default behaviour: launch new window
+            // Keep default behavior: launch new window
             // By calling the parent method I make it compatible
             // with other extensions tweaking ctrl + click
             super.activate(button);
@@ -544,7 +544,7 @@ const DockAbstractAppIcon = GObject.registerClass({
             const singleOrUrgentWindows = windows.length === 1 || hasUrgentWindows;
             switch (buttonAction) {
             case clickAction.MINIMIZE:
-                // In overview just activate the app, unless the acion is explicitely
+                // In overview just activate the app, unless the action is explicitly
                 // requested with a keyboard modifier
                 if (!Main.overview.visible || modifiers) {
                     // If we have button=2 or a modifier, allow minimization even if
@@ -636,7 +636,7 @@ const DockAbstractAppIcon = GObject.registerClass({
             case clickAction.PREVIEWS:
                 if (!Main.overview.visible) {
                     // If only one windows is present just switch to it,
-                    // but only when trigggered with the simple click action
+                    // but only when triggered with the simple click action
                     // (no modifiers, no middle click).
                     if (singleOrUrgentWindows && !modifiers && button === 1) {
                         const [w] = windows;
@@ -652,7 +652,7 @@ const DockAbstractAppIcon = GObject.registerClass({
             case clickAction.MINIMIZE_OR_PREVIEWS:
                 // When a single window is present, toggle minimization
                 // If only one windows is present toggle minimization, but only
-                // when trigggered with the imple click action (no modifiers,
+                // when triggered with the standard click action (no modifiers,
                 // no middle click).
                 if (!Main.overview.visible) {
                     if (singleOrUrgentWindows && !modifiers && button === 1) {
@@ -749,7 +749,7 @@ const DockAbstractAppIcon = GObject.registerClass({
     }
 
     // Try to do the right thing when attempting to launch a new window of an app. In
-    // particular, if the application doens't allow to launch a new window, activate
+    // particular, if the application doesn't allow to launch a new window, activate
     // the existing window instead.
     launchNewWindow() {
         if (this.updating)
@@ -762,7 +762,7 @@ const DockAbstractAppIcon = GObject.registerClass({
         } else {
             // Try to manually activate the first window. Otherwise, when the
             // app is activated by switching to a different workspace, a launch
-            // spinning icon is shown and disappers only after a timeout.
+            // spinning icon is shown and disappears only after a timeout.
             const windows = this.getWindows();
             if (windows.length > 0) {
                 Main.activateWindow(windows[0]);
@@ -1258,7 +1258,7 @@ const DockAppIconMenu = class DockAppIconMenu extends PopupMenu.PopupMenu {
                 this._allWindowsMenuItem.width =  this._allWindowsMenuItem.menu.actor.width + 15;
             }
 
-            // The menu is created hidden and never hidded after being shown.
+            // The menu is created hidden and never hidden after being shown.
             // Instead, a signal connected to its items destroy will set is
             // insensitive if no more windows preview are shown.
             if (windows.length > 0) {
@@ -1298,7 +1298,8 @@ const DockAppIconMenu = class DockAppIconMenu extends PopupMenu.PopupMenu {
                     this.emit('activate-window', window);
                 });
 
-                // This is to achieve a more gracefull transition when the last windows is closed.
+                // This is to achieve a more graceful transition when the last
+                // window is closed.
                 item.connect('destroy', () => {
                     // It's still counting the item just going to be destroyed
                     if (this._allWindowsMenuItem.menu._getMenuItems().length === 1)
@@ -1487,7 +1488,7 @@ class DockShowAppsIconMenu extends DockAppIconMenu {
  */
 export function itemShowLabel() {
     /* eslint-disable no-invalid-this */
-    // Check if the label is still present at all. When switching workpaces, the
+    // Check if the label is still present at all. When switching workspace, the
     // item might have been destroyed in between.
     if (!this._labelText || !this.label.get_stage())
         return;
diff --git a/docking.js b/docking.js
index 531aed6626..e4002bc520 100644
--- a/docking.js
+++ b/docking.js
@@ -74,9 +74,9 @@ const Labels = Object.freeze({
  * slide out of its child via the slide-x property ([0:1]).
  *
  * Required since I want to track the input region of this container which is
- * based on its allocation even if the child overlows the parent actor. By doing
- * this the region of the dash that is slideout is not steling anymore the input
- * regions making the extesion usable when the primary monitor is the right one.
+ * based on its allocation even if the child overflows the parent actor. By doing
+ * this the region of the dash that is slide-out is not stealing anymore the input
+ * regions making the extension usable when the primary monitor is the right one.
  *
  * The slide-x parameter can be used to directly animate the sliding. The parent
  * must have a WEST (SOUTH) anchor_point to achieve the sliding to the RIGHT (BOTTOM)
@@ -225,7 +225,7 @@ const DockedDash = GObject.registerClass({
         });
 
         if (this.monitorIndex === undefined) {
-            // Hello turkish locale, gjs has instead defined this.monitorİndex
+            // Hello turkish locale, gjs has instead defined this.monitorIndex
             // See: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/742
             this.monitorIndex = this.monitor_index;
         }
@@ -238,7 +238,7 @@ const DockedDash = GObject.registerClass({
 
         // Temporary ignore hover events linked to autohide for whatever reason
         this._ignoreHover = false;
-        this._oldignoreHover = null;
+        this._oldIgnoreHover = null;
         // This variables are linked to the settings regardles of autohide or intellihide
         // being temporary disable. Get set by _updateVisibilityMode;
         this._autohideIsEnabled = null;
@@ -458,7 +458,7 @@ const DockedDash = GObject.registerClass({
     _initialize() {
         this._signalsHandler.removeWithLabel(Labels.INITIALIZE);
 
-        // Apply custome css class according to the settings
+        // Apply custom css class according to the settings
         this._themeManager.updateCustomTheme();
 
         this._updateVisibilityMode();
@@ -873,7 +873,7 @@ const DockedDash = GObject.registerClass({
                     Meta.enable_unredirect_for_display(global.display);
                     this._unredirectDisabled = false;
                 }
-                // Remove queued barried removal if any
+                // Remove queued barrier removal timeout if any
                 if (this._removeBarrierTimeoutId > 0)
                     GLib.source_remove(this._removeBarrierTimeoutId);
                 this._updateBarrier();
@@ -1245,15 +1245,15 @@ const DockedDash = GObject.registerClass({
     }
 
     _onDragStart() {
-        this._oldignoreHover = this._ignoreHover;
+        this._oldIgnoreHover = this._ignoreHover;
         this._ignoreHover = true;
         this._animateIn(DockManager.settings.animationTime, 0);
     }
 
     _onDragEnd() {
-        if (this._oldignoreHover)
-            this._ignoreHover = this._oldignoreHover;
-        this._oldignoreHover = null;
+        if (this._oldIgnoreHover)
+            this._ignoreHover = this._oldIgnoreHover;
+        this._oldIgnoreHover = null;
         this._box.sync_hover();
     }
 
@@ -1343,8 +1343,8 @@ const DockedDash = GObject.registerClass({
 
             if (direction) {
                 // Prevent scroll events from triggering too many workspace switches
-                // by adding a 250ms deadtime between each scroll event.
-                // Usefull on laptops when using a touchpad.
+                // by adding a 250ms dead time between each scroll event.
+                // Useful on laptops when using a touch pad.
 
                 // During the deadtime do nothing
                 if (this._optionalScrollWorkspaceSwitchDeadTimeId) {
@@ -1378,7 +1378,7 @@ const DockedDash = GObject.registerClass({
                     Main.wm._workspaceSwitcherPopup = null;
                 });
 
-                // If Workspace Grid is installed, let them handle the scroll behaviour.
+                // If Workspace Grid is installed, let them handle the scroll behavior.
                 if (global.workspace_manager.workspace_grid !== undefined)
                     ws = global.workspace_manager.workspace_grid.actionMoveWorkspace(direction);
                 else
@@ -1414,7 +1414,7 @@ const DockedDash = GObject.registerClass({
 });
 
 /*
- * Handle keybaord shortcuts
+ * Handle keyboard shortcuts
  */
 const NUM_HOTKEYS = 10;
 
@@ -1573,7 +1573,7 @@ const KeyboardShortcuts = class DashToDockKeyboardShortcuts {
 
 /**
  * Isolate overview to open new windows for inactive apps
- * Note: the future implementaion is not fully contained here.
+ * Note: the future implementation is not fully contained here.
  * Some bits are around in other methods of other classes.
  * This class just take care of enabling/disabling the option.
  */
@@ -2149,10 +2149,10 @@ export class DockManager {
         this._oldDash.hide();
 
         // Also set dash width to 1, so it's almost not taken into account by code
-        // calculaing the reserved space in the overview. The reason to keep it at 1 is
-        // to allow its visibility change to trigger an allocaion of the appGrid which
-        // in turn is triggergin the appsIcon spring animation, required when no other
-        // actors has this effect, i.e in horizontal mode and without the workspaceThumnails
+        // calculating the reserved space in the overview. The reason to keep it at 1 is
+        // to allow its visibility change to trigger an allocation of the appGrid which
+        // in turn is triggering the appsIcon spring animation, required when no other
+        // actors has this effect, i.e in horizontal mode and without the workspaceThumbnails
         // 1 static workspace only)
         this._oldDash.set_height(1);
 
@@ -2166,7 +2166,7 @@ export class DockManager {
             () => this._oldDash.set_height(1),
         ]);
 
-        // Pretend I'm the dash: meant to make appgrid swarm animation come from
+        // Pretend I'm the dash: meant to make app grid swarm animation come from
         // the right position of the appShowButton.
         this.overviewControls.dash = this.mainDock.dash;
         this.searchController._showAppsButton = this.mainDock.dash.showAppsButton;