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

Improve app UX and simplify interface #17

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion index.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ body {
}

.myarrow:before {
display: none;
content: '';
height: 0;
width: 0;
Expand All @@ -38,7 +39,7 @@ body {
}

.page {
background: #eeeeee;
background: rgba(255,255,255,0.985);
width: 100%;
height: 100vh;
margin-top: 12px;
Expand Down
50 changes: 39 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,32 @@
</head>
<body class="myarrow">
<div class="page darwin">
<webview id="webview" src="https://chat.openai.com/chat" autosize="on" >
</webview>
</div>
<webview id="webview" src="https://chat.openai.com/chat" autosize="on">
</webview>
</div>
<script>
const webview = document.getElementById('webview');
webview.addEventListener('dom-ready', function() {
const webview = document.getElementById("webview");
webview.addEventListener("dom-ready", function () {
// hide message below text input, sidebar, suggestions on new chat
webview.insertCSS(`
.dark.hidden.bg-gray-900 {
// display: none !important;
}

@media (max-width: 1200px) {
.dark.hidden.bg-gray-900 {
display: none !important;
}

.md\\:pl-\\[260px\\] {
padding-left: 0 !important;
}
}

[class*="Thread__Wrapper"] > div:first-child{
padding-left: 0 !important;
}

// hide message below text input, sidebar, suggestions on new chat
webview.insertCSS(`
.text-xs.text-center {
opacity: 0;
height: 0;
Expand All @@ -39,13 +56,24 @@
margin-top: -40px;
font-size: 20px;
}
`)
`);

const element = webview.executeJavaScript(`
const element = webview.executeJavaScript(`
document.querySelector("[class*='shared__Wrapper']").innerHTML += "<h3>Start by asking anything.</h3>"
`);
});

const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
mediaQuery.addListener(updateStyles);
updateStyles(mediaQuery);

function updateStyles(mq) {
if (mq.matches) {
document.body.classList.add("dark");
} else {
document.body.classList.remove("dark");
}
}
`);
});
</script>
</body>
</html>
21 changes: 16 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require("update-electron-app")();
const electronReload = require("electron-reload");
Copy link

@kusalk kusalk Apr 20, 2023

Choose a reason for hiding this comment

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

Unused variable declaration?


const { menubar } = require("menubar");
const Nucleus = require("nucleus-analytics");
Expand All @@ -18,6 +19,10 @@ const image = nativeImage.createFromPath(
path.join(__dirname, `images/newiconTemplate.png`)
);

require("electron-reload")(__dirname, {
electron: path.join(__dirname, "node_modules", ".bin", "electron"),
Copy link

@kusalk kusalk Apr 20, 2023

Choose a reason for hiding this comment

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

Is this compatible with electron-forge make?
edit: Isn't this a development tool - why's it in the PR

});

app.on("ready", () => {
Nucleus.init("638d9ccf4a5ed2dae43ce122");

Expand All @@ -31,8 +36,9 @@ app.on("ready", () => {
webviewTag: true,
// nativeWindowOpen: true,
},
width: 450,
height: 550,
minWidth: 400,
width: 500,
height: 650,
},
tray,
showOnAllWorkspaces: true,
Expand All @@ -43,8 +49,7 @@ app.on("ready", () => {

mb.on("ready", () => {
const { window } = mb;


window.setAlwaysOnTop(true, "floating", 1);
if (process.platform !== "darwin") {
window.setSkipTaskbar(true);
} else {
Expand Down Expand Up @@ -94,9 +99,15 @@ app.on("ready", () => {
mb.tray.popUpContextMenu(Menu.buildFromTemplate(contextMenuTemplate));
});

tray.on("click", (e) => {
//check if ctrl or meta key is pressed while clicking
e.ctrlKey || e.metaKey
? mb.tray.popUpContextMenu(Menu.buildFromTemplate(contextMenuTemplate))
: null;
});
const menu = new Menu();

globalShortcut.register("CommandOrControl+Shift+g", () => {
globalShortcut.register("CommandOrControl+Alt+g", () => {

Choose a reason for hiding this comment

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

I would be cautious about making this change, as it isn't backwards-compatible and people may already be accustomed to the current shortcut. Additionally, I believe the new one is already used by Google Drive.

Copy link

Choose a reason for hiding this comment

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

The original shortcut is honestly easier to press on both Win and Mac (for my hand anyway)

if (window.isVisible()) {
mb.hideWindow();
} else {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"license": "MIT",
"dependencies": {
"electron-context-menu": "^3.6.0",
"electron-reload": "^2.0.0-alpha.1",
"menubar": "^9.2.3",
"nucleus-analytics": "^4.0.3",
"update-electron-app": "^2.0.1"
Expand Down