hyper-folder-icon
Advanced tools
Comparing version 1.3.3 to 1.4.0
11
gnome.js
const fs = require('fs'); | ||
const path = require('path'); | ||
const path = require('path'); | ||
const gvfs = require('gvfs-meta-node'); | ||
@@ -26,5 +26,3 @@ const mime = require('mime-types'); | ||
let cleanPath = | ||
newEntries[_path]['custom-icon'] | ||
.substr(7); | ||
let cleanPath = newEntries[_path]['custom-icon'].substr(7); | ||
@@ -39,3 +37,2 @@ let _readFile = (__path) => { | ||
let newPath = path.dirname(cleanPath) + '/' + data.toString(); | ||
console.log(newPath); | ||
@@ -49,3 +46,3 @@ fs.readFile(newPath, (err,newData) => { | ||
return resolve({ | ||
resolve({ | ||
buffer:newData.toString((format != "image/svg+xml") ? 'base64' : undefined), | ||
@@ -59,3 +56,3 @@ format:format | ||
return resolve({ | ||
resolve({ | ||
buffer:data.toString((format != "image/svg+xml") ? 'base64' : undefined), | ||
@@ -62,0 +59,0 @@ format:mime.lookup(cleanPath) |
40
index.js
@@ -88,2 +88,6 @@ const iconFinder = require('./iconfinder').iconFinder; | ||
exports.getTabProps = (uid,parentProps,props) => { | ||
return Object.assign({},props,{uid: uid.uid}); | ||
} | ||
exports.decorateTab = (Tab, { React }) => { | ||
@@ -120,13 +124,27 @@ return class extends React.PureComponent { | ||
componentDidMount() { | ||
localCwd(this.state.cwd) | ||
.then((icon) => { | ||
let updateIcon = (icon) => { | ||
window.store.dispatch({ | ||
type: 'FOLDER_ICON', | ||
icon: { | ||
iconData: icon, | ||
cwd:this.state.cwd, | ||
uid:this.props.uid | ||
} | ||
}); | ||
this.setState({ | ||
iconData: icon | ||
}); | ||
}; | ||
localCwd(this.state.cwd) | ||
.then((icon) => { | ||
updateIcon(icon); | ||
}) | ||
.catch((icon) => { | ||
this.setState({ | ||
iconData: icon | ||
}); | ||
updateIcon(icon); | ||
}); | ||
@@ -138,13 +156,3 @@ } | ||
if (prevState.cwd !== this.state.cwd && this.props.isActive) { | ||
localCwd(this.state.cwd) | ||
.then((icon) => { | ||
this.setState({ | ||
iconData: icon | ||
}); | ||
}) | ||
.catch((icon) => { | ||
this.setState({ | ||
iconData: icon | ||
}); | ||
}); | ||
this.componentDidMount(); | ||
} | ||
@@ -151,0 +159,0 @@ } |
{ | ||
"name": "hyper-folder-icon", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "Use folder icons in MacOS and Windows with Hyper", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -8,5 +8,5 @@ hyper-folder-icon | ||
From hyper terminal: hyper i hyper-folder-icon | ||
From hyper terminal: `hyper i hyper-folder-icon` | ||
# Features for MacOS: | ||
# Features for macOS: | ||
@@ -19,7 +19,11 @@ - Show icon of current folder if custom icon has been applied to the folder | ||
# Features for WINDOWS (Untested) | ||
- Integrates with hyper-tab-touchbar showing the icons in the MacBook Pro's TouchBar | ||
 | ||
# Features for Windows (Untested) | ||
- Show icon from Desktop.ini file | ||
# Features for Linux/gnome | ||
# Features for Linux/GNOME | ||
@@ -26,0 +30,0 @@ - Show custom GNOME icon from gvfs metadata |
21561
47
528