Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to disable favicon progress circle #1825

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export default class App extends Mixins(BaseMixin, ThemeMixin) {
}
}

get progressAsFavicon() {
return this.$store.state.gui.uiSettings.progressAsFavicon
}

@Watch('language')
async languageChanged(newVal: string): Promise<void> {
await setAndLoadLocale(newVal)
Expand Down Expand Up @@ -235,7 +239,7 @@ export default class App extends Mixins(BaseMixin, ThemeMixin) {
const favicon32: HTMLLinkElement | null = document.querySelector("link[rel*='icon'][sizes='32x32']")

if (favicon16 && favicon32) {
if (this.printerIsPrinting) {
if (this.progressAsFavicon && this.printerIsPrinting) {
let faviconSize = 64

let canvas = document.createElement('canvas')
Expand Down Expand Up @@ -304,6 +308,11 @@ export default class App extends Mixins(BaseMixin, ThemeMixin) {
this.drawFavicon(this.print_percent)
}

@Watch('progressAsFavicon')
progressAsFaviconChanged(): void {
this.drawFavicon(this.print_percent)
}

@Watch('logoColor')
logoColorChanged(): void {
this.drawFavicon(this.print_percent)
Expand Down
15 changes: 15 additions & 0 deletions src/components/settings/SettingsUiSettingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@
<v-switch v-model="displayCancelPrint" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.ProgressAsFavicon')"
:sub-title="$t('Settings.UiSettingsTab.ProgressAsFaviconDescription')"
:dynamic-slot-width="true">
<v-switch v-model="progressAsFavicon" hide-details class="mt-0" />
</settings-row>
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.UiSettingsTab.LockSliders')"
:sub-title="$t('Settings.UiSettingsTab.LockSlidersDescription')"
Expand Down Expand Up @@ -340,6 +347,14 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.displayCancelPrint', value: newVal })
}

get progressAsFavicon() {
return this.$store.state.gui.uiSettings.progressAsFavicon
}

set progressAsFavicon(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.progressAsFavicon', value: newVal })
}

get confirmOnEmergencyStop() {
return this.$store.state.gui.uiSettings.confirmOnEmergencyStop
}
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,8 @@
"PowerDeviceName": "Printer power device",
"PowerDeviceNameDescription": "Select which Moonraker power device should be used to power on the printer.",
"Primary": "Primary",
"ProgressAsFavicon": "Show progress as favicon",
"ProgressAsFaviconDescription": "Change the Mainsail logo favicon to a progress circle.",
"ScrewsTiltAdjustDialog": "Screws Tilt Adjust Dialog",
"ScrewsTiltAdjustDialogDescription": "Display helper dialog for SCREWS_TILT_CALCULATE.",
"TempchartHeight": "Height Temperature Chart",
Expand Down
1 change: 1 addition & 0 deletions src/store/gui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const getDefaultState = (): GuiState => {
navigationStyle: 'iconsAndText',
defaultNavigationStateSetting: 'alwaysOpen',
powerDeviceName: null,
progressAsFavicon: true,
hideSaveConfigForBedMash: false,
disableFanAnimation: false,
boolManualProbeDialog: true,
Expand Down
1 change: 1 addition & 0 deletions src/store/gui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export interface GuiState {
navigationStyle: 'iconsAndText' | 'iconsOnly'
defaultNavigationStateSetting: 'alwaysOpen' | 'alwaysClosed' | 'lastState'
powerDeviceName: string | null
progressAsFavicon: boolean
hideSaveConfigForBedMash: boolean
disableFanAnimation: boolean
boolManualProbeDialog: boolean
Expand Down