Skip to content

Commit

Permalink
WIndows
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Dec 17, 2024
1 parent 4ff740c commit 8e6d2e5
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions psst-gui/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,32 @@ pub fn account_setup_window() -> WindowDesc<AppState> {
}

pub fn artwork_window() -> WindowDesc<AppState> {
let win_size = (theme::grid(50.0), theme::grid(50.0));

// On Windows, the window size includes the titlebar
let win_size = if cfg!(target_os = "windows") {
const WINDOWS_TITLEBAR_OFFSET: f64 = 56.0;
(win_size.0, win_size.1 + WINDOWS_TITLEBAR_OFFSET)
} else {
win_size
};

let win = WindowDesc::new(artwork_widget())
.window_size((theme::grid(50.0), theme::grid(50.0)))
.window_size(win_size)
.resizable(false)
.show_title(false)
.transparent_titlebar(true);
.transparent_titlebar(true)
.title(|data: &AppState, _env: &_| {
data.playback
.now_playing
.as_ref()
.map(|np| match &np.item {
Playable::Track(track) => format!("{} - {}", track.artist_name(), track.name),
Playable::Episode(episode) => episode.name.to_string(),
})
.unwrap_or_else(|| "Now Playing".to_string())
});

if cfg!(target_os = "macos") {
win.menu(menu::main_menu)
} else {
Expand Down

0 comments on commit 8e6d2e5

Please sign in to comment.