Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed windows note from readme, and utils file.
  • Loading branch information
TimonPost committed Dec 24, 2019
commit cb948e177d84d1bf103c2f16e0ce82c09657652b
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ In order to locate dependencies, the compilation also requires `pkg-config` to b
1. `cd` to the file you just downloaded and unzip
1. `cd` to `spotify-ui` and run with `./spt`

### Note on Windows

The core dependancy `termion` [does not yet support Windows](https://gitlab.redox-os.org/redox-os/termion/issues/103), and so nor does `spotify-tui`. Apologies for this!

You can, however, run `spotify-tui` within the Windows Subsystem for Linux (which I have tested).

## Connecting to Spotify’s API

`spotify-tui` needs to connect to Spotify’s API in order to find music by
Expand Down
10 changes: 10 additions & 0 deletions src/event/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ use crossterm::event;
use std::{sync::mpsc, thread, time::Duration};

#[derive(Debug, Clone, Copy)]
/// Configuration for event handling.
pub struct EventConfig {
/// The key that is used to exit the application.
pub exit_key: Key,
/// The tick rate at which the application will sent an tick event.
pub tick_rate: Duration,
}

Expand All @@ -17,8 +20,11 @@ impl Default for EventConfig {
}
}

/// An occurred event.
pub enum Event<I> {
/// An input event occurred.
Input(I),
/// An tick event occurred.
Tick,
}

Expand All @@ -29,10 +35,12 @@ pub struct Events {
}

impl Events {
/// Constructs an new instance of `Events` with the default config.
pub fn new() -> Events {
Events::with_config(EventConfig::default())
}

/// Constructs an new instance of `Events` from given config.
pub fn with_config(config: EventConfig) -> Events {
let (tx, rx) = mpsc::channel();

Expand All @@ -57,6 +65,8 @@ impl Events {
Events { rx }
}

/// Attempts to read an event.
/// This function will block the current thread.
pub fn next(&self) -> Result<Event<Key>, mpsc::RecvError> {
self.rx.recv()
}
Expand Down
2 changes: 1 addition & 1 deletion src/event/key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crossterm::event;

/// A non-character key on the keyboard
/// Represents an key.
#[derive(PartialEq, Eq, Clone, Copy, Hash, Debug)]
pub enum Key {
/// Both Enter (or Return) and numpad Enter
Expand Down
71 changes: 0 additions & 71 deletions src/util.rs

This file was deleted.