Skip to content

Commit

Permalink
livewinsize
Browse files Browse the repository at this point in the history
  • Loading branch information
Axorax committed Apr 11, 2024
0 parents commit 858d924
Show file tree
Hide file tree
Showing 32 changed files with 843 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
patreon: axorax
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-lock.json
*.lock

node_modules/
target/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Axorax

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.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p align="center"><img src="./src-tauri/icons/128x128.png"></p>

<p align="center"><strong><code>livewinsize</code></strong></p>

<p align="center">View window size on Desktop</p>

# About

When you are developing Desktop applications, you may need to put the height and width of the window for when the app starts or set it to another value for any reason. You need to guess the size or put any value then test it and repeat that process. livewinsize is a simple app that shows the window size that it is currently opened in. You can use this to resize the window and get an idea on what the value for the width and height should be on your app! You can also convert the size into inches, centimeters, etc. with livewinsize and also input a custom size after which livewinsize will resize itself to that size.

# Preview

![Preview](./preview.png)

---

<p align="center"><a href="https://www.patreon.com/axorax">Support me on Patreon</a> — <a href="https://github.com/axorax/socials">Check out my socials</a></p>
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

echo "Copying..."

src_folder="src"
dest_folder="src-copy"

if [ ! -d "$dest_folder" ]; then
mkdir "$dest_folder"
fi

cp -r "$src_folder"/* "$dest_folder"

echo "Minification starting..."

find "$src_folder" -type f -name "*.html" -exec echo "Minifying {}" \; -exec npx html-minifier-terser --collapse-whitespace --remove-comments --output {} {} \;
find "$src_folder" -type f -name "*.css" -exec echo "Minifying {}" \; -exec npx uglifycss --output {} {} \;
find "$src_folder" -type f -name "*.js" -exec echo "Minifying {}" \; -exec npx terser --compress --mangle --output {} -- {} \;

echo "Building..."

npm run tauri build &

wait $!

echo "Cleaning up..."

rm -rf "$src_folder"
mv "$dest_folder" "$src_folder"
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "livewinsize",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"tauri": "tauri"
},
"devDependencies": {
"@tauri-apps/cli": "^1"
}
}
Binary file added preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

if [ ! -d "node_modules" ]; then
npm install
fi

npm run tauri dev
23 changes: 23 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "livewinsize"
version = "1.0.0"
description = "View window size on Desktop"
authors = ["Axorax"]
edition = "2021"

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

[dependencies]
tauri = { version = "1", features = [ "shell-open", "window-set-size"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"

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

[profile.release]
strip = true
lto = true
opt-level = "z"
panic = "abort"
3 changes: 3 additions & 0 deletions src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Binary file added src-tauri/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/128x128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square107x107Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square142x142Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square284x284Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square310x310Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-tauri/icons/icon.icns
Binary file not shown.
Binary file added src-tauri/icons/icon.ico
Binary file not shown.
Binary file added src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("An error occured! Sorry...");
}
57 changes: 57 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"build": {
"devPath": "../src",
"distDir": "../src",
"withGlobalTauri": true
},
"package": {
"productName": "livewinsize",
"version": "1.0.0"
},
"tauri": {
"allowlist": {
"all": false,
"window": {
"all": false,
"setSize": true
},
"shell": {
"all": false,
"open": true
}
},
"windows": [
{
"title": "livewinsize",
"width": 800,
"height": 500
}
],
"security": {
"csp": null
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.axorax.livewinsize",
"icon": [
"icons/icon.icns",
"icons/icon.ico",
"icons/icon.png",
"icons/128x128.png",
"icons/32x32.png",
"icons/128x128@2x.png",
"icons/StoreLogo.png",
"icons/Square30x30Logo.png",
"icons/Square44x44Logo.png",
"icons/Square71x71Logo.png",
"icons/Square89x89Logo.png",
"icons/Square107x107Logo.png",
"icons/Square142x142Logo.png",
"icons/Square150x150Logo.png",
"icons/Square284x284Logo.png",
"icons/Square310x310Logo.png"
]
}
}
}
91 changes: 91 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
<script src="main.js" defer></script>
</head>
<body>
<main>
<div>
<p>Your screen size is</p>
<h1>
<div
class="width"
contenteditable="true"
onblur="focusLost()"
onkeypress="onlyNumbers(event)"
onkeydown="resizeFromEvent(event, 'w', this)"
></div>
<div>x</div>
<div
class="height"
contenteditable="true"
onblur="focusLost()"
onkeypress="onlyNumbers(event)"
onkeydown="resizeFromEvent(event, 'h', this)"
></div>
</h1>
<h2>pixels</h2>
<h3>width x height</h3>
<div class="note">Press Enter to resize the window!</div>
</div>
</main>

<footer>
<div class="button-group">
<div class="group size">
<div>
<div>
<p>Width</p>
<input
class="width"
type="text"
placeholder="Width"
onkeypress="onlyNumbers(event)"
/>
</div>
<div>
<p>Height</p>
<input
class="height"
type="text"
placeholder="Height"
onkeypress="onlyNumbers(event)"
/>
</div>
</div>
</div>

<button onclick="resizeFromInput()" class="size button">
set size
</button>

<div class="group ppi">
<div>DPI/PPI</div>
<div>
<input
oninput="setPPIFromInput(this)"
type="text"
value="96"
onkeypress="onlyNumbers(event)"
/>
</div>
</div>

<div class="group unit">
<div>unit</div>
<button>pixels ▾</button>
</div>

<button class="donate button">Donate</button>
</div>

<div class="dropcover unit">
<input type="text" class="search" placeholder="🔎︎ search units" />
<div></div>
</div>
</footer>
</body>
</html>
Loading

0 comments on commit 858d924

Please sign in to comment.