From 1e3fcc8bdb7bb5b0853c29e72a77d746b2db5175 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 22 Mar 2024 11:49:57 -0700 Subject: [PATCH] Set default Python icon and improve logic for default app prompt dialog --- src/UI/UIItem.js | 13 +++++++++++-- src/helpers.js | 7 +++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index 6681af48..6097051b 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -976,9 +976,18 @@ function UIItem(options){ icon: ``, onClick: async function(){ var extension = path.extname($(el_item).attr('data-path')).toLowerCase(); - if(user_preferences[`default_apps${extension}`] !== suggested_app.name){ + if( + user_preferences[`default_apps${extension}`] !== suggested_app.name + && + ( + (!user_preferences[`default_apps${extension}`] && index > 0) + || + (user_preferences[`default_apps${extension}`]) + ) + ){ const alert_resp = await UIAlert({ - message: `${i18n('change_allways_open_with')} ` + suggested_app.title + '?', + message: `${i18n('change_allways_open_with')} ` + html_encode(suggested_app.title) + '?', + body_icon: suggested_app.icon, buttons:[ { label: i18n('yes'), diff --git a/src/helpers.js b/src/helpers.js index f2df8807..96b13a23 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -989,6 +989,10 @@ window.item_icon = async (fsentry)=>{ else if(fsentry.name.toLowerCase().endsWith('.psd')){ return {image: window.icons['file-psd.svg'], type: 'icon'}; } + // *.py + else if(fsentry.name.toLowerCase().endsWith('.py')){ + return {image: window.icons['file-py.svg'], type: 'icon'}; + } // *.xlsx else if(fsentry.name.toLowerCase().endsWith('.xlsx')){ return {image: window.icons['file-xlsx.svg'], type: 'icon'}; @@ -2126,10 +2130,9 @@ window.open_item = async function(options){ } } //---------------------------------------------------------------- - // Do the user have a preference for this file type? + // Does the user have a preference for this file type? //---------------------------------------------------------------- else if(user_preferences[`default_apps${path.extname(item_path).toLowerCase()}`]) { - console.log('launching default app') launch_app({ name: user_preferences[`default_apps${path.extname(item_path).toLowerCase()}`], file_path: item_path,