Skip to content

Conversation

@bernardopg
Copy link

Overview

This PR adds 8 new JSON configuration options to fully customize the MPRIS widget, enabling layouts from ultra-compact (3 buttons only) to complete with all controls.

New Configuration Options

  • show-title (boolean): Control title/player name visibility
  • show-subtitle (boolean): Control artist-album subtitle visibility
  • show-background (boolean): Control blurred background album art
  • show-shuffle (boolean): Control shuffle button visibility
  • show-repeat (boolean): Control repeat button visibility
  • show-favorite (boolean): Control favorite button (placeholder for future implementation)
  • button-size (integer): Custom button size in pixels
  • compact-mode (boolean): Optimized compact layout (placeholder for future implementation)

Modified Files

Core Implementation

  • src/controlCenter/widgets/mpris/mpris.vala: Extended Config struct with 8 new fields and JSON parsing logic
  • src/controlCenter/widgets/mpris/mpris_player.vala: Updated methods to respect new configuration flags
  • src/configSchema.json: Added 8 new properties with proper validation and defaults

Documentation

  • MPRIS-CUSTOMIZATION.md: Complete feature documentation with examples
  • TESTING-GUIDE.md: Testing guide with multiple configuration presets
  • mpris-config-example.json: Configuration template file
  • test-mpris-configs.sh: Interactive testing script with 4 presets

Configuration Examples

Ultra-Compact Mode

{
  "widget-config": {
    "mpris": {
      "show-album-art": "never",
      "show-title": false,
      "show-subtitle": false,
      "show-shuffle": false,
      "show-repeat": false
    }
  }
}

Minimalist Mode

{
  "widget-config": {
    "mpris": {
      "show-album-art": "when-available",
      "show-title": true,
      "show-subtitle": false,
      "show-shuffle": false,
      "show-repeat": false
    }
  }
}

Complete Mode

{
  "widget-config": {
    "mpris": {
      "show-album-art": "always",
      "show-title": true,
      "show-subtitle": true,
      "show-background": true,
      "show-shuffle": true,
      "show-repeat": true
    }
  }
}

Testing

Users can test different configurations using the included script:

cd ~/git-clones/SwayNotificationCenter
./test-mpris-configs.sh

Backward Compatibility

All changes maintain full backward compatibility. Existing configurations will continue to work with default values applied for new options.

Related Issues

This addresses the need for more flexible MPRIS widget customization, allowing users to optimize their notification center layout based on available screen space and personal preferences.

Add 8 new JSON configuration options to allow full customization of the
MPRIS widget appearance and controls, enabling layouts from ultra-compact
(3 buttons only) to complete with all controls.

New configuration options:
- show-title (boolean): Control title/player name visibility
- show-subtitle (boolean): Control artist-album subtitle visibility
- show-background (boolean): Control blurred background album art
- show-shuffle (boolean): Control shuffle button visibility
- show-repeat (boolean): Control repeat button visibility
- show-favorite (boolean): Control favorite button (placeholder)
- button-size (integer): Custom button size in pixels
- compact-mode (boolean): Optimized compact layout (placeholder)

Modified files:
- src/controlCenter/widgets/mpris/mpris.vala: Extended Config struct
  with 8 new fields and JSON parsing logic
- src/controlCenter/widgets/mpris/mpris_player.vala: Updated methods
  to respect new configuration flags (update_title, update_sub_title,
  update_album_art, update_button_shuffle, update_button_repeat)
- src/configSchema.json: Added 8 new properties to mpris widget schema
  with proper validation and defaults

Documentation:
- MPRIS-CUSTOMIZATION.md: Complete feature documentation with examples
- TESTING-GUIDE.md: Testing guide with multiple configuration presets
- mpris-config-example.json: Configuration template file
- test-mpris-configs.sh: Interactive testing script with 4 presets
  (Ultra-Compact, Minimal, Complete, No-Art)

All changes maintain backward compatibility with existing configurations.
Break long lines in mpris.vala to comply with 100 character limit.
All get_prop calls for new config options now span multiple lines
for better readability and CI compliance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant