Skip to content

Commit

Permalink
fix: Non-built-in presets incorrectly marked as built-in
Browse files Browse the repository at this point in the history
closes: #110
  • Loading branch information
luisbocanegra committed Oct 30, 2024
1 parent 9054b7a commit 11f8e91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package/contents/ui/configPresetAutoload.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ KCM.SimpleKCM {
property string presetsBuiltinDir: Qt.resolvedUrl("./presets").toString().substring(7) + "/"
property string toolsDir: Qt.resolvedUrl("./tools").toString().substring(7) + "/"
property string listUserPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsDir + "'"
property string listBuiltinPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsBuiltinDir + "'"
property string listBuiltinPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsBuiltinDir + "' b"
property string listPresetsCmd: listBuiltinPresetsCmd+";"+listUserPresetsCmd

property string cfg_presetAutoloading
Expand All @@ -39,7 +39,7 @@ KCM.SimpleKCM {
Connections {
target: runCommand
function onExited(cmd, exitCode, exitStatus, stdout, stderr) {
// console.log(cmd);
console.error(cmd, exitCode, exitStatus, stdout, stderr)
if (exitCode!==0) return
// console.log(stdout);
if(cmd === listPresetsCmd) {
Expand Down
3 changes: 2 additions & 1 deletion package/contents/ui/configPresets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ KCM.SimpleKCM {
property string presetsBuiltinDir: Qt.resolvedUrl("./presets").toString().substring(7) + "/"
property string toolsDir: Qt.resolvedUrl("./tools").toString().substring(7) + "/"
property string listUserPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsDir + "'"
property string listBuiltinPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsBuiltinDir + "'"
property string listBuiltinPresetsCmd: "'" + toolsDir + "list_presets.sh' '" + presetsBuiltinDir + "' b"
property string listPresetsCmd: listBuiltinPresetsCmd+";"+listUserPresetsCmd
property string spectaclePreviewCmd: "spectacle -bn -r -o "
property var presets: ({})
Expand Down Expand Up @@ -54,6 +54,7 @@ KCM.SimpleKCM {
Connections {
target: runCommand
function onExited(cmd, exitCode, exitStatus, stdout, stderr) {
console.error(cmd, exitCode, exitStatus, stdout, stderr)
if (exitCode!==0) return
if(cmd === listPresetsCmd) {
presets = ({})
Expand Down
9 changes: 8 additions & 1 deletion package/contents/ui/tools/list_presets.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/usr/bin/env bash

PRESETS_DIR="$1"
BUILTIN="$2"

find "$PRESETS_DIR" -mindepth 1 -prune -type d -print0 | while IFS= read -r -d '' preset; do echo b:"$preset"; done | sort
find "$PRESETS_DIR" -mindepth 1 -prune -type d -print0 | while IFS= read -r -d '' preset; do
if [[ -n $BUILTIN ]]; then
echo "b:$preset"
else
echo "u:$preset"
fi
done | sort

0 comments on commit 11f8e91

Please sign in to comment.