Comments (5)
Hello thanks for your feedback! Are you talking about DBus controls or shortcuts in the app ? What terminal are you using? Can you send the ytermusic log?
from ytermusic.
Not sure what is DBus controls, I'm referring to physical keyboard buttons (sometimes fn+key buttons) to pause/play, next track
and previous track.
I actually cloned your repo and tried to implement this myself but couldn't get it to work, even though I think it should work, here is what I tried:
Added line PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES);
in mod.rs
pub fn run(&mut self, updater: &Receiver<ManagerMessage>) -> Result<(), io::Error> {
// setup terminal
enable_raw_mode()?;
let mut stdout = io::stdout();
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
let backend = CrosstermBackend::new(stdout);
let mut terminal = Terminal::new(backend)?;
// create app and run it
let tick_rate = Duration::from_millis(250);
// V Added this line here V
PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES);
// ^ Added this line here ^
let mut last_tick = Instant::now();
'a: loop {
Added lines in music_player.rs
fn on_key_press(&mut self, key: KeyEvent, _: &ratatui::layout::Rect) -> EventResponse {
match key.code {
KeyCode::Media(media_key) => match media_key {
MediaKeyCode::PlayPause => {
SoundAction::PlayPause.apply_sound_action(self);
EventResponse::None
}
_ => EventResponse::None,
},
...
I'm actually not that familiar with Rust, so I tried making a new empty Rust project just to see if I could at all capture these MediaKeyCode
s but I couldn't, perhaps it's a problem with crossterm
? Or with Linux? I haven't tried on Windows yet.
Where is the log file? I'll happily send it.
from ytermusic.
I don't know how FN + FX keys are handled but it think they should use DBus too (A linux protocol for media actions cross-desktop). To confirm I've been using souvlaki underneath so maybe you should look there. Thanks for the investigation!
from ytermusic.
I just googled souvlaki and it looks promising, I'll give it a try later today and if I hopefully get it to work, will send a PR :) Thanks for the help!
Edited update: I just found the souvlaki code in the project and messed around with it and I just now realized what is the DBus protocol that you are talking about, but that is not what I am referring to.
I am referring to these keyboard buttons:
I confirmed in a new standalone project, kebyoard media buttons are not captured by souvlaki
from ytermusic.
Created a crossterm
bug report about this: crossterm-rs/crossterm#897
from ytermusic.
Related Issues (20)
- Warning during compilation from source (ytpapi2, unused import) HOT 1
- Failed to download song HOT 4
- Switch log file location to local ytermusic files HOT 1
- Arch package is already build for this program so you can add this in repo and maybe add steps like where are main files and how to configure it HOT 11
- There is yewtube foss project can you implement in their way in which cookie is not required to use youtube and play music HOT 3
- [WINDOWS terminal]: duplication of keyboard inputs
- Like/Dislike song function HOT 4
- [Feature request] Add a clear cache command HOT 2
- [Feature request] SponsorBlock API HOT 1
- Random memory allocation faliure HOT 7
- Issue with beta-0.1.0 HOT 1
- Cache the songs in Music, not in cache HOT 3
- Automatically extract cookie from Firefox HOT 3
- Delete playlist data HOT 2
- Add brand accounts support HOT 2
- [Feature Request] Explicit song mark
- Can't play multiple random tracks HOT 1
- [Feature Request] Deleting downloaded songs inside the player HOT 1
- Won't detect error when downloading songs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ytermusic.