Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
* Login screen
* PWA support
  • Loading branch information
malisipi committed Feb 2, 2022
1 parent 569d28b commit 1bd7651
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* css/UbuntuRegular.ttf licensed by [Ubuntu Font License](./LICENSE_UFL.txt).

* icons/Suru licensed by [Creative Commons Attribution-ShareAlike 4.0 License](./LICENSE_CCBYSA.txt). (Read icons/Suru/README.md and cons/Suru/CONTRIBUTING.md to learn about)(Forked from https://github.com/ubuntu/yaru)
* icons/Suru and assets licensed by [Creative Commons Attribution-ShareAlike 4.0 License](./LICENSE_CCBYSA.txt). (Read icons/Suru/README.md and cons/Suru/CONTRIBUTING.md to learn about)(Forked from https://github.com/ubuntu/yaru)

* icons/unsplash licensed by [Unsplash License](./LICENSE_UNSPLASH.txt). (Read icons/unsplash/Attribution.html to learn about)

Expand Down
4 changes: 2 additions & 2 deletions apps/terminal/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function runBashCommand(__command){
if(__command.length==1 || __command[1]=="--help"){
writeOutput("Usage: wine PROGRAM [ARGUMENTS...] Run the specified program\n wine --help Display this help and exit\n wine --version Output version information and exit");
} else if(__command[1]=="--version"){
writeOutput("wine-6.21")
writeOutput("wine-7.0-rc5")
} else {
writeOutput("Uygulama başlatılamadı veya belirtilen dosya ile ilişkili bir uygulama yok.")
writeOutput("The application could not be started or there is no application associated with the specified file.")
}
}else if(__the_command=="sh"||__the_command=="bash"){
writeOutput(__console_info);
Expand Down
Binary file added assets/144.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 assets/192.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 assets/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/Vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions css/login.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
*:not(body,html){
visibility:hidden !important;
}

.panel-notification, .panel-status, .panel-status > *, .login-user, .login-user > *, .login-ubuntu{
visibility: visible !important;
}

.panel-notification, .panel-status{
pointer-events: none;
}

.login-user, .login-ubuntu{
display: unset !important;
}

.login-user{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
margin: 0;
background: #66666666;
border-radius: 5px;
width: 260px;
height: 65px;
color: #ffffff;
}

.login-user > img {
position: relative;
top: 8.5px;
left: 8.5px;
width: 48px;
height: 48px;
filter: brightness(2);
border-radius: 50%;
background: #33333333;
}

.login-user > div{
position: relative;
bottom: 29px;
left: 65px;
font-size: 18px;
}

.login-ubuntu{
position: fixed;
bottom: 20px;
font-size: 45px;
color: #ffffff;
left: 50%;
transform: translate(-50%,0);
}
5 changes: 5 additions & 0 deletions css/panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
transition-duration: 0.2s;
}

.panel-status-no-wifi{
grid-template-columns: 0px auto auto !important;
width: 55px !important;
}

.panel-status-icon{
height: 16px;
filter: brightness(2);
Expand Down
23 changes: 20 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
<head>
<title>Ubuntu</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="icons/Suru/Suru/scalable/places/start-here-symbolic.svg" type="image/x-icon">
<link rel="shortcut icon" href="icons/Suru/Suru/scalable/places/start-here-symbolic.svg" type="image/x-icon">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/login.css" id="login-css">
<script src="main.js"></script>
<link rel="stylesheet" href="css/panel.css">
<script src="js/panel.js" defer></script>
Expand All @@ -26,6 +27,17 @@
<script src="js/notify.js"></script>
<link rel="stylesheet" href="css/notify.css">
<script src="js/app-manager.js"></script>
<script src="js/login.js"></script>
<!-- PWA support -->
<link rel="manifest" href="manifest.webmanifest">
<script src="js/pwa.js"></script>
<!-- PWA support for iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="550055">
<meta name="apple-mobile-web-app-title" content="Ubuntu">
<meta name="msapplication-TileImage" content="assets/144.png">
<meta name="msapplication-TileColor" content="#550055">
<link rel="apple-touch-icon" href="assets/144.png">
</head>
<body oncontextmenu="return false;">
<img src="" draggable="false" class="wallpaper" />
Expand All @@ -37,8 +49,8 @@
</div>
<div class="panel-notification" onclick="showNotificationAbout();"></div>
<div class="panel-status" onclick="showStatusAbout();">
<img class="panel-status-icon" draggable="false" src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" id="wifi" src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" id="sound" src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" id="battery" src="icons/Suru/Suru/scalable/status/battery-level-100-charging-symbolic.svg"/>
</div>
<iframe class="status-about" src="status.html" hidden></iframe>
Expand Down Expand Up @@ -85,6 +97,11 @@
<div id="notify-text">Text</div>
<img id="notify-close" src="icons/Suru/Suru/scalable/ui/window-close-symbolic.svg"/>
</div>
<div class="login-user" style="display: none;" onclick="loginSession();">
<img src="icons/Suru/Suru/scalable/status/avatar-default-symbolic.svg"/>
<div>User</div>
</div>
<div class="login-ubuntu" style="display: none;">ubuntu</div>
<div class="brightness" id="brightness"></div>
</body>
</html>
7 changes: 7 additions & 0 deletions js/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
loginSession=()=>{
document.querySelector("link#login-css").remove();
}

lockSession=()=>{
document.head.insertAdjacentHTML("beforeend",'<link rel="stylesheet" href="css/login.css" id="login-css">');
}
37 changes: 34 additions & 3 deletions js/panel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
monthShortNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

if(navigator.getBattery!=undefined){
batteryIcon=document.querySelector("#battery");
(async ()=>{
Expand All @@ -7,23 +8,53 @@ if(navigator.getBattery!=undefined){
updateBatteryIcon=()=>{
if(deviceBattery.charging){
batteryIcon.src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-charging-symbolic.svg";
document.querySelector(".status-about").contentDocument.querySelector("#battery").src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-charging-symbolic.svg";
if(deviceBattery.level==1){
document.querySelector(".status-about").contentDocument.querySelector("#battery-info").innerText="Full";
} else {
if(deviceBattery.chargingTime!=Infinity){
document.querySelector(".status-about").contentDocument.querySelector("#battery-info").innerText=Math.floor(((1-deviceBattery.level)*100*60*3) / 3600)+":"+Math.floor(((1-deviceBattery.level)*100*60*3) % 3600 / 60)+" Until Full ("+(deviceBattery.level*100)+" %)";
}
}
} else {
batteryIcon.src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-symbolic.svg";
document.querySelector(".status-about").contentDocument.querySelector("#battery").src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-symbolic.svg";
if(deviceBattery.dischargingTime!=Infinity){
document.querySelector(".status-about").contentDocument.querySelector("#battery-info").innerText=Math.floor(deviceBattery.dischargingTime / 3600)+":"+Math.floor(deviceBattery.dischargingTime % 3600 / 60)+" Remaining ("+(deviceBattery.level*100)+" %)";
} else {
document.querySelector(".status-about").contentDocument.querySelector("#battery-info").innerText=Math.floor((deviceBattery.level*100*60*3) / 3600)+":"+Math.floor((deviceBattery.level*100*60*3) % 3600 / 60)+" Remaining ("+(deviceBattery.level*100)+" %)";
}
}
}
updateBatteryIcon();

deviceBattery.addEventListener("chargingchange",updateBatteryIcon);
deviceBattery.addEventListener("levelchange",updateBatteryIcon);
})();
}

function UpdatePanelTime(){
wifiIcon=document.querySelector("#wifi");
wifiOfflineSVG="data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='translate(-1073 267)'%3E%3Cpath d='M1081.003-265c-2.61 0-5.22.838-7.4 2.518l-.266.205.205.263 7.457 9.672 7.668-9.931-.264-.206a12.105 12.105 0 0 0-7.4-2.521zm0 1c2.181 0 4.344.672 6.227 1.951l-6.229 8.07-6.226-8.074c1.883-1.278 4.047-1.948 6.228-1.947z' fill='gray' font-family='sans-serif' font-weight='400' opacity='.5' overflow='visible' style='font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:none;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:%23000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none' white-space='normal'/%3E%3C/g%3E%3C/svg%3E"; // from Suru icons, licensed by (CC-BY-SA 4.0). Learn more about license from LICENSE.md

window.addEventListener("offline",()=>{
wifiIcon.src="data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3C/svg%3E";
document.querySelector(".status-about").contentDocument.querySelector("#wifi").src=wifiOfflineSVG;
document.querySelector(".status-about").contentDocument.querySelector("#wifi-info").innerText="Wi-Fi Not Connected";
document.querySelector(".panel-status").className+=" panel-status-no-wifi";
});

window.addEventListener("online",()=>{
wifiIcon.src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg";
document.querySelector(".status-about").contentDocument.querySelector("#wifi").src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg";
document.querySelector(".status-about").contentDocument.querySelector("#wifi-info").innerText="Wi-Fi";
document.querySelector(".panel-status").className=document.querySelector(".panel-status").className.replace(" panel-status-no-wifi","");
});

function UpdatePanel(){
now = new Date();
document.getElementsByClassName("panel-notification")[0].innerHTML=now.getDate()+" "+(monthShortNames[now.getMonth()])+ " " + now.toString().match("..:..")[0];
}

setInterval(UpdatePanelTime,1000)
setInterval(UpdatePanel,1000)

function changePanelActiveAppIcon(icon,name,brightness=1){
if(name==""){
Expand Down
13 changes: 13 additions & 0 deletions js/pwa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('service-worker.js').then(function (registration) {
console.log('Registered!');
}, function (err) {
console.log('ServiceWorker registration failed: ', err);
}).catch(function (err) {
console.log(err);
});
});
} else {
console.log('service worker is not supported');
}
20 changes: 19 additions & 1 deletion js/status.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function changeBrightness(){
parent.document.getElementById("brightness").style.opacity=1-document.getElementById("brightness-change").value/100;
parent.document.getElementById("brightness").style.opacity=1-window.event.target.value/100;
}

function changeVolume(){
let _volume=window.event.target.value;
if(_volume==0){
parent.document.querySelector("#sound").src="icons/Suru/Suru/scalable/status/audio-volume-muted-symbolic.svg"
} else if(_volume<26){
parent.document.querySelector("#sound").src="icons/Suru/Suru/scalable/status/audio-volume-low-symbolic.svg"
} else if(_volume<76){
parent.document.querySelector("#sound").src="icons/Suru/Suru/scalable/status/audio-volume-medium-symbolic.svg"
} else {
parent.document.querySelector("#sound").src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg"
}
}

function openSettings(){
Expand All @@ -9,4 +22,9 @@ function openSettings(){

openShutdown = ()=>{
parent.showDialog("Shutdown Computer","Do you want to shutdown your computer?","Cancel","Shutdown","","location.href='https://github.com/malisipi/ubuntu-tour'")
}

lockSession=()=>{
parent.showStatusAbout();
parent.lockSession();
}
29 changes: 29 additions & 0 deletions manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"short_name": "Ubuntu",
"name": "Ubuntu",
"icons": [
{
"src": "/assets/Vector.svg",
"type": "image/svg+xml",
"sizes": "512x512"
},
{
"src": "/assets/192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/assets/512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/?pwa=true",
"background_color": "#550055",
"display": "fullscreen",
"scope": "/",
"theme_color": "#550055",
"shortcuts": [],
"description": "Ubuntu",
"screenshots": []
}
3 changes: 3 additions & 0 deletions service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
self.addEventListener('install', function(e) {});
self.addEventListener("activate", event => {});
self.addEventListener('fetch', function (event){});
9 changes: 5 additions & 4 deletions status.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
<script src="js/status.js"></script>
</head>
<body>
<img style="grid-area: sound;" draggable="false" src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg" class="icon-slider"/> <input style="grid-area: sound-slider;" type="range" min="0" max="100" value="100" class="special-slider slider"/>
<img style="grid-area: sound;" draggable="false" src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg" class="icon-slider"/> <input style="grid-area: sound-slider;" type="range" min="0" max="100" value="100" oninput="changeVolume();" class="special-slider slider"/>
<img style="grid-area: brightness;" draggable="false" src="icons/Suru/Suru/scalable/status/display-brightness-symbolic.svg" class="icon-slider"/> <input style="grid-area: brightness-slider;" type="range" id="brightness-change" oninput="changeBrightness();" min="30" max="100" value="100" class="special-slider slider"/>
<div style="grid-area: section;" class="special-section"></div>
<img style="grid-area: wifi;" draggable="false" src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg" class="icon"/> <div style="grid-area: wifi-text;" class="label">Wifi</div>
<img style="grid-area: wifi;" id="wifi" draggable="false" src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg" class="icon"/> <div style="grid-area: wifi-text;" id="wifi-info" class="label">Wi-Fi</div>
<img style="grid-area: bluetooth;" draggable="false" src="icons/Suru/Suru/scalable/status/bluetooth-disabled-symbolic.svg" class="icon"/> <div style="grid-area: bluetooth-text;" class="label">Bluetooth is off</div>
<img style="grid-area: battery;" draggable="false" src="icons/Suru/Suru/scalable/status/battery-level-100-charging-symbolic.svg" class="icon"/> <div style="grid-area: battery-text;" class="label">Full</div>
<img style="grid-area: battery;" id="battery" draggable="false" src="icons/Suru/Suru/scalable/status/battery-level-100-charging-symbolic.svg" class="icon"/> <div style="grid-area: battery-text;" id="battery-info" class="label">Full</div>
<div style="grid-area: section2;" class="special-section"></div>
<img style="grid-area: settings;" onclick="openSettings();" draggable="false" src="icons/Suru/Suru/scalable/apps/settings-app-symbolic.svg" class="icon"/> <div style="grid-area: settings-text;" onclick="openSettings();" class="label">Settings</div>
<img style="grid-area: lock;" draggable="false" src="icons/Suru/Suru/scalable/actions/system-lock-screen-symbolic.svg" class="icon"/> <div style="grid-area: lock-text;" class="label">Lock</div>
<img style="grid-area: lock;" onclick="lockSession();" draggable="false" src="icons/Suru/Suru/scalable/actions/system-lock-screen-symbolic.svg" class="icon"/> <div onclick="lockSession();" style="grid-area: lock-text;" class="label">Lock</div>
<img style="grid-area: shutdown;" onclick="openShutdown();" draggable="false" src="icons/Suru/Suru/scalable/actions/system-shutdown-symbolic.svg" class="icon"/> <div style="grid-area: shutdown-text;" onclick="openShutdown();" class="label">Shutdown</div>
<script>if(navigator.getBattery!=undefined){parent.updateBatteryIcon();}</script>
</body>
</html>

0 comments on commit 1bd7651

Please sign in to comment.