diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index 026a0f7b..30a332ca 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -24,6 +24,7 @@ function settings() { themes(cd); localStorage.setItem("theme", cd); } + var nd = $("[name=nsfw]:checked").val(); var nt = $("[for=n_"+nd+"]").text(); if (nd != localStorage.getItem("nsfw")) { @@ -250,6 +251,12 @@ function load() { } $("#" + theme).prop("checked", true); + var ha = localStorage.getItem("ha"); + if (!ha) { + var ha = "false"; + } + $("#ha_" + ha).prop("checked", true); + var nsfw = localStorage.getItem("nsfw"); if (!nsfw) { var nsfw = "yes"; @@ -913,6 +920,12 @@ function customImp(){ alert("Error") } } +function hardwareAcceleration(){ + var had = $("[name=ha]:checked").val(); + localStorage.setItem("ha", had); + console.log("ha"); + ipc.send('ha', had); +} ipc.on('theme-json-create-complete', function (event, args) { $("#custom_import").val(""); diff --git a/app/main.js b/app/main.js index 7f52a1fc..2c34e679 100644 --- a/app/main.js +++ b/app/main.js @@ -16,8 +16,6 @@ const join = require('path').join; var JSON5 = require('json5'); // アプリケーションをコントロールするモジュール const app = electron.app; - -//app.disableHardwareAcceleration() // ウィンドウを作成するモジュール const BrowserWindow = electron.BrowserWindow; const { @@ -29,8 +27,15 @@ var info_path = join(app.getPath("userData"), "window-size.json"); var max_info_path = join(app.getPath("userData"), "max-window-size.json"); var lang_path=join(app.getPath("userData"), "language"); var customcss=join(app.getPath("userData"), "custom.css"); - var tmp_img = join(app.getPath("userData"), "tmp.png"); +var ha_path=join(app.getPath("userData"), "hardwareAcceleration"); +try{ + fs.readFileSync(ha_path, 'utf8'); + app.disableHardwareAcceleration() + console.log("disabled: HA"); +}catch{ + console.log("enabled: HA"); +} var window_size; try { window_size = JSON.parse(fs.readFileSync(info_path, 'utf8')); @@ -261,7 +266,16 @@ ipc.on('theme-json-list', function(e, arg) { mainWindow.webContents.send('theme-json-list-response', themes); }); }) - +//ハードウェアアクセラレーションの無効化 +ipc.on('ha', function(e, arg) { + if(arg=="true"){ + fs.writeFileSync(ha_path,arg); + }else{ + fs.unlink(ha_path, function (err) {}); + } + app.relaunch() + app.exit() +}) ipc.on('update', function(e, x, y) { var platform=process.platform; diff --git a/app/package.json b/app/package.json index 3bdc70b9..a39afb48 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "17.2.0", + "version": "17.2.1", "description": "TheDesk is a Mastodon client for PC.", "main": "main.js", "scripts": { diff --git a/app/view/en/index.html b/app/view/en/index.html index 3407cb62..9b9f6d75 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -32,7 +32,7 @@