Skip to content

Commit 575ce1d

Browse files
authored
Sort the VM-list (#6717)
1 parent b511323 commit 575ce1d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

vboxlauncher@mockturtl/files/vboxlauncher@mockturtl/applet.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const CMD_VBOX = "virtualbox"
1414
const CMD_VBOXMANAGE = "vboxmanage"
1515

1616
const CMD_VBOX_VM = CMD_VBOXMANAGE + " startvm "
17-
const CMD_VBOX_LIST = CMD_VBOXMANAGE + " list vms"
18-
const CMD_VBOX_LIST_RUN = CMD_VBOXMANAGE + " list runningvms"
17+
const CMD_VBOX_LIST = CMD_VBOXMANAGE + " list --sorted vms"
18+
const CMD_VBOX_LIST_RUN = CMD_VBOXMANAGE + " list --sorted runningvms"
1919
const CMD_VBOX_VERSION = CMD_VBOXMANAGE + " -v"
2020
var VBOX_ISRUNNING = "0"
2121

@@ -71,12 +71,12 @@ const stringFromUTF8Array = function(data) {
7171
}
7272

7373

74-
function MyApplet(metadata, orientation, panelHeight, instanceId) {
74+
function VBoxLauncher(metadata, orientation, panelHeight, instanceId) {
7575
this.settings = new Settings.AppletSettings(this, UUID, instanceId)
7676
this._init(orientation, panelHeight, instanceId)
7777
}
7878

79-
MyApplet.prototype = {
79+
VBoxLauncher.prototype = {
8080
__proto__: Applet.IconApplet.prototype
8181

8282
, _init: function(orientation, panelHeight, instanceId) {
@@ -325,9 +325,14 @@ MyApplet.prototype = {
325325
, onSwitchShowHeadless: function() {
326326
this.updateMenu() // Whether or not to show headless modes
327327
}
328+
, on_applet_removed_from_panel: function(event) {
329+
if (this.menu.isOpen)
330+
this.menu.close();
331+
this.menu.removeAll();
332+
}
328333

329334
}
330335

331336
function main(metadata, orientation, panelHeight, instanceId) {
332-
return new MyApplet(metadata, orientation, panelHeight, instanceId)
337+
return new VBoxLauncher(metadata, orientation, panelHeight, instanceId)
333338
}

vboxlauncher@mockturtl/files/vboxlauncher@mockturtl/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"uuid": "vboxlauncher@mockturtl",
33
"name": "Vbox Launcher",
44
"description": "An applet to launch virtual machines.",
5-
"version": "0.4.1"
5+
"version": "0.4.2",
6+
"author": "mockturtl"
67
}

0 commit comments

Comments
 (0)