talonhub / community

Voice command set for Talon, community-supported.
MIT License
596 stars 761 forks source link

Rich text formatting commands #938

Open auscompgeek opened 1 year ago

auscompgeek commented 1 year ago

There are a few different rich text formatting commands scattered around the place.

For example, our Slack support defines several of its own formatting commands:

https://github.com/knausj85/knausj_talon/blob/000015ed1bd4cb1109d7d6ddaaa4146821821d70/apps/slack/slack_mac.talon#L31-L39

If we search for justify, we can find some Figma and PowerPoint .talon files that, among other things, define commands for text alignment and common text styles.

https://github.com/knausj85/knausj_talon/blob/273b7c9a62de6c12fe9baae175843eb6f0caab2b/apps/platforms/mac/powerpoint/powerpoint.talon#L15-L22

https://github.com/knausj85/knausj_talon/blob/f44077d19aafb8aca35be6d152c73a1252dfb837/apps/figma/figma.talon#L41-L56

(above are in forks, links edited to unfurl)

Searching for strike nets us the rest of the Microsoft Office suite, Evernote, and some Markdown and org-mode. Searching for bold and italic also finds some LaTeX support.

We should probably come up with a consistent grammar for basic rich text formatting. We probably want at least:

lab-do commented 1 year ago

I think we need a rich text formatting tag for it, something like this:

tag: user.rich_text
-

text left: user.text_align_left() 
text right: user.text_align_right() 
text center: user.text_align_center() 
text justify: user.text_align_justify()

text bold: user.text_font_bold()
text italic: user.text_font_italic()
text underline: user.text_font_underline()
text strikethrough: user.text_font_strikethrough()

text (big | bigger): user.text_font_size_up()
text (small | smaller): user.text_font_size_down()
text thicker: user.text_font_weight_up() 
text thinner: user.text_font_weight_down() 

text high: user.text_line_height_up()
text low: user.text_line_height_down()
rntz commented 1 year ago

See previously #159

rntz commented 1 year ago

Usual typographical terms for bolder/less bold are "heavier"/"lighter". Could use those as synonyms or replacements for "thicker"/"thinner". Might also want more synonyms:

text [align] left: user.text_align_left() 
text [align] right: user.text_align_right() 
text [align] center: user.text_align_center() 
text [align] justify: user.text_align_justify()

text bold: user.text_font_bold()
text italic: user.text_font_italic()
text underline: user.text_font_underline()
text strikethrough: user.text_font_strikethrough()

text (large | larger | big | bigger | size up): user.text_font_size_up()
text (small | smaller | size down): user.text_font_size_down()
text (thicker | heavier | weight up): user.text_font_weight_up() 
text (thinner | lighter | weight down): user.text_font_weight_down() 

text [line] height up: user.text_line_height_up()
text [line] height down: user.text_line_height_down()
text letter space up: user.text_letter_space_up()
text letter space down: user.text_letter_space_down()
auscompgeek commented 1 year ago

@nriley I grabbed your PowerPoint commands as an example for this, any thoughts?

nriley commented 1 year ago

I can see how @rntz's suggestion with "text" would be useful in apps that might have additional ways to do things, and it'd be friendlier/less likely to cause conflicts in mixed mode than my single-word commands.

Here's another example (which I use daily) — formatting in OneNote.

https://github.com/nriley/knausj_talon/blob/nriley/apps/onenote/onenote_mac.talon#L10

auscompgeek commented 1 year ago

Stumbled across some Notion commands too. https://github.com/mauricel/knausj_talon/blob/4fc283b6/apps/notion/notion.talon#L14