Skip to content

Add layout-fixer extension - #30165

Open
ramysami wants to merge 3 commits into
raycast:mainfrom
ramysami:ext/layout-fixer
Open

Add layout-fixer extension#30165
ramysami wants to merge 3 commits into
raycast:mainfrom
ramysami:ext/layout-fixer

Conversation

@ramysami

@ramysami ramysami commented Aug 12, 2026

Copy link
Copy Markdown

Description

Adds Layout Fixer, a single no-view command that fixes text typed with the wrong keyboard layout.

You meant to type مرحبا, but the keyboard was still on English, so the screen says lnpfh. Run the command and it becomes مرحبا. It works the other way too — اثممخ typed on a stuck Arabic layout becomes hello.

Behaviour

Situation What happens
Text is selected The selection is converted in place
Nothing selected, cursor in a text field The whole field is selected and converted
Neither A HUD says there's nothing to fix; nothing is touched

Direction is detected automatically by counting script, so there's no "to Arabic" / "to English" choice to make, and running the command twice returns the original text.

Screencast

ezgif-3ba6ebce7ff168f5

Checklist

@raycastbot

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a cross-platform, no-view Layout Fixer command that converts selected or focused-field text between English and Arabic keyboard layouts.

  • Provides separate macOS and Windows Arabic key maps with automatic direction and platform detection.
  • Uses platform-specific synthetic Select All and selection-collapse helpers for the whole-field fallback.
  • Adds extension metadata, documentation, changelog, assets, and standard build/lint configuration.

Confidence Score: 4/5

The selection-scope bug should be fixed before merging because an explicitly selected whitespace region can cause the entire focused field to be converted and overwritten.

The command conflates an existing whitespace-only selection with an absent selection, activates Select All, and can paste converted content over a broader scope than the user selected.

Files Needing Attention: extensions/layout-fixer/src/fix-layout.ts

Important Files Changed

Filename Overview
extensions/layout-fixer/src/fix-layout.ts Implements selection acquisition, whole-field fallback, conversion, and replacement, but mistakes an explicit whitespace-only selection for no selection and can consequently replace the whole field.
extensions/layout-fixer/src/keystrokes.ts Adds fixed macOS and Windows synthetic keystrokes for Select All and collapsing a selection; no independent defect was established.
extensions/layout-fixer/src/layouts.ts Defines the two keyboard maps, reverse sequence handling, script detection, and conversion; documented ambiguous mappings are handled consistently.
extensions/layout-fixer/package.json Declares a valid no-view command, supported platforms, layout preference, category, schema, and required dependencies.
extensions/layout-fixer/README.md Documents usage, platform behavior, layout differences, safeguards, and known mapping ambiguities.
Prompt To Fix All With AI
### Issue 1
extensions/layout-fixer/src/fix-layout.ts:43
**Whitespace Selection Expands Scope**

When the user explicitly selects only spaces, tabs, or line breaks, `source.trim()` treats that selection as absent and sends Select All, causing the command to convert and overwrite the entire focused field instead of operating on the selected region.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Remove tools/make_icon.py from the exten..." | Re-trigger Greptile


// Nothing selected — assume the cursor is sitting in a field and take all
// of it. Raycast has to be out of the way first for the keystroke to land.
if (!source.trim()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Whitespace Selection Expands Scope

When the user explicitly selects only spaces, tabs, or line breaks, source.trim() treats that selection as absent and sends Select All, causing the command to convert and overwrite the entire focused field instead of operating on the selected region.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/layout-fixer/src/fix-layout.ts
Line: 43

Comment:
**Whitespace Selection Expands Scope**

When the user explicitly selects only spaces, tabs, or line breaks, `source.trim()` treats that selection as absent and sends Select All, causing the command to convert and overwrite the entire focused field instead of operating on the selected region.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@ramysami
ramysami marked this pull request as ready for review August 12, 2026 14:22
@pernielsentikaer

Copy link
Copy Markdown
Collaborator

Similar extensions already in the Store

Automated first pass. Overlap is not a blocker on its own, but the README should make the difference clear.

  • Fix Language (fix-language, 610 installs by @hiiamtin) — Switch the language input source of the text when you type and forget to change the language.
    similarity 0.57

@ramysami

Copy link
Copy Markdown
Author

Similar extensions already in the Store

Automated first pass. Overlap is not a blocker on its own, but the README should make the difference clear.

  • Fix Language (fix-language, 610 installs by @hiiamtin) — Switch the language input source of the text when you type and forget to change the language.
    similarity 0.57

Appreciating your reply.
fix-language extension is only for Thai and also does not work if there are no selection to select the whole text input area.

Also could you make it more clear to me what should I change in the README.

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants