refactor(core): rename APP_NAME to 'modus', cleanup shared widgets

- Change APP_NAME from 'modus1' to 'modus' in shared/data.py
- Remove unused flat_scale widget
- Add missing imports in animator and customrevealer
- Delete src/utils/uinput.py (unused)
- Remove unused import in utils/functions.py
This commit is contained in:
sankalp committed 2026-07-12 20:18:05 +05:45
1 parent 94ed52f4b5
commit 66632f0989
7 files changed
+4 -112

No files matched your search

+1 -3
View File
@@ -572,9 +572,7 @@ def open_trash():
continue
# --- Occlusion (uses Hyprland API above) ---
# Occlusion
def check_occlusion(occlusion_region, workspace=None) -> bool:
if workspace is None:
workspace = get_active_workspace_id()
+1 -1
View File
@@ -4,7 +4,7 @@ from utils.functions import parse_timeout_string
from utils.utils import toml_file
HOME_DIR = GLib.get_home_dir()
APP_NAME = "modus1"
APP_NAME = "modus"
CACHE_DIR = str(GLib.get_user_cache_dir()) + f"/{APP_NAME}"
+1
View File
@@ -172,6 +172,7 @@ class Animator(Service):
self._max_value = 1.0
self._repeat = False
self._duration = 0.8
self._bezier_curve = (1, 1, 0, 0)
self._timing_function = timing_function
self._tick_widget = tick_widget
self._tick_interval = tick_interval
+1
View File
@@ -21,6 +21,7 @@ class SlideRevealer(Gtk.Overlay):
self.duration = duration
self.fixed_size = size
self._revealed = False
self._show_animation = False
self._cached_dimensions = None
self.animator = Animator(
-42
View File
@@ -8,10 +8,6 @@ from gi.repository import Pango, PangoCairo
from shared.widgets.animator import Animator, ease_in, ease_in_out, ease_out
# ------------------------------------------------------------------ #
# Helpers #
# ------------------------------------------------------------------ #
def _draw_rounded_rect(cr, x, y, w, h, r):
r = min(r, w / 2, h / 2)
@@ -31,11 +27,6 @@ def _draw_rounded_rect(cr, x, y, w, h, r):
cr.close_path()
# ------------------------------------------------------------------ #
# TypedDict #
# ------------------------------------------------------------------ #
class FlatScaleStyle(TypedDict):
slider_color: Gdk.RGBA
slider_height: float
@@ -52,11 +43,6 @@ class FlatScaleStyle(TypedDict):
background_color: Gdk.RGBA
# ------------------------------------------------------------------ #
# Widget #
# ------------------------------------------------------------------ #
class FlatScale(Gtk.DrawingArea, Widget):
"""
A Cairo-drawn linear scale widget for Fabric.
@@ -232,10 +218,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
if on_value_changed:
self.connect("value-changed", on_value_changed)
# ------------------------------------------------------------------ #
# Value #
# ------------------------------------------------------------------ #
@property
def value(self) -> float:
return self._value
@@ -254,10 +236,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
def get_value(self) -> float:
return self._value
# ------------------------------------------------------------------ #
# Realize / gadget contexts #
# ------------------------------------------------------------------ #
def _on_realize(self, _widget) -> None:
state = self.get_state_flags()
self._gadget_classes[self._slider_ctx] = None
@@ -298,10 +276,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
self._cached_style = None
self.queue_draw()
# ------------------------------------------------------------------ #
# Style resolution #
# ------------------------------------------------------------------ #
def do_get_border_width(
self, context: Gtk.StyleContext, state: Gtk.StateFlags
) -> float:
@@ -361,10 +335,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
return self._min_value + ratio * (self._max_value - self._min_value)
# ------------------------------------------------------------------ #
# Bubble animation helpers #
# ------------------------------------------------------------------ #
def _bubble_open(self):
self._bubble_closing = False
self._anim_bubble_close.pause()
@@ -396,10 +366,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
else:
self._bubble_progress = min(1.0, self._anim_bubble_open.value)
# ------------------------------------------------------------------ #
# Drawing helpers #
# ------------------------------------------------------------------ #
def do_draw_rounded_rect(self, cr, x, y, width, height, radius):
_draw_rounded_rect(cr, x, y, width, height, radius)
@@ -495,10 +461,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
cr.restore()
# ------------------------------------------------------------------ #
# Main draw #
# ------------------------------------------------------------------ #
def do_draw(self, cr: cairo.Context) -> bool:
styles = self.do_resolve_style()
@@ -622,10 +584,6 @@ class FlatScale(Gtk.DrawingArea, Widget):
return False
# ------------------------------------------------------------------ #
# Input events #
# ------------------------------------------------------------------ #
def _on_button_press(self, _widget, event: Gdk.EventButton) -> bool:
if event.button == 1:
self._dragging = True
-1
View File
@@ -369,7 +369,6 @@ def run_command(
return CommandResult(1, "", str(e))
def fuzzy_score(query: str, text: str) -> int:
"""
Fuzzy match scoring. Returns score > 0 if all query chars found in order.
-65
View File
@@ -1,65 +0,0 @@
"""Pure-Python mouse click simulation via /dev/uinput."""
import os
import struct
import time as _time
_UI_DEV_CREATE = 0x5501
_UI_SET_EVBIT = 0x40045564
_UI_SET_KEYBIT = 0x40045565
_UI_SET_RELBIT = 0x40045567
_EV_KEY = 0x01
_EV_REL = 0x02
_REL_X = 0x00
_REL_Y = 0x01
_BTN_LEFT = 0x110
_SYN_REPORT = 0
_ABS_CNT = 64
_INPUT_EVENT_FMT = "<qqHHi"
def uinput_click(x: int, y: int, move_first: bool = True) -> bool:
"""Move cursor to (x, y) and left-click using a virtual uinput mouse.
Returns True on success.
"""
try:
fd = os.open("/dev/uinput", os.O_WRONLY | os.O_NONBLOCK)
import fcntl
for cap in (_EV_KEY, _EV_REL):
fcntl.ioctl(fd, _UI_SET_EVBIT, cap)
fcntl.ioctl(fd, _UI_SET_KEYBIT, _BTN_LEFT)
for rel in (_REL_X, _REL_Y):
fcntl.ioctl(fd, _UI_SET_RELBIT, rel)
name = b"OpenCodeMouse\x00" + b"\x00" * 66
dev = name
dev += struct.pack("<HHHHI", 0x03, 0x1234, 0x5678, 1, 0)
dev += b"\x00" * (_ABS_CNT * 4 * 4)
os.write(fd, dev)
fcntl.ioctl(fd, _UI_DEV_CREATE)
_time.sleep(0.15)
def _emit(etype: int, code: int, value: int):
os.write(fd, struct.pack(_INPUT_EVENT_FMT, 0, 0, etype, code, value))
if move_first:
_emit(_EV_REL, _REL_X, x)
_emit(_EV_REL, _REL_Y, y)
_emit(_SYN_REPORT, 0, 0)
_time.sleep(0.03)
_emit(_EV_KEY, _BTN_LEFT, 1)
_emit(_SYN_REPORT, 0, 0)
_time.sleep(0.03)
_emit(_EV_KEY, _BTN_LEFT, 0)
_emit(_SYN_REPORT, 0, 0)
os.close(fd)
return True
except Exception:
return False