mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
fix(keybinds): show percentage amount in titles & performance improvements
This commit is contained in:
@@ -770,6 +770,26 @@ const DMS_ACTION_ARGS = {
|
||||
}
|
||||
};
|
||||
|
||||
const DMS_AMOUNT_LABELS = {
|
||||
"audio increment": "Volume Up",
|
||||
"audio decrement": "Volume Down",
|
||||
"mpris increment": "Player Volume Up",
|
||||
"mpris decrement": "Player Volume Down",
|
||||
"brightness increment": "Brightness Up",
|
||||
"brightness decrement": "Brightness Down"
|
||||
};
|
||||
|
||||
function getDmsAmountLabel(action) {
|
||||
var parsed = parseDmsActionArgs(action);
|
||||
var label = DMS_AMOUNT_LABELS[parsed.base];
|
||||
if (!label)
|
||||
return null;
|
||||
var amount = parsed.args?.amount;
|
||||
if (amount === undefined || amount === null || amount === "")
|
||||
return label;
|
||||
return label + " (" + amount + "%)";
|
||||
}
|
||||
|
||||
function getActionTypes() {
|
||||
return ACTION_TYPES;
|
||||
}
|
||||
@@ -844,6 +864,10 @@ function getActionLabel(action, compositor) {
|
||||
if (!action)
|
||||
return "";
|
||||
|
||||
var amountLabel = getDmsAmountLabel(action);
|
||||
if (amountLabel)
|
||||
return amountLabel;
|
||||
|
||||
var dmsAct = findDmsAction(action);
|
||||
if (dmsAct)
|
||||
return dmsAct.label;
|
||||
|
||||
Reference in New Issue
Block a user