Skip to content

Commit a017571

Browse files
committed
Add ability to kill process from list + Installer is now one click + Litle tweaks
1 parent 05ac733 commit a017571

File tree

9 files changed

+93
-37
lines changed

9 files changed

+93
-37
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/* globals INCLUDE_RESOURCES_PATH */
2+
/* eslint-disable */
23
import Vue from "vue";
34

45
/**
56
* Set `__resources` path to resources files in renderer process
67
*/
7-
global.__resources = undefined; // eslint-disable-line no-underscore-dangle
8+
global.__resources = undefined;
89
// noinspection BadExpressionStatementJS
9-
INCLUDE_RESOURCES_PATH; // eslint-disable-line no-unused-expressions
10+
INCLUDE_RESOURCES_PATH;
1011
if (__resources === undefined) console.error("[Renderer-process]: Resources path is undefined");
1112

1213
Vue.prototype.__resources = __resources;

builder.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const windowsOS = {
88
target: "nsis"
99
},
1010
nsis: {
11-
oneClick: false,
11+
oneClick: true,
1212
differentialPackage: true,
1313
createDesktopShortcut: true,
1414
allowToChangeInstallationDirectory: false

src/main/index.dev.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Menu, MenuItem, app } from "electron";
1+
import { app } from "electron";
22
import electronDebug from "electron-debug";
33
import vueDevtools from "vue-devtools";
4-
import { ELECTRON_RELAUNCH_CODE } from "../../.electron-nuxt/config";
54
import mainWinHandler from "./mainWindow";
65
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
76
electronDebug({

src/main/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* globals INCLUDE_RESOURCES_PATH */
2+
/* eslint-disable */
23
import { app } from "electron";
34

45
/**

src/renderer/components/CpuInformation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
Max frequency:
3232
</div>
3333
<div class="value">
34-
{{ cpuSpeed }}
34+
{{ cpuSpeed }} Ghz
3535
</div>
3636
</div>
3737
<div class="item">

src/renderer/components/GpuInformation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
VRAM:
3636
</div>
3737
<div class="value">
38-
{{ vram }}
38+
{{ (vram / 1024).toFixed() }} Go
3939
</div>
4040
</div>
4141
<hr>
@@ -51,7 +51,7 @@
5151
</div>
5252
<hr>
5353
<div
54-
v-for="{ vendor, model, connection, resolution, refreshRate } in displays"
54+
v-for="{ vendor, model, connection, resolution } in displays"
5555
class="items"
5656
>
5757
<!-- <div class="item">

src/renderer/components/RamInformation.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
Total:
1616
</div>
1717
<div class="value">
18-
{{ ramTotal }}
18+
{{ ramTotal }} Go
1919
</div>
2020
</div>
2121
<div class="item">
2222
<div class="name">
2323
Free:
2424
</div>
2525
<div class="value">
26-
{{ ramFree }}
26+
{{ ramFree }} Go
2727
</div>
2828
</div>
2929
<div class="item">
3030
<div class="name">
3131
Used:
3232
</div>
3333
<div class="value">
34-
{{ ramUsed }}
34+
{{ ramUsed }} Go
3535
</div>
3636
</div>
3737
</div>
@@ -57,9 +57,9 @@ export default {
5757
async checkSys () {
5858
var data;
5959
data = await mem();
60-
this.ramTotal = (data.total / 1000000000).toFixed(2) + " Go";
61-
this.ramFree = (data.free / 1000000000).toFixed(2) + " Go";
62-
this.ramUsed = (data.used / 1000000000).toFixed(2) + " Go";
60+
this.ramTotal = (data.total / 1073741824).toFixed(2);
61+
this.ramFree = (data.free / 1073741824).toFixed(2);
62+
this.ramUsed = (data.used / 1073741824).toFixed(2);
6363
}
6464
}
6565
};

src/renderer/pages/process.vue

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
large
4747
>
4848
fas fa-list
49-
</v-icon>Processes list <v-spacer />
49+
</v-icon>Processes list
50+
<v-spacer />
5051
</div>
5152
<div class="item">
5253
<div class="name">
@@ -93,10 +94,11 @@
9394
<tr
9495
v-for="item in process"
9596
:key="item.pid"
97+
@click="askKill(item.pid, item.name)"
9698
>
9799
<td>{{ item.name }}</td>
98-
<td>{{ item.pcpu.toFixed(3) }}%</td>
99-
<td>{{ item.pmem.toFixed(3) }}%</td>
100+
<td>{{ item.pcpu.toFixed(2) }}%</td>
101+
<td>{{ item.pmem.toFixed(2) }}%</td>
100102
</tr>
101103
</tbody>
102104
</template>
@@ -113,18 +115,18 @@
113115
<div class="e-nuxt-button" @click="openURL('https://electronjs.org/docs')">
114116
Electron.js
115117
</div>
116-
</div> -->
118+
</div>-->
117119
</div>
118120
</template>
119121

120122
<script>
121-
import { remote } from "electron";
123+
const dialog = require("electron").remote.dialog;
122124
const { currentLoad, processes } = require("systeminformation");
123125
124126
export default {
125-
data () {
127+
data() {
126128
return {
127-
radio: "name",
129+
radio: "cpu",
128130
avgLoad: 0,
129131
idleLoad: 0,
130132
currentLoad: 0,
@@ -139,25 +141,78 @@ export default {
139141
var data;
140142
data = await processes();
141143
this.process = [];
142-
for (let pro of data.list) {
143-
this.process.push(pro);
144-
}
144+
this.process = data.list;
145+
this.process = this.process.filter(el => el.name !== "System Idle Process" );
145146
if (this.radio === "cpu") {
146-
this.process.sort(function(a, b){return b.pcpu - a.pcpu;});
147+
this.process.sort(function(a, b) {
148+
return b.pcpu - a.pcpu;
149+
});
147150
} else if (this.radio === "mem") {
148-
this.process.sort(function(a, b){return b.pmem - a.pmem;});
151+
this.process.sort(function(a, b) {
152+
return b.pmem - a.pmem;
153+
});
149154
} else {
150-
this.process.sort(function(a, b){
151-
if(a.name < b.name) { return -1; }
152-
if(a.name > b.name) { return 1; }
155+
this.process.sort(function(a, b) {
156+
if (a.name < b.name) {
157+
return -1;
158+
}
159+
if (a.name > b.name) {
160+
return 1;
161+
}
153162
return 0;
154163
});
155164
}
156165
data = await currentLoad();
157166
this.avgLoad = data.avgload;
158167
this.currentLoad = data.currentload;
159168
this.idleLoad = data.currentload_idle;
160-
setTimeout(res => this.checkSys(), 2000);
169+
setTimeout(() => this.checkSys(), 2000);
170+
},
171+
askKill(pid, name) {
172+
if (name.includes("System Companion")) {
173+
dialog.showMessageBox(null, {
174+
type: "info",
175+
message: "Sorry you can't kill System Companion from here."
176+
});
177+
} else {
178+
dialog.showMessageBox(
179+
null,
180+
{
181+
type: "question",
182+
title: "Process kill",
183+
message: `Do you want to kill ${name} ?`,
184+
buttons: ["No", "Yes"]
185+
},
186+
response => {
187+
if (response === 1) {
188+
this.processKill(pid, name);
189+
}
190+
}
191+
);
192+
}
193+
},
194+
processKill(pid, name) {
195+
try {
196+
var done = process.kill(pid);
197+
if (done >= 0) {
198+
dialog.showMessageBox(null, {
199+
type: "info",
200+
title: "Process kill",
201+
message: `${name} as been killed`
202+
});
203+
} else {
204+
this.cantKill(name);
205+
}
206+
} catch (error) {
207+
this.cantKill(name);
208+
}
209+
},
210+
cantKill(name) {
211+
dialog.showMessageBox(null, {
212+
type: "info",
213+
title: "Process kill",
214+
message: `${name} can't be killed, try run System Companion as Admin`
215+
});
161216
}
162217
}
163218
};

src/renderer/plugins/vuetify.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import('roboto-fontface/css/roboto/roboto-fontface.css');
2-
import('roboto-fontface/fonts/roboto/Roboto-Thin.woff2') //100
3-
import('roboto-fontface/fonts/roboto/Roboto-Light.woff2') //300
4-
import('roboto-fontface/fonts/roboto/Roboto-Regular.woff2') //400
5-
import('roboto-fontface/fonts/roboto/Roboto-Medium.woff2') //500
6-
import('roboto-fontface/fonts/roboto/Roboto-Bold.woff2') //700
7-
import('roboto-fontface/fonts/roboto/Roboto-Black.woff2') //900
1+
import("roboto-fontface/css/roboto/roboto-fontface.css");
2+
import("roboto-fontface/fonts/roboto/Roboto-Thin.woff2"); //100
3+
import("roboto-fontface/fonts/roboto/Roboto-Light.woff2"); //300
4+
import("roboto-fontface/fonts/roboto/Roboto-Regular.woff2"); //400
5+
import("roboto-fontface/fonts/roboto/Roboto-Medium.woff2"); //500
6+
import("roboto-fontface/fonts/roboto/Roboto-Bold.woff2"); //700
7+
import("roboto-fontface/fonts/roboto/Roboto-Black.woff2"); //900

0 commit comments

Comments
 (0)