Skip to content

Commit

Permalink
Add kiosk mode for electron app
Browse files Browse the repository at this point in the history
- run with kiosk argument "AnimeTV kiosk"
  • Loading branch information
amarullz committed Aug 21, 2024
1 parent cd6ba9a commit 63f5d87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 9 additions & 3 deletions app/src/main/assets/view/m.js
Original file line number Diff line number Diff line change
Expand Up @@ -2464,9 +2464,15 @@ const _API={
return;
}
_API.fullscreenEl=$n('c','electron-fullscreen',null,$('animetv'),'');
_API.fullscreenEl.onclick=function(){
_JSAPI.toggleFullscreen();
};
/* set kiosk */
if (_JSAPI.varGet("kiosk","0")){
_API.fullscreenEl.style.display='none';
}
else{
_API.fullscreenEl.onclick=function(){
_JSAPI.toggleFullscreen();
};
}
_API.fullscreenCb(_JSAPI.getFullscreen());
},
fullscreenCb:function(s){
Expand Down
11 changes: 10 additions & 1 deletion electron/src/animetv.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ const main={
main.vars.fullscreen=(main.vars.initwinstate==2);
}
main.vars.dns=common.dns;

if (process.argv[process.argv.length-1]=="kiosk"){
main.vars.kiosk=1;
main.vars.fullscreen=true;
}

/* Create new window */
main.win=new BrowserWindow({
Expand All @@ -74,7 +79,7 @@ const main={
preload: common.path("/electron/src/preload.js"),
}
});
if (main.vars.initwinstate==1){
if (!main.vars.kiosk && main.vars.initwinstate==1){
/* maximized */
main.win.maximize();
}
Expand Down Expand Up @@ -120,6 +125,7 @@ const main={
sd_domain:'',
fullscreen:false,
initwinstate:0,
kiosk:0,
},
handlerIntent(e,d){
shell.openExternal(d);
Expand Down Expand Up @@ -199,6 +205,9 @@ const main={
return path.join(app.getAppPath(), filename);
},
fullScreen(stat){
if (main.vars.kiosk){
return;
}
if (process.platform !== "darwin"){
main.win.setFullScreen(stat);
}
Expand Down

0 comments on commit 63f5d87

Please sign in to comment.