10 Commits
pre-v1 ... v1.0

Author SHA1 Message Date
admin
aa5dadc302 config v1 fix 2026-05-24 03:19:38 +00:00
admin
7d67d4a74d start v1 fix 2026-05-24 03:19:10 +00:00
admin
d129c70c10 app v1 fix 2026-05-24 03:18:05 +00:00
admin
f962dd393e v1 2026-05-24 01:57:24 +00:00
admin
573c08a07c ui v1 2026-05-24 01:54:51 +00:00
admin
5270ef92c1 config v1 2026-05-24 01:54:31 +00:00
admin
8c7b9fe521 app v1 2026-05-24 01:54:09 +00:00
admin
599efb060e v1 2026-05-24 01:53:17 +00:00
admin
781283e628 v1 ui 2026-05-24 01:50:36 +00:00
admin
214531fc8e start v1 2026-05-24 01:50:04 +00:00
5 changed files with 234 additions and 109 deletions

View File

@@ -1,3 +1,10 @@
# overlaynote
## overlaynote
minimal note overlay
v1.0
---
*v1* <br>
<a href="https://git.backend-3.com/admin/overlaynote/releases">download</a>
minimal note overlay

View File

@@ -44,7 +44,7 @@ THEMES: Final[list[ThemePalette]] = [
),
ThemePalette(
name="yellow",
background="rgba(113,63,18,0.24)",
background="rgba(113,93,38,0.24)",
background_inactive="rgba(113,63,18,0.16)",
border_active="rgba(250,204,21,0.36)",
border_inactive="rgba(255,255,255,0.10)",

View File

@@ -37,9 +37,9 @@ DEFAULT_SETTINGS: Final[dict] = {
"enable_glass_blur": True,
"enable_animations": True,
"enable_shadow": True,
"opacity_active": 1.0,
"opacity_inactive": 0.96,
"opacity_dragging": 0.92,
"opacity_active": 0.99,
"opacity_inactive": 0.95,
"opacity_dragging": 0.98,
"focus_animation_ms": 180,
},
"editor": {
@@ -50,7 +50,7 @@ DEFAULT_SETTINGS: Final[dict] = {
"Arial",
"system-ui",
],
"font_size": 13,
"font_size": 15,
"preview_delay_ms": 700,
"save_debounce_ms": 500,
"max_note_size": 2_000_000,
@@ -83,14 +83,14 @@ DEFAULT_SETTINGS: Final[dict] = {
"startup_stabilize_ms": 80,
},
"appearance": {
"enable_mica": False,
"enable_acrylic": False,
"enable_glass_blur": False,
"enable_mica": True,
"enable_acrylic": True,
"enable_glass_blur": True,
"enable_animations": True,
"enable_shadow": False,
"opacity_active": 1.0,
"opacity_inactive": 0.98,
"opacity_dragging": 0.96,
"opacity_active": 0.99,
"opacity_inactive": 0.95,
"opacity_dragging": 0.98,
"focus_animation_ms": 120,
},
"editor": {
@@ -133,13 +133,13 @@ DEFAULT_SETTINGS: Final[dict] = {
"startup_stabilize_ms": 80,
},
"appearance": {
"enable_mica": False,
"enable_acrylic": False,
"enable_glass_blur": False,
"enable_mica": True,
"enable_acrylic": True,
"enable_glass_blur": True,
"enable_animations": False,
"enable_shadow": False,
"opacity_active": 1.0,
"opacity_inactive": 1.0,
"enable_shadow": True,
"opacity_active": 0.92,
"opacity_inactive": 0.98,
"opacity_dragging": 1.0,
"focus_animation_ms": 0,
},
@@ -158,7 +158,7 @@ DEFAULT_SETTINGS: Final[dict] = {
"enable_clickable_links": True,
"enable_antialiasing": True,
"enable_spellcheck": False,
"padding": 10,
"padding": 6,
},
"behavior": {
"enable_tray": True,

View File

@@ -1,4 +1,7 @@
# v3.1.0 app.py
import atexit
import signal
import traceback
import contextlib
import json
import logging
@@ -33,6 +36,7 @@ from PyQt6.QtGui import (
)
from PyQt6.QtWidgets import (
QApplication,
QFrame,
QMenu,
QSizeGrip,
@@ -137,6 +141,8 @@ class StickyNoteApp(AcrylicWindow):
def __init__(self):
super().__init__()
self._is_quitting = False
self._force_close = False
self._closing = False
@@ -172,19 +178,34 @@ class StickyNoteApp(AcrylicWindow):
self.configure_window()
self.build_tray()
self.restore_state()
self.apply_style()
QTimer.singleShot(
120,
self.initialize_effects,
)
QTimer.singleShot(
self.profile["window"][
"startup_stabilize_ms"
],
220,
self.build_tray,
)
QTimer.singleShot(
80,
self.restore_state,
)
QTimer.singleShot(
260,
self.apply_style,
)
QTimer.singleShot(
320,
self.finalize_startup,
)
self.register_shutdown_hooks()
def configure_font(self) -> None:
self.font_object = QFont()
@@ -249,6 +270,7 @@ class StickyNoteApp(AcrylicWindow):
QEasingCurve.Type.OutCubic
)
# v1.0.1 configure_window.py
def configure_window(self) -> None:
window = self.profile["window"]
@@ -262,10 +284,9 @@ class StickyNoteApp(AcrylicWindow):
window["min_height"],
)
self.setWindowFlags(
Qt.WindowType.Tool
| Qt.WindowType.WindowStaysOnTopHint
| Qt.WindowType.FramelessWindowHint
self.setWindowFlag(
Qt.WindowType.WindowStaysOnTopHint,
True,
)
self.setAttribute(
@@ -273,33 +294,22 @@ class StickyNoteApp(AcrylicWindow):
True,
)
self.setAutoFillBackground(False)
appearance = (
self.profile["appearance"]
self.setAttribute(
Qt.WidgetAttribute.WA_NoSystemBackground,
True,
)
self.setWindowFlag(
Qt.WindowType.WindowCloseButtonHint,
False,
)
self.setAutoFillBackground(
False
)
try:
if appearance[
"enable_mica"
]:
self.windowEffect.setMicaEffect(
self.winId(),
True,
)
elif appearance[
"enable_acrylic"
]:
self.windowEffect.setAcrylicEffect(
self.winId(),
"00000001",
)
except Exception:
logging.exception(
"window_effect_failure"
)
QTimer.singleShot(
120,
self.initialize_effects,
)
def build_ui(self) -> None:
self.root = QWidget(self)
@@ -311,7 +321,7 @@ class StickyNoteApp(AcrylicWindow):
self.layout = QVBoxLayout(
self.root
)
window = self.profile["window"]
margin = window[
@@ -434,7 +444,12 @@ class StickyNoteApp(AcrylicWindow):
| Qt.AlignmentFlag.AlignRight,
)
self.titleBar.hide()
self.editor.setFocus()
def build_tray(self) -> None:
if QSystemTrayIcon.isSystemTrayAvailable() is False:
return
if not self.profile[
"behavior"
]["enable_tray"]:
@@ -474,7 +489,7 @@ class StickyNoteApp(AcrylicWindow):
)
quit_action.triggered.connect(
self.close
self.safe_exit
)
menu.addAction(open_settings)
@@ -588,7 +603,40 @@ class StickyNoteApp(AcrylicWindow):
],
)
)
def initialize_effects(self) -> None:
appearance = (
self.profile["appearance"]
)
try:
hwnd = int(self.winId())
if not hwnd:
return
if appearance[
"enable_mica"
]:
self.windowEffect.setMicaEffect(
hwnd,
True,
)
elif appearance[
"enable_acrylic"
]:
self.windowEffect.setAcrylicEffect(
hwnd,
"00000001",
)
self.update()
self.repaint()
except Exception:
logging.exception(
"window_effect_failure"
)
def start_drag(
self,
global_pos: QPoint,
@@ -668,9 +716,14 @@ class StickyNoteApp(AcrylicWindow):
)
def show_preview(self) -> None:
if self.editor.hasFocus():
if (
self.editor.hasFocus()
or not self.isActiveWindow()
):
return
self.preview.setFocusPolicy(
Qt.FocusPolicy.NoFocus
)
markdown = (
self.editor.toPlainText()
)
@@ -844,25 +897,17 @@ class StickyNoteApp(AcrylicWindow):
"open_settings_failure"
)
def nativeEvent(
self,
eventType,
message,
):
if getattr(
self,
"_closing",
False,
):
return False, 0
def nativeEvent(self, eventType, message):
try:
return super().nativeEvent(
eventType,
message,
)
return super().nativeEvent(eventType, message)
except KeyboardInterrupt:
self.safe_exit()
return False, 0
except SystemExit:
self.safe_exit()
return False, 0
except Exception:
traceback.print_exc()
return False, 0
def resizeEvent(self, event) -> None:
@@ -921,22 +966,80 @@ class StickyNoteApp(AcrylicWindow):
)
def closeEvent(self, event) -> None:
self._closing = True
if self._is_quitting or self._force_close:
try:
self.save_state()
except Exception:
traceback.print_exc()
with contextlib.suppress(Exception):
event.accept()
return
event.ignore()
self.hide()
def register_shutdown_hooks(self) -> None:
app = QApplication.instance()
def handle_shutdown(*_) -> None:
self.safe_exit()
atexit.register(handle_shutdown)
for sig in (signal.SIGINT, signal.SIGTERM):
try:
signal.signal(sig, handle_shutdown)
except Exception:
pass
if app is not None:
app.aboutToQuit.connect(
lambda: setattr(
self,
"_is_quitting",
True,
)
)
def safe_exit(self) -> None:
if self._is_quitting:
return
self._is_quitting = True
try:
self.save_state()
except Exception:
traceback.print_exc()
with contextlib.suppress(Exception):
self.save_timer.stop()
try:
if hasattr(self, "save_timer"):
self.save_timer.stop()
with contextlib.suppress(Exception):
self.preview_timer.stop()
if hasattr(self, "preview_timer"):
self.preview_timer.stop()
except Exception:
traceback.print_exc()
with contextlib.suppress(Exception):
self.opacity_anim.stop()
with contextlib.suppress(Exception):
try:
if hasattr(self, "tray"):
self.tray.hide()
self.tray.deleteLater()
except Exception:
traceback.print_exc()
super().closeEvent(event)
try:
self.hide()
self.deleteLater()
except Exception:
traceback.print_exc()
app = QApplication.instance()
if app is not None:
app.quit()
try:
app.quit()
except:
sys.exit(0)

View File

@@ -1,36 +1,51 @@
# v1.0.3 start.py
import os
import sys
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1"
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
import signal
import sys
import traceback
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QGuiApplication
from PyQt6.QtWidgets import QApplication
from core.app import StickyNoteApp
QGuiApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)
def main() -> int:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
signal.signal(signal.SIGINT, signal.SIG_DFL)
QApplication.setQuitOnLastWindowClosed(False)
app = QApplication.instance()
if app is None:
app = QApplication(sys.argv)
app.setQuitLockEnabled(False)
existing = getattr(app, "_sticky_note_instance", None)
if existing is not None:
existing.raise_()
existing.activateWindow()
return 0
app = QApplication(sys.argv)
window = StickyNoteApp()
app._sticky_note_instance = window
window.show()
return app.exec()
try:
return app.exec()
except KeyboardInterrupt:
try:
window.safe_exit()
except Exception:
traceback.print_exc()
return 0
except SystemExit:
return 0
except Exception:
traceback.print_exc()
return 1
if __name__ == "__main__":
raise SystemExit(main())
raise SystemExit(main())