feat: added partial keybinding support
This commit is contained in:
parent
e2c2a9670f
commit
7b0db53886
3 changed files with 35 additions and 1 deletions
33
Program.cs
33
Program.cs
|
@ -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);
|
||||
|
|
|
@ -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
1
TODO
|
@ -4,3 +4,4 @@
|
|||
- Sort Channels by catagories
|
||||
- DMs
|
||||
- Loading Screen
|
||||
- Hotkeys (Partially Done. Still some weird stuff that happens that idfk why happens)
|
||||
|
|
Reference in a new issue