Skip to content

feat: add devcontainer - #1861

Merged
AucaCoyan merged 3 commits into
espanso:devfrom
phorcys420-contrib:dev
Apr 21, 2024
Merged

AucaCoyan merged 3 commits into
espanso:devfrom
phorcys420-contrib:dev

Conversation

@phorcys420

@phorcys420 phorcys420 commented Feb 18, 2024 •

Copy link
Copy Markdown
Contributor

Discord discussion
(cc: @AucaCoyan)


Devcontainers are an open specification for enriching containers with development specific content and settings that allows developers to use containers as developer environments.

This helps with quick setup of development environments in VSCode, GitHub Codespaces, Coder and others.

This PR is the beginning of the inclusion of dev containers in Espanso.
My long-term vision on this is the following :

Now these will come in separate PRs, I think this current version is fine to get the idea started.

@federico-terzi

federico-terzi commented Feb 18, 2024 •

Copy link
Copy Markdown
Collaborator

Hey folks :)

I'm a big fan of devcontainers, but how can they help with Espanso? The software relies on desktop native APIs that AFAIK are not available from inside a devcontainer context. I understand being able to run unit tests from Docker, which makes sense and we are partially doing it already, but you wouldn't be able to run Espanso itself inside (as far as I can think), so what would be the advantage of running the Espanso dev environment within a devcontainer? :)

@phorcys420

Copy link
Copy Markdown
Contributor Author

Hey folks :)

I'm a big fan of devcontainers, but how can they help with Espanso? The software relies on desktop native APIs that AFAIK are not available from inside a devcontainer context.

Hey! Actually, they should be.
I've been writing my PRs for Espanso from within a custom container (see uwu/basic-env that has a desktop environment running with noVNC to access it.

We can replicate this setup by using the desktop-lite devcontainer feature, I just didn't think of it!

what would be the advantage of running the Espanso dev environment within a devcontainer? :)

Even without access to a desktop environment, the advantages are as follows :

  • Hands-off setup (all the tools install themselves)
  • Standardized dev environments to reduce the "works on my machine" phenomenon
  • Ability to compile espanso easily
  • (Reusable configuration files for CI usage)

Even if you didn't run espanso from within the devcontainer (which you theoretically could, but I'll expand down below), you could still use it as a reference "compilation machine" that you don't have to setup/maintain yourself, which I think is pretty useful (even more when cross-compilation gets there).

I had this other idea that would also make more sense within a devcontainer, I think it'd be great if you could use espanso only with the CLI.
Let me explain, when I was writing my PowerShell Core PR, I needed to have a desktop environment to test my espanso trigger, when in reality, that wasn't useful since I wasn't changing any core espanso behavior, only implementing some "backend logic". (where typing is the front-end)
instead of typing ":test" every now and then, I could've ran espanso trigger ":test" and grabbed the output from there for my testing, making the need for a DE gone while still maintaining good testing.

Obviously, when sending a PR you would test it in a "real" environment, but this would really help with debugging !

@federico-terzi

Copy link
Copy Markdown
Collaborator

Thanks for sharing! Interesting

@AucaCoyan

Copy link
Copy Markdown
Collaborator

Hello! Where are we in this PR? 😄

@AucaCoyan AucaCoyan assigned AucaCoyan and phorcys420 and unassigned AucaCoyan Mar 31, 2024
@phorcys420

Copy link
Copy Markdown
Contributor Author

hey! I don't know why I left it as a draft actually!
I was just waiting for input and kind of forgot about this PR to be honest.

I'll look into adding the desktop-lite feature and undraft this PR :-)

@AucaCoyan

Copy link
Copy Markdown
Collaborator

No worries, I'll happily merge this when ready!

@phorcys420

Copy link
Copy Markdown
Contributor Author

Here it is with the desktop-lite feature!

2024-04-14.15-59-50.mp4

In this preview I started espanso from within the VNC sessions's terminal, but you can also run espanso start from VSCode and it'll work just as well!

This could definitely be better in the following ways :

  • Automatically start espanso whenever built (hot-reload) (needs to be implemented outside of the devcontainer first)
  • Automatically start the text editor

