[Update] Add Transparency.
This commit is contained in:
24
src-ui/logics/configs/useTransparency.js
Normal file
24
src-ui/logics/configs/useTransparency.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useStore_Transparency } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useTransparency = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentTransparency, updateTransparency, pendingTransparency } = useStore_Transparency();
|
||||
|
||||
const getTransparency = () => {
|
||||
pendingTransparency();
|
||||
asyncStdoutToPython("/get/data/transparency");
|
||||
};
|
||||
|
||||
const setTransparency = (selected_transparency) => {
|
||||
pendingTransparency();
|
||||
asyncStdoutToPython("/set/data/transparency", selected_transparency);
|
||||
};
|
||||
|
||||
return {
|
||||
currentTransparency,
|
||||
getTransparency,
|
||||
updateTransparency,
|
||||
setTransparency,
|
||||
};
|
||||
};
|
||||
@@ -30,6 +30,7 @@ import { useSelectedFontFamily } from "@logics_configs/useSelectedFontFamily";
|
||||
import { useUiLanguage } from "@logics_configs/useUiLanguage";
|
||||
import { useUiScaling } from "@logics_configs/useUiScaling";
|
||||
import { useMessageLogUiScaling } from "@logics_configs/useMessageLogUiScaling";
|
||||
import { useTransparency } from "@logics_configs/useTransparency";
|
||||
|
||||
export const useReceiveRoutes = () => {
|
||||
const { updateIsMainPageCompactMode } = useIsMainPageCompactMode();
|
||||
@@ -77,6 +78,7 @@ export const useReceiveRoutes = () => {
|
||||
|
||||
const { updateMessageInputBoxRatio } = useMessageInputBoxRatio();
|
||||
const { updateSelectedFontFamily } = useSelectedFontFamily();
|
||||
const { updateTransparency } = useTransparency();
|
||||
|
||||
|
||||
const routes = {
|
||||
@@ -213,6 +215,9 @@ export const useReceiveRoutes = () => {
|
||||
"/get/data/font_family": updateSelectedFontFamily,
|
||||
"/set/data/font_family": updateSelectedFontFamily,
|
||||
|
||||
"/get/data/transparency": updateTransparency,
|
||||
"/set/data/transparency": updateTransparency,
|
||||
|
||||
// Others Tab
|
||||
"/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||
"/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||
|
||||
Reference in New Issue
Block a user