Skip to content

[Bug / Feature] stack for commands #219

Open
@tsankuanglee

Description

@tsankuanglee

Version Information:

  • Distribution Information ( run uname -a ): Linux 6.4.8-arch1-1
  • swhkd version ( swhkd -V ): 1.2.1

Describe the bug:

Commands chained by && seem to be executed together, disregarding mode stack changes. Example:

super + d
    @enter display

mode display swallow
b
    @escape && @enter display_selection && @enter brightness_selection && set_brightness.sh
endmode

mode display_selection swallow oneoff
{1,2,3}
    save_selection_to_file.sh {left,middle,right}
endmode

mode brightness_selection swallow oneoff
{1,2,3,4,5}
    save_brightness_to_file.sh {0,25,50,75,100}%
endmode

Expected behavior:
With @escape && @enter display_selection && @enter brightness_selection && set_brightness.sh, we expect when mode display_selection is popped, we continue to the next command @enter brightness_selection.

Actual behavior:
As soon as b fires @escape && @enter display_selection && @enter brightness_selection && set_brightness.sh, everything is executed right away, including the set_brightness.sh script, while we are still in the mode display_selection.

To Reproduce:
See example above.

Additional information:
Since we don't have the syntax like sxhkd as I mentioned in #67 , we can't exactly do a command with more than two expansions, e.g.

{1,2,3}; {b,c,t}; {1,2,3}
    display_setting.sh {left,middle,right} {brightness,contrast,temperature} {low,mid,high}

With the mode design, I can only get around it by temporarily saving a state for later use.

That said, mode actually provides a more clear and reusable design, if this bug/feature is addressed. For example, I can re-use the display_selection mode for not only brightness, but contrast, color temperature, etc., by entering that mode, and then continue with the next action.

Metadata

Metadata

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