[+] update pr34
1. add dark/light mode
changing via gsettings
for GTK, wayland;
This commit is contained in:
parent
169ed5cebc
commit
8a7de59e73
8
Makefile
8
Makefile
@ -51,6 +51,14 @@ python_put_dist:
|
||||
done
|
||||
ln -sf $(INSTALL_ROOT)/env3/bin/online-fxreader-pr34-commands $(INSTALL_ROOT)/commands
|
||||
|
||||
python_put_pr34:
|
||||
$(INSTALL_ROOT)/env3/bin/python3 -m uv pip install $(UV_ARGS) \
|
||||
-f releases/whl \
|
||||
-U \
|
||||
online.fxreader.pr34
|
||||
ln -sf $(INSTALL_ROOT)/env3/bin/online-fxreader-pr34-commands $(INSTALL_ROOT)/commands
|
||||
|
||||
|
||||
PYTHON_PROJECTS_NAMES ?= online.fxreader.pr34
|
||||
python_whl:
|
||||
for f in $(PYTHON_PROJECTS_NAMES); do \
|
||||
|
||||
2
deps/com.github.aiortc.aiortc
vendored
2
deps/com.github.aiortc.aiortc
vendored
@ -1 +1 @@
|
||||
Subproject commit adef10a8c41f5c550622879370a40f8a9e545574
|
||||
Subproject commit 4c187fc7dd17c52fb8e4f992d3985eb609eefe6a
|
||||
2
deps/online.fxreader.nartes.books
vendored
2
deps/online.fxreader.nartes.books
vendored
@ -1 +1 @@
|
||||
Subproject commit 3c691ef68d8899edf328d5b06135c0d3b02e7940
|
||||
Subproject commit f2366f328fb8129fa6ae26d00b421025d2f090c7
|
||||
@ -5,7 +5,7 @@ project(
|
||||
).stdout().strip('\n'),
|
||||
# 'online.fxreader.uv',
|
||||
# ['c', 'cpp'],
|
||||
version: '0.1.5.32',
|
||||
version: '0.1.5.38',
|
||||
# default_options: [
|
||||
# 'cpp_std=c++23',
|
||||
# # 'prefer_static=true',
|
||||
|
||||
@ -3979,6 +3979,7 @@ class Command(enum.Enum):
|
||||
backup = 'backup'
|
||||
pip_resolve = 'pip_resolve'
|
||||
pip_check_conflicts = 'pip_check_conflicts'
|
||||
color_scheme = 'color_scheme'
|
||||
|
||||
|
||||
def pip_check_conflicts(
|
||||
@ -4148,6 +4149,10 @@ def commands_cli(argv: Optional[list[str]] = None) -> int:
|
||||
backup(args)
|
||||
elif options.command is Command.scrap_yt_music:
|
||||
scrap_yt_music(args)
|
||||
elif options.command is Command.color_scheme:
|
||||
from .commands_typed.color_scheme import run as color_scheme
|
||||
|
||||
color_scheme(args)
|
||||
elif options.command is Command.vpn:
|
||||
vpn(args)
|
||||
else:
|
||||
|
||||
93
python/online/fxreader/pr34/commands_typed/color_scheme.py
Normal file
93
python/online/fxreader/pr34/commands_typed/color_scheme.py
Normal file
@ -0,0 +1,93 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
import logging
|
||||
from typing import (
|
||||
Literal,
|
||||
Optional,
|
||||
)
|
||||
|
||||
import argparse
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def run(argv: list[str]) -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'action',
|
||||
choices=[
|
||||
'toggle',
|
||||
'dark',
|
||||
'light',
|
||||
'get',
|
||||
],
|
||||
# required=True,
|
||||
type=str,
|
||||
help='action',
|
||||
)
|
||||
from .argparse import parse_args as pr34_parse_args
|
||||
|
||||
options, args = pr34_parse_args(parser, argv)
|
||||
assert len(args) == 0
|
||||
|
||||
def get_theme() -> Literal['light', 'dark', 'default']:
|
||||
res = (
|
||||
subprocess.check_output(
|
||||
[
|
||||
'gsettings',
|
||||
'get',
|
||||
'org.gnome.desktop.interface',
|
||||
'color-scheme',
|
||||
]
|
||||
)
|
||||
.decode('utf-8')
|
||||
.strip()
|
||||
)
|
||||
|
||||
if res == "'prefer-dark'":
|
||||
return 'dark'
|
||||
elif res == "'prefer-light'":
|
||||
return 'light'
|
||||
elif res == "'default'":
|
||||
return 'default'
|
||||
else:
|
||||
logger.error(dict(res=res, msg='unknown theme'))
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
def set_theme(theme: Literal['light', 'dark', 'default']) -> None:
|
||||
if theme == 'light':
|
||||
subprocess.check_call(['gsettings', 'set', 'org.gnome.desktop.interface', 'color-scheme', 'prefer-light'])
|
||||
elif theme == 'dark':
|
||||
subprocess.check_call(['gsettings', 'set', 'org.gnome.desktop.interface', 'color-scheme', 'prefer-dark'])
|
||||
elif theme == 'default':
|
||||
subprocess.check_call(
|
||||
[
|
||||
'gsettings',
|
||||
'reset',
|
||||
'org.gnome.desktop.interface',
|
||||
'color-scheme',
|
||||
]
|
||||
)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
def toggle() -> None:
|
||||
theme = get_theme()
|
||||
if theme in ('light', 'default'):
|
||||
set_theme('dark')
|
||||
else:
|
||||
set_theme('light')
|
||||
|
||||
if options.action == 'toggle':
|
||||
toggle()
|
||||
elif options.action == 'dark':
|
||||
set_theme('dark')
|
||||
elif options.action == 'light':
|
||||
set_theme('light')
|
||||
elif options.action == 'get':
|
||||
sys.stdout.write(json.dumps(get_theme()))
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
raise NotImplementedError
|
||||
BIN
releases/whl/online_fxreader_pr34-0.1.5.33-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.33-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.34-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.34-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.35-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.35-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.36-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.36-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.37-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.37-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.38-py3-none-any.whl
(Stored with Git LFS)
Normal file
BIN
releases/whl/online_fxreader_pr34-0.1.5.38-py3-none-any.whl
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user