diff --git a/package.json b/package.json index 6bf4445..eb2393d 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "naive-ui": "^2.39.0", "typescript": "^5.5.4", "vite": "^5.4.2", + "vooks": "^0.2.12", "vue": "^3.4.38", "vue-tsc": "^2.0.29" } diff --git a/src/BasicConfig.vue b/src/BasicConfig.vue new file mode 100644 index 0000000..604aee3 --- /dev/null +++ b/src/BasicConfig.vue @@ -0,0 +1,81 @@ + + + diff --git a/src/InputMethodConfig.vue b/src/InputMethodConfig.vue index bf50374..5f9119f 100644 --- a/src/InputMethodConfig.vue +++ b/src/InputMethodConfig.vue @@ -4,6 +4,7 @@ import type { MenuOption } from 'naive-ui' import { NButton, NCheckbox, NCheckboxGroup, NFlex, NLayout, NLayoutFooter, NLayoutSider, NMenu } from 'naive-ui' import MinusButton from './MinusButton.vue' import PlusButton from './PlusButton.vue' +import BasicConfig from './BasicConfig.vue' const languageName = new Intl.DisplayNames(navigator.language, { type: 'language' }) @@ -15,9 +16,13 @@ const props = defineProps<{ displayName: string name: string }[] + onClose: () => void }>() const selectedInputMethod = ref(props.inputMethod) +const uri = computed(() => `fcitx://config/inputmethod/${selectedInputMethod.value}`) + +const config = computed(() => window.fcitx.getConfig(uri.value)) const options = computed(() => props.inputMethods.map(({ displayName, name }) => ({ @@ -128,6 +133,17 @@ const filteredLanguageOptions = computed(() => { } return languageOptions.value }) + +const basicConfig = ref() + +function apply() { + window.fcitx.setConfig(uri.value, basicConfig.value.get()) +} + +function confirm() { + apply() + props.onClose() +} -
- {{ selectedInputMethod }} -
+ diff --git a/src/option/BooleanOption.vue b/src/option/BooleanOption.vue new file mode 100644 index 0000000..df70213 --- /dev/null +++ b/src/option/BooleanOption.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/option/IntegerOption.vue b/src/option/IntegerOption.vue new file mode 100644 index 0000000..14ae5a0 --- /dev/null +++ b/src/option/IntegerOption.vue @@ -0,0 +1,23 @@ + + + diff --git a/src/option/UnknownOption.vue b/src/option/UnknownOption.vue new file mode 100644 index 0000000..abba1a9 --- /dev/null +++ b/src/option/UnknownOption.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/util.ts b/src/util.ts new file mode 100644 index 0000000..e298bab --- /dev/null +++ b/src/util.ts @@ -0,0 +1,5 @@ +import { computed } from 'vue' +import { useBreakpoint } from 'vooks' + +const breakpoint = useBreakpoint() +export const isMobile = computed(() => breakpoint.value === 'xs' || breakpoint.value === 's') diff --git a/vite.config.ts b/vite.config.ts index 0b6c740..f4f6b69 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,6 +13,7 @@ export default defineConfig({ external: [ 'vue', 'naive-ui', + 'vooks', ], }, },