-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Big main.js rewrite and added settings
- Loading branch information
Showing
7 changed files
with
335 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
:root { | ||
--text: #fafafa; | ||
--secondary: #bcbcbc; | ||
--background: #010101; | ||
--background-secondary: #171719; | ||
--separator-horizontal: rgba(62, 62, 62, 0.5); | ||
--separator-vertical: rgba(45, 45, 45, 0.3); | ||
} | ||
|
||
body { | ||
background-color: var(--background); | ||
color: var(--text); | ||
font-family: 'Samsung', sans-serif; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
} | ||
|
||
bubble { | ||
background-color: var(--background-secondary); | ||
padding: 20px 20px 20px 20px; | ||
border-radius: 33px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
|
||
.bubble-info { | ||
width: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
} | ||
|
||
seperatorhorizontal { | ||
border-bottom: 3px solid var(--separator-horizontal); | ||
width: 100%; | ||
box-sizing: border-box; | ||
display: flex; | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
seperatorvertical { | ||
border-left: 2px solid var(--separator-vertical); | ||
margin-right: 5px; | ||
height: 20px; | ||
width: 3px; | ||
box-sizing: border-box; | ||
display: flex; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
:root { | ||
--on-background: #FAFAFA; | ||
--on-primary: white; | ||
--app-accent: #4f4ae1; | ||
} | ||
|
||
/* The switch - the box around the toggle-slider */ | ||
.oui-container-toggle { | ||
position: relative; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.toggle { | ||
opacity: 0; | ||
position: absolute; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
.toggle-slider { | ||
position: relative; | ||
display: block; | ||
width: 39px; | ||
height: 20px; | ||
border-radius: 10px; | ||
background-color: #646368; | ||
cursor: pointer; | ||
} | ||
|
||
.toggle-slider:after { | ||
position: absolute; | ||
content: ""; | ||
height: 18px; | ||
width: 18px; | ||
border-radius: 50%; | ||
border: 1px solid #646368; | ||
background-color: var(--on-primary); | ||
transition: .2s; | ||
} | ||
|
||
input:checked+.toggle-slider { | ||
background-color: var(--app-accent); | ||
border-color: var(--app-accent); | ||
} | ||
|
||
input:focus+.toggle-slider { | ||
box-shadow: 0 0 1px var(--app-accent); | ||
} | ||
|
||
input:checked+.toggle-slider:after { | ||
transform: translateX(20px); | ||
border-color: var(--app-accent); | ||
} | ||
|
||
.oui-container-toggle:hover .toggle-slider:after { | ||
box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
.container-position { | ||
display: flex; | ||
flex-direction: column; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
|
||
const folderPath = path.join(os.homedir(), 'AppData', 'Local', 'OneUI-Widgets'); | ||
const jsonFilePath = path.join(folderPath, 'widgetStates.json'); | ||
|
||
window.addEventListener('DOMContentLoaded', () => { | ||
const jsonData = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8')); | ||
|
||
function updateWidgetState(widgetName, checkbox) { | ||
jsonData[widgetName].show = checkbox.checked.toString(); | ||
fs.writeFileSync(jsonFilePath, JSON.stringify(jsonData, null, 4), 'utf8'); | ||
} | ||
|
||
const checkboxes = [ | ||
{ name: 'musicWidget', element: document.getElementById('music-checkbox') }, | ||
{ name: 'batteryWidget', element: document.getElementById('battery-checkbox') }, | ||
{ name: 'deviceCareWidget', element: document.getElementById('deviceCare-checkbox') }, | ||
{ name: 'weatherWidget', element: document.getElementById('weather-checkbox') }, | ||
]; | ||
|
||
checkboxes.forEach((checkbox) => { | ||
checkbox.element.checked = jsonData[checkbox.name].show === 'true'; | ||
|
||
checkbox.element.addEventListener('change', (event) => { | ||
updateWidgetState(checkbox.name, event.target); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.