Created
July 8, 2020 08:40
-
-
Save ssig33/32eb23b49675a9de17cf6740e0a7ed69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta charset="utf-8" /> | |
<title>Clipboard</title> | |
<div id="area"></div> | |
<script> | |
const electron = require("electron"); | |
const ipc = electron.ipcRenderer; | |
const loop = async () => { | |
const text = ipc.sendSync("clipboard", "yokose"); | |
document.querySelector("#area").textContent = text; | |
setTimeout(() => { | |
loop(); | |
}, 2000); | |
}; | |
loop(); | |
</script> | |
<style> | |
body { | |
background-color: rgba(24, 24, 24, 0.7); | |
color: #fff; | |
-webkit-app-region: drag; | |
-webkit-user-select: none; | |
font-size: small; | |
margin: 0; | |
overflow: hidden; | |
} | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require("electron"); | |
const { clipboard } = require("electron"); | |
const BrowserWindow = electron.BrowserWindow; | |
const app = electron.app; | |
const ipc = electron.ipcMain; | |
app.on("ready", () => { | |
const window = new BrowserWindow({ | |
width: 200, | |
height: 40, | |
transparent: true, | |
alwaysOnTop: true | |
frame: false, | |
hasShadow: false, | |
webPreferences: { | |
nodeIntegration: true, | |
}, | |
}); | |
window.loadURL("file://" + __dirname + "/index.html"); | |
window.setMenu(null); | |
ipc.on("clipboard", (e, a) => { | |
const text = clipboard.readText(); | |
e.returnValue = text; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "clip_widget", | |
"version": "0.0.1", | |
"main": "main.js" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment