From 8aab4feb22fa8d8f224ae3a7287d00c749659030 Mon Sep 17 00:00:00 2001 From: Aditya U Date: Tue, 8 Jul 2025 13:27:20 +0530 Subject: [PATCH 1/5] fix: prevent window resizing during movement with Ctrl+Arrow and edge Fixed window resizing issue when moving with Ctrl+Arrow keys by setting window bounds --- src/electron/smoothMovementManager.js | 60 +++++++++++++++++++++------ 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/src/electron/smoothMovementManager.js b/src/electron/smoothMovementManager.js index a676c82..6fc0878 100644 --- a/src/electron/smoothMovementManager.js +++ b/src/electron/smoothMovementManager.js @@ -120,6 +120,11 @@ class SmoothMovementManager { let targetX = this.headerPosition.x; let targetY = this.headerPosition.y; + const windowSize = { + width: currentBounds.width, + height: currentBounds.height + }; + switch (direction) { case 'left': targetX -= this.stepSize; break; case 'right': targetX += this.stepSize; break; @@ -130,19 +135,28 @@ class SmoothMovementManager { const displays = screen.getAllDisplays(); let validPosition = displays.some(d => ( - targetX >= d.workArea.x && targetX + currentBounds.width <= d.workArea.x + d.workArea.width && - targetY >= d.workArea.y && targetY + currentBounds.height <= d.workArea.y + d.workArea.height + targetX >= d.workArea.x && targetX + windowSize.width <= d.workArea.x + d.workArea.width && + targetY >= d.workArea.y && targetY + windowSize.height <= d.workArea.y + d.workArea.height )); if (!validPosition) { const nearestDisplay = screen.getDisplayNearestPoint({ x: targetX, y: targetY }); const { x, y, width, height } = nearestDisplay.workArea; - targetX = Math.max(x, Math.min(x + width - currentBounds.width, targetX)); - targetY = Math.max(y, Math.min(y + height - currentBounds.height, targetY)); + targetX = Math.max(x, Math.min(x + width - windowSize.width, targetX)); + targetY = Math.max(y, Math.min(y + height - windowSize.height, targetY)); } if (targetX === this.headerPosition.x && targetY === this.headerPosition.y) return; - this.animateToPosition(header, targetX, targetY); + + header.setBounds({ + x: Math.round(targetX), + y: Math.round(targetY), + width: windowSize.width, + height: windowSize.height + }); + + this.headerPosition = { x: targetX, y: targetY }; + this.updateLayout(); } animateToPosition(header, targetX, targetY) { @@ -198,20 +212,40 @@ class SmoothMovementManager { const display = this.getCurrentDisplay(header); const { width, height } = display.workAreaSize; const { x: workAreaX, y: workAreaY } = display.workArea; - const headerBounds = header.getBounds(); const currentBounds = header.getBounds(); + + const windowSize = { + width: currentBounds.width, + height: currentBounds.height + }; + let targetX = currentBounds.x; let targetY = currentBounds.y; switch (direction) { - case 'left': targetX = workAreaX; break; - case 'right': targetX = workAreaX + width - headerBounds.width; break; - case 'up': targetY = workAreaY; break; - case 'down': targetY = workAreaY + height - headerBounds.height; break; + case 'left': + targetX = workAreaX; + break; + case 'right': + targetX = workAreaX + width - windowSize.width; + break; + case 'up': + targetY = workAreaY; + break; + case 'down': + targetY = workAreaY + height - windowSize.height; + break; } - this.headerPosition = { x: currentBounds.x, y: currentBounds.y }; - this.animateToPosition(header, targetX, targetY); + header.setBounds({ + x: Math.round(targetX), + y: Math.round(targetY), + width: windowSize.width, + height: windowSize.height + }); + + this.headerPosition = { x: targetX, y: targetY }; + this.updateLayout(); } destroy() { @@ -224,4 +258,4 @@ class SmoothMovementManager { } } -module.exports = SmoothMovementManager; \ No newline at end of file +module.exports = SmoothMovementManager; From d161102bc0f388cc87dd2520000dc44099aa750e Mon Sep 17 00:00:00 2001 From: samtiz Date: Wed, 9 Jul 2025 04:57:29 +0900 Subject: [PATCH 2/5] release v0.2.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 944e413..bad6efc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pickle-glass", - "version": "0.2.2", + "version": "0.2.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pickle-glass", - "version": "0.2.2", + "version": "0.2.3", "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { diff --git a/package.json b/package.json index 84777a5..ea125a0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "pickle-glass", "productName": "Glass", - "version": "0.2.2", + "version": "0.2.3", "description": "Cl*ely for Free", "main": "src/index.js", From ee28516a4e6e310fe5cd419600d99aec111753f2 Mon Sep 17 00:00:00 2001 From: Ronnie Ghose <1313566+RONNCC@users.noreply.github.com> Date: Wed, 9 Jul 2025 00:14:23 -0700 Subject: [PATCH 3/5] Add app auto-update toggle option (#87) --- src/common/config/schema.js | 3 +- src/common/services/sqliteClient.js | 47 +++++++++++++++++++++++++++ src/features/settings/SettingsView.js | 42 ++++++++++++++++++++++++ src/index.js | 27 +++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) diff --git a/src/common/config/schema.js b/src/common/config/schema.js index 19e0d8c..00b58f7 100644 --- a/src/common/config/schema.js +++ b/src/common/config/schema.js @@ -6,7 +6,8 @@ const LATEST_SCHEMA = { { name: 'email', type: 'TEXT NOT NULL' }, { name: 'created_at', type: 'INTEGER' }, { name: 'api_key', type: 'TEXT' }, - { name: 'provider', type: 'TEXT DEFAULT \'openai\'' } + { name: 'provider', type: 'TEXT DEFAULT \'openai\'' }, + { name: 'auto_update_enabled', type: 'INTEGER DEFAULT 1' } ] }, sessions: { diff --git a/src/common/services/sqliteClient.js b/src/common/services/sqliteClient.js index afd64f3..5dea2eb 100644 --- a/src/common/services/sqliteClient.js +++ b/src/common/services/sqliteClient.js @@ -157,6 +157,53 @@ class SQLiteClient { return result.length > 0 && result[0].value === 'true'; } + getAutoUpdate(uid = this.defaultUserId) { + try { + const row = this.query( + 'SELECT auto_update_enabled FROM users WHERE uid = ?', + [uid] + ); + + if (row.length > 0) { + return row[0].auto_update_enabled !== 0; + } else { + // User doesn't exist, create them with default settings + const now = Math.floor(Date.now() / 1000); + this.query( + 'INSERT OR REPLACE INTO users (uid, display_name, email, created_at, auto_update_enabled) VALUES (?, ?, ?, ?, ?)', + [uid, 'User', 'user@example.com', now, 1] + ); + return true; // default to enabled + } + } catch (error) { + console.error('Error getting auto_update_enabled setting:', error); + return true; // fallback to enabled + } + } + + setAutoUpdate(isEnabled, uid = this.defaultUserId) { + try { + const result = this.query( + 'UPDATE users SET auto_update_enabled = ? WHERE uid = ?', + [isEnabled ? 1 : 0, uid] + ); + + // If no rows were updated, the user might not exist, so create them + if (result.changes === 0) { + const now = Math.floor(Date.now() / 1000); + this.query( + 'INSERT OR REPLACE INTO users (uid, display_name, email, created_at, auto_update_enabled) VALUES (?, ?, ?, ?, ?)', + [uid, 'User', 'user@example.com', now, isEnabled ? 1 : 0] + ); + } + + return result; + } catch (error) { + console.error('Error setting auto-update:', error); + throw error; + } + } + close() { if (this.db) { try { diff --git a/src/features/settings/SettingsView.js b/src/features/settings/SettingsView.js index 7dbd9f1..f71344f 100644 --- a/src/features/settings/SettingsView.js +++ b/src/features/settings/SettingsView.js @@ -456,6 +456,8 @@ export class SettingsView extends LitElement { presets: { type: Array, state: true }, selectedPreset: { type: Object, state: true }, showPresets: { type: Boolean, state: true }, + autoUpdateEnabled: { type: Boolean, state: true }, + autoUpdateLoading: { type: Boolean, state: true }, }; //////// after_modelStateService //////// @@ -479,10 +481,46 @@ export class SettingsView extends LitElement { this.selectedPreset = null; this.showPresets = false; this.handleUsePicklesKey = this.handleUsePicklesKey.bind(this) + this.autoUpdateEnabled = true; + this.autoUpdateLoading = true; this.loadInitialData(); //////// after_modelStateService //////// } + async loadAutoUpdateSetting() { + if (!window.require) return; + const { ipcRenderer } = window.require('electron'); + this.autoUpdateLoading = true; + try { + const enabled = await ipcRenderer.invoke('get-auto-update'); + this.autoUpdateEnabled = enabled; + } catch (e) { + this.autoUpdateEnabled = true; // fallback + } + this.autoUpdateLoading = false; + this.requestUpdate(); + } + + async handleToggleAutoUpdate() { + if (!window.require || this.autoUpdateLoading) return; + const { ipcRenderer } = window.require('electron'); + this.autoUpdateLoading = true; + this.requestUpdate(); + try { + const newValue = !this.autoUpdateEnabled; + const success = await ipcRenderer.invoke('set-auto-update', newValue); + if (success) { + this.autoUpdateEnabled = newValue; + } else { + console.error('Failed to update auto-update setting'); + } + } catch (e) { + console.error('Error toggling auto-update:', e); + } + this.autoUpdateLoading = false; + this.requestUpdate(); + } + //////// after_modelStateService //////// async loadInitialData() { if (!window.require) return; @@ -617,6 +655,7 @@ export class SettingsView extends LitElement { this.setupEventListeners(); this.setupIpcListeners(); this.setupWindowResize(); + this.loadAutoUpdateSetting(); } disconnectedCallback() { @@ -1161,6 +1200,9 @@ export class SettingsView extends LitElement { +