[SCRIPT] Updated

This commit is contained in:
t
2025-03-31 20:14:11 +02:00
parent 810f54cb65
commit 314a27eb42
472 changed files with 11721 additions and 921 deletions
+13
View File
@@ -0,0 +1,13 @@
from .about import AboutEntry
from .appearance import AppearanceEntry
from .notifications import NotificationsEntry
from .recorder import RecorderEntry
from .user import UserEntry
__all__ = [
"AboutEntry",
"AppearanceEntry",
"NotificationsEntry",
"RecorderEntry",
"UserEntry",
]
+52
View File
@@ -0,0 +1,52 @@
from ..elements import SettingsPage, SettingsRow, SettingsEntry, SettingsGroup
from ignis.utils import Utils
from ignis.widgets import Widget
from ignis.services.fetch import FetchService
from user_options import user_options
fetch = FetchService.get_default()
class AboutEntry(SettingsEntry):
def __init__(self):
page = SettingsPage(
name="About",
groups=[
Widget.Box(
child=[
Widget.Picture(
image=user_options.material.bind(
"dark_mode",
transform=lambda value: fetch.os_logo_text_dark
if value
else fetch.os_logo_text,
),
width=300,
height=100,
)
],
halign="center",
width_request=300,
height_request=100,
),
SettingsGroup(
name="Info",
rows=[
SettingsRow(label="OS", sublabel=fetch.os_name),
SettingsRow(
label="Ignis version", sublabel=Utils.get_ignis_version()
),
SettingsRow(label="Session type", sublabel=fetch.session_type),
SettingsRow(
label="Wayland compositor", sublabel=fetch.current_desktop
),
SettingsRow(label="Kernel", sublabel=fetch.kernel),
],
),
],
)
super().__init__(
label="About",
icon="help-about-symbolic",
page=page,
)
@@ -0,0 +1,67 @@
import os
from services.material import MaterialService
from ..elements import SwitchRow, SettingsPage, SettingsGroup, FileRow, SettingsEntry
from ignis.widgets import Widget
from user_options import user_options
from ignis.options import options
material = MaterialService.get_default()
class AppearanceEntry(SettingsEntry):
def __init__(self):
page = SettingsPage(
name="Appearance",
groups=[
SettingsGroup(
name=None,
rows=[
Widget.ListBoxRow(
child=Widget.Picture(
image=options.wallpaper.bind("wallpaper_path"),
width=1920 // 4,
height=1080 // 4,
halign="center",
style="border-radius: 1rem;",
content_fit="cover",
),
selectable=False,
activatable=False,
),
SwitchRow(
label="Dark mode",
active=user_options.material.bind("dark_mode"),
on_change=lambda x,
state: user_options.material.set_dark_mode(state),
style="margin-top: 1rem;",
),
FileRow(
label="Wallpaper path",
button_label=os.path.basename(
options.wallpaper.wallpaper_path
)
if options.wallpaper.wallpaper_path
else None,
dialog=Widget.FileDialog(
on_file_set=lambda x, file: material.generate_colors(
file.get_path()
),
initial_path=options.wallpaper.bind("wallpaper_path"),
filters=[
Widget.FileFilter(
mime_types=["image/jpeg", "image/png"],
default=True,
name="Images JPEG/PNG",
)
],
),
),
],
)
],
)
super().__init__(
label="Appearance",
icon="preferences-desktop-wallpaper-symbolic",
page=page,
)
@@ -0,0 +1,45 @@
from ..elements import SwitchRow, SettingsPage, SettingsGroup, SpinRow, SettingsEntry
from ignis.options import options
class NotificationsEntry(SettingsEntry):
def __init__(self):
page = SettingsPage(
name="Notifications",
groups=[
SettingsGroup(
name="General",
rows=[
SwitchRow(
label="Do not disturb",
active=options.notifications.bind("dnd"),
on_change=lambda x, state: options.notifications.set_dnd(
state
),
),
SpinRow(
label="Maximum popups count",
sublabel="The first popup will automatically dismiss",
value=options.notifications.bind("max_popups_count"),
min=1,
on_change=lambda x,
value: options.notifications.set_max_popups_count(value),
),
SpinRow(
label="Popup timeout",
sublabel="Timeout before popup will be dismissed, in milliseconds.",
max=100000,
step=100,
value=options.notifications.bind("popup_timeout"),
on_change=lambda x,
value: options.notifications.set_popup_timeout(value),
),
],
)
],
)
super().__init__(
label="Notifications",
icon="notification-symbolic",
page=page,
)
+61
View File
@@ -0,0 +1,61 @@
from ..elements import (
SpinRow,
SettingsPage,
SettingsGroup,
EntryRow,
FileRow,
SettingsEntry,
)
from ignis.widgets import Widget
from ignis.options import options
class RecorderEntry(SettingsEntry):
def __init__(self):
page = SettingsPage(
name="Recorder",
groups=[
SettingsGroup(
name="General",
rows=[
SpinRow(
label="Recording bitrate",
sublabel="Affects the recording quality",
value=options.recorder.bind("bitrate"),
max=640000,
width=150,
on_change=lambda x, value: options.recorder.set_bitrate(
int(value)
),
step=1000,
),
FileRow(
label="Recording path",
button_label=options.recorder.bind("default_file_location"),
dialog=Widget.FileDialog(
on_file_set=lambda x,
file: options.recorder.set_default_file_location(
file.get_path()
),
select_folder=True,
initial_path=options.recorder.default_file_location,
),
),
EntryRow(
label="Recording filename",
sublabel="Support time formatting",
text=options.recorder.bind("default_filename"),
on_change=lambda x: options.recorder.set_default_filename(
x.text
),
width=200,
),
],
)
],
)
super().__init__(
label="Recorder",
icon="media-record-symbolic",
page=page,
)
+54
View File
@@ -0,0 +1,54 @@
import os
from ..elements import SettingsGroup, SettingsPage, SettingsEntry, FileRow
from ignis.widgets import Widget
from user_options import user_options
class UserEntry(SettingsEntry):
def __init__(self):
page = SettingsPage(
name="User",
groups=[
Widget.Box(
halign="start",
style="margin-left: 2rem;",
child=[
Widget.Picture(
image=user_options.user.bind(
"avatar",
lambda value: "user-info"
if not os.path.exists(value)
else value,
),
width=96,
height=96,
style="border-radius: 10rem;",
),
Widget.Label(
label=os.getenv("USER"), css_classes=["settings-user-name"]
),
],
),
SettingsGroup(
style="margin-top: 2rem;",
valign="start",
name="General",
vexpand=True,
rows=[
FileRow(
label="Avatar",
dialog=Widget.FileDialog(
initial_path=user_options.user.bind("avatar"),
on_file_set=lambda x,
gfile: user_options.user.set_avatar(gfile.get_path()),
),
)
],
),
],
)
super().__init__(
label="User",
icon="user-available-symbolic",
page=page,
)