Skip to main content

WindowsAttributes

Struct WindowsAttributes 

Source
pub struct WindowsAttributes { /* private fields */ }
Expand description

Attributes used on Windows.

Implementations§

Source§

impl WindowsAttributes

Source

pub fn new() -> Self

Creates the default attribute set.

Source

pub fn new_without_app_manifest() -> Self

Creates the default attribute set without the default app manifest.

Source

pub fn window_icon_path<P: AsRef<Path>>(self, window_icon_path: P) -> Self

Sets the icon to use on the window. Currently only used on Windows. It must be in ico format. Defaults to icons/icon.ico.

Source

pub fn app_manifest<S: AsRef<str>>(self, manifest: S) -> Self

Sets the [application manifest] to be included with the application on Windows.

Defaults to:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
    </dependentAssembly>
  </dependency>
</assembly>
§Warning

if you are using tauri’s dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:

 <dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.Windows.Common-Controls"
       version="6.0.0.0"
       processorArchitecture="*"
       publicKeyToken="6595b64144ccf1df"
       language="*"
     />
   </dependentAssembly>
 </dependency>
§Example

The following manifest will brand the exe as requesting administrator privileges. Thus, every time it is executed, a Windows UAC dialog will appear.

let mut windows = tauri_build::WindowsAttributes::new();
windows = windows.app_manifest(r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
          <requestedPrivileges>
              <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>
      </security>
  </trustInfo>
</assembly>
"#);
let attrs =  tauri_build::Attributes::new().windows_attributes(windows);
tauri_build::try_build(attrs).expect("failed to run build script");

Note that you can move the manifest contents to a separate file and use include_str!("manifest.xml") instead of the inline string.

Source

pub fn append_rc_content<S: Into<String>>(self, content: S) -> Self

Append additional .rc content to the generated resource file on Windows. This can be called multiple times to append multiple contents.

Trait Implementations§

Source§

impl Debug for WindowsAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WindowsAttributes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T