Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add macOS menus and keybinds; rename gpui

+66 -22
+19 -19
gpui/Cargo.lock
··· 3 3 version = 4 4 4 5 5 [[package]] 6 + name = "Rockbox" 7 + version = "0.1.0" 8 + dependencies = [ 9 + "anyhow", 10 + "env_logger", 11 + "gpui", 12 + "log", 13 + "prost", 14 + "reqwest", 15 + "rust-embed", 16 + "serde", 17 + "tokio", 18 + "tonic", 19 + "tonic-build", 20 + "tonic-reflection", 21 + "tonic-web", 22 + ] 23 + 24 + [[package]] 6 25 name = "adler2" 7 26 version = "2.0.1" 8 27 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4626 4645 "libc", 4627 4646 "untrusted", 4628 4647 "windows-sys 0.52.0", 4629 - ] 4630 - 4631 - [[package]] 4632 - name = "rockbox-gpui" 4633 - version = "0.1.0" 4634 - dependencies = [ 4635 - "anyhow", 4636 - "env_logger", 4637 - "gpui", 4638 - "log", 4639 - "prost", 4640 - "reqwest", 4641 - "rust-embed", 4642 - "serde", 4643 - "tokio", 4644 - "tonic", 4645 - "tonic-build", 4646 - "tonic-reflection", 4647 - "tonic-web", 4648 4648 ] 4649 4649 4650 4650 [[package]]
+1 -1
gpui/Cargo.toml
··· 2 2 resolver = "2" 3 3 4 4 [package] 5 - name = "rockbox-gpui" 5 + name = "Rockbox" 6 6 version = "0.1.0" 7 7 edition = "2021" 8 8 description = "GPUI-based desktop GUI for Rockbox"
+38 -2
gpui/src/app.rs
··· 1 1 use crate::controller::Controller; 2 2 use crate::state::AppState; 3 + use crate::ui::global_keybinds::{Hide, HideOthers, Next, PlayPause, Prev, Quit, Repeat, Shuffle}; 4 + use crate::ui::global_keybinds::{Library, Player, Queue}; 3 5 use crate::ui::{assets::Assets, rockbox::Rockbox}; 4 6 use gpui::{ 5 - px, size, AppContext, Application, Bounds, TitlebarOptions, WindowBounds, WindowOptions, 7 + px, size, AppContext, Application, Bounds, Menu, MenuItem, SystemMenuType, TitlebarOptions, 8 + WindowBounds, WindowOptions, 6 9 }; 7 10 8 11 pub fn run() { ··· 17 20 cx.open_window( 18 21 WindowOptions { 19 22 window_bounds: Some(WindowBounds::Windowed(bounds)), 20 - app_id: Some("rockbox".into()), 23 + app_id: Some("Rockbox".into()), 21 24 focus: true, 22 25 titlebar: Some(TitlebarOptions { 23 26 title: None, ··· 38 41 }, 39 42 ) 40 43 .expect("failed to open window"); 44 + 45 + cx.set_menus(vec![ 46 + Menu { 47 + name: "Rockbox".into(), 48 + items: vec![ 49 + MenuItem::os_submenu("Services", SystemMenuType::Services), 50 + MenuItem::separator(), 51 + MenuItem::action("Hide Rockbox", Hide), 52 + MenuItem::action("Hide Others", HideOthers), 53 + MenuItem::separator(), 54 + MenuItem::action("Quit Rockbox", Quit), 55 + ], 56 + }, 57 + Menu { 58 + name: "Playback".into(), 59 + items: vec![ 60 + MenuItem::action("Play / Pause", PlayPause), 61 + MenuItem::action("Next Track", Next), 62 + MenuItem::action("Previous Track", Prev), 63 + MenuItem::separator(), 64 + MenuItem::action("Shuffle", Shuffle), 65 + MenuItem::action("Repeat", Repeat), 66 + ], 67 + }, 68 + Menu { 69 + name: "View".into(), 70 + items: vec![ 71 + MenuItem::action("Library", Library), 72 + MenuItem::action("Player", Player), 73 + MenuItem::action("Queue", Queue), 74 + ], 75 + }, 76 + ]); 41 77 42 78 cx.activate(true); 43 79 });
+8
gpui/src/ui/global_keybinds.rs
··· 5 5 6 6 actions!(player, [PlayPause, Next, Prev, Shuffle, Repeat]); 7 7 actions!(pages, [CycleNext, CyclePrev, Library, Player, Queue]); 8 + actions!(app, [Quit, Hide, HideOthers]); 8 9 9 10 pub fn register_keybinds(cx: &mut App) { 10 11 cx.bind_keys([ ··· 18 19 KeyBinding::new("cmd-1", Library, None), 19 20 KeyBinding::new("cmd-2", Player, None), 20 21 KeyBinding::new("cmd-3", Queue, None), 22 + KeyBinding::new("cmd-q", Quit, None), 23 + KeyBinding::new("cmd-h", Hide, None), 24 + KeyBinding::new("cmd-alt-h", HideOthers, None), 21 25 ]); 22 26 23 27 cx.on_action(|_: &PlayPause, cx| { ··· 47 51 let state = cx.global::<Controller>().state.clone(); 48 52 state.update(cx, |s, _| s.toggle_repeat()); 49 53 }); 54 + 55 + cx.on_action(|_: &Quit, cx| cx.quit()); 56 + cx.on_action(|_: &Hide, cx| cx.hide()); 57 + cx.on_action(|_: &HideOthers, cx| cx.hide_other_apps()); 50 58 51 59 cx.on_action(|_: &Library, cx| *cx.global_mut::<Page>() = Page::Library); 52 60 cx.on_action(|_: &Player, cx| *cx.global_mut::<Page>() = Page::Player);