diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md index cd58478c..b014868e 100644 --- a/CONTRIBUTION.md +++ b/CONTRIBUTION.md @@ -1,4 +1,4 @@ -# Contributing to Spotube +# Contributing to SpoTube First off, thanks for taking the time to contribute! @@ -22,7 +22,7 @@ community looks forward to your contributions. ## Table of Contents -- [Contributing to Spotube](#contributing-to-spotube) +- [Contributing to SpoTube](#contributing-to-spotube) - [Table of Contents](#table-of-contents) - [Code of Conduct](#code-of-conduct) - [I Have a Question](#i-have-a-question) @@ -39,7 +39,7 @@ community looks forward to your contributions. ## Code of Conduct This project and everyone participating in it is governed by the -[Spotube Code of Conduct](https://github.com/KRTirtho/spotube/blob/master/CODE_OF_CONDUCT.md). +[SpoTube Code of Conduct](https://github.com/KRTirtho/spotube/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to krtirtho@gmail.com. diff --git a/PRIVACY_POLICY.md b/PRIVACY_POLICY.md index e945fe5e..8990625f 100644 --- a/PRIVACY_POLICY.md +++ b/PRIVACY_POLICY.md @@ -1,6 +1,6 @@ **Privacy Policy** -Kingkor Roy Tirtho built the Spotube app as an Open Source app. This SERVICE is provided by Kingkor Roy Tirtho at no +Kingkor Roy Tirtho built the SpoTube app as an Open Source app. This SERVICE is provided by Kingkor Roy Tirtho at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal @@ -11,7 +11,7 @@ Personal Information that I collect is used for providing and improving the Serv information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at -Spotube unless otherwise defined in this Privacy Policy. +SpoTube unless otherwise defined in this Privacy Policy. **Information Collection and Use** diff --git a/README.md b/README.md index 07c9e8d4..c462f43b 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ preferably by buying their merch/concert tickets/physical media). ## Installation guide New versions usually release every 3-4 months.
-This handy table lists all the methods you can use to install Spotube: +This handy table lists all the methods you can use to install SpoTube: diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 51a28ff1..245df557 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } android { - namespace = "com.example.spotube" + namespace = "oss.krtirtho.spotube" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion @@ -21,7 +21,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.example.spotube" + applicationId = "oss.krtirtho.spotube" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion diff --git a/android/app/src/main/kotlin/com/example/spotube/MainActivity.kt b/android/app/src/main/kotlin/com/example/spotube/MainActivity.kt index d593b415..fa4f8fd8 100644 --- a/android/app/src/main/kotlin/com/example/spotube/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/spotube/MainActivity.kt @@ -1,4 +1,4 @@ -package com.example.spotube +package oss.krtirtho.spotube import io.flutter.embedding.android.FlutterActivity diff --git a/lib/main.dart b/lib/main.dart index 9c5341a2..8cd5c90f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -86,7 +86,6 @@ Future main(List rawArgs) async { await KVStoreService.initialize(); if (kIsDesktop) { - await windowManager.setPreventClose(true); await YtDlp.instance .setBinaryLocation( KVStoreService.getYoutubeEnginePath(YoutubeClientEngine.ytDlp) ?? @@ -106,7 +105,6 @@ Future main(List rawArgs) async { if (kIsDesktop) { await localNotifier.setup(appName: "SpoTube"); - await WindowManagerTools.initialize(); } if (kIsIOS) { diff --git a/lib/pages/settings/sections/appearance.dart b/lib/pages/settings/sections/appearance.dart index 64ee585c..10326ff9 100644 --- a/lib/pages/settings/sections/appearance.dart +++ b/lib/pages/settings/sections/appearance.dart @@ -80,14 +80,14 @@ class SettingsAppearanceSection extends HookConsumerWidget { } }, ), - // ListTile( - // leading: const Icon(SpotubeIcons.amoled), - // title: Text(context.l10n.use_amoled_mode), - // subtitle: Text(context.l10n.pitch_dark_theme), - // trailing: Switch( - // value: preferences.amoledDarkTheme, - // onChanged: preferencesNotifier.setAmoledDarkTheme, - // )), + ListTile( + leading: const Icon(SpotubeIcons.amoled), + title: Text(context.l10n.use_amoled_mode), + subtitle: Text(context.l10n.pitch_dark_theme), + trailing: Switch( + value: preferences.amoledDarkTheme, + onChanged: preferencesNotifier.setAmoledDarkTheme, + )), ListTile( leading: const Icon(SpotubeIcons.palette), title: Text(context.l10n.accent_color), @@ -103,14 +103,14 @@ class SettingsAppearanceSection extends HookConsumerWidget { ), onTap: pickColorScheme(), ), - // ListTile( - // leading: const Icon(SpotubeIcons.colorSync), - // title: Text(context.l10n.sync_album_color), - // subtitle: Text(context.l10n.sync_album_color_description), - // trailing: Switch( - // value: preferences.albumColorSync, - // onChanged: preferencesNotifier.setAlbumColorSync, - // )), + ListTile( + leading: const Icon(SpotubeIcons.colorSync), + title: Text(context.l10n.sync_album_color), + subtitle: Text(context.l10n.sync_album_color_description), + trailing: Switch( + value: preferences.albumColorSync, + onChanged: preferencesNotifier.setAlbumColorSync, + )), ]; if (isGettingStarted) { diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 8f100774..862c586f 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,11 +1,19 @@ -cmake_minimum_required(VERSION 3.10) +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "spotube") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "oss.krtirtho.spotube") +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. cmake_policy(SET CMP0063 NEW) +# Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") # Root filesystem for cross-building. @@ -18,7 +26,7 @@ if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() -# Configure build options. +# Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) @@ -27,6 +35,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) @@ -34,27 +46,20 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) -add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") -# Application build -add_executable(${BINARY_NAME} - "main.cc" - "my_application.cc" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" -) -apply_standard_settings(${BINARY_NAME}) -target_link_libraries(${BINARY_NAME} PRIVATE flutter) -target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) + # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of @@ -64,12 +69,11 @@ set_target_properties(${BINARY_NAME} RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) -target_link_libraries(${BINARY_NAME} PRIVATE ${MIMALLOC_LIB}) - # === Installation === # By default, "installing" just makes a relocatable bundle in the build @@ -96,11 +100,17 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -endif() +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. diff --git a/linux/com.github.KRTirtho.Spotube.appdata.xml b/linux/com.github.KRTirtho.Spotube.appdata.xml deleted file mode 100644 index f30d360b..00000000 --- a/linux/com.github.KRTirtho.Spotube.appdata.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - com.github.KRTirtho.Spotube - Spotube - - Freedom of music - - CC0-1.0 - BSD-4-Clause - - pointing - keyboard - touch - - Kingkor Roy Tirtho - https://github.com/krtirtho/spotube/issues - https://spotube.krtirtho.dev - https://opencollective.com/spotube - -

