Skip to content
Closed
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: 3 additions & 1 deletion widgets/sidebar/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ClockWidget from "./modules/ClockWidget";
import WeatherWidget from "./modules/WeatherWidget";
import MatshellSettingsWidget from "./modules/MatshellSettingsWidget";
import QuickActionsWidget from "./modules/QuickActionWidget";
import TimerWidget from "./modules/TimerWidget";
import TemplateWidget from "./modules/BaseTemplateWidget";
import options from "options";
import HardwareMonitorWidget from "./modules/HardwareWidget/main";
Expand Down Expand Up @@ -48,10 +49,11 @@ export default function Sidebar(
<WeatherWidget />
<MatshellSettingsWidget />
<HardwareMonitorWidget />
<TimerWidget />
<box vexpand />
<QuickActionsWidget />
{/*
<TemplateWidget />
<TemplsssateWidget />
*/}
{/* Extra widgets */}
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ export function HorizontalDiskBar({
used: string;
total: string;
}) {
// Truncate mount point if it's too long
const truncatePath = (path: string, maxLength: number = 20): string => {
if (path.length <= maxLength) return path;

// For paths like /home/user/something, show /home/.../something
const parts = path.split('/').filter(p => p);
if (parts.length > 2) {
return `/${parts[0]}/.../${parts[parts.length - 1]}`;
}

// Otherwise just truncate with ellipsis
return path.substring(0, maxLength - 3) + '...';
};

return (
<box
cssClasses={["hw-disk-bar"]}
Expand All @@ -20,10 +34,11 @@ export function HorizontalDiskBar({
>
<box orientation={Gtk.Orientation.HORIZONTAL} spacing={8}>
<label
label={mountPoint}
label={truncatePath(mountPoint)}
cssClasses={["disk-bar-mount"]}
halign={Gtk.Align.START}
hexpand
tooltipText={mountPoint}
/>
<label
label={`${used} / ${total}`}
Expand All @@ -40,5 +55,4 @@ export function HorizontalDiskBar({
/>
</box>
);
}

}