Full Code of tauri-apps/window-shadows for AI

dev 48fa81bbd955 cached
27 files
31.4 KB
8.7k tokens
7 symbols
1 requests
Download .txt
Repository: tauri-apps/window-shadows
Branch: dev
Commit: 48fa81bbd955
Files: 27
Total size: 31.4 KB

Directory structure:
gitextract_1gvi5f2t/

├── .changes/
│   ├── config.json
│   └── readme.md
├── .github/
│   └── workflows/
│       ├── audit.yml
│       ├── clippy-fmt.yml
│       ├── covector-status.yml
│       ├── covector-version-or-publish.yml
│       └── test.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── LICENSE.spdx
├── README.md
├── examples/
│   ├── tao.rs
│   ├── tauri/
│   │   ├── .gitignore
│   │   ├── package.json
│   │   ├── public/
│   │   │   └── index.html
│   │   └── src-tauri/
│   │       ├── .gitignore
│   │       ├── Cargo.toml
│   │       ├── build.rs
│   │       ├── icons/
│   │       │   └── icon.icns
│   │       ├── src/
│   │       │   └── main.rs
│   │       └── tauri.conf.json
│   └── winit.rs
├── renovate.json
└── src/
    └── lib.rs

================================================
FILE CONTENTS
================================================

================================================
FILE: .changes/config.json
================================================
{
  "gitSiteUrl": "https://github.com/tauri-apps/window-shadows/",
  "pkgManagers": {
    "rust": {
      "version": true,
      "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
      "publish": [
        {
          "command": "cargo package --allow-dirty",
          "dryRunCommand": true
        },
        {
          "command": "echo \"# Cargo Publish\"",
          "dryRunCommand": true,
          "pipe": true
        },
        {
          "command": "echo \"\\`\\`\\`\"",
          "dryRunCommand": true,
          "pipe": true
        },
        {
          "command": "cargo publish --no-verify",
          "dryRunCommand": "cargo publish --no-verify --dry-run --allow-dirty",
          "pipe": true
        },
        {
          "command": "echo \"\\`\\`\\`\"",
          "dryRunCommand": true,
          "pipe": true
        }
      ]
    }
  },
  "packages": {
    "window-shadows": {
      "path": ".",
      "manager": "rust"
    }
  }
}


================================================
FILE: .changes/readme.md
================================================
# Changes

##### via https://github.com/jbolda/covector

As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.

When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.

Use the following format:

```md
---
"package-a": patch
"package-b": minor
---

Change summary goes here

```

Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.

Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).

Given a version number MAJOR.MINOR.PATCH, increment the:

- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).


================================================
FILE: .github/workflows/audit.yml
================================================
# Copyright 2022-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: audit

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'
  push:
    branches:
      - dev
    paths:
      - 'Cargo.lock'
      - 'Cargo.toml'
  pull_request:
    paths:
      - 'Cargo.lock'
      - 'Cargo.toml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: rustsec/audit-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

================================================
FILE: .github/workflows/clippy-fmt.yml
================================================
# Copyright 2022-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: clippy & fmt

on:
  push:
    branches:
      - dev
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  clippy:
    strategy:
      fail-fast: false
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.platform }}

    steps:
      - uses: actions/checkout@v4
      - name: install system deps
        if: matrix.platform == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install -y libgtk-3-dev

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy

      - run: cargo clippy --all-targets --all-features -- -D warnings

  fmt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - run: cargo fmt --all -- --check


================================================
FILE: .github/workflows/covector-status.yml
================================================
name: covector status
on: [pull_request]

jobs:
  covector:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: covector status
        uses: jbolda/covector/packages/action@covector-v0
        id: covector
        with:
          command: 'status'


================================================
FILE: .github/workflows/covector-version-or-publish.yml
================================================
name: covector version or publish

on:
  push:
    branches:
      - dev

jobs:
  version-or-publish:
    runs-on: ubuntu-latest
    timeout-minutes: 65
    outputs:
      change: ${{ steps.covector.outputs.change }}
      commandRan: ${{ steps.covector.outputs.commandRan }}
      successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

    steps:
      - uses: actions/checkout@v4

      - name: cargo login
        run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}
        
      - name: git config
        run: |
          git config --global user.name "${{ github.event.pusher.name }}"
          git config --global user.email "${{ github.event.pusher.email }}"

      - name: covector version or publish (publish when no change files present)
        uses: jbolda/covector/packages/action@covector-v0
        id: covector
        env:
          CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          command: "version-or-publish"
          createRelease: true

      - name: Create Pull Request With Versions Bumped
        id: cpr
        uses: tauri-apps/create-pull-request@v3
        if: steps.covector.outputs.commandRan == 'version'
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          title: Apply Version Updates From Current Changes
          commit-message: 'apply version updates'
          labels: 'version updates'
          branch: 'release'
          body: ${{ steps.covector.outputs.change }}


================================================
FILE: .github/workflows/test.yml
================================================
name: test

on:
  push:
    branches:
      - dev
  pull_request:

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]

    runs-on: ${{ matrix.platform }}

    steps:
      - uses: actions/checkout@v4
      - name: install system deps
        if: matrix.platform == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install -y libgtk-3-dev

      - uses: dtolnay/rust-toolchain@stable
      - run: cargo test


================================================
FILE: .gitignore
================================================
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

/target
Cargo.lock


================================================
FILE: CHANGELOG.md
================================================
# Changelog

## \[0.2.2]

