mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-22 03:04:01 -04:00
core: only use the simple animation driver for the scrolling wallpaper
fixes #3837
This commit is contained in:
@@ -2,8 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/duxlabs-dev/dux-go/shellapp"
|
||||
@@ -83,12 +85,36 @@ func preLaunch() {
|
||||
ensureFontCache()
|
||||
}
|
||||
|
||||
// The elapsed-timer driver keeps the scrolling wallpaper spring in step above 60 Hz,
|
||||
// but it makes every other animation jump after a dropped frame (#3837).
|
||||
func scrollingWallpaperConfigured() bool {
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
data, err := os.ReadFile(filepath.Join(configDir, "dms", "settings.json"))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return wantsSimpleAnimationDriver(data)
|
||||
}
|
||||
|
||||
func wantsSimpleAnimationDriver(settings []byte) bool {
|
||||
var parsed struct {
|
||||
WallpaperFillMode string `json:"wallpaperFillMode"`
|
||||
}
|
||||
if json.Unmarshal(settings, &parsed) != nil {
|
||||
return false
|
||||
}
|
||||
return parsed.WallpaperFillMode == "Scrolling"
|
||||
}
|
||||
|
||||
func dmsExtraEnv(string) []string {
|
||||
var env []string
|
||||
if selfPath, err := os.Executable(); err == nil {
|
||||
env = append(env, "DMS_EXECUTABLE="+selfPath)
|
||||
}
|
||||
if os.Getenv("QSG_USE_SIMPLE_ANIMATION_DRIVER") == "" {
|
||||
if os.Getenv("QSG_USE_SIMPLE_ANIMATION_DRIVER") == "" && scrollingWallpaperConfigured() {
|
||||
env = append(env, "QSG_USE_SIMPLE_ANIMATION_DRIVER=1")
|
||||
}
|
||||
if _, set := os.LookupEnv("MALLOC_CONF"); !set {
|
||||
|
||||
@@ -399,12 +399,16 @@ Column {
|
||||
|
||||
readonly property var fillModes: ["Stretch", "Fit", "Fill", "Scrolling", "Tile", "TileVertically", "TileHorizontally", "Pad"]
|
||||
readonly property var fillModeLabels: [I18n.tr("Stretch", "wallpaper fill mode"), I18n.tr("Fit", "wallpaper fill mode"), I18n.tr("Fill", "wallpaper fill mode"), I18n.tr("Scroll", "wallpaper fill mode"), I18n.tr("Tile", "wallpaper fill mode"), I18n.tr("Tile Vertically", "wallpaper fill mode"), I18n.tr("Tile Horizontally", "wallpaper fill mode"), I18n.tr("Pad", "wallpaper fill mode")]
|
||||
// dms picks the animation driver at launch from this setting
|
||||
readonly property bool simpleAnimationDriver: Quickshell.env("QSG_USE_SIMPLE_ANIMATION_DRIVER") === "1"
|
||||
readonly property bool driverMismatch: (SettingsData.wallpaperFillMode === "Scrolling") !== simpleAnimationDriver
|
||||
|
||||
tab: "wallpaper"
|
||||
tags: ["background", "fill", "fit", "stretch", "tile", "scale"]
|
||||
settingKey: "wallpaperFillMode"
|
||||
resetKeys: root.perMonitor ? [] : ["wallpaperFillMode"]
|
||||
text: I18n.tr("Fill mode")
|
||||
description: driverMismatch ? I18n.tr("Requires restart") : ""
|
||||
visible: root.wallpaperIsImage
|
||||
dropdownWidth: 190
|
||||
options: fillModeLabels
|
||||
|
||||
@@ -286,6 +286,11 @@ def extract_i18n_string(value):
|
||||
return None
|
||||
|
||||
|
||||
def is_status_notice(value):
|
||||
"""A description with an empty branch only shows while some state holds; it is not searchable text."""
|
||||
return re.search(r"""\?\s*(""|'')\s*:|:\s*(""|'')\s*$""", value.strip()) is not None
|
||||
|
||||
|
||||
def extract_tags(value):
|
||||
match = re.search(r"\[([^\]]+)\]", value)
|
||||
if not match:
|
||||
@@ -489,7 +494,7 @@ def find_settings_components(content, filename, wrappers, tab_meta, hub_meta):
|
||||
|
||||
desc_raw = extract_property(own, "description") or extract_property(own, "summary") or defaults.get("description") or borrowed_description(block, setting_key)
|
||||
description = None
|
||||
if desc_raw:
|
||||
if desc_raw and not is_status_notice(desc_raw):
|
||||
description = extract_i18n_string(desc_raw)
|
||||
|
||||
visible_raw = extract_property(own_scope(block), "visible")
|
||||
|
||||
@@ -11276,7 +11276,6 @@
|
||||
"tabIndex": 25,
|
||||
"category": "Gamma control",
|
||||
"keywords": [
|
||||
"available",
|
||||
"blue light",
|
||||
"color",
|
||||
"color temperature",
|
||||
@@ -11291,15 +11290,13 @@
|
||||
"output",
|
||||
"outputs",
|
||||
"redshift",
|
||||
"requires",
|
||||
"resolution",
|
||||
"screen",
|
||||
"screens",
|
||||
"temperature",
|
||||
"warm"
|
||||
],
|
||||
"parentLabel": "Displays",
|
||||
"description": "Gamma control not available. Requires DMS API v6+."
|
||||
"parentLabel": "Displays"
|
||||
},
|
||||
{
|
||||
"section": "nightModeTransitionMinutes",
|
||||
@@ -15897,12 +15894,10 @@
|
||||
"schedule",
|
||||
"settings",
|
||||
"share",
|
||||
"shared",
|
||||
"tint",
|
||||
"wallpaper"
|
||||
],
|
||||
"parentLabel": "Wallpaper & colors",
|
||||
"description": "Using shared settings from Gamma Control"
|
||||
"parentLabel": "Wallpaper & colors"
|
||||
},
|
||||
{
|
||||
"section": "wallpaperCycling",
|
||||
|
||||
@@ -19,7 +19,7 @@ if [[ -n "${QS_ARGS:-}" ]]; then
|
||||
# shellcheck disable=SC2206
|
||||
qs_args=($QS_ARGS)
|
||||
else
|
||||
state_file="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/danklinux.path"
|
||||
state_file="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/dms.path"
|
||||
config_path="$(cat "$state_file" 2>/dev/null || true)"
|
||||
[[ -n "$config_path" ]] || { echo "no running dms shell ($state_file missing)" >&2; exit 1; }
|
||||
qs_args=(-p "$config_path")
|
||||
|
||||
Reference in New Issue
Block a user