mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(clipboard): removed unused date filter and date headers, went with a simple "time ago" indicator per entry which feels more natural
This commit is contained in:
@@ -625,11 +625,7 @@
|
||||
"emoji-search-description": "Search and copy emojis",
|
||||
"settings-search-description": "Search and navigate to settings",
|
||||
"windows-search-description": "Search and focus open windows"
|
||||
},
|
||||
"date-filter-all-time": "All Time",
|
||||
"date-filter-today": "Today",
|
||||
"date-filter-yesterday": "Yesterday",
|
||||
"date-filter-previous-7-days": "Previous 7 Days"
|
||||
}
|
||||
},
|
||||
"lock-screen": {
|
||||
"authenticating": "Authenticating...",
|
||||
@@ -1305,8 +1301,6 @@
|
||||
"settings-auto-paste-label": "Auto paste",
|
||||
"settings-clip-chips-description": "Show a tab bar to filter clipboard history by type (Images, Links, Files, Code, etc).",
|
||||
"settings-clip-chips-label": "Enable Category Chips",
|
||||
"settings-clip-date-headers-description": "Group clipboard history chronologically with visual headers.",
|
||||
"settings-clip-date-headers-label": "Enable Date grouping",
|
||||
"settings-clip-preview-description": "Show a preview of the clipboard content when using the >clip command.",
|
||||
"settings-clip-preview-label": "Enable clip preview",
|
||||
"settings-clip-smart-icons-description": "Show specific icons for links, files, colors, and code instead of a generic clipboard icon.",
|
||||
@@ -1959,7 +1953,6 @@
|
||||
"click-to-stop-recording": "Screen recorder (stop recording)",
|
||||
"collapse": "Collapse sidebar",
|
||||
"copy-address": "Copy address",
|
||||
"date-filter": "Date filter",
|
||||
"delete-notification": "Delete notification",
|
||||
"dismiss-notification": "Dismiss notification",
|
||||
"do-not-disturb-enabled": "Do Not Disturb",
|
||||
|
||||
@@ -233,7 +233,6 @@
|
||||
"clipboardWrapText": true,
|
||||
"enableClipboardSmartIcons": true,
|
||||
"enableClipboardChips": true,
|
||||
"enableClipboardDateHeaders": true,
|
||||
"clipboardWatchTextCommand": "wl-paste --type text --watch cliphist store",
|
||||
"clipboardWatchImageCommand": "wl-paste --type image --watch cliphist store",
|
||||
"position": "center",
|
||||
|
||||
@@ -1335,6 +1335,24 @@
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.clipboard"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.launcher.settings-clip-smart-icons-label",
|
||||
"descriptionKey": "panels.launcher.settings-clip-smart-icons-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 8,
|
||||
"tabLabel": "panels.launcher.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.clipboard"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.launcher.settings-clip-chips-label",
|
||||
"descriptionKey": "panels.launcher.settings-clip-chips-description",
|
||||
"widget": "NToggle",
|
||||
"tab": 8,
|
||||
"tabLabel": "panels.launcher.title",
|
||||
"subTab": 1,
|
||||
"subTabLabel": "common.clipboard"
|
||||
},
|
||||
{
|
||||
"labelKey": "panels.launcher.settings-clipboard-watch-text-label",
|
||||
"descriptionKey": "panels.launcher.settings-clipboard-watch-text-description",
|
||||
|
||||
@@ -422,7 +422,6 @@ Singleton {
|
||||
property bool clipboardWrapText: true
|
||||
property bool enableClipboardSmartIcons: true
|
||||
property bool enableClipboardChips: true
|
||||
property bool enableClipboardDateHeaders: true
|
||||
property string clipboardWatchTextCommand: "wl-paste --type text --watch cliphist store"
|
||||
property string clipboardWatchImageCommand: "wl-paste --type image --watch cliphist store"
|
||||
property string position: "center" // Position: center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center
|
||||
|
||||
@@ -40,7 +40,7 @@ SmartPanel {
|
||||
return false;
|
||||
if (!Settings.data.appLauncher.enableClipPreview)
|
||||
return false;
|
||||
return selectedIndex >= 0 && results && !!results[selectedIndex] && !results[selectedIndex].isHeader;
|
||||
return selectedIndex >= 0 && results && !!results[selectedIndex];
|
||||
}
|
||||
readonly property int previewPanelWidth: Math.round(400 * Style.uiScaleRatio)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ Rectangle {
|
||||
readonly property int badgeSize: Math.round(effectiveIconSize * Style.uiScaleRatio)
|
||||
readonly property int entryHeight: Math.round(badgeSize + (launcherDensity === "compact" ? (Style.marginL + Style.marginXXS) : (Style.marginXL + Style.marginS)))
|
||||
|
||||
readonly property bool providerShowsCategories: currentProvider.showsCategories === true
|
||||
readonly property bool providerShowsCategories: (currentProvider.showsCategories !== undefined ? currentProvider.showsCategories : true) && providerCategories.length > 0
|
||||
|
||||
readonly property var providerCategories: {
|
||||
if (currentProvider.availableCategories && currentProvider.availableCategories.length > 0) {
|
||||
|
||||
@@ -93,7 +93,7 @@ Variants {
|
||||
return false;
|
||||
if (!Settings.data.appLauncher.enableClipPreview)
|
||||
return false;
|
||||
return launcherCore.selectedIndex >= 0 && launcherCore.results && !!launcherCore.results[launcherCore.selectedIndex] && !launcherCore.results[launcherCore.selectedIndex].isHeader;
|
||||
return launcherCore.selectedIndex >= 0 && launcherCore.results && !!launcherCore.results[launcherCore.selectedIndex];
|
||||
}
|
||||
|
||||
// Dimmer background (click to close)
|
||||
|
||||
@@ -26,7 +26,6 @@ Item {
|
||||
|
||||
// Categories
|
||||
property var availableCategories: Settings.data.appLauncher.enableClipboardChips ? ["All", "Images", "Links", "Files", "Code", "Colors"] : []
|
||||
property bool showsCategories: Settings.data.appLauncher.enableClipboardChips
|
||||
property string selectedCategory: "All"
|
||||
|
||||
function selectCategory(cat) {
|
||||
@@ -38,41 +37,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Date Filtering
|
||||
property bool hasDateFilter: Settings.data.appLauncher.enableClipboardDateHeaders
|
||||
property string dateFilter: "all"
|
||||
property var availableDateFilters: [
|
||||
{
|
||||
"label": I18n.tr("launcher.date-filter-all-time"),
|
||||
"action": "all",
|
||||
"icon": iconMode === "tabler" ? "calendar" : "x-office-calendar"
|
||||
},
|
||||
{
|
||||
"label": I18n.tr("launcher.date-filter-today"),
|
||||
"action": "today",
|
||||
"icon": iconMode === "tabler" ? "calendar-event" : "view-calendar-timeline"
|
||||
},
|
||||
{
|
||||
"label": I18n.tr("launcher.date-filter-yesterday"),
|
||||
"action": "yesterday",
|
||||
"icon": iconMode === "tabler" ? "calendar-time" : "view-calendar"
|
||||
},
|
||||
{
|
||||
"label": I18n.tr("launcher.date-filter-previous-7-days"),
|
||||
"action": "week",
|
||||
"icon": iconMode === "tabler" ? "calendar-week" : "view-calendar-week"
|
||||
}
|
||||
]
|
||||
|
||||
function selectDateFilter(filter) {
|
||||
if (dateFilter !== filter) {
|
||||
dateFilter = filter;
|
||||
if (launcher) {
|
||||
launcher.updateResults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var categoryIcons: {
|
||||
"All": iconMode === "tabler" ? "border-all" : "view-grid",
|
||||
"Images": iconMode === "tabler" ? "photo" : "image",
|
||||
@@ -258,15 +222,7 @@ Item {
|
||||
// Search clipboard items
|
||||
const searchTerm = query.toLowerCase();
|
||||
|
||||
// Date grouping trackers
|
||||
const headersEnabled = Settings.data.appLauncher.enableClipboardDateHeaders;
|
||||
const now = Date.now() / 1000;
|
||||
const todayStart = new Date();
|
||||
todayStart.setHours(0, 0, 0, 0);
|
||||
const todayStartTs = todayStart.getTime() / 1000;
|
||||
const yesterdayStartTs = todayStartTs - 86400;
|
||||
|
||||
let currentGroup = "";
|
||||
|
||||
const catMap = {
|
||||
"Images": "image",
|
||||
@@ -292,50 +248,14 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
// Date Filter
|
||||
const firstSeen = ClipboardService.firstSeenById[item.id] || now;
|
||||
if (root.dateFilter !== "all") {
|
||||
if (root.dateFilter === "today" && firstSeen < todayStartTs)
|
||||
return;
|
||||
if (root.dateFilter === "yesterday" && (firstSeen >= todayStartTs || firstSeen < yesterdayStartTs))
|
||||
return;
|
||||
if (root.dateFilter === "week" && (firstSeen >= yesterdayStartTs || firstSeen < (todayStartTs - (86400 * 7))))
|
||||
return;
|
||||
}
|
||||
|
||||
// Check date group logic
|
||||
if (headersEnabled && !searchTerm && root.selectedCategory === "All" && root.dateFilter === "all") {
|
||||
let groupName = I18n.tr("launcher.date-filter-all-time");
|
||||
if (firstSeen >= todayStartTs) {
|
||||
groupName = I18n.tr("launcher.date-filter-today");
|
||||
} else if (firstSeen >= yesterdayStartTs) {
|
||||
groupName = I18n.tr("launcher.date-filter-yesterday");
|
||||
} else if (firstSeen >= todayStartTs - (86400 * 7)) {
|
||||
groupName = I18n.tr("launcher.date-filter-previous-7-days");
|
||||
}
|
||||
|
||||
if (groupName !== currentGroup) {
|
||||
currentGroup = groupName;
|
||||
results.push({
|
||||
"name": currentGroup,
|
||||
"description": "",
|
||||
"icon": iconMode === "tabler" ? "calendar" : "x-office-calendar",
|
||||
"isTablerIcon": true,
|
||||
"isImage": false,
|
||||
"hideIcon": true,
|
||||
"isHeader": true,
|
||||
"clipboardId": "",
|
||||
"onActivate": function () {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Format the result based on type
|
||||
let entry;
|
||||
if (item.isImage) {
|
||||
entry = formatImageEntry(item);
|
||||
entry = formatImageEntry(item, firstSeen);
|
||||
} else {
|
||||
entry = formatTextEntry(item);
|
||||
entry = formatTextEntry(item, firstSeen);
|
||||
}
|
||||
|
||||
// Add activation handler
|
||||
@@ -371,12 +291,16 @@ Item {
|
||||
return results;
|
||||
}
|
||||
|
||||
function formatImageEntry(item) {
|
||||
function formatImageEntry(item, firstSeen) {
|
||||
const meta = ClipboardService.parseImageMeta(item.preview);
|
||||
const timeStr = Time.formatRelativeTime(new Date(firstSeen * 1000));
|
||||
let desc = meta ? `${meta.fmt} • ${meta.size}` : item.mime || "Image data";
|
||||
if (timeStr)
|
||||
desc += ` • ${timeStr}`;
|
||||
|
||||
return {
|
||||
"name": meta ? `Image ${meta.w}×${meta.h}` : "Image",
|
||||
"description": meta ? `${meta.fmt} • ${meta.size}` : item.mime || "Image data",
|
||||
"description": desc,
|
||||
"icon": iconMode === "tabler" ? "photo" : "image",
|
||||
"isTablerIcon": true,
|
||||
"isImage": true,
|
||||
@@ -389,7 +313,7 @@ Item {
|
||||
};
|
||||
}
|
||||
|
||||
function formatTextEntry(item) {
|
||||
function formatTextEntry(item, firstSeen) {
|
||||
const preview = (item.preview || "").trim();
|
||||
const lines = preview.split('\n').filter(l => l.trim());
|
||||
|
||||
@@ -415,6 +339,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
const timeStr = Time.formatRelativeTime(new Date(firstSeen * 1000));
|
||||
if (timeStr)
|
||||
description += ` • ${timeStr}`;
|
||||
|
||||
let defaultIcon = iconMode === "tabler" ? "clipboard" : "text-x-generic";
|
||||
let colorHex = "";
|
||||
if (Settings.data.appLauncher.enableClipboardSmartIcons) {
|
||||
@@ -517,7 +445,7 @@ Item {
|
||||
|
||||
// Get preview data for the preview panel
|
||||
function getPreviewData(item) {
|
||||
if (!item || item.isHeader)
|
||||
if (!item)
|
||||
return null;
|
||||
return {
|
||||
"clipboardId": item.clipboardId,
|
||||
|
||||
@@ -63,15 +63,6 @@ ColumnLayout {
|
||||
enabled: Settings.data.appLauncher.enableClipboardHistory
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("panels.launcher.settings-clip-date-headers-label")
|
||||
description: I18n.tr("panels.launcher.settings-clip-date-headers-description")
|
||||
checked: Settings.data.appLauncher.enableClipboardDateHeaders
|
||||
onToggled: checked => Settings.data.appLauncher.enableClipboardDateHeaders = checked
|
||||
defaultValue: Settings.getDefaultValue("appLauncher.enableClipboardDateHeaders")
|
||||
enabled: Settings.data.appLauncher.enableClipboardHistory
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
visible: Settings.data.appLauncher.enableClipboardHistory
|
||||
|
||||
Reference in New Issue
Block a user