File tree Expand file tree Collapse file tree 7 files changed +51
-0
lines changed
Actions/Content/Background Expand file tree Collapse file tree 7 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (c) 2024 Files Community
2+ // Licensed under the MIT License. See the LICENSE.
3+
4+ namespace Files . App . Actions
5+ {
6+ internal sealed class SetAsAppBackgroundAction : BaseSetAsAction
7+ {
8+ private IAppearanceSettingsService AppearanceSettingsService { get ; } = Ioc . Default . GetRequiredService < IAppearanceSettingsService > ( ) ;
9+
10+ public override string Label
11+ => "SetAsAppBackground" . GetLocalizedResource ( ) ;
12+
13+ public override string Description
14+ => "SetAsAppBackgroundDescription" . GetLocalizedResource ( ) ;
15+
16+ public override RichGlyph Glyph
17+ => new ( "\uE91B " ) ;
18+
19+ public override bool IsExecutable =>
20+ base . IsExecutable &&
21+ context . SelectedItem is not null ;
22+
23+ public override Task ExecuteAsync ( )
24+ {
25+ if ( context . SelectedItem is not null )
26+ AppearanceSettingsService . AppThemeBackgroundImageSource = context . SelectedItem . ItemPath ;
27+
28+ return Task . CompletedTask ;
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ public enum CommandCodes
7171 SetAsWallpaperBackground ,
7272 SetAsSlideshowBackground ,
7373 SetAsLockscreenBackground ,
74+ SetAsAppBackground ,
7475
7576 // Install
7677 InstallFont ,
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ public IRichCommand this[HotKey hotKey]
7676 public IRichCommand SetAsWallpaperBackground => commands [ CommandCodes . SetAsWallpaperBackground ] ;
7777 public IRichCommand SetAsSlideshowBackground => commands [ CommandCodes . SetAsSlideshowBackground ] ;
7878 public IRichCommand SetAsLockscreenBackground => commands [ CommandCodes . SetAsLockscreenBackground ] ;
79+ public IRichCommand SetAsAppBackground => commands [ CommandCodes . SetAsAppBackground ] ;
7980 public IRichCommand CopyItem => commands [ CommandCodes . CopyItem ] ;
8081 public IRichCommand CopyPath => commands [ CommandCodes . CopyPath ] ;
8182 public IRichCommand CopyPathWithQuotes => commands [ CommandCodes . CopyPathWithQuotes ] ;
@@ -249,6 +250,7 @@ public IEnumerator<IRichCommand> GetEnumerator() =>
249250 [ CommandCodes . SetAsWallpaperBackground ] = new SetAsWallpaperBackgroundAction ( ) ,
250251 [ CommandCodes . SetAsSlideshowBackground ] = new SetAsSlideshowBackgroundAction ( ) ,
251252 [ CommandCodes . SetAsLockscreenBackground ] = new SetAsLockscreenBackgroundAction ( ) ,
253+ [ CommandCodes . SetAsAppBackground ] = new SetAsAppBackgroundAction ( ) ,
252254 [ CommandCodes . CopyItem ] = new CopyItemAction ( ) ,
253255 [ CommandCodes . CopyPath ] = new CopyPathAction ( ) ,
254256 [ CommandCodes . CopyPathWithQuotes ] = new CopyPathWithQuotesAction ( ) ,
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
6767 IRichCommand SetAsWallpaperBackground { get ; }
6868 IRichCommand SetAsSlideshowBackground { get ; }
6969 IRichCommand SetAsLockscreenBackground { get ; }
70+ IRichCommand SetAsAppBackground { get ; }
7071
7172 IRichCommand InstallFont { get ; }
7273 IRichCommand InstallInfDriver { get ; }
Original file line number Diff line number Diff line change @@ -411,6 +411,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
411411 new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsWallpaperBackground ) . Build ( ) ,
412412 new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsLockscreenBackground ) . Build ( ) ,
413413 new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsSlideshowBackground ) . Build ( ) ,
414+ new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsAppBackground ) . Build ( ) ,
414415 ]
415416 } ,
416417 new ContextMenuFlyoutItemViewModelBuilder ( Commands . RotateLeft )
Original file line number Diff line number Diff line change 339339 <data name =" SetAsLockscreen" xml : space =" preserve" >
340340 <value >Set as lockscreen background</value >
341341 </data >
342+ <data name =" SetAsAppBackground" xml : space =" preserve" >
343+ <value >Set as app background</value >
344+ </data >
342345 <data name =" AccessDeniedDeleteDialog.Text" xml : space =" preserve" >
343346 <value >We weren't able to delete this item</value >
344347 </data >
24632466 <data name =" SetAsLockscreenBackgroundDescription" xml : space =" preserve" >
24642467 <value >Set selected picture as lockscreen background</value >
24652468 </data >
2469+ <data name =" SetAsAppBackgroundDescription" xml : space =" preserve" >
2470+ <value >Set selected picture as the app background</value >
2471+ </data >
24662472 <data name =" InstallFontDescription" xml : space =" preserve" >
24672473 <value >Install selected font(s)</value >
24682474 </data >
Original file line number Diff line number Diff line change 384384 <FontIcon Glyph =" {x:Bind Commands.SetAsLockscreenBackground.Glyph.BaseGlyph}" />
385385 </MenuFlyoutItem .Icon>
386386 </MenuFlyoutItem >
387+ <MenuFlyoutItem
388+ x:Name=" SetAsAppBackgroundFlyoutItem"
389+ Command=" {x:Bind Commands.SetAsAppBackground}"
390+ KeyboardAcceleratorTextOverride=" {x:Bind Commands.SetAsAppBackground.HotKeyText, Mode=OneWay}"
391+ Text=" {helpers:ResourceString Name=Application}" >
392+ <MenuFlyoutItem .Icon>
393+ <FontIcon Glyph =" {x:Bind Commands.SetAsAppBackground.Glyph.BaseGlyph}" />
394+ </MenuFlyoutItem .Icon>
395+ </MenuFlyoutItem >
387396 </MenuFlyout >
388397 </AppBarButton .Flyout>
389398
You can’t perform that action at this time.
0 commit comments