Archived
0
0
Fork 0

feat: added partial keybinding support

This commit is contained in:
Daryl Ronningen 2021-12-16 12:23:54 -07:00
parent e2c2a9670f
commit 7b0db53886
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
3 changed files with 35 additions and 1 deletions

View file

@ -226,6 +226,39 @@ namespace chord
}
};
userListList.OpenSelectedItem += args =>
{
};
Application.Top.KeyPress += async args =>
{
switch (ShortcutHelper.GetModifiersKey(args.KeyEvent)) {
case Key.CtrlMask | Key.S:
serverListList.SetFocus();
break;
case Key.CtrlMask | Key.C:
channelListList.SetFocus();
break;
case Key.CtrlMask | Key.AltMask | Key.C:
chatBoxList.SetFocus();
break;
case Key.CtrlMask | Key.U:
userListList.SetFocus();
break;
case Key.CtrlMask | Key.Enter:
var restSharpClient = new RestClient("https://discord.com/api/v9");
var restSharpReq = new RestRequest($"channels/{currentSelectedChannel}/messages");
restSharpClient.AddDefaultHeader("Authorization", settings.Token);
restSharpReq.AddJsonBody(new { content = Encoding.UTF8.GetString(messageBoxText.Text.ToByteArray()) });
await restSharpClient.PostAsync<List<object>>(restSharpReq);
messageBoxText.Text = "";
break;
}
};
Application.Top.Add(window, menuBar);
window.Add(serverList, channelList, messageBox, chatBox, userList);
serverList.Add(serverListList);

View file

@ -2,7 +2,7 @@
A C# Discord TUI Client
## Getting Started
Add a `settings.json` to `~/.config/chord`;
Add a `config.json` to `~/.config/chord`;
```json
{

1
TODO
View file

@ -4,3 +4,4 @@
- Sort Channels by catagories
- DMs
- Loading Screen
- Hotkeys (Partially Done. Still some weird stuff that happens that idfk why happens)