Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Jul 23, 2022
0 parents commit 4052869
Show file tree
Hide file tree
Showing 28 changed files with 998 additions and 0 deletions.
Binary file added .github/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src-tauri/packages/tao"]
path = src-tauri/packages/tao
url = ssh://[email protected]/RoundedCorners/tao.git
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.0.1

Initial commit
324 changes: 324 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<p align="center">
<img width="64" height="64" src="./src-tauri/src/img/icon.ico">
</p>

# Rounded Corners

This app rounds the corners of your Windows screen.

![Rounded Corners](./.github/cover.png)
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "roundedcorners-app",
"version": "0.0.1",
"description": "",
"license": "MIT",
"scripts": {
"build": "vite build",
"dev": "vite",
"serve": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "1.0.2",
"solid-js": "1.4.7"
},
"devDependencies": {
"@tauri-apps/cli": "1.0.5",
"autoprefixer": "10.4.7",
"postcss": "8.4.14",
"tailwindcss": "3.1.6",
"typescript": "4.7.4",
"vite": "3.0.2",
"vite-plugin-solid": "2.3.0"
}
}
16 changes: 16 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
plugins: [
require("postcss-import"),
require("postcss-url"),
require("tailwindcss/nesting"),
require("tailwindcss")("./tailwind.config.js"),
require("postcss-combine-media-query"),
require("postcss-combine-duplicated-selectors")({
removeDuplicatedProperties: true,
removeDuplicatedValues: false,
}),
require("autoprefixer"),
require("cssnano")({ preset: "advanced" }),
require("postcss-reporter"),
],
};
4 changes: 4 additions & 0 deletions src-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools
29 changes: 29 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "roundedcorners"
version = "0.0.1"
description = "Rounded Corners"
authors = ["Nikola Hristov <[email protected]>"]
license-file = "LICENSE"
repository = "https://github.com/RoundedCorners/app"
default-run = "roundedcorners"
edition = "2021"
rust-version = "1.57"

[patch.crates-io]
tao = { path = "packages/tao" }

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

[dependencies]
serde_json = "1.0.82"
serde = { version = "1.0.140", features = ["derive"] }
tauri = { version = "1.0.5", features = ["system-tray", "window-set-position"] }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = ["tauri/custom-protocol"]
324 changes: 324 additions & 0 deletions src-tauri/LICENSE

Large diffs are not rendered by default.

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()
}
1 change: 1 addition & 0 deletions src-tauri/packages/tao
Submodule tao added at e0fc84
Binary file added src-tauri/src/img/16x16.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/src/img/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/src/img/banner.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/src/img/dialogImage.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/src/img/icon.ico
Binary file not shown.
37 changes: 37 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#![cfg_attr(all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows")]

use tauri::{CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu};

fn main() {
tauri::Builder::default()
.system_tray(
SystemTray::new().with_menu(
SystemTrayMenu::new()
.add_item(CustomMenuItem::new("show".to_string(), "Show"))
.add_item(CustomMenuItem::new("hide".to_string(), "Hide"))
.add_item(CustomMenuItem::new("exit".to_string(), "Exit")),
),
)
.on_system_tray_event(|app, event| {
if let SystemTrayEvent::MenuItemClick { id, .. } = event {
match id.as_str() {
"show" => {
app.windows().into_iter().for_each(|(_label, window)| {
window.show().unwrap();
});
}
"hide" => {
app.windows().into_iter().for_each(|(_label, window)| {
window.hide().unwrap();
});
}
"exit" => {
std::process::exit(0);
}
_ => {}
}
}
})
.run(tauri::generate_context!())
.expect("Error! Failed to run Rounded Corners.");
}
76 changes: 76 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "..\\node_modules/@tauri-apps/cli\\schema.json",
"build": {
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev",
"devPath": "http://localhost:3000",
"distDir": "../dist"
},
"package": {
"productName": "Rounded Corners",
"version": "0.0.1"
},
"tauri": {
"allowlist": {
"all": false,
"window": {
"setPosition": true
}
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "Copyright (c) Playform 2022. All rights reserved.",
"externalBin": [],
"icon": [
"src/img/16x16.png",
"src/img/32x32.png",
"src/img/icon.ico"
],
"identifier": "com.playform.roundedcorners",
"longDescription": "Rounded Corners app for Windows",
"resources": [],
"shortDescription": "Rounded Corners",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": "",
"wix": {
"bannerPath": "src/img/banner.png",
"dialogImagePath": "src/img/dialogImage.png"
}
}
},
"security": {
"csp": null
},
"systemTray": {
"iconPath": "src/img/icon.ico",
"iconAsTemplate": true
},
"updater": {
"active": false
},
"windows": [
{
"alwaysOnTop": true,
"center": false,
"decorations": false,
"fileDropEnabled": false,
"focus": true,
"fullscreen": true,
"label": "window",
"maximized": false,
"resizable": false,
"skipTaskbar": true,
"title": "",
"transparent": true,
"url": "/src/windows/window.html",
"visible": true,
"x": 0,
"y": 0
}
]
}
}
28 changes: 28 additions & 0 deletions src/assets/css/corner.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.Corner {
--corner-size: 23px;
width: var(--corner-size);
height: var(--corner-size);

-webkit-mask-image: radial-gradient(
circle at var(--corner-size) var(--corner-size),
transparent calc(var(--corner-size) + -0.7px),
rgba(255, 255, 255, 1) calc(var(--corner-size) + 0.7px)
);

@apply absolute inset-auto bg-black;

&[data-id="top_right"] {
transform: rotate(90deg);
@apply right-0;
}

&[data-id="bottom_right"] {
transform: rotate(180deg);
@apply right-0 bottom-0;
}

&[data-id="bottom_left"] {
transform: rotate(270deg);
@apply left-0 bottom-0;
}
}
13 changes: 13 additions & 0 deletions src/assets/css/window.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
background: transparent;
position: relative;
}

::-webkit-scrollbar {
display: none;
}
9 changes: 9 additions & 0 deletions src/components/corner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { mergeProps } from "solid-js";

import "./../assets/css/corner.css";

export default function Corner(props) {
const merged = mergeProps({ id: "default" }, props);

return <div class="Corner" data-id={merged.id}></div>;
};
27 changes: 27 additions & 0 deletions src/components/window.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { appWindow } from "@tauri-apps/api/window";

import type { Component } from "solid-js";
import { createSignal, For, lazy } from 'solid-js';
import { render } from "solid-js/web";
import "./../assets/css/window.css";

const Corner = lazy(() => import("./corner"));

const Window: Component = () => {
const [corners] = createSignal([
{ id: 'top_left' },
{ id: 'top_right' },
{ id: 'bottom_right' },
{ id: 'bottom_left' }
]);

return (
<div class="Window" data-label={appWindow.label}>
<For each={corners()}>{(corner, i) =>
<Corner id={corner.id} />
}</For>
</div>
);
};

render(() => <Window />, document.getElementById("box") as HTMLElement);
23 changes: 23 additions & 0 deletions src/windows/window.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>

<html lang="en">

<head>

<meta
name="viewport"
content="width=150, height=150, initial-scale=1, maximum-scale=1, user-scalable=no"
/>

</head>

<body>

<div id="box"></div>

<script src="/src/components/window.tsx" type="module"></script>

</body>

</html>

8 changes: 8 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
content: ["./src/**/*.{js,ts,jsx,tsx,css,md,mdx,html,json,scss}"],
darkMode: "media",
theme: {
extend: {},
},
plugins: [],
};
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"types": [
"vite/client"
],
"noEmit": true,
"isolatedModules": true
}
}
18 changes: 18 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import { resolve } from "path";

export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: "esnext",
rollupOptions: {
input: {
window: resolve(__dirname, "src/windows/window.html"),
},
},
},
});

0 comments on commit 4052869

Please sign in to comment.