refactor: controla constelações por script de atalho
This commit is contained in:
parent
740c9b836b
commit
bfb8f31952
5 changed files with 26 additions and 12 deletions
|
|
@ -9,7 +9,6 @@ ColumnLayout {
|
|||
property alias cfg_ShowSkeleton: skeletonCheck.checked
|
||||
property alias cfg_BaladaMode: baladaCheck.checked
|
||||
property alias cfg_ChuvaMode: chuvaCheck.checked
|
||||
property alias cfg_ShowConstellations: constellationsCheck.checked
|
||||
property double cfg_Latitude
|
||||
property double cfg_Longitude
|
||||
|
||||
|
|
@ -38,12 +37,6 @@ ColumnLayout {
|
|||
onCheckedChanged: if (checked) baladaCheck.checked = false
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: constellationsCheck
|
||||
Kirigami.FormData.label: i18n("Constelações:")
|
||||
text: i18n("Ligar estrelas e mostrar os nomes")
|
||||
}
|
||||
|
||||
Kirigami.Separator { Kirigami.FormData.isSection: true }
|
||||
|
||||
// Observador do céu realista (aceita vírgula ou ponto decimal)
|
||||
|
|
|
|||
|
|
@ -1467,6 +1467,22 @@ function setShowConstellations(on) {
|
|||
projectSky();
|
||||
}
|
||||
|
||||
/* Estado controlado por toggle-constellations.sh. A primeira leitura também
|
||||
é aplicada, então o modo sobrevive a reloads do WebEngine. */
|
||||
let constellationsFileVal = null;
|
||||
(function pollConstellationsFile() {
|
||||
fetch('file:///tmp/skeledance-constellations?t=' + Date.now())
|
||||
.then(r => r.text())
|
||||
.then(t => {
|
||||
const v = t.trim();
|
||||
if (v === constellationsFileVal) return;
|
||||
constellationsFileVal = v;
|
||||
setShowConstellations(v === '1');
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => setTimeout(pollConstellationsFile, 800));
|
||||
})();
|
||||
|
||||
/* ── Passo de projeção: recalcula posições de tela (a cada 30s o céu gira
|
||||
~0.125°, imperceptível). Camada estática (Via Láctea + estrelas fracas)
|
||||
é pré-renderizada em baseCanvas; só as brilhantes cintilam por frame ── */
|
||||
|
|
@ -2332,6 +2348,7 @@ document.addEventListener('keydown', e => {
|
|||
if (!e.target.matches('input,textarea')) {
|
||||
if (e.key === 'b' || e.key === 'B') toggleBalada();
|
||||
if (e.key === 'r' || e.key === 'R') toggleChuva();
|
||||
if (e.key === 'c' || e.key === 'C') setShowConstellations(!showConstellations);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ WallpaperItem {
|
|||
webView.runJavaScript("setShowSkeleton(" + Plasmoid.configuration.ShowSkeleton + ")")
|
||||
webView.runJavaScript("setBaladaMode(" + Plasmoid.configuration.BaladaMode + ")")
|
||||
webView.runJavaScript("setChuvaMode(" + Plasmoid.configuration.ChuvaMode + ")")
|
||||
webView.runJavaScript("setShowConstellations(" + Plasmoid.configuration.ShowConstellations + ")")
|
||||
webView.runJavaScript("setObserverLocation(" + Plasmoid.configuration.Latitude + ","
|
||||
+ Plasmoid.configuration.Longitude + ")")
|
||||
}
|
||||
|
|
@ -21,7 +20,6 @@ WallpaperItem {
|
|||
function onShowSkeletonChanged() { applyConfig() }
|
||||
function onBaladaModeChanged() { applyConfig() }
|
||||
function onChuvaModeChanged() { applyConfig() }
|
||||
function onShowConstellationsChanged() { applyConfig() }
|
||||
function onLatitudeChanged() { applyConfig() }
|
||||
function onLongitudeChanged() { applyConfig() }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue