Skip to content

Commit

Permalink
Removed deprecated status bar and battery level
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Nov 27, 2017
1 parent aa453aa commit 6180aee
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 89 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ You can customize your application with 'ezr:config'. All Settings, customizatio
}
],
"customShortcuts": [],
"favorites": [],
"hideStatusBar": true
"favorites": []
}
```

Expand Down Expand Up @@ -156,7 +155,6 @@ You can customize your application with 'ezr:config'. All Settings, customizatio
* `shortCut`: String - Represents the keyword for the shortcut. For example `vsc`.
* `path`: String - Represents the path to the shortcut. For Example `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio Code\Visual Studio Code.lnk`
* `favorites` String[] - This is where the applications stores your most used applications. You don't have to modify this.
* `hideStatusBar` Boolean - Whether to hide/show the status bar at the bottom of the window. Default is `true`.

## Color Themes
![all-color-themes](img/color-themes/all-color-themes.png)
Expand Down
20 changes: 1 addition & 19 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<input id="user-input" class="user-input" type="text" v-model="userInput" ref="input" v-on:keyDown="handleKeyPress" :autofocus="{ true: focusOnInput }">
<i id="search-icon" :class="searchIcon" aria-hidden="true"></i>

<div class="output-container" :class="{ 'toggled' : config.hideStatusBar }">
<div class="output-container">

<div class="search-result">
<ul class="search-result-list">
Expand Down Expand Up @@ -209,13 +209,6 @@ <h3>Most used</h3>
</div>
<hr>

<div class="config-item">
<h3>Misc</h3>
<label>Hide status bar</label>
<input type="checkbox" v-model="config.hideStatusBar">
</div>
<hr>

<div class="config-item">
<button v-on:click="closeConfig">
<i class="fa fa-arrow-left"></i>
Expand All @@ -229,17 +222,6 @@ <h3>Misc</h3>
</div>

</div>

<div class="status-bar" :class="{ 'hidden': config.hideStatusBar }" style="-webkit-app-region: drag">
<span>
{{ dateTimeNow }}
</span>
<span :class="{ 'hidden' : !computerHasBattery }">
<i :class="battery.icon"></i>
{{ battery.percentage }}%
</span>
</div>

</div>

<script src="./node_modules/vue/dist/vue.min.js"></script>
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@
"license": "MIT",
"main": "./js/main.js",
"dependencies": {
"babel-preset-es2015": "^6.16.0",
"battery-level": "^2.0.1",
"escape-html": "^1.0.3",
"font-awesome": "^4.7.0",
"gulp-babel": "^6.1.2",
"highlight.js": "^9.10.0",
"jquery": "^3.1.1",
"leven": "^2.1.0",
"mime": "^1.3.4",
"open": "0.0.5",
"pretty-bytes": "^2.0.1",
"textextensions": "^2.0.1",
"vue": "^2.1.10"
},
"devDependencies": {
"electron": "^1.7.9",
"electron-builder": "^19.46.9",
"gulp": "^3.9.1",
"gulp-sass": "^3.1.0"
"gulp-sass": "^3.1.0",
"gulp-babel": "^6.1.2",
"babel-preset-es2015": "^6.16.0"
},
"scripts": {
"start": "./node_modules/.bin/electron ./js/main.js",
Expand Down
20 changes: 1 addition & 19 deletions src/css/_app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
}

$user-input-height: 100px;
$status-bar-height: 25px;

body, html {
@include font();
Expand Down Expand Up @@ -48,15 +47,11 @@ input.user-input {

div.output-container {
width: 100vw;
height: calc(100vh - #{$user-input-height} - #{$status-bar-height});
height: calc(100vh - #{$user-input-height});
overflow-y: scroll;
position: relative;
}

div.toggled {
height: calc(100vh - #{$user-input-height});
}

ul.search-result-list {
list-style: none;
padding: 0;
Expand Down Expand Up @@ -248,19 +243,6 @@ div.config {
}
}

div.status-bar {
line-height: $status-bar-height;
font-size: 0.8rem;
width: 100vw;
background-color: $button-color;
color: $button-text-color;
text-align: center;

span {
padding: 0 5px;
}
}

.hidden {
display: none;
}
Expand Down
3 changes: 1 addition & 2 deletions src/js/ConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ function getDefaultConfig() {
{ name: 'DuckDuckGo', prefix: 'd', url: 'https://duckduckgo.com/?q=', icon: 'fa fa-search'}
],
customShortcuts: [],
favorites: [],
hideStatusBar: true
favorites: []
}
}

Expand Down
42 changes: 1 addition & 41 deletions src/js/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'fs'
import path from 'path'
import { exec } from 'child_process'
import { ipcRenderer } from 'electron'
import batteryLevel from 'battery-level'
import hljs from 'highlight.js'

import ConfigManager from './js/ConfigManager'
Expand Down Expand Up @@ -33,10 +32,7 @@ let vue = new Vue({
colorThemePath: `./css/${configManager.getConfig().colorTheme}.css`,
newFolder: '',
newCustomShortcut: {},
newWebSearch: {},
battery: {},
computerHasBattery: false,
dateTimeNow: getDateTime()
newWebSearch: {}
},
methods: {
handleKeyPress(e) {
Expand Down Expand Up @@ -322,37 +318,6 @@ function focusOnInput() {
document.getElementById('user-input').focus()
}

function setBattery() {
batteryLevel().then(level => {
if (!isNaN(level))
vue.computerHasBattery = true

vue.battery.percentage = Math.round(level * 100)
vue.battery.icon = getBatteryIcon()
})
}

function getBatteryIcon() {
if (vue.battery.percentage >= 80)
return 'fa fa-battery-full'
if (vue.battery.percentage >= 60)
return 'fa fa-battery-three-quarters'
if (vue.battery.percentage >= 40)
return 'fa fa-battery-half'
if (vue.battery.percentage >= 20)
return 'fa fa-battery-quarter'
else
return 'fa fa-battery-empty'
}

function getDateTime() {
return new Date().toLocaleString('de-CH')
}

function setDateTime() {
vue.dateTimeNow = getDateTime()
}

function stringIsEmptyOrWhitespaces(string) {
return string === undefined || string.replace(/\s/g, '').length === 0
}
Expand Down Expand Up @@ -383,11 +348,6 @@ document.addEventListener('keyup', (e) => {
focusOnInput()
})

setInterval(() => {
setBattery()
setDateTime()
}, 1000)

function highlight() {
setTimeout(() => {
let block = document.getElementById('text-file-preview')
Expand Down

0 comments on commit 6180aee

Please sign in to comment.