Compare commits

..

2 Commits

Author SHA1 Message Date
sawka 8a92ea1857 playing with tab styles 2024-02-29 09:37:14 -08:00
sawka 65fe908649 trying to work the logo into the sidebar 2024-02-29 00:13:25 -08:00
13 changed files with 193 additions and 1001 deletions
+17 -89
View File
@@ -11,15 +11,15 @@ jobs:
matrix:
include:
- platform: "darwin"
arch: "universal"
arch: "x64"
runner: "macos-latest"
scripthaus: "build-package"
- platform: "darwin"
arch: "arm64"
runner: "macos-latest-xlarge"
scripthaus: "build-package"
- platform: "linux"
arch: "arm64"
runner: "ubuntu-latest"
scripthaus: "build-package-linux"
- platform: "linux"
arch: "amd64"
arch: "x64"
runner: "ubuntu-latest"
scripthaus: "build-package-linux"
runs-on: ${{ matrix.runner }}
@@ -29,11 +29,6 @@ jobs:
with:
repository: scripthaus-dev/scripthaus
path: scripthaus
- name: Install Linux Build Dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install rpm flatpak flatpak-builder snapcraft
- uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
@@ -41,8 +36,7 @@ jobs:
wavesrv/go.sum
waveshell/go.sum
scripthaus/go.sum
- name: Install Scripthaus
run: |
- run: |
go work use ./scripthaus;
cd scripthaus;
go get ./...;
@@ -51,96 +45,30 @@ jobs:
with:
node-version: ${{env.NODE_VERSION}}
cache: "yarn"
- name: Set Version
id: set-version
- id: set-version
run: |
VERSION=$(node -e 'console.log(require("./version.js"))')
echo "WAVETERM_VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Install Yarn Dependencies
run: yarn --frozen-lockfile
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
run: ./scripthaus/scripthaus run ${{ matrix.scripthaus }}
env:
GOARCH: ${{ matrix.arch }}
- run: yarn --frozen-lockfile
- run: ./scripthaus/scripthaus run ${{ matrix.scripthaus }}
- uses: actions/upload-artifact@v4
with:
name: waveterm-build-${{ matrix.platform }}
path: out/make/*
name: waveterm-build-${{ matrix.platform }}-${{ matrix.arch }}
path: out/make/zip/${{ matrix.platform }}/${{ matrix.arch }}/*.zip
retention-days: 2
runbuild-linux-arm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: scripthaus-dev/scripthaus
path: scripthaus
- name: Install Linux Build Dependencies
run: |
sudo apt-get update
sudo apt-get install rpm flatpak flatpak-builder snapcraft
- uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: |
wavesrv/go.sum
waveshell/go.sum
scripthaus/go.sum
- name: Install Scripthaus
run: |
go work use ./scripthaus;
cd scripthaus;
go get ./...;
CGO_ENABLED=1 go build -o scripthaus cmd/main.go
- uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
cache: "yarn"
- name: Set Version
id: set-version
run: |
VERSION=$(node -e 'console.log(require("./version.js"))')
echo "WAVETERM_VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Install Yarn Dependencies
run: yarn --frozen-lockfile
- name: Build linux/arm64
uses: pguyot/arm-runner-action@v2
with:
image_additional_mb: 2000
base_image: dietpi:rpi_armv8_bullseye
bind_mount_repository: true
commands: |
sudo apt-get update && sudo apt-get install -y snapd git
sudo snap install --classic go
git clone
- uses: actions/upload-artifact@v4
with:
name: waveterm-build-linux-arm
path: out/make/*
retention-days: 2
upload:
name: "Upload Builds"
runs-on: ubuntu-latest
needs: [runbuild, runbuild-linux-arm]
needs: [runbuild]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: download
- name: Move builds into buildtemp
run: |
mkdir buildtemp
# Will only move over the files, flattening the directory structure
find download -mindepth 2 -type f -exec mv -t buildtemp -i '{}' +
- name: Set `version.txt`
run: |
path: buildtemp
- run: |
echo "${{ needs.runbuild.outputs.WAVETERM_VERSION }}" > buildtemp/version.txt
- name: Zip Builds
run: (cd buildtemp; zip ../waveterm-builds.zip *)
- name: Upload to S3
run: aws s3 cp waveterm-builds.zip s3://waveterm-github-artifacts/
- run: (cd buildtemp; zip ../waveterm-builds.zip *)
- run: aws s3 cp waveterm-builds.zip s3://waveterm-github-artifacts/
env:
AWS_ACCESS_KEY_ID: "${{ secrets.S3_USERID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.S3_SECRETKEY }}"
+1 -1
View File
@@ -9,7 +9,7 @@
# Wave Terminal
An open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.
A open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.
Wave isn't just another terminal emulator; it's a rethink on how terminals are built. Wave combines command line with the power of the open web to help veteran CLI users and new developers alike.
-24
View File
@@ -1,24 +0,0 @@
sudo apt-get update && sudo apt-get install -y snapd git
sudo snap install --classic go && sudo snap install --classic yarn
rm -rf dist/
rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv $GOARCH
yarn run electron-builder -c electron-builder.config.js -l
-71
View File
@@ -1,71 +0,0 @@
const pkg = require("./package.json");
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const config = {
artifactName: "${productName}-${version}-${arch}.${ext}",
npmRebuild: false,
nodeGypRebuild: false,
electronCompile: false,
publish: null,
files: [
{
from: "./dist",
to: "./dist",
filter: ["**/*"],
},
{
from: "./public",
to: "./public",
filter: ["**/*"],
},
{
from: "./bin",
to: "./bin",
filter: ["**/*"],
},
{
from: ".",
to: ".",
filter: ["package.json"],
},
"!**/node_modules/**${/*}", // Ignore node_modules by default
{
from: "./node_modules",
to: "./node_modules",
filter: ["monaco-editor/min/**/*"], // This is the only module we want to include
},
],
directories: {
output: "make",
},
appId: pkg.build.appId,
productName: pkg.productName,
mac: {
target: {
target: "zip",
arch: "universal",
},
icon: "public/waveterm.icns",
category: "public.app-category.developer-tools",
minimumSystemVersion: "10.15.0",
asarUnpack: ["bin/**/*"],
},
linux: {
executableName: pkg.productName,
category: "TerminalEmulator",
icon: "public/waveterm.icns",
target: ["zip", "deb"],
asar: false,
desktop: {
Name: pkg.productName,
Comment: pkg.description,
Keywords: "developer;terminal;emulator;",
category: "Development;Utility;",
},
},
};
module.exports = config;
+8 -59
View File
@@ -1,5 +1,4 @@
const pkg = require("./package.json");
let AllowedFirstParts = {
var AllowedFirstParts = {
"package.json": true,
dist: true,
public: true,
@@ -7,11 +6,11 @@ let AllowedFirstParts = {
bin: true,
};
let AllowedNodeModules = {
var AllowedNodeModules = {
"monaco-editor": true,
};
let modCache = {};
var modCache = {};
function ignoreFn(path) {
let parts = path.split("/");
@@ -48,7 +47,11 @@ function ignoreFn(path) {
module.exports = {
packagerConfig: {
ignore: ignoreFn,
files: ["package.json", "dist/*", "public/*", "bin/*"],
files: [
"package.json",
"dist/*",
"public/*",
],
icon: "public/waveterm.icns",
},
rebuildConfig: {},
@@ -57,59 +60,5 @@ module.exports = {
name: "@electron-forge/maker-zip",
platforms: ["darwin", "linux"],
},
{
name: "@electron-forge/maker-deb",
config: {
options: {
bin: pkg.productName,
name: pkg.name,
genericName: "Terminal Emulator",
productName: pkg.productName,
productDescription: pkg.description,
icon: "public/waveterm.icns",
categories: ["Utility", "Development"],
maintainer: pkg.author,
homepage: pkg.homepage,
license: pkg.license,
version: pkg.version,
},
},
},
{
name: "@electron-forge/maker-rpm",
config: {
options: {
bin: pkg.productName,
name: pkg.name,
genericName: "Terminal Emulator",
productName: pkg.productName,
description: pkg.description,
productDescription: pkg.description,
icon: "public/waveterm.icns",
categories: ["Utility", "Development"],
license: pkg.license,
version: pkg.version,
},
},
},
// {
// name: "@electron-forge/maker-flatpak",
// config: {
// options: {
// bin: pkg.productName,
// mimeType: ["text/plain"],
// },
// },
// },
// {
// name: "@electron-forge/maker-snap",
// config: {
// features: {
// audio: true,
// mpris: "com.commandline.waveterm",
// webgl: true,
// },
// },
// },
],
};
+8 -23
View File
@@ -1,22 +1,10 @@
{
"name": "waveterm",
"author": {
"name": "Command Line Inc",
"email": "info@commandline.dev"
},
"author": "Command Line Inc",
"productName": "Wave",
"description": "An open-source, cross-platform, AI-integrated, modern terminal for seamless workflows.",
"version": "0.6.1",
"version": "v0.6.1",
"main": "dist/emain.js",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/wavetermdev/waveterm"
},
"homepage": "https://waveterm.dev",
"build": {
"appId": "dev.commandline.waveterm"
},
"dependencies": {
"@monaco-editor/react": "^4.5.1",
"@table-nav/core": "^0.0.7",
@@ -63,12 +51,12 @@
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.17.12",
"@electron-forge/cli": "^7.2.0",
"@electron-forge/maker-deb": "^7.3.0",
"@electron-forge/maker-flatpak": "^7.3.0",
"@electron-forge/maker-rpm": "^7.3.0",
"@electron-forge/maker-deb": "^7.2.0",
"@electron-forge/maker-rpm": "^7.2.0",
"@electron-forge/maker-snap": "^7.2.0",
"@electron-forge/maker-squirrel": "^7.2.0",
"@electron-forge/maker-zip": "^7.3.0",
"@electron-forge/maker-zip": "^7.2.0",
"@electron/rebuild": "^3.4.0",
"@svgr/webpack": "^8.1.0",
"@types/classnames": "^2.3.1",
"@types/electron": "^1.6.10",
@@ -84,7 +72,6 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.1",
"electron": "29.0.1",
"electron-builder": "^24.12.0",
"file-loader": "^6.2.0",
"http-server": "^14.1.1",
"less": "^4.1.2",
@@ -102,7 +89,5 @@
"webpack-dev-server": "^4.9.1",
"webpack-merge": "^5.8.0"
},
"scripts": {
"postinstall": "electron-builder install-app-deps"
}
}
"scripts": {}
}
+24 -37
View File
@@ -44,21 +44,13 @@ rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv arm64
buildWaveSrv amd64
yarn run electron-builder -c electron-builder.config.js -m
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go)
(cd wavesrv; CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd)
node_modules/.bin/electron-forge make
```
```bash
@@ -69,43 +61,38 @@ rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --env prod
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
function buildWaveSrv {
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 GOARCH=$1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$1 ./cmd)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
buildWaveSrv $GOARCH
yarn run electron-builder -c electron-builder.config.js -l
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go)
(cd waveshell; CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go)
# adds -extldflags=-static, *only* on linux (macos does not support fully static binaries) to avoid a glibc dependency
(cd wavesrv; CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-linkmode 'external' -extldflags=-static $GO_LDFLAGS -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd)
node_modules/.bin/electron-forge make
```
```bash
# @scripthaus command open-electron-package
# @scripthaus cd :playbook
open out/Wave-darwin-x64/Wave.app
```
```bash
# @scripthaus command build-wavesrv
WAVESRV_VERSION=$(node -e 'console.log(require("./version.js"))')
cd wavesrv
CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv.$GOARCH ./cmd
CGO_ENABLED=1 go build -tags "osusergo,netgo,sqlite_omit_load_extension" -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M') -X main.WaveVersion=$WAVESRV_VERSION" -o ../bin/wavesrv ./cmd
```
```bash
# @scripthaus command fullbuild-waveshell
set -e
cd waveshell
WAVESHELL_VERSION=v0.4
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
function buildWaveShell {
(cd waveshell; CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-$WAVESHELL_VERSION-$1.$2 main-waveshell.go)
}
buildWaveShell darwin amd64
buildWaveShell darwin arm64
buildWaveShell linux amd64
buildWaveShell linux arm64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.amd64 main-waveshell.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-linux.arm64 main-waveshell.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.amd64 main-waveshell.go
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.4-darwin.arm64 main-waveshell.go
```
```bash
+1 -1
View File
@@ -17,7 +17,7 @@ body {
body {
&.is-dev .sidebar {
background-color: var(--app-panel-bg-color-dev);
// background-color: var(--app-panel-bg-color-dev);
}
}
+40 -4
View File
@@ -15,12 +15,19 @@
font-family: var(--label-font-family);
font-weight: var(--sidebar-font-weight);
.sidebar-content {
height: 100vh;
display: flex;
flex-direction: column;
}
.title-bar-drag {
-webkit-app-region: drag;
height: calc(var(--screentabs-height) + 1px);
border-bottom: 1px solid var(--app-border-color);
position: relative;
display: flex;
flex-shrink: 0;
.logo {
line-height: 15px;
@@ -47,13 +54,22 @@
}
.contents {
display: flex;
flex-direction: column;
width: 100%;
margin-top: 16px;
flex-grow: 1;
}
.separator {
height: 1px;
margin: 16px 0;
background-color: var(--sidebar-separator-color);
flex-shrink: 0;
}
.sidebar-spacer {
flex-grow: 1;
}
.item.workspaces-item {
@@ -80,12 +96,32 @@
}
}
.sidebar-logo-div {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-grow: 100;
max-height: 180px;
img {
filter: grayscale(1);
opacity: 0.2;
transition: filter 1.5s ease-in-out, opacity 1.5s ease-in-out;
max-width: 200px;
}
}
&:hover .sidebar-logo-div {
img {
filter: grayscale(0);
opacity: 1;
}
}
.bottom {
position: absolute;
bottom: 2rem;
left: 0;
padding-bottom: 1rem;
width: 100%;
padding-top: 0.8rem;
flex-shrink: 0;
}
.item {
+7 -10
View File
@@ -247,9 +247,9 @@ class MainSideBar extends React.Component<MainSideBarProps, {}> {
*/
setMiddleHeightSubtractor() {
const windowHeight = window.innerHeight;
const bottomHeight = windowHeight - window.document.getElementById("sidebar-bottom")?.offsetTop;
const bottomHeight = window.document.getElementById("sidebar-bottom")?.offsetHeight;
const middleTop = document.getElementById("sidebar-middle")?.offsetTop;
const newMiddleHeightSubtractor = bottomHeight + middleTop;
const newMiddleHeightSubtractor = bottomHeight + middleTop + 200;
if (!Number.isNaN(newMiddleHeightSubtractor)) {
mobx.action(() => {
this.middleHeightSubtractor.set(newMiddleHeightSubtractor);
@@ -278,14 +278,6 @@ class MainSideBar extends React.Component<MainSideBarProps, {}> {
{(toggleCollapse) => (
<React.Fragment>
<div className="title-bar-drag">
<div className="logo">
<If condition={sidebarWidth > 215}>
<WaveLogoWord />
</If>
<If condition={sidebarWidth <= 215}>
<WaveLogo />
</If>
</div>
<div className="close-button">
<i className="fa-sharp fa-solid fa-xmark-large" onClick={toggleCollapse} />
</div>
@@ -332,6 +324,11 @@ class MainSideBar extends React.Component<MainSideBarProps, {}> {
>
{this.getSessions()}
</div>
<div className="sidebar-spacer" />
<div className="sidebar-logo-div">
<img src="public/logos/wave-logo.png" alt="logo" />
</div>
<div className="sidebar-spacer" />
<div className="bottom" id="sidebar-bottom">
{this.getUpdateAppBanner()}
<If condition={GlobalModel.isDev}>
+14 -18
View File
@@ -102,13 +102,21 @@
// This applies a transparency mask to the background color, as set above, so that it will blend with whatever the theme's background color is.
z-index: 1;
width: var(--screen-tab-width);
mask-image: linear-gradient(
rgba(0, 0, 0, 1),
rgba(0, 0, 0, 0.7) 15%,
rgba(0, 0, 0, 0.5) 30%,
rgba(0, 0, 0, 0) 100%
);
mask-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 100%);
}
&.is-active {
border-top: 2px solid var(--tab-green);
opacity: 1;
font-weight: var(--screentabs-selected-font-weight);
}
&.is-archived {
.fa.fa-archive {
margin-right: 4px;
}
}
.screen-tab-inner {
display: flex;
flex-direction: row;
@@ -127,18 +135,6 @@
flex-grow: 1;
}
&.is-active {
border-top: none;
opacity: 1;
font-weight: var(--screentabs-selected-font-weight);
}
&.is-archived {
.fa.fa-archive {
margin-right: 4px;
}
}
// Only one of these will be visible at a time
.end-icons {
// This adjusts the position of the icon to account for the default 8px margin on the parent. We want the positional calculations for this icon to assume it is flush with the edge of the screen tab.
+21 -37
View File
@@ -69,10 +69,9 @@ function log(...msg: any[]) {
console.log = log;
console.log(
sprintf(
"waveterm-app starting, WAVETERM_HOME=%s, electronpath=%s gopath=%s arch=%s/%s",
"waveterm-app starting, WAVETERM_HOME=%s, apppath=%s arch=%s/%s",
waveHome,
getElectronAppBasePath(),
getGoAppBasePath(),
getAppBasePath(),
unamePlatform,
unameArch
)
@@ -131,46 +130,31 @@ function checkPromptMigrate() {
}
}
/**
* Gets the base path to the Electron app resources. For dev, this is the root of the project. For packaged apps, this is the app.asar archive.
* @returns The base path of the Electron application
*/
function getElectronAppBasePath(): string {
// for dev, this is just the waveterm directory
// for prod, this is .../Wave.app/Contents/Resources/app
function getAppBasePath() {
return path.dirname(__dirname);
}
/**
* Gets the base path to the Go backend. If the app is packaged as an asar, the path will be in a separate unpacked directory.
* @returns The base path of the Go backend
*/
function getGoAppBasePath(): string {
const appDir = getElectronAppBasePath();
if (appDir.endsWith(".asar")) {
return `${appDir}.unpacked`;
} else {
return appDir;
}
}
function getBaseHostPort(): string {
function getBaseHostPort() {
if (isDev) {
return DevServerEndpoint;
}
return ProdServerEndpoint;
}
function getWaveSrvPath(): string {
return path.join(getGoAppBasePath(), "bin", `wavesrv.${unameArch}`);
function getWaveSrvPath() {
return path.join(getAppBasePath(), "bin", "wavesrv");
}
function getWaveSrvCmd(): string {
function getWaveSrvCmd() {
const waveSrvPath = getWaveSrvPath();
const waveHome = getWaveHomeDir();
const logFile = path.join(waveHome, "wavesrv.log");
return `"${waveSrvPath}" >> "${logFile}" 2>&1`;
}
function getWaveSrvCwd(): string {
function getWaveSrvCwd() {
return getWaveHomeDir();
}
@@ -178,7 +162,7 @@ function ensureDir(dir: fs.PathLike) {
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
}
function readAuthKey(): string {
function readAuthKey() {
const homeDir = getWaveHomeDir();
const authKeyFileName = path.join(homeDir, AuthKeyFile);
if (!fs.existsSync(authKeyFileName)) {
@@ -275,7 +259,7 @@ electron.Menu.setApplicationMenu(menu);
let MainWindow: Electron.BrowserWindow | null = null;
function getMods(input: any): object {
function getMods(input: any) {
return { meta: input.meta, shift: input.shift, ctrl: input.control, alt: input.alt };
}
@@ -307,7 +291,7 @@ function shFrameNavHandler(event: Electron.Event<Electron.WebContentsWillFrameNa
console.log("frame navigation canceled");
}
function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWindow {
function createMainWindow(clientData: ClientDataType | null) {
const bounds = calcBounds(clientData);
setKeyUtilPlatform(platform());
const win = new electron.BrowserWindow({
@@ -321,11 +305,11 @@ function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWi
transparent: true,
icon: unamePlatform == "linux" ? "public/logos/wave-logo-dark.png" : undefined,
webPreferences: {
preload: path.join(getElectronAppBasePath(), DistDir, "preload.js"),
preload: path.join(getAppBasePath(), DistDir, "preload.js"),
},
});
const indexHtml = isDev ? "index-dev.html" : "index.html";
win.loadFile(path.join(getElectronAppBasePath(), "public", indexHtml));
win.loadFile(path.join(getAppBasePath(), "public", indexHtml));
win.webContents.on("before-input-event", (e, input) => {
const waveEvent = adaptFromElectronKeyEvent(input);
if (win.isFocused()) {
@@ -466,7 +450,7 @@ function mainResizeHandler(_: any, win: Electron.BrowserWindow) {
});
}
function calcBounds(clientData: ClientDataType): Electron.Rectangle {
function calcBounds(clientData: ClientDataType) {
const primaryDisplay = electron.screen.getPrimaryDisplay();
const pdBounds = primaryDisplay.bounds;
const size = { x: 100, y: 100, width: pdBounds.width - 200, height: pdBounds.height - 200 };
@@ -588,7 +572,7 @@ function readLastLinesOfFile(filePath: string, lineCount: number) {
});
}
function getContextMenu(): electron.Menu {
function getContextMenu(): any {
const menu = new electron.Menu();
const menuItem = new electron.MenuItem({ label: "Testing", click: () => console.log("click testing!") });
menu.append(menuItem);
@@ -601,7 +585,7 @@ function getFetchHeaders() {
};
}
async function getClientDataPoll(loopNum: number): Promise<ClientDataType | null> {
async function getClientDataPoll(loopNum: number) {
const lastTime = loopNum >= 6;
const cdata = await getClientData(!lastTime, loopNum);
if (lastTime || cdata != null) {
@@ -611,7 +595,7 @@ async function getClientDataPoll(loopNum: number): Promise<ClientDataType | null
return getClientDataPoll(loopNum + 1);
}
async function getClientData(willRetry: boolean, retryNum: number): Promise<ClientDataType | null> {
async function getClientData(willRetry: boolean, retryNum: number) {
const url = new URL(getBaseHostPort() + "/api/get-client-data");
const fetchHeaders = getFetchHeaders();
return fetch(url, { headers: fetchHeaders })
@@ -650,13 +634,13 @@ function runWaveSrv() {
pReject = argReject;
});
const envCopy = { ...process.env };
envCopy[WaveAppPathVarName] = getGoAppBasePath();
envCopy[WaveAppPathVarName] = getAppBasePath();
if (isDev) {
envCopy[WaveDevVarName] = "1";
}
const waveSrvCmd = getWaveSrvCmd();
console.log("trying to run local server", waveSrvCmd);
const proc = child_process.execFile("bash", ["-c", waveSrvCmd], {
const proc = child_process.spawn("bash", ["-c", waveSrvCmd], {
cwd: getWaveSrvCwd(),
env: envCopy,
});
+52 -627
View File
File diff suppressed because it is too large Load Diff