[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

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

Add `Escape` sidebar shortcut

Kasper (Apr 30, 2024, 5:17 AM +0200) 331b4ebb 2ebe9ce7

+28 -2
+1
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 3 ## Next 4 + - Add `Escape` shortcut for de-focusing the sidebar and filter 4 5 - Fix rare error with updating artwork 5 6 - Fix importing of iTunes playlist likes. These aren't visible in the app, but they do get imported. If you previously imported playlists, the likes got lost in Ferrum. 6 7
+1
src/components/Filter.svelte
··· 13 13 14 14 <input 15 15 on:focus 16 + on:keydown 16 17 bind:this={filterInput} 17 18 type="text" 18 19 class="search"
+10 -1
src/components/Sidebar.svelte
··· 6 6 import { writable } from 'svelte/store' 7 7 import { setContext, tick } from 'svelte' 8 8 import { dragged } from '../lib/drag-drop' 9 + import { main_area } from '@/lib/page' 9 10 10 11 const special = { 11 12 children: ['root'], ··· 84 85 on:focus={() => { 85 86 contentElement.scrollTop = 0 86 87 }} 88 + on:keydown={(e) => { 89 + if (e.key === 'Escape') { 90 + main_area.focus() 91 + } 92 + }} 87 93 /> 88 94 <!-- svelte-ignore a11y-no-noninteractive-element-interactions --> 89 95 <nav 90 96 class="items" 91 97 tabindex="-1" 92 98 on:keydown={(e) => { 93 - if (e.key == 'Home' || e.key == 'End' || e.key == 'PageUp' || e.key == 'PageDown') { 99 + if (e.key === 'Escape') { 100 + e.preventDefault() 101 + main_area.focus() 102 + } else if (e.key == 'Home' || e.key == 'End' || e.key == 'PageUp' || e.key == 'PageDown') { 94 103 e.preventDefault() 95 104 } else { 96 105 $itemHandle?.handleKey(e)
+5 -1
src/components/TrackList.svelte
··· 10 10 assertUnreachable, 11 11 } from '../lib/helpers' 12 12 import { appendToUserQueue, prependToUserQueue } from '../lib/queue' 13 - import { selection, scrollToIndex } from '../lib/page' 13 + import { selection, scrollToIndex, main_area } from '../lib/page' 14 14 import { ipcListen, ipcRenderer } from '../lib/window' 15 15 import { onDestroy } from 'svelte' 16 16 import { dragged } from '../lib/drag-drop' ··· 184 184 } 185 185 186 186 let virtualList: VirtualList<ReturnType<typeof getItem>> 187 + 188 + $: if (virtualList) { 189 + main_area.focus = virtualList.focus 190 + } 187 191 188 192 $: if ($page && virtualList) { 189 193 virtualList.refresh()
+4
src/components/VirtualList.svelte
··· 25 25 } 26 26 } 27 27 28 + export function focus() { 29 + viewport.focus() 30 + } 31 + 28 32 let viewport: HTMLDivElement 29 33 function handleScroll(e: Event) { 30 34 const target = e.target as HTMLTextAreaElement
+7
src/lib/page.ts
··· 5 5 6 6 export const scrollToIndex = writable(null as number | null) 7 7 8 + let main_area_el: HTMLElement | undefined 9 + export const main_area = { 10 + focus() { 11 + main_area_el?.focus() 12 + }, 13 + } 14 + 8 15 export const selection = newSelection({ 9 16 getItemCount: () => get(page).length, 10 17 scrollToItem: (i) => scrollToIndex.set(i),