me

/

vendetta Public
17 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

fix: missing options in the settings editor

diviocity committed last Nov 12 · 3e4163bcc5f246e02299f4c7fad2c482407f8e88 View patch
Unverified signature 2 files changed +48 -2
src/settings.v +1 -1

@@ -16,7 +16,7 @@ pub mut:

1616 // The audio server: 'auto' is mpv's autoprobing, a name forces one. The

1717 // platform's server list validates it on load, so a file carried over

1818 // from another OS demotes instead of forcing an absent output.

19- ao string = 'pulse'

19+ ao string = 'auto'

2020 loop_file bool

2121 loop_playlist bool

2222 hwdec bool

src/settings_view.v +47 -1

@@ -75,7 +75,7 @@ fn (p &Player) settings_pages() []ui2.SettingPage {

7575 toggle_item('title_filename', 'Show filename in the window title'),

7676 ]

7777 $if mpris ? {

78- interface_items << toggle_item('media_controls', 'Desktop media controls')

78+ interface_items << toggle_item('media_controls', 'Desktop media controls (MPRIS)')

7979 }

8080 return [

8181 ui2.SettingPage{

@@ -322,11 +322,48 @@ fn (p &Player) settings_pages() []ui2.SettingPage {

322322 },

323323 ]

324324 },

325+ ui2.SettingGroup{

326+ title: 'Custom mpv options'

327+ items: p.settings_mpv_items()

328+ },

325329 ]

326330 },

327331 ]

328332}

329333

334+// Reuse the option dialog and reset events, including options saved by the CLI.

335+fn (p &Player) settings_mpv_items() []ui2.SettingItem {

336+ mut items := [ui2.SettingItem{

337+ key: 'mpv_option'

338+ title: 'Set custom mpv option'

339+ description: 'Apply an mpv option by name and value and save it for future sessions.'

340+ kind: .button

341+ button_text: 'Add'

342+ }]

343+ mut names := p.mpv_opts.keys()

344+ names.sort()

345+ for name in names {

346+ if name in mirrored_mpv_options {

347+ continue

348+ }

349+ items << ui2.SettingItem{

350+ key: 'mpv_option_edit:${name}'

351+ title: name

352+ description: p.mpv_opts[name]

353+ kind: .button

354+ button_text: 'Edit'

355+ }

356+ items << ui2.SettingItem{

357+ key: 'mpv_option_reset:${name}'

358+ title: 'Unset ${name}'

359+ description: 'Remove the saved option. Some options reset after restarting.'

360+ kind: .button

361+ button_text: 'Unset'

362+ }

363+ }

364+ return items

365+}

366+

330367// settings_values reads every row's value from the player.

331368fn (p &Player) settings_values() map[string]ui2.SettingValue {

332369 mut values := map[string]ui2.SettingValue{}

@@ -455,6 +492,15 @@ fn (mut p Player) take_settings_step(step ui2.SettingsStep) {

455492 }

456493 return

457494 }

495+ if step.action == 'mpv_option' || step.action.starts_with('mpv_option_edit:') {

496+ // The option dialog must be above the player, without the settings scrim.

497+ p.set_settings_open(false)

498+ p.handle(step.action)

499+ return

500+ }

501+ if step.action.starts_with('mpv_option_reset:') {

502+ p.handle(step.action)

503+ }

458504 p.settings_changed()

459505 ui2.refresh()

460506 if step.sync_id.len > 0 && ui2.text(step.sync_id) != step.sync_text {