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

Fix 2205 - Support cwd #2290

Merged
merged 6 commits into from
Apr 18, 2023
Merged

Conversation

Kangaxx-0
Copy link
Contributor

#2205 - supports cwd as option

  • Zellij options --default-cwd <path> without config
  • Zellij with default_cwd = in zellij config file → set path to usr
  • cargo xtask test

Screenshot

2205

@Kangaxx-0 Kangaxx-0 marked this pull request as ready for review March 15, 2023 00:40
@Kangaxx-0 Kangaxx-0 temporarily deployed to cachix March 15, 2023 15:46 — with GitHub Actions Inactive
Copy link
Member

@imsnif imsnif left a comment

Choose a reason for hiding this comment

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

Hey @Kangaxx-0 - good job with this! The code looks great and the solution very native.

Only issue I found is that when the default_cwd is set, whenever we open a new pane it is set to it instead of the current folder. This to me is more of an override_cwd than a default_cwd.

If we adjust this, I think we're good to merge.

@Kangaxx-0
Copy link
Contributor Author

Only issue I found is that when the default_cwd is set, whenever we open a new pane it is set to it instead of the current folder. This to me is more of an override_cwd than a default_cwd.

If we adjust this, I think we're good to merge.

I changed it to override_cwd :)

@Kangaxx-0 Kangaxx-0 requested a review from imsnif March 25, 2023 16:38
@imsnif
Copy link
Member

imsnif commented Mar 28, 2023

