Skip to content

Commit

Permalink
ytmdesktop#276 Toggle hardware acceleration
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerluiz committed Aug 2, 2020
1 parent 47e3480 commit 409acdc
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 3 deletions.
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ if (isMac()) {
Menu.setApplicationMenu(menu)
}

if (settingsProvider.get('settings-disable-hardware-acceleration')) {
app.disableHardwareAcceleration()
}

/* Functions ============================================================================= */
function createWindow() {
if (isMac() || isWindows()) {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"MEDIA_CONTROL_THUMBS_UP": "Thumbs Up",
"LABEL_CHANGELOG": "What's new",
"MEDIA_CONTROL_VOLUME_UP": "Increase volume",
"MEDIA_CONTROL_VOLUME_DOWN": "Decrease volume"
"MEDIA_CONTROL_VOLUME_DOWN": "Decrease volume",
"LABEL_SETTINGS_TAB_GENERAL_DISABLE_HARDWARE_ACCELERATION": "Disable hardware acceleration"
}
3 changes: 2 additions & 1 deletion src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"MEDIA_CONTROL_THUMBS_UP": "Curtir",
"LABEL_CHANGELOG": "O que há de novo",
"MEDIA_CONTROL_VOLUME_UP": "Aumentar volume",
"MEDIA_CONTROL_VOLUME_DOWN": "Diminuir volume"
"MEDIA_CONTROL_VOLUME_DOWN": "Diminuir volume",
"LABEL_SETTINGS_TAB_GENERAL_DISABLE_HARDWARE_ACCELERATION": "Desabilitar aceleração de hardware"
}
3 changes: 2 additions & 1 deletion src/locales/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@
"MEDIA_CONTROL_THUMBS_UP": "Thumbs Up",
"LABEL_CHANGELOG": "What's new",
"MEDIA_CONTROL_VOLUME_UP": "Increase volume",
"MEDIA_CONTROL_VOLUME_DOWN": "Decrease volume"
"MEDIA_CONTROL_VOLUME_DOWN": "Decrease volume",
"LABEL_SETTINGS_TAB_GENERAL_DISABLE_HARDWARE_ACCELERATION": "Disable hardware acceleration"
}
19 changes: 19 additions & 0 deletions src/pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,25 @@
</td>
</tr>

<tr>
<td>
<span
i18n="i18n_LABEL_SETTINGS_TAB_GENERAL_DISABLE_HARDWARE_ACCELERATION"
></span>
</td>
<td class="right">
<div class="switch">
<label>
<input
type="checkbox"
id="settings-disable-hardware-acceleration"
/>
<span class="lever"></span>
</label>
</div>
</td>
</tr>

<tr class="macos-specific">
<td colspan="2">
<div
Expand Down
5 changes: 5 additions & 0 deletions src/pages/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ document.addEventListener('DOMContentLoaded', function () {
})
initElement('settings-rainmeter-web-now-playing', 'click')
initElement('settings-enable-double-tapping-show-hide', 'click')
initElement(
'settings-disable-hardware-acceleration',
'click',
showRelaunchButton
)

initElement('settings-miniplayer-always-top', 'click')
initElement('settings-miniplayer-always-show-controls', 'click')
Expand Down
5 changes: 5 additions & 0 deletions src/utils/defaultSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ settingsProvider.setInitialValue('discord-presence-settings', {
time: true,
hideIdle: true,
})

settingsProvider.setInitialValue(
'settings-disable-hardware-acceleration',
false
)

0 comments on commit 409acdc

Please sign in to comment.