Add debug tracing functionality and clean up metadata

This commit is contained in:
prairienerd18
2026-04-06 20:43:11 -05:00
parent 7ec023c3e3
commit aff9ba46a3
2 changed files with 15 additions and 9 deletions

View File

@@ -8,6 +8,9 @@ const Main = imports.ui.main;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const Settings = imports.ui.settings; const Settings = imports.ui.settings;
// ─── debug ───────────────────────────────────────────────────────────────────
const DEBUG = false;
// ─── tunables ──────────────────────────────────────────────────────────────── // ─── tunables ────────────────────────────────────────────────────────────────
const TRIGGER_Y = 50; // px from screen top that activates the overlay const TRIGGER_Y = 50; // px from screen top that activates the overlay
const POLL_INTERVAL = 40; // ms between pointer polls during a drag const POLL_INTERVAL = 40; // ms between pointer polls during a drag
@@ -49,6 +52,10 @@ function log(msg) {
global.log(`[ctile] ${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. // 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. // Falls back to a neutral blue if the theme doesn't define accent_color.
function getAccentColor() { function getAccentColor() {
@@ -89,7 +96,7 @@ function applyLayout(win, layout) {
const y = area.y + Math.round(yF * area.height); const y = area.y + Math.round(yF * area.height);
const w = Math.round(wF * area.width); const w = Math.round(wF * area.width);
const h = Math.round(hF * area.height); 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); 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 // Add to the top-level stage so it is always above panels/windows
global.stage.add_child(this._actor); global.stage.add_child(this._actor);
log('overlay built and added to stage'); trace('overlay built and added to stage');
} }
show(monitorIndex, edge) { show(monitorIndex, edge) {
@@ -249,7 +256,7 @@ class TileOverlay {
ay = mon.y + 10; ay = mon.y + 10;
} }
this._actor.set_position(ax, ay); 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({ this._actor.ease({
opacity : 255, opacity : 255,
duration : SHOW_ANIM_MS, duration : SHOW_ANIM_MS,
@@ -265,7 +272,7 @@ class TileOverlay {
this._visible = false; this._visible = false;
this._currentMonIdx = -1; this._currentMonIdx = -1;
this._currentEdge = null; this._currentEdge = null;
log('overlay hiding'); trace('overlay hiding');
this._actor.ease({ this._actor.ease({
opacity : 0, opacity : 0,
@@ -446,17 +453,17 @@ class CTileExtension {
} }
_onGrabBegin(_display, _screen, win, op) { _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 (op !== Meta.GrabOp.MOVING && op !== Meta.GrabOp.KEYBOARD_MOVING) return;
if (!win) return; if (!win) return;
this._dragWindow = win; this._dragWindow = win;
this._grabbedLayout = null; this._grabbedLayout = null;
this._startPoll(); this._startPoll();
log('drag started, poll started'); trace('drag started, poll started');
} }
_onGrabEnd(_display, _screen, _win, _op) { _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(); this._stopPoll();
const layout = this._grabbedLayout; const layout = this._grabbedLayout;
const dragWin = this._dragWindow; const dragWin = this._dragWindow;

View File

@@ -4,6 +4,5 @@
"description": "Drag windows to the top edge to select tiling layouts — like Windows 11 Snap Layouts.", "description": "Drag windows to the top edge to select tiling layouts — like Windows 11 Snap Layouts.",
"version": "1.0.0", "version": "1.0.0",
"cinnamon-version": ["6.0", "6.2", "6.4", "6.6"], "cinnamon-version": ["6.0", "6.2", "6.4", "6.6"],
"max-instances": "1", "max-instances": "1"
"url": ""
} }