mapsize 1.2.0: permanent delete and in-map reveal when headless
On a headless Linux or BSD system (no DISPLAY or WAYLAND_DISPLAY) nothing empties the freedesktop trash, so trashing never freed space. There, d now deletes permanently after an explicit confirmation, checking owner and type against the scan and removing through an os.Root on the parent so a swapped symlink cannot redirect it. o shows the folder in the map instead of launching a file manager. Desktop sessions, macOS and Windows are unchanged.
This commit is contained in:
@@ -226,6 +226,17 @@ func (m *Model) reveal() tea.Cmd {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if platform.Headless() {
|
||||
// No file manager: show the folder in the map instead.
|
||||
id := m.selectedNode()
|
||||
if m.tree.Node(id).IsDir() && len(m.kidsOf(id).ids) > 0 {
|
||||
m.zoomTo(id)
|
||||
m.setViewByName("Map")
|
||||
} else {
|
||||
m.jumpTo(id)
|
||||
}
|
||||
return m.info("Showing " + textutil.Sanitize(m.tree.Path(m.zoom)))
|
||||
}
|
||||
if err := platform.Reveal(p); err != nil {
|
||||
return m.warn("Open failed: " + textutil.Sanitize(err.Error()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user