Open source Spotify client that doesn't require Premium nor uses Electron! Available for - both desktop & mobile!

-

Following are the features that currently spotube offers:

-
    -
  • 🚫 No ads, thanks to the use of public & free Spotify and YT Music APIsΒΉ
  • -
  • ⬇️ Downloadable tracks
  • -
  • πŸ–₯️ πŸ“± Cross-platform support
  • -
  • πŸͺΆ Small size & less data usage
  • -
  • πŸ•΅οΈ Anonymous/guest login
  • -
  • πŸ•’ Time synced lyrics
  • -
  • βœ‹ No telemetry, diagnostics or user data collection
  • -
  • πŸš€ Native performance
  • -
  • πŸ“– Open source/libre software
  • -
  • πŸ”‰ Playback control is done locally, not on the server
  • -
-
- - - - https://rawcdn.githack.com/KRTirtho/spotube/refs/heads/master/assets/spotube-screenshot.png - -
- - - com.github.KRTirtho.Spotube.desktop - %{{APPDATA_RELEASE}}% - - - - - - - - - - - - - - - - - - krtirtho@gmail.com - \ No newline at end of file diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt index 33fd5801..d5bd0164 100644 --- a/linux/flutter/CMakeLists.txt +++ b/linux/flutter/CMakeLists.txt @@ -1,3 +1,4 @@ +# This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") diff --git a/linux/packaging/appimage/make_config.yaml b/linux/packaging/appimage/make_config.yaml deleted file mode 100644 index c7332ea2..00000000 --- a/linux/packaging/appimage/make_config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -display_name: Spotube -icon: assets/spotube-logo.png - -keywords: - - Music - - Spotify - - Media - - Streaming - - YouTube - -generic_name: Music Streaming Application -categories: - - Music - -supported_mime_type: - - x-scheme-handler/spotify diff --git a/linux/packaging/deb/make_config.yaml b/linux/packaging/deb/make_config.yaml deleted file mode 100644 index 4528a136..00000000 --- a/linux/packaging/deb/make_config.yaml +++ /dev/null @@ -1,47 +0,0 @@ -display_name: Spotube -package_name: spotube - -maintainer: - name: Kingkor Roy Tirtho - email: krtirtho@gmail.com - -priority: optional -section: x11 -installed_size: 24400 - -dependencies: - - mpv - - libappindicator3-1 | libayatana-appindicator3-1 - - gir1.2-appindicator3-0.1 | gir1.2-ayatanaappindicator3-0.1 - - libsecret-1-0 - - libnotify-bin - - libjsoncpp25 - - libmpv1 | libmpv2 - - xdg-user-dirs - - avahi-daemon - - avahi-discover - - avahi-utils - - libnss-mdns - - mdns-scan - - libwebkit2gtk-4.1-0 | libwebkit2gtk-4.0-0 - - libsoup-3.0-0 | libsoup-2.4-0 - -suggested_dependencies: - - yt-dlp - -essential: false -icon: assets/spotube-logo.png - -keywords: - - Music - - Spotify - - Media - - Streaming - - YouTube - -generic_name: Music Streaming Application -categories: - - Music - -supported_mime_type: - - x-scheme-handler/spotify diff --git a/linux/packaging/rpm/make_config.yaml b/linux/packaging/rpm/make_config.yaml deleted file mode 100644 index 3d4a3b7e..00000000 --- a/linux/packaging/rpm/make_config.yaml +++ /dev/null @@ -1,38 +0,0 @@ -icon: assets/spotube-logo.png -summary: Lightweight cross-platform Spotify desktop client -group: Applications/Multimedia -vendor: Kingkor Roy Tirtho -packager: Kingkor Roy Tirtho -packagerEmail: krtirtho@gmail.com -license: BSD-4-Clause -url: https://github.com/KRTirtho/spotube -requires: - - mpv - - libappindicator - - jsoncpp - - libsecret - - libnotify - - xdg-user-dirs - - avahi - - mdns-scan - - nss-mdns - - webkit2gtk4.1 - - libsoup3 - -display_name: Spotube - -keywords: - - Music - - Spotify - - Media - - Streaming - - YouTube - -generic_name: Music Streaming Application -categories: - - Music - -startup_notify: true - -supported_mime_type: - - x-scheme-handler/spotify diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt new file mode 100644 index 00000000..e97dabc7 --- /dev/null +++ b/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/linux/main.cc b/linux/runner/main.cc similarity index 100% rename from linux/main.cc rename to linux/runner/main.cc diff --git a/linux/my_application.cc b/linux/runner/my_application.cc similarity index 65% rename from linux/my_application.cc rename to linux/runner/my_application.cc index 0aa4d905..c0649892 100644 --- a/linux/my_application.cc +++ b/linux/runner/my_application.cc @@ -17,13 +17,6 @@ G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) // Implements GApplication::activate. static void my_application_activate(GApplication* application) { MyApplication* self = MY_APPLICATION(application); - - GList* windows = gtk_application_get_windows(GTK_APPLICATION(application)); - if (windows) { - gtk_window_present(GTK_WINDOW(windows->data)); - return; - } - GtkWindow* window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); @@ -58,8 +51,7 @@ static void my_application_activate(GApplication* application) { gtk_widget_show(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); - fl_dart_project_set_dart_entrypoint_arguments( - project, self->dart_entrypoint_arguments); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); FlView* view = fl_view_new(project); gtk_widget_show(GTK_WIDGET(view)); @@ -71,24 +63,40 @@ static void my_application_activate(GApplication* application) { } // Implements GApplication::local_command_line. -static gboolean my_application_local_command_line(GApplication* application, - gchar*** arguments, - int* exit_status) { +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { MyApplication* self = MY_APPLICATION(application); // Strip out the first argument as it is the binary name. self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); g_autoptr(GError) error = nullptr; if (!g_application_register(application, nullptr, &error)) { - g_warning("Failed to register: %s", error->message); - *exit_status = 1; - return TRUE; + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; } g_application_activate(application); *exit_status = 0; - return FALSE; + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); } // Implements GObject::dispose. @@ -100,31 +108,23 @@ static void my_application_dispose(GObject* object) { static void my_application_class_init(MyApplicationClass* klass) { G_APPLICATION_CLASS(klass)->activate = my_application_activate; - G_APPLICATION_CLASS(klass)->local_command_line = - my_application_local_command_line; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; G_OBJECT_CLASS(klass)->dispose = my_application_dispose; } static void my_application_init(MyApplication* self) {} -bool is_flatpak(void) { - if (getenv("container") || getenv("FLATPAK_ID") || getenv("FLATPAK")) { - /* flatpak */ - return true; - } - return false; /* No container detected */ -} - MyApplication* my_application_new() { - // gchar based alternate MY_APPLICATION_ID - const char* my_application_id = APPLICATION_ID; + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); - if (is_flatpak()) { - my_application_id = "com.github.KRTirtho.Spotube"; - } - - return MY_APPLICATION(g_object_new( - my_application_get_type(), "application-id", my_application_id, "flags", - G_APPLICATION_HANDLES_COMMAND_LINE | G_APPLICATION_HANDLES_OPEN, - nullptr)); -} \ No newline at end of file + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/my_application.h b/linux/runner/my_application.h similarity index 100% rename from linux/my_application.h rename to linux/runner/my_application.h diff --git a/linux/spotube.desktop b/linux/spotube.desktop deleted file mode 100644 index 53f381e1..00000000 --- a/linux/spotube.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Spotube -Exec=/usr/bin/spotube -Icon=/usr/share/icons/spotube/spotube-logo.png -Comment=A music streaming app combining the power of Spotify & YouTube -Terminal=false -Categories=Audio;Music;Player;AudioVideo; -MimeType=x-scheme-handler/spotify; \ No newline at end of file
Spotube screenshot