mirror of
http://100.103.83.12:3003/fegger/pineNoteShell.git
synced 2026-09-17 11:32:44 +00:00
Improve e-ink support with forced refreshes and no animations
- Add `einkRefresh()` helper calling `pdlc-cli --refresh` after rotation, brightness changes, waveform changes, and when the widget opens - Disable CSS transitions and animations globally to reduce ghosting - Remove button hover transform and transition effects - Update README with e-ink-specific guidance and tuning notes
This commit is contained in:
@@ -4,7 +4,7 @@ import app from "ags/gtk3/app"
|
||||
import { Astal, Gtk, Gdk } from "ags/gtk3"
|
||||
import { execAsync } from "ags/process"
|
||||
import { readFile } from "ags/file"
|
||||
import { createBinding, createState, createComputed } from "ags"
|
||||
import { createBinding, createState, createComputed, createEffect } from "ags"
|
||||
import Hyprland from "gi://AstalHyprland"
|
||||
import Brightness from "gi://AstalBrightness"
|
||||
|
||||
@@ -20,6 +20,14 @@ const notify = (msg) => execAsync(["notify-send", msg]).catch(console.error)
|
||||
const toTitleCase = (str) =>
|
||||
str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase())
|
||||
|
||||
// --- e-ink helpers --------------------------------------------------------
|
||||
|
||||
function einkRefresh() {
|
||||
// Trigger a full display refresh after actions that cause large visual changes.
|
||||
// Silently ignore failures if pdlc-cli is not installed.
|
||||
execAsync(["pdlc-cli", "--refresh"]).catch(() => {})
|
||||
}
|
||||
|
||||
// --- managers --------------------------------------------------------------
|
||||
|
||||
class BrightnessController {
|
||||
@@ -36,6 +44,8 @@ class BrightnessController {
|
||||
set(level) {
|
||||
if (!this.screen) return
|
||||
this.screen.brightness = level / 100
|
||||
// PineNote: force an e-ink refresh so the brightness change is visible
|
||||
einkRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +73,8 @@ class ScreenRotator {
|
||||
])
|
||||
|
||||
notify(`Screen rotated to ${rotation}`)
|
||||
// PineNote: e-ink needs an explicit refresh after rotation
|
||||
einkRefresh()
|
||||
} catch (err) {
|
||||
notify(`Failed to rotate screen: ${err.message}`)
|
||||
}
|
||||
@@ -139,6 +151,9 @@ class WaveformController {
|
||||
execAsync(["pdlc-cli", "--waveform", waveform]).catch((err) =>
|
||||
console.log(`Could not apply waveform: ${err.message}`),
|
||||
)
|
||||
|
||||
// PineNote: refresh after changing waveform mode
|
||||
einkRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +170,12 @@ function PinenoteShell() {
|
||||
|
||||
const [visible, setVisible] = createState(false)
|
||||
|
||||
// PineNote: when the widget is shown, force an e-ink refresh so the
|
||||
// overlay draws cleanly on the slow display.
|
||||
createEffect(() => {
|
||||
if (visible()) einkRefresh()
|
||||
})
|
||||
|
||||
const brightnessLevel = brightness.screen
|
||||
? createBinding(brightness.screen, "brightness")((v) => Math.round((v || 0) * 100))
|
||||
: createState(100)[0]
|
||||
|
||||
Reference in New Issue
Block a user