diff --git a/extensions/punto/CHANGELOG.md b/extensions/punto/CHANGELOG.md index ef546900c7d07..69f6dd010fa64 100644 --- a/extensions/punto/CHANGELOG.md +++ b/extensions/punto/CHANGELOG.md @@ -1,5 +1,9 @@ # Punto Changelog +## [Ua layout mapping] - 2025-02-04 + +- Added Ukrainian layout mapping to dropdown + ## [Ru layout mapping] - 2025-02-03 - Replaced ru layout preference with a dropdown to map layout caption with names diff --git a/extensions/punto/README.md b/extensions/punto/README.md index db757335ab34a..73ff90a9b44ad 100644 --- a/extensions/punto/README.md +++ b/extensions/punto/README.md @@ -2,15 +2,16 @@ ![](media/example.png) -Changes the layout of selected text to the opposite one and additionally changes the keyboard layout to a target one with the help of the [keyboardSwitcher](https://github.com/Lutzifer/keyboardSwitcher) +Changes the layout of selected text to the opposite one and additionally changes the keyboard layout to a target one using MacOS built-in capabilities. -Supported languages: -- English -- Russian +Supported keyboard layouts: +- Latin (English or any else) +- Cyrillic (Russian/Ukranian) Limitations: - If the cursor was at the end of the line, the `getSelectedText` function will return the whole line instead of selection and the switched layout text will appear right after the cursor +- If a required layout is not selectable in the dropdown, you can request it by raising an [issues](https://github.com/raycast/extensions/issues) to Punto extension Recommended Hotkey: Option+Option (To apply, just hit the Option button 2 times) diff --git a/extensions/punto/package.json b/extensions/punto/package.json index f9b3c98f7dbaa..a84394a26d160 100644 --- a/extensions/punto/package.json +++ b/extensions/punto/package.json @@ -42,9 +42,9 @@ "default": "control" }, { - "name": "ruLayoutName", - "title": "Russian Layout", - "description": "The name of the Russian layout", + "name": "cyrLayoutName", + "title": "Cyrillic Layout", + "description": "The name of the Cyrillic layout", "type": "dropdown", "required": true, "data": [ @@ -59,14 +59,25 @@ { "title": "Russian - QWERTY", "value": "Russian - Phonetic" + }, + { + "title": "Ukrainian", + "value": "Ukrainian - PC" + }, + { + "title": "Ukrainian - Legacy", + "value": "Ukrainian" + }, + { + "title": "Ukrainian - QWERTY", + "value": "Ukrainian-QWERTY" } - ], - "default": "Russian" + ] }, { - "name": "enLayoutName", - "title": "English Layout", - "description": "The name of the English layout", + "name": "latLayoutName", + "title": "Latin Layout", + "description": "The name of the Latin layout", "type": "textfield", "required": true, "default": "ABC" diff --git a/extensions/punto/src/index.ts b/extensions/punto/src/index.ts index 6949c0ac67ca2..38e24a938a8ae 100644 --- a/extensions/punto/src/index.ts +++ b/extensions/punto/src/index.ts @@ -11,14 +11,14 @@ import { promisify } from "util"; const exec = promisify(Exec); interface Preferences { layoutSwitchModifier: string; - enLayoutName: string; - ruLayoutName: string; + latLayoutName: string; + cyrLayoutName: string; showSuccessHUD: boolean; } enum Layout { - EN = "EN", - RU = "RU", + LAT = "LAT", + CYR = "CYR", } export default async function main() { @@ -57,9 +57,9 @@ async function switchKeyboardLayout( // console.log("installed layout names are " + languages.join(", ")); // console.log("target layout is " + targetLayout); const targetLayoutName = - targetLayout === Layout.EN - ? preferences.enLayoutName - : preferences.ruLayoutName; + targetLayout === Layout.LAT + ? preferences.latLayoutName + : preferences.cyrLayoutName; if (!languages.includes(targetLayoutName)) { await showHUD( "Layout " + @@ -108,7 +108,7 @@ function detectLayout(input: string): Layout { const array = input.split(""); const enChars = array.filter((c) => en_ru.has(c)).length; const ruChars = array.filter((c) => ru_en.has(c)).length; - return enChars > ruChars ? Layout.EN : Layout.RU; + return enChars > ruChars ? Layout.LAT : Layout.CYR; } function switchCharacterLayout(char: string): string {