mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Set default Python icon and improve logic for default app prompt dialog
This commit is contained in:
parent
b31c5a672d
commit
1e3fcc8bdb
@ -976,9 +976,18 @@ function UIItem(options){
|
||||
icon: `<img src="${html_encode(suggested_app.icon ?? window.icons['app.svg'])}" style="width:16px; height: 16px; margin-bottom: -4px;">`,
|
||||
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'),
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user