Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent talonscript language files from being active in sleep mode #569

Merged
merged 1 commit into from
Aug 27, 2021
Merged

Prevent talonscript language files from being active in sleep mode #569

merged 1 commit into from
Aug 27, 2021

Conversation

AndreasArvidsson
Copy link
Collaborator

@AndreasArvidsson AndreasArvidsson commented Aug 16, 2021

Adding mode: command to all talonscript language files to prevent them from being active in sleep mode.
fixes #561

The headers are getting quite verbose but right now I don't know of any better way to support both automatic language detection and forced languages that are only active in command mode.

EDIT:
One option if we are allowed pervert the applications context is to define an application for each language.
In code.py we could iterate the list of each language and define an application context for each of them.

for lang in extension_lang_map.values():
    mod.apps[f"lang_{lang}"] = f"""
    mode: command
    and mode: user.{lang}
    mode: command
    and mode: user.auto_lang
    and code.language: {lang}
    """

Then in talonscript just use this simple header

app: lang_python
-

@lunixbochs @knausj85 Is this a workable solution or should we stick to the verbose headers?

ps.
Just to clarify. The whole reason for the verbose header is that code.language doesn't update when forcing a language so until you switch file and code.language updates you have two active languages at the same time. Being able to force code.language to refresh would solve the issue in a better way I think.

@lunixbochs
Copy link
Collaborator

lunixbochs commented Aug 16, 2021 via email

@pokey pokey merged commit 4ac7ba1 into talonhub:master Aug 27, 2021
@AndreasArvidsson AndreasArvidsson deleted the language_sleep branch August 27, 2021 11:16
daanvdh pushed a commit to daanvdh/knausj_talon that referenced this pull request Sep 2, 2021
* master: (55 commits)
  Added command mode to all language headers to prevent them being active in sleep mode (talonhub#569)
  Change command client keyboard shortcut (talonhub#572)
  Make slap command work with Slack (talonhub#535)
  Add Pound Sterling (£) Sign (talonhub#523)
  `quote that` and `inside quotes` changes (talonhub#538)
  Knausj generic terminal establishment (talonhub#514)
  Add right-drag command to Talon (talonhub#498)
  Add a small delay to tab close on Chrome (talonhub#553)
  fix tab jumping for firefox on linux (talonhub#558)
  implement cancel command properly (talonhub#536)
  Add a command to copy the url of the current page (talonhub#534)
  Add fetch all to convenience mappings
  Update .gitignore
  Ignore settings directory
  Delete cancel.talon
  Fix Mac Terminal Copy-paste (talonhub#525)
  add phones word/word left/word right commands (talonhub#531)
  Update switcher.py (talonhub#529)
  jetbrains filename() quick fix
  Update switcher.py
  ...
codecat555 pushed a commit to codecat555/knausj_talon that referenced this pull request Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.talon file commands are active even in sleep mode
4 participants