feature/presets-shortcuts-tray #1

Merged
maot merged 7 commits from feature/presets-shortcuts-tray into main 2026-08-04 00:54:53 +00:00
Collaborator

Presets, atalho de teclado e bandeja do sistema

Adicionado suporte a presets de gamma/contraste/brilho, atalhos de teclado globais por preset e um ícone na bandeja do sistema, para o app continuar rodando em segundo plano.

Presets

Adicionada a opção de salvar os valores atuais como um preset (nome + Save), aplicá-lo e apagá-lo (com confirmação antes de excluir). Criado um preset fixo chamado "Default", que não pode ser editado nem apagado — serve como reset rápido.

Atalho de teclado

Adicionado atalho de teclado global por preset: basta clicar no botão, pressionar a combinação desejada e pronto. Esc cancela, e há um botão para limpar o atalho.

Bandeja do sistema

Adicionado um ícone na bandeja do sistema, já que o atalho só funciona com o app aberto: fechar a janela agora apenas a minimiza, e é possível encerrar o app de vez pelo menu da bandeja (Quit).


Foi necessário adicionar a dependência kf6-kglobalaccel-devel para compilar, usada pelos atalhos globais.

Para testar: rodar make run, criar/aplicar/apagar presets, definir um atalho e testá-lo com a janela minimizada, e fechar a janela para confirmar que o app permanece na bandeja.

# Presets, atalho de teclado e bandeja do sistema Adicionado suporte a presets de gamma/contraste/brilho, atalhos de teclado globais por preset e um ícone na bandeja do sistema, para o app continuar rodando em segundo plano. ## Presets Adicionada a opção de salvar os valores atuais como um preset (nome + Save), aplicá-lo e apagá-lo (com confirmação antes de excluir). Criado um preset fixo chamado "Default", que não pode ser editado nem apagado — serve como reset rápido. ## Atalho de teclado Adicionado atalho de teclado global por preset: basta clicar no botão, pressionar a combinação desejada e pronto. Esc cancela, e há um botão para limpar o atalho. ## Bandeja do sistema Adicionado um ícone na bandeja do sistema, já que o atalho só funciona com o app aberto: fechar a janela agora apenas a minimiza, e é possível encerrar o app de vez pelo menu da bandeja (Quit). --- Foi necessário adicionar a dependência `kf6-kglobalaccel-devel` para compilar, usada pelos atalhos globais. Para testar: rodar `make run`, criar/aplicar/apagar presets, definir um atalho e testá-lo com a janela minimizada, e fechar a janela para confirmar que o app permanece na bandeja.
KGlobalAccel is needed for per-preset global shortcuts, and Qt Widgets
because Qt.labs.platform's SystemTrayIcon is backed by KStatusNotifierItem
under Plasma, which builds a QMenu internally.
A plain QGuiApplication aborts when Qt.labs.platform's SystemTrayIcon
tries to build its KStatusNotifierItem-backed QMenu. Also set the
desktop file name to match the shipped org.kde.kgamma_wayland.desktop,
improving tray/taskbar icon and window-class matching under Wayland.
Presets are now keyed by a stable id (QUuid) instead of by name, since
the id backs a per-preset QAction registered with KGlobalAccel whose
objectName must never change once a shortcut is bound to it.

- savePreset/applyPreset/deletePreset now take an id.
- setPresetShortcut/clearPresetShortcut bind or clear a global shortcut
  via KGlobalAccel, which persists the actual key sequence itself.
- A pinned "default" preset (gamma/contrast/brightness = 1/1/0) is
  auto-seeded if missing and can't be deleted.
- Presets saved by a previous version (no id field) get one synthesized
  on first load.
- The presetNames string list is replaced by a presets property exposing
  id/name/gamma/contrast/brightness/isDefault/shortcutText per preset.
Closing the window now hides it instead of quitting, and a
Qt.labs.platform.SystemTrayIcon (Show/Hide/Quit menu) keeps the app
reachable so global preset shortcuts keep working in the background.
The org.kde.desktop QQC2 style draws a tick mark per stepSize unless
Kirigami.StyleHints.tickMarkStepSize is explicitly negative. With
stepSize 0.01 that rendered as a solid strip of tiny bars across the
groove, only becoming visible once QApplication properly initialized
the native style backend for the tray icon.
Replaces the earlier per-row preset list with a single ComboBox plus
Delete/Set Shortcut/Apply buttons acting on the selected preset (Delete
disabled, not hidden, for the pinned Default preset). Selection is
tracked by preset id in QML and re-synced whenever the presets property
rebuilds, since ComboBox.currentIndex would otherwise reset on every
underlying model refresh.

Adds a Kirigami.PromptDialog confirming preset deletion, and a
Kirigami.Dialog shortcut recorder that captures a raw key combination
via Keys.onPressed and forwards it to setPresetShortcut (Escape cancels,
a "Clear Shortcut" footer action clears an existing binding).

Also renames the main window's own Apply button to "Apply Adjustments"
so it no longer reads the same as the preset row's "Apply" button.
Needed for the global preset shortcuts feature.
maot merged commit d81e9a0a2d into main 2026-08-04 00:54:53 +00:00
maot deleted branch feature/presets-shortcuts-tray 2026-08-04 00:54:53 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
maot/kgamma-2-ng!1
No description provided.