Hey @Kangaxx-0 - I think we need a default_cwd rather than an override_cwd (that's also what the issue was about). Would you like to work on it in that direction?

@Kangaxx-0
Copy link
Contributor Author

Hi @imsnif - Sorry, I am bit confused here. In my initial commit, I used default_cwd, and I thought you would prefer override_cwd in your first comment, are you saying you feel default_cwd is better, and want me to change it back?

Besides the name change, any other change you feel we might need ?

@imsnif
Copy link
Member

imsnif commented Mar 29, 2023

Hey @Kangaxx-0 - I just re-read my initial comment and realized I was very unclear, sorry about that!

What we want to do here is add a default_cwd option. This option should behave as follows:
When opening a new pane, it should be the default. Meaning that if we have another cwd from somewhere else (eg. from the previous pane we opened) we should use that one.
This means the default_cwd option should only be used at the beginning of the session or in cases where we can't read the cwd of an existing pane for some reason. In all other cases it's a better and expected experience (for most users) that the pane will be opened in the current location of the previously focused pane.

@Kangaxx-0
Copy link
Contributor Author

@imsnif Thanks for your feedback, I've made some small changes, and I believe it works as you expected.

I have not sent new iteration, this is just my local changes, please let me know when I will update the new commit

defaultcwd

@Kangaxx-0 Kangaxx-0 temporarily deployed to cachix April 6, 2023 08:54 — with GitHub Actions Inactive
@imsnif
Copy link
Member

imsnif commented Apr 6, 2023

Hey @Kangaxx-0 - very elegant solution here! Only problem is that this now only works if a default_shell is defined... do you think we can find a solution that will work in any case?

@Kangaxx-0
Copy link
Contributor Author

Hey @Kangaxx-0 - very elegant solution here! Only problem is that this now only works if a default_shell is defined... do you think we can find a solution that will work in any case?

Hello @imsnif, thanks for your comments, in order to make default cwd works without default_shell, I made a few changes to pass down a new param.

I've tested all below scenarios and they all worked fine

  • no default_shell and no default_cwd
  • no default_shell and default_cwd
  • default_shell and no default_cwd
  • default_shell and default_cwd

Please take a look when you get a chance, thanks

@Kangaxx-0 Kangaxx-0 temporarily deployed to cachix April 18, 2023 13:29 — with GitHub Actions Inactive
@imsnif
Copy link
Member

imsnif commented Apr 18, 2023

Great work on this - thank you for bearing with all my change requests!

@imsnif imsnif merged commit 4c87b1e into zellij-org:main Apr 18, 2023
har7an pushed a commit to har7an/zellij that referenced this pull request Apr 18, 2023
* init commit

* add default config to kdl file

* change the field from `default_cwd` to `override_cwd`

* change back to default_cwd

* fix test

* default cwd works without `default_shell`
renovate bot added a commit to scottames/dots that referenced this pull request Jun 19, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [aquaproj/aqua-registry](https://togithub.com/aquaproj/aqua-registry)
| minor | `v4.19.0` -> `v4.20.0` |
| [zellij-org/zellij](https://togithub.com/zellij-org/zellij) | minor |
`v0.36.0` -> `v0.37.0` |

---

### Release Notes

<details>
<summary>aquaproj/aqua-registry</summary>

###
[`v4.20.0`](https://togithub.com/aquaproj/aqua-registry/releases/tag/v4.20.0)

[Compare
Source](https://togithub.com/aquaproj/aqua-registry/compare/v4.19.0...v4.20.0)


[Issues](https://togithub.com/aquaproj/aqua-registry/issues?q=is%3Aissue+milestone%3Av4.20.0)
| [Pull
Requests](https://togithub.com/aquaproj/aqua-registry/pulls?q=is%3Apr+milestone%3Av4.20.0)
| aquaproj/aqua-registry@v4.19.0...v4.20.0

#### 🎉 New Packages


[#&#8203;13132](https://togithub.com/aquaproj/aqua-registry/issues/13132)
[segmentio/golines](https://togithub.com/segmentio/golines): A golang
formatter that fixes long lines
[@&#8203;iwata](https://togithub.com/iwata)

#### Fixes


[#&#8203;13143](https://togithub.com/aquaproj/aqua-registry/issues/13143)
[terraform-linters/tflint](https://togithub.com/terraform-linters/tflint):
Support old versions

</details>

<details>
<summary>zellij-org/zellij</summary>

###
[`v0.37.0`](https://togithub.com/zellij-org/zellij/releases/tag/v0.37.0)

[Compare
Source](https://togithub.com/zellij-org/zellij/compare/v0.36.0...v0.37.0)

In this release we've done a lot of work on our WebAssembly / WASI
plugin system and are very excited to invite adventurous Rust developers
to come pioneer our plugin system with us. To read more, please see the
official [Plugin
Documentation](https://zellij.dev/documentation/plugins.html).

Please also drop by our Discord or Matrix and show us the plugins you're
working on!

#### Other Highlights

- Some basic themes are now included with the release, give it a try by
starting Zellij with `zellij options --theme catppuccin-mocha`
-   Layouts now support environment variables and tilde expansions
-   We can now provide a `--cwd` option when starting Zellij

#### All changes

- fix(plugin): respect hide session option on compact-bar by
[@&#8203;pedromfedricci](https://togithub.com/pedromfedricci) in
[zellij-org/zellij#2368
- feat: Add layout configuration to exclude panes from tab sync by
[@&#8203;on3iro](https://togithub.com/on3iro) in
[zellij-org/zellij#2314
- Fix 2205 - Support cwd by
[@&#8203;Kangaxx-0](https://togithub.com/Kangaxx-0) in
[zellij-org/zellij#2290
- feat(plugins): reload plugin at runtime by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2372
- Update architecture doc by
[@&#8203;Kangaxx-0](https://togithub.com/Kangaxx-0) in
[zellij-org/zellij#2371
- feat(themes): add nightfox themes by
[@&#8203;EdenEast](https://togithub.com/EdenEast) in
[zellij-org/zellij#2384
- feat: provide default themes by
[@&#8203;jaeheonji](https://togithub.com/jaeheonji) in
[zellij-org/zellij#2307
- feat(plugins): update and render plugins asynchronously by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2410
- feat(layout): Support environment variables in cwd
([#&#8203;2288](https://togithub.com/zellij-org/zellij/issues/2288)) by
[@&#8203;shahamran](https://togithub.com/shahamran) in
[zellij-org/zellij#2291
- Add file path context to all IO errors in ConfigError by
[@&#8203;Imberflur](https://togithub.com/Imberflur) in
[zellij-org/zellij#2412
- fix(e2e): fix flaky locked mode test by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2413
- Fix error loading non-existant themes directory and use default themes
as the base when merging by
[@&#8203;Imberflur](https://togithub.com/Imberflur) in
[zellij-org/zellij#2411
- improve build/ci times by
[@&#8203;tlinford](https://togithub.com/tlinford) in
[zellij-org/zellij#2396
- Do not unwrap() the sticky bit setting! by
[@&#8203;valpackett](https://togithub.com/valpackett) in
[zellij-org/zellij#2424
- Use rust 1.67 by [@&#8203;har7an](https://togithub.com/har7an) in
[zellij-org/zellij#2375
- Fix issue 2421 - Update config file output by
[@&#8203;Kangaxx-0](https://togithub.com/Kangaxx-0) in
[zellij-org/zellij#2443
- feat(plugins): Plugin workers and strider by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2449
- fix: cwd of newtab action by
[@&#8203;onichandame](https://togithub.com/onichandame) in
[zellij-org/zellij#2455
- feat(wasm-plugin-system): major overhaul and some goodies by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2510
- feat(plugins): extensive plugin api by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2516
- fix: runtime panic because of local cache by
[@&#8203;jaeheonji](https://togithub.com/jaeheonji) in
[zellij-org/zellij#2522
- fix(output): do not hide cursor on a render that does not include
visual assets by [@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2528
- fix(screen): focus tab as well as pane when launching existing plugin
by [@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2530
- fix(strider): clear search term on ESC by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2531
- fix(plugins): only listen to hd if a plugin is subscribed to hd events
by [@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2529
- fix(logs): suppress debug logs when not debugging by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2532
- fix(plugins): allow loading relative urls by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2539
- feat(plugins): plugin pane state events by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2545
- performance(plugins): use a debounced fs watcher by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2546
- feat(plugins): more plugin api methods by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2550
- refactor(plugins): improve api by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2552
- feat(plugins): strider improvements by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2551
- docs(plugins): document the zellij-tile events and commands api by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2554
- docs(plugins): better zellij-tile-docs by
[@&#8203;imsnif](https://togithub.com/imsnif) in
[zellij-org/zellij#2560

#### New Contributors

- [@&#8203;on3iro](https://togithub.com/on3iro) made their first
contribution in
[zellij-org/zellij#2314
- [@&#8203;Kangaxx-0](https://togithub.com/Kangaxx-0) made their first
contribution in
[zellij-org/zellij#2290
- [@&#8203;EdenEast](https://togithub.com/EdenEast) made their first
contribution in
[zellij-org/zellij#2384
- [@&#8203;shahamran](https://togithub.com/shahamran) made their first
contribution in
[zellij-org/zellij#2291
- [@&#8203;Imberflur](https://togithub.com/Imberflur) made their first
contribution in
[zellij-org/zellij#2412
- [@&#8203;valpackett](https://togithub.com/valpackett) made their first
contribution in
[zellij-org/zellij#2424
- [@&#8203;onichandame](https://togithub.com/onichandame) made their
first contribution in
[zellij-org/zellij#2455

**Full Changelog**:
zellij-org/zellij@v0.36.0...v0.37.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/scottames/dots).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMjYuMCIsInVwZGF0ZWRJblZlciI6IjM1LjEyNi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

None yet

2 participants