Repository navigation
color picker: remove recent colors with a hover button, delete or backspace - #3764
Mario-Mohar wants to merge 2 commits into
Conversation
|
/claude review |
| const recent = recentColors.filter(c => c !== colorStr); | ||
| if (recent.length === recentColors.length) | ||
| return; | ||
| recentColors = recent; |
There was a problem hiding this comment.
Removing the first recent color while the picker is open resets the color being edited. ColorPickerModal.selectedColor is bound to SessionData.recentColors[0] (Modals/ColorPickerModal.qml:13). The binding stays live when the picker is opened with plain open/toggle, because no caller assigns it in that case. So this write triggers onSelectedColorChanged, which calls setColor(...): the editor jumps to the next recent color, or to Theme.primary once the list is empty, and the user's in-progress color is lost. Until now recentColors only changed through addRecentColor(currentColor), so this never showed.
Fix: make selectedColor a plain value, not a live binding. For example, seed it from recentColors[0] in show() when no caller set a color, so later edits to the recent list don't touch an open picker.
Claude reviewOne bug to fix before merge.
|
? I guess it's fine letting your AI write everything but you could test it yourself and adjust the text here. I must say I also don't like a simple right click to remove. This is not a usual interaction as far as I am aware. |
|
@apollo79 thanks, good points. Right-click is gone, hovering a swatch now shows a small close button, and Backspace works like Delete. I clicked through it myself and updated the description. The review finding was real: removing the first recent color reset the color being edited. Fixed in ColorPickerModal, before/after screenshots are in the description. |
Description
Recent colors in the color picker could only be added, never removed. A wrong pick stayed in the list until five newer colors pushed it out.
Hovering a recent color swatch now shows a small close button in its corner that removes the color. With keyboard focus on a swatch, Delete or Backspace does the same. The removal goes through a new
SessionData.removeRecentColor(), which filters the color out and saves the session, so it stays gone after a restart. Removing a color that is not in the list does nothing and does not write the file.ColorPickerModal.selectedColorfollowsrecentColors[0], and its change handler used to push every change into the editor. Removing the first recent color while the picker was open therefore replaced the color being edited. The handler now only applies changes while the picker is closed.show()still appliesselectedColoron open, so callers that set it before opening are unaffected.Tests in
quickshell/tests/session-recent-colors.test.mjscover removing and saving, the no-op for an unknown color, and adding a removed color again (it comes back first). They fail on master and pass with this change.Tested in a nested Hyprland session with
session.jsonseeded with a few colors:session.jsonis updated.#e53935to the next recent color#43a047, with it the edited color stays.Type of change
Related issues
Closes #3760
Screenshots / video
Removing the first recent color with Backspace while the picker is open (top: focused, bottom: after removal):
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis clean (no Go changes)make lint-qmlwith no new warnings