Skip to content

Commit 73b4569

Browse files
committed
update keybindings
1 parent 9489bf1 commit 73b4569

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

cmd/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ import (
1414
)
1515

1616
func init() {
17-
_, lazyDebridFolderPath, _ := config.ConfigPath()
18-
logPath := filepath.Join(lazyDebridFolderPath, "lazydebrid.log")
17+
cacheDir, err := os.UserCacheDir()
18+
if err != nil {
19+
log.Fatal("Could not get default cache dir for system. Cannot initialize log file.")
20+
}
21+
logPath := filepath.Join(cacheDir, "lazydebrid.log")
1922
logFile, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
2023
if err != nil {
2124
log.Fatal("Could not open log file:", err)

internal/bindings/bindings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func Keybindings(g *gocui.Gui) error {
3737
bind(views.ViewDetails, '/', gocui.ModNone, views.FocusSearchBar)
3838
bind(views.ViewDetails, '?', gocui.ModNone, handlers.ShowHelpModal)
3939

40+
bind(views.ViewTorrents, 'a', gocui.ModNone, handlers.ShowAddMagnetModal)
4041
bind(views.ViewTorrents, 'j', gocui.ModNone, views.CursorDown)
4142
bind(views.ViewTorrents, 'k', gocui.ModNone, views.CursorUp)
4243
bind(views.ViewTorrents, gocui.KeyArrowDown, gocui.ModNone, views.CursorDown)

internal/handlers/modals.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,38 @@ func ShowSetTokenModal(g *gocui.Gui, v *gocui.View) error {
3535
})
3636
}
3737

38+
func ShowAddMagnetModal(g *gocui.Gui, v *gocui.View) error {
39+
return views.ShowModal(g, views.ViewAddMagnet, "Add Magnet Link", "", func(input string) error {
40+
return HandleAddMagnetLink(g, input)
41+
})
42+
}
43+
3844
func ShowHelpModal(g *gocui.Gui, v *gocui.View) error {
3945
content := `
4046
── Navigation ─────────────
41-
↑ ↓ Move cursor
42-
TAB Switch view
43-
/ Focus search
47+
↑ ↓, j k Move cursor
48+
TAB Pane forward
49+
BACKSPACE Pane back
50+
/ Focus search
4451
4552
── Actions ────────────────
46-
ENTER Download selected
47-
^C Copy download link
48-
D Download all files
53+
ENTER, d Download selected (Details)
54+
D Download all files (Details)
55+
ENTER View torrent files (Torrents)
56+
y Copy download link (Details)
57+
a Add magnet link (Torrents)
4958
5059
── Management ─────────────
51-
^A Add magnet link
52-
^P Set download path
53-
^X Set API key
54-
^Q Quit application
60+
d Delete torrent (Torrents / Active)
61+
s Check status (Active)
62+
^A Add magnet modal (global)
63+
^P Set download path
64+
^X Set API key
65+
^Q Quit application
66+
^C Close modal
67+
68+
── Help ───────────────────
69+
? Show this help
5570
`
5671
return views.ShowModal(g, views.ViewHelp, "Shortcuts", content, func(string) error { return nil })
5772
}
58-
59-
func ShowAddMagnetModal(g *gocui.Gui, v *gocui.View) error {
60-
return views.ShowModal(g, views.ViewAddMagnet, "Add Magnet Link", "", func(input string) error {
61-
return HandleAddMagnetLink(g, input)
62-
})
63-
}

internal/views/keys.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package views
22

33
var (
4-
MainKeys = "Search: </> | Switch Pane: <Tab> | Download Path: <^P> | API Key: <^X> | Quit: <^Q>"
5-
TorrentsKeys = "Up: <k> | Down: <j> | Add Magnet: <a> | Search: </> | Keybindings: <?>"
6-
DetailsKeys = "Up: <k> | Down: <j> | Copy link: <y> | Download: <d> | Download all: <D> | Keybindings: <?>"
7-
ActiveDownloadsKeys = "Up: <k> | Down: <j> | Status: <s> | Delete <d> | Keybindings: <?>"
4+
MainKeys = "Search: </> | Pane forward: <Tab> | Pane back: <Backspace> | Download Path: <^P> | API Key: <^X> | Quit: <^Q>"
5+
TorrentsKeys = "Up: <k> | Down: <j> | Add Magnet: <a> | Open: <Enter> | Delete: <d> | Search: </> | Keybindings: <?>"
6+
DetailsKeys = "Up: <k> | Down: <j> | Copy link: <y> | Download: <Enter>/<d> | Download all: <D> | Keybindings: <?>"
7+
ActiveDownloadsKeys = "Up: <k> | Down: <j> | Status: <s> | Delete: <d> | Keybindings: <?>"
88
SearchKeys = "Search: <Enter> | Keybindings: <?>"
99
ModalKeys = "Submit: <Enter> | Close: <^C>"
1010
)

0 commit comments

Comments
 (0)