Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Main Workflow

on:
push:
branches: [ "*" ]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

package:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
options: --privileged
steps:
- uses: actions/checkout@v4

- name: Install build tools
run: |
apt-get update
apt-get install -y meson ninja-build libglib2.0-dev libgtk-3-dev tar gzip

- name: Package extension
run: |
mkdir -p wiggle/extension
cp -r * wiggle/extension/
tar -czf wiggle.tar.gz -C wiggle extension
ls -la
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Node modules
node_modules/

# Test coverage
coverage/

# Logs and temporary files
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment files
.env
.env.local

# OS generated files
dcrcache/
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Firecrawl results
.firecrawl/
33 changes: 33 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AGENTS.md

## Commands

- `npm test` - Run unit tests with Mocha
- `npx mocha --require ./tests/mocks/gjs.js tests/**/*.test.js` - Alternative test command

## Architecture

- This is a GNOME extension written in JavaScript using the GJS framework
- The main entry point is `extension.js`
- Effects are implemented as separate classes extending `EffectBase`
- Two effect types exist: `MagnificationEffect` (cursor zoom) and `FindMouseEffect` (halo)
- Settings are managed via GSettings schema in `schemas/org.gnome.shell.extensions.wiggle.gschema.xml`

## Testing

- Tests use Mocha + Chai + Sinon
- Mock GJS modules in `tests/mocks/gjs.js` must be loaded before tests
- Test files are in the `tests/` directory with `.test.js` extension
- Node 24+ is used for testing (ESM modules)

## Build & Install

- Run `make install` to build and install the extension
- Requires GNOME 46 or later
- Extension UUID: `wiggle@mechtifs.github.com`

## Important Notes

- Do NOT commit `node_modules/` - it's in `.gitignore`
- The `wiggle` subdirectory is a git submodule (the original repo)
- Keep changes focused on the extension code, not test infrastructure
27 changes: 27 additions & 0 deletions const.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,31 @@ export const Field = {
DIST: 'distance-threshold',
CHCK: 'check-interval',
DRAW: 'draw-interval',

// New Fields
MODE: 'effect-mode',
TRIGGER: 'trigger-type',
T_KEY: 'trigger-key',
HALO_COLOR: 'halo-color',
HALO_RADIUS: 'halo-radius',
HALO_OPACITY: 'halo-opacity',

// Spotlight Effect Settings
SPOTLIGHT_COLOR: 'spotlight-color',
SPOTLIGHT_SIZE: 'spotlight-size',
SPOTLIGHT_OPACITY: 'spotlight-opacity',

// Laser Pointer Settings
LASER_COLOR: 'laser-color',
LASER_THICKNESS: 'laser-thickness',
LASER_LENGTH: 'laser-length',

// Trail Effect Settings
TRAIL_COLOR: 'trail-color',
TRAIL_LENGTH: 'trail-length',
TRAIL_FADE: 'trail-fade-duration',

// Arrow Guide Settings
ARROW_COLOR: 'arrow-color',
ARROW_SIZE: 'arrow-size',
};
23 changes: 10 additions & 13 deletions cursor.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

import Clutter from 'gi://Clutter';
import Meta from 'gi://Meta';

export default class Cursor {
constructor() {
this._tracker = global.backend.get_cursor_tracker(global.display);
this._tracker = Meta.CursorTracker.get_for_display(global.display);
}

get hot() {
Expand All @@ -16,24 +17,13 @@ export default class Cursor {
}

show() {
const seat = Clutter.get_default_backend().get_default_seat();

if (seat.is_unfocus_inhibited()) {
seat.uninhibit_unfocus();
}

this._tracker.disconnectObject(this);
this._tracker.set_pointer_visible(true);
}

hide() {
const seat = Clutter.get_default_backend().get_default_seat();

if (!seat.is_unfocus_inhibited()) {
seat.inhibit_unfocus();
}

this._tracker.set_pointer_visible(false);

this._tracker.disconnectObject(this);
this._tracker.connectObject(
'visibility-changed', () => {
Expand All @@ -44,4 +34,11 @@ export default class Cursor {
this
);
}

destroy() {
if (this._tracker) {
this._tracker.disconnectObject(this);
this._tracker = null;
}
}
}
Loading