diff --git a/extension.js b/extension.js index 31dda10..50e6977 100644 --- a/extension.js +++ b/extension.js @@ -8,6 +8,9 @@ const Main = imports.ui.main; const Mainloop = imports.mainloop; const Settings = imports.ui.settings; +// ─── debug ─────────────────────────────────────────────────────────────────── +const DEBUG = false; + // ─── tunables ──────────────────────────────────────────────────────────────── const TRIGGER_Y = 50; // px from screen top that activates the overlay const POLL_INTERVAL = 40; // ms between pointer polls during a drag @@ -49,6 +52,10 @@ function log(msg) { global.log(`[ctile] ${msg}`); } +function trace(msg) { + if (DEBUG) global.log(`[ctile][trace] ${msg}`); +} + // Returns [r, g, b] normalized (0-1) for the current theme's accent color. // Falls back to a neutral blue if the theme doesn't define accent_color. function getAccentColor() { @@ -89,7 +96,7 @@ function applyLayout(win, layout) { const y = area.y + Math.round(yF * area.height); const w = Math.round(wF * area.width); const h = Math.round(hF * area.height); - log(`applyLayout ${layout.id}: move_resize_frame to ${x},${y} ${w}x${h}`); + trace(`applyLayout ${layout.id}: move_resize_frame to ${x},${y} ${w}x${h}`); win.move_resize_frame(false, x, y, w, h); } @@ -210,7 +217,7 @@ class TileOverlay { // Add to the top-level stage so it is always above panels/windows global.stage.add_child(this._actor); - log('overlay built and added to stage'); + trace('overlay built and added to stage'); } show(monitorIndex, edge) { @@ -249,7 +256,7 @@ class TileOverlay { ay = mon.y + 10; } this._actor.set_position(ax, ay); - log(`overlay shown at ${ax},${ay} size=${aw}x${ah} monitor=${monitorIndex} edge=${edge}`); + trace(`overlay shown at ${ax},${ay} size=${aw}x${ah} monitor=${monitorIndex} edge=${edge}`); this._actor.ease({ opacity : 255, duration : SHOW_ANIM_MS, @@ -265,7 +272,7 @@ class TileOverlay { this._visible = false; this._currentMonIdx = -1; this._currentEdge = null; - log('overlay hiding'); + trace('overlay hiding'); this._actor.ease({ opacity : 0, @@ -446,17 +453,17 @@ class CTileExtension { } _onGrabBegin(_display, _screen, win, op) { - log(`grab-op-begin op=${op} MOVING=${Meta.GrabOp.MOVING} win=${win}`); + trace(`grab-op-begin op=${op} MOVING=${Meta.GrabOp.MOVING} win=${win}`); if (op !== Meta.GrabOp.MOVING && op !== Meta.GrabOp.KEYBOARD_MOVING) return; if (!win) return; this._dragWindow = win; this._grabbedLayout = null; this._startPoll(); - log('drag started, poll started'); + trace('drag started, poll started'); } _onGrabEnd(_display, _screen, _win, _op) { - log(`grab-op-end, hoveredLayout=${this._grabbedLayout ? this._grabbedLayout.id : 'none'}`); + trace(`grab-op-end, hoveredLayout=${this._grabbedLayout ? this._grabbedLayout.id : 'none'}`); this._stopPoll(); const layout = this._grabbedLayout; const dragWin = this._dragWindow; diff --git a/metadata.json b/metadata.json index 10c65e5..fc2bfe4 100644 --- a/metadata.json +++ b/metadata.json @@ -4,6 +4,5 @@ "description": "Drag windows to the top edge to select tiling layouts — like Windows 11 Snap Layouts.", "version": "1.0.0", "cinnamon-version": ["6.0", "6.2", "6.4", "6.6"], - "max-instances": "1", - "url": "" + "max-instances": "1" }