Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ CMakeUserPresets.json
/_CPack_Packages
debug_log*
debug_*
.vscode/tasks.json
/.vscode
data/session.json
.vscode/
16 changes: 16 additions & 0 deletions assets/settings_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,21 @@
"category": "developer",
"note": null,
"default": false
},
{
"key": "restore_session_on_startup",
"name": "Restore previous session",
"description": "Reopen tabs from your last browsing session when starting the browser.",
"category": "general",
"note": null,
"default": true
},
{
"key": "save_session_continuously",
"name": "Enable crash recovery",
"description": "Continuously save session state so tabs can be restored after crashes or unexpected closures (ALT+F4).",
"category": "general",
"note": null,
"default": true
}
]
106 changes: 106 additions & 0 deletions assets/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,110 @@ body.compact-tabs .icon {

body.compact-tabs #toggle-downloads .downloads-badge {
top: 0;
}

/* Session Restore Bar */
#session-restore-bar {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
background: linear-gradient(180deg, #2d4a6f 0%, #1e3a5f 100%);
border-bottom: 1px solid #3d6a9f;
padding: 8px 16px;
z-index: 9999;
align-items: center;
justify-content: space-between;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
from {
transform: translateY(-100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}

#session-restore-bar.visible {
display: flex;
}

#session-restore-bar .restore-message {
display: flex;
align-items: center;
gap: 10px;
color: #e0e8f0;
font-size: 13px;
}

#session-restore-bar .restore-icon {
width: 20px;
height: 20px;
fill: #7cb3e0;
}

#session-restore-bar .restore-actions {
display: flex;
gap: 8px;
}

#session-restore-bar .restore-btn {
padding: 6px 14px;
border-radius: 4px;
border: none;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.2s, transform 0.1s;
}

#session-restore-bar .restore-btn:hover {
transform: translateY(-1px);
}

#session-restore-bar .restore-btn:active {
transform: translateY(0);
}

#session-restore-bar .restore-btn.primary {
background: #4a9eff;
color: white;
}

#session-restore-bar .restore-btn.primary:hover {
background: #5aadff;
}

#session-restore-bar .restore-btn.secondary {
background: rgba(255, 255, 255, 0.1);
color: #c0d0e0;
border: 1px solid rgba(255, 255, 255, 0.2);
}

#session-restore-bar .restore-btn.secondary:hover {
background: rgba(255, 255, 255, 0.15);
}

#session-restore-bar .dismiss-btn {
background: none;
border: none;
color: #8090a0;
cursor: pointer;
padding: 4px;
margin-left: 8px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}

#session-restore-bar .dismiss-btn:hover {
background: rgba(255, 255, 255, 0.1);
color: #c0d0e0;
}
71 changes: 70 additions & 1 deletion assets/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,26 @@
</span>
</div>


<!-- Session Restore Bar -->
<div id="session-restore-bar" role="alert" aria-live="polite">
<div class="restore-message">
<svg class="restore-icon" viewBox="0 0 24 24" aria-hidden="true">
<path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z" fill="currentColor"/>
<path d="M12 8v5l4.28 2.54.72-1.21-3.5-2.08V8H12z" fill="currentColor"/>
</svg>
<span id="restore-message-text">Your previous session was interrupted. Would you like to restore your tabs?</span>
</div>
<div class="restore-actions">
<button class="restore-btn primary" id="restore-session-btn">Restore</button>
<button class="restore-btn secondary" id="dismiss-session-btn">Start Fresh</button>
<button class="dismiss-btn" id="close-restore-bar" aria-label="Close">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</svg>
</button>
</div>
</div>

<div id="menu-dropdown" class="menu-dropdown hidden" role="menu" aria-hidden="true">
<div class="menu-item" data-action="new-tab">New tab [Ctrl+T]</div>
<div class="menu-item" data-action="new-window">New window [Ctrl+N]</div>
Expand Down Expand Up @@ -138,6 +157,56 @@
chromeTabs.removeTab(tab);
}

// Session Restore Bar Functions
function showSessionRestoreBar(tabCount, wasCrash) {
const bar = document.getElementById('session-restore-bar');
const msgText = document.getElementById('restore-message-text');
if (!bar || !msgText) return;

if (wasCrash) {
msgText.textContent = `Your previous session was interrupted. Restore ${tabCount} tab${tabCount !== 1 ? 's' : ''}?`;
} else {
msgText.textContent = `Would you like to restore ${tabCount} tab${tabCount !== 1 ? 's' : ''} from your last session?`;
}

bar.classList.add('visible');

// Set up event handlers
const restoreBtn = document.getElementById('restore-session-btn');
const dismissBtn = document.getElementById('dismiss-session-btn');
const closeBtn = document.getElementById('close-restore-bar');

const hideBar = () => {
bar.classList.remove('visible');
};

if (restoreBtn) {
restoreBtn.onclick = () => {
hideBar();
if (window.OnRestoreSession) OnRestoreSession();
};
}

if (dismissBtn) {
dismissBtn.onclick = () => {
hideBar();
if (window.OnDismissSession) OnDismissSession();
};
}

if (closeBtn) {
closeBtn.onclick = () => {
hideBar();
if (window.OnDismissSession) OnDismissSession();
};
}
}

function hideSessionRestoreBar() {
const bar = document.getElementById('session-restore-bar');
if (bar) bar.classList.remove('visible');
}

function bindCallbacks() {
el.addEventListener('requestNewTab', ({ detail }) => OnRequestNewTab());
el.addEventListener('requestTabClose', ({ detail }) => OnRequestTabClose(detail.tabEl.getAttribute('data-tab-id')));
Expand Down
Loading
Loading