- [`791c43d`](https://github.com/tauri-apps/window-shadows/commit/791c43def0e802a47a7b163e7bc612b3a0faf794) Update `windows-sys` version to `0.48`

## \[0.2.1]

- Update docs to include conditional compliation flags.
  - [a9db8cf](https://github.com/tauri-apps/window-shadows/commit/a9db8cf57317ed4383a094daef33e0cc9875b702) chore: update docs on 2022-12-29

## \[0.2.0]

- Update `raw-window-handle` dependency to 0.5
  - [26f0c3c](https://github.com/tauri-apps/window-shadows/commit/26f0c3c3c7e8d2ab47009987ae4027b67b891f40) chore(deps): update raw-window-handle to 0.5 on 2022-07-25

## \[0.1.3]

- Update documentation about macOS transparent windows.
  - [196fea6](https://github.com/tauri-apps/window-shadows/commit/196fea6d8059c1d3d73837c842bb89f6138dbad7) chore: update crate cos on 2022-03-29
  - [5ec769e](https://github.com/tauri-apps/window-shadows/commit/5ec769e6a14c25ed824604020ab3d2d1bf21e413) publish new versions ([#17](https://github.com/tauri-apps/window-shadows/pull/17)) on 2022-03-29
  - [918b3dd](https://github.com/tauri-apps/window-shadows/commit/918b3ddc0a7359ad540067ef1ec6f6cbe7052c55) docs: update docs for macOS transparent windows on 2022-05-06
- Add screenshots
  - [c908533](https://github.com/tauri-apps/window-shadows/commit/c9085333e1867f840509ffdc1cab869dd06b768c) chore: add screenshots ([#24](https://github.com/tauri-apps/window-shadows/pull/24)) on 2022-05-23

## \[0.1.2]

- Fix docs failing because of a wrong example.
  - [ca3b8a1](https://github.com/tauri-apps/window-shadows/commit/ca3b8a11f6b9bf456f2372684bd4fabef74504a0) fix: fix docs on 2022-03-29

## \[0.1.1]

- Update crate docs.
  - [196fea6](https://github.com/tauri-apps/window-shadows/commit/196fea6d8059c1d3d73837c842bb89f6138dbad7) chore: update crate cos on 2022-03-29

## \[0.1.0]

- Initial Release.
  - [4489c8f](https://github.com/tauri-apps/window-shadows/commit/4489c8fadc6a04c0b83d5e9dbf45cf006c4266af) chroe: update `README.md` on 2022-03-05
  - [bd80ba3](https://github.com/tauri-apps/window-shadows/commit/bd80ba3849d3f27eb8e3e445f54931b5b522d9d3) chore: bump changefile to minor on 2022-03-05


================================================
FILE: Cargo.toml
================================================
[package]
name = "window-shadows"
description = "Add native shadows to your windows."
authors = [ "Tauri Programme within The Commons Conservancy" ]
version = "0.2.2"
edition = "2021"
license = "Apache-2.0 OR MIT"
readme = "README.md"
repository = "https://github.com/tauri-apps/tauri-plugin-shadows"
documentation = "https://docs.rs/tauri-plugin-shadows"
keywords = [ "shadows", "windowing", "gui" ]
categories = [ "gui" ]

[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
targets = [ "x86_64-apple-darwin", "x86_64-pc-windows-msvc" ]

[dependencies]
raw-window-handle = "0.5"

[dev-dependencies]
tao = { version = "0.25", features = ["rwh_05"] }
winit = {version = "0.29", default-features = false, features = ["x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita", "rwh_05"] }

[target."cfg(target_os = \"windows\")".dependencies]
windows-sys = { version = "0.52.0", features = [
  "Win32_Foundation",
  "Win32_Graphics_Dwm",
  "Win32_UI_Controls"
] }

[target."cfg(target_os = \"macos\")".dependencies]
cocoa = "0.25"
objc = "0.2"


================================================
FILE: LICENSE-APACHE
================================================
                              Apache License
                        Version 2.0, January 2004
                     http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

   "License" shall mean the terms and conditions for use, reproduction,
   and distribution as defined by Sections 1 through 9 of this document.

   "Licensor" shall mean the copyright owner or entity authorized by
   the copyright owner that is granting the License.

   "Legal Entity" shall mean the union of the acting entity and all
   other entities that control, are controlled by, or are under common
   control with that entity. For the purposes of this definition,
   "control" means (i) the power, direct or indirect, to cause the
   direction or management of such entity, whether by contract or
   otherwise, or (ii) ownership of fifty percent (50%) or more of the
   outstanding shares, or (iii) beneficial ownership of such entity.

   "You" (or "Your") shall mean an individual or Legal Entity
   exercising permissions granted by this License.

   "Source" form shall mean the preferred form for making modifications,
   including but not limited to software source code, documentation
   source, and configuration files.

   "Object" form shall mean any form resulting from mechanical
   transformation or translation of a Source form, including but
   not limited to compiled object code, generated documentation,
   and conversions to other media types.

   "Work" shall mean the work of authorship, whether in Source or
   Object form, made available under the License, as indicated by a
   copyright notice that is included in or attached to the work
   (an example is provided in the Appendix below).

   "Derivative Works" shall mean any work, whether in Source or Object
   form, that is based on (or derived from) the Work and for which the
   editorial revisions, annotations, elaborations, or other modifications
   represent, as a whole, an original work of authorship. For the purposes
   of this License, Derivative Works shall not include works that remain
   separable from, or merely link (or bind by name) to the interfaces of,
   the Work and Derivative Works thereof.

   "Contribution" shall mean any work of authorship, including
   the original version of the Work and any modifications or additions
   to that Work or Derivative Works thereof, that is intentionally
   submitted to Licensor for inclusion in the Work by the copyright owner
   or by an individual or Legal Entity authorized to submit on behalf of
   the copyright owner. For the purposes of this definition, "submitted"
   means any form of electronic, verbal, or written communication sent
   to the Licensor or its representatives, including but not limited to
   communication on electronic mailing lists, source code control systems,
   and issue tracking systems that are managed by, or on behalf of, the
   Licensor for the purpose of discussing and improving the Work, but
   excluding communication that is conspicuously marked or otherwise
   designated in writing by the copyright owner as "Not a Contribution."

   "Contributor" shall mean Licensor and any individual or Legal Entity
   on behalf of whom a Contribution has been received by Licensor and
   subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   copyright license to reproduce, prepare Derivative Works of,
   publicly display, publicly perform, sublicense, and distribute the
   Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   (except as stated in this section) patent license to make, have made,
   use, offer to sell, sell, import, and otherwise transfer the Work,
   where such license applies only to those patent claims licensable
   by such Contributor that are necessarily infringed by their
   Contribution(s) alone or by combination of their Contribution(s)
   with the Work to which such Contribution(s) was submitted. If You
   institute patent litigation against any entity (including a
   cross-claim or counterclaim in a lawsuit) alleging that the Work
   or a Contribution incorporated within the Work constitutes direct
   or contributory patent infringement, then any patent licenses
   granted to You under this License for that Work shall terminate
   as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
   Work or Derivative Works thereof in any medium, with or without
   modifications, and in Source or Object form, provided that You
   meet the following conditions:

   (a) You must give any other recipients of the Work or
       Derivative Works a copy of this License; and

   (b) You must cause any modified files to carry prominent notices
       stating that You changed the files; and

   (c) You must retain, in the Source form of any Derivative Works
       that You distribute, all copyright, patent, trademark, and
       attribution notices from the Source form of the Work,
       excluding those notices that do not pertain to any part of
       the Derivative Works; and

   (d) If the Work includes a "NOTICE" text file as part of its
       distribution, then any Derivative Works that You distribute must
       include a readable copy of the attribution notices contained
       within such NOTICE file, excluding those notices that do not
       pertain to any part of the Derivative Works, in at least one
       of the following places: within a NOTICE text file distributed
       as part of the Derivative Works; within the Source form or
       documentation, if provided along with the Derivative Works; or,
       within a display generated by the Derivative Works, if and
       wherever such third-party notices normally appear. The contents
       of the NOTICE file are for informational purposes only and
       do not modify the License. You may add Your own attribution
       notices within Derivative Works that You distribute, alongside
       or as an addendum to the NOTICE text from the Work, provided
       that such additional attribution notices cannot be construed
       as modifying the License.

   You may add Your own copyright statement to Your modifications and
   may provide additional or different license terms and conditions
   for use, reproduction, or distribution of Your modifications, or
   for any such Derivative Works as a whole, provided Your use,
   reproduction, and distribution of the Work otherwise complies with
   the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
   names, trademarks, service marks, or product names of the Licensor,
   except as required for reasonable and customary use in describing the
   origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
   agreed to in writing, Licensor provides the Work (and each
   Contributor provides its Contributions) on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied, including, without limitation, any warranties or conditions
   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
   PARTICULAR PURPOSE. You are solely responsible for determining the
   appropriateness of using or redistributing the Work and assume any
   risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
   whether in tort (including negligence), contract, or otherwise,
   unless required by applicable law (such as deliberate and grossly
   negligent acts) or agreed to in writing, shall any Contributor be
   liable to You for damages, including any direct, indirect, special,
   incidental, or consequential damages of any character arising as a
   result of this License or out of the use or inability to use the
   Work (including but not limited to damages for loss of goodwill,
   work stoppage, computer failure or malfunction, or any and all
   other commercial damages or losses), even if such Contributor
   has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
   the Work or Derivative Works thereof, You may choose to offer,
   and charge a fee for, acceptance of support, warranty, indemnity,
   or other liability obligations and/or rights consistent with this
   License. However, in accepting such obligations, You may act only
   on Your own behalf and on Your sole responsibility, not on behalf
   of any other Contributor, and only if You agree to indemnify,
   defend, and hold each Contributor harmless for any liability
   incurred by, or claims asserted against, such Contributor by reason
   of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

   To apply the Apache License to your work, attach the following
   boilerplate notice, with the fields enclosed by brackets "[]"
   replaced with your own identifying information. (Don't include
   the brackets!)  The text should be enclosed in the appropriate
   comment syntax for the file format. We also recommend that a
   file or class name and description of purpose be included on the
   same "printed page" as the copyright notice for easier
   identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


================================================
FILE: LICENSE-MIT
================================================
MIT License

Copyright (c) 2020-2022 Tauri Programme within The Commons Conservancy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: LICENSE.spdx
================================================
SPDXVersion: SPDX-2.1
DataLicense: CC0-1.0
PackageName: window-shadows
DataFormat: SPDXRef-1
PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
PackageHomePage: https://tauri.app
PackageLicenseDeclared: Apache-2.0
PackageLicenseDeclared: MIT
PackageCopyrightText: 2020-2022, The Tauri Programme in the Commons Conservancy
PackageSummary: <text>Add native shadows to your windows.
                </text>
PackageComment: <text>The package includes the following libraries; see
Relationship information.
                </text>
Created: 2020-05-20T09:00:00Z
PackageDownloadLocation: git://github.com/tauri-apps/window-shadows
PackageDownloadLocation: git+https://github.com/tauri-apps/window-shadows.git
PackageDownloadLocation: git+ssh://github.com/tauri-apps/window-shadows.git
Creator: Person: Daniel Thompson-Yvetot


================================================
FILE: README.md
================================================
> [!warning]
> # ARCHIVE NOTICE
> 
> This crate is **Unmaintained**! it served its purpose which was an interim solution to enable shadows on undecorated windows for `tao` and `tauri`.
> 
> As of `tauri@v2` and recent versions of `tao` and `winit`, they all support enablind/disabling shadows so this crate is not needed.
>
> If you're using `tauri@v1` and need this crate, don't worry, this crate will still function with `tauri@v1` without any problems.


# window-shadows

[![](https://img.shields.io/crates/v/window-shadows)](https://crates.io/crates/window-shadows) [![](https://img.shields.io/docsrs/window-shadows)](https://docs.rs/window-shadows/) ![](https://img.shields.io/crates/l/window-shadows)
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)

Add native shadows to your windows.

## Platform-specific

- **Windows**: On Windows 11, the window will also have rounded corners.
- **macOS**: Shadows are always disabled for transparent windows.
- **Linux**: Unsupported, Shadows are controlled by the compositor installed on the end-user system.

## Example

```rs
use window_shadows::set_shadow;

#[cfg(any(windows, target_os = "macos"))]
set_shadow(&window, true).unwrap();
```

## Screenshots

<p align="center">

| Windows | macOS |
| :---:   | :---: |
| ![Windows screenshot](./screenshots/windows.png) | ![macOS screenshot](./screenshots/macOS.png) |

</p>


================================================
FILE: examples/tao.rs
================================================
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

fn main() {
    use tao::{
        event::{Event, WindowEvent},
        event_loop::{ControlFlow, EventLoop},
        window::WindowBuilder,
    };
    use window_shadows::set_shadow;

    let event_loop = EventLoop::new();

    let window = WindowBuilder::new()
        .with_decorations(false)
        .build(&event_loop)
        .unwrap();

    set_shadow(&window, true).expect("Unsupported platform!");

    window.set_title("A fantastic window!");

    event_loop.run(move |event, _, control_flow| {
        *control_flow = ControlFlow::Wait;

        if let Event::WindowEvent {
            event: WindowEvent::CloseRequested,
            ..
        } = event
        {
            *control_flow = ControlFlow::Exit
        }
    });
}


================================================
FILE: examples/tauri/.gitignore
================================================
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

node_modules/


================================================
FILE: examples/tauri/package.json
================================================
{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "MIT OR Apache-2.0",
  "dependencies": {
    "@tauri-apps/cli": "^1.0.0"
  }
}

================================================
FILE: examples/tauri/public/index.html
================================================
<!-- Copyright 2020-2022 Tauri Programme within The Commons Conservancy
     SPDX-License-Identifier: Apache-2.0
     SPDX-License-Identifier: MIT
-->
<html>

<body>
  <div>window shadows example</div>
</body>

</html>

================================================
FILE: examples/tauri/src-tauri/.gitignore
================================================
# Copyright 2020-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

# Generated by Cargo
# will have compiled files and executables
/target/


================================================
FILE: examples/tauri/src-tauri/Cargo.toml
================================================
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["Tauri Programme within The Commons Conservancy"]
edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
serde_json = "1"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1", features = ["api-all"] }
window-shadows = { path = "../../../" }

[build-dependencies]
tauri-build = { version = "1" }

[features]
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]


================================================
FILE: examples/tauri/src-tauri/build.rs
================================================
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

fn main() {
    tauri_build::build()
}


================================================
FILE: examples/tauri/src-tauri/src/main.rs
================================================
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

#![cfg_attr(
    all(not(debug_assertions), target_os = "windows"),
    windows_subsystem = "windows"
)]

use tauri::Manager;
use window_shadows::set_shadow;

fn main() {
    tauri::Builder::default()
        .setup(|app| {
            let window = app.get_window("main").unwrap();
            set_shadow(&window, true).expect("Unsupported platform!");
            Ok(())
        })
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}


================================================
FILE: examples/tauri/src-tauri/tauri.conf.json
================================================
{
  "package": {
    "productName": "app",
    "version": "0.1.0"
  },
  "build": {
    "distDir": "../public",
    "devPath": "../public"
  },
  "tauri": {
    "bundle": {
      "active": true,
      "targets": "all",
      "identifier": "com.tauri.window-shadows",
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ],
      "resources": [],
      "externalBin": [],
      "copyright": "",
      "category": "DeveloperTool",
      "shortDescription": "",
      "longDescription": "",
      "deb": {
        "depends": []
      },
      "macOS": {
        "frameworks": [],
        "exceptionDomain": "",
        "signingIdentity": null,
        "entitlements": null
      },
      "windows": {
        "certificateThumbprint": null,
        "digestAlgorithm": "sha256",
        "timestampUrl": ""
      }
    },
    "updater": {
      "active": false
    },
    "allowlist": {
      "all": true
    },
    "windows": [
      {
        "title": "app",
        "width": 800,
        "height": 600,
        "resizable": true,
        "fullscreen": false,
        "decorations": false
      }
    ],
    "security": {
      "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
    }
  }
}


================================================
FILE: examples/winit.rs
================================================
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

fn main() {
    use window_shadows::set_shadow;
    use winit::{
        event::{Event, WindowEvent},
        event_loop::{ControlFlow, EventLoop},
        window::WindowBuilder,
    };

    let event_loop = EventLoop::new().unwrap();

    let window = WindowBuilder::new()
        .with_decorations(false)
        .build(&event_loop)
        .unwrap();

    set_shadow(&window, true).expect("Unsupported platform!");

    window.set_title("A fantastic window!");

    event_loop
        .run(move |event, event_loop| {
            event_loop.set_control_flow(ControlFlow::Wait);

            if let Event::WindowEvent {
                event: WindowEvent::CloseRequested,
                ..
            } = event
            {
                event_loop.exit()
            }
        })
        .unwrap();
}


================================================
FILE: renovate.json
================================================
{
  "extends": ["config:base", ":disableDependencyDashboard"]
}


================================================
FILE: src/lib.rs
================================================
// Copyright 2020-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

//! Add native shadows to your windows.
//!
//! ## Platform-specific
//!
//! - **Windows**: On Windows 11, the window will also have rounded corners.
//! - **macOS**: Shadows are always disabled for transparent windows.
//! - **Linux**: Unsupported, Shadows are controlled by the compositor installed on the end-user system.
//!
//! # Example
//!
//! ```no_run
//! use window_shadows::set_shadow;
//!
//! # let window: &dyn raw_window_handle::HasRawWindowHandle = unsafe { std::mem::zeroed() };
//! #[cfg(any(windows, target_os = "macos"))]
//! set_shadow(&window, true).unwrap();
//! ```

/// Enables or disables the shadows for a window.
///
/// ## Platform-specific
///
/// - **Windows**: On Windows 11, the window will also have rounded corners.
/// - **macOS**: Shadows are always disabled for transparent windows.
/// - **Linux**: Unsupported, Shadows are controlled by the compositor installed on the end-user system.
pub fn set_shadow(
    window: impl raw_window_handle::HasRawWindowHandle,
    #[allow(unused)] enable: bool,
) -> Result<(), Error> {
    match window.raw_window_handle() {
        #[cfg(target_os = "macos")]
        raw_window_handle::RawWindowHandle::AppKit(handle) => {
            use cocoa::{appkit::NSWindow, base::id};
            use objc::runtime::{NO, YES};

            unsafe {
                (handle.ns_window as id).setHasShadow_(if enable { YES } else { NO });
            }

            Ok(())
        }
        #[cfg(target_os = "windows")]
        raw_window_handle::RawWindowHandle::Win32(handle) => {
            use windows_sys::Win32::{
                Graphics::Dwm::DwmExtendFrameIntoClientArea, UI::Controls::MARGINS,
            };

            let m = if enable { 1 } else { 0 };
            let margins = MARGINS {
                cxLeftWidth: m,
                cxRightWidth: m,
                cyTopHeight: m,
                cyBottomHeight: m,
            };
            unsafe {
                DwmExtendFrameIntoClientArea(handle.hwnd as _, &margins);
            };
            Ok(())
        }
        _ => Err(Error::UnsupportedPlatform),
    }
}

#[derive(Debug)]
pub enum Error {
    UnsupportedPlatform,
}

impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "\"set_shadow()\" is only supported on Windows and macOS")
    }
}
Download .txt
gitextract_1gvi5f2t/

├── .changes/
│   ├── config.json
│   └── readme.md
├── .github/
│   └── workflows/
│       ├── audit.yml
│       ├── clippy-fmt.yml
│       ├── covector-status.yml
│       ├── covector-version-or-publish.yml
│       └── test.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── LICENSE.spdx
├── README.md
├── examples/
│   ├── tao.rs
│   ├── tauri/
│   │   ├── .gitignore
│   │   ├── package.json
│   │   ├── public/
│   │   │   └── index.html
│   │   └── src-tauri/
│   │       ├── .gitignore
│   │       ├── Cargo.toml
│   │       ├── build.rs
│   │       ├── icons/
│   │       │   └── icon.icns
│   │       ├── src/
│   │       │   └── main.rs
│   │       └── tauri.conf.json
│   └── winit.rs
├── renovate.json
└── src/
    └── lib.rs
Download .txt
SYMBOL INDEX (7 symbols across 5 files)

FILE: examples/tao.rs
  function main (line 5) | fn main() {

FILE: examples/tauri/src-tauri/build.rs
  function main (line 5) | fn main() {

FILE: examples/tauri/src-tauri/src/main.rs
  function main (line 13) | fn main() {

FILE: examples/winit.rs
  function main (line 5) | fn main() {

FILE: src/lib.rs
  function set_shadow (line 30) | pub fn set_shadow(
  type Error (line 69) | pub enum Error {
    method fmt (line 74) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Condensed preview — 27 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (35K chars).
[
  {
    "path": ".changes/config.json",
    "chars": 1008,
    "preview": "{\n  \"gitSiteUrl\": \"https://github.com/tauri-apps/window-shadows/\",\n  \"pkgManagers\": {\n    \"rust\": {\n      \"version\": tru"
  },
  {
    "path": ".changes/readme.md",
    "chars": 1617,
    "preview": "# Changes\n\n##### via https://github.com/jbolda/covector\n\nAs you create PRs and make changes that require a version bump,"
  },
  {
    "path": ".github/workflows/audit.yml",
    "chars": 643,
    "preview": "# Copyright 2022-2022 Tauri Programme within The Commons Conservancy\n# SPDX-License-Identifier: Apache-2.0\n# SPDX-Licens"
  },
  {
    "path": ".github/workflows/clippy-fmt.yml",
    "chars": 1060,
    "preview": "# Copyright 2022-2022 Tauri Programme within The Commons Conservancy\n# SPDX-License-Identifier: Apache-2.0\n# SPDX-Licens"
  },
  {
    "path": ".github/workflows/covector-status.yml",
    "chars": 284,
    "preview": "name: covector status\non: [pull_request]\n\njobs:\n  covector:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions"
  },
  {
    "path": ".github/workflows/covector-version-or-publish.yml",
    "chars": 1515,
    "preview": "name: covector version or publish\n\non:\n  push:\n    branches:\n      - dev\n\njobs:\n  version-or-publish:\n    runs-on: ubunt"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 521,
    "preview": "name: test\n\non:\n  push:\n    branches:\n      - dev\n  pull_request:\n\njobs:\n  test:\n    strategy:\n      fail-fast: false\n  "
  },
  {
    "path": ".gitignore",
    "chars": 158,
    "preview": "# Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n# SPDX-License-Identifier: Apache-2.0\n# SPDX-Licens"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 2141,
    "preview": "# Changelog\n\n## \\[0.2.2]\n\n- [`791c43d`](https://github.com/tauri-apps/window-shadows/commit/791c43def0e802a47a7b163e7bc6"
  },
  {
    "path": "Cargo.toml",
    "chars": 1059,
    "preview": "[package]\nname = \"window-shadows\"\ndescription = \"Add native shadows to your windows.\"\nauthors = [ \"Tauri Programme withi"
  },
  {
    "path": "LICENSE-APACHE",
    "chars": 10847,
    "preview": "                              Apache License\n                        Version 2.0, January 2004\n                     http"
  },
  {
    "path": "LICENSE-MIT",
    "chars": 1108,
    "preview": "MIT License\n\nCopyright (c) 2020-2022 Tauri Programme within The Commons Conservancy\n\nPermission is hereby granted, free "
  },
  {
    "path": "LICENSE.spdx",
    "chars": 845,
    "preview": "SPDXVersion: SPDX-2.1\nDataLicense: CC0-1.0\nPackageName: window-shadows\nDataFormat: SPDXRef-1\nPackageSupplier: Organizati"
  },
  {
    "path": "README.md",
    "chars": 1429,
    "preview": "> [!warning]\n> # ARCHIVE NOTICE\n> \n> This crate is **Unmaintained**! it served its purpose which was an interim solution"
  },
  {
    "path": "examples/tao.rs",
    "chars": 884,
    "preview": "// Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-Lic"
  },
  {
    "path": "examples/tauri/.gitignore",
    "chars": 153,
    "preview": "# Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n# SPDX-License-Identifier: Apache-2.0\n# SPDX-Licens"
  },
  {
    "path": "examples/tauri/package.json",
    "chars": 269,
    "preview": "{\n  \"name\": \"app\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"E"
  },
  {
    "path": "examples/tauri/public/index.html",
    "chars": 218,
    "preview": "<!-- Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n     SPDX-License-Identifier: Apache-2.0\n     SP"
  },
  {
    "path": "examples/tauri/src-tauri/.gitignore",
    "chars": 212,
    "preview": "# Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n# SPDX-License-Identifier: Apache-2.0\n# SPDX-Licens"
  },
  {
    "path": "examples/tauri/src-tauri/Cargo.toml",
    "chars": 491,
    "preview": "[package]\nname = \"app\"\nversion = \"0.1.0\"\ndescription = \"A Tauri App\"\nauthors = [\"Tauri Programme within The Commons Cons"
  },
  {
    "path": "examples/tauri/src-tauri/build.rs",
    "chars": 181,
    "preview": "// Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-Lic"
  },
  {
    "path": "examples/tauri/src-tauri/src/main.rs",
    "chars": 626,
    "preview": "// Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-Lic"
  },
  {
    "path": "examples/tauri/src-tauri/tauri.conf.json",
    "chars": 1372,
    "preview": "{\n  \"package\": {\n    \"productName\": \"app\",\n    \"version\": \"0.1.0\"\n  },\n  \"build\": {\n    \"distDir\": \"../public\",\n    \"dev"
  },
  {
    "path": "examples/winit.rs",
    "chars": 950,
    "preview": "// Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-Lic"
  },
  {
    "path": "renovate.json",
    "chars": 64,
    "preview": "{\n  \"extends\": [\"config:base\", \":disableDependencyDashboard\"]\n}\n"
  },
  {
    "path": "src/lib.rs",
    "chars": 2508,
    "preview": "// Copyright 2020-2022 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-Lic"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the tauri-apps/window-shadows GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 27 files (31.4 KB), approximately 8.7k tokens, and a symbol index with 7 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!