1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 17:42:06 -04:00

dock: add trash bin button (#2277)

* dock: add trash bin button

- icon reflects content- filled/empty
- multiple file manager support with nautilus as default, builtin as
fallback
- settingsspec at dock tab
- context menu

* fix: remove support for builtin filebrowser

needs specific adaptors at FB adhering the trash freedesktop spec

* fix: suppress auto-hide dock with trash context menu open

* feat: allow for custom file manager command

* feat: switch runner to proc.runcommand with toasts on command failures
This commit is contained in:
Kangheng Liu
2026-04-27 09:55:00 -04:00
committed by GitHub
parent e805f6b5ac
commit 536e654b5e
9 changed files with 763 additions and 5 deletions

View File

@@ -506,6 +506,79 @@ Item {
}
}
SettingsCard {
width: parent.width
iconName: "delete"
title: I18n.tr("Trash")
settingKey: "dockTrash"
SettingsToggleRow {
settingKey: "dockShowTrash"
tags: ["dock", "trash", "bin", "recycle"]
text: I18n.tr("Show Trash in Dock")
description: I18n.tr("Place a trash bin at the end of the dock")
checked: SettingsData.dockShowTrash
onToggled: checked => SettingsData.set("dockShowTrash", checked)
}
SettingsDropdownRow {
id: trashFmDropdown
settingKey: "dockTrashFileManager"
tags: ["dock", "trash", "file", "manager", "nautilus", "thunar", "dolphin", "custom"]
text: I18n.tr("Open Trash With")
description: I18n.tr("File manager used to open the trash. Pick \"custom\" to enter your own command.")
visible: SettingsData.dockShowTrash
currentValue: SettingsData.dockTrashFileManager
options: TrashService.availableFileManagers || []
onValueChanged: value => SettingsData.set("dockTrashFileManager", value)
}
FocusScope {
width: parent.width - Theme.spacingM * 2
height: visible ? trashCustomCommandColumn.implicitHeight : 0
anchors.left: parent.left
anchors.leftMargin: Theme.spacingM
visible: SettingsData.dockShowTrash && SettingsData.dockTrashFileManager === "custom"
Column {
id: trashCustomCommandColumn
width: parent.width
spacing: Theme.spacingXS
StyledText {
text: I18n.tr("Custom open-trash command")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: trashCustomCommandField
width: parent.width
placeholderText: "pcmanfm trash:///"
backgroundColor: Theme.surfaceContainerHighest
normalBorderColor: Theme.outlineMedium
focusedBorderColor: Theme.primary
Component.onCompleted: {
if (SettingsData.dockTrashCustomCommand) {
text = SettingsData.dockTrashCustomCommand;
}
}
onTextEdited: SettingsData.set("dockTrashCustomCommand", text.trim())
MouseArea {
anchors.fill: parent
onPressed: mouse => {
trashCustomCommandField.forceActiveFocus();
mouse.accepted = false;
}
}
}
}
}
}
SettingsCard {
width: parent.width
iconName: "photo_size_select_large"