diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} diff --git a/assets/locale/mediacontrols@cliffniff.github.com.pot b/assets/locale/mediacontrols@cliffniff.github.com.pot new file mode 100644 index 0000000..f4e328f --- /dev/null +++ b/assets/locale/mediacontrols@cliffniff.github.com.pot @@ -0,0 +1,370 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-04 20:18+0530\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/prefs.ts:125 +msgid "Are you sure you want to clear the cache?" +msgstr "" + +#: src/prefs.ts:126 assets/ui/app-chooser.blp:19 +msgid "Cancel" +msgstr "" + +#: src/prefs.ts:127 assets/ui/prefs.blp:253 +msgid "Clear cache" +msgstr "" + +#: src/prefs.ts:134 src/prefs.ts:143 +#, javascript-format +msgid "Cache size: %s" +msgstr "" + +#: src/prefs.ts:226 +msgid "Cache cleared successfully!" +msgstr "" + +#: src/prefs.ts:228 +msgid "Failed to clear cache!" +msgstr "" + +#: src/helpers/BlacklistedPlayers.ts:50 +msgid "" +"No players are blacklisted" +msgstr "" + +#: src/helpers/LabelList.ts:9 +msgid "Artist" +msgstr "" + +#: src/helpers/LabelList.ts:10 +msgid "Title" +msgstr "" + +#: src/helpers/LabelList.ts:11 +msgid "Album" +msgstr "" + +#: src/helpers/LabelList.ts:12 +msgid "Disc Number" +msgstr "" + +#: src/helpers/LabelList.ts:13 +msgid "Track Number" +msgstr "" + +#: assets/ui/app-chooser.blp:5 +msgid "Select app to blacklist" +msgstr "" + +#: assets/ui/app-chooser.blp:24 +msgid "Select" +msgstr "" + +#: assets/ui/blacklisted-players.blp:5 +msgid "Blacklist players" +msgstr "" + +#: assets/ui/blacklisted-players.blp:6 +msgid "Blacklisted players will be ignored by the extension." +msgstr "" + +#: assets/ui/blacklisted-players.blp:17 +msgid "Add" +msgstr "" + +#: assets/ui/element-list.blp:5 +msgid "Elements" +msgstr "" + +#: assets/ui/element-list.blp:12 assets/ui/prefs.blp:134 +msgid "Player icon" +msgstr "" + +#: assets/ui/element-list.blp:22 assets/ui/label-list.blp:5 +msgid "Label" +msgstr "" + +#: assets/ui/element-list.blp:32 assets/ui/prefs.blp:100 +msgid "Player controls" +msgstr "" + +#: assets/ui/label-list.blp:18 +msgid "Add item" +msgstr "" + +#: assets/ui/label-list.blp:24 +msgid "Add custom text" +msgstr "" + +#: assets/ui/prefs.blp:6 +msgid "General" +msgstr "" + +#: assets/ui/prefs.blp:10 +msgid "Common" +msgstr "" + +#: assets/ui/prefs.blp:13 +msgid "Labels" +msgstr "" + +#: assets/ui/prefs.blp:14 +msgid "Customize the labels in the panel and the popup menu" +msgstr "" + +#: assets/ui/prefs.blp:30 +msgid "Fixed width" +msgstr "" + +#: assets/ui/prefs.blp:31 +msgid "Use the specified width even when they are smaller than the width" +msgstr "" + +#: assets/ui/prefs.blp:35 +msgid "Scroll labels" +msgstr "" + +#: assets/ui/prefs.blp:36 +msgid "Scroll the labels when they are wider than the width" +msgstr "" + +#: assets/ui/prefs.blp:42 +msgid "Hide the media notification" +msgstr "" + +#: assets/ui/prefs.blp:43 +msgid "Hide the media notifications in the notification list" +msgstr "" + +#: assets/ui/prefs.blp:49 +msgid "Information" +msgstr "" + +#: assets/ui/prefs.blp:52 +msgid "Homepage" +msgstr "" + +#: assets/ui/prefs.blp:64 +msgid "Release notes" +msgstr "" + +#: assets/ui/prefs.blp:76 assets/ui/prefs.blp:80 +msgid "Report an issue" +msgstr "" + +#: assets/ui/prefs.blp:91 +msgid "Panel" +msgstr "" + +#: assets/ui/prefs.blp:96 +msgid "Show label" +msgstr "" + +#: assets/ui/prefs.blp:104 +msgid "Show player controls" +msgstr "" + +#: assets/ui/prefs.blp:108 +msgid "Show play/pause button" +msgstr "" + +#: assets/ui/prefs.blp:113 +msgid "Show next track button" +msgstr "" + +#: assets/ui/prefs.blp:118 +msgid "Show previous track button" +msgstr "" + +#: assets/ui/prefs.blp:123 +msgid "Show seek forward button" +msgstr "" + +#: assets/ui/prefs.blp:128 +msgid "Show seek back button" +msgstr "" + +#: assets/ui/prefs.blp:138 +msgid "Show player icon" +msgstr "" + +#: assets/ui/prefs.blp:142 +msgid "Colored player icon" +msgstr "" + +#: assets/ui/prefs.blp:150 +msgid "Positions" +msgstr "" + +#: assets/ui/prefs.blp:154 +msgid "Extension" +msgstr "" + +#: assets/ui/prefs.blp:157 +msgid "Position" +msgstr "" + +#: assets/ui/prefs.blp:158 +msgid "Position of the extension in the panel" +msgstr "" + +#: assets/ui/prefs.blp:162 +msgid "Left" +msgstr "" + +#: assets/ui/prefs.blp:163 +msgid "Center" +msgstr "" + +#: assets/ui/prefs.blp:164 +msgid "Right" +msgstr "" + +#: assets/ui/prefs.blp:170 +msgid "Index" +msgstr "" + +#: assets/ui/prefs.blp:171 +msgid "Index of the extension" +msgstr "" + +#: assets/ui/prefs.blp:188 +msgid "Shortcuts" +msgstr "" + +#: assets/ui/prefs.blp:193 assets/ui/prefs.blp:318 +msgid "Show popup menu" +msgstr "" + +#: assets/ui/prefs.blp:194 +msgid "Shortcut to toggle the popup menu" +msgstr "" + +#: assets/ui/prefs.blp:198 assets/ui/prefs.blp:275 +msgid "Set shortcut" +msgstr "" + +#: assets/ui/prefs.blp:206 +msgid "Mouse actions" +msgstr "" + +#: assets/ui/prefs.blp:209 +msgid "Left click / Tap" +msgstr "" + +#: assets/ui/prefs.blp:214 +msgid "Middle click" +msgstr "" + +#: assets/ui/prefs.blp:219 +msgid "Right click" +msgstr "" + +#: assets/ui/prefs.blp:224 +msgid "Double click / Double tap" +msgstr "" + +#: assets/ui/prefs.blp:229 +msgid "Scroll up / Swipe right" +msgstr "" + +#: assets/ui/prefs.blp:234 +msgid "Scroll down / Swipe left" +msgstr "" + +#: assets/ui/prefs.blp:241 +msgid "Other" +msgstr "" + +#: assets/ui/prefs.blp:245 +msgid "Cache" +msgstr "" + +#: assets/ui/prefs.blp:246 +msgid "" +"This extension cache album art to improve performance. You can clear the " +"cache here." +msgstr "" + +#: assets/ui/prefs.blp:249 +msgid "Cache album art" +msgstr "" + +#: assets/ui/prefs.blp:264 +msgid "Clear" +msgstr "" + +#: assets/ui/prefs.blp:291 +msgid "" +"Press escape to cancel.\n" +"Press enter to set the shortcut.\n" +"Press backspace to reset." +msgstr "" + +#: assets/ui/prefs.blp:297 +msgid "Press shortcut" +msgstr "" + +#: assets/ui/prefs.blp:308 +msgid "None" +msgstr "" + +#: assets/ui/prefs.blp:309 +msgid "Play/Pause" +msgstr "" + +#: assets/ui/prefs.blp:310 +msgid "Play" +msgstr "" + +#: assets/ui/prefs.blp:311 +msgid "Pause" +msgstr "" + +#: assets/ui/prefs.blp:312 +msgid "Next track" +msgstr "" + +#: assets/ui/prefs.blp:313 +msgid "Previous track" +msgstr "" + +#: assets/ui/prefs.blp:314 +msgid "Volume up" +msgstr "" + +#: assets/ui/prefs.blp:315 +msgid "Volume down" +msgstr "" + +#: assets/ui/prefs.blp:316 +msgid "Toggle loop" +msgstr "" + +#: assets/ui/prefs.blp:317 +msgid "Toggle shuffle" +msgstr "" + +#: assets/ui/prefs.blp:319 +msgid "Raise player" +msgstr "" + +#: assets/ui/prefs.blp:320 +msgid "Quit player" +msgstr "" diff --git a/assets/locale/de.po b/assets/locale/old/de.po similarity index 100% rename from assets/locale/de.po rename to assets/locale/old/de.po diff --git a/assets/locale/mediacontrols.pot b/assets/locale/old/mediacontrols.pot similarity index 100% rename from assets/locale/mediacontrols.pot rename to assets/locale/old/mediacontrols.pot diff --git a/assets/org.gnome.shell.extensions.mediacontrols.gschema.xml b/assets/org.gnome.shell.extensions.mediacontrols.gschema.xml index a1a8c6b..1a01776 100644 --- a/assets/org.gnome.shell.extensions.mediacontrols.gschema.xml +++ b/assets/org.gnome.shell.extensions.mediacontrols.gschema.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -73,22 +73,22 @@ ['TITLE', '-', 'ARTIST'] - 'Show popup menu' + 'SHOW_POPUP_MENU' - 'None' + 'NONE' - 'Raise player' + 'RAISE_PLAYER' - 'None' + 'NONE' - 'Volume up' + 'VOLUME_UP' - 'Volume down' + 'VOLUME_DOWN' true diff --git a/assets/ui/app-chooser.blp b/assets/ui/app-chooser.blp index 52a4522..27acba5 100644 --- a/assets/ui/app-chooser.blp +++ b/assets/ui/app-chooser.blp @@ -2,7 +2,7 @@ using Gtk 4.0; using Adw 1; template $AppChooser: Adw.Window { - title: "Select app to blacklist"; + title: _("Select app to blacklist"); modal: true; resizable: false; default-width: 300; @@ -16,12 +16,12 @@ template $AppChooser: Adw.Window { [start] Button cancel-btn { - label: "Cancel"; + label: _("Cancel"); } [end] Button select-btn { - label: "Select"; + label: _("Select"); styles [ "suggested-action" diff --git a/assets/ui/blacklisted-players.blp b/assets/ui/blacklisted-players.blp index d859cc4..e282bc0 100644 --- a/assets/ui/blacklisted-players.blp +++ b/assets/ui/blacklisted-players.blp @@ -2,8 +2,8 @@ using Gtk 4.0; using Adw 1; template $BlacklistedPlayers: Adw.PreferencesGroup { - title: "Blacklist players"; - description: "Blacklisted players will be ignored by the extension."; + title: _("Blacklist players"); + description: _("Blacklisted players will be ignored by the extension."); header-suffix: Button add-btn { halign: end; @@ -14,7 +14,7 @@ template $BlacklistedPlayers: Adw.PreferencesGroup { ] Adw.ButtonContent { - label: "Add"; + label: _("Add"); icon-name: "list-add-symbolic"; } }; diff --git a/assets/ui/element-list.blp b/assets/ui/element-list.blp index 8f9b32e..72eedc6 100644 --- a/assets/ui/element-list.blp +++ b/assets/ui/element-list.blp @@ -2,14 +2,14 @@ using Gtk 4.0; using Adw 1; template $ElementList: Adw.PreferencesGroup { - title: "Elements"; + title: _("Elements"); ListBox list-box { styles ["boxed-list"] selection-mode: multiple; Adw.ActionRow icon-row { - title: "Player icon"; + title: _("Player icon"); activatable: true; [suffix] @@ -19,7 +19,7 @@ template $ElementList: Adw.PreferencesGroup { } Adw.ActionRow label-row { - title: "Label"; + title: _("Label"); activatable: true; [suffix] @@ -29,7 +29,7 @@ template $ElementList: Adw.PreferencesGroup { } Adw.ActionRow controls-row { - title: "Player controls"; + title: _("Player controls"); activatable: true; [suffix] diff --git a/assets/ui/label-list.blp b/assets/ui/label-list.blp index 8d559ee..a028ce9 100644 --- a/assets/ui/label-list.blp +++ b/assets/ui/label-list.blp @@ -2,7 +2,7 @@ using Gtk 4.0; using Adw 1; template $LabelList: Adw.PreferencesGroup { - title: "Label"; + title: _("Label"); header-suffix: Box { halign: end; @@ -15,13 +15,13 @@ template $LabelList: Adw.PreferencesGroup { ] Button add-item-btn { - label: "Add item"; + label: _("Add item"); halign: end; valign: center; } Button add-text-btn { - label: "Add custom text"; + label: _("Add custom text"); halign: end; valign: center; } diff --git a/assets/ui/prefs.blp b/assets/ui/prefs.blp index 39f4866..6d63c9c 100644 --- a/assets/ui/prefs.blp +++ b/assets/ui/prefs.blp @@ -3,15 +3,15 @@ using Gio 2.0; using Adw 1; Adw.PreferencesPage page-general { - title: "General"; + title: _("General"); icon-name: "settings-symbolic"; Adw.PreferencesGroup { - title: "Common"; + title: _("Common"); Adw.ExpanderRow { - title: "Labels"; - subtitle: "Customize the labels in the panel and the popup menu"; + title: _("Labels"); + subtitle: _("Customize the labels in the panel and the popup menu"); expanded: true; Adw.SpinRow sr-general-label-width { @@ -27,29 +27,29 @@ Adw.PreferencesPage page-general { } Adw.SwitchRow sr-general-label-fixed { - title: "Fixed width"; - subtitle: "Use the specified width even when they are smaller than the width"; + title: _("Fixed width"); + subtitle: _("Use the specified width even when they are smaller than the width"); } Adw.SwitchRow sr-general-scroll-labels { - title: "Scroll labels"; - subtitle: "Scroll the labels when they are wider than the width"; + title: _("Scroll labels"); + subtitle: _("Scroll the labels when they are wider than the width"); } } Adw.SwitchRow sr-general-hide-media-notification { - title: "Hide the media notification"; - subtitle: "Hide the media notifications in the notification list"; + title: _("Hide the media notification"); + subtitle: _("Hide the media notifications in the notification list"); } } Adw.PreferencesGroup { - title: "Information"; + title: _("Information"); Adw.ActionRow { - title: "Homepage"; + title: _("Homepage"); activatable-widget: lb-general-homepage; LinkButton lb-general-homepage { @@ -61,7 +61,7 @@ Adw.PreferencesPage page-general { } Adw.ActionRow { - title: "Release notes"; + title: _("Release notes"); activatable-widget: lb-general-notes; LinkButton lb-general-notes { @@ -73,11 +73,11 @@ Adw.PreferencesPage page-general { } Adw.ActionRow { - title: "Report an issue"; + title: _("Report an issue"); activatable-widget: lb-general-issues; LinkButton lb-general-issues { - label: "Report an issue"; + label: _("Report an issue"); icon-name: "link-symbolic"; uri: "hhttps://github.com/sakithb/media-controls/issues"; margin-top: 10; @@ -88,58 +88,58 @@ Adw.PreferencesPage page-general { } Adw.PreferencesPage page-panel { - title: "Panel"; + title: _("Panel"); icon-name: "panel-top-symbolic"; Adw.PreferencesGroup { Adw.SwitchRow sr-panel-show-label { - title: "Show label"; + title: _("Show label"); } Adw.ExpanderRow { - title: "Player controls"; + title: _("Player controls"); expanded: true; Adw.SwitchRow sr-panel-show-controls { - title: "Show player controls"; + title: _("Show player controls"); } Adw.SwitchRow sr-panel-show-play { - title: "Show play/pause button"; + title: _("Show play/pause button"); sensitive: bind sr-panel-show-controls.active; } Adw.SwitchRow sr-panel-show-next { - title: "Show next track button"; + title: _("Show next track button"); sensitive: bind sr-panel-show-controls.active; } Adw.SwitchRow sr-panel-show-prev { - title: "Show previous track button"; + title: _("Show previous track button"); sensitive: bind sr-panel-show-controls.active; } Adw.SwitchRow sr-panel-show-seek-forward { - title: "Show seek forward button"; + title: _("Show seek forward button"); sensitive: bind sr-panel-show-controls.active; } Adw.SwitchRow sr-panel-show-seek-backward { - title: "Show seek back button"; + title: _("Show seek back button"); sensitive: bind sr-panel-show-controls.active; } } Adw.ExpanderRow { - title: "Player icon"; + title: _("Player icon"); expanded: true; Adw.SwitchRow sr-panel-show-player { - title: "Show player icon"; + title: _("Show player icon"); } Adw.SwitchRow sr-panel-colored-player { - title: "Colored player icon"; + title: _("Colored player icon"); sensitive: bind sr-panel-show-player.active; } } @@ -147,28 +147,28 @@ Adw.PreferencesPage page-panel { } Adw.PreferencesPage page-positions { - title: "Positions"; + title: _("Positions"); icon-name: "view-list-symbolic"; Adw.PreferencesGroup { - title: "Extension"; + title: _("Extension"); Adw.ComboRow cr-positions-extension-position { - title: "Position"; - subtitle: "Position of the extension in the panel"; + title: _("Position"); + subtitle: _("Position of the extension in the panel"); model: StringList { strings [ - "Left", - "Center", - "Right", + _("Left"), + _("Center"), + _("Right"), ] }; } Adw.SpinRow sr-positions-extension-index { - title: "Index"; - subtitle: "Index of the extension"; + title: _("Index"); + subtitle: _("Index of the extension"); adjustment: Adjustment { lower: 0; @@ -185,17 +185,17 @@ Adw.PreferencesPage page-positions { } Adw.PreferencesPage page-shortcuts { - title: "Shortcuts"; + title: _("Shortcuts"); icon-name: "keyboard-symbolic"; Adw.PreferencesGroup { Adw.ActionRow row-shortcuts-popup { - title: "Show popup menu"; - subtitle: "Shortcut to toggle the popup menu"; + title: _("Show popup menu"); + subtitle: _("Shortcut to toggle the popup menu"); activatable-widget: sl-shortcuts-popup; ShortcutLabel sl-shortcuts-popup { - disabled-text: "Set shortcut"; + disabled-text: _("Set shortcut"); halign: center; valign: center; } @@ -203,54 +203,54 @@ Adw.PreferencesPage page-shortcuts { } Adw.PreferencesGroup { - title: "Mouse actions"; + title: _("Mouse actions"); Adw.ComboRow cr-shortcuts-mouse-left { - title: "Left click / Tap"; + title: _("Left click / Tap"); model: mouse-actions; } Adw.ComboRow cr-shortcuts-mouse-middle { - title: "Middle click"; + title: _("Middle click"); model: mouse-actions; } Adw.ComboRow cr-shortcuts-mouse-right { - title: "Right click"; + title: _("Right click"); model: mouse-actions; } Adw.ComboRow cr-shortcuts-mouse-double { - title: "Double click / Double tap"; + title: _("Double click / Double tap"); model: mouse-actions; } Adw.ComboRow cr-shortcuts-mouse-scroll-up { - title: "Scroll up / Swipe right"; + title: _("Scroll up / Swipe right"); model: mouse-actions; } Adw.ComboRow cr-shortcuts-mouse-scroll-down { - title: "Scroll down / Swipe left"; + title: _("Scroll down / Swipe left"); model: mouse-actions; } } } Adw.PreferencesPage page-other { - title: "Other"; + title: _("Other"); icon-name: "settings-symbolic"; Adw.PreferencesGroup { - title: "Cache"; - description: "This extension cache album art to improve performance. You can clear the cache here."; + title: _("Cache"); + description: _("This extension cache album art to improve performance. You can clear the cache here."); Adw.SwitchRow sr-other-cache { - title: "Cache album art"; + title: _("Cache album art"); } Adw.ActionRow row-other-cache-clear { - title: "Clear cache"; + title: _("Clear cache"); Button btn-other-cache-clear { halign: end; @@ -261,7 +261,7 @@ Adw.PreferencesPage page-other { ] Adw.ButtonContent { - label: "Clear"; + label: _("Clear"); icon-name: "user-trash-symbolic"; } } @@ -272,7 +272,7 @@ Adw.PreferencesPage page-other { } Adw.Window win-shortcut-editor { - title: "Set shortcut"; + title: _("Set shortcut"); modal: true; resizable: false; default-width: 300; @@ -288,13 +288,13 @@ Adw.Window win-shortcut-editor { margin-bottom: 20; Label { - label: "Press escape to cancel.\nPress enter to set the shortcut.\nPress backspace to reset."; + label: _("Press escape to cancel.\nPress enter to set the shortcut.\nPress backspace to reset."); use-markup: true; wrap: true; } ShortcutLabel sl-shortcut-editor { - disabled-text: "Press shortcut"; + disabled-text: _("Press shortcut"); halign: center; valign: center; vexpand: true; @@ -305,18 +305,18 @@ Adw.Window win-shortcut-editor { StringList mouse-actions { strings [ - "None", - "Play/Pause", - "Play", - "Pause", - "Next track", - "Previous track", - "Volume up", - "Volume down", - "Toggle loop", - "Toggle shuffle", - "Show popup menu", - "Raise player", - "Quit player", + _("None"), + _("Play/Pause"), + _("Play"), + _("Pause"), + _("Next track"), + _("Previous track"), + _("Volume up"), + _("Volume down"), + _("Toggle loop"), + _("Toggle shuffle"), + _("Show popup menu"), + _("Raise player"), + _("Quit player"), ] } diff --git a/package.json b/package.json index b5cf814..475c785 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,14 @@ { "type": "module", "scripts": { - "compile": "npm run compile:clean && npm run compile:tsc && npm run compile:ui && npm run compile:assets && npm run compile:gresource", + "compile": "npm run compile:clean && npm run compile:tsc && npm run compile:ui && npm run compile:assets && npm run compile:gresource && npm run compile:po", "compile:tsc": "tsc", "compile:ui": "mkdir -p dist/compiled/ui;for i in assets/ui/*.blp;do BASENAME=$(basename $i);/usr/bin/env blueprint-compiler compile --output ./dist/compiled/ui/${BASENAME%.*}.ui $i;done", - "compile:padding": "eslint --fix --rule \"{padding-line-between-statements: [\"error\", { \"blankLine\": \"always\", \"prev\": \"block-like\", \"next\": \"block-like\" }]}\" dist/compiled/", + "compile:padding": "eslint --fix --rule \"{padding-line-between-statements: ['error', { 'blankLine': 'always', 'prev': '*', 'next': 'block-like' }, { 'blankLine': 'always', 'prev': 'block-like', 'next': '*' }, { 'blankLine': 'always', 'prev': 'multiline-expression', 'next': '*' }, { 'blankLine': 'always', 'prev': '*', 'next': 'multiline-expression' }, { 'blankLine': 'always', 'prev': 'import', 'next': 'expression' }, { 'blankLine': 'always', 'prev': 'expression', 'next': 'export' }, { 'blankLine': 'always', 'prev': 'expression', 'next': 'class' }]}\" dist/compiled/", "compile:assets": "find assets -type f -not -path '*/images/*' -not -path '*/locale/*' -not -path '*/schemas/*' -not -path '*/ui/*' -exec sh -c 'f=\"{}\"; p=${f#*/}; d=$(dirname $p); mkdir -p dist/compiled/$d; cp $f dist/compiled/$p' ';'", "compile:gresource": "glib-compile-resources assets/org.gnome.shell.extensions.mediacontrols.gresource.xml --target=dist/compiled/org.gnome.shell.extensions.mediacontrols.gresource --sourcedir=dist/compiled/", + "compile:po": "touch assets/locale/mediacontrols@cliffniff.github.com.pot && xgettext --from-code=UTF-8 --add-comments --join-existing --keyword=_ --keyword=C_:1c,2 --language=Javascript --output=assets/locale/mediacontrols@cliffniff.github.com.pot src/*.ts src/**/*.ts assets/ui/*.blp", + "compile:post": "rm -rf dist/compiled/*.xml dist/compiled/ui/; ls dist/compiled/types/ | grep -xv \"enums\" | xargs -I \"$\" rm \"dist/compiled/types/$\"", "compile:clean": "rm -rf dist", "lint": "eslint src --ext .ts", "format": "prettier --write src" diff --git a/src/extension.ts b/src/extension.ts index 11e8ab5..ecbe78a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,22 +8,23 @@ import { Extension } from "resource:///org/gnome/shell/extensions/extension.js"; import PanelButton from "./helpers/PanelButton.js"; import PlayerProxy from "./helpers/PlayerProxy.js"; +import { debugLog, enumValueByIndex, errorLog, handleError } from "./utils/misc.js"; +import { getAppByIdAndEntry, createDbusProxy } from "./utils/shell_only.js"; +import { StdInterface } from "./types/dbus.js"; +import { KeysOf } from "./types/misc.js"; import { - DBUS_IFACE_NAME, - DBUS_OBJECT_PATH, - DBUS_PROPERTIES_IFACE_NAME, - ExtensionPositions, + PlaybackStatus, + WidgetFlags, LabelTypes, - MPRIS_IFACE_NAME, + PanelElements, MPRIS_PLAYER_IFACE_NAME, + DBUS_PROPERTIES_IFACE_NAME, + MPRIS_IFACE_NAME, + DBUS_OBJECT_PATH, + DBUS_IFACE_NAME, + ExtensionPositions, MouseActions, - PanelElements, } from "./types/enums/general.js"; -import { PlaybackStatus, WidgetFlags } from "./types/enums/shell.js"; -import { debugLog, enumValueByIndex, errorLog, handleError } from "./utils/misc.js"; -import { getAppByIdAndEntry, createDbusProxy } from "./utils/shell.js"; -import { StdInterface } from "./types/dbus.js"; -import { KeysOf } from "./types/general.js"; Gio._promisify(Gio.File.prototype, "load_contents_async", "load_contents_finish"); @@ -125,12 +126,12 @@ export default class MediaControls extends Extension { this.extensionIndex = this.settings.get_uint("extension-index"); this.elementsOrder = this.settings.get_strv("elements-order") as ElementsOrder; this.labelsOrder = this.settings.get_strv("labels-order") as LabelsOrder; - this.mouseActionLeft = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-left")); - this.mouseActionMiddle = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-middle")); - this.mouseActionRight = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-right")); - this.mouseActionDouble = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-double")); - this.mouseActionScrollUp = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-scroll-up")); - this.mouseActionScrollDown = enumValueByIndex(MouseActions, this.settings.get_enum("mouse-action-scroll-down")); + this.mouseActionLeft = this.settings.get_enum("mouse-action-left") as MouseActions; + this.mouseActionMiddle = this.settings.get_enum("mouse-action-middle") as MouseActions; + this.mouseActionRight = this.settings.get_enum("mouse-action-right") as MouseActions; + this.mouseActionDouble = this.settings.get_enum("mouse-action-double") as MouseActions; + this.mouseActionScrollUp = this.settings.get_enum("mouse-action-scroll-up") as MouseActions; + this.mouseActionScrollDown = this.settings.get_enum("mouse-action-scroll-down") as MouseActions; this.cacheArt = this.settings.get_boolean("cache-art"); this.blacklistedPlayers = this.settings.get_strv("blacklisted-players"); @@ -223,33 +224,27 @@ export default class MediaControls extends Extension { }); this.settings.connect("changed::mouse-action-left", () => { - const enumIndex = this.settings.get_enum("mouse-action-left"); - this.mouseActionLeft = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionLeft = this.settings.get_enum("mouse-action-left") as MouseActions; }); this.settings.connect("changed::mouse-action-middle", () => { - const enumIndex = this.settings.get_enum("mouse-action-middle"); - this.mouseActionMiddle = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionMiddle = this.settings.get_enum("mouse-action-middle") as MouseActions; }); this.settings.connect("changed::mouse-action-right", () => { - const enumIndex = this.settings.get_enum("mouse-action-right"); - this.mouseActionRight = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionRight = this.settings.get_enum("mouse-action-right") as MouseActions; }); this.settings.connect("changed::mouse-action-double", () => { - const enumIndex = this.settings.get_enum("mouse-action-double"); - this.mouseActionDouble = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionDouble = this.settings.get_enum("mouse-action-double") as MouseActions; }); this.settings.connect("changed::mouse-action-scroll-up", () => { - const enumIndex = this.settings.get_enum("mouse-action-scroll-up"); - this.mouseActionScrollUp = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionScrollUp = this.settings.get_enum("mouse-action-scroll-up") as MouseActions; }); this.settings.connect("changed::mouse-action-scroll-down", () => { - const enumIndex = this.settings.get_enum("mouse-action-scroll-down"); - this.mouseActionScrollDown = enumValueByIndex(MouseActions, enumIndex); + this.mouseActionScrollDown = this.settings.get_enum("mouse-action-scroll-down") as MouseActions; }); this.settings.connect("changed::cache-art", () => { diff --git a/src/helpers/BlacklistedPlayers.ts b/src/helpers/BlacklistedPlayers.ts index 2d52527..e838e5f 100644 --- a/src/helpers/BlacklistedPlayers.ts +++ b/src/helpers/BlacklistedPlayers.ts @@ -2,6 +2,8 @@ import Adw from "gi://Adw?version=1"; import GObject from "gi://GObject?version=2.0"; import Gio from "gi://Gio?version=2.0"; import Gtk from "gi://Gtk?version=4.0"; +import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"; + import AppChooser from "./AppChooser.js"; GObject.type_ensure(AppChooser.$gtype); @@ -45,7 +47,7 @@ class BlacklistedPlayers extends Adw.PreferencesGroup { const row = new Adw.ActionRow(); const label = new Gtk.Label(); - label.label = "No players are blacklisted"; + label.label = _("No players are blacklisted"); label.useMarkup = true; label.halign = Gtk.Align.CENTER; label.marginTop = 20; diff --git a/src/helpers/ElementList.ts b/src/helpers/ElementList.ts index 8ec5c5d..cb4db0a 100644 --- a/src/helpers/ElementList.ts +++ b/src/helpers/ElementList.ts @@ -3,17 +3,19 @@ import GObject from "gi://GObject?version=2.0"; import Gdk from "gi://Gdk?version=4.0"; import Graphene from "gi://Graphene?version=1.0"; import Gtk from "gi://Gtk?version=4.0"; - import { PanelElements } from "../types/enums/general.js"; -import { enumKeyByValue } from "../utils/misc.js"; + +interface PanelElementRow extends Adw.ActionRow { + elementKey: string; +} class ElementList extends Adw.PreferencesGroup { public elements: string[]; private listBox: Gtk.ListBox; - private iconRow: Adw.ActionRow; - private labelRow: Adw.ActionRow; - private controlsRow: Adw.ActionRow; + private iconRow: PanelElementRow; + private labelRow: PanelElementRow; + private controlsRow: PanelElementRow; constructor(params = {}) { super(params); @@ -22,10 +24,13 @@ class ElementList extends Adw.PreferencesGroup { this.listBox = this._list_box; // @ts-expect-error Typescript doesn't know about the internal children this.iconRow = this._icon_row; + this.iconRow.elementKey = "ICON"; // @ts-expect-error Typescript doesn't know about the internal children this.labelRow = this._label_row; + this.labelRow.elementKey = "LABEL"; // @ts-expect-error Typescript doesn't know about the internal children this.controlsRow = this._controls_row; + this.controlsRow.elementKey = "CONTROLS"; this.elements = []; @@ -46,9 +51,9 @@ class ElementList extends Adw.PreferencesGroup { }); this.listBox.add_controller(dropTarget); - this.listBox.set_sort_func((firstRow: Adw.ActionRow, secondRow: Adw.ActionRow) => { - const firstIndex = this.elements.indexOf(enumKeyByValue(PanelElements, firstRow.title)); - const secondIndex = this.elements.indexOf(enumKeyByValue(PanelElements, secondRow.title)); + this.listBox.set_sort_func((firstRow: PanelElementRow, secondRow: PanelElementRow) => { + const firstIndex = this.elements.indexOf(firstRow.elementKey); + const secondIndex = this.elements.indexOf(secondRow.elementKey); return firstIndex - secondIndex; }); diff --git a/src/helpers/LabelList.ts b/src/helpers/LabelList.ts index d3342a1..e4164e7 100644 --- a/src/helpers/LabelList.ts +++ b/src/helpers/LabelList.ts @@ -3,7 +3,7 @@ import GObject from "gi://GObject?version=2.0"; import Gdk from "gi://Gdk?version=4.0"; import Graphene from "gi://Graphene?version=1.0"; import Gtk from "gi://Gtk?version=4.0"; - +import { gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"; import { LabelTypes } from "../types/enums/general.js"; class LabelList extends Adw.PreferencesGroup { @@ -24,11 +24,9 @@ class LabelList extends Adw.PreferencesGroup { // @ts-expect-error Typescript doesn't know about internal children this.addTextBtn = this._add_text_btn; - this.labelsList = new Gtk.StringList(); - - for (const label of Object.values(LabelTypes)) { - this.labelsList.append(label); - } + this.labelsList = new Gtk.StringList({ + strings: Object.values(LabelTypes).map(_), + }); const dropTarget = Gtk.DropTarget.new(GObject.TYPE_UINT, Gdk.DragAction.MOVE); dropTarget.connect("drop", (_, sourceIndex, x, y) => { @@ -88,7 +86,7 @@ class LabelList extends Adw.PreferencesGroup { const element = this.labels[i]; if (Object.keys(LabelTypes).includes(element)) { const row = new Adw.ComboRow(); - row.title = LabelTypes[element]; + row.title = _(LabelTypes[element]); row.model = this.labelsList; row.selected = Object.keys(LabelTypes).indexOf(element); diff --git a/src/helpers/MenuSlider.ts b/src/helpers/MenuSlider.ts index 838ba4c..65fd045 100644 --- a/src/helpers/MenuSlider.ts +++ b/src/helpers/MenuSlider.ts @@ -1,6 +1,7 @@ import Clutter from "gi://Clutter?version=13"; import GObject from "gi://GObject?version=2.0"; import St from "gi://St?version=13"; + import * as Slider from "resource:///org/gnome/shell/ui/slider.js"; import { msToHHMMSS } from "../utils/misc.js"; diff --git a/src/helpers/PanelButton.ts b/src/helpers/PanelButton.ts index 8dda05c..94a1d6f 100644 --- a/src/helpers/PanelButton.ts +++ b/src/helpers/PanelButton.ts @@ -12,19 +12,21 @@ import MediaControls from "../extension.js"; import PlayerProxy from "./PlayerProxy.js"; import ScrollingLabel from "./ScrollingLabel.js"; import MenuSlider from "./MenuSlider.js"; -import { LabelTypes, MouseActions, PanelElements } from "../types/enums/general.js"; +import { KeysOf } from "../types/misc.js"; +import { debugLog, handleError } from "../utils/misc.js"; +import { getAppByIdAndEntry, getImage } from "../utils/shell_only.js"; +import { PlayerProxyProperties } from "../types/dbus.js"; +import { ControlIconOptions } from "../types/enums/shell_only.js"; import { + LabelTypes, + PanelElements, + MouseActions, LoopStatus, PlaybackStatus, WidgetFlags, - ControlIconOptions, - MenuControlIconOptions, - PanelControlIconOptions, -} from "../types/enums/shell.js"; -import { debugLog, handleError } from "../utils/misc.js"; -import { getAppByIdAndEntry, getImage } from "../utils/shell.js"; -import { KeysOf } from "../types/general.js"; -import { PlayerProxyProperties } from "../types/dbus.js"; +} from "../types/enums/general.js"; +import { PanelControlIconOptions } from "../types/enums/shell_only.js"; +import { MenuControlIconOptions } from "../types/enums/shell_only.js"; Gio._promisify(GdkPixbuf.Pixbuf, "new_from_stream_async", "new_from_stream_finish"); diff --git a/src/helpers/PlayerProxy.ts b/src/helpers/PlayerProxy.ts index 94c5c40..38f2788 100644 --- a/src/helpers/PlayerProxy.ts +++ b/src/helpers/PlayerProxy.ts @@ -1,4 +1,9 @@ import Gio from "gi://Gio?version=2.0"; + +import { MPRIS_PLAYER_IFACE_NAME, MPRIS_OBJECT_PATH, PlaybackStatus, LoopStatus } from "../types/enums/general.js"; +import { debugLog, errorLog, handleError } from "../utils/misc.js"; +import { createDbusProxy } from "../utils/shell_only.js"; +import { KeysOf } from "../types/misc.js"; import { MprisInterface, MprisPlayerInterface, @@ -8,11 +13,6 @@ import { PlayerProxyProperties, PropertiesInterface, } from "../types/dbus.js"; -import { MPRIS_OBJECT_PATH, MPRIS_PLAYER_IFACE_NAME } from "../types/enums/general.js"; -import { PlaybackStatus, LoopStatus } from "../types/enums/shell.js"; -import { debugLog, errorLog, handleError } from "../utils/misc.js"; -import { createDbusProxy } from "../utils/shell.js"; -import { KeysOf } from "../types/general.js"; type PlayerProxyChangeListeners = Map< KeysOf, diff --git a/src/index.d.ts b/src/index.d.ts index 6018a33..ac5cdc7 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -20,4 +20,8 @@ declare global { interface ImportMeta { url: string; } + + interface String { + format(...args: unknown[]): string; + } } diff --git a/src/metadata.json b/src/metadata.json index 49e172a..14b6fcd 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -4,9 +4,7 @@ "description": "Show controls and information of the currently playing media in the panel.", "url": "https://github.com/cliffniff/media-controls", "settings-schema": "org.gnome.shell.extensions.mediacontrols", - "gettext-domain": "mediacontrols", + "gettext-domain": "mediacontrols@cliffniff.github.com", "version-name": "2.0.0-beta.1", - "shell-version": [ - "45" - ] + "shell-version": ["45"] } diff --git a/src/prefs.ts b/src/prefs.ts index 3648302..557ead1 100644 --- a/src/prefs.ts +++ b/src/prefs.ts @@ -1,16 +1,16 @@ -import "./utils/initResource.js"; +import "./utils/init_resource.js"; import Adw from "gi://Adw?version=1"; import GLib from "gi://GLib?version=2.0"; import Gdk from "gi://Gdk?version=4.0"; import Gio from "gi://Gio?version=2.0"; import Gtk from "gi://Gtk?version=4.0"; -import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"; +import GObject from "gi://GObject?version=2.0"; +import { ExtensionPreferences, gettext as _ } from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"; import BlacklistedPlayers from "./helpers/BlacklistedPlayers.js"; import ElementList from "./helpers/ElementList.js"; import LabelList from "./helpers/LabelList.js"; -import { isValidBinding, isValidAccelerator } from "./utils/prefs.js"; -import GObject from "gi://GObject?version=2.0"; +import { isValidBinding, isValidAccelerator } from "./utils/prefs_only.js"; GObject.type_ensure(BlacklistedPlayers.$gtype); GObject.type_ensure(ElementList.$gtype); @@ -122,16 +122,16 @@ export default class MediaControlsPreferences extends ExtensionPreferences { const cacheClearBtn = this.builder.get_object("btn-other-cache-clear") as Gtk.Button; cacheClearBtn.connect("clicked", () => { - const dialog = Adw.MessageDialog.new(this.window, "", "Are you sure you want to clear the cache?"); - dialog.add_response("cancel", "Cancel"); - dialog.add_response("clear", "Clear cache"); + const dialog = Adw.MessageDialog.new(this.window, "", _("Are you sure you want to clear the cache?")); + dialog.add_response("cancel", _("Cancel")); + dialog.add_response("clear", _("Clear cache")); dialog.set_response_appearance("clear", Adw.ResponseAppearance.DESTRUCTIVE); - dialog.connect("response", (_, response) => { + dialog.connect("response", (self, response) => { if (response === "cancel") return; this.clearCache().then(() => { - cacheClearRow.subtitle = `Cache size: ${GLib.format_size(0)}`; + cacheClearRow.subtitle = _("Cache size: %s").format(GLib.format_size(0)); }); }); @@ -140,7 +140,7 @@ export default class MediaControlsPreferences extends ExtensionPreferences { this.getCacheSize().then((size) => { const sizeReadable = GLib.format_size(size); - cacheClearRow.subtitle = `Cache size: ${sizeReadable}`; + cacheClearRow.subtitle = _("Cache size: %s").format(sizeReadable); }); const blacklistedGrp = this.builder.get_object("gp-other-blacklist") as InstanceType; @@ -223,9 +223,9 @@ export default class MediaControlsPreferences extends ExtensionPreferences { const success = await folder.trash_async(null, null); if (success) { - this.sendToast("Cache cleared successfully!"); + this.sendToast(_("Cache cleared successfully!")); } else { - this.sendToast("Failed to clear cache!"); + this.sendToast(_("Failed to clear cache!")); } } } diff --git a/src/types/dbus.ts b/src/types/dbus.ts index 14d9e0f..7a51232 100644 --- a/src/types/dbus.ts +++ b/src/types/dbus.ts @@ -1,7 +1,8 @@ import Gio from "gi://Gio?version=2.0"; import GLib from "gi://GLib?version=2.0"; -import { KeysOf } from "./general.js"; -import { LoopStatus, PlaybackStatus } from "./enums/shell.js"; + +import { KeysOf } from "./misc.js"; +import { LoopStatus, PlaybackStatus } from "./enums/general.js"; type MethodResult = [T]; diff --git a/src/types/enums/general.ts b/src/types/enums/general.ts index 597da04..9ab2fbb 100644 --- a/src/types/enums/general.ts +++ b/src/types/enums/general.ts @@ -1,18 +1,28 @@ -// Types common to the extension and the preferences window - -import { Enum } from "../general.js"; +import { Enum } from "../misc.js"; +export const DBUS_IFACE_NAME = "org.freedesktop.DBus"; export const MPRIS_OBJECT_PATH = "/org/mpris/MediaPlayer2"; export const DBUS_OBJECT_PATH = "/org/freedesktop/DBus"; export const MPRIS_IFACE_NAME = "org.mpris.MediaPlayer2"; -export const MPRIS_PLAYER_IFACE_NAME = "org.mpris.MediaPlayer2.Player"; export const DBUS_PROPERTIES_IFACE_NAME = "org.freedesktop.DBus.Properties"; -export const DBUS_IFACE_NAME = "org.freedesktop.DBus"; +export const MPRIS_PLAYER_IFACE_NAME = "org.mpris.MediaPlayer2.Player"; -export const PanelElements = { - ICON: "Player icon", - LABEL: "Label", - CONTROLS: "Player controls", +export const PlaybackStatus = { + PLAYING: "Playing", + PAUSED: "Paused", + STOPPED: "Stopped", +} as const; + +export const LoopStatus = { + NONE: "None", + TRACK: "Track", + PLAYLIST: "Playlist", +} as const; + +export const ExtensionPositions = { + LEFT: "left", + CENTER: "center", + RIGHT: "right", } as const; export const LabelTypes = { @@ -23,29 +33,57 @@ export const LabelTypes = { TRACK_NUMBER: "Track Number", } as const; -export const ExtensionPositions = { - LEFT: "left", - CENTER: "center", - RIGHT: "right", +export const PanelElements = { + ICON: 0, + LABEL: 1, + CONTROLS: 2, } as const; export const MouseActions = { - NONE: "None", - PLAY_PAUSE: "Play/Pause", - PLAY: "Play", - PAUSE: "Pause", - NEXT_TRACK: "Next track", - PREVIOUS_TRACK: "Previous track", - VOLUME_UP: "Volume up", - VOLUME_DOWN: "Volume down", - TOGGLE_LOOP: "Toggle loop", - TOGGLE_SHUFFLE: "Toggle shuffle", - SHOW_POPUP_MENU: "Show popup menu", - RAISE_PLAYER: "Raise player", - QUIT_PLAYER: "Quit player", + NONE: 0, + PLAY_PAUSE: 1, + PLAY: 2, + PAUSE: 3, + NEXT_TRACK: 4, + PREVIOUS_TRACK: 5, + VOLUME_UP: 6, + VOLUME_DOWN: 7, + TOGGLE_LOOP: 8, + TOGGLE_SHUFFLE: 9, + SHOW_POPUP_MENU: 10, + RAISE_PLAYER: 11, + QUIT_PLAYER: 12, +} as const; + +export const WidgetFlags = { + PANEL_ICON: 1 << 0, + PANEL_LABEL: 1 << 1, + PANEL_CONTROLS_SEEK_BACKWARD: 1 << 2, + PANEL_CONTROLS_PREVIOUS: 1 << 3, + PANEL_CONTROLS_PLAYPAUSE: 1 << 4, + PANEL_CONTROLS_NEXT: 1 << 5, + PANEL_CONTROLS_SEEK_FORWARD: 1 << 6, + PANEL_CONTROLS: (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6), + PANEL: (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6), + PANEL_NO_REPLACE: 1 << 7, + MENU_PLAYERS: 1 << 8, + MENU_IMAGE: 1 << 9, + MENU_LABELS: 1 << 10, + MENU_SLIDER: 1 << 11, + MENU_CONTROLS_LOOP: 1 << 12, + MENU_CONTROLS_PREV: 1 << 13, + MENU_CONTROLS_PLAYPAUSE: 1 << 14, + MENU_CONTROLS_NEXT: 1 << 15, + MENU_CONTROLS_SHUFFLE: 1 << 16, + MENU_CONTROLS: (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15) | (1 << 16), + MENU: (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15) | (1 << 16), + ALL: ~(-1 << 17), } as const; export type PanelElements = Enum; export type LabelTypes = Enum; export type ExtensionPositions = Enum; export type MouseActions = Enum; +export type LoopStatus = Enum; +export type PlaybackStatus = Enum; +export type WidgetFlags = Enum; diff --git a/src/types/enums/shell.ts b/src/types/enums/shell_only.ts similarity index 70% rename from src/types/enums/shell.ts rename to src/types/enums/shell_only.ts index e83d651..35638bf 100644 --- a/src/types/enums/shell.ts +++ b/src/types/enums/shell_only.ts @@ -1,19 +1,5 @@ -// Types only used in the extension. Do not import this file in preferences because Clutter is not available there. - import Clutter from "gi://Clutter?version=13"; -import { Enum } from "../general.js"; - -export const PlaybackStatus = { - PLAYING: "Playing", - PAUSED: "Paused", - STOPPED: "Stopped", -} as const; - -export const LoopStatus = { - NONE: "None", - TRACK: "Track", - PLAYLIST: "Playlist", -} as const; +import { Enum } from "../misc.js"; export const ControlIconOptions = { LOOP_NONE: { @@ -146,34 +132,6 @@ export const ControlIconOptions = { }, } as const; -export const WidgetFlags = { - PANEL_ICON: 1 << 0, - PANEL_LABEL: 1 << 1, - PANEL_CONTROLS_SEEK_BACKWARD: 1 << 2, - PANEL_CONTROLS_PREVIOUS: 1 << 3, - PANEL_CONTROLS_PLAYPAUSE: 1 << 4, - PANEL_CONTROLS_NEXT: 1 << 5, - PANEL_CONTROLS_SEEK_FORWARD: 1 << 6, - PANEL_CONTROLS: (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6), - PANEL: (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6), - PANEL_NO_REPLACE: 1 << 7, - MENU_PLAYERS: 1 << 8, - MENU_IMAGE: 1 << 9, - MENU_LABELS: 1 << 10, - MENU_SLIDER: 1 << 11, - MENU_CONTROLS_LOOP: 1 << 12, - MENU_CONTROLS_PREV: 1 << 13, - MENU_CONTROLS_PLAYPAUSE: 1 << 14, - MENU_CONTROLS_NEXT: 1 << 15, - MENU_CONTROLS_SHUFFLE: 1 << 16, - MENU_CONTROLS: (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15) | (1 << 16), - MENU: (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15) | (1 << 16), - ALL: ~(-1 << 17), -} as const; - -export type LoopStatus = Enum; -export type PlaybackStatus = Enum; -export type WidgetFlags = Enum; export type ControlIconOptions = Enum; export type MenuControlIconOptions = (typeof ControlIconOptions)[ | "LOOP_NONE" diff --git a/src/types/general.ts b/src/types/misc.ts similarity index 100% rename from src/types/general.ts rename to src/types/misc.ts diff --git a/src/utils/initResource.ts b/src/utils/init_resource.ts similarity index 100% rename from src/utils/initResource.ts rename to src/utils/init_resource.ts diff --git a/src/utils/prefs.ts b/src/utils/prefs_only.ts similarity index 100% rename from src/utils/prefs.ts rename to src/utils/prefs_only.ts diff --git a/src/utils/shell.ts b/src/utils/shell_only.ts similarity index 100% rename from src/utils/shell.ts rename to src/utils/shell_only.ts