Skip to content

Commit 6237184

Browse files
committed
Add an option to either Edit or Run launchers on double-click
1 parent 75305bc commit 6237184

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

Lib/Launchpad/Config/LaunchpadConfig.ahk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@
129129
set => this.SetIniValue("PlatformsViewMode", value)
130130
}
131131

132+
LauncherDoubleClickAction {
133+
get => this.GetIniValue("LauncherDoubleClickAction") || "Edit"
134+
set => this.SetIniValue("LauncherDoubleClickAction", value)
135+
}
136+
132137
LaunchersLoaded() {
133138
return (this.app.Launchers != "")
134139
}

Lib/Launchpad/Window/Form/SettingsWindow.ahk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
availableThemes := Map()
33
logLevels := ["None", "Error", "Warning", "Info", "Debug"]
44
listViewModes := ["Report", "Tile", "List"]
5+
doubleClickActions := ["Edit", "Run"]
56
needsRestart := false
67

78
__New(app, themeObj, windowKey, owner := "", parent := "") {
@@ -28,6 +29,12 @@
2829
ctl.OnEvent("Change", "OnLaunchersViewModeChange")
2930
ctl.ToolTip := "Select how you would like to view your launchers in the main window."
3031

32+
this.AddHeading("Double-Click Action")
33+
chosen := this.GetItemIndex(this.doubleClickActions, this.app.Config.LauncherDoubleClickAction)
34+
ctl := this.guiObj.AddDDL("vLauncherDoubleClickAction xs y+m Choose" . chosen . " w250 c" . this.themeObj.GetColor("editText"), this.doubleClickActions)
35+
ctl.OnEvent("Change", "OnLauncherDoubleClickActionChange")
36+
ctl.ToolTip := "Select what you would like to happen when double-clicking a launcher in the main list."
37+
3138
this.AddConfigLocationBlock("Launcher File", "LauncherFile", "Reload")
3239
this.AddConfigLocationBlock("Launcher Directory", "DestinationDir")
3340
this.AddConfigLocationBlock("Assets Directory", "AssetsDir")
@@ -280,6 +287,11 @@
280287
this.app.Config.PlatformsViewMode := this.listViewModes[ctl.Value]
281288
}
282289

290+
OnLauncherDoubleClickActionChange(ctl, info) {
291+
this.guiObj.Submit(false)
292+
this.app.Config.LauncherDoubleClickAction := this.doubleClickActions[ctl.Value]
293+
}
294+
283295
OnBackupsViewModeChange(ctl, info) {
284296
this.guiObj.Submit(false)
285297
this.app.Config.BackupsViewMode := this.listViewModes[ctl.Value]

Lib/Launchpad/Window/ManageWindow/MainWindow.ahk

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@
4444
this.app.Builders.BuildLaunchers(Map(launcherKey, launcher), true)
4545
this.UpdateListView()
4646
} else if (result == "RunLauncher") {
47-
if (launcher.IsBuilt) {
48-
file := launcher.GetLauncherFile(launcherKey, false)
49-
50-
if (file) {
51-
Run(file,, "Hide")
52-
}
53-
}
47+
this.RunLauncher(launcherKey)
5448
} else if (result == "DeleteLauncher") {
5549
result := this.app.GuiManager.Dialog("LauncherDeleteWindow", launcher, this.app.Services.Get("LauncherManager"), this.windowKey)
5650

@@ -60,6 +54,18 @@
6054
}
6155
}
6256

57+
RunLauncher(launcherKey) {
58+
launcher := this.launcherManager.Entities[launcherKey]
59+
60+
if (launcher && launcher.IsBuilt) {
61+
file := launcher.GetLauncherFile(launcherKey, false)
62+
63+
if (file) {
64+
Run(file,, "Hide")
65+
}
66+
}
67+
}
68+
6369
ShowTitleMenu() {
6470
toolsItems := []
6571
toolsItems.Push(Map("label", "Manage &Platforms", "name", "ManagePlatforms"))
@@ -207,7 +213,12 @@
207213

208214
OnDoubleClick(LV, rowNum) {
209215
key := this.listView.GetRowKey(rowNum)
210-
this.EditLauncher(key)
216+
217+
if (this.app.Config.LauncherDoubleClickAction == "Run") {
218+
this.RunLauncher(key)
219+
} else {
220+
this.EditLauncher(key)
221+
}
211222
}
212223

213224
EditLauncher(key) {

0 commit comments

Comments
 (0)