tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[feat] get the size of the taskbar

Open mondy opened this issue 1 year ago • 3 comments

Describe the problem

I would like to get the size and location of the taskbar. I'd like to see cross-platform support (Windows, Mac, Linux). Using this, we would like to create a function that will pull the window to the edge when it comes to the edge of the screen.

Describe the solution you'd like

I think adding taskbar position and size information to the Monitor class would be a good idea, but there may be a better way.

Alternatives considered

I asked a question in the discussion and the following method seems to solve the problem in Windows. https://github.com/tauri-apps/tauri/discussions/1336#discussioncomment-5474834

Additional context

No response

mondy avatar Mar 30 '23 13:03 mondy

Kinda hard to ensure buttons for a always-on-top interface land above the taskbar without this feature. Hopefully it gets implemented.

Doing some quick research to assist:

Mac Solution: https://developer.apple.com/documentation/appkit/nsscreen/1388369-visibleframe?language=objc Source: https://github.com/rust-windowing/winit/issues/2494#issuecomment-1251524206

X11: _NET_WORKAREA is a option for single monitors. https://specifications.freedesktop.org/wm-spec/1.4/ar01s03.html#idm139704063854592 Source: https://stackoverflow.com/a/26524483

But it apparently falls down for multi-monitor setups. Source: https://stackoverflow.com/a/18678545

09silverware avatar May 07 '23 11:05 09silverware

Quick and dirty solution. Move a transparent, decoration-less window to the screen you want. Create it at any size, but not maximized (to avoid the transparency issues in TAO atm). In Rust, during setup, move to the monitor you want to measure, maximize, read size and position. Then you can compare this against the monitor's size and position.

09silverware avatar May 07 '23 11:05 09silverware

@09silverware But how can you maximize to fill area without taskbar? Because, if, you call .maximize() in Rust and then measure the size, it fills entire screen.

Andrew-web-coder avatar Feb 01 '24 16:02 Andrew-web-coder