diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index e39178a6..235008c4 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -4,18 +4,21 @@ var ipc = electron.ipcRenderer //title bar const customTitlebar = require('custom-electron-titlebar') window.addEventListener('DOMContentLoaded', () => { - const file = location.href.substr(-10) - if ( - file == 'index.html' || - file == '/acct.html' || - file == 'tting.html' - ) { - new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex('#000'), - titleHorizontalAlignment: 'right', - icon: '../../img/desk.png' + ipc.send('frameCheck', '') + ipc.on('frame', function(event, args) { + const file = location.href.substr(-10) + if ( + file == 'index.html' || + file == '/acct.html' || + file == 'tting.html' + ) { + new customTitlebar.Titlebar({ + backgroundColor: customTitlebar.Color.fromHex('#000'), + titleHorizontalAlignment: 'right', + icon: '../../img/desk.png' + }) + } }) - } }) onmessage = function(e) { @@ -65,6 +68,8 @@ onmessage = function(e) { ipc.send('theme-json-request', e.data[1]) } else if (e.data[0] == 'ha') { ipc.send('ha', e.data[1]) + } else if (e.data[0] == 'frameSet') { + ipc.send('frameSet', e.data[1]) } else if (e.data[0] == 'ua') { ipc.send('ua', e.data[1]) } else if (e.data[0] == 'aboutData') { diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index d756810a..b3f17063 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -17,6 +17,9 @@ var envView = new Vue({ if (ls == 'ua_setting') { useragent(val) } + if (ls == 'frame') { + frameSet(val) + } return true } } @@ -764,6 +767,9 @@ function hardwareAcceleration(had) { function useragent(val) { postMessage(['ua', val], '*') } +function frameSet(val) { + postMessage(['frameSet', val], '*') +} function customSound(key) { postMessage(['customSound', key], '*') } diff --git a/app/main.js b/app/main.js index dc7a81ea..faa3be90 100644 --- a/app/main.js +++ b/app/main.js @@ -62,6 +62,7 @@ var max_info_path = join(app.getPath('userData'), 'max-window-size.json') var lang_path = join(app.getPath('userData'), 'language') var ha_path = join(app.getPath('userData'), 'hardwareAcceleration') var ua_path = join(app.getPath('userData'), 'useragent') +var frame_path = join(app.getPath('userData'), 'frame') try { fs.readFileSync(ha_path, 'utf8') app.disableHardwareAcceleration() @@ -97,6 +98,16 @@ function isFile(file) { if (err.code === 'ENOENT') return false } } +try { + var frameRaw = fs.readFileSync(frame_path, 'utf8') + if(frameRaw == 'false') { + var frame = false + } else { + var frame = true + } +} catch { + var frame = true +} // 全てのウィンドウが閉じたら終了 app.on('window-all-closed', function() { electron.session.defaultSession.clearCache(() => {}) @@ -142,7 +153,7 @@ function createWindow() { y: window_size.y, icon: __dirname + '/desk.png', show: false, - frame: false, + frame: frame, resizable: true } } else if (platform == 'win32') { @@ -158,7 +169,8 @@ function createWindow() { x: window_size.x, y: window_size.y, simpleFullscreen: true, - show: false + show: false, + frame: frame } } else if (platform == 'darwin') { var arg = { @@ -173,7 +185,8 @@ function createWindow() { x: window_size.x, y: window_size.y, simpleFullscreen: true, - show: false + show: false, + frame: frame, } } mainWindow = new BrowserWindow(arg) @@ -282,9 +295,11 @@ function createWindow() { var platform = process.platform var bit = process.arch Menu.setApplicationMenu( - Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir, dirname)) + Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir, dirname, frame)) ) - mainWindow.setMenu(null) + if(!frame) { + mainWindow.setMenu(null) + } //CSS css.css(mainWindow) //アップデータとダウンロード diff --git a/app/main/language.js b/app/main/language.js index 07ef568c..8b9beb30 100644 --- a/app/main/language.js +++ b/app/main/language.js @@ -1,12 +1,19 @@ // Create the Application's main menu -function templete(lang, mainWindow, packaged, dir, dirname) { +function templete(lang, mainWindow, packaged, dir, dirname, frame) { + //フレーム if(lang !="ja" && lang != "en"){ lang = "en" } const electron = require("electron"); + const ipc = electron.ipcMain; const app = electron.app; const BrowserWindow = electron.BrowserWindow; const join = require('path').join; + ipc.on("frameCheck", function(e, arg) { + if(!frame) { + e.sender.webContents.send("frame", ""); + } + }); const dict = { "application": { "ja": "アプリケーション", diff --git a/app/main/system.js b/app/main/system.js index a671f241..fa7f3556 100644 --- a/app/main/system.js +++ b/app/main/system.js @@ -12,6 +12,7 @@ function system(mainWindow, dir, lang, dirname) { var ua_path = join(app.getPath("userData"), "useragent"); var lang_path = join(app.getPath("userData"), "language"); var log_dir_path = join(app.getPath("userData"), "logs"); + var frame_path = join(app.getPath("userData"), "frame"); //ログ var today = new Date(); //今日のやつ @@ -115,6 +116,7 @@ function system(mainWindow, dir, lang, dirname) { app.relaunch(); app.exit(); }); + //ユーザーエージェント ipc.on("ua", function(e, arg) { if (arg == "") { fs.unlink(ua_path, function(err) {}); @@ -124,6 +126,12 @@ function system(mainWindow, dir, lang, dirname) { app.relaunch(); app.exit(); }); + //フレームのありなし + ipc.on("frameSet", function(e, arg) { + fs.writeFileSync(frame_path, arg); + app.relaunch(); + app.exit(); + }); ipc.on("quit", (e, args) => { app.quit(); @@ -278,6 +286,7 @@ function system(mainWindow, dir, lang, dirname) { e.sender.webContents.send("logData", logs); }); }); + //起動時ログディレクトリ存在確認と作成、古ログ削除 fs.access(log_dir_path, fs.constants.R_OK | fs.constants.W_OK, error => { if (error) { diff --git a/app/view/make/language/en/setting.json b/app/view/make/language/en/setting.json index b4448f33..89485722 100644 --- a/app/view/make/language/en/setting.json +++ b/app/view/make/language/en/setting.json @@ -4,6 +4,8 @@ "yes": "Yes", "no": "No", "none": "None", + "show": "Show", + "hide": "Hide", "default": "Default", "change": "Change", "select": "Select", @@ -34,6 +36,8 @@ "savefolderwarn": "TheDesk uses this value when it try to save pictures or take screenshots.", "useragent":"User agent", "useragentWarn":"Restart when changed", + "frame": "Window frame", + "frameWarn": "If 'off', the window looks cool.", "absolute": "absolute value", "srcUrl": "Search engine", "srcUrlWarn": "{q} will be replaced to query.", diff --git a/app/view/make/language/ja-KS/setting.json b/app/view/make/language/ja-KS/setting.json index 77715d19..0e129112 100644 --- a/app/view/make/language/ja-KS/setting.json +++ b/app/view/make/language/ja-KS/setting.json @@ -4,6 +4,8 @@ "yes": "はい", "no": "いいえ", "none": "なし", + "show": "表示", + "hide": "非表示", "default": "既定", "change": "変更", "select": "選択", @@ -33,6 +35,8 @@ "savefolderwarn": "画像ダウンロードやスクリーンショットはここに保存や。", "useragent":"ユーザーエージェント", "useragentWarn":"再起動すんで。", + "frame": "ウィンドウのフレーム", + "frameWarn": "フレーム無しやとタイトルバーがシュッとするで。再起動すんで。", "absolute": "絶対指定", "srcUrl": "検索エンジン", "srcUrlWarn": "{q}が検索文字列になるで。", diff --git a/app/view/make/language/ja/setting.json b/app/view/make/language/ja/setting.json index 1be2437f..09f39af3 100644 --- a/app/view/make/language/ja/setting.json +++ b/app/view/make/language/ja/setting.json @@ -4,6 +4,8 @@ "yes": "はい", "no": "いいえ", "none": "なし", + "show": "表示", + "hide": "非表示", "default": "既定", "change": "変更", "select": "選択", @@ -34,6 +36,8 @@ "savefolderwarn": "画像ダウンロードやスクリーンショットに影響します。", "useragent":"ユーザーエージェント", "useragentWarn":"再起動します。", + "frame": "ウィンドウのフレーム", + "frameWarn": "フレーム無しだと、タイトルバーのデザインがクールになります。再起動します。", "absolute": "絶対指定", "srcUrl": "検索エンジン", "srcUrlWarn": "{q}が検索文字列に置換されます。", diff --git a/app/view/make/setting.sample.html b/app/view/make/setting.sample.html index 65b4ceec..7cd46b36 100644 --- a/app/view/make/setting.sample.html +++ b/app/view/make/setting.sample.html @@ -1,5 +1,5 @@ - + Settings - TheDesk @@ -25,6 +25,9 @@ .pcr-result { height: 1rem !important; } + .container-after-titlebar { + padding: 20px; + } @@pwa@@ diff --git a/app/view/make/setting.sample.js b/app/view/make/setting.sample.js index e8bfe470..61812942 100644 --- a/app/view/make/setting.sample.js +++ b/app/view/make/setting.sample.js @@ -142,6 +142,26 @@ var envConstruction = [ desc: '@@srcUrlWarn@@', after: '' } + }, + { + id: 'frame', + storage: 'frame', + checkbox: true, + setValue: true, + text: { + head: '@@frame@@', + desc: '@@frameWarn@@', + checkbox: [ + { + text: '@@show@@', + value: 'true' + }, + { + text: '@@hide@@', + value: 'false' + } + ] + } } ] var tlConstruction = [