chore(root): migrate touv and simplify dependencies
New Features - Added uv as the primary package manager and introduced new system packages awww, apple-fonts, swappy, and wl-clipboard. - Removed many redundant Python packages from the install script. Enhancements - Replaced Pillow-based QR code detection with GdkPixbuf, eliminating the python-pillow dependency. - Fixed a typo in the import (`ConfigServic` → `ConfigService`) and corrected service imports. - Updated the application launch to use `uwsm app -- uv run main.py` for uv-managed execution. Bug Fixes - Resolved import typo that prevented proper ConfigService initialization. - Adjusted QR-code decoding logic to correctly handle image pixel channels, improving robustness.
This commit is contained in:
3 files changed
+24
-33
No files matched your search
+3
-21
@@ -21,39 +21,21 @@ REPO_URL="https://github.com/S4NKALP/Modus.git"
|
|||||||
INSTALL_DIR="$HOME/.config/Modus"
|
INSTALL_DIR="$HOME/.config/Modus"
|
||||||
|
|
||||||
PACKAGES=(
|
PACKAGES=(
|
||||||
python-fabric-git
|
uv
|
||||||
fabric-cli-git
|
fabric-cli-git
|
||||||
glace-git
|
glace-git
|
||||||
cliphist
|
cliphist
|
||||||
gnome-bluetooth-3.0
|
gnome-bluetooth-3.0
|
||||||
gobject-introspection
|
|
||||||
slurp
|
slurp
|
||||||
ffmpeg
|
ffmpeg
|
||||||
hypridle
|
hypridle
|
||||||
hyprsunset
|
hyprsunset
|
||||||
hyprpicker
|
hyprpicker
|
||||||
imagemagick
|
|
||||||
libnotify
|
libnotify
|
||||||
matugen-bin
|
matugen-bin
|
||||||
playerctl
|
playerctl
|
||||||
python-gobject
|
|
||||||
python-pillow
|
|
||||||
python-setproctitle
|
|
||||||
python-toml
|
|
||||||
python-requests
|
|
||||||
python-numpy
|
|
||||||
python-pywayland
|
|
||||||
python-pyxdg
|
|
||||||
python-ijson
|
|
||||||
python-watchdog
|
|
||||||
python-pyotp
|
|
||||||
pyzbar
|
|
||||||
python-psutil
|
|
||||||
python-pydbus
|
|
||||||
python-thefuzz
|
|
||||||
python-pam
|
|
||||||
gtk-session-lock
|
gtk-session-lock
|
||||||
swww
|
awww
|
||||||
apple-fonts
|
apple-fonts
|
||||||
swappy
|
swappy
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
@@ -349,7 +331,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
step "Starting Modus..."
|
step "Starting Modus..."
|
||||||
if uwsm app -- python "$INSTALL_DIR/main.py" >/dev/null 2>&1 & then
|
if uwsm app -- uv run "$INSTALL_DIR/main.py" >/dev/null 2>&1 & then
|
||||||
disown
|
disown
|
||||||
sleep 1
|
sleep 1
|
||||||
if pgrep -f "python.*main.py" >/dev/null; then
|
if pgrep -f "python.*main.py" >/dev/null; then
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ from .network import NetworkClient, Wifi, Ethernet, AccessPoint # noqa: F401
|
|||||||
from .mpris import MprisPlayer, MprisPlayerManager # noqa: F401
|
from .mpris import MprisPlayer, MprisPlayerManager # noqa: F401
|
||||||
from .todo import TodoService # noqa: F401
|
from .todo import TodoService # noqa: F401
|
||||||
from .modus import ModusService # noqa: F401
|
from .modus import ModusService # noqa: F401
|
||||||
from .config import on_config_change, start_config_service, ConfigServic # noqa: F401
|
from .config import on_config_change, start_config_service, ConfigService # noqa: F401
|
||||||
+20
-11
@@ -7,7 +7,7 @@ from pathlib import Path
|
|||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
import pyotp
|
import pyotp
|
||||||
from PIL import Image
|
from fabric.utils import GdkPixbuf
|
||||||
from pyzbar.pyzbar import decode
|
from pyzbar.pyzbar import decode
|
||||||
|
|
||||||
import config.data as data
|
import config.data as data
|
||||||
@@ -70,15 +70,14 @@ def read_and_save_to_json():
|
|||||||
|
|
||||||
# Open the captured image
|
# Open the captured image
|
||||||
try:
|
try:
|
||||||
img = Image.open(screenshot)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(screenshot)
|
||||||
except Exception as e:
|
pixels = pixbuf.get_pixels()
|
||||||
print("Error opening the image:", e)
|
channels = pixbuf.get_n_channels()
|
||||||
return False
|
gray_pixels = pixels[::channels]
|
||||||
|
decoded_objects = decode((gray_pixels, pixbuf.get_width(), pixbuf.get_height()))
|
||||||
# Decode QR Code(s) from the image
|
finally:
|
||||||
decoded_objects = decode(img)
|
del pixbuf
|
||||||
if not decoded_objects:
|
if not decoded_objects:
|
||||||
print("No QR Code detected in the selected area.")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
@@ -279,8 +278,18 @@ def scan_qr_and_add_account(account_name: str, secrets_file_path: str) -> dict:
|
|||||||
|
|
||||||
# Decode QR code
|
# Decode QR code
|
||||||
try:
|
try:
|
||||||
img = Image.open(screenshot_path)
|
try:
|
||||||
decoded_objects = decode(img)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(screenshot_path)
|
||||||
|
pixels = pixbuf.get_pixels()
|
||||||
|
channels = pixbuf.get_n_channels()
|
||||||
|
gray_pixels = pixels[::channels]
|
||||||
|
decoded_objects = decode(
|
||||||
|
(gray_pixels, pixbuf.get_width(), pixbuf.get_height())
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
# Delete pixbuf to free native memory immediately
|
||||||
|
if "pixbuf" in locals():
|
||||||
|
del pixbuf
|
||||||
|
|
||||||
if not decoded_objects:
|
if not decoded_objects:
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user