The safety layer: two presses for anything you cannot take back
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
// One tile in the power menu: big glyph, label underneath.
|
||||
//
|
||||
// Anything that ends the session arms on the first press and only fires on the
|
||||
// second, with the label swapping to "Confirm" — an accidental Ctrl+Alt+Delete
|
||||
// should never be one click away from losing everything that is open.
|
||||
// second — an accidental Ctrl+Alt+Delete should never be one click away from
|
||||
// losing everything that is open.
|
||||
//
|
||||
// Armed, the tile turns red and names the thing it is about to do ("Power off")
|
||||
// rather than saying "Confirm". Six tiles could all say "Confirm"; only one of
|
||||
// them is about to take the machine down, and the press that does it should say
|
||||
// which one it is.
|
||||
|
||||
import QtQuick
|
||||
import qs.config
|
||||
@@ -21,6 +26,13 @@ Rectangle {
|
||||
|
||||
readonly property bool armed: confirmTimer.running
|
||||
|
||||
// The tile's own label, said as a sentence rather than as a title: "Power
|
||||
// Off" is the name of a menu entry, "Power off" is the thing the next press
|
||||
// does. Derived, so an entry added to the menu cannot forget to name itself.
|
||||
readonly property string armedLabel: root.label === ""
|
||||
? "Confirm"
|
||||
: root.label.charAt(0) + root.label.slice(1).toLowerCase()
|
||||
|
||||
implicitWidth: 136
|
||||
implicitHeight: 136
|
||||
radius: Theme.cardRadius + 6
|
||||
@@ -68,7 +80,7 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: root.armed ? "Confirm" : root.label
|
||||
text: root.armed ? root.armedLabel : root.label
|
||||
color: root.armed ? Theme.danger : Theme.fg
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: Theme.fontSize
|
||||
|
||||
Reference in New Issue
Block a user