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:
@@ -2,7 +2,10 @@
|
||||
|
||||
package platform
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
)
|
||||
|
||||
// TrashName is the user-facing name of the trash.
|
||||
const TrashName = "trash"
|
||||
@@ -12,3 +15,10 @@ func Reveal(string) error { return errors.New("not supported on this platform")
|
||||
|
||||
// Trash is unsupported on this platform.
|
||||
func Trash(string, Expect) error { return errors.New("trash not supported on this platform") }
|
||||
|
||||
// Headless reports whether there is no graphical session (no X or Wayland
|
||||
// display), so there is no file manager to open and no desktop trash anyone
|
||||
// will empty.
|
||||
func Headless() bool {
|
||||
return os.Getenv("DISPLAY") == "" && os.Getenv("WAYLAND_DISPLAY") == ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user