Skip to content

question: updating flyline from signal handlers #852

Closed

Description

@georglauterbach

When switching between dark and light mode on my system, shells receive the SIGUSR2 signal and run handler functions for specific programs to update them (if they cannot update automatically). Flyline is updated by running flyline set-style ... from the signal handler.

This seems to be working in general. I noticed, though, that I need to run a (single) command (doesn't matter which one) for flyline to actually update the colors. Moreover, other programs like herdr (terminal multiplexer) are receiving an update too, and this update also only applies after I ran one command in flyline.

What do you think could be the culprit here?

Activity

  1. georglauterbach commented on Jul 29, 2026

    @georglauterbach
    ContributorAuthor

    I dug a bit. Here is what I found: While the interactive shell sits at the prompt, it is blocked inside readline (or flyline for that matter). Bash treats that wait like a foreground command. From the Bash man page:

    If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes.

    A common workaround seems to be using SIGALRM, which readline handles specifically. Do you think this would also make sense for flyline (at least delegating the signal or something)?

  2. georglauterbach commented on Jul 29, 2026

    @georglauterbach
    ContributorAuthor

    Here is a diff file to the current state of main (665e65a) that implements the signal handling logic:

    signal_handlers.diff.txt

  3. HalFrgrd commented on Aug 11, 2026

    @HalFrgrd
    Owner

    Hey, I'm just getting to look at this now. Do you mind explaining how you setup your shell to handle SIGUSR2? Im not familiar.

  4. georglauterbach commented on Aug 11, 2026

    @georglauterbach
    ContributorAuthor

    You can see it here. It's a simple trap '<HANDLER>' <SIGNAL NAME>. In my case, I call function (trap __hermes__signal_handler_sigusr2 SIGUSR2) which runs a few other functions to update color variants (light-dark-theme).

  5. georglauterbach commented on Aug 15, 2026

    @georglauterbach
    ContributorAuthor

    @HalFrgrd If you want me to, I can open PR(s) to upstream the changes from my fork. Would you be interested? The commits are here. I am rebasing onto your master once in while to keep the branches up-to-date. I currently have three patches:

    1. Adjusting the release profile
    2. Adding proper async signal handling
    3. Implementing proper fade for light terminal colors
  6. HalFrgrd commented on Aug 15, 2026

    @HalFrgrd
    Owner

    Yes please! If you are a light mode terminal user, I would be interested in what you think of the light mode palette. Especially the new scrollbar color / hover / depress styles. I'm not a light mode user so would appreciate someone to take a look at it!

  7. georglauterbach commented on Aug 15, 2026

    @georglauterbach
    ContributorAuthor

    I am using light during the day and dark during the night. I run a custom flyline theme, but I will gladly give feedback on the defaults. Let me start with upstreaming the changes and I will provide feedback on the defaults afterward.

  8. georglauterbach commented on Aug 15, 2026

    @georglauterbach
    ContributorAuthor

    First PR is #931. I will be adding a second MR for cursor fades once #931 is merged.

    I also propose updating the release profile:

    [profile.release]
    panic = "unwind"
    overflow-checks = true
    lto = true
    +codegen-units = 1

    Having only one codegen unit increases compile times, so I am hesitant, but this would provide the benefit of having better optimized code in release builds. We could also go for 2 or 4. The default is 16.

  9. HalFrgrd commented on Aug 15, 2026

    @HalFrgrd
    Owner

    Thanks for the tip, I tested codegen-units = 1 and pushed to master.

  10. georglauterbach commented on Aug 16, 2026

    @georglauterbach
    ContributorAuthor

    Closed by #935 and b3ab32a

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions