mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
matugen: add terminals always dark option
This commit is contained in:
@@ -232,6 +232,7 @@ Singleton {
|
|||||||
property bool gtkThemingEnabled: false
|
property bool gtkThemingEnabled: false
|
||||||
property bool qtThemingEnabled: false
|
property bool qtThemingEnabled: false
|
||||||
property bool syncModeWithPortal: true
|
property bool syncModeWithPortal: true
|
||||||
|
property bool terminalsAlwaysDark: false
|
||||||
|
|
||||||
property bool showDock: false
|
property bool showDock: false
|
||||||
property bool dockAutoHide: false
|
property bool dockAutoHide: false
|
||||||
|
|||||||
@@ -779,8 +779,9 @@ Singleton {
|
|||||||
Quickshell.execDetached(["sh", "-c", `mkdir -p '${stateDir}' && cat > '${desiredPath}' << 'EOF'\n${json}\nEOF`])
|
Quickshell.execDetached(["sh", "-c", `mkdir -p '${stateDir}' && cat > '${desiredPath}' << 'EOF'\n${json}\nEOF`])
|
||||||
workerRunning = true
|
workerRunning = true
|
||||||
const syncModeWithPortal = (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal) ? "true" : "false"
|
const syncModeWithPortal = (typeof SettingsData !== "undefined" && SettingsData.syncModeWithPortal) ? "true" : "false"
|
||||||
|
const terminalsAlwaysDark = (typeof SettingsData !== "undefined" && SettingsData.terminalsAlwaysDark) ? "true" : "false"
|
||||||
console.log("Theme: Starting matugen worker")
|
console.log("Theme: Starting matugen worker")
|
||||||
systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, configDir, syncModeWithPortal, "--run"]
|
systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, configDir, syncModeWithPortal, terminalsAlwaysDark, "--run"]
|
||||||
systemThemeGenerator.running = true
|
systemThemeGenerator.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ var SPEC = {
|
|||||||
gtkThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
gtkThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
||||||
qtThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
qtThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
||||||
syncModeWithPortal: { def: true },
|
syncModeWithPortal: { def: true },
|
||||||
|
terminalsAlwaysDark: { def: false, onChange: "regenSystemThemes" },
|
||||||
|
|
||||||
showDock: { def: false },
|
showDock: { def: false },
|
||||||
dockAutoHide: { def: false },
|
dockAutoHide: { def: false },
|
||||||
|
|||||||
@@ -1175,61 +1175,62 @@ Item {
|
|||||||
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: portalSyncSection.implicitHeight + Theme.spacingL * 2
|
height: applicationsSection.implicitHeight + Theme.spacingL * 2
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||||
Theme.outline.b, 0.2)
|
Theme.outline.b, 0.2)
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
Row {
|
Column {
|
||||||
id: portalSyncSection
|
id: applicationsSection
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingL
|
anchors.margins: Theme.spacingL
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
DankIcon {
|
Row {
|
||||||
name: "sync"
|
width: parent.width
|
||||||
size: Theme.iconSize
|
spacing: Theme.spacingM
|
||||||
color: Theme.primary
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
DankIcon {
|
||||||
width: parent.width - Theme.iconSize - Theme.spacingM - syncToggle.width - Theme.spacingM
|
name: "terminal"
|
||||||
spacing: Theme.spacingXS
|
size: Theme.iconSize
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Sync Mode with Portal")
|
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
|
||||||
font.weight: Font.Medium
|
|
||||||
color: Theme.surfaceText
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: I18n.tr("Sync dark mode with settings portals for system-wide theme hints")
|
text: I18n.tr("Applications")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
color: Theme.surfaceVariantText
|
font.weight: Font.Medium
|
||||||
wrapMode: Text.WordWrap
|
color: Theme.surfaceText
|
||||||
width: parent.width
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankToggle {
|
DankToggle {
|
||||||
id: syncToggle
|
width: parent.width
|
||||||
|
text: I18n.tr("Sync Mode with Portal")
|
||||||
width: 48
|
description: I18n.tr("Sync dark mode with settings portals for system-wide theme hints")
|
||||||
height: 32
|
|
||||||
checked: SettingsData.syncModeWithPortal
|
checked: SettingsData.syncModeWithPortal
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
onToggled: checked => {
|
||||||
onToggled: checked => SettingsData.set("syncModeWithPortal", checked)
|
return SettingsData.set("syncModeWithPortal", checked)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Terminals - Always use Dark Theme")
|
||||||
|
description: I18n.tr("Force terminal applications to always use dark color schemes")
|
||||||
|
checked: SettingsData.terminalsAlwaysDark
|
||||||
|
onToggled: checked => {
|
||||||
|
return SettingsData.set("terminalsAlwaysDark", checked)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// System Configuration Warning
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: warningText.implicitHeight + Theme.spacingM * 2
|
height: warningText.implicitHeight + Theme.spacingM * 2
|
||||||
@@ -1449,6 +1450,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1463,7 +1465,6 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFileSelected: function(filePath) {
|
onFileSelected: function(filePath) {
|
||||||
// Save the custom theme file path and switch to custom theme
|
|
||||||
if (filePath.endsWith(".json")) {
|
if (filePath.endsWith(".json")) {
|
||||||
SettingsData.set("customThemeFile", filePath)
|
SettingsData.set("customThemeFile", filePath)
|
||||||
Theme.switchTheme("custom")
|
Theme.switchTheme("custom")
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [ $# -lt 4 ]; then
|
if [ $# -lt 5 ]; then
|
||||||
echo "Usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL --run" >&2
|
echo "Usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL TERMINALS_ALWAYS_DARK --run" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ STATE_DIR="$1"
|
|||||||
SHELL_DIR="$2"
|
SHELL_DIR="$2"
|
||||||
CONFIG_DIR="$3"
|
CONFIG_DIR="$3"
|
||||||
SYNC_MODE_WITH_PORTAL="$4"
|
SYNC_MODE_WITH_PORTAL="$4"
|
||||||
|
TERMINALS_ALWAYS_DARK="$5"
|
||||||
|
|
||||||
if [ ! -d "$STATE_DIR" ]; then
|
if [ ! -d "$STATE_DIR" ]; then
|
||||||
echo "Error: STATE_DIR '$STATE_DIR' does not exist" >&2
|
echo "Error: STATE_DIR '$STATE_DIR' does not exist" >&2
|
||||||
@@ -26,10 +27,10 @@ if [ ! -d "$CONFIG_DIR" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift 4
|
shift 5
|
||||||
|
|
||||||
if [[ "${1:-}" != "--run" ]]; then
|
if [[ "${1:-}" != "--run" ]]; then
|
||||||
echo "usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL --run" >&2
|
echo "usage: $0 STATE_DIR SHELL_DIR CONFIG_DIR SYNC_MODE_WITH_PORTAL TERMINALS_ALWAYS_DARK --run" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -202,6 +203,11 @@ EOF
|
|||||||
echo "[config]" > "$TMP_CONTENT_CFG"
|
echo "[config]" > "$TMP_CONTENT_CFG"
|
||||||
echo "" >> "$TMP_CONTENT_CFG"
|
echo "" >> "$TMP_CONTENT_CFG"
|
||||||
|
|
||||||
|
TERMINAL_MODE="$mode"
|
||||||
|
if [[ "$TERMINALS_ALWAYS_DARK" == "true" ]]; then
|
||||||
|
TERMINAL_MODE="dark"
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v ghostty >/dev/null 2>&1; then
|
if command -v ghostty >/dev/null 2>&1; then
|
||||||
sed "s|'SHELL_DIR/|'$SHELL_DIR/|g" "$SHELL_DIR/matugen/configs/ghostty.toml" >> "$TMP_CONTENT_CFG"
|
sed "s|'SHELL_DIR/|'$SHELL_DIR/|g" "$SHELL_DIR/matugen/configs/ghostty.toml" >> "$TMP_CONTENT_CFG"
|
||||||
echo "" >> "$TMP_CONTENT_CFG"
|
echo "" >> "$TMP_CONTENT_CFG"
|
||||||
@@ -243,12 +249,13 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -s "$TMP_CONTENT_CFG" ]] && grep -q '\[templates\.' "$TMP_CONTENT_CFG"; then
|
if [[ -s "$TMP_CONTENT_CFG" ]] && grep -q '\[templates\.' "$TMP_CONTENT_CFG"; then
|
||||||
|
MAT_TERMINAL_MODE=(-m "$TERMINAL_MODE")
|
||||||
case "$kind" in
|
case "$kind" in
|
||||||
image)
|
image)
|
||||||
matugen -c "$TMP_CONTENT_CFG" image "$value" "${MAT_MODE[@]}" "${MAT_TYPE[@]}" >/dev/null
|
matugen -c "$TMP_CONTENT_CFG" image "$value" "${MAT_TERMINAL_MODE[@]}" "${MAT_TYPE[@]}" >/dev/null
|
||||||
;;
|
;;
|
||||||
hex)
|
hex)
|
||||||
matugen -c "$TMP_CONTENT_CFG" color hex "$value" "${MAT_MODE[@]}" "${MAT_TYPE[@]}" >/dev/null
|
matugen -c "$TMP_CONTENT_CFG" color hex "$value" "${MAT_TERMINAL_MODE[@]}" "${MAT_TYPE[@]}" >/dev/null
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -292,8 +299,13 @@ EOF
|
|||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TERMINAL_LIGHT_FLAG=""
|
||||||
|
if [[ "$TERMINALS_ALWAYS_DARK" != "true" ]] && [[ "$mode" == "light" ]]; then
|
||||||
|
TERMINAL_LIGHT_FLAG="--light"
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v ghostty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/ghostty/config-dankcolors" ]]; then
|
if command -v ghostty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/ghostty/config-dankcolors" ]]; then
|
||||||
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --ghostty 2>/dev/null || true)
|
OUT=$(dms dank16 "$PRIMARY" $TERMINAL_LIGHT_FLAG ${SURFACE:+--background "$SURFACE"} --ghostty 2>/dev/null || true)
|
||||||
if [[ -n "${OUT:-}" ]]; then
|
if [[ -n "${OUT:-}" ]]; then
|
||||||
printf "\n%s\n" "$OUT" >> "$CONFIG_DIR/ghostty/config-dankcolors"
|
printf "\n%s\n" "$OUT" >> "$CONFIG_DIR/ghostty/config-dankcolors"
|
||||||
if [[ -f "$CONFIG_DIR/ghostty/config" ]] && grep -q "^[^#]*config-dankcolors" "$CONFIG_DIR/ghostty/config" 2>/dev/null; then
|
if [[ -f "$CONFIG_DIR/ghostty/config" ]] && grep -q "^[^#]*config-dankcolors" "$CONFIG_DIR/ghostty/config" 2>/dev/null; then
|
||||||
@@ -303,7 +315,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v kitty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/kitty/dank-theme.conf" ]]; then
|
if command -v kitty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/kitty/dank-theme.conf" ]]; then
|
||||||
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --kitty 2>/dev/null || true)
|
OUT=$(dms dank16 "$PRIMARY" $TERMINAL_LIGHT_FLAG ${SURFACE:+--background "$SURFACE"} --kitty 2>/dev/null || true)
|
||||||
if [[ -n "${OUT:-}" ]]; then
|
if [[ -n "${OUT:-}" ]]; then
|
||||||
printf "\n%s\n" "$OUT" >> "$CONFIG_DIR/kitty/dank-theme.conf"
|
printf "\n%s\n" "$OUT" >> "$CONFIG_DIR/kitty/dank-theme.conf"
|
||||||
if [[ -f "$CONFIG_DIR/kitty/kitty.conf" ]] && grep -q "^[^#]*dank-theme.conf" "$CONFIG_DIR/kitty/kitty.conf" 2>/dev/null; then
|
if [[ -f "$CONFIG_DIR/kitty/kitty.conf" ]] && grep -q "^[^#]*dank-theme.conf" "$CONFIG_DIR/kitty/kitty.conf" 2>/dev/null; then
|
||||||
@@ -320,7 +332,7 @@ EOF
|
|||||||
echo "[colors]" > "$FOOT_CONFIG"
|
echo "[colors]" > "$FOOT_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --foot 2>/dev/null || true)
|
OUT=$(dms dank16 "$PRIMARY" $TERMINAL_LIGHT_FLAG ${SURFACE:+--background "$SURFACE"} --foot 2>/dev/null || true)
|
||||||
if [[ -n "${OUT:-}" ]]; then
|
if [[ -n "${OUT:-}" ]]; then
|
||||||
printf "\n%s\n" "$OUT" >> "$FOOT_CONFIG"
|
printf "\n%s\n" "$OUT" >> "$FOOT_CONFIG"
|
||||||
fi
|
fi
|
||||||
@@ -334,7 +346,7 @@ EOF
|
|||||||
touch "$WEZTERM_CONFIG"
|
touch "$WEZTERM_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --wezterm 2>/dev/null || true)
|
OUT=$(dms dank16 "$PRIMARY" $TERMINAL_LIGHT_FLAG ${SURFACE:+--background "$SURFACE"} --wezterm 2>/dev/null || true)
|
||||||
if [[ -n "${OUT:-}" ]]; then
|
if [[ -n "${OUT:-}" ]]; then
|
||||||
printf "\n%s\n" "$OUT" >>"$WEZTERM_CONFIG"
|
printf "\n%s\n" "$OUT" >>"$WEZTERM_CONFIG"
|
||||||
fi
|
fi
|
||||||
@@ -348,7 +360,7 @@ EOF
|
|||||||
touch "$ALACRITTY_CONFIG"
|
touch "$ALACRITTY_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${SURFACE:+--background "$SURFACE"} --alacritty 2>/dev/null || true)
|
OUT=$(dms dank16 "$PRIMARY" $TERMINAL_LIGHT_FLAG ${SURFACE:+--background "$SURFACE"} --alacritty 2>/dev/null || true)
|
||||||
if [[ -n "${OUT:-}" ]]; then
|
if [[ -n "${OUT:-}" ]]; then
|
||||||
printf "\n%s\n" "$OUT" >> "$ALACRITTY_CONFIG"
|
printf "\n%s\n" "$OUT" >> "$ALACRITTY_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user