[PR #99] [MERGED] Using cossterm for windows support. #607

Closed
opened 2026-02-28 14:50:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Rigellute/spotify-tui/pull/99
Author: @TimonPost
Created: 10/22/2019
Status: Merged
Merged: 12/24/2019
Merged by: @Rigellute

Base: masterHead: crossterm_impl


📝 Commits (2)

  • 050622e Implemented crossterm for crossplatform compatibility.
  • cb948e1 Removed windows note from readme, and utils file.

📊 Changes

29 files changed (+533 additions, -313 deletions)

View changed files

📝 Cargo.lock (+173 -148)
📝 Cargo.toml (+2 -2)
📝 README.md (+0 -6)
src/event/events.rs (+73 -0)
src/event/key.rs (+179 -0)
src/event/mod.rs (+7 -0)
📝 src/handlers/album_list.rs (+5 -3)
📝 src/handlers/album_tracks.rs (+5 -3)
📝 src/handlers/artist_albums.rs (+5 -3)
📝 src/handlers/artists.rs (+2 -3)
📝 src/handlers/common_key_events.rs (+2 -2)
📝 src/handlers/empty.rs (+7 -5)
📝 src/handlers/error_screen.rs (+1 -2)
📝 src/handlers/help_menu.rs (+1 -2)
📝 src/handlers/home.rs (+1 -1)
📝 src/handlers/input.rs (+3 -3)
📝 src/handlers/library.rs (+2 -2)
📝 src/handlers/made_for_you.rs (+1 -1)
📝 src/handlers/mod.rs (+3 -3)
📝 src/handlers/playbar.rs (+1 -1)

...and 9 more files

📄 Description

Fixes: https://github.com/Rigellute/spotify-tui/issues/69

This app can support windows very easily. TUI has the crossterm backend which is made to support cross-platform.

I tried to move this library over to crossterm just to experiment to how easy it was to swap termion. It was very easy. Please have a look at this fork.

Although...

Their implementation uses crossterm 0.9 and 0.12 is already out and they didn't even release my latest patch - done a few months ago - with 0.10 yet. This old version of crossterm has some problems and ideally it should use 0.12 it's way better performance-wise as well.

However, I encountered problems:

-. KeyEvent (replacement for Key) does not implement Copy however, this is going to be fixed in 0.12.2.

  • TUI uses crossterm ^0.9, therefore, use crossterm ^12 because TUI requires types from ^0.9
  • You probably don't want to have a dependency to git branch of TUI

The real blocker here was that crossterm::KeyEvent did not implement Copy and therefore it has to be wrapped in order for it to be used.

Introduced:

  1. Key enum, this enum is used in the library and should be used instead of the termion::Key or crossterm::KeyEvent or others toughtout the crates. You probably don't want to depend on a certain library restricted to linux but have a small abstraction so that crossterm, for example, can be implemented with more ease.
  2. CrosstermBackend this uses crossterm for its implementation and is crossplatform.

Qustions:

This is just an experiment because I wanted to listen to Spotify on windows, however, there are some concerns with git dependencies and old versions of crossterm. Do you think crossterm should be behind a feature flag, the only supported implementation, or not used at all?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/99 **Author:** [@TimonPost](https://github.com/TimonPost) **Created:** 10/22/2019 **Status:** ✅ Merged **Merged:** 12/24/2019 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `crossterm_impl` --- ### 📝 Commits (2) - [`050622e`](https://github.com/Rigellute/spotify-tui/commit/050622e1bce6141b6dd3fc98a462cb58b7173b55) Implemented crossterm for crossplatform compatibility. - [`cb948e1`](https://github.com/Rigellute/spotify-tui/commit/cb948e177d84d1bf103c2f16e0ce82c09657652b) Removed windows note from readme, and utils file. ### 📊 Changes **29 files changed** (+533 additions, -313 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+173 -148) 📝 `Cargo.toml` (+2 -2) 📝 `README.md` (+0 -6) ➕ `src/event/events.rs` (+73 -0) ➕ `src/event/key.rs` (+179 -0) ➕ `src/event/mod.rs` (+7 -0) 📝 `src/handlers/album_list.rs` (+5 -3) 📝 `src/handlers/album_tracks.rs` (+5 -3) 📝 `src/handlers/artist_albums.rs` (+5 -3) 📝 `src/handlers/artists.rs` (+2 -3) 📝 `src/handlers/common_key_events.rs` (+2 -2) 📝 `src/handlers/empty.rs` (+7 -5) 📝 `src/handlers/error_screen.rs` (+1 -2) 📝 `src/handlers/help_menu.rs` (+1 -2) 📝 `src/handlers/home.rs` (+1 -1) 📝 `src/handlers/input.rs` (+3 -3) 📝 `src/handlers/library.rs` (+2 -2) 📝 `src/handlers/made_for_you.rs` (+1 -1) 📝 `src/handlers/mod.rs` (+3 -3) 📝 `src/handlers/playbar.rs` (+1 -1) _...and 9 more files_ </details> ### 📄 Description Fixes: https://github.com/Rigellute/spotify-tui/issues/69 This app can support windows very easily. TUI has the [crossterm backend](https://github.com/fdehau/tui-rs/blob/master/Cargo.toml#L33) which is made to support cross-platform. I tried to move this library over to crossterm just to experiment to how easy it was to swap termion. It was very easy. Please have a look at this [fork](https://github.com/TimonPost/spotify-tui/tree/crossterm_impl). Although... Their implementation uses crossterm 0.9 and 0.12 is already out and they didn't even release my latest patch - done a few months ago - with 0.10 yet. This old version of crossterm has some problems and ideally it should use 0.12 it's way better performance-wise as well. However, I encountered problems: -. `KeyEvent` (replacement for `Key`) does not implement `Copy` however, this is going to be fixed in 0.12.2. - TUI uses crossterm ^0.9, therefore, use crossterm ^12 because TUI requires types from ^0.9 - You probably don't want to have a dependency to git branch of TUI The real blocker here was that `crossterm::KeyEvent` did not implement `Copy` and therefore it has to be wrapped in order for it to be used. Introduced: 1. `Key` enum, this enum is used in the library and should be used instead of the `termion::Key` or `crossterm::KeyEvent` or others toughtout the crates. You probably don't want to depend on a certain library restricted to linux but have a small abstraction so that crossterm, for example, can be implemented with more ease. 2. `CrosstermBackend` this uses crossterm for its implementation and is crossplatform. Qustions: This is just an experiment because I wanted to listen to Spotify on windows, however, there are some concerns with git dependencies and old versions of crossterm. Do you think crossterm should be behind a feature flag, the only supported implementation, or not used at all? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:50:12 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#607
No description provided.