I also think espanso start should have a --no-detach flag or whatever to be able to CTRL+C the espanso process whenever you don't need it anymore and to have espansod logs directly, I think that would enhance the developer experience.

I can submit issues for those if needed :-)

@phorcys420
phorcys420 marked this pull request as ready for review April 14, 2024 14:05
@phorcys420

Copy link
Copy Markdown
Contributor Author

@AucaCoyan @federico-terzi the PR is ready to be merged if you don't see anything else to add :-)

@AucaCoyan
AucaCoyan self-requested a review April 14, 2024 21:32
@AucaCoyan

Copy link
Copy Markdown
Collaborator

WOW that is amazing!
I'm very sorry I took so much to respond, I initially thought that I needed to test the devcontainer in my pc first. With the video it was more than enough!
All good!
If you are willing, we could improve the CONTRIBUTING.md docs, but that is another PR 😄

@AucaCoyan AucaCoyan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I love this!

@AucaCoyan
AucaCoyan merged commit 91280eb into espanso:dev Apr 21, 2024
@phorcys420

Copy link
Copy Markdown
Contributor Author

🚀

AucaCoyan added a commit that referenced this pull request Nov 5, 2024
* chore(deps): bump bzip2 from 0.4.3 to 0.4.4

Bumps [bzip2](https://github.com/alexcrichton/bzip2-rs) from 0.4.3 to 0.4.4.
- [Release notes](https://github.com/alexcrichton/bzip2-rs/releases)
- [Commits](https://github.com/alexcrichton/bzip2-rs/commits/0.4.4)

---
updated-dependencies:
- dependency-name: bzip2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix two warnings

* feat(clipboard): set string for type NSHTMLPboardType in clipboard when set_html (#1807)

* chore: ⬆️ Upgrade `enum-as-inner` across crates (#1796)

* ⬆️ Upgrade `espanso-detect` crate

* ⬆️ Upgrade `espanso-config`

* ⬆️ Upgrade `espanso-inject`

* ⬆️ Upgrade `espanso-render` crate

* ⬆️ Upgrade `espanso` bin crate

* 🚨 Fix clippy `+=` bug

* 💚 comment `rust-cache` action

* ⬆️ change `winrt` for `tauri-winrt` crate

* 🐛 replace the import

* Revert "🐛 replace the import"

This reverts commit 1712f27.

* Revert ":arrow_up: change `winrt` for `tauri-winrt` crate"

This reverts commit ffcc745.

* Revert ":arrow_up: Upgrade `espanso` bin crate"

This reverts commit 7c85b95.

* 🙈 add `.profraw` to gitignore

* Revert "🚨 Fix clippy `+=` bug"

This reverts commit 7c62bd9.

* ⏪ revert `rust-cache` step

* 🎨 ran `cargo fmt`

* feat(render): add support for pwsh (#1824)

* feat(render): add support for pwsh

* feat(render): add macos support for pwsh

* feat: add comment to explain the different powershell versions

* fmt(espanso-render): format pwsh-related modifications

* Update SECURITY.md (#1836)

Updated with information from #1704 (comment)

* chore: update rust-cache CI action

* chore: upgrade `fs_extra` and `html2text` (#1831)

* chore: Upgrade `cargo-make` to version `0.37.5` (#1797)

* ⬆️ Upgrade `cargo-make` to version `0.37.5`

* comment `record.h` out

* 💡 remove the comment

* 🚧 trigger the CI again

* move `--env` before the make cmd

* print default features

* chore(deps): bump h2 from 0.3.18 to 0.3.24 (#1815)

Bumps [h2](https://github.com/hyperium/h2) from 0.3.18 to 0.3.24.
- [Release notes](https://github.com/hyperium/h2/releases)
- [Changelog](https://github.com/hyperium/h2/blob/v0.3.24/CHANGELOG.md)
- [Commits](hyperium/h2@v0.3.18...v0.3.24)

---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Add contributing doc and upgrade `workspace.resolver` to v2 (#1829)

* 📝 update `federico-terzi` with `espanso` gh repo

* 📝 add `CONTRIBUTING.md`

* ⬆️ upgrade `workspace.resolver` to v2

* ✅ update failing tests on `federico-terzi`

* 🎨 format the code

* typo `addressing`

Co-authored-by: Federico Terzi <[email protected]>

* 📝 add documentation on c++

---------

Co-authored-by: Federico Terzi <[email protected]>

* fix: 🏗️ fix cargo-make release builds (#1846)

* 🏗️ fix cargo-make release builds

* 💚 fix cargo-make builds

* chore(deps): bump tokio from 1.19.2 to 1.28.2 (#1844)

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.19.2 to 1.28.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](tokio-rs/tokio@tokio-1.19.2...tokio-1.28.2)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 🚨 fix clippy (#1852)

* ✨ add `cargo-udeps` chapter

* 📝 update `CONTRIBUTING` and delete `Compilation.md`

* 📝 update `CONTRIBUTING`

* ✨ add `run-clang-format`

* ✨ add `clang-format` files config

* ✨ add lints

* 📝 modify the clang doc

* 🔥 delete rustfmt file

* 🔥 remove unused crates (#1856)

* 🚨 add `clippy` lints to `Cargo.toml`

* 🚨 fix linter on mac

* 🚨 fix all the lints

* 🚨 fix lints

* 🚧 putting warn on pedantic for the CI

* 🚨 more lints

* 🔥 remove unused import

* 🚨 fix more lints

* 🚨 fix lints

* 🚨 lints

* 🚨 lints

* 🚨 fix lint

* 🔥 remove `maplit`

* 🚨 fix clippy broken on dev

* 🔥 remove `lazy_static`

* 🔥 remove `lazycell`

* 🔥 remove `tempdir````

* 🔥 remove `lazycell`

* 🔥 remove `thiserror```

* 🔥 remove `lazycell`

* 🔥 remove `enum-as-inner`

* 🔥 remove `crossbeam`

* 🔥 remove `log`

* 🔥 remove `anyhow`

* ♻️ refactor `external crate lazy_static`

* 🔀 merge `dev`

* 🐛 fix missing `lazy_static`

* 🐛 fix another missing import

* 🐛 fix missing import

* ♻️ remove `target_os = "macos"` on the mac crate

* Revert "♻️ remove `target_os = "macos"` on the mac crate"

This reverts commit 2e8a2ff.

* 🔥 remove `log`, `lazycell` and `thiserror`

* 🔥 remove `anyhow` and `thiserror`

* 🔥 remove `dunce` `log` and `tempfile`

* 🔥 remove `log` and `serde_json`

* 🔥 remove `anyhow` `thiserror`

* 🔥 remove `lazy_static`

* ⬆️ upload the `Cargo.lock`

* 🎨 format everything again

* 🐛 fix `=` issue in build_windows_resources (#1877)

* Add option to open config folder to context menu (#1870)

* Add option to open config folder to context menu

* Cargo fmt

---------

Co-authored-by: Brandon Nolet <[email protected]>

* ✨ word_separators: add apostrophe, double-quotes, Form Feed (\u000c), and tab (#1855)

* ✨ add a couple of chars

* 🚨 fix lint

* ✨ add form feed

* 🔥 remove `22u8` as char

* ✨ add `)` `]` `}` and `>`

* Revert "✨ Combine `Compilation` with `CONTRIBUTING` and extend the details" (#1883)

* Use new sctk api (#1901)

* Use new sctk api.

This also fixes the issue with the unresponsive window under wayland.

The cause appears to have been associating a callback with the keyboard
created, since this issue is reproducible with the new API if a
keyboard_with_repeat is created and a repeat callback passed.

* update sctk version

* clippy: ignore many_single_char_names in

* make clippy happy

---------

Co-authored-by: morgan-dgk <[email protected]>

* 🚨 fix clippy (#1921)

* 💚 update rust version in Dockerfile (#1923)

* Fix build with wx-config-qt (#1918)

When installing the wxwidgets-qt5 Package in Arch the binary
wx-config does not exist. It only installs /usr/bin/wx-config-qt.

To fix the build when this package is used it is added as a
possible location when looking for the wx-config command.

* chore(deps): bump h2 from 0.3.24 to 0.3.26 (#1930)

Bumps [h2](https://github.com/hyperium/h2) from 0.3.24 to 0.3.26.
- [Release notes](https://github.com/hyperium/h2/releases)
- [Changelog](https://github.com/hyperium/h2/blob/v0.3.26/CHANGELOG.md)
- [Commits](hyperium/h2@v0.3.24...v0.3.26)

---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 📝 change feature request template (#1936)

* chore: add github issue form bug and feat templates (#1042)

* chore: add github issue form bug and feat templates

* chore: add Discord & disable require in issue templates

* Fix non-void function missing a return (#1946)

The absence of a return value in a non-void function is undefined
behavior in C++ and results in a runtime crash when compiled via nix on
aarch64-darwin.

Fixes: #1945
Related: NixOS/nixpkgs#247162

* ✨ add schemas (#1917)

* ✨ add matches schema

* 🙈 add `*.code-workspace`

* 🚚 rename file

* ✨ add config schema

* ✨ add config schema

* 🚨 fix clippy lints

* 🐛 change `word_separators` from string to array of string

* ✨ add `match` type of var

* ✨ add `propagate_case` and `uppercase_style`

* ✨ add `word: bool` to schema

* ✨ add `force_mode`

* ✨ remove the required `matches` key

* ✨ add `params` to `echo` var

* 🐛 typo in `params`

* ✨ rework vars

* ✨ add required only one of these fields

* ✨ add `form` type of replace

* ✨ add schemas to the default yaml files

* ⬆️ upgrade `upload-artifact` to `v4` (#1951)

* 🐛 fix links in yaml schemas (#1952)

* ✨ add `nushell` support (#1924)

* feat: add devcontainer (#1861)

* feat: add devcontainer

* feat(devcontainer): add desktop-lite feature

* refactor: Use workspace dependencies where practical (#1956)

* refactor: Use workspace dependencies where practical

When using a workspace, one can ensure a single version of a dependency is used across
the entire workspace by configuring the version in `[workspace.dependencies]` and then
referring to it by `dependencyname.workspace = true` in the individual `Cargo.toml`s.

See also: #1825 (comment)

* Migrate additional dependencies to workspace

* Update to latest clippy (#1962)

* ✅ skip a long test

* 🚨 update new clippy lints

* ✅ add excluded tests

* 🔥 remove espanso-modulo tests (breaks macOS CI)

* fix(inject): attach modifiers state to the next record on x11 (#1680)

When pressing Ctrl+Shift+v, previously the injected key events would be:
- `Ctrl` key with modifier state for Ctrl
- `Shift` key with modifier state for Ctrl & Shift
- `v` key with modifier state for Ctrl & Shift

Whereas manually typing the keys would give the following key events:
- `Ctrl` key with no modifiers
- `Shift` key with modifier state for Ctrl
- `v` key with modifier state for Ctrl & Shift

Meaning that the key event state represents the modifiers that exist at
a given moment, not the new state with the current modifier being
pressed.

* Support non-ASCII characters in triggers on macOS (#1967)

Reports the number of bytes in the UTF-8 encoded character input to the Rust code, as expected there. Formerly the number of Unicode characters/codepoints was reported instead, which did only work for 7-bit ASCII characters.

* 🚨 fix clippy (#1988)

* 🚨 fix windows errors

* 🔥 delete an unused import

* 🚨 fix mac clippy lints

* 🚨 fix more lints

* Word separators

I realised we omitted some word_separators that may occur BEFORE words, so have added "( ", "{",  "[", and "<", as well as the additional punctuation marks ":", and ";".
The documentation will have to follow.
I considered adding "-" and "_", but I think these can be left to users who need them.
Minor tidying of security.md.

* 💚 change `macos-11` for `macos-latest` (#1987)

* Improve form size constraints and text overflow behavior (#1991)

* Wrap static text in forms

* Add configs for max form width and height

* 🚨 fix clippy warnings and tests (#2002)

* Show regex in search bar (#1998)

* Show regex in search bar

* Resolve errors

* Create a rpm build automatically (#1979)

* Create a rpm build automatically

* Fix typo in build script

---------

Co-authored-by: Benedikt Koeppel <[email protected]>

* 💚 fix requirement `create-release` (#2004)

* 💚 remove `rpm` build (#2008)

* 🚧 fix some allow lints (#2003)

* 🚧 fix some allow lints

* 🚨 more lints!

* 🐛 skip flaky test and fix a lint

* ✨ try again with clap 3.0 (#2009)

* ✨ try again with clap 3.0

* ⬆️ upgrade clap 3.0.0 to ^3

* 📝 clarify `Applications` folder (#2015)

* 🔥 remove `snap` support (#2016)

* ⬆️ upgrade `bumpalo` (#2017)

* ⬆️ upgrade `colored` (#2018)

* 👷 change ubuntu 18.04 for 24.04 in the docker image (#1925)

* 👷 change ubuntu for debian for the docker image

* 🚚 move files

* ⬆️ change `debian 12` for `ubuntu 24.04` in Dockerfile

* 🚚 move to the original path

* 💚 fix path of the ci (#2025)

* chore(deps): bump openssl from 0.10.61 to 0.10.66 (#2026)

Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.61 to 0.10.66.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](rust-openssl/rust-openssl@openssl-v0.10.61...openssl-v0.10.66)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ✨ add `locale` and `offset` to date module schema (#2040)

* docs: fix code fences (#2055)

This allows easy copying of commands.

* Fix clippy (#2065)

* 🚨 fix clippy warnings and tests

* 🚨 fix clippy lint

* Resolve issue with cursor placement when using multi-byte characters (#2063)

* Fix delay between keystrokes on Mac. (#2067)

* Fix delay between keystrokes on Mac. Fix issue #2038.

* Changed the way it is implemented, so users that have the default delay won't experience any change. Users that define a delay, will have it.

* Fix formatting.

* Fix new line.

* remove 2048 byte clipboard limit for windows (#2085)

* 🐛 fix label needs triage (#2093)

* ⚗️ add support to detect wayland compositor in use (#2101)

* add deps for layout/wayland

* add experimental support to detect wayland compositor

* try to fix windows compilation

* change a & and a fmt line

---------

Co-authored-by: Auca Coyan <[email protected]>

* 🔊 update level of very verbose wayland log (#2107)

* 🏷️ update labels of feature request issues (#2117)

* 🚧 testing the signature of signpath

* ⚗️ trigger CI in master

* 🚧 test the ci again

* 👷 change the workflow to pre-release and trigger a new version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Terzi <[email protected]>
Co-authored-by: Federico Terzi <[email protected]>
Co-authored-by: Mickael Metesreau <[email protected]>
Co-authored-by: phorcys420 <[email protected]>
Co-authored-by: Stephen Meech <[email protected]>
Co-authored-by: BNolet <[email protected]>
Co-authored-by: Brandon Nolet <[email protected]>
Co-authored-by: Morgan <[email protected]>
Co-authored-by: morgan-dgk <[email protected]>
Co-authored-by: Alexander Stehlik <[email protected]>
Co-authored-by: Tobias Büschel <[email protected]>
Co-authored-by: Nathan Henrie <[email protected]>
Co-authored-by: Benoit de Chezelles <[email protected]>
Co-authored-by: Michael Thies <[email protected]>
Co-authored-by: Maine <[email protected]>
Co-authored-by: Benedikt Köppel <[email protected]>
Co-authored-by: Benedikt Koeppel <[email protected]>
Co-authored-by: Mihir Rabade <[email protected]>
Co-authored-by: bAron <[email protected]>
Co-authored-by: TFGF <[email protected]>
Co-authored-by: Kroum Tzanev <[email protected]>
sboldt1978 pushed a commit to sboldt1978/espanso that referenced this pull request Feb 11, 2026
* feat: add devcontainer

* feat(devcontainer): add desktop-lite feature
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.

3 participants