Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.vscode
*vscode*

# pycharm
.idea

# ruff formatter
.ruff*/

Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.9
hooks:
- id: ruff
args: [--config, ruff.toml]
- id: ruff-format
args: [--config, ruff.toml]
16 changes: 8 additions & 8 deletions fabric/audio/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ def do_list_stream_type(
return rlist

def on_default_stream_changed(self, id: int, type: str):
logger.info(f"[Audio][{type.title()}] Changing default {type} to {id}")
# logger.info(f"[Audio][{type.title()}] Changing default {type} to {id}")

if (old_strm := self.__getattribute__(f"_{type}")) is not None:
logger.info(f"[Audio][{type.title()}] Removing old {type} stream")
# logger.info(f"[Audio][{type.title()}] Removing old {type} stream")
try:
hndlr_id = self.__getattribute__(f"_{type}_connection")
old_strm.handler_disconnect(hndlr_id)
Expand Down Expand Up @@ -304,9 +304,9 @@ def on_stream_added(self, _, stream_id: int):
"changed", lambda *_: self.changed()
)

logger.info(
f"[Audio][{audio_stream.type.title()}] Adding stream {stream_id} with name {audio_stream.name}"
)
# logger.info(
# f"[Audio][{audio_stream.type.title()}] Adding stream {stream_id} with name {audio_stream.name}"
# )
self.do_notify_streams(stream)
return self.changed()

Expand All @@ -317,9 +317,9 @@ def on_stream_removed(self, _, stream_id: int):
audio_stream = self._streams.pop(stream_id)
audio_stream.handler_disconnect(self._stream_connectors.pop(stream_id)) # type: ignore

logger.info(
f"[Audio][{audio_stream.type.title()}] Removing stream {stream_id} with name {audio_stream.name}"
)
# logger.info(
# f"[Audio][{audio_stream.type.title()}] Removing stream {stream_id} with name {audio_stream.name}"
# )
self.do_notify_streams(audio_stream.stream)
audio_stream.close()
return self.changed()
Expand Down
17 changes: 16 additions & 1 deletion fabric/system_tray/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import gi
from loguru import logger
from pathlib import Path
from typing import NamedTuple, Literal, Any, cast
from fabric.core.service import Service, Signal, Property
from fabric.utils.helpers import load_dbus_xml, bulk_connect, get_enum_member
Expand Down Expand Up @@ -174,8 +175,22 @@ def get_preferred_icon_pixbuf(
preferred_icon_name = icon_name
preferred_icon_pixmap = icon_pixmap

icon_theme = self.icon_theme
# Some apps return an absolute path instead of the icon name
if preferred_icon_pixmap is None and preferred_icon_name:
path = Path(preferred_icon_name)
if path.is_absolute() and path.exists():
try:
target = size if size is not None else 24
return GdkPixbuf.Pixbuf.new_from_file_at_scale(
str(path),
target,
target,
True,
)
except GLib.GError:
return None

icon_theme = self.icon_theme
icon_theme_sizes: list | None = (
icon_theme.get_icon_sizes(preferred_icon_name)
if preferred_icon_name is not None
Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[project]
name = "fabric"
version = "0.0.2"
dependencies = ["click", "loguru", "pycairo", "PyGObject==3.50.0"]
dependencies = [
"click",
"loguru",
"psutil>=7.2.2",
"pycairo",
"pygobject==3.50.0",
"pygobject-stubs>=2.16.0",
]
requires-python = ">=3.11"
authors = [
{ name = "Yousef El-Darsh", email = "yousef.eldarsh@gmail.com" },
Expand Down
Loading