File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use anyhow:: Result ;
22use windows:: core:: w;
33use windows:: Win32 :: Foundation :: HWND ;
4- use windows:: Win32 :: UI :: WindowsAndMessaging :: {
5- FindWindowW , SendMessageTimeoutW , SMTO_ABORTIFHUNG ,
6- } ;
4+ use windows:: Win32 :: UI :: WindowsAndMessaging :: { FindWindowW , SendMessageTimeoutW , SMTO_ABORTIFHUNG } ;
75
86const WM_COMMAND : u32 = 0x0111 ;
97const SHCMD_TOGGLE_DESKTOP_ICONS : u32 = 0x7402 ;
@@ -90,8 +88,7 @@ pub fn are_icons_visible() -> bool {
9088 return true ;
9189 }
9290
93- let visible =
94- windows:: Win32 :: UI :: WindowsAndMessaging :: IsWindowVisible ( listview) . as_bool ( ) ;
91+ let visible = windows:: Win32 :: UI :: WindowsAndMessaging :: IsWindowVisible ( listview) . as_bool ( ) ;
9592 crate :: dlog!( "are_icons_visible: SysListView32 visible = {visible}" ) ;
9693 visible
9794 }
Original file line number Diff line number Diff line change @@ -60,8 +60,14 @@ pub fn is_taskbar_visible() -> bool {
6060/// Hide the taskbar (main + all secondary monitors).
6161pub fn hide_taskbar ( ) -> Result < ( ) > {
6262 let primary = get_taskbar ( ) ;
63- crate :: dlog!( "hide_taskbar: primary HWND is null = {}" , primary. 0 . is_null( ) ) ;
64- anyhow:: ensure!( !primary. 0 . is_null( ) , "Could not find taskbar window (Shell_TrayWnd)" ) ;
63+ crate :: dlog!(
64+ "hide_taskbar: primary HWND is null = {}" ,
65+ primary. 0 . is_null( )
66+ ) ;
67+ anyhow:: ensure!(
68+ !primary. 0 . is_null( ) ,
69+ "Could not find taskbar window (Shell_TrayWnd)"
70+ ) ;
6571
6672 unsafe {
6773 let r = ShowWindow ( primary, SW_HIDE ) ;
@@ -76,8 +82,14 @@ pub fn hide_taskbar() -> Result<()> {
7682/// Show the taskbar (main + all secondary monitors).
7783pub fn show_taskbar ( ) -> Result < ( ) > {
7884 let primary = get_taskbar ( ) ;
79- crate :: dlog!( "show_taskbar: primary HWND is null = {}" , primary. 0 . is_null( ) ) ;
80- anyhow:: ensure!( !primary. 0 . is_null( ) , "Could not find taskbar window (Shell_TrayWnd)" ) ;
85+ crate :: dlog!(
86+ "show_taskbar: primary HWND is null = {}" ,
87+ primary. 0 . is_null( )
88+ ) ;
89+ anyhow:: ensure!(
90+ !primary. 0 . is_null( ) ,
91+ "Could not find taskbar window (Shell_TrayWnd)"
92+ ) ;
8193
8294 unsafe {
8395 let r = ShowWindow ( primary, SW_SHOW ) ;
You can’t perform that action at this time.
0 commit comments