Skip to content

Commit

Permalink
💚 Add mac os icns files
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminadk committed Jun 19, 2019
1 parent b2c2cde commit b492189
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 17 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ A JavaScript clone of the popular [**ScreenToGif**](https://github.com/NickeMana

## Installation

Currently this application is only available for **Windows**.

Download the latest release.

Please note this application is not intended for distrubution. As mentioned above, download [**ScreenToGif**](https://github.com/NickeManarin/ScreenToGif).
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
"nsis"
]
},
"mac": {
"category": "public.app-category.utilities",
"icon": "static/icon.icns",
"publish": {
"provider": "github",
"owner": "benjaminadk"
},
"target": [
"dmg"
]
},
"directories": {
"output": "release"
}
Expand All @@ -70,7 +81,8 @@
"electron-70"
],
"platforms": [
"win32"
"win32",
"darwin"
],
"arches": [
"x64",
Expand Down
3 changes: 0 additions & 3 deletions src/common/filepaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ export const TEMP_DIRECTORY = path.join(remote.app.getPath('temp'), 'Gifit')
export const RECORDINGS_DIRECTORY = path.join(TEMP_DIRECTORY, 'Recordings')
// store options file
export const OPTIONS_PATH = path.join(remote.app.getPath('userData'), 'options.json')
// static assets
export const RECORDING_ICON = path.join(__static, 'video-recording.ico')
export const PAUSED_ICON = path.join(__static, 'video-paused.ico')
3 changes: 1 addition & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import getURL from 'common/getURL'
import config from 'common/config'

// main electron window

// config variables
const {
inDev,
Expand All @@ -23,7 +22,7 @@ var recorderId = null
function createMainWindow() {
mainWindow = new BrowserWindow({
title: 'Gifit - Start Up',
icon: path.join(__static, 'icon.ico'),
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width,
height,
center: true,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/App/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async () => {
resolve(Map(options))
} else {
const where = spawnSync('where', ['ffmpeg'], { encoding: 'utf8' })
const ffmpegPath = where.stdout.replace('\r\n', '')
const ffmpegPath = where.error ? '' : where.stdout.replace('\r\n', '')
const options = Map(defaultOptions)
.set('ffmpegPath', ffmpegPath)
.set('optionsPath', OPTIONS_PATH)
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/Board/initializeBoard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { remote, ipcRenderer } from 'electron'
import path from 'path'
import getURL from 'common/getURL'
import config from 'common/config'

Expand Down Expand Up @@ -31,6 +32,7 @@ export default (state, dispatch) => {

boardWindow = new remote.BrowserWindow({
title: 'GifIt - Board',
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width: board.width,
height: board.height,
useContentSize: true,
Expand Down
7 changes: 5 additions & 2 deletions src/renderer/components/Encoder/initializeEncoder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { remote, ipcRenderer } from 'electron'
import { remote } from 'electron'
import path from 'path'
import getURL from 'common/getURL'
import config from 'common/config'
Expand All @@ -21,9 +21,12 @@ export default (parent, dispatch, encoderData) => {
encoderWindow = new remote.BrowserWindow({
parent,
title: 'GifIt - Encoder',
icon: path.join(__static, 'icon.ico'),
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width,
height,
resizable: false,
minimizable: false,
maximizable: false,
webPreferences: {
nodeIntegration: true,
webSecurity: !inDev
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function Options() {
title: 'Select the location of the FFMpeg executable',
defaultPath: '.',
buttonLabel: 'Open',
filters: [{ name: 'FFMpeg Executable', extensions: ['exe'] }],
filters: [{ name: 'FFMpeg Executable', extensions: ['exe', 'dmg'] }],
properties: ['openFile']
}
const callback = filepath => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Options/initializeOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default (parent, dispatch) => {
optionsWindow = new remote.BrowserWindow({
parent,
title: 'GifIt - Options',
icon: path.join(__static, 'icon.ico'),
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width,
height,
center: true,
Expand Down
17 changes: 13 additions & 4 deletions src/renderer/components/Recorder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Controls from './Controls'
import SelectOverlay from './SelectOverlay'
import Svg from '../Svg'
import { Container, Confirm, Option, Outline, ZoomOverlay } from './styles'
import { RECORDINGS_DIRECTORY, RECORDING_ICON, PAUSED_ICON } from 'common/filepaths'
import { RECORDINGS_DIRECTORY } from 'common/filepaths'
import config from 'common/config'

const {
Expand All @@ -22,6 +22,15 @@ const {
const mkdirAsync = promisify(mkdir)
const writeFileAsync = promisify(writeFile)

const recordingIcon = path.join(
__static,
process.platform === 'win32' ? 'video-recording.ico' : 'video-recording.icns'
)
const pausedIcon = path.join(
__static,
process.platform === 'win32' ? 'video-paused.ico' : 'video-paused.icns'
)

export default function Recorder() {
const { state, dispatch } = useContext(AppContext)
const { options, sources } = state
Expand Down Expand Up @@ -230,7 +239,7 @@ export default function Recorder() {
}, 500)
})

tray.current = new remote.Tray(RECORDING_ICON)
tray.current = new remote.Tray(recordingIcon)
remote.getCurrentWindow().setIgnoreMouseEvents(true, { forward: true })

// create full screen canvas
Expand Down Expand Up @@ -368,15 +377,15 @@ export default function Recorder() {
setMode(6)
clearInterval(captureInterval.current)
clearInterval(timeout.current)
tray.current.setImage(PAUSED_ICON)
tray.current.setImage(pausedIcon)
}

// resume recording from being paused
function onRecordResume() {
setMode(captureType === 'crop' ? 4 : 5)
t1.current = performance.now()
captureInterval.current = setInterval(() => onCaptureFrame(), Math.round(1000 / frameRate))
tray.current.setImage(RECORDING_ICON)
tray.current.setImage(recordingIcon)
timeout.current = setInterval(() => {
setTimeLimit(cur => cur - 1000)
}, 1000)
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/Recorder/initializeRecorder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { remote, ipcRenderer } from 'electron'
import path from 'path'
import getURL from 'common/getURL'
import config from 'common/config'

Expand Down Expand Up @@ -37,6 +38,7 @@ export default (state, dispatch) => {

recorderWindow = new remote.BrowserWindow({
title: 'GifIt - Recorder',
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width,
height,
x,
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/Scale/initializeScale.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { remote } from 'electron'
import path from 'path'
import getURL from 'common/getURL'
import config from 'common/config'

Expand All @@ -12,6 +13,7 @@ export default (scale, setScale) => {

scaleWindow = new remote.BrowserWindow({
title: 'Scale',
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width: 200,
height: 100,
alwaysOnTop: true,
Expand Down
5 changes: 5 additions & 0 deletions src/renderer/components/Webcam/initializeWebcam.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { remote, ipcRenderer } from 'electron'
import path from 'path'
import getURL from 'common/getURL'
import config from 'common/config'

Expand Down Expand Up @@ -30,9 +31,13 @@ export default (state, dispatch) => {

webcamWindow = new remote.BrowserWindow({
title: 'GifIt - Webcam',
icon: path.join(__static, process.platform === 'win32' ? 'icon.ico' : 'icon.icns'),
width: 0,
height: 0,
useContentSize: true,
resizable: false,
maximizable: false,
minimizable: false,
show: false,
webPreferences: { nodeIntegration: true }
})
Expand Down
Binary file added static/icon.icns
Binary file not shown.
Binary file added static/video-paused.icns
Binary file not shown.
Binary file added static/video-recording.icns
Binary file not shown.

0 comments on commit b492189

Please sign in to comment.