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

commands/include: handle many files in single line #8455

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

mTvare6
Copy link
Contributor

@mTvare6 mTvare6 commented Nov 13, 2024

i3 supports including multiple files in a single line, whereas sway limits to single file per line.

@emersion emersion added the i3-compat Sway doesn't match i3's behavior label Nov 13, 2024
@emersion
Copy link
Member

Reading https://github.com/i3/i3/blob/2746e0319b03a8a5a02b57a69b1fb47e0a9c22f1/src/config_directives.c#L18: it seems like i3's include directive only supports a single parameter. Am I missing something?

@mTvare6
Copy link
Contributor Author

mTvare6 commented Nov 14, 2024

@emersion I hadn't checked the code then, looking into the logs I see

11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_include:19 - include ~/.config/sway/a ~/.config/sway/b
11/14/2024 08:50:55 PM - Including config file /home/epestr/.config/sway/a
11/14/2024 08:50:55 PM - Changing working directory to config file directory /home/epestr/.config/sway
11/14/2024 08:50:55 PM - ../src/config_parser.c:parse_config:234 - CONFIG(line   1): exec echo a > ~/aa
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - Including config file /home/epestr/.config/sway/b
11/14/2024 08:50:55 PM - Changing working directory to config file directory /home/epestr/.config/sway
11/14/2024 08:50:55 PM - ../src/config_parser.c:parse_config:234 - CONFIG(line   1): exec echo b > ~/bb
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a18d18, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a1d848, state = 108
11/14/2024 08:50:55 PM - ../src/config_directives.c:cfg_criteria_init:106 - Initializing criteria, current_match = 0x7ffdf6a1d848, state = 108

And if you look into what ~/.config/sway/a holds, the code is executed(exec echo a > ~/aa) and so did b.

@mTvare6
Copy link
Contributor Author

mTvare6 commented Nov 14, 2024

@emersion, also the code looks pretty self explanatory, we loop over the p.we_wordv which wordexp() returns, checking if they were valid.

@emersion
Copy link
Member

Ah, it seems the whole string until end-of-line is passed in to that i3 function, instead of a single word.

Instead of looping over arguments, we should probably handle this like exec for instance, where we join back together words?

i3 supports including multiple files in a single line, whereas sway
limits to single file per line.
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

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

Thanks!

@emersion emersion merged commit fec3da7 into swaywm:master Nov 17, 2024
3 checks passed
@mTvare6 mTvare6 deleted the include-many-files branch November 18, 2024 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i3-compat Sway doesn't match i3's behavior
Development

Successfully merging this pull request may close these issues.

2 participants