Implemented comprehensive zone resizing functionality in the zone editor: Features: - Detects when mouse is near zone edges/corners (10px threshold) - Supports all 8 resize handles: N, S, E, W, NE, NW, SE, SW - Visual feedback with cyan highlight during resize - Real-time dimension label updates while resizing - Enforces minimum zone size (20x20 pixels) - Constrains resizing to monitor boundaries - Maintains zone data structure integrity during resize Implementation details: - Added state tracking: isResizingZone, resizingZoneIndex, resizeEdge, originalZoneBounds - New method _findResizeEdge() for edge/corner detection - Enhanced _onButtonPress() to prioritize resize over move - Extended _onMotion() with resize delta calculations for all 8 directions - Updated instruction label to include resize guidance - Updated TODO.md to mark item #17 as completed The zone editor now supports create, move, and resize operations with clear visual feedback for each mode (green=normal, yellow=moving, cyan=resizing). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5.9 KiB
5.9 KiB
GridSnap TODO List
Critical Issues
1. Custom Layout Persistence ✅ COMPLETED
Priority: High
- Custom layouts are only stored in memory
- Layouts are lost when extension reloads or Cinnamon restarts
- Need to implement file-based storage
- Location:
~/.local/share/gridsnap/layouts.json - Save layouts when created in graphical editor
- Load layouts on extension initialization
2. Remove Last Zone Implementation (extension.js:236-274)
Priority: Medium
_removeLastZone()destroys and recreates entire editor interface- Causes visual flicker
- Inefficient approach
- Could leave dangling event listeners
- Refactor to only remove the last zone widget without recreating everything
Functionality Improvements
3. Multi-Monitor Support
Priority: High
- Currently only works on primary monitor (extension.js:61)
- Need per-monitor zone configurations
- Detect which monitor window is on when snapping
- Allow zone editor to work on any monitor
- Store zone layouts per monitor
4. High-DPI Display Support
Priority: Medium
- Coordinates from
get_coords()may not respect window scaling - Test on high-DPI displays
- Verify zone calculations work correctly with display scaling
- May need to use
get_resource_scale()or similar
5. Edit Existing Custom Layouts
Priority: Medium
- Currently can only create new layouts in editor
- Add ability to select and edit existing custom layouts
- Add UI to choose which layout to edit
- Pre-populate editor with existing zones when editing
15. Show Zone Dimensions in Editor ✅ COMPLETED
Priority: Medium
- Display zone dimensions while drawing in graphical editor
- Show width and height in pixels and/or percentage
- Update dimensions in real-time as zone is resized
- Display position coordinates (x, y)
- Show dimensions near cursor or inside zone preview
16. Move/Reposition Zones in Editor ✅ COMPLETED
Priority: Medium
- Allow clicking and dragging existing zones to move them
- Visual feedback when zone is selected for moving (yellow highlight)
- Prevent moving zones outside monitor bounds
- Update zone coordinates as zone is moved
- Maintain zone size while moving (only change position)
- Snap to grid or guides (future enhancement)
17. Resize Zones in Editor ✅ COMPLETED
Priority: High
- Detect mouse near edges and corners of zones (10px threshold)
- Allow dragging edges to resize zones horizontally or vertically
- Allow dragging corners to resize zones diagonally
- Visual feedback when zone is being resized (cyan highlight)
- Show dimension label during resize with real-time updates
- Enforce minimum zone size (20x20 pixels)
- Constrain resize to monitor bounds
- Update zone data structure in real-time during resize
- Support all 8 resize handles (N, S, E, W, NE, NW, SE, SW)
Code Quality & Robustness
6. Comprehensive Error Handling
Priority: Medium
- Add validation of zone sizes during window snapping
- Add checks for
window.move_resize_frame()success - Validate monitor dimensions before calculations
- Handle edge cases (window too small, zone too small, etc.)
- Add user notifications for errors instead of silent failures
7. Event Leak Prevention
Priority: Low
- Zone preview widgets might not be properly destroyed if motion events stop unexpectedly
- Audit all signal connections and ensure disconnect in cleanup
- Add defensive cleanup in edge cases
- Review overlay widget lifecycle
8. Zone Overlap Detection
Priority: Low
- Warn user if zones overlap in graphical editor
- Provide visual feedback for overlapping zones
- Optionally prevent overlaps or auto-adjust
Features from README (Planned)
9. Zone Layout Import/Export
Priority: Low
- Allow exporting custom layouts to JSON files
- Import layouts from JSON files
- Share layouts between systems
- Backup/restore functionality
10. More Pre-configured Layouts
Priority: Low
- Add more default layout options
- Common patterns: ultrawide monitor layouts, vertical splits
- 1/3 - 2/3 layouts
- Picture-in-picture style layouts
11. Animation Effects
Priority: Low
- Add smooth transitions when snapping windows
- Animate zone overlay appearance/disappearance
- Visual feedback when window snaps to zone
12. Settings Panel ✅ COMPLETED
Priority: Medium
- Add Cinnamon settings panel for the extension
- Toggle features on/off (shift-drag, keyboard snap)
- Manage saved layouts (view, delete, export)
- Customize zone appearance (colors, border width, opacity)
- Configure zone number visibility
- Enable/disable snap notifications
- Allow customization of keybindings (future enhancement)
- Configure animation speeds (when animations added)
Documentation
13. Update Metadata ✅ COMPLETED
Priority: Low
- Add "url" property to metadata.json
- Update author name to "Keith Smith"
- Add project URL/repository link
Testing
14. Test Coverage
Priority: Low
- Test on different Cinnamon versions (5.0, 5.2, 5.4, 5.6, 6.0)
- Test with different window types (maximized, minimized, dialog boxes)
- Test edge cases (dragging between monitors, rapid key presses)
- Test with different keyboard layouts
- Verify memory leaks don't occur with repeated enable/disable
Recently Fixed ✅
- Keybinding closure bug (all zones mapped to zone 9)
- Keybinding conflicts with panel app launcher (changed to Super+Ctrl+1-9)
- Shift-drag detection (implemented modifier polling)
- Window object reference (use global.display.focus_window)
- Window API compatibility (property checks vs get_maximized())
- Signal handler parameters (grab-op-begin/end)
- Laptop keyboard support (removed numpad dependency)