Skip to content

Commit

Permalink
Remove VcXsrv Beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
htngr committed Dec 18, 2024
1 parent 5b15198 commit bc63f13
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 101 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
cp result store.tar.gz
nix build .#machine-wsl.config.build.tarball -L
cp result machine.tar.gz
nix build ./build#vcxsrv-bin -L
cp result vcxsrv-installer.exe
# nix build ./build#vcxsrv-bin -L
# cp result vcxsrv-installer.exe
- uses: actions/upload-artifact@v4
with:
name: windows
Expand Down Expand Up @@ -56,11 +56,11 @@ jobs:
mkdir -p "msix/VFS/Common AppData/codchi/"
mv .\msix\*.tar.gz "msix/VFS/Common AppData/codchi/"
.\msix\vcxsrv-installer.exe /S | Out-Null # wait for installer to finish...
mkdir -p "msix/VFS/ProgramFilesX64"
cp -r "${env:ProgramFiles}\VcXsrv" "msix/VFS/ProgramFilesX64"
rm .\msix\vcxsrv-installer.exe
mv .\msix\VFS\ProgramFilesX64\VcXsrv\vcxsrv.exe .\msix\VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe
# .\msix\vcxsrv-installer.exe /S | Out-Null # wait for installer to finish...
# mkdir -p "msix/VFS/ProgramFilesX64"
# cp -r "${env:ProgramFiles}\VcXsrv" "msix/VFS/ProgramFilesX64"
# rm .\msix\vcxsrv-installer.exe
# mv .\msix\VFS\ProgramFilesX64\VcXsrv\vcxsrv.exe .\msix\VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe
# - run: |
# reg add "HKCU\ROOT\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "[{ProgramFilesX64}]\VcXsrv\codchi_vcxsrv.exe" /t REG_SZ /d "~ HIGHDPIAWARE"
# reg save "HKCU\ROOT" .\msix\User.dat
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Report bugs, suggest new features, or ask questions via [GitHub Issues](https://

### Professional Support

For professional support, please contact [aformatik](https://www.aformatik.de/kontakt):
For professional support, please contact [aformatik](https://www.aformatik.de/kontakt) or send an email to <codchi [at] aformatik [dot] de>:

- **Feature Requests & Issues**: We offer dedicated assistance for feature requests, bug fixes, and troubleshooting.
- **Training and Consulting**: Need help building a tailored *code machine* for your organization? We provide specialized training and consulting services to help you leverage Codchi to its full potential in your environment.
Expand Down
14 changes: 7 additions & 7 deletions build/msix/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
<!-- <DeviceCapability Name="webcam" /> -->
<!-- <DeviceCapability Name="bluetooth" /> -->
</Capabilities>
<Extensions>
<desktop2:Extension Category="windows.firewallRules">
<desktop2:FirewallRules Executable="VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe">
<desktop2:Rule Direction="in" IPProtocol="TCP" LocalPortMax="6000" LocalPortMin="6000" Profile="all"/>
</desktop2:FirewallRules>
</desktop2:Extension>
</Extensions>
<!-- <Extensions> -->
<!-- <desktop2:Extension Category="windows.firewallRules"> -->
<!-- <desktop2:FirewallRules Executable="VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe"> -->
<!-- <desktop2:Rule Direction="in" IPProtocol="TCP" LocalPortMax="6000" LocalPortMin="6000" Profile="all"/> -->
<!-- </desktop2:FirewallRules> -->
<!-- </desktop2:Extension> -->
<!-- </Extensions> -->
</Package>
92 changes: 21 additions & 71 deletions codchi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion codchi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ freedesktop_entry_parser = "1.3.0"
indicatif = "0.17.8"
indicatif-log-bridge = "0.2.3"
inquire = "0.7.5"
not-so-human-panic = "1.1.5"
# not-so-human-panic = "1.1.5"
num_enum = "0.7.3"
number_prefix = "0.4.0"
petname = { version = "2.0.2", default-features = false, features = [
Expand All @@ -54,6 +54,7 @@ git-url-parse = "0.4.5"
toml_edit = { version = "0.22.22", features = ["serde"] }
which = "6.0.3"
notify-rust = "4.11.3"
human-panic = "2.0.2"
# clap-help = "1.3.0"
# termimad = "0.30.0"

Expand Down
6 changes: 3 additions & 3 deletions codchi/src/config/codchi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct CodchiConfig {

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct VcXsrvConfig {
#[serde(default = "def_true")]
#[serde(default = "def_false")]
pub enable: bool,
#[serde(default = "def_false")]
pub tray: bool,
Expand All @@ -29,7 +29,7 @@ pub struct VcXsrvConfig {
impl Default for VcXsrvConfig {
fn default() -> Self {
Self {
enable: true,
enable: false,
tray: false,
}
}
Expand Down Expand Up @@ -152,7 +152,7 @@ vcxsrv.tray = true
assert_eq!(
Ok(CodchiConfig {
vcxsrv: VcXsrvConfig {
enable: true,
enable: false,
tray: true
},
..Default::default()
Expand Down
26 changes: 18 additions & 8 deletions codchi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ pub mod tray;
pub mod util;

fn main() -> anyhow::Result<()> {
not_so_human_panic::setup_panic!();
human_panic::setup_panic!(human_panic::Metadata::new(
env!("CARGO_PKG_NAME"),
format!("{} Commit: {}", env!("CARGO_PKG_VERSION"), env!("CODCHI_GIT_COMMIT"))
)
// .authors("Codchi contributers: <https://github.com/aformatik/codchi>")
// .homepage("https://codchi.dev")
.support("- Create an issue at <https://github.com/aformatik/codchi/issues>
- For professional support contact aformatik : <https://aformatik.de/kontakt/>
Codchi is currently in beta and still under active development and testing. Sometimes it can help to execute the same command 2 or 3 times. In the worst case you should be able to export your files with `codchi tar <CODCHI_MACHINE> export.tar`.
"));

let cli = Cli::parse();

Expand All @@ -40,15 +50,15 @@ fn main() -> anyhow::Result<()> {
// preload config
let cfg = CodchiConfig::get();

if !matches!(cli.command, Some(Cmd::Tray {})) && cfg.tray.autostart {
Driver::host()
.start_tray(false)
.trace_err("Failed starting codchi's tray")
.ignore();
}

// process commands without the store commands
match &cli.command {
Some(Cmd::Tray {}) if cfg.tray.autostart => {
Driver::host()
.start_tray(false)
.trace_err("Failed starting codchi's tray")
.ignore();
exit(0);
}
Some(Cmd::Tar { name, target_file }) => {
progress_scope! {
set_progress_status(format!("Exporting files of {name} to {target_file:?}..."));
Expand Down
4 changes: 4 additions & 0 deletions codchi/src/platform/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ pub trait Host: Sized {
if let Some(p) = System::new_all()
.processes_by_name("codchi".as_ref())
.find(|p| {
log::trace!("Found candidate {:?} while searching for {exe:?}", p.cmd());
log::trace!("Found {p:?} while searching for {exe:?}");
p.exe().is_some_and(|p| p == exe) && p.cmd().get(1).is_some_and(|arg| arg == "tray")
})
{

log::trace!("Kill running: {kill_running}. Process: {:?}", p.cmd());
if kill_running {
log::debug!("Killing running tray");
p.kill();
Expand Down
2 changes: 2 additions & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
asvetliakov.vscode-neovim
];
})
pkgs.bashInteractive # fix terminal in VSCode
];
programs.neovim.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
Expand Down
4 changes: 2 additions & 2 deletions docs/content/1.introduction/3.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ data_dir = 'C:\Users\me\AppData\Local\codchi'
tray.autostart = true

[vcxsrv]
enable = true
enable = false
tray_icon = false
```

Expand All @@ -32,5 +32,5 @@ tray.autostart = true
| ------ | ---- | ------- | ------------- |
| `data_dir` | `string` | `%LOCALAPPDATA%\codchi`, `$XDG_DATA_HOME/codchi` | The path where codchi stores data files from code machines |
| `tray.autostart` | `bool` | `true` | Whether to automatically start the Codchi system tray icon |
| `vcxsrv.enable` (Windows only) | `bool` | `true` | Whether to use [VcXsrv](https://github.com/marchaesen/vcxsrv), a X-Server for Windows, instead of Windows' own RDP solution. VcXsrv mostly has a better user experience and better performance but still has some bugs |
| `vcxsrv.enable` (Windows only) | `bool` | `false` | Whether to use [VcXsrv](https://github.com/marchaesen/vcxsrv), a X-Server for Windows, instead of Windows' own RDP solution. VcXsrv mostly has a better user experience and better performance but still has some bugs. Currently Codchi is shipped without VcXsrv due to security concerns, but it can be installed manually. |
| `vcxsrv.tray_icon` (Windows only) | `bool` | `false` | Whether to show VcXsrv's system tray icon
4 changes: 3 additions & 1 deletion docs/content/4.contrib/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ One thing to note is that since a code machine doesn't have its own store, it ca
### WSL

- **SystemD:** WSL natively supports SystemD.
- **GUI:** Windows natively supports GUI applications within WSL with WSLg using a mixture of Wayland and RDP. Unfortunately, because of the latter, this doesn't really provide a native experience for Linux GUI applications. Therefore, by default, [VcXsrv](https://github.com/marchaesen/vcxsrv), a native Windows X server, is included and enabled in codchi. It can be disabled in [configuration](../1.introduction/3.config.md).
- **GUI:** Windows natively supports GUI applications within WSL with WSLg using a mixture of Wayland and RDP. Unfortunately, because of the latter, this doesn't really provide a native experience for Linux GUI applications. ~~Therefore, by default, [VcXsrv](https://github.com/marchaesen/vcxsrv), a native Windows X server, is included and enabled in codchi. It can be disabled in [configuration](../1.introduction/3.config.md).~~[^1]
- **Sound:** WSLg provides a PulseAudio server by default which works well enough.
- **File sharing:** Files are shared accross WSL instances via bind mounts in `/mnt/wsl/codchi`.
- **Environment variables, secrets:** Shared via `$env:WSLENV` and a file which is written by the host driver to `\\wsl$\codchi-*\...`.
Expand All @@ -86,6 +86,8 @@ One thing to note is that since a code machine doesn't have its own store, it ca
- **GPU:** WSL provides access to the GPU installed on the host via dynamic libraries and executables. Since a code machine is a NixOS system some LD hacks are neccessary.
- **Host Integration:** The default applications inside each code machine are configured such that files or webpages open in the default Windows browser

[^1]: Currently there are some security concerns in the GitHub repo of VcXsrv which is why it isn't included in Codchi by default anymore. But, if installed manually, it can still be used by Codchi (see [config](../1.introduction/3.config.md)).


::alert{type="warning"}

Expand Down

0 comments on commit bc63f13

Please sign in to comment.