mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-02 03:28:28 -04:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| accdd0972c | |||
| 00c28f69fd | |||
| 2e0337b68c | |||
| 4975960ea4 | |||
| 0381a112b3 | |||
| ed5e2a22c0 | |||
| 847718459c | |||
| 95b120b475 | |||
| 4dd2f1d5be | |||
| bf5faf725b | |||
| e5eff919b8 | |||
| 606115748a | |||
| ad936bfdc9 | |||
| 110396cb2a | |||
| 7b08e61863 | |||
| 876ead665b | |||
| 74896fb87c | |||
| f1f528b2cb | |||
| 9853e1431b | |||
| e7b8196a4a | |||
| 85ebb402cb | |||
| f37f4a1f35 | |||
| fc11dfbc57 | |||
| 7806cf4a58 | |||
| 89895da4fa | |||
| 4ff93bf46e | |||
| 63ffd7caec | |||
| dac08b34c6 | |||
| 840a448b4a | |||
| 26d429fa31 | |||
| fd20cce9b7 | |||
| ad5a96d95b | |||
| 8ba5e1a082 | |||
| 7d6a7bae06 | |||
| 986a6e0230 | |||
| 64ba1fbb1b | |||
| ab9df791b3 | |||
| 65f4a9a044 | |||
| 59164cbd30 | |||
| 7ab1f6a956 | |||
| 841167ac44 | |||
| c2a6a7aebd | |||
| b17ef80c91 | |||
| a55177f1d2 | |||
| 3d0ce17a8c |
@@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
steps:
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
@@ -55,6 +55,15 @@ jobs:
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.app_token.outputs.token }}
|
||||
|
||||
- name: Preflight — verify Release workflow is dispatchable
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh api "repos/${{ github.repository }}/actions/workflows/release.yml" \
|
||||
--jq '.state' | grep -qx active ||
|
||||
{ echo "::error::release.yml is not dispatchable; aborting before any push"; exit 1; }
|
||||
|
||||
- name: Port audit (informational)
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app_token.outputs.token }}
|
||||
@@ -83,7 +92,7 @@ jobs:
|
||||
|
||||
- name: Dispatch Release workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app_token.outputs.token }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh workflow run release.yml --ref "${{ steps.derive.outputs.tag }}" \
|
||||
-f tag="${{ steps.derive.outputs.tag }}" \
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
steps:
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
steps:
|
||||
- name: Create GitHub App token
|
||||
id: app_token
|
||||
uses: actions/create-github-app-token@v2
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ secrets.APP_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -91,21 +91,30 @@ var authListServicesCmd = &cobra.Command{
|
||||
|
||||
var authValidateCmd = &cobra.Command{
|
||||
Use: "validate",
|
||||
Short: "Validate a PAM service file for use as the DMS lock-screen password stack",
|
||||
Long: "Validate one PAM service (by --service NAME or --path /abs/file) for use as the DMS lock-screen password stack. Exits 1 when the file is not usable.",
|
||||
Short: "Validate a PAM service file for use by the DMS lock screen",
|
||||
Long: "Validate one PAM service (by --service NAME or --path /abs/file) for use as the DMS lock-screen password or dedicated U2F stack. Exits 1 when the file is not usable.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
path, _ := cmd.Flags().GetString("path")
|
||||
service, _ := cmd.Flags().GetString("service")
|
||||
purpose, _ := cmd.Flags().GetString("purpose")
|
||||
asJSON, _ := cmd.Flags().GetBool("json")
|
||||
|
||||
if (path == "") == (service == "") {
|
||||
log.Fatalf("Error: exactly one of --path or --service is required")
|
||||
}
|
||||
|
||||
if purpose != "password" && purpose != "u2f" {
|
||||
log.Fatalf("Error: --purpose must be password or u2f")
|
||||
}
|
||||
|
||||
var result sharedpam.LockscreenPamValidation
|
||||
switch {
|
||||
case service != "":
|
||||
result = sharedpam.ValidateLockscreenPamService(service)
|
||||
if purpose == "u2f" {
|
||||
result = sharedpam.ValidateLockscreenU2fPamService(service)
|
||||
} else {
|
||||
result = sharedpam.ValidateLockscreenPamService(service)
|
||||
}
|
||||
case !filepath.IsAbs(path):
|
||||
result = sharedpam.LockscreenPamValidation{
|
||||
Path: path,
|
||||
@@ -114,7 +123,11 @@ var authValidateCmd = &cobra.Command{
|
||||
Errors: []string{"--path must be an absolute file path"},
|
||||
}
|
||||
default:
|
||||
result = sharedpam.ValidateLockscreenPamPath(path)
|
||||
if purpose == "u2f" {
|
||||
result = sharedpam.ValidateLockscreenU2fPamPath(path)
|
||||
} else {
|
||||
result = sharedpam.ValidateLockscreenPamPath(path)
|
||||
}
|
||||
}
|
||||
|
||||
if asJSON {
|
||||
@@ -159,6 +172,7 @@ func init() {
|
||||
|
||||
authValidateCmd.Flags().String("path", "", "Absolute path to a PAM service file to validate")
|
||||
authValidateCmd.Flags().String("service", "", "Name of a PAM service to resolve across the system PAM dirs")
|
||||
authValidateCmd.Flags().String("purpose", "password", "Validation purpose: password or u2f")
|
||||
authValidateCmd.Flags().Bool("json", false, "Output as JSON")
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,9 @@ Modes:
|
||||
full - Capture the focused output
|
||||
all - Capture all outputs combined
|
||||
output - Capture a specific output by name
|
||||
window - Capture the focused window (Hyprland/Mango)
|
||||
window - Capture the focused window (Hyprland/Mango/niri)
|
||||
last - Capture the last selected region
|
||||
scroll - Select a region, then scroll to capture a stitched tall image
|
||||
|
||||
Output format (--format):
|
||||
png - PNG format (default)
|
||||
@@ -72,7 +73,9 @@ Examples:
|
||||
dms screenshot --no-confirm # Region capture on mouse release
|
||||
dms screenshot --cursor=on # Include cursor
|
||||
dms screenshot -f jpg -q 85 # JPEG with quality 85
|
||||
dms screenshot --json # Print capture metadata as JSON`,
|
||||
dms screenshot --json # Print capture metadata as JSON
|
||||
dms screenshot scroll # Scroll capture, Enter finishes / Esc cancels
|
||||
dms screenshot scroll --interval 250`,
|
||||
}
|
||||
|
||||
var ssRegionCmd = &cobra.Command{
|
||||
@@ -110,10 +113,33 @@ If no previous region exists, falls back to interactive selection.`,
|
||||
var ssWindowCmd = &cobra.Command{
|
||||
Use: "window",
|
||||
Short: "Capture the focused window",
|
||||
Long: `Capture the currently focused window. Supported on Hyprland and Mango.`,
|
||||
Long: `Capture the currently focused window. Supported on Hyprland, Mango, and niri.`,
|
||||
Run: runScreenshotWindow,
|
||||
}
|
||||
|
||||
var ssScrollInterval int
|
||||
|
||||
var ssScrollCmd = &cobra.Command{
|
||||
Use: "scroll",
|
||||
Short: "Capture a scrolling region stitched into one tall image",
|
||||
Long: `Select a region, then scroll the content beneath with the mouse wheel or
|
||||
touchpad while frames are captured and stitched vertically. Finish with the
|
||||
on-screen done button; cancel with the cancel button. Enter and Esc work
|
||||
everywhere: most compositors hold the keyboard on the overlay (keyboard
|
||||
scrolling does not reach the app there), while Hyprland leaves the keyboard
|
||||
with the application — keyboard scrolling works, and Enter/Esc act through
|
||||
temporary global binds for the session. The cursor is never included in
|
||||
frames.
|
||||
|
||||
Frames are stitched continuously while scrolling, and revisited content is
|
||||
never duplicated — scrolling up past the starting point extends the image
|
||||
upward. Content jumped past faster than capture can follow is skipped rather
|
||||
than stitched incorrectly.
|
||||
|
||||
Rotated outputs are not supported.`,
|
||||
Run: runScreenshotScroll,
|
||||
}
|
||||
|
||||
var ssListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List available outputs",
|
||||
@@ -143,7 +169,10 @@ func init() {
|
||||
screenshotCmd.PersistentFlags().BoolVar(&ssStdout, "stdout", false, "Output image to stdout (for piping to swappy, etc.)")
|
||||
screenshotCmd.PersistentFlags().BoolVar(&ssJSON, "json", false, "Print capture metadata as JSON")
|
||||
|
||||
ssScrollCmd.Flags().IntVar(&ssScrollInterval, "interval", 45, "Capture interval in milliseconds (30-1000)")
|
||||
|
||||
screenshotCmd.AddCommand(ssRegionCmd)
|
||||
screenshotCmd.AddCommand(ssScrollCmd)
|
||||
screenshotCmd.AddCommand(ssFullCmd)
|
||||
screenshotCmd.AddCommand(ssAllCmd)
|
||||
screenshotCmd.AddCommand(ssOutputCmd)
|
||||
@@ -249,7 +278,7 @@ func runScreenshot(config screenshot.Config) {
|
||||
|
||||
// Region select needs the keyboard; drop popout grabs for its duration.
|
||||
result, err := func() (*screenshot.CaptureResult, error) {
|
||||
interactive := config.Mode == screenshot.ModeRegion || config.Mode == screenshot.ModeLastRegion
|
||||
interactive := config.Mode == screenshot.ModeRegion || config.Mode == screenshot.ModeLastRegion || config.Mode == screenshot.ModeScroll
|
||||
if interactive {
|
||||
setPopoutScreenshotMode(true)
|
||||
defer setPopoutScreenshotMode(false)
|
||||
@@ -437,6 +466,12 @@ func runScreenshotRegion(cmd *cobra.Command, args []string) {
|
||||
runScreenshot(config)
|
||||
}
|
||||
|
||||
func runScreenshotScroll(cmd *cobra.Command, args []string) {
|
||||
config := getScreenshotConfig(screenshot.ModeScroll)
|
||||
config.IntervalMs = min(max(ssScrollInterval, 30), 1000)
|
||||
runScreenshot(config)
|
||||
}
|
||||
|
||||
func runScreenshotFull(cmd *cobra.Command, args []string) {
|
||||
config := getScreenshotConfig(screenshot.ModeFullScreen)
|
||||
runScreenshot(config)
|
||||
|
||||
@@ -124,7 +124,9 @@ func GetLogger() *Logger {
|
||||
logger = &Logger{base}
|
||||
|
||||
if path := os.Getenv("DMS_LOG_FILE"); path != "" {
|
||||
_ = SetLogFile(path)
|
||||
logMu.Lock()
|
||||
_ = setLogFile(logger, path)
|
||||
logMu.Unlock()
|
||||
}
|
||||
})
|
||||
return logger
|
||||
@@ -145,15 +147,18 @@ func SetLevel(level string) {
|
||||
// profile when stderr is a TTY and route the file through ansiStripWriter so
|
||||
// the file stays plain while stderr keeps its colors.
|
||||
func SetLogFile(path string) error {
|
||||
l := GetLogger()
|
||||
logMu.Lock()
|
||||
defer logMu.Unlock()
|
||||
return setLogFile(l, path)
|
||||
}
|
||||
|
||||
func setLogFile(l *Logger, path string) error {
|
||||
if logFile != nil {
|
||||
logFile.Close()
|
||||
logFile = nil
|
||||
}
|
||||
|
||||
l := GetLogger()
|
||||
if path == "" {
|
||||
l.SetOutput(logStderr)
|
||||
applyColorProfile(l, logStderr)
|
||||
|
||||
@@ -44,6 +44,7 @@ type TemplateDef struct {
|
||||
ID string
|
||||
Commands []string
|
||||
Flatpaks []string
|
||||
ConfigDirs []string
|
||||
ConfigFile string
|
||||
Kind TemplateKind
|
||||
RunUnconditionally bool
|
||||
@@ -60,9 +61,9 @@ var templateRegistry = []TemplateDef{
|
||||
{ID: "firefox", Commands: []string{"firefox"}, ConfigFile: "firefox.toml"},
|
||||
{ID: "pywalfox", Commands: []string{"pywalfox"}, ConfigFile: "pywalfox.toml"},
|
||||
{ID: "zenbrowser", Commands: []string{"zen", "zen-browser", "zen-beta", "zen-twilight"}, Flatpaks: []string{"app.zen_browser.zen"}, ConfigFile: "zenbrowser.toml"},
|
||||
{ID: "vesktop", Commands: []string{"vesktop"}, Flatpaks: []string{"dev.vencord.Vesktop"}, ConfigFile: "vesktop.toml"},
|
||||
{ID: "vencord", Commands: []string{"discord", "Discord", "discord-canary", "DiscordCanary"}, Flatpaks: []string{"com.discordapp.Discord", "com.discordapp.DiscordCanary"}, ConfigFile: "vencord.toml"},
|
||||
{ID: "equibop", Commands: []string{"equibop"}, ConfigFile: "equibop.toml"},
|
||||
{ID: "vesktop", Commands: []string{"vesktop"}, Flatpaks: []string{"dev.vencord.Vesktop"}, ConfigDirs: []string{"vesktop"}, ConfigFile: "vesktop.toml"},
|
||||
{ID: "vencord", Commands: []string{"discord", "Discord", "discord-canary", "DiscordCanary"}, Flatpaks: []string{"com.discordapp.Discord", "com.discordapp.DiscordCanary"}, ConfigDirs: []string{"Vencord"}, ConfigFile: "vencord.toml"},
|
||||
{ID: "equibop", Commands: []string{"equibop"}, ConfigDirs: []string{"equibop"}, ConfigFile: "equibop.toml"},
|
||||
{ID: "ghostty", Commands: []string{"ghostty"}, ConfigFile: "ghostty.toml", Kind: TemplateKindTerminal},
|
||||
{ID: "kitty", Commands: []string{"kitty"}, ConfigFile: "kitty.toml", Kind: TemplateKindTerminal},
|
||||
{ID: "foot", Commands: []string{"foot"}, ConfigFile: "foot.toml", Kind: TemplateKindTerminal},
|
||||
@@ -459,9 +460,9 @@ output_path = '%s'
|
||||
case TemplateKindGTK:
|
||||
switch opts.Mode {
|
||||
case ColorModeLight:
|
||||
appendConfig(opts, cfgFile, nil, nil, "gtk3-light.toml")
|
||||
appendConfig(opts, cfgFile, nil, nil, nil, "gtk3-light.toml")
|
||||
default:
|
||||
appendConfig(opts, cfgFile, nil, nil, "gtk3-dark.toml")
|
||||
appendConfig(opts, cfgFile, nil, nil, nil, "gtk3-dark.toml")
|
||||
}
|
||||
case TemplateKindTerminal:
|
||||
appendTerminalConfig(opts, cfgFile, tmpDir, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigFile)
|
||||
@@ -474,10 +475,10 @@ output_path = '%s'
|
||||
appendVSCodeConfig(cfgFile, "vscode-insiders", filepath.Join(homeDir, ".vscode-insiders/extensions"), opts.ShellDir)
|
||||
case TemplateKindEmacs:
|
||||
if utils.EmacsConfigDir() != "" {
|
||||
appendConfig(opts, cfgFile, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigFile)
|
||||
appendConfig(opts, cfgFile, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigDirs, tmpl.ConfigFile)
|
||||
}
|
||||
default:
|
||||
appendConfig(opts, cfgFile, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigFile)
|
||||
appendConfig(opts, cfgFile, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigDirs, tmpl.ConfigFile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,13 +513,14 @@ func appendConfig(
|
||||
cfgFile *os.File,
|
||||
checkCmd []string,
|
||||
checkFlatpaks []string,
|
||||
checkConfigDirs []string,
|
||||
fileName string,
|
||||
) {
|
||||
configPath := filepath.Join(opts.ShellDir, "matugen", "configs", fileName)
|
||||
if _, err := os.Stat(configPath); err != nil {
|
||||
return
|
||||
}
|
||||
if !appExists(opts.AppChecker, checkCmd, checkFlatpaks) {
|
||||
if !appExists(opts.AppChecker, checkCmd, checkFlatpaks) && !configDirExists(checkConfigDirs) {
|
||||
return
|
||||
}
|
||||
data, err := os.ReadFile(configPath)
|
||||
@@ -599,6 +601,20 @@ func templateSessionActive(tmpl TemplateDef) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func configDirExists(names []string) bool {
|
||||
configHome := utils.XDGConfigHome()
|
||||
if configHome == "" {
|
||||
return false
|
||||
}
|
||||
for _, name := range names {
|
||||
info, err := os.Stat(filepath.Join(configHome, name))
|
||||
if err == nil && info.IsDir() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func appExists(checker utils.AppChecker, checkCmd []string, checkFlatpaks []string) bool {
|
||||
// Both nil is treated as "skip check" / unconditionally run
|
||||
if checkCmd == nil && checkFlatpaks == nil {
|
||||
@@ -1096,7 +1112,7 @@ func CheckTemplates(checker utils.AppChecker) []TemplateCheck {
|
||||
case tmpl.Kind == TemplateKindEmacs:
|
||||
detected = appExists(checker, tmpl.Commands, tmpl.Flatpaks) && utils.EmacsConfigDir() != ""
|
||||
default:
|
||||
detected = appExists(checker, tmpl.Commands, tmpl.Flatpaks) && templateSessionActive(tmpl)
|
||||
detected = (appExists(checker, tmpl.Commands, tmpl.Flatpaks) || configDirExists(tmpl.ConfigDirs)) && templateSessionActive(tmpl)
|
||||
}
|
||||
|
||||
checks = append(checks, TemplateCheck{ID: tmpl.ID, Detected: detected})
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestAppendConfigBinaryExists(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"sh"}, nil, "test.toml")
|
||||
appendConfig(opts, cfgFile, []string{"sh"}, nil, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -82,7 +82,7 @@ func TestAppendConfigBinaryDoesNotExist(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{}, "test.toml")
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{}, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -122,7 +122,7 @@ func TestAppendConfigFlatpakExists(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, nil, []string{"app.zen_browser.zen"}, "test.toml")
|
||||
appendConfig(opts, cfgFile, nil, []string{"app.zen_browser.zen"}, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -163,7 +163,7 @@ func TestAppendConfigFlatpakDoesNotExist(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{}, []string{"com.nonexistent.flatpak"}, "test.toml")
|
||||
appendConfig(opts, cfgFile, []string{}, []string{"com.nonexistent.flatpak"}, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -203,7 +203,7 @@ func TestAppendConfigBothExist(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"sh"}, []string{"app.zen_browser.zen"}, "test.toml")
|
||||
appendConfig(opts, cfgFile, []string{"sh"}, []string{"app.zen_browser.zen"}, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -244,7 +244,7 @@ func TestAppendConfigNeitherExists(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{"com.nonexistent.flatpak"}, "test.toml")
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{"com.nonexistent.flatpak"}, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -281,7 +281,7 @@ func TestAppendConfigNoChecks(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir}
|
||||
|
||||
appendConfig(opts, cfgFile, nil, nil, "test.toml")
|
||||
appendConfig(opts, cfgFile, nil, nil, nil, "test.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -312,7 +312,7 @@ func TestAppendConfigFileDoesNotExist(t *testing.T) {
|
||||
|
||||
opts := &Options{ShellDir: shellDir}
|
||||
|
||||
appendConfig(opts, cfgFile, nil, nil, "nonexistent.toml")
|
||||
appendConfig(opts, cfgFile, nil, nil, nil, "nonexistent.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
@@ -487,3 +487,90 @@ func TestBuildMergedConfigSkipsMangowcWithoutActiveSession(t *testing.T) {
|
||||
}
|
||||
assert.NotContains(t, string(output), "[templates.dmsmango]")
|
||||
}
|
||||
|
||||
func TestAppendConfigConfigDirExists(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
|
||||
shellDir := filepath.Join(tempDir, "shell")
|
||||
configsDir := filepath.Join(shellDir, "matugen", "configs")
|
||||
if err := os.MkdirAll(configsDir, 0o755); err != nil {
|
||||
t.Fatalf("failed to create configs dir: %v", err)
|
||||
}
|
||||
|
||||
testConfig := "vencord config content"
|
||||
if err := os.WriteFile(filepath.Join(configsDir, "vencord.toml"), []byte(testConfig), 0o644); err != nil {
|
||||
t.Fatalf("failed to write config: %v", err)
|
||||
}
|
||||
|
||||
configHome := filepath.Join(tempDir, "config")
|
||||
if err := os.MkdirAll(filepath.Join(configHome, "Vencord"), 0o755); err != nil {
|
||||
t.Fatalf("failed to create Vencord config dir: %v", err)
|
||||
}
|
||||
t.Setenv("XDG_CONFIG_HOME", configHome)
|
||||
|
||||
outFile := filepath.Join(tempDir, "output.toml")
|
||||
cfgFile, err := os.Create(outFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create output file: %v", err)
|
||||
}
|
||||
defer cfgFile.Close()
|
||||
|
||||
mockChecker := mocks_utils.NewMockAppChecker(t)
|
||||
mockChecker.EXPECT().AnyCommandExists("nonexistent-binary-12345").Return(false)
|
||||
mockChecker.EXPECT().AnyFlatpakExists("com.nonexistent.flatpak").Return(false)
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{"com.nonexistent.flatpak"}, []string{"Vencord"}, "vencord.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read output: %v", err)
|
||||
}
|
||||
|
||||
assert.Equal(t, testConfig+"\n", string(output))
|
||||
}
|
||||
|
||||
func TestAppendConfigConfigDirDoesNotExist(t *testing.T) {
|
||||
tempDir := t.TempDir()
|
||||
|
||||
shellDir := filepath.Join(tempDir, "shell")
|
||||
configsDir := filepath.Join(shellDir, "matugen", "configs")
|
||||
if err := os.MkdirAll(configsDir, 0o755); err != nil {
|
||||
t.Fatalf("failed to create configs dir: %v", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(filepath.Join(configsDir, "vencord.toml"), []byte("vencord config content"), 0o644); err != nil {
|
||||
t.Fatalf("failed to write config: %v", err)
|
||||
}
|
||||
|
||||
configHome := filepath.Join(tempDir, "config")
|
||||
if err := os.MkdirAll(configHome, 0o755); err != nil {
|
||||
t.Fatalf("failed to create config home: %v", err)
|
||||
}
|
||||
t.Setenv("XDG_CONFIG_HOME", configHome)
|
||||
|
||||
outFile := filepath.Join(tempDir, "output.toml")
|
||||
cfgFile, err := os.Create(outFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create output file: %v", err)
|
||||
}
|
||||
defer cfgFile.Close()
|
||||
|
||||
mockChecker := mocks_utils.NewMockAppChecker(t)
|
||||
mockChecker.EXPECT().AnyCommandExists("nonexistent-binary-12345").Return(false)
|
||||
mockChecker.EXPECT().AnyFlatpakExists("com.nonexistent.flatpak").Return(false)
|
||||
|
||||
opts := &Options{ShellDir: shellDir, AppChecker: mockChecker}
|
||||
|
||||
appendConfig(opts, cfgFile, []string{"nonexistent-binary-12345"}, []string{"com.nonexistent.flatpak"}, []string{"Vencord"}, "vencord.toml")
|
||||
|
||||
cfgFile.Close()
|
||||
output, err := os.ReadFile(outFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read output: %v", err)
|
||||
}
|
||||
|
||||
assert.Empty(t, string(output))
|
||||
}
|
||||
|
||||
@@ -646,6 +646,7 @@ type lockscreenPamAnalysis struct {
|
||||
inlineFingerprint bool
|
||||
inlineU2f bool
|
||||
modules []string
|
||||
authModules []string
|
||||
unknownDirectives []string
|
||||
err error
|
||||
}
|
||||
@@ -730,6 +731,9 @@ func (r lockscreenPamResolver) analyzeInto(path string, filterType string, stack
|
||||
}
|
||||
if !foundModule && strings.HasSuffix(field, ".so") {
|
||||
acc.modules = append(acc.modules, field)
|
||||
if lineType == "auth" {
|
||||
acc.authModules = append(acc.authModules, field)
|
||||
}
|
||||
foundModule = true
|
||||
}
|
||||
}
|
||||
@@ -774,6 +778,14 @@ func ValidateLockscreenPamPath(path string) LockscreenPamValidation {
|
||||
return validateLockscreenPam("", path, defaultValidateDeps())
|
||||
}
|
||||
|
||||
func ValidateLockscreenU2fPamService(name string) LockscreenPamValidation {
|
||||
return validateLockscreenU2fPam(name, "", defaultValidateDeps())
|
||||
}
|
||||
|
||||
func ValidateLockscreenU2fPamPath(path string) LockscreenPamValidation {
|
||||
return validateLockscreenU2fPam("", path, defaultValidateDeps())
|
||||
}
|
||||
|
||||
func validateLockscreenPam(serviceName string, path string, deps lockscreenPamValidateDeps) LockscreenPamValidation {
|
||||
result := LockscreenPamValidation{
|
||||
MissingModules: []string{},
|
||||
@@ -838,6 +850,64 @@ func validateLockscreenPam(serviceName string, path string, deps lockscreenPamVa
|
||||
return result
|
||||
}
|
||||
|
||||
func validateLockscreenU2fPam(serviceName string, path string, deps lockscreenPamValidateDeps) LockscreenPamValidation {
|
||||
result := validateLockscreenPam(serviceName, path, deps)
|
||||
if result.Path == "" {
|
||||
return result
|
||||
}
|
||||
|
||||
resolver := lockscreenPamResolver{baseDirs: deps.baseDirs, readFile: deps.readFile}
|
||||
analysis := resolver.analyzePath(result.Path)
|
||||
if analysis.err != nil {
|
||||
return result
|
||||
}
|
||||
|
||||
filteredWarnings := result.Warnings[:0]
|
||||
for _, warning := range result.Warnings {
|
||||
if strings.Contains(warning, "pam_u2f is present") && strings.Contains(warning, "double-prompt") {
|
||||
continue
|
||||
}
|
||||
filteredWarnings = append(filteredWarnings, warning)
|
||||
}
|
||||
result.Warnings = filteredWarnings
|
||||
|
||||
hasU2fAuth := false
|
||||
unsafeModules := []string{}
|
||||
unsafeSeen := map[string]bool{}
|
||||
for _, ref := range analysis.authModules {
|
||||
name := filepath.Base(ref)
|
||||
if name == "pam_u2f.so" {
|
||||
hasU2fAuth = true
|
||||
continue
|
||||
}
|
||||
switch name {
|
||||
case "pam_env.so", "pam_faildelay.so", "pam_nologin.so":
|
||||
continue
|
||||
default:
|
||||
if !unsafeSeen[name] {
|
||||
unsafeSeen[name] = true
|
||||
unsafeModules = append(unsafeModules, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !hasU2fAuth {
|
||||
result.Errors = append(result.Errors, "no pam_u2f auth directive found; select a dedicated security-key PAM service")
|
||||
}
|
||||
for _, name := range unsafeModules {
|
||||
result.Errors = append(result.Errors, fmt.Sprintf("additional auth module %s is not allowed in a dedicated security-key PAM service", name))
|
||||
}
|
||||
for _, name := range result.MissingModules {
|
||||
if strings.Contains(name, "pam_u2f") {
|
||||
result.Errors = append(result.Errors, fmt.Sprintf("%s is not installed or its configured path is unavailable", name))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
result.Valid = len(result.Errors) == 0
|
||||
return result
|
||||
}
|
||||
|
||||
func moduleReferenceExists(ref string, deps lockscreenPamValidateDeps) bool {
|
||||
if filepath.IsAbs(ref) {
|
||||
_, err := deps.stat(ref)
|
||||
@@ -895,7 +965,7 @@ func buildManagedLockscreenU2FPamContent() string {
|
||||
|
||||
func syncLockscreenPamConfigWithDeps(logFunc func(string), sudoPassword string, deps syncDeps) error {
|
||||
if deps.isNixOS() {
|
||||
logFunc("ℹ NixOS detected. DMS continues to use /etc/pam.d/login for lock screen password auth on NixOS unless you declare security.pam.services.dankshell yourself. U2F and fingerprint are handled separately and should not be included in dankshell.")
|
||||
logFunc("ℹ NixOS detected. DMS does not write /etc/pam.d/dankshell; the lock screen uses a sanitized password-only service in the user state directory unless you select a custom PAM source.")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -611,8 +611,8 @@ func TestSyncLockscreenPamConfigWithDeps(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("syncLockscreenPamConfigWithDeps returned error on NixOS path: %v", err)
|
||||
}
|
||||
if len(logs) == 0 || !strings.Contains(logs[0], "NixOS detected") || !strings.Contains(logs[0], "/etc/pam.d/login") {
|
||||
t.Fatalf("expected NixOS informational log mentioning /etc/pam.d/login, got %v", logs)
|
||||
if len(logs) == 0 || !strings.Contains(logs[0], "NixOS detected") || !strings.Contains(logs[0], "sanitized password-only service") {
|
||||
t.Fatalf("expected NixOS informational log describing the user-state fallback, got %v", logs)
|
||||
}
|
||||
if _, err := os.Stat(env.dankshellPath); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected no dankshell file to be written on NixOS path, stat err = %v", err)
|
||||
@@ -994,6 +994,84 @@ func TestValidateLockscreenPam(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestValidateLockscreenU2fPam(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("accepts a dedicated U2F stack with custom options", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newPamTestEnv(t)
|
||||
env.availableModules["pam_u2f.so"] = true
|
||||
env.writePamFile(t, "dankshell-u2f", "#%PAM-1.0\nauth required pam_u2f.so cue authfile=/etc/u2f-mappings\naccount required pam_permit.so\n")
|
||||
|
||||
result := validateLockscreenU2fPam("dankshell-u2f", "", env.validateDeps())
|
||||
if !result.Valid {
|
||||
t.Fatalf("expected valid dedicated U2F stack, got %+v", result)
|
||||
}
|
||||
if !result.InlineU2f {
|
||||
t.Fatalf("expected inline U2F detection, got %+v", result)
|
||||
}
|
||||
if containsSubstr(result.Warnings, "double-prompt") {
|
||||
t.Fatalf("dedicated U2F validation should not warn about its expected U2F module: %v", result.Warnings)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("rejects a primary login stack that also prompts for a password", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newPamTestEnv(t)
|
||||
env.availableModules["pam_unix.so"] = true
|
||||
env.availableModules["pam_u2f.so"] = true
|
||||
env.writePamFile(t, "login", "#%PAM-1.0\nauth required pam_unix.so\nauth required pam_u2f.so cue\naccount required pam_unix.so\n")
|
||||
|
||||
result := validateLockscreenU2fPam("login", "", env.validateDeps())
|
||||
if result.Valid {
|
||||
t.Fatalf("expected mixed password/U2F stack to be rejected, got %+v", result)
|
||||
}
|
||||
if !containsSubstr(result.Errors, "pam_unix.so") || !containsSubstr(result.Errors, "dedicated security-key") {
|
||||
t.Fatalf("expected actionable mixed-stack error, got %v", result.Errors)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("rejects a stack without pam_u2f", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newPamTestEnv(t)
|
||||
env.availableModules["pam_unix.so"] = true
|
||||
env.writePamFile(t, "password-only", "#%PAM-1.0\nauth required pam_unix.so\n")
|
||||
|
||||
result := validateLockscreenU2fPam("password-only", "", env.validateDeps())
|
||||
if result.Valid || !containsSubstr(result.Errors, "pam_u2f") {
|
||||
t.Fatalf("expected missing-U2F error, got %+v", result)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("does not accept a similarly named module as pam_u2f", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newPamTestEnv(t)
|
||||
env.availableModules["pam_u2f_helper.so"] = true
|
||||
env.writePamFile(t, "not-u2f", "#%PAM-1.0\nauth required pam_u2f_helper.so\n")
|
||||
|
||||
result := validateLockscreenU2fPam("not-u2f", "", env.validateDeps())
|
||||
if result.Valid || !containsSubstr(result.Errors, "no pam_u2f auth directive") {
|
||||
t.Fatalf("expected exact pam_u2f module validation, got %+v", result)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("rejects a missing pam_u2f module", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newPamTestEnv(t)
|
||||
env.writePamFile(t, "dankshell-u2f", "#%PAM-1.0\nauth required pam_u2f.so cue\n")
|
||||
|
||||
result := validateLockscreenU2fPam("dankshell-u2f", "", env.validateDeps())
|
||||
if result.Valid || !containsSubstr(result.Errors, "pam_u2f.so is not installed") {
|
||||
t.Fatalf("expected missing-module error, got %+v", result)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func containsSubstr(items []string, substr string) bool {
|
||||
for _, item := range items {
|
||||
if strings.Contains(item, substr) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package qmlchecks
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGreeterExternalAuthStatusUsesEffectiveFingerprintAvailability(t *testing.T) {
|
||||
data, err := os.ReadFile("../../../quickshell/Modules/Greetd/GreeterContent.qml")
|
||||
if err != nil {
|
||||
t.Fatalf("read greeter QML: %v", err)
|
||||
}
|
||||
|
||||
content := string(data)
|
||||
for _, required := range []string{
|
||||
"readonly property bool greeterPamHasExternalAuth: greeterPamHasFprint || greeterPamHasU2f",
|
||||
"if (greeterPamHasFprint && greeterPamHasU2f)",
|
||||
"if (greeterPamHasFprint)",
|
||||
} {
|
||||
if !strings.Contains(content, required) {
|
||||
t.Fatalf("greeter external-auth status must contain %q", required)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,3 +23,51 @@ func TestLockScreenPasswordFieldBypassesTextInputIME(t *testing.T) {
|
||||
t.Fatalf("passwordField should handle physical key text manually instead of relying on a text input control")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLockScreenAuthenticationCardOwnsFactorControls(t *testing.T) {
|
||||
data, err := os.ReadFile("../../../quickshell/Modules/Settings/LockScreenTab.qml")
|
||||
if err != nil {
|
||||
t.Fatalf("read lock screen settings QML: %v", err)
|
||||
}
|
||||
|
||||
content := string(data)
|
||||
authCard := strings.Index(content, `title: I18n.tr("Authentication")`)
|
||||
behaviorCard := strings.Index(content, `title: I18n.tr("Behavior")`)
|
||||
fingerprintToggle := strings.Index(content, `settingKey: "enableFprint"`)
|
||||
u2fToggle := strings.Index(content, `settingKey: "enableU2f"`)
|
||||
u2fSource := strings.Index(content, `settingKey: "lockU2fPamPath"`)
|
||||
if authCard < 0 || behaviorCard < 0 || fingerprintToggle < 0 || u2fToggle < 0 || u2fSource < 0 {
|
||||
t.Fatalf("expected authentication card, factor toggles, and U2F source setting")
|
||||
}
|
||||
for name, position := range map[string]int{
|
||||
"fingerprint toggle": fingerprintToggle,
|
||||
"U2F toggle": u2fToggle,
|
||||
"U2F source": u2fSource,
|
||||
} {
|
||||
if position < authCard || position > behaviorCard {
|
||||
t.Fatalf("%s must remain in the authentication card", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLockScreenPamSupportsManagedAndSystemPolicies(t *testing.T) {
|
||||
data, err := os.ReadFile("../../../quickshell/Modules/Lock/Pam.qml")
|
||||
if err != nil {
|
||||
t.Fatalf("read lock screen PAM QML: %v", err)
|
||||
}
|
||||
|
||||
content := string(data)
|
||||
for _, required := range []string{
|
||||
"SettingsData.lockPamExternallyManaged",
|
||||
"SettingsData.lockU2fPamPath",
|
||||
"customU2fPamActive",
|
||||
"u2fSuppressedByPrimaryPam",
|
||||
} {
|
||||
if !strings.Contains(content, required) {
|
||||
t.Fatalf("lock screen PAM must contain %q", required)
|
||||
}
|
||||
}
|
||||
if strings.Contains(content, "runningFromNixStore || resolveUserPam.running") {
|
||||
t.Fatalf("DMS-managed policy must generate the sanitized user PAM stack on Nix-store installs")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,41 +30,30 @@ func DetectCompositor() Compositor {
|
||||
return detectedCompositor
|
||||
}
|
||||
|
||||
hyprlandSig := os.Getenv("HYPRLAND_INSTANCE_SIGNATURE")
|
||||
niriSocket := os.Getenv("NIRI_SOCKET")
|
||||
swaySocket := os.Getenv("SWAYSOCK")
|
||||
scrollSocket := os.Getenv("SCROLLSOCK")
|
||||
miracleSocket := os.Getenv("MIRACLESOCK")
|
||||
mangoSocket := os.Getenv("MANGO_INSTANCE_SIGNATURE")
|
||||
candidates := []struct {
|
||||
socket string
|
||||
needsStat bool
|
||||
compositor Compositor
|
||||
}{
|
||||
{os.Getenv("MANGO_INSTANCE_SIGNATURE"), true, CompositorMango},
|
||||
{os.Getenv("NIRI_SOCKET"), true, CompositorNiri},
|
||||
{os.Getenv("SCROLLSOCK"), true, CompositorScroll},
|
||||
{os.Getenv("MIRACLESOCK"), true, CompositorMiracle},
|
||||
{os.Getenv("SWAYSOCK"), true, CompositorSway},
|
||||
{os.Getenv("HYPRLAND_INSTANCE_SIGNATURE"), false, CompositorHyprland},
|
||||
}
|
||||
|
||||
switch {
|
||||
case mangoSocket != "":
|
||||
if _, err := os.Stat(mangoSocket); err == nil {
|
||||
detectedCompositor = CompositorMango
|
||||
return detectedCompositor
|
||||
// A stale env var from a previous session must not mask the live compositor
|
||||
for _, c := range candidates {
|
||||
if c.socket == "" {
|
||||
continue
|
||||
}
|
||||
case niriSocket != "":
|
||||
if _, err := os.Stat(niriSocket); err == nil {
|
||||
detectedCompositor = CompositorNiri
|
||||
return detectedCompositor
|
||||
if c.needsStat {
|
||||
if _, err := os.Stat(c.socket); err != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
case scrollSocket != "":
|
||||
if _, err := os.Stat(scrollSocket); err == nil {
|
||||
detectedCompositor = CompositorScroll
|
||||
return detectedCompositor
|
||||
}
|
||||
case miracleSocket != "":
|
||||
if _, err := os.Stat(miracleSocket); err == nil {
|
||||
detectedCompositor = CompositorMiracle
|
||||
return detectedCompositor
|
||||
}
|
||||
case swaySocket != "":
|
||||
if _, err := os.Stat(swaySocket); err == nil {
|
||||
detectedCompositor = CompositorSway
|
||||
return detectedCompositor
|
||||
}
|
||||
case hyprlandSig != "":
|
||||
detectedCompositor = CompositorHyprland
|
||||
detectedCompositor = c.compositor
|
||||
return detectedCompositor
|
||||
}
|
||||
|
||||
@@ -90,7 +79,7 @@ func GetActiveWindow() (*WindowGeometry, error) {
|
||||
case CompositorMango:
|
||||
return getMangoActiveWindow()
|
||||
default:
|
||||
return nil, fmt.Errorf("window capture requires Hyprland or Mango")
|
||||
return nil, fmt.Errorf("window capture requires Hyprland, Mango, or niri")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,58 @@ func BufferToImageWithFormat(buf *ShmBuffer, format uint32) *image.RGBA {
|
||||
return img
|
||||
}
|
||||
|
||||
func ImageToBuffer(img image.Image) (*ShmBuffer, error) {
|
||||
bounds := img.Bounds()
|
||||
w, h := bounds.Dx(), bounds.Dy()
|
||||
buf, err := CreateShmBuffer(w, h, w*4)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data := buf.Data()
|
||||
switch src := img.(type) {
|
||||
case *image.NRGBA:
|
||||
for y := range h {
|
||||
srcOff := y * src.Stride
|
||||
dstOff := y * buf.Stride
|
||||
for x := range w {
|
||||
si, di := srcOff+x*4, dstOff+x*4
|
||||
a := uint32(src.Pix[si+3])
|
||||
data[di+0] = uint8(uint32(src.Pix[si+2]) * a / 255)
|
||||
data[di+1] = uint8(uint32(src.Pix[si+1]) * a / 255)
|
||||
data[di+2] = uint8(uint32(src.Pix[si+0]) * a / 255)
|
||||
data[di+3] = uint8(a)
|
||||
}
|
||||
}
|
||||
case *image.RGBA:
|
||||
for y := range h {
|
||||
srcOff := y * src.Stride
|
||||
dstOff := y * buf.Stride
|
||||
for x := range w {
|
||||
si, di := srcOff+x*4, dstOff+x*4
|
||||
data[di+0] = src.Pix[si+2]
|
||||
data[di+1] = src.Pix[si+1]
|
||||
data[di+2] = src.Pix[si+0]
|
||||
data[di+3] = src.Pix[si+3]
|
||||
}
|
||||
}
|
||||
default:
|
||||
for y := range h {
|
||||
dstOff := y * buf.Stride
|
||||
for x := range w {
|
||||
cr, cg, cb, ca := img.At(bounds.Min.X+x, bounds.Min.Y+y).RGBA()
|
||||
di := dstOff + x*4
|
||||
data[di+0] = uint8(cb >> 8)
|
||||
data[di+1] = uint8(cg >> 8)
|
||||
data[di+2] = uint8(cr >> 8)
|
||||
data[di+3] = uint8(ca >> 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.Format = FormatARGB8888
|
||||
return buf, nil
|
||||
}
|
||||
|
||||
func EncodePNG(w io.Writer, img image.Image) error {
|
||||
enc := png.Encoder{CompressionLevel: png.BestSpeed}
|
||||
return enc.Encode(w, img)
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
package screenshot
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
const niriScreenshotTimeout = 5 * time.Second
|
||||
|
||||
// CaptureNiriWindowImage captures the focused window through niri's
|
||||
// ScreenshotWindow action; niri replies before writing the file, so a second
|
||||
// event-stream connection waits for ScreenshotCaptured. niri also copies the
|
||||
// capture to its own clipboard, which cannot be disabled.
|
||||
func CaptureNiriWindowImage(showPointer bool) (image.Image, error) {
|
||||
socket := os.Getenv("NIRI_SOCKET")
|
||||
if socket == "" {
|
||||
return nil, fmt.Errorf("NIRI_SOCKET not set")
|
||||
}
|
||||
|
||||
dir := os.Getenv("XDG_RUNTIME_DIR")
|
||||
if dir == "" {
|
||||
dir = os.TempDir()
|
||||
}
|
||||
path := filepath.Join(dir, fmt.Sprintf("dms-window-%d.png", os.Getpid()))
|
||||
|
||||
events, err := subscribeNiriEvents(socket)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer events.Close()
|
||||
|
||||
if err := requestNiriWindowScreenshot(socket, path, showPointer); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer os.Remove(path)
|
||||
|
||||
if err := awaitNiriScreenshot(events, path); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("open niri screenshot: %w", err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
img, err := png.Decode(f)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode niri screenshot: %w", err)
|
||||
}
|
||||
return img, nil
|
||||
}
|
||||
|
||||
func subscribeNiriEvents(socket string) (net.Conn, error) {
|
||||
conn, err := net.DialTimeout("unix", socket, 2*time.Second)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("connect niri socket: %w", err)
|
||||
}
|
||||
_ = conn.SetDeadline(time.Now().Add(niriScreenshotTimeout))
|
||||
|
||||
if _, err := conn.Write([]byte("\"EventStream\"\n")); err != nil {
|
||||
conn.Close()
|
||||
return nil, fmt.Errorf("subscribe niri events: %w", err)
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
func awaitNiriScreenshot(events net.Conn, path string) error {
|
||||
scanner := bufio.NewScanner(events)
|
||||
scanner.Buffer(make([]byte, 0, 64<<10), 1<<20)
|
||||
|
||||
for scanner.Scan() {
|
||||
var event struct {
|
||||
ScreenshotCaptured *struct {
|
||||
Path string `json:"path"`
|
||||
} `json:"ScreenshotCaptured"`
|
||||
}
|
||||
if json.Unmarshal(scanner.Bytes(), &event) != nil {
|
||||
continue
|
||||
}
|
||||
if event.ScreenshotCaptured != nil && event.ScreenshotCaptured.Path == path {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
return fmt.Errorf("await niri screenshot: %w", err)
|
||||
}
|
||||
return fmt.Errorf("niri event stream closed before screenshot completed")
|
||||
}
|
||||
|
||||
func requestNiriWindowScreenshot(socket, path string, showPointer bool) error {
|
||||
conn, err := net.DialTimeout("unix", socket, 2*time.Second)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect niri socket: %w", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
_ = conn.SetDeadline(time.Now().Add(3 * time.Second))
|
||||
|
||||
request := map[string]any{
|
||||
"Action": map[string]any{
|
||||
"ScreenshotWindow": map[string]any{
|
||||
"id": nil,
|
||||
"write_to_disk": true,
|
||||
"show_pointer": showPointer,
|
||||
"path": path,
|
||||
},
|
||||
},
|
||||
}
|
||||
payload, err := json.Marshal(request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := conn.Write(append(payload, '\n')); err != nil {
|
||||
return fmt.Errorf("niri request: %w", err)
|
||||
}
|
||||
|
||||
line, err := bufio.NewReader(conn).ReadBytes('\n')
|
||||
if err != nil {
|
||||
return fmt.Errorf("niri reply: %w", err)
|
||||
}
|
||||
|
||||
var reply map[string]json.RawMessage
|
||||
if err := json.Unmarshal(line, &reply); err != nil {
|
||||
return fmt.Errorf("parse niri reply: %w", err)
|
||||
}
|
||||
if raw, ok := reply["Err"]; ok {
|
||||
var msg string
|
||||
_ = json.Unmarshal(raw, &msg)
|
||||
return fmt.Errorf("niri screenshot: %s", msg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Screenshoter) captureNiriWindow() (*CaptureResult, error) {
|
||||
img, err := CaptureNiriWindowImage(s.config.Cursor == CursorOn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf, err := ImageToBuffer(img)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
scale := 1.0
|
||||
if output := s.findOutputByName(GetFocusedMonitor()); output != nil {
|
||||
scale = output.effectiveScale()
|
||||
}
|
||||
|
||||
return &CaptureResult{
|
||||
Buffer: buf,
|
||||
YInverted: false,
|
||||
Format: uint32(FormatARGB8888),
|
||||
Scale: scale,
|
||||
}, nil
|
||||
}
|
||||
@@ -95,6 +95,9 @@ type RegionSelector struct {
|
||||
showCapturedCursor bool
|
||||
shiftHeld bool
|
||||
|
||||
phase selectorPhase
|
||||
scroll *scrollSession
|
||||
|
||||
running bool
|
||||
cancelled bool
|
||||
result Region
|
||||
@@ -167,11 +170,15 @@ func (r *RegionSelector) Run() (*CaptureResult, bool, error) {
|
||||
|
||||
r.running = true
|
||||
for r.running {
|
||||
if err := r.ctx.Dispatch(); err != nil {
|
||||
if err := r.dispatchOrTick(); err != nil {
|
||||
return nil, false, fmt.Errorf("dispatch: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if r.scroll != nil && r.scroll.abortErr != nil {
|
||||
return nil, false, r.scroll.abortErr
|
||||
}
|
||||
|
||||
if r.cancelled || r.capturedBuffer == nil {
|
||||
return nil, r.cancelled, nil
|
||||
}
|
||||
@@ -186,6 +193,10 @@ func (r *RegionSelector) Run() (*CaptureResult, bool, error) {
|
||||
scale = s
|
||||
}
|
||||
}
|
||||
if r.scroll != nil {
|
||||
yInverted = false
|
||||
format = uint32(r.scroll.format)
|
||||
}
|
||||
|
||||
return &CaptureResult{
|
||||
Buffer: r.capturedBuffer,
|
||||
@@ -696,7 +707,9 @@ func (r *RegionSelector) initRenderBuffer(os *OutputSurface) {
|
||||
}
|
||||
slot.pool = pool
|
||||
|
||||
wlBuf, err := pool.CreateBuffer(0, int32(buf.Width), int32(buf.Height), int32(buf.Stride), os.screenFormat)
|
||||
// niri latches surface opacity from the first buffer's format
|
||||
// (observed), so slots are ARGB from the start with A=255 when opaque
|
||||
wlBuf, err := pool.CreateBuffer(0, int32(buf.Width), int32(buf.Height), int32(buf.Stride), alphaFormat(os.screenFormat))
|
||||
if err != nil {
|
||||
log.Error("create render slot wl_buffer failed", "err", err)
|
||||
pool.Destroy()
|
||||
@@ -738,8 +751,9 @@ func (r *RegionSelector) applyPreSelection(os *OutputSurface) {
|
||||
|
||||
x1 := float64(r.preSelect.X-os.output.x) * scaleX
|
||||
y1 := float64(r.preSelect.Y-os.output.y) * scaleY
|
||||
x2 := float64(r.preSelect.X-os.output.x+r.preSelect.Width) * scaleX
|
||||
y2 := float64(r.preSelect.Y-os.output.y+r.preSelect.Height) * scaleY
|
||||
// selection edges are inclusive; the exclusive width edge is one device px past it
|
||||
x2 := float64(r.preSelect.X-os.output.x+r.preSelect.Width)*scaleX - scaleX
|
||||
y2 := float64(r.preSelect.Y-os.output.y+r.preSelect.Height)*scaleY - scaleY
|
||||
|
||||
r.selection.hasSelection = true
|
||||
r.selection.dragging = false
|
||||
@@ -769,10 +783,13 @@ func (r *RegionSelector) redrawSurface(os *OutputSurface) {
|
||||
return
|
||||
}
|
||||
|
||||
slot.shm.CopyFrom(srcBuf)
|
||||
|
||||
// Draw overlay (dimming + selection) into this slot
|
||||
r.drawOverlay(os, slot.shm)
|
||||
switch r.phase {
|
||||
case phaseScroll:
|
||||
r.drawScrollOverlay(os, slot.shm)
|
||||
default:
|
||||
slot.shm.CopyFrom(srcBuf)
|
||||
r.drawOverlay(os, slot.shm)
|
||||
}
|
||||
|
||||
if os.viewport != nil {
|
||||
_ = os.wlSurface.SetBufferScale(1)
|
||||
@@ -808,6 +825,8 @@ func (r *RegionSelector) cleanup() {
|
||||
r.cursorBuffer.Close()
|
||||
}
|
||||
|
||||
r.cleanupScroll()
|
||||
|
||||
for _, os := range r.surfaces {
|
||||
for _, slot := range os.slots {
|
||||
if slot == nil {
|
||||
|
||||
@@ -94,6 +94,20 @@ func (r *RegionSelector) setupPointerHandlers() {
|
||||
return
|
||||
}
|
||||
|
||||
if r.phase == phaseScroll {
|
||||
if e.Button != 0x110 || e.State != 1 || r.activeSurface != r.selection.surface {
|
||||
return
|
||||
}
|
||||
switch r.scrollBarHit(r.pointerX, r.pointerY) {
|
||||
case "done":
|
||||
r.finishScroll()
|
||||
case "cancel":
|
||||
r.cancelled = true
|
||||
r.running = false
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
switch e.Button {
|
||||
case 0x110: // BTN_LEFT
|
||||
switch e.State {
|
||||
@@ -135,6 +149,17 @@ func (r *RegionSelector) setupKeyboardHandlers() {
|
||||
return
|
||||
}
|
||||
|
||||
if r.phase == phaseScroll {
|
||||
switch e.Key {
|
||||
case 1:
|
||||
r.cancelled = true
|
||||
r.running = false
|
||||
case 28, 96:
|
||||
r.finishScroll()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
switch e.Key {
|
||||
case 1:
|
||||
r.cancelled = true
|
||||
@@ -152,17 +177,15 @@ func (r *RegionSelector) setupKeyboardHandlers() {
|
||||
})
|
||||
}
|
||||
|
||||
func (r *RegionSelector) finishSelection() {
|
||||
func (r *RegionSelector) selectionDeviceRect() (*OutputSurface, int, int, int, int) {
|
||||
if r.selection.surface == nil {
|
||||
r.running = false
|
||||
return
|
||||
return nil, 0, 0, 0, 0
|
||||
}
|
||||
|
||||
os := r.selection.surface
|
||||
srcBuf := r.getSourceBuffer(os)
|
||||
if srcBuf == nil {
|
||||
r.running = false
|
||||
return
|
||||
return nil, 0, 0, 0, 0
|
||||
}
|
||||
|
||||
x1, y1 := r.selection.anchorX, r.selection.anchorY
|
||||
@@ -181,24 +204,10 @@ func (r *RegionSelector) finishSelection() {
|
||||
scaleY = float64(srcBuf.Height) / float64(os.logicalH)
|
||||
}
|
||||
|
||||
bx1 := int(x1 * scaleX)
|
||||
by1 := int(y1 * scaleY)
|
||||
bx2 := int(x2 * scaleX)
|
||||
by2 := int(y2 * scaleY)
|
||||
|
||||
// Clamp to buffer bounds
|
||||
if bx1 < 0 {
|
||||
bx1 = 0
|
||||
}
|
||||
if by1 < 0 {
|
||||
by1 = 0
|
||||
}
|
||||
if bx2 > srcBuf.Width {
|
||||
bx2 = srcBuf.Width
|
||||
}
|
||||
if by2 > srcBuf.Height {
|
||||
by2 = srcBuf.Height
|
||||
}
|
||||
bx1 := clamp(int(x1*scaleX), 0, srcBuf.Width)
|
||||
by1 := clamp(int(y1*scaleY), 0, srcBuf.Height)
|
||||
bx2 := clamp(int(x2*scaleX), 0, srcBuf.Width)
|
||||
by2 := clamp(int(y2*scaleY), 0, srcBuf.Height)
|
||||
|
||||
w, h := bx2-bx1+1, by2-by1+1
|
||||
if r.shiftHeld && w != h {
|
||||
@@ -215,7 +224,23 @@ func (r *RegionSelector) finishSelection() {
|
||||
h = 1
|
||||
}
|
||||
|
||||
// Create cropped buffer and copy pixels directly
|
||||
return os, bx1, by1, w, h
|
||||
}
|
||||
|
||||
func (r *RegionSelector) finishSelection() {
|
||||
os, bx1, by1, w, h := r.selectionDeviceRect()
|
||||
if os == nil {
|
||||
r.running = false
|
||||
return
|
||||
}
|
||||
|
||||
if r.screenshoter != nil && r.screenshoter.config.Mode == ModeScroll {
|
||||
r.enterScrollPhase(os, bx1, by1, w, h)
|
||||
return
|
||||
}
|
||||
|
||||
srcBuf := r.getSourceBuffer(os)
|
||||
|
||||
cropped, err := CreateShmBuffer(w, h, w*4)
|
||||
if err != nil {
|
||||
r.running = false
|
||||
|
||||
@@ -57,7 +57,7 @@ func (r *RegionSelector) drawOverlay(os *OutputSurface, renderBuf *ShmBuffer) {
|
||||
w, h := renderBuf.Width, renderBuf.Height
|
||||
format := os.screenFormat
|
||||
|
||||
// Dim the entire buffer
|
||||
// dim, forcing alpha: the X-format source's padding byte is undefined
|
||||
for y := 0; y < h; y++ {
|
||||
off := y * stride
|
||||
for x := 0; x < w; x++ {
|
||||
@@ -68,6 +68,7 @@ func (r *RegionSelector) drawOverlay(os *OutputSurface, renderBuf *ShmBuffer) {
|
||||
data[i+0] = uint8(int(data[i+0]) * 3 / 5)
|
||||
data[i+1] = uint8(int(data[i+1]) * 3 / 5)
|
||||
data[i+2] = uint8(int(data[i+2]) * 3 / 5)
|
||||
data[i+3] = 255
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ func (r *RegionSelector) drawOverlay(os *OutputSurface, renderBuf *ShmBuffer) {
|
||||
data[di+0] = srcData[si+0]
|
||||
data[di+1] = srcData[si+1]
|
||||
data[di+2] = srcData[si+2]
|
||||
data[di+3] = srcData[si+3]
|
||||
data[di+3] = 255
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +127,81 @@ func (r *RegionSelector) drawOverlay(os *OutputSurface, renderBuf *ShmBuffer) {
|
||||
r.drawDimensions(data, stride, w, h, bx1, by1, selW, selH, format)
|
||||
}
|
||||
|
||||
func (r *RegionSelector) drawScrollOverlay(os *OutputSurface, renderBuf *ShmBuffer) {
|
||||
data := renderBuf.Data()
|
||||
stride := renderBuf.Stride
|
||||
w, h := renderBuf.Width, renderBuf.Height
|
||||
|
||||
// 40% premultiplied scrim
|
||||
for y := 0; y < h; y++ {
|
||||
off := y * stride
|
||||
for x := 0; x < w; x++ {
|
||||
i := off + x*4
|
||||
if i+3 >= len(data) {
|
||||
continue
|
||||
}
|
||||
data[i+0], data[i+1], data[i+2], data[i+3] = 0, 0, 0, 102
|
||||
}
|
||||
}
|
||||
|
||||
s := r.scroll
|
||||
if s == nil || r.selection.surface != os {
|
||||
return
|
||||
}
|
||||
|
||||
// hole oversized 2px so overlay pixels never land in captured frames
|
||||
holeX := s.holeX - 2
|
||||
holeY := s.holeY - 2
|
||||
holeW := s.holeW + 4
|
||||
holeH := s.holeH + 4
|
||||
|
||||
x1 := clamp(holeX, 0, w)
|
||||
y1 := clamp(holeY, 0, h)
|
||||
x2 := clamp(holeX+holeW, 0, w)
|
||||
y2 := clamp(holeY+holeH, 0, h)
|
||||
|
||||
for y := y1; y < y2; y++ {
|
||||
off := y * stride
|
||||
for x := x1; x < x2; x++ {
|
||||
i := off + x*4
|
||||
if i+3 >= len(data) {
|
||||
continue
|
||||
}
|
||||
data[i+0], data[i+1], data[i+2], data[i+3] = 0, 0, 0, 0
|
||||
}
|
||||
}
|
||||
|
||||
r.drawBorder(data, stride, w, h, holeX-1, holeY-1, holeW+2, holeH+2, os.screenFormat)
|
||||
r.drawScrollBar(data, stride, w, h, os.screenFormat)
|
||||
}
|
||||
|
||||
func (r *RegionSelector) drawScrollBar(data []byte, stride, bufW, bufH int, format uint32) {
|
||||
s := r.scroll
|
||||
style := LoadOverlayStyle()
|
||||
const charH = 12
|
||||
|
||||
r.fillRect(data, stride, bufW, bufH, s.barX, s.barY, s.barW, s.barH,
|
||||
style.BackgroundR, style.BackgroundG, style.BackgroundB, 245, format)
|
||||
|
||||
labelY := s.doneY + (s.btnH-charH)/2
|
||||
r.fillRect(data, stride, bufW, bufH, s.doneX, s.doneY, s.doneW, s.btnH,
|
||||
style.AccentR, style.AccentG, style.AccentB, 255, format)
|
||||
r.drawText(data, stride, bufW, bufH, s.doneX+12, labelY, "done", 10, 10, 10, format)
|
||||
|
||||
r.fillRect(data, stride, bufW, bufH, s.cancelX, s.cancelY, s.cancelW, s.btnH,
|
||||
70, 70, 70, 255, format)
|
||||
r.drawText(data, stride, bufW, bufH, s.cancelX+12, labelY, "cancel",
|
||||
style.TextR, style.TextG, style.TextB, format)
|
||||
|
||||
rows := 0
|
||||
if s.st != nil {
|
||||
rows = s.st.rows()
|
||||
}
|
||||
counter := fmt.Sprintf("%d shots %dpx", s.kept, rows)
|
||||
r.drawText(data, stride, bufW, bufH, s.cancelX+s.cancelW+16, labelY, counter,
|
||||
style.TextR, style.TextG, style.TextB, format)
|
||||
}
|
||||
|
||||
func (r *RegionSelector) drawHUD(data []byte, stride, bufW, bufH int, format uint32) {
|
||||
if r.selection.dragging {
|
||||
return
|
||||
|
||||
@@ -92,7 +92,7 @@ func (s *Screenshoter) Run() (*CaptureResult, error) {
|
||||
switch s.config.Mode {
|
||||
case ModeLastRegion:
|
||||
return s.captureLastRegion()
|
||||
case ModeRegion:
|
||||
case ModeRegion, ModeScroll:
|
||||
return s.captureRegion()
|
||||
case ModeWindow:
|
||||
return s.captureWindow()
|
||||
@@ -145,6 +145,10 @@ func (s *Screenshoter) captureRegion() (*CaptureResult, error) {
|
||||
}
|
||||
|
||||
func (s *Screenshoter) captureWindow() (*CaptureResult, error) {
|
||||
if DetectCompositor() == CompositorNiri {
|
||||
return s.captureNiriWindow()
|
||||
}
|
||||
|
||||
geom, err := GetActiveWindow()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -0,0 +1,574 @@
|
||||
package screenshot
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/proto/wlr_layer_shell"
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/internal/proto/wlr_screencopy"
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
type selectorPhase int
|
||||
|
||||
const (
|
||||
phaseSelect selectorPhase = iota
|
||||
phaseScroll
|
||||
)
|
||||
|
||||
const (
|
||||
scrollMaxFailures = 5
|
||||
scrollSeamTicks = 4
|
||||
)
|
||||
|
||||
type scrollSession struct {
|
||||
output *WaylandOutput
|
||||
// wire coords for CaptureOutputRegion (logical or device px per compositor)
|
||||
capX, capY, capW, capH int32
|
||||
// device-pixel rect in the overlay buffer, for hole/border drawing
|
||||
holeX, holeY, holeW, holeH int
|
||||
|
||||
interval time.Duration
|
||||
nextTick time.Time
|
||||
inFlight bool
|
||||
failures int
|
||||
kept int
|
||||
abortErr error
|
||||
|
||||
buf *ShmBuffer
|
||||
pool *client.ShmPool
|
||||
wlBuf *client.Buffer
|
||||
frame *wlr_screencopy.ZwlrScreencopyFrameV1
|
||||
format PixelFormat
|
||||
frameW, frameH int
|
||||
yInverted bool
|
||||
|
||||
prevSig []float32
|
||||
prevPlaced bool
|
||||
unmatched bool
|
||||
unmatchedTicks int
|
||||
|
||||
// control bar geometry in overlay buffer pixels
|
||||
barX, barY, barW, barH int
|
||||
doneX, doneY, doneW int
|
||||
cancelX, cancelY int
|
||||
cancelW int
|
||||
btnH int
|
||||
|
||||
sigCh chan os.Signal
|
||||
keysBound bool
|
||||
|
||||
st *stitcher
|
||||
}
|
||||
|
||||
func (r *RegionSelector) dispatchOrTick() error {
|
||||
timeout := -1
|
||||
if s := r.scroll; r.phase == phaseScroll && s != nil && s.sigCh != nil {
|
||||
select {
|
||||
case sig := <-s.sigCh:
|
||||
switch sig {
|
||||
case unix.SIGUSR2:
|
||||
r.cancelled = true
|
||||
r.running = false
|
||||
default:
|
||||
r.finishScroll()
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
}
|
||||
if s := r.scroll; r.phase == phaseScroll && s.abortErr == nil && (s.st == nil || !s.st.full) {
|
||||
timeout = max(int(time.Until(s.nextTick).Milliseconds()), 0)
|
||||
}
|
||||
|
||||
fds := []unix.PollFd{{Fd: int32(r.ctx.Fd()), Events: unix.POLLIN}}
|
||||
n, err := unix.Poll(fds, timeout)
|
||||
switch {
|
||||
case err == unix.EINTR:
|
||||
return nil
|
||||
case err != nil:
|
||||
return err
|
||||
case n > 0:
|
||||
return r.ctx.Dispatch()
|
||||
}
|
||||
|
||||
r.scrollTick()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RegionSelector) scrollTick() {
|
||||
s := r.scroll
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if s.inFlight || (s.st != nil && s.st.full) {
|
||||
s.nextTick = time.Now().Add(s.interval)
|
||||
return
|
||||
}
|
||||
r.startScrollCapture()
|
||||
}
|
||||
|
||||
func (r *RegionSelector) enterScrollPhase(os *OutputSurface, x, y, w, h int) {
|
||||
switch {
|
||||
case os.output.transform != TransformNormal:
|
||||
r.abortScroll(fmt.Errorf("scroll capture does not support rotated outputs"))
|
||||
return
|
||||
case w < 1 || h < 1:
|
||||
r.abortScroll(fmt.Errorf("empty scroll capture region"))
|
||||
return
|
||||
}
|
||||
|
||||
interval := 45
|
||||
if r.screenshoter != nil && r.screenshoter.config.IntervalMs > 0 {
|
||||
interval = r.screenshoter.config.IntervalMs
|
||||
}
|
||||
|
||||
capX, capY, capW, capH := x, y, w, h
|
||||
switch DetectCompositor() {
|
||||
case CompositorHyprland, CompositorMango:
|
||||
// both take device pixels, deviating from spec (observed)
|
||||
default:
|
||||
// spec: logical coordinates, scaled by the compositor
|
||||
// https://wayland.app/protocols/wlr-screencopy-unstable-v1#zwlr_screencopy_manager_v1:request:capture_output_region
|
||||
if scale := os.output.fractionalScale; scale > 1 {
|
||||
capX = int(float64(x)/scale + 0.5)
|
||||
capY = int(float64(y)/scale + 0.5)
|
||||
capW = int(float64(w)/scale + 0.5)
|
||||
capH = int(float64(h)/scale + 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
r.scroll = &scrollSession{
|
||||
output: os.output,
|
||||
capX: int32(capX),
|
||||
capY: int32(capY),
|
||||
capW: int32(capW),
|
||||
capH: int32(capH),
|
||||
holeX: x,
|
||||
holeY: y,
|
||||
holeW: w,
|
||||
holeH: h,
|
||||
interval: time.Duration(interval) * time.Millisecond,
|
||||
nextTick: time.Now(),
|
||||
}
|
||||
|
||||
r.layoutScrollBar(os)
|
||||
|
||||
for _, surf := range r.surfaces {
|
||||
r.setInputPassthrough(surf, surf == os)
|
||||
}
|
||||
|
||||
// Hyprland routes all pointer input to exclusive-keyboard layers
|
||||
// (https://github.com/hyprwm/Hyprland/discussions/14136), so the keyboard
|
||||
// is released there and Enter/Esc come back via temporary global binds
|
||||
if DetectCompositor() == CompositorHyprland {
|
||||
r.enterHyprlandScrollInput(os)
|
||||
}
|
||||
|
||||
r.phase = phaseScroll
|
||||
for _, surf := range r.surfaces {
|
||||
r.redrawSurface(surf)
|
||||
}
|
||||
}
|
||||
|
||||
// sized for the worst-case counter so the input region is set once
|
||||
func (r *RegionSelector) layoutScrollBar(os *OutputSurface) {
|
||||
s := r.scroll
|
||||
const charAdv, pad, gap = 9, 12, 16
|
||||
|
||||
s.btnH = 24
|
||||
s.doneW = len("done")*charAdv + 24
|
||||
s.cancelW = len("cancel")*charAdv + 24
|
||||
counterW := len("99999 shots 999999px") * charAdv
|
||||
s.barW = pad + s.doneW + gap + s.cancelW + gap + counterW + pad
|
||||
s.barH = s.btnH + 24
|
||||
|
||||
bufW, bufH := os.screenBuf.Width, os.screenBuf.Height
|
||||
s.barX = (bufW - s.barW) / 2
|
||||
s.barY = bufH - s.barH - 24
|
||||
|
||||
borderX1, borderY1 := s.holeX-3, s.holeY-3
|
||||
borderX2, borderY2 := s.holeX+s.holeW+3, s.holeY+s.holeH+3
|
||||
overlaps := s.barX < borderX2 && s.barX+s.barW > borderX1 &&
|
||||
s.barY < borderY2 && s.barY+s.barH > borderY1
|
||||
if overlaps {
|
||||
s.barY = 24
|
||||
}
|
||||
|
||||
s.doneX = s.barX + pad
|
||||
s.doneY = s.barY + (s.barH-s.btnH)/2
|
||||
s.cancelX = s.doneX + s.doneW + gap
|
||||
s.cancelY = s.doneY
|
||||
}
|
||||
|
||||
func (r *RegionSelector) setInputPassthrough(os *OutputSurface, withBar bool) {
|
||||
reg, err := r.compositor.CreateRegion()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if withBar && os.screenBuf != nil && os.logicalW > 0 {
|
||||
s := r.scroll
|
||||
scaleX := float64(os.logicalW) / float64(os.screenBuf.Width)
|
||||
scaleY := float64(os.logicalH) / float64(os.screenBuf.Height)
|
||||
_ = reg.Add(int32(float64(s.barX)*scaleX), int32(float64(s.barY)*scaleY),
|
||||
int32(float64(s.barW)*scaleX)+1, int32(float64(s.barH)*scaleY)+1)
|
||||
}
|
||||
_ = os.wlSurface.SetInputRegion(reg)
|
||||
_ = reg.Destroy()
|
||||
}
|
||||
|
||||
func (r *RegionSelector) enterHyprlandScrollInput(osurf *OutputSurface) {
|
||||
for _, surf := range r.surfaces {
|
||||
_ = surf.layerSurf.SetKeyboardInteractivity(uint32(wlr_layer_shell.ZwlrLayerSurfaceV1KeyboardInteractivityNone))
|
||||
}
|
||||
if r.shortcutsInhibitor != nil {
|
||||
_ = r.shortcutsInhibitor.Destroy()
|
||||
r.shortcutsInhibitor = nil
|
||||
}
|
||||
|
||||
s := r.scroll
|
||||
scale := osurf.output.fractionalScale
|
||||
if scale <= 0 {
|
||||
scale = 1
|
||||
}
|
||||
cx := int(float64(osurf.output.x) + float64(s.holeX+s.holeW/2)/scale)
|
||||
cy := int(float64(osurf.output.y) + float64(s.holeY+s.holeH/2)/scale)
|
||||
hyprlandFocusWindowAt(cx, cy)
|
||||
|
||||
s.sigCh = make(chan os.Signal, 2)
|
||||
signal.Notify(s.sigCh, unix.SIGUSR1, unix.SIGUSR2)
|
||||
s.keysBound = hyprlandBindScrollKeys(os.Getpid())
|
||||
}
|
||||
|
||||
func hyprlandFocusWindowAt(x, y int) {
|
||||
out, err := exec.Command("hyprctl", "-j", "clients").Output()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var clients []struct {
|
||||
Address string `json:"address"`
|
||||
At [2]int `json:"at"`
|
||||
Size [2]int `json:"size"`
|
||||
Mapped bool `json:"mapped"`
|
||||
Hidden bool `json:"hidden"`
|
||||
FocusHistoryID int `json:"focusHistoryID"`
|
||||
}
|
||||
if json.Unmarshal(out, &clients) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
best := -1
|
||||
for i, c := range clients {
|
||||
if !c.Mapped || c.Hidden {
|
||||
continue
|
||||
}
|
||||
if x < c.At[0] || x >= c.At[0]+c.Size[0] || y < c.At[1] || y >= c.At[1]+c.Size[1] {
|
||||
continue
|
||||
}
|
||||
if best < 0 || c.FocusHistoryID < clients[best].FocusHistoryID {
|
||||
best = i
|
||||
}
|
||||
}
|
||||
if best < 0 {
|
||||
return
|
||||
}
|
||||
_ = exec.Command("hyprctl", "dispatch", "focuswindow", "address:"+clients[best].Address).Run()
|
||||
}
|
||||
|
||||
func hyprlandBindScrollKeys(pid int) bool {
|
||||
batch := fmt.Sprintf("keyword bind ,Return,exec,kill -USR1 %d ; keyword bind ,Escape,exec,kill -USR2 %d", pid, pid)
|
||||
return exec.Command("hyprctl", "--batch", batch).Run() == nil
|
||||
}
|
||||
|
||||
func hyprlandUnbindScrollKeys() {
|
||||
_ = exec.Command("hyprctl", "--batch", "keyword unbind ,Return ; keyword unbind ,Escape").Run()
|
||||
}
|
||||
|
||||
func (r *RegionSelector) scrollBarHit(x, y float64) string {
|
||||
s := r.scroll
|
||||
os := r.selection.surface
|
||||
if s == nil || os == nil || os.screenBuf == nil || os.logicalW == 0 {
|
||||
return ""
|
||||
}
|
||||
bx := int(x * float64(os.screenBuf.Width) / float64(os.logicalW))
|
||||
by := int(y * float64(os.screenBuf.Height) / float64(os.logicalH))
|
||||
|
||||
switch {
|
||||
case bx >= s.doneX && bx < s.doneX+s.doneW && by >= s.doneY && by < s.doneY+s.btnH:
|
||||
return "done"
|
||||
case bx >= s.cancelX && bx < s.cancelX+s.cancelW && by >= s.cancelY && by < s.cancelY+s.btnH:
|
||||
return "cancel"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func alphaFormat(format uint32) uint32 {
|
||||
switch format {
|
||||
case uint32(FormatXRGB8888):
|
||||
return uint32(FormatARGB8888)
|
||||
case uint32(FormatXBGR8888):
|
||||
return uint32(FormatABGR8888)
|
||||
default:
|
||||
return format
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RegionSelector) startScrollCapture() {
|
||||
s := r.scroll
|
||||
frame, err := r.screencopy.CaptureOutputRegion(0, s.output.wlOutput, s.capX, s.capY, s.capW, s.capH)
|
||||
if err != nil {
|
||||
r.abortScroll(fmt.Errorf("scroll capture: %w", err))
|
||||
return
|
||||
}
|
||||
s.inFlight = true
|
||||
s.frame = frame
|
||||
s.nextTick = time.Now().Add(s.interval)
|
||||
|
||||
frame.SetBufferHandler(func(e wlr_screencopy.ZwlrScreencopyFrameV1BufferEvent) {
|
||||
if err := s.ensureCaptureBuffer(r, e); err != nil {
|
||||
r.abortScroll(err)
|
||||
return
|
||||
}
|
||||
if err := frame.Copy(s.wlBuf); err != nil {
|
||||
log.Error("scroll frame copy failed", "err", err)
|
||||
}
|
||||
})
|
||||
|
||||
frame.SetFlagsHandler(func(e wlr_screencopy.ZwlrScreencopyFrameV1FlagsEvent) {
|
||||
s.yInverted = (e.Flags & 1) != 0
|
||||
})
|
||||
|
||||
frame.SetReadyHandler(func(e wlr_screencopy.ZwlrScreencopyFrameV1ReadyEvent) {
|
||||
frame.Destroy()
|
||||
s.frame = nil
|
||||
s.inFlight = false
|
||||
s.failures = 0
|
||||
s.nextTick = time.Now().Add(s.interval)
|
||||
r.handleScrollFrame()
|
||||
})
|
||||
|
||||
frame.SetFailedHandler(func(e wlr_screencopy.ZwlrScreencopyFrameV1FailedEvent) {
|
||||
frame.Destroy()
|
||||
s.frame = nil
|
||||
s.inFlight = false
|
||||
s.failures++
|
||||
s.nextTick = time.Now().Add(s.interval)
|
||||
if s.failures >= scrollMaxFailures {
|
||||
r.abortScroll(fmt.Errorf("screencopy failed %d consecutive times", s.failures))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (s *scrollSession) ensureCaptureBuffer(r *RegionSelector, e wlr_screencopy.ZwlrScreencopyFrameV1BufferEvent) error {
|
||||
if s.buf != nil {
|
||||
if int(e.Width) != s.frameW || int(e.Height) != s.frameH || PixelFormat(e.Format) != s.format {
|
||||
return fmt.Errorf("output changed during scroll capture")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
format := PixelFormat(e.Format)
|
||||
if int(e.Stride) < int(e.Width)*format.BytesPerPixel() {
|
||||
return fmt.Errorf("invalid stride from compositor: %d for width %d", e.Stride, e.Width)
|
||||
}
|
||||
|
||||
buf, err := CreateShmBuffer(int(e.Width), int(e.Height), int(e.Stride))
|
||||
if err != nil {
|
||||
return fmt.Errorf("create scroll buffer: %w", err)
|
||||
}
|
||||
buf.Format = format
|
||||
|
||||
pool, err := r.shm.CreatePool(buf.Fd(), int32(buf.Size()))
|
||||
if err != nil {
|
||||
buf.Close()
|
||||
return fmt.Errorf("create scroll pool: %w", err)
|
||||
}
|
||||
|
||||
wlBuf, err := pool.CreateBuffer(0, int32(buf.Width), int32(buf.Height), int32(buf.Stride), e.Format)
|
||||
if err != nil {
|
||||
pool.Destroy()
|
||||
buf.Close()
|
||||
return fmt.Errorf("create scroll wl_buffer: %w", err)
|
||||
}
|
||||
|
||||
s.buf = buf
|
||||
s.pool = pool
|
||||
s.wlBuf = wlBuf
|
||||
s.format = format
|
||||
s.frameW = int(e.Width)
|
||||
s.frameH = int(e.Height)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RegionSelector) handleScrollFrame() {
|
||||
s := r.scroll
|
||||
if s == nil || s.buf == nil {
|
||||
return
|
||||
}
|
||||
|
||||
rows, err := s.extractRows()
|
||||
if err != nil {
|
||||
r.abortScroll(err)
|
||||
return
|
||||
}
|
||||
|
||||
if s.st == nil {
|
||||
s.st = newStitcher(s.frameW * 4)
|
||||
}
|
||||
|
||||
cols := s.st.rowSamples(rows)
|
||||
sig := s.st.frameSig(rows)
|
||||
dup := duplicateFrame(sig, s.prevSig)
|
||||
s.prevSig = sig
|
||||
|
||||
// moving content: recapture at compositor speed, the timer paces idle only
|
||||
if !dup {
|
||||
s.nextTick = time.Now()
|
||||
}
|
||||
|
||||
var added int
|
||||
switch {
|
||||
case dup && s.unmatched:
|
||||
// settled somewhere unreachable: seam a new segment after a few ticks
|
||||
s.unmatchedTicks++
|
||||
if s.unmatchedTicks < scrollSeamTicks {
|
||||
return
|
||||
}
|
||||
var placed bool
|
||||
added, placed = s.st.pushFrame(rows, cols)
|
||||
if !placed {
|
||||
added = s.st.seamAppend(rows, cols)
|
||||
}
|
||||
s.prevPlaced = true
|
||||
s.unmatched = false
|
||||
s.unmatchedTicks = 0
|
||||
case dup && s.prevPlaced:
|
||||
return
|
||||
default:
|
||||
var placed bool
|
||||
added, placed = s.st.pushFrame(rows, cols)
|
||||
s.prevPlaced = placed
|
||||
s.unmatched = !placed
|
||||
s.unmatchedTicks = 0
|
||||
}
|
||||
|
||||
if scrollDebug {
|
||||
log.Error("scroll frame", "dup", dup, "unmatched", s.unmatched,
|
||||
"placed", s.prevPlaced, "added", added, "canvas", s.st.rows(), "kept", s.kept)
|
||||
}
|
||||
if added == 0 {
|
||||
return
|
||||
}
|
||||
s.kept++
|
||||
if r.selection.surface != nil {
|
||||
r.redrawSurface(r.selection.surface)
|
||||
}
|
||||
}
|
||||
|
||||
var scrollDebug = os.Getenv("DMS_SCROLL_DEBUG") != ""
|
||||
|
||||
func (s *scrollSession) extractRows() ([]byte, error) {
|
||||
src := s.buf
|
||||
format := s.format
|
||||
|
||||
if format.Is24Bit() {
|
||||
converted, newFormat, err := src.ConvertTo32Bit(format)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("convert scroll frame: %w", err)
|
||||
}
|
||||
defer converted.Close()
|
||||
src = converted
|
||||
s.format = newFormat
|
||||
}
|
||||
|
||||
rows := make([]byte, s.frameW*4*s.frameH)
|
||||
data := src.Data()
|
||||
for y := 0; y < s.frameH; y++ {
|
||||
srcY := y
|
||||
if s.yInverted {
|
||||
srcY = s.frameH - 1 - y
|
||||
}
|
||||
srcOff := srcY * src.Stride
|
||||
dstOff := y * s.frameW * 4
|
||||
if srcOff+s.frameW*4 > len(data) {
|
||||
continue
|
||||
}
|
||||
copy(rows[dstOff:dstOff+s.frameW*4], data[srcOff:srcOff+s.frameW*4])
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
func (r *RegionSelector) finishScroll() {
|
||||
s := r.scroll
|
||||
if s == nil || s.st == nil || s.st.rows() == 0 {
|
||||
r.cancelled = true
|
||||
r.running = false
|
||||
return
|
||||
}
|
||||
|
||||
buf, err := CreateShmBuffer(s.frameW, s.st.rows(), s.frameW*4)
|
||||
if err != nil {
|
||||
r.abortScroll(fmt.Errorf("create stitched buffer: %w", err))
|
||||
return
|
||||
}
|
||||
copy(buf.Data(), s.st.canvas)
|
||||
buf.Format = s.format
|
||||
|
||||
r.capturedBuffer = buf
|
||||
r.capturedRegion = Region{
|
||||
X: int32(s.holeX),
|
||||
Y: int32(s.holeY),
|
||||
Width: int32(s.holeW),
|
||||
Height: int32(s.holeH),
|
||||
Output: s.output.name,
|
||||
}
|
||||
// same convention as finishSelection or preselect breaks on scaled outputs
|
||||
r.result = Region{
|
||||
X: int32(s.holeX) + s.output.x,
|
||||
Y: int32(s.holeY) + s.output.y,
|
||||
Width: int32(s.holeW),
|
||||
Height: int32(s.holeH),
|
||||
Output: s.output.name,
|
||||
}
|
||||
r.running = false
|
||||
}
|
||||
|
||||
func (r *RegionSelector) abortScroll(err error) {
|
||||
if r.scroll == nil {
|
||||
r.scroll = &scrollSession{}
|
||||
}
|
||||
r.scroll.abortErr = err
|
||||
r.running = false
|
||||
}
|
||||
|
||||
func (r *RegionSelector) cleanupScroll() {
|
||||
s := r.scroll
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
if s.keysBound {
|
||||
hyprlandUnbindScrollKeys()
|
||||
}
|
||||
if s.sigCh != nil {
|
||||
signal.Stop(s.sigCh)
|
||||
}
|
||||
if s.frame != nil {
|
||||
s.frame.Destroy()
|
||||
}
|
||||
if s.wlBuf != nil {
|
||||
s.wlBuf.Destroy()
|
||||
}
|
||||
if s.pool != nil {
|
||||
s.pool.Destroy()
|
||||
}
|
||||
if s.buf != nil {
|
||||
s.buf.Close()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
package screenshot
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// mirrors handleScrollFrame's stitch logic so glides run without a compositor
|
||||
type simSession struct {
|
||||
prevSig []float32
|
||||
prevPlaced bool
|
||||
unmatched bool
|
||||
unmatchedTicks int
|
||||
st *stitcher
|
||||
}
|
||||
|
||||
func (s *simSession) observe(rows []byte) {
|
||||
cols := s.st.rowSamples(rows)
|
||||
sig := s.st.frameSig(rows)
|
||||
dup := duplicateFrame(sig, s.prevSig)
|
||||
s.prevSig = sig
|
||||
|
||||
switch {
|
||||
case dup && s.unmatched:
|
||||
s.unmatchedTicks++
|
||||
if s.unmatchedTicks < scrollSeamTicks {
|
||||
return
|
||||
}
|
||||
if _, placed := s.st.pushFrame(rows, cols); !placed {
|
||||
s.st.seamAppend(rows, cols)
|
||||
}
|
||||
s.prevPlaced = true
|
||||
s.unmatched = false
|
||||
s.unmatchedTicks = 0
|
||||
case dup && s.prevPlaced:
|
||||
return
|
||||
default:
|
||||
_, placed := s.st.pushFrame(rows, cols)
|
||||
s.prevPlaced = placed
|
||||
s.unmatched = !placed
|
||||
s.unmatchedTicks = 0
|
||||
}
|
||||
}
|
||||
|
||||
// the page at a fractional scroll offset, as a compositor renders mid-glide
|
||||
func fractionalFrame(page []byte, stride, frameH int, offset float64) []byte {
|
||||
top := int(offset)
|
||||
frac := offset - float64(top)
|
||||
out := make([]byte, frameH*stride)
|
||||
for y := 0; y < frameH; y++ {
|
||||
a := page[(top+y)*stride : (top+y+1)*stride]
|
||||
b := page[(top+y+1)*stride : (top+y+2)*stride]
|
||||
row := out[y*stride : (y+1)*stride]
|
||||
for x := range row {
|
||||
row[x] = byte(float64(a[x])*(1-frac) + float64(b[x])*frac)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// blank gaps between paragraphs plus identical card blocks repeated around
|
||||
func webbyPage(rng *rand.Rand, stride, rows int) []byte {
|
||||
page := make([]byte, rows*stride)
|
||||
card := make([]byte, 40*stride)
|
||||
rng.Read(card)
|
||||
|
||||
row := 0
|
||||
for row < rows {
|
||||
switch rng.Intn(4) {
|
||||
case 0: // blank gap
|
||||
row += 10 + rng.Intn(20)
|
||||
case 1: // repeated card block
|
||||
n := copy(page[row*stride:], card)
|
||||
row += n / stride
|
||||
default: // paragraph of distinct rows
|
||||
n := (8 + rng.Intn(22)) * stride
|
||||
if row*stride+n > len(page) {
|
||||
n = len(page) - row*stride
|
||||
}
|
||||
rng.Read(page[row*stride : row*stride+n])
|
||||
row += n / stride
|
||||
}
|
||||
}
|
||||
return page
|
||||
}
|
||||
|
||||
// screen-fixed sidebar in the unsampled outer 8% plus per-frame hover noise
|
||||
func addFixedChrome(rng *rand.Rand, frame []byte, stride, frameH int, sidebar []byte) {
|
||||
sbw := len(sidebar) / frameH
|
||||
for y := 0; y < frameH; y++ {
|
||||
copy(frame[y*stride:y*stride+sbw], sidebar[y*sbw:(y+1)*sbw])
|
||||
}
|
||||
hoverTop := 40 + rng.Intn(frameH-80)
|
||||
for y := hoverTop; y < hoverTop+24; y++ {
|
||||
off := y*stride + stride/3
|
||||
for x := 0; x < 60; x++ {
|
||||
frame[off+x] ^= 0x08
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// starting at the page bottom and scrolling up must prepend, never stall
|
||||
func TestScrollSimulationBottomUp(t *testing.T) {
|
||||
const stride = 2048
|
||||
const frameH = 240
|
||||
rng := rand.New(rand.NewSource(99))
|
||||
page := webbyPage(rng, stride, 4000)
|
||||
|
||||
st := newStitcher(stride)
|
||||
sidebar := make([]byte, frameH*140)
|
||||
rng.Read(sidebar)
|
||||
|
||||
sim := &simSession{st: st}
|
||||
|
||||
pos := 3700.0
|
||||
capture := func() []byte {
|
||||
f := fractionalFrame(page, stride, frameH, pos)
|
||||
addFixedChrome(rng, f, stride, frameH, sidebar)
|
||||
return f
|
||||
}
|
||||
glide := func(target float64) {
|
||||
for i := 0; ; i++ {
|
||||
step := (target - pos) * 0.45
|
||||
if step > -1 && step < 1 {
|
||||
break
|
||||
}
|
||||
pos += step
|
||||
if i%4 != 3 {
|
||||
pos = float64(int(pos))
|
||||
}
|
||||
sim.observe(capture())
|
||||
}
|
||||
pos = target
|
||||
sim.observe(capture())
|
||||
sim.observe(capture())
|
||||
}
|
||||
|
||||
sim.observe(capture())
|
||||
for _, target := range []float64{3640, 3560, 3460, 3340, 3240} {
|
||||
glide(target)
|
||||
}
|
||||
|
||||
wantRows := (3700 + frameH) - 3240
|
||||
got := sim.st.rows()
|
||||
if got < wantRows-stitchMinAppend || got > wantRows+2 {
|
||||
t.Fatalf("canvas has %d rows, want ~%d (upward scrolling must prepend)", got, wantRows)
|
||||
}
|
||||
topPage := 3240 + (wantRows - got)
|
||||
for _, cr := range []int{0, 100, 300} {
|
||||
if !rowMatchesPage(sim.st.canvas, page, stride, cr, topPage+cr) {
|
||||
t.Fatalf("canvas row %d does not map onto page row %d", cr, topPage+cr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// exact page row or a blend of neighbors, allowing a one-row offset
|
||||
func rowMatchesPage(canvas, page []byte, stride, canvasRow, pageRow int) bool {
|
||||
for x := 200; x < stride-1400; x++ {
|
||||
c := int(canvas[canvasRow*stride+x])
|
||||
lo, hi := 255, 0
|
||||
for k := pageRow - 1; k <= pageRow+1; k++ {
|
||||
v := int(page[k*stride+x])
|
||||
lo, hi = min(lo, v), max(hi, v)
|
||||
}
|
||||
if c < lo-1 || c > hi+1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// a fling past a full frame height must seam a new segment, not go dead
|
||||
func TestScrollSimulationFastFlingRecovers(t *testing.T) {
|
||||
const stride = 2048
|
||||
const frameH = 240
|
||||
rng := rand.New(rand.NewSource(7))
|
||||
page := webbyPage(rng, stride, 4000)
|
||||
|
||||
sim := &simSession{st: newStitcher(stride)}
|
||||
frame := func(top int) []byte {
|
||||
return slices.Clone(page[top*stride : (top+frameH)*stride])
|
||||
}
|
||||
rest := func(top int) {
|
||||
for range scrollSeamTicks + 2 {
|
||||
sim.observe(frame(top))
|
||||
}
|
||||
}
|
||||
|
||||
rest(0)
|
||||
sim.observe(frame(60))
|
||||
sim.observe(frame(130))
|
||||
rest(130)
|
||||
firstRange := 130 + frameH
|
||||
|
||||
sim.observe(frame(900))
|
||||
sim.observe(frame(1400))
|
||||
rest(1800)
|
||||
|
||||
sim.observe(frame(1860))
|
||||
sim.observe(frame(1930))
|
||||
rest(1930)
|
||||
|
||||
wantRows := firstRange + (1930 - 1800) + frameH
|
||||
if got := sim.st.rows(); got != wantRows {
|
||||
t.Fatalf("canvas has %d rows, want %d (first range %d + new segment)", got, wantRows, firstRange)
|
||||
}
|
||||
seamStart := firstRange
|
||||
if !slices.Equal(sim.st.canvas[seamStart*stride:], page[1800*stride:(1930+frameH)*stride]) {
|
||||
t.Fatal("new segment content wrong after fling recovery")
|
||||
}
|
||||
}
|
||||
|
||||
// eased glides with up/down scrubbing must cover the range exactly once
|
||||
func TestScrollSimulationSmoothGlide(t *testing.T) {
|
||||
const stride = 2048
|
||||
const frameH = 240
|
||||
rng := rand.New(rand.NewSource(99))
|
||||
page := webbyPage(rng, stride, 4000)
|
||||
|
||||
st := newStitcher(stride)
|
||||
sidebar := make([]byte, frameH*140)
|
||||
rng.Read(sidebar)
|
||||
|
||||
sim := &simSession{st: st}
|
||||
|
||||
pos := 0.0
|
||||
capture := func() []byte {
|
||||
f := fractionalFrame(page, stride, frameH, pos)
|
||||
addFixedChrome(rng, f, stride, frameH, sidebar)
|
||||
return f
|
||||
}
|
||||
glide := func(target float64) {
|
||||
for i := 0; ; i++ {
|
||||
step := (target - pos) * 0.45
|
||||
if step > -1 && step < 1 {
|
||||
break
|
||||
}
|
||||
pos += step
|
||||
// mostly snapped to device pixels, with the odd fractional frame
|
||||
if i%4 != 3 {
|
||||
pos = float64(int(pos))
|
||||
}
|
||||
sim.observe(capture())
|
||||
}
|
||||
pos = target
|
||||
sim.observe(capture())
|
||||
sim.observe(capture())
|
||||
}
|
||||
|
||||
sim.observe(capture())
|
||||
for _, target := range []float64{160, 330, 480, 650, 800, 960, 1100} {
|
||||
glide(target)
|
||||
}
|
||||
for _, target := range []float64{700, 300, 900, 1100} {
|
||||
glide(target)
|
||||
}
|
||||
|
||||
wantRows := 1100 + frameH
|
||||
got := sim.st.rows()
|
||||
if got < wantRows-stitchMinAppend || got > wantRows+2 {
|
||||
t.Fatalf("canvas has %d rows, want ~%d (more = duplicated bands, fewer = gaps)", got, wantRows)
|
||||
}
|
||||
|
||||
hoverLo, hoverHi := stride/3, stride/3+60
|
||||
mismatched := 0
|
||||
for row := 0; row < min(got, wantRows); row += 7 {
|
||||
off := row * stride
|
||||
a1, b1 := sim.st.canvas[off+200:off+hoverLo], page[off+200:off+hoverLo]
|
||||
a2, b2 := sim.st.canvas[off+hoverHi:off+stride], page[off+hoverHi:off+stride]
|
||||
if !slices.Equal(a1, b1) || !slices.Equal(a2, b2) {
|
||||
mismatched++
|
||||
}
|
||||
}
|
||||
if mismatched > (wantRows/7)/20 {
|
||||
t.Fatalf("%d of %d sampled rows mismatch page content (mid-animation pixels baked in)", mismatched, wantRows/7)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
package screenshot
|
||||
|
||||
// Frame stitcher after mark-shot's column-sampling design
|
||||
// (https://github.com/jswysnemc/mark-shot, src/scroll/stitcher_algorithm.cpp).
|
||||
// Only rows overhanging the captured range are committed; frames that match
|
||||
// nothing are dropped without touching state.
|
||||
|
||||
const (
|
||||
stitchMaxCanvasBytes = 256 << 20
|
||||
stitchMaxRowsCap = 30000
|
||||
|
||||
// mark-shot: StitchConfig{100, 9.0f, 15, 1.0f}
|
||||
stitchAcceptDiff = 9.0
|
||||
stitchApproxDiff = 1.0
|
||||
stitchMinCompare = 50
|
||||
stitchMinCanvas = 100
|
||||
stitchMinAppend = 15
|
||||
stitchCoarseStep = 8
|
||||
stitchPredictWindow = 160
|
||||
stitchBandSamples = 17
|
||||
|
||||
// mark-shot: kDuplicateAvgDiff=1.1f, kDuplicateMaxDiff=4, 18x24 grid
|
||||
stitchDupAvgDiff = 1.1
|
||||
stitchDupMaxDiff = 4.0
|
||||
stitchSigCols = 18
|
||||
stitchSigRows = 24
|
||||
|
||||
// blank rows agree at every offset and must not decide a match
|
||||
stitchActivityMin = 2.0
|
||||
stitchRowMatchTol = 4.0
|
||||
stitchMinActive = 12
|
||||
)
|
||||
|
||||
// mean luminance per band (8-32%, 34-66%, 68-92%); the outer 8% is chrome
|
||||
type rowCols [3]float32
|
||||
|
||||
type stitcher struct {
|
||||
stride int
|
||||
sampleOffs [3][]int
|
||||
|
||||
canvas []byte
|
||||
cols []rowCols
|
||||
|
||||
anchor int
|
||||
last []rowCols
|
||||
lastOffset int
|
||||
|
||||
maxRows int
|
||||
full bool
|
||||
}
|
||||
|
||||
func newStitcher(stride int) *stitcher {
|
||||
px := stride / 4
|
||||
st := &stitcher{
|
||||
stride: stride,
|
||||
maxRows: min(stitchMaxCanvasBytes/stride, stitchMaxRowsCap),
|
||||
}
|
||||
bands := [3][2]float64{{0.08, 0.32}, {0.34, 0.66}, {0.68, 0.92}}
|
||||
for b, band := range bands {
|
||||
lo := int(float64(px) * band[0])
|
||||
hi := max(int(float64(px)*band[1]), lo+1)
|
||||
n := min(stitchBandSamples, hi-lo)
|
||||
for s := range n {
|
||||
st.sampleOffs[b] = append(st.sampleOffs[b], (lo+(hi-lo)*s/n)*4)
|
||||
}
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
||||
func (st *stitcher) rowSamples(data []byte) []rowCols {
|
||||
rows := len(data) / st.stride
|
||||
cols := make([]rowCols, rows)
|
||||
for y := range rows {
|
||||
row := data[y*st.stride:]
|
||||
for b := range 3 {
|
||||
var sum float32
|
||||
for _, off := range st.sampleOffs[b] {
|
||||
sum += 0.114*float32(row[off]) + 0.587*float32(row[off+1]) + 0.299*float32(row[off+2])
|
||||
}
|
||||
cols[y][b] = sum / float32(len(st.sampleOffs[b]))
|
||||
}
|
||||
}
|
||||
return cols
|
||||
}
|
||||
|
||||
func (st *stitcher) frameSig(data []byte) []float32 {
|
||||
rows := len(data) / st.stride
|
||||
px := st.stride / 4
|
||||
sig := make([]float32, 0, stitchSigCols*stitchSigRows)
|
||||
for gy := range stitchSigRows {
|
||||
y := (2*gy + 1) * rows / (2 * stitchSigRows)
|
||||
for gx := range stitchSigCols {
|
||||
x := (2*gx + 1) * px / (2 * stitchSigCols)
|
||||
off := y*st.stride + x*4
|
||||
sig = append(sig, 0.114*float32(data[off])+0.587*float32(data[off+1])+0.299*float32(data[off+2]))
|
||||
}
|
||||
}
|
||||
return sig
|
||||
}
|
||||
|
||||
func (st *stitcher) rows() int {
|
||||
return len(st.cols)
|
||||
}
|
||||
|
||||
func rowColsDiff(a, b rowCols) float32 {
|
||||
return (abs32(a[0]-b[0]) + abs32(a[1]-b[1]) + abs32(a[2]-b[2])) / 3
|
||||
}
|
||||
|
||||
func duplicateFrame(a, b []float32) bool {
|
||||
if len(a) != len(b) || len(a) == 0 {
|
||||
return false
|
||||
}
|
||||
var sum, maxDiff float32
|
||||
for i := range a {
|
||||
d := abs32(a[i] - b[i])
|
||||
sum += d
|
||||
maxDiff = max(maxDiff, d)
|
||||
}
|
||||
return sum/float32(len(a)) <= stitchDupAvgDiff && maxDiff <= stitchDupMaxDiff
|
||||
}
|
||||
|
||||
// sticky header/footer zones, per mark-shot: 10% top, 8% bottom, min 16px
|
||||
func matchIgnores(h int) (top, bottom int) {
|
||||
if h < 80 {
|
||||
return 0, 0
|
||||
}
|
||||
return clamp(h/10, 16, h/4), clamp(h*8/100, 16, h/4)
|
||||
}
|
||||
|
||||
func activity(f []rowCols) []bool {
|
||||
active := make([]bool, len(f))
|
||||
for i := 1; i < len(f); i++ {
|
||||
active[i] = rowColsDiff(f[i], f[i-1]) > stitchActivityMin
|
||||
}
|
||||
return active
|
||||
}
|
||||
|
||||
func (st *stitcher) pushFrame(frame []byte, f []rowCols) (int, bool) {
|
||||
if st.full || len(f) == 0 {
|
||||
return 0, true
|
||||
}
|
||||
|
||||
h := len(f)
|
||||
if len(st.cols) == 0 {
|
||||
n := st.appendRows(frame, f, 0)
|
||||
st.anchor = 0
|
||||
st.last = f
|
||||
st.lastOffset = 0
|
||||
return n, true
|
||||
}
|
||||
|
||||
pos, ok := st.locateFrame(f, activity(f))
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
delta := pos - st.anchor
|
||||
added := 0
|
||||
if over := pos + h - len(st.cols); over >= stitchMinAppend {
|
||||
added += st.appendRows(frame, f, h-over)
|
||||
}
|
||||
if over := -pos; over >= stitchMinAppend {
|
||||
n := st.prependRows(frame, f, over)
|
||||
added += n
|
||||
pos += n
|
||||
}
|
||||
|
||||
st.anchor = pos
|
||||
st.last = f
|
||||
st.lastOffset = delta
|
||||
return added, true
|
||||
}
|
||||
|
||||
// seamAppend starts a new segment after a jump capture couldn't follow.
|
||||
func (st *stitcher) seamAppend(frame []byte, f []rowCols) int {
|
||||
if st.full || len(f) == 0 {
|
||||
return 0
|
||||
}
|
||||
pos := len(st.cols)
|
||||
n := st.appendRows(frame, f, 0)
|
||||
st.anchor = pos
|
||||
st.last = f
|
||||
st.lastOffset = 0
|
||||
return n
|
||||
}
|
||||
|
||||
func (st *stitcher) locateFrame(f []rowCols, active []bool) (int, bool) {
|
||||
d, diff := st.adjacentOffset(f, active)
|
||||
pred := st.anchor + d
|
||||
|
||||
if diff <= stitchAcceptDiff {
|
||||
if _, ok := st.verifyAt(f, active, pred); ok {
|
||||
return pred, true
|
||||
}
|
||||
}
|
||||
if pos, _, ok := st.scanPositions(f, active, pred, true); ok {
|
||||
return pos, true
|
||||
}
|
||||
pos, _, ok := st.scanPositions(f, active, pred, false)
|
||||
return pos, ok
|
||||
}
|
||||
|
||||
func (st *stitcher) verifyAt(f []rowCols, active []bool, pos int) (float32, bool) {
|
||||
diff, count, activeMatches := st.canvasDiff(f, active, pos)
|
||||
ok := count >= stitchMinCanvas && diff <= stitchAcceptDiff && activeMatches >= stitchMinActive
|
||||
return diff, ok
|
||||
}
|
||||
|
||||
// signed deltas searched outward from the previous one (mark-shot's
|
||||
// predictOffsetIter), early-exiting once a diff beats approxDiff
|
||||
func (st *stitcher) adjacentOffset(f []rowCols, active []bool) (int, float32) {
|
||||
h := len(f)
|
||||
if len(st.last) != h {
|
||||
return 0, float32(1e9)
|
||||
}
|
||||
limit := max(h-stitchMinCompare-1, 0)
|
||||
|
||||
bestD, bestDiff := 0, float32(1e9)
|
||||
countdown := -1
|
||||
try := func(d int) bool {
|
||||
if d < -limit || d > limit {
|
||||
return false
|
||||
}
|
||||
diff, activeMatches := st.pairDiff(f, active, d)
|
||||
if activeMatches >= stitchMinActive && diff < bestDiff {
|
||||
bestDiff, bestD = diff, d
|
||||
}
|
||||
switch {
|
||||
case bestDiff < stitchApproxDiff/4:
|
||||
return true
|
||||
case bestDiff < stitchApproxDiff && countdown < 0:
|
||||
countdown = 10
|
||||
}
|
||||
if countdown > 0 {
|
||||
countdown--
|
||||
}
|
||||
return countdown == 0
|
||||
}
|
||||
|
||||
if try(st.lastOffset) {
|
||||
return bestD, bestDiff
|
||||
}
|
||||
for k := 1; ; k++ {
|
||||
lo, hi := st.lastOffset-k, st.lastOffset+k
|
||||
if lo < -limit && hi > limit {
|
||||
break
|
||||
}
|
||||
if try(hi) || try(lo) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return bestD, bestDiff
|
||||
}
|
||||
|
||||
func (st *stitcher) pairDiff(f []rowCols, active []bool, d int) (float32, int) {
|
||||
h := len(f)
|
||||
top, bottom := matchIgnores(h)
|
||||
lo := max(top, -d)
|
||||
hi := min(h-bottom, h-d)
|
||||
|
||||
count := hi - lo
|
||||
if count < stitchMinCompare {
|
||||
return float32(1e9), 0
|
||||
}
|
||||
var sum float32
|
||||
activeMatches := 0
|
||||
for i := lo; i < hi; i++ {
|
||||
rd := rowColsDiff(f[i], st.last[i+d])
|
||||
sum += rd
|
||||
if active[i] && rd <= stitchRowMatchTol {
|
||||
activeMatches++
|
||||
}
|
||||
}
|
||||
return sum / float32(count), activeMatches
|
||||
}
|
||||
|
||||
func (st *stitcher) canvasDiff(f []rowCols, active []bool, pos int) (float32, int, int) {
|
||||
h := len(f)
|
||||
top, bottom := matchIgnores(h)
|
||||
lo := max(top, -pos)
|
||||
hi := min(h-bottom, len(st.cols)-pos)
|
||||
|
||||
count := hi - lo
|
||||
if count < 1 {
|
||||
return float32(1e9), 0, 0
|
||||
}
|
||||
var sum float32
|
||||
activeMatches := 0
|
||||
for i := lo; i < hi; i++ {
|
||||
rd := rowColsDiff(f[i], st.cols[pos+i])
|
||||
sum += rd
|
||||
if active[i] && rd <= stitchRowMatchTol {
|
||||
activeMatches++
|
||||
}
|
||||
}
|
||||
return sum / float32(count), count, activeMatches
|
||||
}
|
||||
|
||||
// mark-shot's findEdgePosition (nearOnly: edges + prediction window, 1px) and
|
||||
// findKnownPosition (coarse sweep refined around the winner)
|
||||
func (st *stitcher) scanPositions(f []rowCols, active []bool, pred int, nearOnly bool) (int, float32, bool) {
|
||||
h := len(f)
|
||||
C := len(st.cols)
|
||||
minPos := stitchMinCanvas - h
|
||||
maxPos := C - stitchMinCanvas
|
||||
|
||||
bestPos, bestDiff := 0, float32(1e9)
|
||||
bestDist := 1 << 30
|
||||
consider := func(pos int) {
|
||||
if pos < minPos || pos > maxPos {
|
||||
return
|
||||
}
|
||||
diff, ok := st.verifyAt(f, active, pos)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
dist := pos - pred
|
||||
if dist < 0 {
|
||||
dist = -dist
|
||||
}
|
||||
better := diff < bestDiff
|
||||
if !nearOnly {
|
||||
better = dist < bestDist || dist == bestDist && diff < bestDiff
|
||||
}
|
||||
if better {
|
||||
bestPos, bestDiff, bestDist = pos, diff, dist
|
||||
}
|
||||
}
|
||||
|
||||
if nearOnly {
|
||||
for pos := pred - stitchPredictWindow; pos <= pred+stitchPredictWindow; pos++ {
|
||||
consider(pos)
|
||||
}
|
||||
for pos := C - h; pos <= maxPos; pos++ {
|
||||
consider(pos)
|
||||
}
|
||||
for pos := minPos; pos <= 0; pos++ {
|
||||
consider(pos)
|
||||
}
|
||||
if bestDiff > stitchAcceptDiff {
|
||||
return 0, 0, false
|
||||
}
|
||||
return bestPos, bestDiff, true
|
||||
}
|
||||
|
||||
for pos := minPos; pos <= maxPos; pos += stitchCoarseStep {
|
||||
consider(pos)
|
||||
}
|
||||
if bestDiff > stitchAcceptDiff {
|
||||
return 0, 0, false
|
||||
}
|
||||
|
||||
refined, refinedDiff := bestPos, bestDiff
|
||||
for pos := bestPos - stitchCoarseStep + 1; pos < bestPos+stitchCoarseStep; pos++ {
|
||||
if pos == bestPos {
|
||||
continue
|
||||
}
|
||||
if diff, ok := st.verifyAt(f, active, pos); ok && diff < refinedDiff {
|
||||
refined, refinedDiff = pos, diff
|
||||
}
|
||||
}
|
||||
return refined, refinedDiff, true
|
||||
}
|
||||
|
||||
func (st *stitcher) appendRows(frame []byte, f []rowCols, from int) int {
|
||||
n := len(f) - from
|
||||
if room := st.maxRows - len(st.cols); n > room {
|
||||
n = room
|
||||
st.full = true
|
||||
}
|
||||
if n <= 0 {
|
||||
st.full = true
|
||||
return 0
|
||||
}
|
||||
|
||||
st.canvas = append(st.canvas, frame[from*st.stride:(from+n)*st.stride]...)
|
||||
st.cols = append(st.cols, f[from:from+n]...)
|
||||
return n
|
||||
}
|
||||
|
||||
func (st *stitcher) prependRows(frame []byte, f []rowCols, n int) int {
|
||||
if room := st.maxRows - len(st.cols); n > room {
|
||||
n = room
|
||||
st.full = true
|
||||
}
|
||||
if n <= 0 {
|
||||
st.full = true
|
||||
return 0
|
||||
}
|
||||
|
||||
canvas := make([]byte, n*st.stride+len(st.canvas))
|
||||
copy(canvas, frame[:n*st.stride])
|
||||
copy(canvas[n*st.stride:], st.canvas)
|
||||
st.canvas = canvas
|
||||
|
||||
cols := make([]rowCols, 0, n+len(st.cols))
|
||||
cols = append(cols, f[:n]...)
|
||||
st.cols = append(cols, st.cols...)
|
||||
return n
|
||||
}
|
||||
|
||||
func abs32(f float32) float32 {
|
||||
if f < 0 {
|
||||
return -f
|
||||
}
|
||||
return f
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package screenshot
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/rand"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const (
|
||||
testStride = 512
|
||||
testFrameH = 240
|
||||
)
|
||||
|
||||
func makePage(t *testing.T, rows int) []byte {
|
||||
t.Helper()
|
||||
rng := rand.New(rand.NewSource(42))
|
||||
page := make([]byte, rows*testStride)
|
||||
rng.Read(page)
|
||||
return page
|
||||
}
|
||||
|
||||
func frameAt(page []byte, top int) []byte {
|
||||
return page[top*testStride : (top+testFrameH)*testStride]
|
||||
}
|
||||
|
||||
func pushFrame(st *stitcher, frame []byte) int {
|
||||
n, _ := st.pushFrame(frame, st.rowSamples(frame))
|
||||
return n
|
||||
}
|
||||
|
||||
func TestStitchSlidingWindows(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
|
||||
for _, delta := range []int{20, 60, 110} {
|
||||
st := newStitcher(testStride)
|
||||
lastTop := 0
|
||||
for top := 0; top+testFrameH <= 900; top += delta {
|
||||
lastTop = top
|
||||
pushFrame(st, frameAt(page, top))
|
||||
}
|
||||
|
||||
wantRows := lastTop + testFrameH
|
||||
if st.rows() != wantRows {
|
||||
t.Fatalf("delta %d: got %d rows, want %d", delta, st.rows(), wantRows)
|
||||
}
|
||||
if !bytes.Equal(st.canvas, page[:wantRows*testStride]) {
|
||||
t.Fatalf("delta %d: canvas does not match source rows", delta)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchDropsNoOverlap(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
st := newStitcher(testStride)
|
||||
|
||||
pushFrame(st, frameAt(page, 0))
|
||||
if appended := pushFrame(st, frameAt(page, testFrameH+50)); appended != 0 {
|
||||
t.Fatalf("unmatched jump appended %d rows", appended)
|
||||
}
|
||||
if !bytes.Equal(st.canvas, page[:testFrameH*testStride]) {
|
||||
t.Fatal("canvas changed on unmatched frame")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchNoGrowthCases(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
blank := make([]byte, testFrameH*testStride)
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
first, second []byte
|
||||
}{
|
||||
{"identical frame", frameAt(page, 0), frameAt(page, 0)},
|
||||
{"jitter below min append", frameAt(page, 0), frameAt(page, stitchMinAppend-5)},
|
||||
{"blank on blank", blank, blank},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
st := newStitcher(testStride)
|
||||
pushFrame(st, tc.first)
|
||||
if appended := pushFrame(st, tc.second); appended != 0 {
|
||||
t.Fatalf("%s: appended %d rows", tc.name, appended)
|
||||
}
|
||||
if st.rows() != testFrameH {
|
||||
t.Fatalf("%s: got %d rows, want %d", tc.name, st.rows(), testFrameH)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchRevisitNeverDuplicates(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
st := newStitcher(testStride)
|
||||
|
||||
pushFrame(st, frameAt(page, 0))
|
||||
pushFrame(st, frameAt(page, 100))
|
||||
pushFrame(st, frameAt(page, 200))
|
||||
|
||||
for _, top := range []int{150, 60, 0, 80, 190} {
|
||||
if appended := pushFrame(st, frameAt(page, top)); appended != 0 {
|
||||
t.Fatalf("revisited frame at %d appended %d rows", top, appended)
|
||||
}
|
||||
}
|
||||
pushFrame(st, frameAt(page, 300))
|
||||
|
||||
wantRows := 300 + testFrameH
|
||||
if st.rows() != wantRows {
|
||||
t.Fatalf("got %d rows, want %d", st.rows(), wantRows)
|
||||
}
|
||||
if !bytes.Equal(st.canvas, page[:wantRows*testStride]) {
|
||||
t.Fatal("canvas corrupted by revisited frames")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchScrollUpPrepends(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
st := newStitcher(testStride)
|
||||
|
||||
pushFrame(st, frameAt(page, 500))
|
||||
if appended := pushFrame(st, frameAt(page, 420)); appended != 80 {
|
||||
t.Fatalf("upward frame appended %d rows, want 80", appended)
|
||||
}
|
||||
pushFrame(st, frameAt(page, 560))
|
||||
|
||||
if !bytes.Equal(st.canvas, page[420*testStride:(560+testFrameH)*testStride]) {
|
||||
t.Fatal("canvas does not match page range after prepend + append")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchNoisyChromeStillMatches(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
st := newStitcher(testStride)
|
||||
|
||||
addChrome := func(frame []byte, seed byte) []byte {
|
||||
f := slices.Clone(frame)
|
||||
for y := range testFrameH {
|
||||
for x := range 32 {
|
||||
f[y*testStride+x] = seed + byte(y)
|
||||
}
|
||||
}
|
||||
for y := 100; y < 124; y++ {
|
||||
for x := testStride / 2; x < testStride/2+40; x++ {
|
||||
f[y*testStride+x] ^= 0x08
|
||||
}
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
pushFrame(st, addChrome(frameAt(page, 0), 1))
|
||||
if appended := pushFrame(st, addChrome(frameAt(page, 90), 2)); appended != 90 {
|
||||
t.Fatalf("appended %d rows, want 90", appended)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStitchMaxRowsCap(t *testing.T) {
|
||||
page := makePage(t, 1000)
|
||||
st := newStitcher(testStride)
|
||||
st.maxRows = testFrameH + 10
|
||||
|
||||
pushFrame(st, frameAt(page, 0))
|
||||
if appended := pushFrame(st, frameAt(page, 100)); appended != 10 {
|
||||
t.Fatalf("appended %d rows past cap, want 10", appended)
|
||||
}
|
||||
if !st.full {
|
||||
t.Fatal("stitcher not marked full at cap")
|
||||
}
|
||||
if pushFrame(st, frameAt(page, 300)) != 0 {
|
||||
t.Fatal("push after full appended rows")
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ const (
|
||||
ModeAllScreens
|
||||
ModeOutput
|
||||
ModeLastRegion
|
||||
ModeScroll
|
||||
)
|
||||
|
||||
type Format int
|
||||
@@ -62,6 +63,7 @@ type Config struct {
|
||||
SaveFile bool
|
||||
Notify bool
|
||||
Stdout bool
|
||||
IntervalMs int
|
||||
}
|
||||
|
||||
func DefaultConfig() Config {
|
||||
|
||||
@@ -744,6 +744,32 @@ func (b *IWDBackend) DisconnectWiFi() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *IWDBackend) abortInFlightConnection(ssid string) {
|
||||
b.stateMutex.Lock()
|
||||
if !b.state.IsConnecting || b.state.ConnectingSSID != ssid {
|
||||
b.stateMutex.Unlock()
|
||||
return
|
||||
}
|
||||
b.state.IsConnecting = false
|
||||
b.state.ConnectingSSID = ""
|
||||
b.state.LastError = ""
|
||||
b.stateMutex.Unlock()
|
||||
|
||||
b.attemptMutex.RLock()
|
||||
att := b.curAttempt
|
||||
b.attemptMutex.RUnlock()
|
||||
|
||||
if att != nil && att.ssid == ssid {
|
||||
att.mu.Lock()
|
||||
att.finalized = true
|
||||
att.mu.Unlock()
|
||||
}
|
||||
|
||||
if err := b.DisconnectWiFi(); err != nil {
|
||||
log.Warnf("[abortInFlightConnection] failed to abort connection to %s: %v", ssid, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *IWDBackend) ForgetWiFiNetwork(ssid string) error {
|
||||
b.stateMutex.RLock()
|
||||
currentSSID := b.state.WiFiSSID
|
||||
@@ -812,6 +838,10 @@ func (b *IWDBackend) SetWiFiAutoconnect(ssid string, autoconnect bool) error {
|
||||
return fmt.Errorf("failed to set autoconnect: %w", call.Err)
|
||||
}
|
||||
|
||||
if !autoconnect {
|
||||
b.abortInFlightConnection(ssid)
|
||||
}
|
||||
|
||||
b.updateState()
|
||||
|
||||
if b.onStateChange != nil {
|
||||
|
||||
@@ -359,6 +359,24 @@ func (b *NetworkManagerBackend) DisconnectWiFi() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *NetworkManagerBackend) abortInFlightConnection(ssid string) {
|
||||
b.stateMutex.Lock()
|
||||
if !b.state.IsConnecting || b.state.ConnectingSSID != ssid {
|
||||
b.stateMutex.Unlock()
|
||||
return
|
||||
}
|
||||
b.state.IsConnecting = false
|
||||
b.state.ConnectingSSID = ""
|
||||
b.state.LastError = ""
|
||||
b.stateMutex.Unlock()
|
||||
|
||||
b.clearCachedWiFiSecretBySSID(ssid)
|
||||
|
||||
if err := b.DisconnectWiFi(); err != nil {
|
||||
log.Warnf("[abortInFlightConnection] failed to abort connection to %s: %v", ssid, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *NetworkManagerBackend) ForgetWiFiNetwork(ssid string) error {
|
||||
conn, err := b.findConnection(ssid)
|
||||
if err != nil {
|
||||
@@ -963,6 +981,10 @@ func (b *NetworkManagerBackend) SetWiFiAutoconnect(ssid string, autoconnect bool
|
||||
return fmt.Errorf("failed to update connection: %w", err)
|
||||
}
|
||||
|
||||
if !autoconnect {
|
||||
b.abortInFlightConnection(ssid)
|
||||
}
|
||||
|
||||
b.updateWiFiNetworks()
|
||||
|
||||
if b.onStateChange != nil {
|
||||
|
||||
@@ -50,11 +50,42 @@ func (b pacmanBackend) Upgrade(ctx context.Context, opts UpgradeOptions, onLine
|
||||
}
|
||||
|
||||
func pacmanUpgradeArgv(opts UpgradeOptions) []string {
|
||||
argv := []string{"pacman", "-Syu", "--noconfirm", "--needed"}
|
||||
if len(opts.Ignored) > 0 {
|
||||
argv = append(argv, "--ignore", strings.Join(opts.Ignored, ","))
|
||||
return privilegedArgv(opts, "pacman", "-Syu", "--noconfirm", "--needed")
|
||||
}
|
||||
|
||||
// Dont allow partial updates on arch, if they wanna break their system they can do it outside of DMS:
|
||||
// https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported
|
||||
// AUR packages are exempt — holding those cannot break the repo dependency graph.
|
||||
func dropPacmanRepoIgnores(ignored []string, pending []Package) []string {
|
||||
if len(ignored) == 0 {
|
||||
return ignored
|
||||
}
|
||||
repoPending := make(map[string]bool, len(pending))
|
||||
for _, p := range pending {
|
||||
if p.Repo == RepoSystem {
|
||||
repoPending[p.Name] = true
|
||||
}
|
||||
}
|
||||
out := make([]string, 0, len(ignored))
|
||||
for _, name := range ignored {
|
||||
if repoPending[name] {
|
||||
continue
|
||||
}
|
||||
out = append(out, name)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func isPacmanFamily(b Backend) bool {
|
||||
if b == nil {
|
||||
return false
|
||||
}
|
||||
switch b.ID() {
|
||||
case "pacman", "paru", "yay":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return privilegedArgv(opts, argv...)
|
||||
}
|
||||
|
||||
type archHelperBackend struct {
|
||||
@@ -112,7 +143,7 @@ func (b archHelperBackend) Upgrade(ctx context.Context, opts UpgradeOptions, onL
|
||||
}
|
||||
cmd := strings.Join(archHelperUpgradeArgv(b.id, opts.IncludeAUR, opts.Ignored), " ")
|
||||
title := fmt.Sprintf("DMS — System Update (%s)", b.id)
|
||||
return Run(ctx, wrapInTerminal(term, title, cmd), RunOptions{OnLine: onLine})
|
||||
return Run(ctx, wrapInTerminal(term, title, cmd, opts.TerminalArgs), RunOptions{OnLine: onLine})
|
||||
}
|
||||
|
||||
func archHelperUpgradeArgv(id string, includeAUR bool, ignored []string) []string {
|
||||
|
||||
@@ -119,7 +119,7 @@ func findTerminal(override string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func wrapInTerminal(term, title, shellCmd string) []string {
|
||||
func wrapInTerminal(term, title, shellCmd string, extraArgs []string) []string {
|
||||
const appID = "com.danklinux.dms"
|
||||
banner := fmt.Sprintf(
|
||||
`printf '\033[1;36m=== %s ===\033[0m\n'; printf '\033[2m$ %s\033[0m\n'; printf '\033[33mYou may be prompted for your sudo password to apply system updates.\033[0m\n\n'`,
|
||||
@@ -129,24 +129,25 @@ func wrapInTerminal(term, title, shellCmd string) []string {
|
||||
export := `export SUDO_PROMPT="[DMS] sudo password for %u: "; `
|
||||
full := export + banner + "; " + shellCmd + "; " + closer
|
||||
|
||||
var argv []string
|
||||
execFlag := "-e"
|
||||
switch term {
|
||||
case "kitty":
|
||||
return []string{term, "--class", appID, "-T", title, "-e", "sh", "-c", full}
|
||||
case "alacritty":
|
||||
return []string{term, "--class", appID, "-T", title, "-e", "sh", "-c", full}
|
||||
case "kitty", "alacritty", "wezterm":
|
||||
argv = []string{term, "--class", appID, "-T", title}
|
||||
case "foot":
|
||||
return []string{term, "--app-id=" + appID, "--title=" + title, "-e", "sh", "-c", full}
|
||||
argv = []string{term, "--app-id=" + appID, "--title=" + title}
|
||||
case "ghostty":
|
||||
return []string{term, "--class=" + appID, "--title=" + title, "-e", "sh", "-c", full}
|
||||
case "wezterm":
|
||||
return []string{term, "--class", appID, "-T", title, "-e", "sh", "-c", full}
|
||||
argv = []string{term, "--class=" + appID, "--title=" + title}
|
||||
case "xterm":
|
||||
return []string{term, "-class", appID, "-T", title, "-e", "sh", "-c", full}
|
||||
argv = []string{term, "-class", appID, "-T", title}
|
||||
case "konsole":
|
||||
return []string{term, "-p", "tabtitle=" + title, "-e", "sh", "-c", full}
|
||||
argv = []string{term, "-p", "tabtitle=" + title}
|
||||
case "gnome-terminal":
|
||||
return []string{term, "--title=" + title, "--", "sh", "-c", full}
|
||||
argv = []string{term, "--title=" + title}
|
||||
execFlag = "--"
|
||||
default:
|
||||
return []string{term, "-e", "sh", "-c", full}
|
||||
argv = []string{term}
|
||||
}
|
||||
argv = append(argv, extraArgs...)
|
||||
return append(argv, execFlag, "sh", "-c", full)
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ func handleUpgrade(conn net.Conn, req models.Request, m *Manager) {
|
||||
DryRun: params.BoolOpt(req.Params, "dry", false),
|
||||
CustomCommand: params.StringOpt(req.Params, "customCommand", ""),
|
||||
Terminal: params.StringOpt(req.Params, "terminal", ""),
|
||||
TerminalArgs: stringSliceOpt(req.Params, "terminalArgs"),
|
||||
Ignored: stringSliceOpt(req.Params, "ignored"),
|
||||
}
|
||||
if err := m.Upgrade(opts); err != nil {
|
||||
|
||||
@@ -336,7 +336,7 @@ func (m *Manager) runUpgrade(ctx context.Context, opts UpgradeOptions) {
|
||||
}()
|
||||
|
||||
if opts.CustomCommand != "" {
|
||||
m.runCustomUpgrade(ctx, opts.CustomCommand, opts.Terminal)
|
||||
m.runCustomUpgrade(ctx, opts)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -345,6 +345,9 @@ func (m *Manager) runUpgrade(ctx context.Context, opts UpgradeOptions) {
|
||||
opts.Targets = append([]Package(nil), m.state.Packages...)
|
||||
m.mu.RUnlock()
|
||||
}
|
||||
if isPacmanFamily(m.selection.System) {
|
||||
opts.Ignored = dropPacmanRepoIgnores(opts.Ignored, opts.Targets)
|
||||
}
|
||||
opts.Targets = dropIgnoredTargets(opts.Targets, opts.Ignored)
|
||||
|
||||
backends := upgradeBackends(m.selection, opts)
|
||||
@@ -389,8 +392,8 @@ func (m *Manager) runUpgrade(ctx context.Context, opts UpgradeOptions) {
|
||||
m.finishSuccessfulUpgrade(true)
|
||||
}
|
||||
|
||||
func (m *Manager) runCustomUpgrade(ctx context.Context, command, terminalOverride string) {
|
||||
term := findTerminal(terminalOverride)
|
||||
func (m *Manager) runCustomUpgrade(ctx context.Context, opts UpgradeOptions) {
|
||||
term := findTerminal(opts.Terminal)
|
||||
if term == "" {
|
||||
m.setError(ErrCodeBackendFailed, "no terminal found (pick one in DMS settings, set $TERMINAL, or install kitty/ghostty/foot/alacritty)")
|
||||
return
|
||||
@@ -407,7 +410,7 @@ func (m *Manager) runCustomUpgrade(ctx context.Context, command, terminalOverrid
|
||||
m.markDirty()
|
||||
|
||||
onLine := func(line string) { m.appendLog(line) }
|
||||
argv := wrapInTerminal(term, "DMS — System Update (custom)", command)
|
||||
argv := wrapInTerminal(term, "DMS — System Update (custom)", opts.CustomCommand, opts.TerminalArgs)
|
||||
if err := Run(ctx, argv, RunOptions{OnLine: onLine}); err != nil {
|
||||
code := ErrCodeBackendFailed
|
||||
switch {
|
||||
@@ -425,6 +428,7 @@ func (m *Manager) runCustomUpgrade(ctx context.Context, command, terminalOverrid
|
||||
}
|
||||
|
||||
m.finishSuccessfulUpgrade(false)
|
||||
m.runRefresh(context.Background(), false)
|
||||
}
|
||||
|
||||
func (m *Manager) finishSuccessfulUpgrade(clearPackages bool) {
|
||||
|
||||
@@ -80,6 +80,7 @@ type UpgradeOptions struct {
|
||||
AttachStdio bool
|
||||
CustomCommand string
|
||||
Terminal string
|
||||
TerminalArgs []string
|
||||
Targets []Package
|
||||
Ignored []string
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ func TestUpgradeCommandBuilders(t *testing.T) {
|
||||
want: []string{"paru", "-Syu", "--noconfirm", "--needed", "--ignore", "linux,discord"},
|
||||
},
|
||||
{
|
||||
name: "pacman with ignored packages",
|
||||
name: "pacman never passes --ignore",
|
||||
got: pacmanUpgradeArgv(UpgradeOptions{Ignored: []string{"linux"}}),
|
||||
want: []string{"pkexec", "pacman", "-Syu", "--noconfirm", "--needed", "--ignore", "linux"},
|
||||
want: []string{"pkexec", "pacman", "-Syu", "--noconfirm", "--needed"},
|
||||
},
|
||||
{
|
||||
name: "dnf with ignored packages",
|
||||
@@ -106,6 +106,18 @@ func TestUpgradeCommandBuilders(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDropPacmanRepoIgnoresKeepsAURHolds(t *testing.T) {
|
||||
pending := []Package{
|
||||
{Name: "linux", Repo: RepoSystem},
|
||||
{Name: "librewolf", Repo: RepoAUR},
|
||||
}
|
||||
got := dropPacmanRepoIgnores([]string{"linux", "librewolf", "not-pending"}, pending)
|
||||
want := []string{"librewolf", "not-pending"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("ignored = %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAptUpgradeArgvHoldsIgnored(t *testing.T) {
|
||||
argv := aptUpgradeArgv("apt-get", UpgradeOptions{Ignored: []string{"linux-image-generic", "bad;name"}})
|
||||
if len(argv) < 2 || argv[len(argv)-2] != "-c" {
|
||||
|
||||
@@ -200,7 +200,9 @@ in
|
||||
];
|
||||
# DMS currently relies on /etc/pam.d/login for lock screen password auth on NixOS.
|
||||
# Declare security.pam.services.dankshell only if you want to override that runtime fallback.
|
||||
# U2F and fingerprint are handled separately by DMS — do not add pam_u2f or pam_fprintd here.
|
||||
# Do not add pam_u2f or pam_fprintd here for security-key unlock, enable
|
||||
# programs.dank-material-shell.lockscreen.securityKey.enable, which declares the
|
||||
# dedicated dankshell-u2f service DMS drives on its own.
|
||||
# security.pam.services.dankshell = {
|
||||
# # Example: add faillock
|
||||
# faillock.enable = true;
|
||||
|
||||
@@ -23,6 +23,15 @@ in
|
||||
description = "Systemd target to bind to.";
|
||||
default = "graphical-session.target";
|
||||
};
|
||||
options.programs.dank-material-shell.lockscreen.securityKey = {
|
||||
enable = lib.mkEnableOption "FIDO2/U2F security key unlock for the DMS lock screen via a dedicated dankshell-u2f PAM service";
|
||||
package = lib.mkPackageOption pkgs "pam_u2f" { };
|
||||
moduleArgs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "cue" ];
|
||||
description = "Arguments passed to pam_u2f.so in the dankshell-u2f PAM service.";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
|
||||
description = "DankMaterialShell";
|
||||
@@ -46,6 +55,18 @@ in
|
||||
inherit value;
|
||||
}) common.plugins;
|
||||
|
||||
# DMS's bundled U2F fallback stack references pam_u2f.so by name, which NixOS's
|
||||
# libpam cannot resolve; the dedicated service below uses the absolute store path
|
||||
# and is picked up automatically by the lock screen when present.
|
||||
security.pam.services."dankshell-u2f" = lib.mkIf cfg.lockscreen.securityKey.enable {
|
||||
text = ''
|
||||
auth required ${cfg.lockscreen.securityKey.package}/lib/security/pam_u2f.so ${lib.concatStringsSep " " cfg.lockscreen.securityKey.moduleArgs}
|
||||
account required pam_permit.so
|
||||
password required pam_deny.so
|
||||
session required pam_permit.so
|
||||
'';
|
||||
};
|
||||
|
||||
services.power-profiles-daemon.enable = lib.mkDefault true;
|
||||
services.accounts-daemon.enable = lib.mkDefault true;
|
||||
services.geoclue2.enable = lib.mkDefault true;
|
||||
|
||||
@@ -19,6 +19,7 @@ pkgs.testers.runNixOSTest {
|
||||
programs.dank-material-shell = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
lockscreen.securityKey.enable = true;
|
||||
plugins = {
|
||||
TestPlugin = {
|
||||
src = pkgs.emptyDirectory;
|
||||
@@ -39,6 +40,7 @@ pkgs.testers.runNixOSTest {
|
||||
machine.succeed("su -- danklinux -c 'dms --help >/dev/null'")
|
||||
machine.succeed("test -d /etc/xdg/quickshell/dms-plugins")
|
||||
machine.succeed("test -f /run/current-system/sw/lib/systemd/user/dms.service")
|
||||
machine.succeed("grep -q 'lib/security/pam_u2f.so cue' /etc/pam.d/dankshell-u2f")
|
||||
|
||||
payload = json.loads(machine.succeed("su -- danklinux -c 'dms doctor --json'"))
|
||||
t.assertIn("summary", payload)
|
||||
|
||||
@@ -11,6 +11,8 @@ Singleton {
|
||||
|
||||
property var appUsageRanking: {}
|
||||
property bool _saving: false
|
||||
property bool _hasLoaded: false
|
||||
property bool _parseError: false
|
||||
|
||||
Component.onCompleted: {
|
||||
loadSettings();
|
||||
@@ -21,15 +23,21 @@ Singleton {
|
||||
}
|
||||
|
||||
function parseSettings(content) {
|
||||
_parseError = false;
|
||||
try {
|
||||
if (content && content.trim()) {
|
||||
var settings = JSON.parse(content);
|
||||
appUsageRanking = settings.appUsageRanking || {};
|
||||
}
|
||||
} catch (e) {}
|
||||
_hasLoaded = true;
|
||||
} catch (e) {
|
||||
_parseError = true;
|
||||
}
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
if (_parseError || !_hasLoaded)
|
||||
return;
|
||||
settingsFile.setText(JSON.stringify({
|
||||
"appUsageRanking": appUsageRanking
|
||||
}, null, 2));
|
||||
|
||||
@@ -63,6 +63,7 @@ const DMS_ACTIONS = [
|
||||
{ id: "spawn dms ipc call keybinds open niri", label: "Keybinds Cheatsheet: Open", compositor: "niri" },
|
||||
{ id: "spawn dms ipc call keybinds close", label: "Keybinds Cheatsheet: Close" },
|
||||
{ id: "spawn dms ipc call lock lock", label: "Lock Screen" },
|
||||
{ id: "spawn dms ipc call lock lockAndOutputsOff", label: "Lock Screen & Outputs Off" },
|
||||
{ id: "spawn dms ipc call lock demo", label: "Lock Screen: Demo" },
|
||||
{ id: "spawn dms ipc call inhibit toggle", label: "Idle Inhibit: Toggle" },
|
||||
{ id: "spawn dms ipc call inhibit enable", label: "Idle Inhibit: Enable" },
|
||||
|
||||
@@ -65,16 +65,35 @@ Singleton {
|
||||
|
||||
function _openPopout(popout) {
|
||||
if (popout.dashVisible !== undefined) {
|
||||
if (popout.dashVisible && !popout.shouldBeVisible && !popout.isClosing)
|
||||
let flagStayedTrue = popout.dashVisible === true;
|
||||
if (popout.dashVisible && !popout.shouldBeVisible && !popout.isClosing) {
|
||||
popout.dashVisible = false;
|
||||
flagStayedTrue = false;
|
||||
}
|
||||
popout.dashVisible = true;
|
||||
// Flag already true (e.g. retargeting to another monitor) won't re-fire
|
||||
// the change handler, so drive the surface open explicitly.
|
||||
if (flagStayedTrue)
|
||||
_ensureSurfaceOpen(popout);
|
||||
return;
|
||||
}
|
||||
if (popout.notificationHistoryVisible !== undefined) {
|
||||
const flagStayedTrue = popout.notificationHistoryVisible === true;
|
||||
popout.notificationHistoryVisible = true;
|
||||
if (flagStayedTrue)
|
||||
_ensureSurfaceOpen(popout);
|
||||
return;
|
||||
}
|
||||
popout.open();
|
||||
_ensureSurfaceOpen(popout);
|
||||
}
|
||||
|
||||
function _ensureSurfaceOpen(popout) {
|
||||
if (typeof popout.present === "function") {
|
||||
popout.present();
|
||||
return;
|
||||
}
|
||||
if (typeof popout.open === "function")
|
||||
popout.open();
|
||||
}
|
||||
|
||||
function _closePopout(popout) {
|
||||
|
||||
@@ -240,6 +240,8 @@ Singleton {
|
||||
onBlurForegroundLayersChanged: saveSettings()
|
||||
property real blurLayerOutlineOpacity: 0.12
|
||||
onBlurLayerOutlineOpacityChanged: saveSettings()
|
||||
property bool blurBorderEnabled: true
|
||||
onBlurBorderEnabledChanged: saveSettings()
|
||||
property string blurBorderColor: "outline"
|
||||
onBlurBorderColorChanged: saveSettings()
|
||||
property string blurBorderCustomColor: "#ffffff"
|
||||
@@ -859,6 +861,7 @@ Singleton {
|
||||
property bool notificationOverlayEnabled: false
|
||||
property bool notificationPopupShadowEnabled: true
|
||||
property bool notificationPopupPrivacyMode: false
|
||||
property bool notificationForegroundLayers: true
|
||||
property int overviewRows: 2
|
||||
property int overviewColumns: 5
|
||||
property real overviewScale: 0.16
|
||||
@@ -898,6 +901,8 @@ Singleton {
|
||||
property string lockPamPath: ""
|
||||
property bool lockPamInlineFprint: false
|
||||
property bool lockPamInlineU2f: false
|
||||
property bool lockPamExternallyManaged: false
|
||||
property string lockU2fPamPath: ""
|
||||
property bool greeterPamExternallyManaged: false
|
||||
property string lockScreenInactiveColor: "#000000"
|
||||
property int lockScreenNotificationMode: 0
|
||||
|
||||
@@ -580,11 +580,15 @@ Singleton {
|
||||
readonly property bool foregroundLayers: typeof SettingsData === "undefined" || (SettingsData.blurForegroundLayers ?? true)
|
||||
readonly property bool blurForegroundLayers: BlurService.enabled && foregroundLayers
|
||||
readonly property bool transparentBlurLayers: BlurService.enabled && !foregroundLayers
|
||||
readonly property bool notificationForegroundLayers: typeof SettingsData === "undefined" || (SettingsData.notificationForegroundLayers ?? true)
|
||||
readonly property color readableSurface: withAlpha(surfaceContainer, popupTransparency)
|
||||
readonly property color readableSurfaceHigh: withAlpha(surfaceContainerHigh, popupTransparency)
|
||||
readonly property color floatingSurface: foregroundLayers ? readableSurface : withAlpha(readableSurface, 0)
|
||||
readonly property color floatingSurfaceHigh: foregroundLayers ? readableSurfaceHigh : withAlpha(readableSurfaceHigh, 0)
|
||||
readonly property color nestedSurface: floatingSurfaceHigh
|
||||
readonly property color notificationFloatingSurface: notificationForegroundLayers ? readableSurface : withAlpha(readableSurface, 0)
|
||||
readonly property color notificationFloatingSurfaceHigh: notificationForegroundLayers ? readableSurfaceHigh : withAlpha(readableSurfaceHigh, 0)
|
||||
readonly property color notificationNestedSurface: notificationFloatingSurfaceHigh
|
||||
readonly property real blurLayerOutlineOpacity: Math.max(0, Math.min(1, typeof SettingsData === "undefined" ? 0.12 : (SettingsData.blurLayerOutlineOpacity ?? 0.12)))
|
||||
readonly property real layerOutlineOpacity: blurLayerOutlineOpacity
|
||||
readonly property int layerOutlineWidth: layerOutlineOpacity > 0 ? 1 : 0
|
||||
|
||||
@@ -63,6 +63,7 @@ Singleton {
|
||||
readonly property string u2fKeysPath: homeDir ? homeDir + "/.config/Yubico/u2f_keys" : ""
|
||||
readonly property bool homeU2fKeysDetected: u2fKeysPath !== "" && u2fKeysWatcher.loaded && u2fKeysText.trim() !== ""
|
||||
readonly property bool lockU2fCustomConfigDetected: pamModuleEnabled(dankshellU2fPamText, "pam_u2f")
|
||||
readonly property bool lockU2fCustomSourceDetected: (settingsRoot?.lockU2fPamPath || "") !== "" && customU2fPamWatcher.loaded
|
||||
readonly property bool greeterPamHasFprint: greeterPamStackHasModule("pam_fprintd")
|
||||
readonly property bool greeterPamHasU2f: greeterPamStackHasModule("pam_u2f")
|
||||
|
||||
@@ -176,7 +177,7 @@ Singleton {
|
||||
readonly property bool lockU2fReady: {
|
||||
if (forcedU2fAvailable !== null)
|
||||
return forcedU2fAvailable;
|
||||
return lockU2fCustomConfigDetected || homeU2fKeysDetected;
|
||||
return lockU2fCustomSourceDetected || lockU2fCustomConfigDetected || homeU2fKeysDetected;
|
||||
}
|
||||
|
||||
readonly property bool lockU2fCanEnable: {
|
||||
@@ -246,6 +247,10 @@ Singleton {
|
||||
readonly property var _pamProbeCommand: ["sh", "-c", "for module in pam_fprintd.so pam_u2f.so; do found=false; for dir in /usr/lib64/security /usr/lib/security /lib/security /lib/x86_64-linux-gnu/security /usr/lib/x86_64-linux-gnu/security /usr/lib/aarch64-linux-gnu/security /run/current-system/sw/lib/security; do if [ -f \"$dir/$module\" ]; then found=true; break; fi; done; printf '%s:%s\\n' \"$module\" \"$found\"; done"]
|
||||
|
||||
function detectAuthCapabilities() {
|
||||
// FileView cannot watch paths that do not exist yet, so reload the U2F PAM
|
||||
dankshellU2fPamWatcher.reload();
|
||||
u2fKeysWatcher.reload();
|
||||
|
||||
if (forcedFprintAvailable === null) {
|
||||
fingerprintProbeFinalized = false;
|
||||
Proc.runCommand("fprint-probe", _fprintProbeCommand, (output, exitCode) => {
|
||||
@@ -722,14 +727,22 @@ Singleton {
|
||||
FileView {
|
||||
id: dankshellU2fPamWatcher
|
||||
path: "/etc/pam.d/dankshell-u2f"
|
||||
watchChanges: true
|
||||
printErrors: false
|
||||
onLoaded: root.dankshellU2fPamText = text()
|
||||
onLoadFailed: root.dankshellU2fPamText = ""
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: customU2fPamWatcher
|
||||
path: root.settingsRoot?.lockU2fPamPath || ""
|
||||
printErrors: false
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: u2fKeysWatcher
|
||||
path: root.u2fKeysPath
|
||||
watchChanges: true
|
||||
printErrors: false
|
||||
onLoaded: root.u2fKeysText = text()
|
||||
onLoadFailed: root.u2fKeysText = ""
|
||||
|
||||
@@ -70,6 +70,7 @@ var SPEC = {
|
||||
blurEnabled: { def: false },
|
||||
blurForegroundLayers: { def: true },
|
||||
blurLayerOutlineOpacity: { def: 0.12, coerce: percentToUnit },
|
||||
blurBorderEnabled: { def: true },
|
||||
blurBorderColor: { def: "outline" },
|
||||
blurBorderCustomColor: { def: "#ffffff" },
|
||||
blurBorderOpacity: { def: 0.35, coerce: percentToUnit },
|
||||
@@ -437,6 +438,7 @@ var SPEC = {
|
||||
notificationOverlayEnabled: { def: false },
|
||||
notificationPopupShadowEnabled: { def: true },
|
||||
notificationPopupPrivacyMode: { def: false },
|
||||
notificationForegroundLayers: { def: true },
|
||||
overviewRows: { def: 2, persist: false },
|
||||
overviewColumns: { def: 5, persist: false },
|
||||
overviewScale: { def: 0.16, persist: false },
|
||||
@@ -459,6 +461,8 @@ var SPEC = {
|
||||
lockPamPath: { def: "" },
|
||||
lockPamInlineFprint: { def: false },
|
||||
lockPamInlineU2f: { def: false },
|
||||
lockPamExternallyManaged: { def: false },
|
||||
lockU2fPamPath: { def: "" },
|
||||
lockScreenInactiveColor: { def: "#000000" },
|
||||
lockScreenNotificationMode: { def: 0 },
|
||||
lockScreenVideoEnabled: { def: false },
|
||||
|
||||
+61
-66
@@ -1,3 +1,5 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
@@ -53,6 +55,7 @@ Item {
|
||||
delegate: Loader {
|
||||
id: fadeWindowLoader
|
||||
required property var modelData
|
||||
readonly property FadeToLockWindow loadedWindow: item as FadeToLockWindow
|
||||
active: SettingsData.fadeToLockEnabled
|
||||
asynchronous: false
|
||||
|
||||
@@ -64,29 +67,29 @@ Item {
|
||||
}
|
||||
|
||||
onFadeCancelled: {
|
||||
log.debug("Fade to lock cancelled by user on screen:", fadeWindowLoader.modelData.name);
|
||||
root.log.debug("Fade to lock cancelled by user on screen:", fadeWindowLoader.modelData.name);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: IdleService
|
||||
enabled: fadeWindowLoader.item !== null
|
||||
enabled: fadeWindowLoader.loadedWindow !== null
|
||||
|
||||
function onFadeToLockRequested() {
|
||||
if (fadeWindowLoader.item) {
|
||||
fadeWindowLoader.item.startFade();
|
||||
if (fadeWindowLoader.loadedWindow) {
|
||||
fadeWindowLoader.loadedWindow.startFade();
|
||||
}
|
||||
}
|
||||
|
||||
function onCancelFadeToLock() {
|
||||
if (fadeWindowLoader.item) {
|
||||
fadeWindowLoader.item.cancelFade();
|
||||
if (fadeWindowLoader.loadedWindow) {
|
||||
fadeWindowLoader.loadedWindow.cancelFade();
|
||||
}
|
||||
}
|
||||
|
||||
function onDismissFadeToLock() {
|
||||
if (fadeWindowLoader.item) {
|
||||
fadeWindowLoader.item.dismiss();
|
||||
if (fadeWindowLoader.loadedWindow) {
|
||||
fadeWindowLoader.loadedWindow.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +102,7 @@ Item {
|
||||
delegate: Loader {
|
||||
id: fadeDpmsWindowLoader
|
||||
required property var modelData
|
||||
readonly property FadeToDpmsWindow loadedWindow: item as FadeToDpmsWindow
|
||||
active: SettingsData.fadeToDpmsEnabled
|
||||
asynchronous: false
|
||||
|
||||
@@ -110,30 +114,38 @@ Item {
|
||||
}
|
||||
|
||||
onFadeCancelled: {
|
||||
log.debug("Fade to DPMS cancelled by user on screen:", fadeDpmsWindowLoader.modelData.name);
|
||||
root.log.debug("Fade to DPMS cancelled by user on screen:", fadeDpmsWindowLoader.modelData.name);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: IdleService
|
||||
enabled: fadeDpmsWindowLoader.item !== null
|
||||
enabled: fadeDpmsWindowLoader.loadedWindow !== null
|
||||
|
||||
function onFadeToDpmsRequested() {
|
||||
if (fadeDpmsWindowLoader.item) {
|
||||
fadeDpmsWindowLoader.item.startFade();
|
||||
if (fadeDpmsWindowLoader.loadedWindow) {
|
||||
fadeDpmsWindowLoader.loadedWindow.startFade();
|
||||
}
|
||||
}
|
||||
|
||||
function onCancelFadeToDpms() {
|
||||
if (fadeDpmsWindowLoader.item) {
|
||||
fadeDpmsWindowLoader.item.cancelFade();
|
||||
if (fadeDpmsWindowLoader.loadedWindow) {
|
||||
fadeDpmsWindowLoader.loadedWindow.cancelFade();
|
||||
}
|
||||
}
|
||||
|
||||
function onRequestMonitorOn() {
|
||||
if (!fadeDpmsWindowLoader.item)
|
||||
if (!fadeDpmsWindowLoader.loadedWindow)
|
||||
return;
|
||||
fadeDpmsWindowLoader.item.cancelFade();
|
||||
fadeDpmsWindowLoader.loadedWindow.cancelFade();
|
||||
}
|
||||
|
||||
function onMonitorsOffChanged() {
|
||||
if (IdleService.monitorsOff)
|
||||
return;
|
||||
if (!fadeDpmsWindowLoader.loadedWindow)
|
||||
return;
|
||||
fadeDpmsWindowLoader.loadedWindow.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -351,9 +363,7 @@ Item {
|
||||
Variants {
|
||||
model: SettingsData.notificationFocusedMonitor ? Quickshell.screens : SettingsData.getFilteredScreens("notifications")
|
||||
|
||||
delegate: NotificationPopupManager {
|
||||
modelData: item
|
||||
}
|
||||
delegate: NotificationPopupManager {}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
@@ -387,6 +397,7 @@ Item {
|
||||
LazyLoader {
|
||||
id: wifiPasswordModalLoader
|
||||
active: false
|
||||
readonly property WifiPasswordModal loadedModal: item as WifiPasswordModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.wifiPasswordModalLoader = wifiPasswordModalLoader;
|
||||
@@ -421,6 +432,7 @@ Item {
|
||||
LazyLoader {
|
||||
id: polkitAuthModalLoader
|
||||
active: false
|
||||
readonly property PolkitAuthModal loadedModal: item as PolkitAuthModal
|
||||
|
||||
PolkitAuthModal {
|
||||
id: polkitAuthModal
|
||||
@@ -439,8 +451,8 @@ Item {
|
||||
if (PopoutService.systemUpdatePopout?.shouldBeVisible)
|
||||
return;
|
||||
polkitAuthModalLoader.active = true;
|
||||
if (polkitAuthModalLoader.item)
|
||||
polkitAuthModalLoader.item.show();
|
||||
if (polkitAuthModalLoader.loadedModal)
|
||||
polkitAuthModalLoader.loadedModal.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,20 +471,20 @@ Item {
|
||||
target: NetworkService
|
||||
|
||||
function onCredentialsNeeded(token, ssid, setting, fields, hints, reason, connType, connName, vpnService, fieldsInfo) {
|
||||
const alreadyShown = wifiPasswordModalLoader.item && wifiPasswordModalLoader.item.shouldBeVisible;
|
||||
if (alreadyShown && token === lastCredentialsToken)
|
||||
const alreadyShown = wifiPasswordModalLoader.loadedModal && wifiPasswordModalLoader.loadedModal.shouldBeVisible;
|
||||
if (alreadyShown && token === root.lastCredentialsToken)
|
||||
return;
|
||||
|
||||
wifiPasswordModalLoader.active = true;
|
||||
if (!wifiPasswordModalLoader.item)
|
||||
if (!wifiPasswordModalLoader.loadedModal)
|
||||
return;
|
||||
|
||||
if (alreadyShown && lastCredentialsToken !== "" && lastCredentialsToken !== token)
|
||||
NetworkService.cancelCredentials(lastCredentialsToken);
|
||||
if (alreadyShown && root.lastCredentialsToken !== "" && root.lastCredentialsToken !== token)
|
||||
NetworkService.cancelCredentials(root.lastCredentialsToken);
|
||||
|
||||
lastCredentialsToken = token;
|
||||
lastCredentialsTime = Date.now();
|
||||
wifiPasswordModalLoader.item.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService, fieldsInfo);
|
||||
root.lastCredentialsToken = token;
|
||||
root.lastCredentialsTime = Date.now();
|
||||
wifiPasswordModalLoader.loadedModal.showFromPrompt(token, ssid, setting, fields, hints, reason, connType, connName, vpnService, fieldsInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,10 +781,10 @@ Item {
|
||||
}
|
||||
|
||||
function onAppPickerRequested(data) {
|
||||
log.debug("App picker requested with data:", JSON.stringify(data));
|
||||
root.log.debug("App picker requested with data:", JSON.stringify(data));
|
||||
|
||||
if (!data || !data.target) {
|
||||
log.warn("Invalid app picker request data");
|
||||
root.log.warn("Invalid app picker request data");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -889,7 +901,6 @@ Item {
|
||||
|
||||
delegate: DankSlideout {
|
||||
id: notepadSlideout
|
||||
modelData: item
|
||||
title: I18n.tr("Notepad")
|
||||
slideoutWidth: 480
|
||||
expandable: true
|
||||
@@ -985,8 +996,8 @@ Item {
|
||||
onSwitchUserRequested: {
|
||||
switchUserModalLoader.active = true;
|
||||
Qt.callLater(() => {
|
||||
if (switchUserModalLoader.item)
|
||||
switchUserModalLoader.item.showFromPowerMenu();
|
||||
if (switchUserModalLoader.loadedModal)
|
||||
switchUserModalLoader.loadedModal.showFromPowerMenu();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1000,6 +1011,7 @@ Item {
|
||||
id: switchUserModalLoader
|
||||
|
||||
active: false
|
||||
readonly property SwitchUserModal loadedModal: item as SwitchUserModal
|
||||
|
||||
SwitchUserModal {
|
||||
id: switchUserModal
|
||||
@@ -1055,7 +1067,6 @@ Item {
|
||||
model: SettingsData.getFilteredScreens("toast")
|
||||
|
||||
delegate: Toast {
|
||||
modelData: item
|
||||
visible: ToastService.toastVisible
|
||||
}
|
||||
}
|
||||
@@ -1070,73 +1081,55 @@ Item {
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: VolumeOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: VolumeOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: MediaVolumeOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: MediaVolumeOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: MediaPlaybackOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: MediaPlaybackOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: MicVolumeOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: MicVolumeOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: BrightnessOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: BrightnessOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: IdleInhibitorOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: IdleInhibitorOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.osdPowerProfileEnabled ? SettingsData.getFilteredScreens("osd") : []
|
||||
|
||||
delegate: PowerProfileOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: PowerProfileOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: CapsLockOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: CapsLockOSD {}
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("osd")
|
||||
|
||||
delegate: AudioOutputOSD {
|
||||
modelData: item
|
||||
}
|
||||
delegate: AudioOutputOSD {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1153,6 +1146,7 @@ Item {
|
||||
Loader {
|
||||
id: greeterLoader
|
||||
active: false
|
||||
readonly property GreeterModal loadedModal: item as GreeterModal
|
||||
sourceComponent: GreeterModal {
|
||||
onGreeterCompleted: greeterLoader.active = false
|
||||
Component.onCompleted: show()
|
||||
@@ -1161,8 +1155,8 @@ Item {
|
||||
Connections {
|
||||
target: FirstLaunchService
|
||||
function onGreeterRequested() {
|
||||
if (greeterLoader.active && greeterLoader.item) {
|
||||
greeterLoader.item.show();
|
||||
if (greeterLoader.active && greeterLoader.loadedModal) {
|
||||
greeterLoader.loadedModal.show();
|
||||
return;
|
||||
}
|
||||
greeterLoader.active = true;
|
||||
@@ -1173,6 +1167,7 @@ Item {
|
||||
Loader {
|
||||
id: changelogLoader
|
||||
active: false
|
||||
readonly property ChangelogModal loadedModal: item as ChangelogModal
|
||||
sourceComponent: ChangelogModal {
|
||||
onChangelogDismissed: changelogLoader.active = false
|
||||
Component.onCompleted: show()
|
||||
@@ -1181,8 +1176,8 @@ Item {
|
||||
Connections {
|
||||
target: ChangelogService
|
||||
function onChangelogRequested() {
|
||||
if (changelogLoader.active && changelogLoader.item) {
|
||||
changelogLoader.item.show();
|
||||
if (changelogLoader.active && changelogLoader.loadedModal) {
|
||||
changelogLoader.loadedModal.show();
|
||||
return;
|
||||
}
|
||||
changelogLoader.active = true;
|
||||
|
||||
@@ -214,7 +214,7 @@ Item {
|
||||
Item {
|
||||
id: listClip
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: BlurService.enabled && stickyHeader.visible ? 32 : 0
|
||||
anchors.topMargin: stickyHeader.visible ? 32 : 0
|
||||
anchors.bottomMargin: bottomSectionHeader.visible ? bottomSectionHeader.height : 0
|
||||
clip: true
|
||||
|
||||
@@ -417,7 +417,7 @@ Item {
|
||||
anchors.top: parent.top
|
||||
height: 32
|
||||
z: 101
|
||||
color: Theme.floatingSurface
|
||||
color: "transparent"
|
||||
visible: !root._bottomSectionHeaderActive && stickyHeaderSection !== null
|
||||
|
||||
readonly property int versionTrigger: root.controller?.viewModeVersion ?? 0
|
||||
|
||||
@@ -27,7 +27,7 @@ DankModal {
|
||||
property real holdProgress: 0
|
||||
property bool showHoldHint: false
|
||||
property bool holdFromKeyboard: false
|
||||
property string pendingKeyAction: ""
|
||||
property string committedAction: ""
|
||||
|
||||
readonly property bool needsConfirmation: SettingsData.powerActionConfirm
|
||||
readonly property int holdDurationMs: SettingsData.powerActionHoldDuration * 1000
|
||||
@@ -39,10 +39,16 @@ DankModal {
|
||||
return action !== "lock" && action !== "restart";
|
||||
}
|
||||
|
||||
function actionWakesOnKeyRelease(action) {
|
||||
return action === "suspend" || action === "hibernate";
|
||||
}
|
||||
|
||||
function startHold(action, actionIndex) {
|
||||
if (committedAction !== "")
|
||||
return;
|
||||
if (!needsConfirmation || !actionNeedsConfirm(action)) {
|
||||
if (holdFromKeyboard) {
|
||||
pendingKeyAction = action;
|
||||
if (holdFromKeyboard && actionWakesOnKeyRelease(action)) {
|
||||
commitAction(action, actionIndex);
|
||||
return;
|
||||
}
|
||||
executeAction(action);
|
||||
@@ -56,7 +62,6 @@ DankModal {
|
||||
}
|
||||
|
||||
function cancelHold() {
|
||||
pendingKeyAction = "";
|
||||
if (holdAction === "")
|
||||
return;
|
||||
const wasHolding = holdProgress > 0;
|
||||
@@ -76,8 +81,8 @@ DankModal {
|
||||
return;
|
||||
}
|
||||
holdTimer.stop();
|
||||
if (holdFromKeyboard) {
|
||||
pendingKeyAction = holdAction;
|
||||
if (holdFromKeyboard && actionWakesOnKeyRelease(holdAction)) {
|
||||
commitAction(holdAction, holdActionIndex);
|
||||
return;
|
||||
}
|
||||
const action = holdAction;
|
||||
@@ -87,6 +92,25 @@ DankModal {
|
||||
executeAction(action);
|
||||
}
|
||||
|
||||
function commitAction(action, actionIndex) {
|
||||
holdTimer.stop();
|
||||
holdAction = "";
|
||||
holdActionIndex = actionIndex;
|
||||
committedAction = action;
|
||||
commitFallbackTimer.restart();
|
||||
}
|
||||
|
||||
function executeCommittedAction() {
|
||||
if (committedAction === "")
|
||||
return;
|
||||
commitFallbackTimer.stop();
|
||||
const action = committedAction;
|
||||
committedAction = "";
|
||||
holdActionIndex = -1;
|
||||
holdProgress = 0;
|
||||
executeAction(action);
|
||||
}
|
||||
|
||||
signal switchUserRequested
|
||||
|
||||
function executeAction(action) {
|
||||
@@ -128,6 +152,12 @@ DankModal {
|
||||
onTriggered: root.showHoldHint = false
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: commitFallbackTimer
|
||||
interval: 5000
|
||||
onTriggered: root.executeCommittedAction()
|
||||
}
|
||||
|
||||
function openCentered() {
|
||||
parentBounds = Qt.rect(0, 0, 0, 0);
|
||||
parentScreen = null;
|
||||
@@ -286,7 +316,8 @@ DankModal {
|
||||
holdProgress = 0;
|
||||
showHoldHint = false;
|
||||
holdFromKeyboard = false;
|
||||
pendingKeyAction = "";
|
||||
committedAction = "";
|
||||
commitFallbackTimer.stop();
|
||||
updateVisibleActions();
|
||||
const defaultIndex = getDefaultActionIndex();
|
||||
selectedIndex = defaultIndex;
|
||||
@@ -309,6 +340,10 @@ DankModal {
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
if (committedAction !== "") {
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
holdFromKeyboard = true;
|
||||
if (SettingsData.powerMenuGridLayout) {
|
||||
handleGridNavigation(event, true);
|
||||
@@ -321,6 +356,11 @@ DankModal {
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
if (committedAction !== "") {
|
||||
event.accepted = true;
|
||||
executeCommittedAction();
|
||||
return;
|
||||
}
|
||||
if (SettingsData.powerMenuGridLayout) {
|
||||
handleGridNavigation(event, false);
|
||||
} else {
|
||||
@@ -331,16 +371,7 @@ DankModal {
|
||||
function handleListNavigation(event, isPressed) {
|
||||
if (!isPressed) {
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_R || event.key === Qt.Key_X || event.key === Qt.Key_L || event.key === Qt.Key_S || event.key === Qt.Key_H || event.key === Qt.Key_D || (event.key === Qt.Key_P && !(event.modifiers & Qt.ControlModifier))) {
|
||||
if (pendingKeyAction !== "") {
|
||||
const action = pendingKeyAction;
|
||||
pendingKeyAction = "";
|
||||
holdAction = "";
|
||||
holdActionIndex = -1;
|
||||
holdProgress = 0;
|
||||
executeAction(action);
|
||||
} else {
|
||||
cancelHold();
|
||||
}
|
||||
cancelHold();
|
||||
event.accepted = true;
|
||||
}
|
||||
return;
|
||||
@@ -434,16 +465,7 @@ DankModal {
|
||||
function handleGridNavigation(event, isPressed) {
|
||||
if (!isPressed) {
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_R || event.key === Qt.Key_X || event.key === Qt.Key_L || event.key === Qt.Key_S || event.key === Qt.Key_H || event.key === Qt.Key_D || (event.key === Qt.Key_P && !(event.modifiers & Qt.ControlModifier))) {
|
||||
if (pendingKeyAction !== "") {
|
||||
const action = pendingKeyAction;
|
||||
pendingKeyAction = "";
|
||||
holdAction = "";
|
||||
holdActionIndex = -1;
|
||||
holdProgress = 0;
|
||||
executeAction(action);
|
||||
} else {
|
||||
cancelHold();
|
||||
}
|
||||
cancelHold();
|
||||
event.accepted = true;
|
||||
}
|
||||
return;
|
||||
@@ -812,6 +834,7 @@ DankModal {
|
||||
|
||||
Row {
|
||||
id: hintRow
|
||||
readonly property bool selectedNeedsHold: root.actionNeedsConfirm(root.getActionAtIndex(root.selectedIndex))
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Theme.spacingS
|
||||
@@ -826,7 +849,13 @@ DankModal {
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
name: root.showHoldHint ? "warning" : "touch_app"
|
||||
name: {
|
||||
if (root.showHoldHint)
|
||||
return "warning";
|
||||
if (!hintRow.selectedNeedsHold)
|
||||
return "bolt";
|
||||
return "touch_app";
|
||||
}
|
||||
size: Theme.fontSizeSmall
|
||||
color: root.showHoldHint ? Theme.warning : Theme.surfaceTextSecondary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -836,8 +865,12 @@ DankModal {
|
||||
readonly property real totalMs: SettingsData.powerActionHoldDuration * 1000
|
||||
readonly property int remainingMs: Math.ceil(totalMs * (1 - root.holdProgress))
|
||||
text: {
|
||||
if (root.committedAction !== "")
|
||||
return I18n.tr("Release to confirm");
|
||||
if (root.showHoldHint)
|
||||
return I18n.tr("Hold longer to confirm");
|
||||
if (!hintRow.selectedNeedsHold)
|
||||
return I18n.tr("Activates immediately");
|
||||
if (root.holdProgress > 0) {
|
||||
if (totalMs < 1000)
|
||||
return I18n.tr("Hold to confirm (%1 ms)").arg(remainingMs);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
@@ -57,60 +56,96 @@ Variants {
|
||||
}
|
||||
|
||||
property string source: SessionData.getMonitorWallpaper(modelData.name) || ""
|
||||
property bool isColorSource: source.startsWith("#")
|
||||
readonly property bool isColorSource: source.startsWith("#")
|
||||
readonly property string displaySource: {
|
||||
if (!source || isColorSource)
|
||||
return "";
|
||||
return source.startsWith("file://") ? source : encodeFileUrl(source);
|
||||
}
|
||||
property bool contentReady: false
|
||||
property bool surfaceBounce: false
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onIsLightModeChanged() {
|
||||
if (SessionData.perModeWallpaper) {
|
||||
var newSource = SessionData.getMonitorWallpaper(modelData.name) || "";
|
||||
if (newSource !== root.source) {
|
||||
root.source = newSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Live stack is captured into frozenLayer once stable, then unloaded; if the capture stalls the stack just stays live.
|
||||
property bool liveActive: false
|
||||
property bool frozenValid: false
|
||||
property string _frozenSource: ""
|
||||
property bool loadFailed: false
|
||||
property int _freezeWaitFrames: 0
|
||||
|
||||
function getFillMode(modeName) {
|
||||
switch (modeName) {
|
||||
case "Stretch":
|
||||
return Image.Stretch;
|
||||
case "Fit":
|
||||
case "PreserveAspectFit":
|
||||
return Image.PreserveAspectFit;
|
||||
case "Fill":
|
||||
case "PreserveAspectCrop":
|
||||
return Image.PreserveAspectCrop;
|
||||
case "Tile":
|
||||
return Image.Tile;
|
||||
case "TileVertically":
|
||||
return Image.TileVertically;
|
||||
case "TileHorizontally":
|
||||
return Image.TileHorizontally;
|
||||
case "Pad":
|
||||
return Image.Pad;
|
||||
default:
|
||||
return Image.PreserveAspectCrop;
|
||||
}
|
||||
}
|
||||
readonly property var backingWindow: Window.window
|
||||
readonly property bool renderActive: !source || liveActive || _freezeWaitFrames > 0
|
||||
property int _settleFrames: 3
|
||||
|
||||
readonly property int maxTextureSize: 8192
|
||||
readonly property int textureWidth: Math.min(modelData.width, maxTextureSize)
|
||||
readonly property int textureHeight: Math.min(modelData.height, maxTextureSize)
|
||||
|
||||
Component.onCompleted: {
|
||||
isInitialized = true;
|
||||
if (!source || isColorSource) {
|
||||
if (!displaySource) {
|
||||
contentReady = true;
|
||||
return;
|
||||
}
|
||||
liveActive = true;
|
||||
}
|
||||
|
||||
property bool isInitialized: false
|
||||
property real transitionProgress: 0
|
||||
readonly property bool transitioning: transitionAnimation.running
|
||||
property bool effectActive: false
|
||||
property bool useNextForEffect: false
|
||||
readonly property var backingWindow: Window.window
|
||||
readonly property bool renderActive: !source || effectActive || currentWallpaper.status === Image.Loading || nextWallpaper.status === Image.Loading
|
||||
property int _settleFrames: 3
|
||||
onDisplaySourceChanged: {
|
||||
invalidate();
|
||||
loadFailed = false;
|
||||
_freezeWaitFrames = 0;
|
||||
if (!displaySource) {
|
||||
liveActive = false;
|
||||
frozenValid = false;
|
||||
_frozenSource = "";
|
||||
contentReady = true;
|
||||
return;
|
||||
}
|
||||
liveActive = true;
|
||||
}
|
||||
|
||||
function regenerate() {
|
||||
invalidate();
|
||||
if (!displaySource)
|
||||
return;
|
||||
if (liveActive) {
|
||||
scheduleFreeze();
|
||||
return;
|
||||
}
|
||||
liveActive = true;
|
||||
}
|
||||
|
||||
function handleDisplayable() {
|
||||
contentReady = true;
|
||||
if (liveLoader.item?.currentFailed) {
|
||||
if (!frozenValid)
|
||||
loadFailed = true;
|
||||
liveActive = false;
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
function scheduleFreeze() {
|
||||
if (!liveLoader.item?.stable)
|
||||
return;
|
||||
frozenLayer.scheduleUpdate();
|
||||
_freezeWaitFrames = 3;
|
||||
_settleFrames = 3;
|
||||
// No wedge watchdog: an occluded surface may never produce frames, the freeze just waits
|
||||
backingWindow?.update();
|
||||
}
|
||||
|
||||
function completeFreeze() {
|
||||
const live = liveLoader.item;
|
||||
if (!live || !live.stable)
|
||||
return;
|
||||
frozenValid = true;
|
||||
_frozenSource = displaySource;
|
||||
liveActive = false;
|
||||
log.info("froze blur layer for", modelData.name);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
onTextureWidthChanged: regenerate()
|
||||
onTextureHeightChanged: regenerate()
|
||||
|
||||
function invalidate() {
|
||||
_settleFrames = 3;
|
||||
@@ -157,29 +192,35 @@ Variants {
|
||||
root._settleFrames--;
|
||||
root._wedgeBounced = false;
|
||||
wedgeWatchdog.stop();
|
||||
if (root._freezeWaitFrames > 0 && --root._freezeWaitFrames === 0)
|
||||
root.completeFreeze();
|
||||
}
|
||||
function onVisibleChanged() {
|
||||
root.invalidate();
|
||||
}
|
||||
function onWidthChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
function onHeightChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
function onResourcesLost() {
|
||||
root.frozenValid = false;
|
||||
root.regenerate();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Quickshell
|
||||
function onScreensChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onWallpaperFillModeChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
function onEffectiveWallpaperBackgroundColorChanged() {
|
||||
root.invalidate();
|
||||
@@ -188,18 +229,26 @@ Variants {
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onIsLightModeChanged() {
|
||||
if (SessionData.perModeWallpaper) {
|
||||
var newSource = SessionData.getMonitorWallpaper(modelData.name) || "";
|
||||
if (newSource !== root.source) {
|
||||
root.source = newSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
function onMonitorWallpaperFillModesChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
function onPerMonitorWallpaperChanged() {
|
||||
root.invalidate();
|
||||
root.regenerate();
|
||||
}
|
||||
}
|
||||
|
||||
// Theme changes repaint DankBackdrop but nothing else wakes the render loop
|
||||
Connections {
|
||||
target: Theme
|
||||
enabled: root.isColorSource || currentWallpaper.status === Image.Error
|
||||
enabled: root.isColorSource || root.loadFailed
|
||||
function onPrimaryChanged() {
|
||||
root.invalidate();
|
||||
}
|
||||
@@ -217,89 +266,23 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
function handleTransitionLoadError(failedSource) {
|
||||
log.warn("failed to load candidate wallpaper for", modelData.name + ":", failedSource);
|
||||
transitionDelayTimer.stop();
|
||||
transitionAnimation.stop();
|
||||
root.useNextForEffect = false;
|
||||
root.effectActive = false;
|
||||
root.transitionProgress = 0.0;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
|
||||
onSourceChanged: {
|
||||
invalidate();
|
||||
if (!source || source.startsWith("#")) {
|
||||
setWallpaperImmediate("");
|
||||
return;
|
||||
Connections {
|
||||
target: liveLoader.item
|
||||
function onBecameDisplayable() {
|
||||
root.handleDisplayable();
|
||||
}
|
||||
|
||||
const formattedSource = source.startsWith("file://") ? source : encodeFileUrl(source);
|
||||
|
||||
if (!isInitialized || !currentWallpaper.source) {
|
||||
setWallpaperImmediate(formattedSource);
|
||||
isInitialized = true;
|
||||
return;
|
||||
function onStableChanged() {
|
||||
if (liveLoader.item.stable)
|
||||
root.scheduleFreeze();
|
||||
}
|
||||
if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
||||
setWallpaperImmediate(formattedSource);
|
||||
return;
|
||||
function onTransitioningChanged() {
|
||||
root.invalidate();
|
||||
}
|
||||
changeWallpaper(formattedSource);
|
||||
}
|
||||
|
||||
function setWallpaperImmediate(newSource) {
|
||||
transitionDelayTimer.stop();
|
||||
transitionAnimation.stop();
|
||||
root.transitionProgress = 0.0;
|
||||
root.effectActive = false;
|
||||
if (!newSource)
|
||||
root.contentReady = true;
|
||||
currentWallpaper.source = newSource;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
|
||||
function startTransition() {
|
||||
root.useNextForEffect = true;
|
||||
root.effectActive = true;
|
||||
if (srcNext.scheduleUpdate)
|
||||
srcNext.scheduleUpdate();
|
||||
transitionDelayTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: transitionDelayTimer
|
||||
interval: 16
|
||||
repeat: false
|
||||
onTriggered: transitionAnimation.start()
|
||||
}
|
||||
|
||||
function changeWallpaper(newPath) {
|
||||
if (newPath === currentWallpaper.source)
|
||||
return;
|
||||
if (!newPath || newPath.startsWith("#"))
|
||||
return;
|
||||
if (root.transitioning) {
|
||||
transitionAnimation.stop();
|
||||
root.transitionProgress = 0;
|
||||
root.effectActive = false;
|
||||
currentWallpaper.source = nextWallpaper.source;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
if (!currentWallpaper.source) {
|
||||
setWallpaperImmediate(newPath);
|
||||
return;
|
||||
}
|
||||
|
||||
nextWallpaper.source = newPath;
|
||||
|
||||
if (nextWallpaper.status === Image.Ready)
|
||||
root.startTransition();
|
||||
}
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: !root.source || root.isColorSource || currentWallpaper.status === Image.Error
|
||||
active: !root.source || root.isColorSource || root.loadFailed
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: DankBackdrop {
|
||||
@@ -307,126 +290,43 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
readonly property int maxTextureSize: 8192
|
||||
property int textureWidth: Math.min(modelData.width, maxTextureSize)
|
||||
property int textureHeight: Math.min(modelData.height, maxTextureSize)
|
||||
|
||||
Image {
|
||||
id: currentWallpaper
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
opacity: 1
|
||||
asynchronous: true
|
||||
retainWhileLoading: true
|
||||
smooth: true
|
||||
cache: true
|
||||
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error) {
|
||||
log.warn("failed to load active wallpaper for", modelData.name + ":", source);
|
||||
}
|
||||
if (status === Image.Ready || status === Image.Error) {
|
||||
root.contentReady = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextWallpaper
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
opacity: 0
|
||||
asynchronous: true
|
||||
retainWhileLoading: true
|
||||
smooth: true
|
||||
cache: true
|
||||
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error) {
|
||||
root.handleTransitionLoadError(source);
|
||||
return;
|
||||
}
|
||||
if (status !== Image.Ready)
|
||||
return;
|
||||
if (!root.transitioning) {
|
||||
root.startTransition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: srcNext
|
||||
sourceItem: root.effectActive ? nextWallpaper : null
|
||||
hideSource: root.effectActive
|
||||
live: root.effectActive
|
||||
mipmap: false
|
||||
recursive: false
|
||||
textureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dummyRect
|
||||
width: 1
|
||||
height: 1
|
||||
visible: false
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: srcDummy
|
||||
sourceItem: dummyRect
|
||||
hideSource: true
|
||||
id: frozenLayer
|
||||
anchors.fill: parent
|
||||
sourceItem: liveContainer
|
||||
live: false
|
||||
mipmap: false
|
||||
recursive: false
|
||||
smooth: true
|
||||
visible: root.frozenValid || root.liveActive
|
||||
textureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||
}
|
||||
|
||||
Item {
|
||||
id: blurredLayer
|
||||
id: liveContainer
|
||||
anchors.fill: parent
|
||||
visible: root.liveActive
|
||||
|
||||
MultiEffect {
|
||||
Loader {
|
||||
id: liveLoader
|
||||
anchors.fill: parent
|
||||
source: currentWallpaper
|
||||
visible: currentWallpaper.source !== ""
|
||||
blurEnabled: true
|
||||
blur: 0.8
|
||||
blurMax: 75
|
||||
opacity: 1 - root.transitionProgress
|
||||
autoPaddingEnabled: false
|
||||
}
|
||||
active: root.liveActive
|
||||
asynchronous: false
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: root.useNextForEffect ? srcNext : srcDummy
|
||||
visible: nextWallpaper.source !== "" && root.useNextForEffect
|
||||
blurEnabled: true
|
||||
blur: 0.8
|
||||
blurMax: 75
|
||||
opacity: root.transitionProgress
|
||||
autoPaddingEnabled: false
|
||||
}
|
||||
}
|
||||
// Cached images reach Ready synchronously during creation, before Connections retargets
|
||||
onLoaded: {
|
||||
if (item.displayableNow)
|
||||
root.handleDisplayable();
|
||||
if (item.stable)
|
||||
root.scheduleFreeze();
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: transitionAnimation
|
||||
target: root
|
||||
property: "transitionProgress"
|
||||
from: 0.0
|
||||
to: 1.0
|
||||
duration: 1000
|
||||
easing.type: Easing.InOutCubic
|
||||
onFinished: {
|
||||
if (nextWallpaper.source && nextWallpaper.status === Image.Ready)
|
||||
currentWallpaper.source = nextWallpaper.source;
|
||||
root.useNextForEffect = false;
|
||||
nextWallpaper.source = "";
|
||||
root.transitionProgress = 0.0;
|
||||
root.effectActive = false;
|
||||
sourceComponent: BlurredWallpaperLive {
|
||||
wallpaperSource: root.displaySource
|
||||
initialSource: root._frozenSource
|
||||
screenName: modelData.name
|
||||
blurTextureSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
readonly property var log: Log.scoped("BlurredWallpaperLive")
|
||||
|
||||
required property string wallpaperSource
|
||||
required property string initialSource
|
||||
required property string screenName
|
||||
required property size blurTextureSize
|
||||
|
||||
readonly property bool currentFailed: currentWallpaper.status === Image.Error
|
||||
readonly property bool displayableNow: currentWallpaper.status === Image.Ready || currentWallpaper.status === Image.Error
|
||||
readonly property bool stable: isInitialized && !effectActive && !transitionAnimation.running && !transitionDelayTimer.running && currentWallpaper.status === Image.Ready && currentWallpaper.source.toString() === wallpaperSource && !nextWallpaper.source.toString()
|
||||
|
||||
signal becameDisplayable
|
||||
|
||||
property bool isInitialized: false
|
||||
property real transitionProgress: 0
|
||||
readonly property bool transitioning: transitionAnimation.running
|
||||
property bool effectActive: false
|
||||
property bool useNextForEffect: false
|
||||
|
||||
function getFillMode(modeName) {
|
||||
switch (modeName) {
|
||||
case "Stretch":
|
||||
return Image.Stretch;
|
||||
case "Fit":
|
||||
case "PreserveAspectFit":
|
||||
return Image.PreserveAspectFit;
|
||||
case "Fill":
|
||||
case "PreserveAspectCrop":
|
||||
return Image.PreserveAspectCrop;
|
||||
case "Tile":
|
||||
return Image.Tile;
|
||||
case "TileVertically":
|
||||
return Image.TileVertically;
|
||||
case "TileHorizontally":
|
||||
return Image.TileHorizontally;
|
||||
case "Pad":
|
||||
return Image.Pad;
|
||||
default:
|
||||
return Image.PreserveAspectCrop;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (initialSource && initialSource !== wallpaperSource && !(CompositorService.isNiri && SessionData.isSwitchingMode)) {
|
||||
currentWallpaper.source = initialSource;
|
||||
isInitialized = true;
|
||||
changeWallpaper(wallpaperSource);
|
||||
return;
|
||||
}
|
||||
currentWallpaper.source = wallpaperSource;
|
||||
isInitialized = true;
|
||||
}
|
||||
|
||||
onWallpaperSourceChanged: {
|
||||
if (!isInitialized)
|
||||
return;
|
||||
if (!wallpaperSource) {
|
||||
setWallpaperImmediate("");
|
||||
return;
|
||||
}
|
||||
if (!currentWallpaper.source.toString()) {
|
||||
setWallpaperImmediate(wallpaperSource);
|
||||
return;
|
||||
}
|
||||
if (CompositorService.isNiri && SessionData.isSwitchingMode) {
|
||||
setWallpaperImmediate(wallpaperSource);
|
||||
return;
|
||||
}
|
||||
changeWallpaper(wallpaperSource);
|
||||
}
|
||||
|
||||
function handleTransitionLoadError(failedSource) {
|
||||
log.warn("failed to load candidate wallpaper for", screenName + ":", failedSource);
|
||||
transitionDelayTimer.stop();
|
||||
transitionAnimation.stop();
|
||||
useNextForEffect = false;
|
||||
effectActive = false;
|
||||
transitionProgress = 0.0;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
|
||||
function setWallpaperImmediate(newSource) {
|
||||
transitionDelayTimer.stop();
|
||||
transitionAnimation.stop();
|
||||
transitionProgress = 0.0;
|
||||
effectActive = false;
|
||||
currentWallpaper.source = newSource;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
|
||||
function startTransition() {
|
||||
useNextForEffect = true;
|
||||
effectActive = true;
|
||||
if (srcNext.scheduleUpdate)
|
||||
srcNext.scheduleUpdate();
|
||||
transitionDelayTimer.start();
|
||||
}
|
||||
|
||||
function changeWallpaper(newPath) {
|
||||
if (!newPath)
|
||||
return;
|
||||
if (newPath === currentWallpaper.source.toString())
|
||||
return;
|
||||
if (transitioning) {
|
||||
transitionAnimation.stop();
|
||||
transitionProgress = 0;
|
||||
effectActive = false;
|
||||
currentWallpaper.source = nextWallpaper.source;
|
||||
nextWallpaper.source = "";
|
||||
}
|
||||
if (!currentWallpaper.source.toString()) {
|
||||
setWallpaperImmediate(newPath);
|
||||
return;
|
||||
}
|
||||
|
||||
nextWallpaper.source = newPath;
|
||||
|
||||
if (nextWallpaper.status === Image.Ready)
|
||||
startTransition();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: transitionDelayTimer
|
||||
interval: 16
|
||||
repeat: false
|
||||
onTriggered: transitionAnimation.start()
|
||||
}
|
||||
|
||||
Image {
|
||||
id: currentWallpaper
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
opacity: 1
|
||||
asynchronous: true
|
||||
retainWhileLoading: true
|
||||
smooth: true
|
||||
cache: true
|
||||
sourceSize: root.blurTextureSize
|
||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(root.screenName))
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error) {
|
||||
root.log.warn("failed to load active wallpaper for", root.screenName + ":", source);
|
||||
}
|
||||
if (status === Image.Ready || status === Image.Error) {
|
||||
root.becameDisplayable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: nextWallpaper
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
opacity: 0
|
||||
asynchronous: true
|
||||
retainWhileLoading: true
|
||||
smooth: true
|
||||
cache: true
|
||||
sourceSize: root.blurTextureSize
|
||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(root.screenName))
|
||||
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error) {
|
||||
root.handleTransitionLoadError(source);
|
||||
return;
|
||||
}
|
||||
if (status !== Image.Ready)
|
||||
return;
|
||||
if (!root.transitioning) {
|
||||
root.startTransition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: srcNext
|
||||
sourceItem: root.effectActive ? nextWallpaper : null
|
||||
hideSource: root.effectActive
|
||||
live: root.effectActive
|
||||
mipmap: false
|
||||
recursive: false
|
||||
textureSize: root.blurTextureSize
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: dummyRect
|
||||
width: 1
|
||||
height: 1
|
||||
visible: false
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: srcDummy
|
||||
sourceItem: dummyRect
|
||||
hideSource: true
|
||||
live: false
|
||||
mipmap: false
|
||||
recursive: false
|
||||
}
|
||||
|
||||
Item {
|
||||
id: blurredLayer
|
||||
anchors.fill: parent
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: currentWallpaper
|
||||
visible: currentWallpaper.source !== ""
|
||||
blurEnabled: true
|
||||
blur: 0.8
|
||||
blurMax: 75
|
||||
opacity: 1 - root.transitionProgress
|
||||
autoPaddingEnabled: false
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: root.useNextForEffect ? srcNext : srcDummy
|
||||
visible: nextWallpaper.source !== "" && root.useNextForEffect
|
||||
blurEnabled: true
|
||||
blur: 0.8
|
||||
blurMax: 75
|
||||
opacity: root.transitionProgress
|
||||
autoPaddingEnabled: false
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: transitionAnimation
|
||||
target: root
|
||||
property: "transitionProgress"
|
||||
from: 0.0
|
||||
to: 1.0
|
||||
duration: 1000
|
||||
easing.type: Easing.InOutCubic
|
||||
onFinished: {
|
||||
if (nextWallpaper.source && nextWallpaper.status === Image.Ready)
|
||||
currentWallpaper.source = nextWallpaper.source;
|
||||
root.useNextForEffect = false;
|
||||
nextWallpaper.source = "";
|
||||
root.transitionProgress = 0.0;
|
||||
root.effectActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,12 @@ DankPopout {
|
||||
|
||||
readonly property color _containerBg: Theme.nestedSurface
|
||||
|
||||
// Defer open one tick so screen-change geometry settles before the surface
|
||||
// maps; a synchronous open churns the surface and loses the blur on a switch.
|
||||
function present() {
|
||||
Qt.callLater(open);
|
||||
}
|
||||
|
||||
function openWithSection(section) {
|
||||
StateUtils.openWithSection(root, section);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ Item {
|
||||
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
|
||||
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
|
||||
// Connected-frame Bar Inset Padding: absolute free-end inset (auto < 0 = frameThickness, 0 = edge-to-edge).
|
||||
// Any amount beyond the frameThickness baseline is also added at the bar-clearance ends (all ends).
|
||||
// FrameExclusions already moves a free bar end inward by frameThickness so use frame inset to mangage the gap
|
||||
readonly property real _frameInsetResolved: SettingsData.frameBarInsetPadding < 0 ? SettingsData.frameThickness : SettingsData.frameBarInsetPadding
|
||||
readonly property real _frameInsetExtra: Math.max(0, _frameInsetResolved - SettingsData.frameThickness)
|
||||
|
||||
@@ -47,28 +47,28 @@ Item {
|
||||
if (_barIsVertical)
|
||||
return _edgeBaseMargin;
|
||||
if (_usesFrameBarChrome)
|
||||
return hasAdjacentLeftBarLive ? (_edgeBaseMargin + SettingsData.frameBarSize + _frameInsetExtra) : Math.max(0, _frameInsetResolved);
|
||||
return hasAdjacentLeftBarLive ? (_edgeBaseMargin + SettingsData.frameBarSize + _frameInsetExtra) : _frameInsetExtra;
|
||||
return Math.max(0, _barInsetPadding);
|
||||
}
|
||||
readonly property real _rightMargin: {
|
||||
if (_barIsVertical)
|
||||
return _edgeBaseMargin;
|
||||
if (_usesFrameBarChrome)
|
||||
return hasAdjacentRightBarLive ? (_edgeBaseMargin + SettingsData.frameBarSize + _frameInsetExtra) : Math.max(0, _frameInsetResolved);
|
||||
return hasAdjacentRightBarLive ? (_edgeBaseMargin + SettingsData.frameBarSize + _frameInsetExtra) : _frameInsetExtra;
|
||||
return Math.max(0, _barInsetPadding);
|
||||
}
|
||||
readonly property real _topMargin: {
|
||||
if (!_barIsVertical)
|
||||
return 0;
|
||||
if (_usesFrameBarChrome)
|
||||
return hasAdjacentTopBarLive ? (outlineThickness + SettingsData.frameThickness + _frameInsetExtra) : Math.max(0, _frameInsetResolved);
|
||||
return hasAdjacentTopBarLive ? (outlineThickness + SettingsData.frameThickness + _frameInsetExtra) : _frameInsetExtra;
|
||||
return Math.max(0, _barInsetPadding);
|
||||
}
|
||||
readonly property real _bottomMargin: {
|
||||
if (!_barIsVertical)
|
||||
return 0;
|
||||
if (_usesFrameBarChrome)
|
||||
return hasAdjacentBottomBarLive ? (outlineThickness + SettingsData.frameThickness + _frameInsetExtra) : Math.max(0, _frameInsetResolved);
|
||||
return hasAdjacentBottomBarLive ? (outlineThickness + SettingsData.frameThickness + _frameInsetExtra) : _frameInsetExtra;
|
||||
return Math.max(0, _barInsetPadding);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ DankPopout {
|
||||
color: "transparent"
|
||||
focus: true
|
||||
|
||||
readonly property bool hasTerminalBackend: (SystemUpdateService.backends || []).some(b => b.runsInTerminal === true)
|
||||
readonly property bool upgradeRunsInTerminal: SystemUpdateService.useCustomCommand || (SystemUpdateService.backends || []).some(b => b.runsInTerminal === true)
|
||||
|
||||
property int nowUnix: Math.floor(Date.now() / 1000)
|
||||
|
||||
@@ -272,7 +272,7 @@ DankPopout {
|
||||
includeAUR: SettingsData.updaterAllowAUR,
|
||||
terminal: SessionData.terminalOverride
|
||||
};
|
||||
if (updaterPanel.hasTerminalBackend) {
|
||||
if (updaterPanel.upgradeRunsInTerminal) {
|
||||
systemUpdatePopout._reopenAfterUpgrade = true;
|
||||
SystemUpdateService.runUpdates(opts);
|
||||
systemUpdatePopout.close();
|
||||
@@ -336,7 +336,10 @@ DankPopout {
|
||||
|
||||
StyledText {
|
||||
id: statusText
|
||||
anchors.fill: parent
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: ignoredSection.top
|
||||
anchors.margins: Theme.spacingM
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@@ -361,7 +364,10 @@ DankPopout {
|
||||
|
||||
DankListView {
|
||||
id: packagesList
|
||||
anchors.fill: parent
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: ignoredSection.top
|
||||
anchors.margins: Theme.spacingS
|
||||
visible: !SystemUpdateService.isUpgrading && SystemUpdateService.updateCount > 0 && !SystemUpdateService.hasError && !SystemUpdateService.isChecking
|
||||
clip: true
|
||||
@@ -467,18 +473,128 @@ DankPopout {
|
||||
iconName: "visibility_off"
|
||||
iconSize: 16
|
||||
iconColor: Theme.surfaceVariantText
|
||||
visible: rowHoverHandler.hovered
|
||||
visible: rowHoverHandler.hovered && SystemUpdateService.canIgnorePackage(packageRow.modelData)
|
||||
tooltipText: I18n.tr("Ignore this package")
|
||||
onClicked: SystemUpdateService.ignorePackage(packageRow.modelData.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: ignoredSection
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: Theme.spacingS
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
readonly property var ignoredNames: SettingsData.updaterIgnoredPackages || []
|
||||
readonly property bool shown: ignoredNames.length > 0 && !SystemUpdateService.isUpgrading && !SystemUpdateService.isChecking
|
||||
property bool expanded: false
|
||||
|
||||
visible: shown
|
||||
height: shown ? implicitHeight : 0
|
||||
|
||||
Rectangle {
|
||||
id: ignoredToggle
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: ignoredToggleArea.containsMouse ? Theme.primaryHoverLight : Theme.surfaceLight
|
||||
|
||||
DankIcon {
|
||||
id: ignoredToggleIcon
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: "visibility_off"
|
||||
size: 16
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.left: ignoredToggleIcon.right
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: I18n.tr("Ignored (%1)").arg(ignoredSection.ignoredNames.length)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: ignoredSection.expanded ? "expand_less" : "expand_more"
|
||||
size: 16
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: ignoredToggleArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: ignoredSection.expanded = !ignoredSection.expanded
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankListView {
|
||||
width: parent.width
|
||||
height: ignoredSection.expanded ? Math.min(contentHeight, 150) : 0
|
||||
visible: ignoredSection.expanded
|
||||
clip: true
|
||||
spacing: Theme.spacingXS
|
||||
model: ignoredSection.ignoredNames
|
||||
|
||||
delegate: Rectangle {
|
||||
id: ignoredRow
|
||||
width: ListView.view.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceLight
|
||||
|
||||
required property string modelData
|
||||
|
||||
StyledText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.right: restoreButton.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: ignoredRow.modelData
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
id: restoreButton
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
buttonSize: 24
|
||||
iconName: "visibility"
|
||||
iconSize: 16
|
||||
iconColor: Theme.surfaceVariantText
|
||||
tooltipText: I18n.tr("Stop ignoring %1").arg(ignoredRow.modelData)
|
||||
onClicked: SystemUpdateService.unignorePackage(ignoredRow.modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
visible: SystemUpdateService.isUpgrading && updaterPanel.hasTerminalBackend
|
||||
visible: SystemUpdateService.isUpgrading && updaterPanel.upgradeRunsInTerminal
|
||||
|
||||
DankIcon {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -509,7 +625,7 @@ DankPopout {
|
||||
DankFlickable {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
visible: SystemUpdateService.isUpgrading && !updaterPanel.hasTerminalBackend
|
||||
visible: SystemUpdateService.isUpgrading && !updaterPanel.upgradeRunsInTerminal
|
||||
contentWidth: width
|
||||
contentHeight: logText.implicitHeight
|
||||
clip: true
|
||||
|
||||
@@ -63,8 +63,8 @@ BasePill {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => root.triggerRipple(this, mouse.x, mouse.y)
|
||||
onClicked: function (mouse) {
|
||||
onPressed: function (mouse) {
|
||||
root.triggerRipple(this, mouse.x, mouse.y);
|
||||
switch (mouse.button) {
|
||||
case Qt.RightButton:
|
||||
openContextMenu();
|
||||
|
||||
@@ -13,33 +13,6 @@ BasePill {
|
||||
readonly property bool _hoverPreview: MprisController.isFirefoxYoutubeHoverPreview(activePlayer)
|
||||
readonly property bool _isPlaying: !!activePlayer && activePlayer.playbackState === 1 && !_hoverPreview
|
||||
|
||||
property string _stableTitle: ""
|
||||
property string _stableArtist: ""
|
||||
|
||||
Connections {
|
||||
target: root.activePlayer
|
||||
function onTrackTitleChanged() {
|
||||
root._syncMeta();
|
||||
}
|
||||
function onTrackArtistChanged() {
|
||||
root._syncMeta();
|
||||
}
|
||||
}
|
||||
|
||||
onActivePlayerChanged: _syncMeta()
|
||||
|
||||
function _syncMeta() {
|
||||
if (!activePlayer) {
|
||||
_stableTitle = "";
|
||||
_stableArtist = "";
|
||||
return;
|
||||
}
|
||||
if (MprisController.isFirefoxYoutubeHoverPreview(activePlayer))
|
||||
return;
|
||||
_stableTitle = activePlayer.trackTitle || "";
|
||||
_stableArtist = activePlayer.trackArtist || "";
|
||||
}
|
||||
|
||||
readonly property bool __isChromeBrowser: {
|
||||
if (!activePlayer?.identity)
|
||||
return false;
|
||||
@@ -310,10 +283,10 @@ BasePill {
|
||||
readonly property bool isWebMedia: lowerIdentity.includes("firefox") || lowerIdentity.includes("chrome") || lowerIdentity.includes("chromium") || lowerIdentity.includes("edge") || lowerIdentity.includes("safari")
|
||||
|
||||
property string displayText: {
|
||||
if (!activePlayer || !root._stableTitle)
|
||||
if (!activePlayer || !MprisController.stableTitle)
|
||||
return "";
|
||||
const title = isWebMedia ? root._stableTitle : (root._stableTitle || "Unknown Track");
|
||||
const subtitle = isWebMedia ? (root._stableArtist || cachedIdentity) : (root._stableArtist || "");
|
||||
const title = MprisController.stableTitle;
|
||||
const subtitle = isWebMedia ? (MprisController.stableArtist || cachedIdentity) : MprisController.stableArtist;
|
||||
return subtitle.length > 0 ? title + " • " + subtitle : title;
|
||||
}
|
||||
|
||||
@@ -344,9 +317,45 @@ BasePill {
|
||||
id: mediaText
|
||||
readonly property bool onScreen: Window.window?.visible ?? false
|
||||
property bool needsScrolling: implicitWidth > textContainer.width && SettingsData.scrollTitleEnabled
|
||||
readonly property bool scrollActive: needsScrolling && textContainer.visible && onScreen && root._isPlaying
|
||||
readonly property real maxScrollOffset: Math.max(0, implicitWidth - textContainer.width + 5)
|
||||
property real scrollOffset: 0
|
||||
property int scrollDirection: 1
|
||||
property real scrollHoldMs: 2000
|
||||
property real textShift: 0
|
||||
|
||||
function resetScroll() {
|
||||
scrollOffset = 0;
|
||||
scrollDirection = 1;
|
||||
scrollHoldMs = 2000;
|
||||
}
|
||||
|
||||
function stepScroll(deltaMs) {
|
||||
if (scrollHoldMs > 0) {
|
||||
scrollHoldMs -= deltaMs;
|
||||
return;
|
||||
}
|
||||
const next = scrollOffset + scrollDirection * deltaMs / 60;
|
||||
if (next >= maxScrollOffset) {
|
||||
scrollOffset = maxScrollOffset;
|
||||
scrollDirection = -1;
|
||||
scrollHoldMs = 2000;
|
||||
return;
|
||||
}
|
||||
if (next <= 0) {
|
||||
scrollOffset = 0;
|
||||
scrollDirection = 1;
|
||||
scrollHoldMs = 2000;
|
||||
return;
|
||||
}
|
||||
scrollOffset = next;
|
||||
}
|
||||
|
||||
onScrollActiveChanged: {
|
||||
if (!scrollActive)
|
||||
resetScroll();
|
||||
}
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: textContainer.displayText
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
@@ -356,52 +365,38 @@ BasePill {
|
||||
opacity: 1
|
||||
|
||||
onTextChanged: {
|
||||
scrollOffset = 0;
|
||||
resetScroll();
|
||||
textShift = 0;
|
||||
scrollTimer.reset();
|
||||
textChangeAnimation.restart();
|
||||
}
|
||||
|
||||
// Timer stepping, not NumberAnimation — a running animation commits frames every vsync (#2863)
|
||||
// Timer stepping, not NumberAnimation — a running animation commits frames every vsync (#2863).
|
||||
// When cava frames are already driving renders, scroll steps ride those ticks instead —
|
||||
// two unsynchronized tick sources nearly double the surface commit rate (#2863).
|
||||
Timer {
|
||||
id: scrollTimer
|
||||
readonly property real maxOffset: Math.max(0, mediaText.implicitWidth - textContainer.width + 5)
|
||||
property int direction: 1
|
||||
property int holdTicks: 33
|
||||
|
||||
interval: 60
|
||||
repeat: true
|
||||
running: mediaText.needsScrolling && textContainer.visible && mediaText.onScreen && root._isPlaying
|
||||
|
||||
function reset() {
|
||||
mediaText.scrollOffset = 0;
|
||||
direction = 1;
|
||||
holdTicks = 33;
|
||||
}
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running)
|
||||
reset();
|
||||
}
|
||||
running: mediaText.scrollActive
|
||||
onTriggered: {
|
||||
if (holdTicks > 0) {
|
||||
holdTicks--;
|
||||
if (cavaTickWatch.running)
|
||||
return;
|
||||
}
|
||||
const next = mediaText.scrollOffset + direction;
|
||||
if (next >= maxOffset) {
|
||||
mediaText.scrollOffset = maxOffset;
|
||||
direction = -1;
|
||||
holdTicks = 33;
|
||||
return;
|
||||
}
|
||||
if (next <= 0) {
|
||||
mediaText.scrollOffset = 0;
|
||||
direction = 1;
|
||||
holdTicks = 33;
|
||||
return;
|
||||
}
|
||||
mediaText.scrollOffset = next;
|
||||
mediaText.stepScroll(60);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: cavaTickWatch
|
||||
interval: 150
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CavaService
|
||||
enabled: mediaText.scrollActive && SettingsData.audioVisualizerEnabled && CavaService.cavaAvailable
|
||||
function onValuesChanged() {
|
||||
cavaTickWatch.restart();
|
||||
mediaText.stepScroll(40);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1250,13 +1250,8 @@ BasePill {
|
||||
|
||||
if (root.isVerticalOrientation) {
|
||||
const edge = root.axis?.edge;
|
||||
if (edge === "left") {
|
||||
const targetX = overflowMenu.anchorPos.x;
|
||||
return Math.max(left, Math.min(right, targetX));
|
||||
} else {
|
||||
const targetX = overflowMenu.anchorPos.x - alignedWidth;
|
||||
return Math.max(left, Math.min(right, targetX));
|
||||
}
|
||||
const targetX = edge === "left" ? overflowMenu.anchorPos.x : overflowMenu.anchorPos.x - alignedWidth;
|
||||
return Math.max(10, Math.min(overflowMenu.width - alignedWidth - 10, targetX));
|
||||
} else {
|
||||
const want = overflowMenu.anchorPos.x - alignedWidth / 2;
|
||||
return Math.max(left, Math.min(right, want));
|
||||
@@ -1271,13 +1266,8 @@ BasePill {
|
||||
const want = overflowMenu.anchorPos.y - alignedHeight / 2;
|
||||
return Math.max(top, Math.min(bottom, want));
|
||||
} else {
|
||||
if (root.isAtBottom) {
|
||||
const targetY = overflowMenu.anchorPos.y - alignedHeight;
|
||||
return Math.max(top, Math.min(bottom, targetY));
|
||||
} else {
|
||||
const targetY = overflowMenu.anchorPos.y;
|
||||
return Math.max(top, Math.min(bottom, targetY));
|
||||
}
|
||||
const targetY = root.isAtBottom ? overflowMenu.anchorPos.y - alignedHeight : overflowMenu.anchorPos.y;
|
||||
return Math.max(10, Math.min(overflowMenu.height - alignedHeight - 10, targetY));
|
||||
}
|
||||
})(), overflowMenu.dpr)
|
||||
|
||||
@@ -1770,13 +1760,8 @@ BasePill {
|
||||
|
||||
if (menuRoot.isVertical) {
|
||||
const edge = menuRoot.axis?.edge;
|
||||
if (edge === "left") {
|
||||
const targetX = menuWindow.anchorPos.x;
|
||||
return Math.max(left, Math.min(right, targetX));
|
||||
} else {
|
||||
const targetX = menuWindow.anchorPos.x - alignedWidth;
|
||||
return Math.max(left, Math.min(right, targetX));
|
||||
}
|
||||
const targetX = edge === "left" ? menuWindow.anchorPos.x : menuWindow.anchorPos.x - alignedWidth;
|
||||
return Math.max(10, Math.min(menuWindow.width - alignedWidth - 10, targetX));
|
||||
} else {
|
||||
const want = menuWindow.anchorPos.x - alignedWidth / 2;
|
||||
return Math.max(left, Math.min(right, want));
|
||||
@@ -1791,13 +1776,8 @@ BasePill {
|
||||
const want = menuWindow.anchorPos.y - alignedHeight / 2;
|
||||
return Math.max(top, Math.min(bottom, want));
|
||||
} else {
|
||||
if (menuRoot.isAtBottom) {
|
||||
const targetY = menuWindow.anchorPos.y - alignedHeight;
|
||||
return Math.max(top, Math.min(bottom, targetY));
|
||||
} else {
|
||||
const targetY = menuWindow.anchorPos.y;
|
||||
return Math.max(top, Math.min(bottom, targetY));
|
||||
}
|
||||
const targetY = menuRoot.isAtBottom ? menuWindow.anchorPos.y - alignedHeight : menuWindow.anchorPos.y;
|
||||
return Math.max(10, Math.min(menuWindow.height - alignedHeight - 10, targetY));
|
||||
}
|
||||
})(), menuWindow.dpr)
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ Item {
|
||||
property int dropdownType: 0
|
||||
property var activePlayer: null
|
||||
property var allPlayers: []
|
||||
// Chromium keeps dead MPRIS services registered w/empty metadata; avoid listing them
|
||||
readonly property var selectablePlayers: (allPlayers || []).filter(p => p && !MprisController.isIdle(p))
|
||||
property point anchorPos: Qt.point(0, 0)
|
||||
property bool isRightEdge: false
|
||||
property var targetWindow: null
|
||||
@@ -64,6 +66,22 @@ Item {
|
||||
panelExited();
|
||||
}
|
||||
|
||||
property real _wheelAccum: 0
|
||||
|
||||
function volumeWheel(wheelEvent) {
|
||||
if (!volumeAvailable)
|
||||
return;
|
||||
wheelEvent.accepted = true;
|
||||
_wheelAccum += wheelEvent.angleDelta.y;
|
||||
const notches = _wheelAccum > 0 ? Math.floor(_wheelAccum / 120) : Math.ceil(_wheelAccum / 120);
|
||||
if (notches === 0)
|
||||
return;
|
||||
_wheelAccum -= notches * 120;
|
||||
SessionData.suppressOSDTemporarily();
|
||||
const next = currentVolume + notches * AudioService.wheelVolumeStep / 100;
|
||||
root.volumeChanged(Math.max(0, Math.min(1, next)));
|
||||
}
|
||||
|
||||
readonly property Item __activePanel: {
|
||||
switch (dropdownType) {
|
||||
case 1:
|
||||
@@ -144,6 +162,7 @@ Item {
|
||||
hoverEnabled: true
|
||||
onEntered: panelAreaEntered()
|
||||
onExited: panelAreaExited()
|
||||
onWheel: wheelEvent => root.volumeWheel(wheelEvent)
|
||||
}
|
||||
|
||||
Item {
|
||||
@@ -203,6 +222,7 @@ Item {
|
||||
|
||||
onEntered: panelAreaEntered()
|
||||
onExited: panelAreaExited()
|
||||
onWheel: wheelEvent => root.volumeWheel(wheelEvent)
|
||||
onPressed: mouse => updateVolume(mouse)
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed)
|
||||
@@ -428,7 +448,7 @@ Item {
|
||||
id: playersPanel
|
||||
visible: dropdownType === 3
|
||||
width: 240
|
||||
height: Math.max(180, Math.min(240, (allPlayers?.length || 0) * 50 + 80))
|
||||
height: Math.max(180, Math.min(240, (root.selectablePlayers?.length || 0) * 50 + 80))
|
||||
x: isRightEdge ? anchorPos.x : anchorPos.x - width
|
||||
y: anchorPos.y - height / 2
|
||||
radius: Theme.cornerRadius * 2
|
||||
@@ -485,7 +505,7 @@ Item {
|
||||
anchors.margins: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Media Players (") + (allPlayers?.length || 0) + ")"
|
||||
text: I18n.tr("Media Players (") + (root.selectablePlayers?.length || 0) + ")"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -506,7 +526,7 @@ Item {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Repeater {
|
||||
model: allPlayers || []
|
||||
model: root.selectablePlayers || []
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
@@ -582,5 +602,4 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ Item {
|
||||
playersExpanded = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
readonly property bool isRightEdge: {
|
||||
if (barPosition === SettingsData.Position.Right)
|
||||
return true;
|
||||
@@ -342,54 +340,6 @@ Item {
|
||||
root.maybeFinishSwitch();
|
||||
}
|
||||
|
||||
component BgBlurLayer: ClippingRectangle {
|
||||
id: layer
|
||||
property alias art: layerImg.source
|
||||
readonly property bool ready: layerImg.status === Image.Ready && layerImg.source != ""
|
||||
property bool front: false
|
||||
signal loaded
|
||||
|
||||
anchors.fill: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
antialiasing: true
|
||||
opacity: front ? 0.7 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 350
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: layerImg
|
||||
anchors.centerIn: parent
|
||||
width: Math.max(parent.width, parent.height) * 1.1
|
||||
height: width
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
cache: true
|
||||
visible: false
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready && source != "")
|
||||
layer.loaded();
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.centerIn: parent
|
||||
width: layerImg.width
|
||||
height: layerImg.height
|
||||
source: layerImg
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 0.8
|
||||
saturation: -0.2
|
||||
brightness: -0.25
|
||||
}
|
||||
}
|
||||
|
||||
BgBlurLayer {
|
||||
id: layerA
|
||||
front: bgContainer._showA
|
||||
@@ -410,6 +360,54 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
component BgBlurLayer: ClippingRectangle {
|
||||
id: layer
|
||||
property alias art: layerImg.source
|
||||
readonly property bool ready: layerImg.status === Image.Ready && layerImg.source != ""
|
||||
property bool front: false
|
||||
signal loaded
|
||||
|
||||
anchors.fill: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
antialiasing: true
|
||||
opacity: front ? 0.7 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 350
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: layerImg
|
||||
anchors.centerIn: parent
|
||||
width: Math.max(parent.width, parent.height) * 1.1
|
||||
height: width
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
cache: true
|
||||
visible: false
|
||||
onStatusChanged: {
|
||||
if (status === Image.Ready && source != "")
|
||||
layer.loaded();
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.centerIn: parent
|
||||
width: layerImg.width
|
||||
height: layerImg.height
|
||||
source: layerImg
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 0.8
|
||||
saturation: -0.2
|
||||
brightness: -0.25
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingM
|
||||
@@ -469,7 +467,7 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
StyledText {
|
||||
text: activePlayer?.trackTitle || I18n.tr("Unknown Track")
|
||||
text: MprisController.stableTitle || I18n.tr("Unknown Track")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
@@ -481,7 +479,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: activePlayer?.trackArtist || I18n.tr("Unknown Artist")
|
||||
text: MprisController.stableArtist || I18n.tr("Unknown Artist")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceTextMedium
|
||||
width: parent.width
|
||||
@@ -799,16 +797,17 @@ Item {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (playersExpanded) {
|
||||
if (allPlayers && allPlayers.length > 1) {
|
||||
const players = (root.allPlayers || []).filter(p => p && !MprisController.isIdle(p));
|
||||
if (players.length > 1) {
|
||||
let currentIndex = -1;
|
||||
for (let i = 0; i < allPlayers.length; i++) {
|
||||
if (allPlayers[i] === activePlayer) {
|
||||
for (let i = 0; i < players.length; i++) {
|
||||
if (players[i] === root.activePlayer) {
|
||||
currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const nextIndex = (currentIndex + 1) % allPlayers.length;
|
||||
MprisController.setActivePlayer(allPlayers[nextIndex]);
|
||||
const nextIndex = (currentIndex + 1) % players.length;
|
||||
MprisController.setActivePlayer(players[nextIndex]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -885,19 +884,15 @@ Item {
|
||||
onClicked: {
|
||||
toggleMute();
|
||||
}
|
||||
property real wheelAccum: 0
|
||||
onWheel: wheelEvent => {
|
||||
SessionData.suppressOSDTemporarily();
|
||||
const delta = wheelEvent.angleDelta.y;
|
||||
const current = (currentVolume * 100) || 0;
|
||||
const maxVol = usePlayerVolume ? 100 : AudioService.sinkMaxVolume;
|
||||
const newVolume = delta > 0 ? Math.min(maxVol, current + 5) : Math.max(0, current - 5);
|
||||
|
||||
if (usePlayerVolume) {
|
||||
activePlayer.volume = newVolume / 100;
|
||||
} else if (AudioService.sink?.audio) {
|
||||
AudioService.sink.audio.volume = newVolume / 100;
|
||||
}
|
||||
wheelEvent.accepted = true;
|
||||
wheelAccum += wheelEvent.angleDelta.y;
|
||||
const notches = wheelAccum > 0 ? Math.floor(wheelAccum / 120) : Math.ceil(wheelAccum / 120);
|
||||
if (notches === 0)
|
||||
return;
|
||||
wheelAccum -= notches * 120;
|
||||
root.adjustVolume(notches * AudioService.wheelVolumeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1079,7 +1079,7 @@ Rectangle {
|
||||
|
||||
Text {
|
||||
text: I18n.tr("Add a task...", "placeholder in the new-task input field")
|
||||
color: Theme.onSurface_38
|
||||
color: Theme.outlineButton
|
||||
visible: taskInput.text.length === 0
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -88,7 +88,7 @@ Card {
|
||||
topPadding: Theme.spacingL
|
||||
|
||||
StyledText {
|
||||
text: activePlayer?.trackTitle || I18n.tr("Unknown")
|
||||
text: MprisController.stableTitle || I18n.tr("Unknown")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -99,7 +99,7 @@ Card {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: activePlayer?.trackArtist || I18n.tr("Unknown Artist")
|
||||
text: MprisController.stableArtist || I18n.tr("Unknown Artist")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
width: parent.width
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -19,6 +18,7 @@ Card {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
visible: !WeatherService.weather.available
|
||||
z: 1
|
||||
|
||||
DankSpinner {
|
||||
size: 24
|
||||
@@ -42,9 +42,9 @@ Card {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Button {
|
||||
DankButton {
|
||||
text: I18n.tr("Refresh")
|
||||
flat: true
|
||||
buttonHeight: 32
|
||||
visible: !WeatherService.weather.loading
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: WeatherService.forceRefresh()
|
||||
|
||||
@@ -141,52 +141,27 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
DankActionButton {
|
||||
id: refreshButtonTwo
|
||||
name: "refresh"
|
||||
size: Theme.iconSize - 4
|
||||
color: Theme.withAlpha(Theme.surfaceText, 0.4)
|
||||
anchors.top: parent.top
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
smoothTransform: isRefreshing
|
||||
|
||||
property bool isRefreshing: false
|
||||
iconName: isRefreshing ? "" : "refresh"
|
||||
iconColor: Theme.withAlpha(Theme.surfaceText, 0.4)
|
||||
tooltipText: I18n.tr("Refresh Weather")
|
||||
tooltipSide: "left"
|
||||
enabled: !isRefreshing
|
||||
|
||||
MouseArea {
|
||||
id: refreshButtonMouseAreaTwo
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor
|
||||
enabled: parent.enabled
|
||||
property bool isRefreshing: false
|
||||
|
||||
Timer {
|
||||
id: hoverDelayTwo
|
||||
interval: 300
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
refreshButtonTooltipTwo.show(I18n.tr("Refresh Weather"), refreshButtonTwo, 0, 0, "left");
|
||||
}
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
hoverDelayTwo.restart();
|
||||
}
|
||||
|
||||
onExited: {
|
||||
hoverDelayTwo.stop();
|
||||
refreshButtonTooltipTwo.hide();
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
refreshButtonTwo.isRefreshing = true;
|
||||
WeatherService.forceRefresh();
|
||||
refreshTimerTwo.restart();
|
||||
}
|
||||
onClicked: {
|
||||
isRefreshing = true;
|
||||
WeatherService.forceRefresh();
|
||||
refreshTimerTwo.restart();
|
||||
}
|
||||
|
||||
DankTooltipV2 {
|
||||
id: refreshButtonTooltipTwo
|
||||
DankSpinner {
|
||||
anchors.centerIn: parent
|
||||
size: refreshButtonTwo.iconSize
|
||||
visible: refreshButtonTwo.isRefreshing
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -194,14 +169,6 @@ Item {
|
||||
interval: 2000
|
||||
onTriggered: refreshButtonTwo.isRefreshing = false
|
||||
}
|
||||
|
||||
RotationAnimator on rotation {
|
||||
running: refreshButtonTwo.isRefreshing
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -864,52 +831,28 @@ Item {
|
||||
onClicked: SessionData.setWeatherHourlyDetailed(!SessionData.weatherHourlyDetailed)
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
DankActionButton {
|
||||
id: refreshButton
|
||||
name: "refresh"
|
||||
size: Theme.iconSize - 4
|
||||
color: Theme.withAlpha(Theme.surfaceText, 0.4)
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
smoothTransform: isRefreshing
|
||||
|
||||
property bool isRefreshing: false
|
||||
iconName: isRefreshing ? "" : "refresh"
|
||||
iconColor: Theme.withAlpha(Theme.surfaceText, 0.4)
|
||||
tooltipText: I18n.tr("Refresh Weather")
|
||||
tooltipSide: "left"
|
||||
enabled: !isRefreshing
|
||||
|
||||
MouseArea {
|
||||
id: refreshButtonMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor
|
||||
enabled: parent.enabled
|
||||
property bool isRefreshing: false
|
||||
|
||||
Timer {
|
||||
id: hoverDelay
|
||||
interval: 300
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
refreshButtonTooltip.show(I18n.tr("Refresh Weather"), refreshButton, 0, 0, "left");
|
||||
}
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
hoverDelay.restart();
|
||||
}
|
||||
|
||||
onExited: {
|
||||
hoverDelay.stop();
|
||||
refreshButtonTooltip.hide();
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
refreshButton.isRefreshing = true;
|
||||
WeatherService.forceRefresh();
|
||||
refreshTimer.restart();
|
||||
}
|
||||
onClicked: {
|
||||
isRefreshing = true;
|
||||
WeatherService.forceRefresh();
|
||||
refreshTimer.restart();
|
||||
}
|
||||
|
||||
DankTooltipV2 {
|
||||
id: refreshButtonTooltip
|
||||
DankSpinner {
|
||||
anchors.centerIn: parent
|
||||
size: refreshButton.iconSize
|
||||
visible: refreshButton.isRefreshing
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -917,14 +860,6 @@ Item {
|
||||
interval: 2000
|
||||
onTriggered: refreshButton.isRefreshing = false
|
||||
}
|
||||
|
||||
RotationAnimator on rotation {
|
||||
running: refreshButton.isRefreshing
|
||||
from: 0
|
||||
to: 360
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -936,7 +871,7 @@ Item {
|
||||
id: dailyLoader
|
||||
anchors.fill: parent
|
||||
sourceComponent: dailyComponent
|
||||
active: root.visible && root.available
|
||||
active: root.visible && root.available && width > 0 && height > 0
|
||||
visible: !root.showHourly
|
||||
asynchronous: true
|
||||
opacity: 0
|
||||
@@ -953,7 +888,7 @@ Item {
|
||||
id: hourlyLoader
|
||||
anchors.fill: parent
|
||||
sourceComponent: hourlyComponent
|
||||
active: root.visible && root.available
|
||||
active: root.visible && root.available && width > 0 && height > 0
|
||||
visible: root.showHourly
|
||||
asynchronous: true
|
||||
opacity: 0
|
||||
@@ -1038,6 +973,7 @@ Item {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
property real hWheelAccum: 0
|
||||
onWheel: wheel => {
|
||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
||||
@@ -1049,6 +985,15 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wheel.angleDelta.x !== 0) {
|
||||
hWheelAccum += wheel.angleDelta.x;
|
||||
const steps = Math.trunc(hWheelAccum / 120);
|
||||
hWheelAccum -= steps * 120;
|
||||
if (steps !== 0)
|
||||
hourlyList.currentIndex = Math.max(0, Math.min(hourlyList.model - 1, hourlyList.currentIndex - steps));
|
||||
wheel.accepted = true;
|
||||
return;
|
||||
}
|
||||
wheel.accepted = false;
|
||||
}
|
||||
}
|
||||
@@ -1096,6 +1041,7 @@ Item {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
property real hWheelAccum: 0
|
||||
onWheel: wheel => {
|
||||
if (wheel.modifiers & Qt.ShiftModifier) {
|
||||
if (wheel.angleDelta.y % 120 == 0 && wheel.angleDelta.x == 0) {
|
||||
@@ -1107,6 +1053,15 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wheel.angleDelta.x !== 0) {
|
||||
hWheelAccum += wheel.angleDelta.x;
|
||||
const steps = Math.trunc(hWheelAccum / 120);
|
||||
hWheelAccum -= steps * 120;
|
||||
if (steps !== 0)
|
||||
dailyList.currentIndex = Math.max(0, Math.min(dailyList.model - 1, dailyList.currentIndex - steps));
|
||||
wheel.accepted = true;
|
||||
return;
|
||||
}
|
||||
wheel.accepted = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,14 +73,14 @@ Item {
|
||||
readonly property bool greeterPamHasFprint: greeterPamStackHasFprint && (!fprintdProbeComplete || fprintdHasDevice)
|
||||
readonly property bool greeterPamHasU2f: greeterPamStackHasModule("pam_u2f")
|
||||
readonly property bool greeterExternalAuthAvailable: (greeterPamHasFprint && GreetdSettings.greeterEnableFprint) || (greeterPamHasU2f && GreetdSettings.greeterEnableU2f)
|
||||
readonly property bool greeterPamHasExternalAuth: greeterPamStackHasFprint || greeterPamHasU2f
|
||||
readonly property bool greeterPamHasExternalAuth: greeterPamHasFprint || greeterPamHasU2f
|
||||
readonly property bool externalAuthInProgress: awaitingExternalAuth || (Greetd.state !== GreetdState.Inactive && passwordSubmitRequested && greeterPamHasExternalAuth && !pendingPasswordResponse)
|
||||
readonly property string externalAuthStatusMessage: {
|
||||
if (!externalAuthInProgress)
|
||||
return "";
|
||||
if (greeterPamStackHasFprint && greeterPamHasU2f)
|
||||
if (greeterPamHasFprint && greeterPamHasU2f)
|
||||
return I18n.tr("Awaiting fingerprint or security key authentication");
|
||||
if (greeterPamStackHasFprint)
|
||||
if (greeterPamHasFprint)
|
||||
return I18n.tr("Awaiting fingerprint authentication");
|
||||
return I18n.tr("Awaiting security key authentication");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
@@ -65,10 +66,23 @@ PanelWindow {
|
||||
}
|
||||
|
||||
function cancelFade() {
|
||||
dismiss();
|
||||
fadeCancelled();
|
||||
}
|
||||
|
||||
function dismiss() {
|
||||
fadeSeq.stop();
|
||||
fadeOverlay.opacity = 0.0;
|
||||
active = false;
|
||||
fadeCancelled();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: IdleService
|
||||
function onIsShellLockedChanged() {
|
||||
if (IdleService.isShellLocked)
|
||||
return;
|
||||
root.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -10,38 +10,61 @@ import qs.Services
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
readonly property var log: Log.scoped("Lock")
|
||||
|
||||
property string sharedPasswordBuffer: ""
|
||||
property bool shouldLock: false
|
||||
|
||||
onShouldLockChanged: {
|
||||
IdleService.isShellLocked = shouldLock;
|
||||
if (shouldLock && lockPowerOffArmed) {
|
||||
lockStateCheck.restart();
|
||||
}
|
||||
onSharedPasswordBufferChanged: {
|
||||
if (!powerOffFadeTimer.running)
|
||||
return;
|
||||
cancelPowerOffFade();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: lockStateCheck
|
||||
interval: 100
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (sessionLock.locked && lockPowerOffArmed) {
|
||||
pendingLock = false;
|
||||
IdleService.monitorsOff = true;
|
||||
CompositorService.powerOffMonitors();
|
||||
lockWakeAllowed = false;
|
||||
lockWakeDebounce.restart();
|
||||
lockPowerOffArmed = false;
|
||||
dpmsReapplyTimer.start();
|
||||
}
|
||||
}
|
||||
onShouldLockChanged: {
|
||||
IdleService.isShellLocked = shouldLock;
|
||||
}
|
||||
|
||||
property bool lockInitiatedLocally: false
|
||||
property bool pendingLock: false
|
||||
readonly property int maxLockRetries: 3
|
||||
property int lockRetryAttempts: 0
|
||||
property bool lockRetryPending: false
|
||||
property bool lockPowerOffArmed: false
|
||||
property bool lockWakeAllowed: false
|
||||
property bool customLockerSpawned: false
|
||||
readonly property bool powerOffOnLock: SettingsData.lockScreenPowerOffMonitorsOnLock || IdleService.lockPowerOffRequested
|
||||
property real powerOffFadeTarget: 0
|
||||
property bool powerOffFadeInstant: false
|
||||
|
||||
function beginPowerOff() {
|
||||
if (!SettingsData.fadeToDpmsEnabled || SettingsData.fadeToDpmsGracePeriod <= 0) {
|
||||
applyMonitorsOff();
|
||||
return;
|
||||
}
|
||||
powerOffFadeInstant = false;
|
||||
powerOffFadeTarget = 1;
|
||||
powerOffFadeTimer.restart();
|
||||
}
|
||||
|
||||
function applyMonitorsOff() {
|
||||
IdleService.monitorsOff = true;
|
||||
CompositorService.powerOffMonitors();
|
||||
lockWakeAllowed = false;
|
||||
lockWakeDebounce.restart();
|
||||
dpmsReapplyTimer.start();
|
||||
}
|
||||
|
||||
function resetPowerOffFade() {
|
||||
powerOffFadeTimer.stop();
|
||||
powerOffFadeInstant = true;
|
||||
powerOffFadeTarget = 0;
|
||||
}
|
||||
|
||||
function cancelPowerOffFade() {
|
||||
resetPowerOffFade();
|
||||
IdleService.lockPowerOffRequested = false;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
IdleService.lockComponent = this;
|
||||
@@ -65,6 +88,7 @@ Scope {
|
||||
}
|
||||
|
||||
function spawnCustomLocker() {
|
||||
IdleService.lockPowerOffRequested = false;
|
||||
Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionLock]);
|
||||
// The custom locker manages its own surface; DMS never engages
|
||||
// WlSessionLock here, so isShellLocked stays false and the fade
|
||||
@@ -81,6 +105,24 @@ Scope {
|
||||
return true;
|
||||
}
|
||||
|
||||
function resetLockRetry() {
|
||||
lockRetryAttempts = 0;
|
||||
lockRetryPending = false;
|
||||
lockRetryTimer.stop();
|
||||
}
|
||||
|
||||
function handleLockLost() {
|
||||
if (lockRetryAttempts >= maxLockRetries) {
|
||||
log.error("Compositor refused session lock", maxLockRetries, "times - resetting lock state");
|
||||
forceReset();
|
||||
return;
|
||||
}
|
||||
lockRetryAttempts++;
|
||||
lockRetryPending = true;
|
||||
lockRetryTimer.restart();
|
||||
log.warn("Session lock lost while lock requested - retry", lockRetryAttempts, "/", maxLockRetries);
|
||||
}
|
||||
|
||||
function lock() {
|
||||
if (SettingsData.customPowerActionLock?.length > 0) {
|
||||
spawnCustomLocker();
|
||||
@@ -89,8 +131,9 @@ Scope {
|
||||
if (shouldLock || pendingLock)
|
||||
return;
|
||||
|
||||
resetLockRetry();
|
||||
lockInitiatedLocally = true;
|
||||
lockPowerOffArmed = SettingsData.lockScreenPowerOffMonitorsOnLock;
|
||||
lockPowerOffArmed = powerOffOnLock;
|
||||
|
||||
if (!SessionService.active && SessionService.loginctlAvailable && SettingsData.loginctlLockIntegration) {
|
||||
pendingLock = true;
|
||||
@@ -102,9 +145,20 @@ Scope {
|
||||
notifyLoginctl(true);
|
||||
}
|
||||
|
||||
function lockAndOutputsOff() {
|
||||
IdleService.lockPowerOffRequested = true;
|
||||
if (sessionLock.secure) {
|
||||
beginPowerOff();
|
||||
return;
|
||||
}
|
||||
lockPowerOffArmed = true;
|
||||
lock();
|
||||
}
|
||||
|
||||
function unlock() {
|
||||
if (!shouldLock)
|
||||
return;
|
||||
resetLockRetry();
|
||||
lockInitiatedLocally = false;
|
||||
notifyLoginctl(false);
|
||||
shouldLock = false;
|
||||
@@ -115,6 +169,9 @@ Scope {
|
||||
pendingLock = false;
|
||||
shouldLock = false;
|
||||
customLockerSpawned = false;
|
||||
resetLockRetry();
|
||||
resetPowerOffFade();
|
||||
IdleService.lockPowerOffRequested = false;
|
||||
}
|
||||
|
||||
function activate() {
|
||||
@@ -135,7 +192,7 @@ Scope {
|
||||
return;
|
||||
}
|
||||
lockInitiatedLocally = false;
|
||||
lockPowerOffArmed = SettingsData.lockScreenPowerOffMonitorsOnLock;
|
||||
lockPowerOffArmed = powerOffOnLock;
|
||||
shouldLock = true;
|
||||
}
|
||||
|
||||
@@ -151,11 +208,17 @@ Scope {
|
||||
shouldLock = false;
|
||||
}
|
||||
|
||||
function onSessionResumed() {
|
||||
if (!shouldLock || sessionLock.locked)
|
||||
return;
|
||||
resumeRelockTimer.restart();
|
||||
}
|
||||
|
||||
function onLoginctlStateChanged() {
|
||||
if (SessionService.active && pendingLock) {
|
||||
pendingLock = false;
|
||||
lockInitiatedLocally = true;
|
||||
lockPowerOffArmed = SettingsData.lockScreenPowerOffMonitorsOnLock;
|
||||
lockPowerOffArmed = powerOffOnLock;
|
||||
shouldLock = true;
|
||||
return;
|
||||
}
|
||||
@@ -163,7 +226,7 @@ Scope {
|
||||
if (handleLoginctlCustomLock())
|
||||
return;
|
||||
lockInitiatedLocally = false;
|
||||
lockPowerOffArmed = SettingsData.lockScreenPowerOffMonitorsOnLock;
|
||||
lockPowerOffArmed = powerOffOnLock;
|
||||
shouldLock = true;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +238,11 @@ Scope {
|
||||
function onLockRequested() {
|
||||
lock();
|
||||
}
|
||||
|
||||
function onMonitorsOffChanged() {
|
||||
if (!IdleService.monitorsOff)
|
||||
root.resetPowerOffFade();
|
||||
}
|
||||
}
|
||||
|
||||
Pam {
|
||||
@@ -187,7 +255,7 @@ Scope {
|
||||
WlSessionLock {
|
||||
id: sessionLock
|
||||
|
||||
locked: shouldLock
|
||||
locked: shouldLock && !lockRetryPending
|
||||
|
||||
WlSessionLockSurface {
|
||||
id: lockSurface
|
||||
@@ -214,32 +282,78 @@ Scope {
|
||||
root.sharedPasswordBuffer = newPassword;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
opacity: root.powerOffFadeTarget
|
||||
visible: opacity > 0 || powerOffFadeTimer.running
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: !root.powerOffFadeInstant
|
||||
NumberAnimation {
|
||||
duration: SettingsData.fadeToDpmsGracePeriod * 1000
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
property real baselineX: -1
|
||||
property real baselineY: -1
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: powerOffFadeTimer.running
|
||||
hoverEnabled: enabled
|
||||
onEnabledChanged: {
|
||||
baselineX = -1;
|
||||
baselineY = -1;
|
||||
}
|
||||
onPressed: root.cancelPowerOffFade()
|
||||
onWheel: root.cancelPowerOffFade()
|
||||
onPositionChanged: mouse => {
|
||||
if (baselineX < 0) {
|
||||
baselineX = mouse.x;
|
||||
baselineY = mouse.y;
|
||||
return;
|
||||
}
|
||||
if (Math.abs(mouse.x - baselineX) < 5 && Math.abs(mouse.y - baselineY) < 5)
|
||||
return;
|
||||
root.cancelPowerOffFade();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: sessionLock
|
||||
|
||||
function onLockedChanged() {
|
||||
notifyLockedHint(sessionLock.locked);
|
||||
if (sessionLock.locked) {
|
||||
pendingLock = false;
|
||||
if (lockPowerOffArmed && SettingsData.lockScreenPowerOffMonitorsOnLock) {
|
||||
IdleService.monitorsOff = true;
|
||||
CompositorService.powerOffMonitors();
|
||||
lockWakeAllowed = false;
|
||||
lockWakeDebounce.restart();
|
||||
}
|
||||
lockPowerOffArmed = false;
|
||||
dpmsReapplyTimer.start();
|
||||
function onSecureChanged() {
|
||||
notifyLockedHint(sessionLock.secure);
|
||||
if (!sessionLock.secure)
|
||||
return;
|
||||
}
|
||||
IdleService.dismissFadeToLock();
|
||||
lockRetryAttempts = 0;
|
||||
pendingLock = false;
|
||||
if (lockPowerOffArmed && powerOffOnLock)
|
||||
beginPowerOff();
|
||||
lockPowerOffArmed = false;
|
||||
}
|
||||
|
||||
function onLockedChanged() {
|
||||
if (sessionLock.locked)
|
||||
return;
|
||||
if (shouldLock && (IdleService.monitorsOff || lockPowerOffArmed || IdleService.lockPowerOffRequested))
|
||||
return;
|
||||
lockWakeAllowed = false;
|
||||
if (IdleService.monitorsOff && SettingsData.lockScreenPowerOffMonitorsOnLock) {
|
||||
resetPowerOffFade();
|
||||
if (IdleService.monitorsOff && powerOffOnLock) {
|
||||
IdleService.monitorsOff = false;
|
||||
CompositorService.powerOnMonitors();
|
||||
}
|
||||
IdleService.lockPowerOffRequested = false;
|
||||
if (shouldLock && !lockRetryPending)
|
||||
handleLockLost();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +368,10 @@ Scope {
|
||||
root.lock();
|
||||
}
|
||||
|
||||
function lockAndOutputsOff() {
|
||||
root.lockAndOutputsOff();
|
||||
}
|
||||
|
||||
function unlock() {
|
||||
root.unlock();
|
||||
}
|
||||
@@ -267,13 +385,15 @@ Scope {
|
||||
}
|
||||
|
||||
function isLocked(): bool {
|
||||
return sessionLock.locked;
|
||||
return sessionLock.secure;
|
||||
}
|
||||
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
shouldLock: root.shouldLock,
|
||||
sessionLockLocked: sessionLock.locked,
|
||||
sessionLockSecure: sessionLock.secure,
|
||||
lockRetryAttempts: root.lockRetryAttempts,
|
||||
lockInitiatedLocally: root.lockInitiatedLocally,
|
||||
pendingLock: root.pendingLock,
|
||||
loginctlLocked: SessionService.locked,
|
||||
@@ -282,6 +402,49 @@ Scope {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: powerOffFadeTimer
|
||||
interval: SettingsData.fadeToDpmsGracePeriod * 1000
|
||||
repeat: false
|
||||
onTriggered: root.applyMonitorsOff()
|
||||
}
|
||||
|
||||
IdleMonitor {
|
||||
timeout: 1
|
||||
respectInhibitors: false
|
||||
enabled: powerOffFadeTimer.running
|
||||
onIsIdleChanged: {
|
||||
if (isIdle)
|
||||
return;
|
||||
if (!powerOffFadeTimer.running)
|
||||
return;
|
||||
root.cancelPowerOffFade();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: lockRetryTimer
|
||||
interval: 1000
|
||||
repeat: false
|
||||
onTriggered: root.lockRetryPending = false
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: resumeRelockTimer
|
||||
interval: 1000
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (!root.shouldLock || sessionLock.locked)
|
||||
return;
|
||||
if (IdleService.monitorsOff || root.lockPowerOffArmed || IdleService.lockPowerOffRequested)
|
||||
return;
|
||||
root.log.warn("Session lock dead after resume - re-locking");
|
||||
root.resetLockRetry();
|
||||
root.lockRetryPending = true;
|
||||
root.lockRetryPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: dpmsReapplyTimer
|
||||
interval: 100
|
||||
@@ -294,9 +457,9 @@ Scope {
|
||||
interval: 200
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
if (!sessionLock.locked)
|
||||
if (!sessionLock.secure)
|
||||
return;
|
||||
if (!SettingsData.lockScreenPowerOffMonitorsOnLock)
|
||||
if (!powerOffOnLock)
|
||||
return;
|
||||
if (!IdleService.monitorsOff) {
|
||||
lockWakeAllowed = true;
|
||||
@@ -313,7 +476,7 @@ Scope {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: sessionLock.locked
|
||||
enabled: sessionLock.secure
|
||||
hoverEnabled: enabled
|
||||
onPressed: lockWakeDebounce.restart()
|
||||
onPositionChanged: lockWakeDebounce.restart()
|
||||
@@ -322,10 +485,10 @@ Scope {
|
||||
|
||||
FocusScope {
|
||||
anchors.fill: parent
|
||||
focus: sessionLock.locked
|
||||
focus: sessionLock.secure
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (!sessionLock.locked)
|
||||
if (!sessionLock.secure)
|
||||
return;
|
||||
lockWakeDebounce.restart();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ Scope {
|
||||
}
|
||||
|
||||
function proceedAfterPrimaryAuth(): void {
|
||||
if (SettingsData.enableU2f && SettingsData.u2fMode === "and" && u2f.available) {
|
||||
if (!root.u2fSuppressedByPrimaryPam && SettingsData.enableU2f && SettingsData.u2fMode === "and" && u2f.available) {
|
||||
u2f.startForSecondFactor();
|
||||
} else {
|
||||
completeUnlock();
|
||||
@@ -91,8 +91,9 @@ Scope {
|
||||
}
|
||||
|
||||
readonly property bool customPamActive: SettingsData.lockPamPath !== "" && customPamWatcher.loaded
|
||||
readonly property bool fprintSuppressedByCustomPam: customPamActive && SettingsData.lockPamInlineFprint
|
||||
readonly property bool u2fSuppressedByCustomPam: customPamActive && SettingsData.lockPamInlineU2f
|
||||
readonly property bool fprintSuppressedByPrimaryPam: SettingsData.lockPamExternallyManaged || (customPamActive && SettingsData.lockPamInlineFprint)
|
||||
readonly property bool u2fSuppressedByPrimaryPam: SettingsData.lockPamExternallyManaged || (customPamActive && SettingsData.lockPamInlineU2f)
|
||||
readonly property bool customU2fPamActive: SettingsData.lockU2fPamPath !== "" && customU2fPamWatcher.loaded
|
||||
|
||||
FileView {
|
||||
id: customPamWatcher
|
||||
@@ -109,16 +110,17 @@ Scope {
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: nixosMarker
|
||||
id: u2fConfigWatcher
|
||||
|
||||
path: "/etc/NIXOS"
|
||||
path: "/etc/pam.d/dankshell-u2f"
|
||||
watchChanges: true
|
||||
printErrors: false
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: u2fConfigWatcher
|
||||
id: customU2fPamWatcher
|
||||
|
||||
path: "/etc/pam.d/dankshell-u2f"
|
||||
path: SettingsData.lockU2fPamPath !== "" ? SettingsData.lockU2fPamPath : ""
|
||||
printErrors: false
|
||||
}
|
||||
|
||||
@@ -145,26 +147,23 @@ Scope {
|
||||
}
|
||||
|
||||
function ensureUserPamConfig(): void {
|
||||
if (root.runningFromNixStore || resolveUserPam.running)
|
||||
if (SettingsData.lockPamExternallyManaged || resolveUserPam.running)
|
||||
return;
|
||||
resolveUserPam.running = true;
|
||||
}
|
||||
|
||||
Component.onCompleted: ensureUserPamConfig()
|
||||
|
||||
// Detects Nix-installed DMS on non-NixOS systems
|
||||
readonly property bool runningFromNixStore: Quickshell.shellDir.startsWith("/nix/store/")
|
||||
|
||||
PamContext {
|
||||
id: passwd
|
||||
|
||||
config: {
|
||||
if (root.customPamActive)
|
||||
return SettingsData.lockPamPath.slice(SettingsData.lockPamPath.lastIndexOf("/") + 1);
|
||||
if (SettingsData.lockPamExternallyManaged)
|
||||
return "login";
|
||||
if (dankshellConfigWatcher.loaded)
|
||||
return "dankshell";
|
||||
if (nixosMarker.loaded || root.runningFromNixStore)
|
||||
return "login";
|
||||
if (userPamWatcher.loaded)
|
||||
return "dankshell";
|
||||
return "login";
|
||||
@@ -174,9 +173,9 @@ Scope {
|
||||
const idx = SettingsData.lockPamPath.lastIndexOf("/");
|
||||
return idx > 0 ? SettingsData.lockPamPath.slice(0, idx) : "/";
|
||||
}
|
||||
if (dankshellConfigWatcher.loaded)
|
||||
if (SettingsData.lockPamExternallyManaged)
|
||||
return "/etc/pam.d";
|
||||
if (nixosMarker.loaded || root.runningFromNixStore)
|
||||
if (dankshellConfigWatcher.loaded)
|
||||
return "/etc/pam.d";
|
||||
if (userPamWatcher.loaded)
|
||||
return root.userPamDir;
|
||||
@@ -265,7 +264,7 @@ Scope {
|
||||
property int errorTries
|
||||
|
||||
function checkAvail(): void {
|
||||
if (!available || !SettingsData.enableFprint || !root.lockSecured || root.fprintSuppressedByCustomPam) {
|
||||
if (!available || !SettingsData.enableFprint || !root.lockSecured || root.fprintSuppressedByPrimaryPam) {
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
@@ -325,7 +324,7 @@ Scope {
|
||||
property bool available: SettingsData.lockU2fReady
|
||||
|
||||
function checkAvail(): void {
|
||||
if (!available || !SettingsData.enableU2f || !root.lockSecured || root.u2fSuppressedByCustomPam) {
|
||||
if (!available || !SettingsData.enableU2f || !root.lockSecured || root.u2fSuppressedByPrimaryPam) {
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
@@ -335,7 +334,7 @@ Scope {
|
||||
}
|
||||
|
||||
function startForSecondFactor(): void {
|
||||
if (!available || !SettingsData.enableU2f || root.u2fSuppressedByCustomPam) {
|
||||
if (!available || !SettingsData.enableU2f || root.u2fSuppressedByPrimaryPam) {
|
||||
root.completeUnlock();
|
||||
return;
|
||||
}
|
||||
@@ -348,7 +347,7 @@ Scope {
|
||||
}
|
||||
|
||||
function startForAlternativeAuth(): void {
|
||||
if (!available || !SettingsData.enableU2f || root.u2fSuppressedByCustomPam || SettingsData.u2fMode !== "or" || root.unlockInProgress || passwd.active || active)
|
||||
if (!available || !SettingsData.enableU2f || root.u2fSuppressedByPrimaryPam || SettingsData.u2fMode !== "or" || root.unlockInProgress || passwd.active || active)
|
||||
return;
|
||||
abort();
|
||||
root.u2fPending = true;
|
||||
@@ -358,8 +357,18 @@ Scope {
|
||||
start();
|
||||
}
|
||||
|
||||
config: u2fConfigWatcher.loaded ? "dankshell-u2f" : "u2f"
|
||||
configDirectory: u2fConfigWatcher.loaded ? "/etc/pam.d" : Quickshell.shellDir + "/assets/pam"
|
||||
config: {
|
||||
if (root.customU2fPamActive)
|
||||
return SettingsData.lockU2fPamPath.slice(SettingsData.lockU2fPamPath.lastIndexOf("/") + 1);
|
||||
return u2fConfigWatcher.loaded ? "dankshell-u2f" : "u2f";
|
||||
}
|
||||
configDirectory: {
|
||||
if (root.customU2fPamActive) {
|
||||
const idx = SettingsData.lockU2fPamPath.lastIndexOf("/");
|
||||
return idx > 0 ? SettingsData.lockU2fPamPath.slice(0, idx) : "/";
|
||||
}
|
||||
return u2fConfigWatcher.loaded ? "/etc/pam.d" : Quickshell.shellDir + "/assets/pam";
|
||||
}
|
||||
|
||||
onMessageChanged: {
|
||||
if (message.toLowerCase().includes("touch"))
|
||||
@@ -478,8 +487,11 @@ Scope {
|
||||
root.attemptInfoMessages = [];
|
||||
root.lockoutAnnouncedThisAttempt = false;
|
||||
root.resetAuthFlows();
|
||||
if (!dankshellConfigWatcher.loaded && !nixosMarker.loaded && !userPamWatcher.loaded)
|
||||
if (!SettingsData.lockPamExternallyManaged && !dankshellConfigWatcher.loaded && !userPamWatcher.loaded)
|
||||
ensureUserPamConfig();
|
||||
// FileView cannot watch a path that does not exist yet; re-read so a
|
||||
// dedicated service created after startup is used on the next lock.
|
||||
u2fConfigWatcher.reload();
|
||||
fprint.checkAvail();
|
||||
u2f.checkAvail();
|
||||
}
|
||||
@@ -516,6 +528,19 @@ Scope {
|
||||
u2f.checkAvail();
|
||||
}
|
||||
|
||||
function onLockPamExternallyManagedChanged(): void {
|
||||
root.resetAuthFlows();
|
||||
if (!SettingsData.lockPamExternallyManaged)
|
||||
root.ensureUserPamConfig();
|
||||
fprint.checkAvail();
|
||||
u2f.checkAvail();
|
||||
}
|
||||
|
||||
function onLockU2fPamPathChanged(): void {
|
||||
u2f.abort();
|
||||
u2f.checkAvail();
|
||||
}
|
||||
|
||||
function onU2fModeChanged(): void {
|
||||
if (root.lockSecured) {
|
||||
u2f.abort();
|
||||
|
||||
@@ -49,7 +49,7 @@ Rectangle {
|
||||
color: {
|
||||
if (isSelected && keyboardNavigationActive)
|
||||
return Theme.primaryPressed;
|
||||
return Theme.floatingSurfaceHigh;
|
||||
return Theme.notificationFloatingSurfaceHigh;
|
||||
}
|
||||
border.color: {
|
||||
if (isSelected && keyboardNavigationActive)
|
||||
|
||||
@@ -153,7 +153,7 @@ Rectangle {
|
||||
if (keyboardNavigationActive && expanded && selectedNotificationIndex >= 0) {
|
||||
return Theme.primaryHoverLight;
|
||||
}
|
||||
return Theme.floatingSurfaceHigh;
|
||||
return Theme.notificationFloatingSurfaceHigh;
|
||||
}
|
||||
border.color: {
|
||||
if (isGroupSelected && keyboardNavigationActive) {
|
||||
@@ -583,7 +583,7 @@ Rectangle {
|
||||
return expandedBaseHeight;
|
||||
}
|
||||
radius: Theme.cornerRadius
|
||||
color: isSelected ? Theme.primaryPressed : Theme.nestedSurface
|
||||
color: isSelected ? Theme.primaryPressed : Theme.notificationNestedSurface
|
||||
border.color: isSelected ? Theme.withAlpha(Theme.primary, 0.4) : Theme.outlineMedium
|
||||
border.width: 1
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ DankPopout {
|
||||
notificationHistoryVisible = !notificationHistoryVisible;
|
||||
}
|
||||
|
||||
// Re-open without toggling the flag (used when retargeting to another monitor).
|
||||
function present() {
|
||||
openSized();
|
||||
}
|
||||
|
||||
function openSized() {
|
||||
if (!notificationHistoryVisible)
|
||||
return;
|
||||
|
||||
@@ -676,7 +676,7 @@ PanelWindow {
|
||||
sourceWidth: Math.max(0, content.width - (content.cardInset * 2))
|
||||
sourceHeight: Math.max(0, content.height - (content.cardInset * 2))
|
||||
targetRadius: win.connectedFrameMode ? Theme.connectedSurfaceRadius : Theme.cornerRadius
|
||||
targetColor: win.connectedFrameMode ? Theme.floatingSurface : Theme.readableSurface
|
||||
targetColor: win.connectedFrameMode ? Theme.notificationFloatingSurface : Theme.readableSurface
|
||||
borderColor: win.notificationData && win.notificationData.urgency === NotificationUrgency.Critical ? Theme.withAlpha(Theme.primary, 0.3) : Theme.withAlpha(Theme.outline, 0.08)
|
||||
borderWidth: win.notificationData && win.notificationData.urgency === NotificationUrgency.Critical ? 2 : 0
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ Item {
|
||||
|
||||
function greeterFingerprintDescription() {
|
||||
if (SettingsData.greeterPamExternallyManaged)
|
||||
return "greetd PAM is externally managed";
|
||||
return I18n.tr("Managed by the primary PAM source.", "factor managed by PAM source status");
|
||||
if (SettingsData.greeterFingerprintSource === "pam")
|
||||
return I18n.tr("PAM already provides fingerprint auth. Enable this to show it at login.", "greeter fingerprint login setting");
|
||||
|
||||
@@ -39,7 +39,7 @@ Item {
|
||||
|
||||
function greeterU2fDescription() {
|
||||
if (SettingsData.greeterPamExternallyManaged)
|
||||
return "greetd PAM is externally managed";
|
||||
return I18n.tr("Managed by the primary PAM source.", "factor managed by PAM source status");
|
||||
if (SettingsData.greeterU2fSource === "pam")
|
||||
return I18n.tr("PAM already provides security-key auth. Enable this to show it at login.", "greeter security key login setting");
|
||||
|
||||
@@ -305,7 +305,7 @@ Item {
|
||||
onExited: exitCode => {
|
||||
root.greeterSyncRunning = false;
|
||||
if (exitCode === 0) {
|
||||
var launched = root.greeterTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete sync authentication there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete sync there; it will close automatically when done.");
|
||||
var launched = root.greeterTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete authentication there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete authentication there; it will close automatically when done.");
|
||||
root.greeterStatusText = root.greeterStatusText ? root.greeterStatusText + "\n\n" + launched : launched;
|
||||
SettingsData.clearGreeterSyncPending();
|
||||
return;
|
||||
@@ -396,7 +396,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "info"
|
||||
title: I18n.tr("Greeter Status")
|
||||
title: I18n.tr("Status")
|
||||
settingKey: "greeterStatus"
|
||||
|
||||
StyledText {
|
||||
@@ -470,7 +470,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "fingerprint"
|
||||
title: I18n.tr("Login Authentication")
|
||||
title: I18n.tr("Authentication")
|
||||
settingKey: "greeterAuth"
|
||||
|
||||
StyledText {
|
||||
@@ -485,8 +485,8 @@ Item {
|
||||
SettingsToggleRow {
|
||||
settingKey: "greeterPamExternallyManaged"
|
||||
tags: ["greeter", "pam", "managed", "external", "greetd", "auth"]
|
||||
text: "greetd PAM is externally managed"
|
||||
description: "DMS removes its managed block from /etc/pam.d/greetd and stops writing to it"
|
||||
text: I18n.tr("Use system PAM authentication", "system PAM policy toggle")
|
||||
description: I18n.tr("DMS removes its managed block from /etc/pam.d/greetd and stops writing to it", "greeter system PAM toggle description")
|
||||
checked: SettingsData.greeterPamExternallyManaged
|
||||
onToggled: checked => SettingsData.set("greeterPamExternallyManaged", checked)
|
||||
}
|
||||
@@ -517,7 +517,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "palette"
|
||||
title: I18n.tr("Greeter Appearance")
|
||||
title: I18n.tr("Appearance")
|
||||
settingKey: "greeterAppearance"
|
||||
|
||||
StyledText {
|
||||
@@ -558,7 +558,7 @@ Item {
|
||||
currentValue: {
|
||||
var current = (SettingsData.greeterLockDateFormat !== undefined && SettingsData.greeterLockDateFormat !== "") ? SettingsData.greeterLockDateFormat : SettingsData.lockDateFormat || "";
|
||||
var match = root._lockDateFormatPresets.find(p => p.format === current);
|
||||
return match ? match.label : (current ? I18n.tr("Custom: ") + current : root._lockDateFormatPresets[0].label);
|
||||
return match ? match.label : (current ? I18n.tr("Custom") + ": " + current : root._lockDateFormatPresets[0].label);
|
||||
}
|
||||
onValueChanged: value => {
|
||||
var preset = root._lockDateFormatPresets.find(p => p.label === value);
|
||||
@@ -601,7 +601,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "history"
|
||||
title: I18n.tr("Greeter Behavior")
|
||||
title: I18n.tr("Behavior")
|
||||
settingKey: "greeterBehavior"
|
||||
|
||||
StyledText {
|
||||
|
||||
@@ -747,6 +747,31 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "layers"
|
||||
title: I18n.tr("Modal Background")
|
||||
settingKey: "modalBackground"
|
||||
tags: ["modal", "darken", "background", "overlay", "launcher"]
|
||||
|
||||
SettingsControlledByFrame {
|
||||
visible: SettingsData.frameEnabled
|
||||
parentModal: root.parentModal
|
||||
settingLabel: I18n.tr("Darken Modal Background")
|
||||
reason: I18n.tr("Disabled by Frame Mode")
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "modalDarkenBackground"
|
||||
tags: ["modal", "darken", "background", "overlay", "launcher"]
|
||||
text: I18n.tr("Darken Modal Background")
|
||||
description: I18n.tr("Show darkened overlay behind modal dialogs")
|
||||
visible: !SettingsData.frameEnabled
|
||||
checked: SettingsData.modalDarkenBackground
|
||||
onToggled: checked => SettingsData.set("modalDarkenBackground", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "open_in_new"
|
||||
|
||||
@@ -11,6 +11,10 @@ Item {
|
||||
|
||||
readonly property bool lockFprintToggleAvailable: SettingsData.lockFingerprintCanEnable || SettingsData.enableFprint
|
||||
readonly property bool lockU2fToggleAvailable: SettingsData.lockU2fCanEnable || SettingsData.enableU2f
|
||||
readonly property bool primaryPamHasFprint: SettingsData.lockPamPath !== "" && SettingsData.lockPamInlineFprint
|
||||
readonly property bool primaryPamHasU2f: SettingsData.lockPamPath !== "" && SettingsData.lockPamInlineU2f
|
||||
readonly property bool lockFprintControlledByPrimary: SettingsData.lockPamExternallyManaged || primaryPamHasFprint
|
||||
readonly property bool lockU2fControlledByPrimary: SettingsData.lockPamExternallyManaged || primaryPamHasU2f
|
||||
|
||||
property var authServices: []
|
||||
property bool authValidateRunning: false
|
||||
@@ -19,6 +23,12 @@ Item {
|
||||
property string authValidateMessage: ""
|
||||
property string authPendingApplyPath: ""
|
||||
property bool authShowCustom: false
|
||||
property bool u2fValidateRunning: false
|
||||
property bool u2fValidateOk: false
|
||||
property bool u2fValidateWarn: false
|
||||
property string u2fValidateMessage: ""
|
||||
property string u2fPendingApplyPath: ""
|
||||
property bool u2fShowCustom: false
|
||||
|
||||
readonly property string authAutoLabel: I18n.tr("Auto", "automatic PAM authentication source option")
|
||||
readonly property string authCustomLabel: I18n.tr("Custom...", "custom PAM authentication source option")
|
||||
@@ -37,6 +47,8 @@ Item {
|
||||
return svc ? authServiceLabel(svc) : authCustomLabel;
|
||||
}
|
||||
|
||||
readonly property string u2fAuthCurrentValue: SettingsData.lockU2fPamPath === "" ? authAutoLabel : authCustomLabel
|
||||
|
||||
function refreshAuthServices() {
|
||||
authListServicesProcess.running = true;
|
||||
}
|
||||
@@ -62,6 +74,25 @@ Item {
|
||||
authValidateProcess.running = true;
|
||||
}
|
||||
|
||||
function applyAutoU2fSource() {
|
||||
SettingsData.set("lockU2fPamPath", "");
|
||||
root.u2fValidateOk = false;
|
||||
root.u2fValidateWarn = false;
|
||||
root.u2fValidateMessage = "";
|
||||
}
|
||||
|
||||
function validateAndApplyU2fSource(path) {
|
||||
if (!path)
|
||||
return;
|
||||
root.u2fPendingApplyPath = path;
|
||||
root.u2fValidateMessage = "";
|
||||
root.u2fValidateOk = false;
|
||||
root.u2fValidateWarn = false;
|
||||
root.u2fValidateRunning = true;
|
||||
u2fValidateProcess.command = ["dms", "auth", "validate", "--purpose", "u2f", "--path", path, "--json"];
|
||||
u2fValidateProcess.running = true;
|
||||
}
|
||||
|
||||
function lockFingerprintDescription() {
|
||||
switch (SettingsData.lockFingerprintReason) {
|
||||
case "ready":
|
||||
@@ -161,12 +192,12 @@ Item {
|
||||
} catch (e) {}
|
||||
|
||||
if (!data) {
|
||||
root.authValidateMessage = "validation failed — is dms in PATH?";
|
||||
root.authValidateMessage = I18n.tr("Config validation failed");
|
||||
return;
|
||||
}
|
||||
if (!data.valid) {
|
||||
const errs = Array.isArray(data.errors) ? data.errors : [];
|
||||
root.authValidateMessage = ["not applied:", ...errs].join("\n");
|
||||
root.authValidateMessage = [I18n.tr("Config validation failed"), ...errs].join("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,7 +207,46 @@ Item {
|
||||
const warns = Array.isArray(data.warnings) ? data.warnings : [];
|
||||
root.authValidateOk = true;
|
||||
root.authValidateWarn = warns.length > 0;
|
||||
root.authValidateMessage = warns.length > 0 ? ["applied with warnings:", ...warns].join("\n") : "applied";
|
||||
root.authValidateMessage = [I18n.tr("Authentication changes applied."), ...warns].join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: u2fValidateProcess
|
||||
running: false
|
||||
|
||||
property string collected: ""
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: u2fValidateProcess.collected = text || ""
|
||||
}
|
||||
|
||||
onExited: exitCode => {
|
||||
root.u2fValidateRunning = false;
|
||||
root.u2fValidateOk = false;
|
||||
root.u2fValidateWarn = false;
|
||||
|
||||
let data = null;
|
||||
try {
|
||||
data = JSON.parse(u2fValidateProcess.collected);
|
||||
} catch (e) {}
|
||||
|
||||
if (!data) {
|
||||
root.u2fValidateMessage = I18n.tr("Config validation failed");
|
||||
return;
|
||||
}
|
||||
if (!data.valid) {
|
||||
const errs = Array.isArray(data.errors) ? data.errors : [];
|
||||
root.u2fValidateMessage = [I18n.tr("Config validation failed"), ...errs].join("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsData.set("lockU2fPamPath", root.u2fPendingApplyPath);
|
||||
const warns = Array.isArray(data.warnings) ? data.warnings : [];
|
||||
root.u2fValidateOk = true;
|
||||
root.u2fValidateWarn = warns.length > 0;
|
||||
root.u2fValidateMessage = [I18n.tr("Authentication changes applied."), ...warns].join("\n");
|
||||
root.refreshAuthDetection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +266,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "lock"
|
||||
title: I18n.tr("Lock Screen layout")
|
||||
title: I18n.tr("Layout")
|
||||
settingKey: "lockLayout"
|
||||
|
||||
SettingsToggleRow {
|
||||
@@ -275,7 +345,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "palette"
|
||||
title: I18n.tr("Lock Screen Appearance")
|
||||
title: I18n.tr("Appearance")
|
||||
settingKey: "lockAppearance"
|
||||
|
||||
StyledText {
|
||||
@@ -326,14 +396,22 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "key"
|
||||
title: "Authentication Source"
|
||||
title: I18n.tr("Authentication")
|
||||
settingKey: "lockAuthSource"
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Authentication changes apply automatically.")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
width: parent.width
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
settingKey: "lockPamPath"
|
||||
tags: ["lock", "screen", "pam", "authentication", "source", "service"]
|
||||
text: "Authentication Source"
|
||||
description: SettingsData.lockPamPath !== "" ? SettingsData.lockPamPath : "Which PAM service the lock screen uses to authenticate"
|
||||
text: I18n.tr("Authentication Source", "lock screen PAM source setting")
|
||||
description: SettingsData.lockPamPath !== "" ? SettingsData.lockPamPath : I18n.tr("Which PAM service the lock screen uses to authenticate", "lock screen PAM source setting")
|
||||
options: root.authOptions
|
||||
currentValue: root.authCurrentValue
|
||||
onValueChanged: value => {
|
||||
@@ -394,21 +472,116 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
visible: (SettingsData.lockPamInlineFprint && SettingsData.enableFprint) || (SettingsData.lockPamInlineU2f && SettingsData.enableU2f)
|
||||
text: "The pinned PAM stack already prompts for fingerprint or security key, so DMS skips its own prompts"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.warning
|
||||
SettingsToggleRow {
|
||||
settingKey: "lockPamExternallyManaged"
|
||||
tags: ["lock", "screen", "pam", "managed", "external", "authentication", "policy"]
|
||||
text: I18n.tr("Use system PAM authentication", "system PAM policy toggle")
|
||||
checked: SettingsData.lockPamExternallyManaged
|
||||
onToggled: checked => SettingsData.set("lockPamExternallyManaged", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "enableFprint"
|
||||
tags: ["lock", "screen", "fingerprint", "authentication", "biometric", "fprint"]
|
||||
text: I18n.tr("Enable fingerprint authentication")
|
||||
description: root.lockFprintControlledByPrimary ? I18n.tr("Managed by the primary PAM source.", "factor managed by PAM source status") : root.lockFingerprintDescription()
|
||||
descriptionColor: root.lockFprintControlledByPrimary || SettingsData.lockFingerprintReason === "ready" ? Theme.surfaceVariantText : Theme.warning
|
||||
checked: SettingsData.enableFprint || root.primaryPamHasFprint
|
||||
enabled: root.lockFprintToggleAvailable && !root.lockFprintControlledByPrimary
|
||||
onToggled: checked => SettingsData.set("enableFprint", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "enableU2f"
|
||||
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "fido", "authentication", "hardware"]
|
||||
text: I18n.tr("Enable security key authentication", "Enable FIDO2/U2F hardware security key for lock screen")
|
||||
description: root.lockU2fControlledByPrimary ? I18n.tr("Managed by the primary PAM source.", "factor managed by PAM source status") : root.lockU2fDescription()
|
||||
descriptionColor: root.lockU2fControlledByPrimary || SettingsData.lockU2fReason === "ready" ? Theme.surfaceVariantText : Theme.warning
|
||||
checked: SettingsData.enableU2f || root.primaryPamHasU2f
|
||||
enabled: root.lockU2fToggleAvailable && !root.lockU2fControlledByPrimary
|
||||
onToggled: checked => SettingsData.set("enableU2f", checked)
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
settingKey: "u2fMode"
|
||||
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "mode", "factor", "second"]
|
||||
text: I18n.tr("Security key mode", "lock screen U2F security key mode setting")
|
||||
description: I18n.tr("'Alternative' lets the key unlock on its own. 'Second factor' requires password or fingerprint first, then the key.", "lock screen U2F security key mode setting")
|
||||
visible: SettingsData.enableU2f && !root.lockU2fControlledByPrimary
|
||||
options: [I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method"), I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint")]
|
||||
currentValue: SettingsData.u2fMode === "and" ? I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint") : I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method")
|
||||
onValueChanged: value => {
|
||||
if (value === I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint"))
|
||||
SettingsData.set("u2fMode", "and");
|
||||
else
|
||||
SettingsData.set("u2fMode", "or");
|
||||
}
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
settingKey: "lockU2fPamPath"
|
||||
tags: ["lock", "screen", "pam", "u2f", "security", "key", "source", "service"]
|
||||
text: I18n.tr("Security Key PAM Source", "lock screen dedicated U2F PAM source setting")
|
||||
description: SettingsData.lockU2fPamPath !== "" ? SettingsData.lockU2fPamPath : I18n.tr("Auto uses an installed or bundled key-only service.", "lock screen dedicated U2F PAM source setting")
|
||||
visible: !root.lockU2fControlledByPrimary
|
||||
options: [root.authAutoLabel, root.authCustomLabel]
|
||||
currentValue: root.u2fAuthCurrentValue
|
||||
onValueChanged: value => {
|
||||
if (value === root.authAutoLabel) {
|
||||
root.u2fShowCustom = false;
|
||||
root.applyAutoU2fSource();
|
||||
return;
|
||||
}
|
||||
root.u2fShowCustom = true;
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
wrapMode: Text.Wrap
|
||||
topPadding: Theme.spacingS
|
||||
spacing: Theme.spacingS
|
||||
visible: !root.lockU2fControlledByPrimary && (root.u2fShowCustom || root.u2fAuthCurrentValue === root.authCustomLabel)
|
||||
|
||||
DankTextField {
|
||||
id: customU2fPamField
|
||||
width: parent.width - validateU2fPamButton.width - Theme.spacingS
|
||||
placeholderText: "/etc/pam.d/dankshell-u2f"
|
||||
text: SettingsData.lockU2fPamPath
|
||||
backgroundColor: Theme.surfaceContainerHighest
|
||||
}
|
||||
|
||||
DankButton {
|
||||
id: validateU2fPamButton
|
||||
text: I18n.tr("Apply Changes", "validate and apply custom U2F PAM authentication source")
|
||||
enabled: !root.u2fValidateRunning && customU2fPamField.text.trim() !== ""
|
||||
onClicked: root.validateAndApplyU2fSource(customU2fPamField.text.trim())
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: Math.min(160, u2fStatusText.implicitHeight + Theme.spacingM * 2)
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainerHighest
|
||||
visible: !root.lockU2fControlledByPrimary && root.u2fValidateMessage !== ""
|
||||
|
||||
StyledText {
|
||||
id: u2fStatusText
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
text: root.u2fValidateMessage
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: "monospace"
|
||||
color: !root.u2fValidateOk ? Theme.error : (root.u2fValidateWarn ? Theme.warning : Theme.surfaceVariantText)
|
||||
wrapMode: Text.Wrap
|
||||
verticalAlignment: Text.AlignTop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "lock"
|
||||
title: I18n.tr("Lock Screen behaviour")
|
||||
title: I18n.tr("Behavior")
|
||||
settingKey: "lockBehavior"
|
||||
|
||||
StyledText {
|
||||
@@ -461,53 +634,6 @@ Item {
|
||||
checked: SettingsData.lockAtStartup
|
||||
onToggled: checked => SettingsData.set("lockAtStartup", checked)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Lock screen authentication changes apply automatically and may open a terminal when sudo authentication is required.")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
width: parent.width
|
||||
wrapMode: Text.Wrap
|
||||
topPadding: Theme.spacingS
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "enableFprint"
|
||||
tags: ["lock", "screen", "fingerprint", "authentication", "biometric", "fprint"]
|
||||
text: I18n.tr("Enable fingerprint authentication")
|
||||
description: root.lockFingerprintDescription()
|
||||
descriptionColor: SettingsData.lockFingerprintReason === "ready" ? Theme.surfaceVariantText : Theme.warning
|
||||
checked: SettingsData.enableFprint
|
||||
enabled: root.lockFprintToggleAvailable
|
||||
onToggled: checked => SettingsData.set("enableFprint", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "enableU2f"
|
||||
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "fido", "authentication", "hardware"]
|
||||
text: I18n.tr("Enable security key authentication", "Enable FIDO2/U2F hardware security key for lock screen")
|
||||
description: root.lockU2fDescription()
|
||||
descriptionColor: SettingsData.lockU2fReason === "ready" ? Theme.surfaceVariantText : Theme.warning
|
||||
checked: SettingsData.enableU2f
|
||||
enabled: root.lockU2fToggleAvailable
|
||||
onToggled: checked => SettingsData.set("enableU2f", checked)
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
settingKey: "u2fMode"
|
||||
tags: ["lock", "screen", "u2f", "yubikey", "security", "key", "mode", "factor", "second"]
|
||||
text: I18n.tr("Security key mode", "lock screen U2F security key mode setting")
|
||||
description: I18n.tr("'Alternative' lets the key unlock on its own. 'Second factor' requires password or fingerprint first, then the key.", "lock screen U2F security key mode setting")
|
||||
visible: SettingsData.enableU2f
|
||||
options: [I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method"), I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint")]
|
||||
currentValue: SettingsData.u2fMode === "and" ? I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint") : I18n.tr("Alternative (OR)", "U2F mode option: key works as standalone unlock method")
|
||||
onValueChanged: value => {
|
||||
if (value === I18n.tr("Second Factor (AND)", "U2F mode option: key required after password or fingerprint"))
|
||||
SettingsData.set("u2fMode", "and");
|
||||
else
|
||||
SettingsData.set("u2fMode", "or");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
@@ -594,7 +720,7 @@ Item {
|
||||
SettingsCard {
|
||||
width: parent.width
|
||||
iconName: "monitor"
|
||||
title: I18n.tr("Lock Screen Display")
|
||||
title: I18n.tr("Display Assignment")
|
||||
settingKey: "lockDisplay"
|
||||
|
||||
StyledText {
|
||||
|
||||
@@ -300,6 +300,15 @@ Item {
|
||||
onToggled: checked => SettingsData.set("notificationCompactMode", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "notificationForegroundLayers"
|
||||
tags: ["notification", "foreground", "layers", "surface", "blur", "glass", "contrast", "cards"]
|
||||
text: I18n.tr("Foreground Layers")
|
||||
description: I18n.tr("Show foreground surfaces on notification cards")
|
||||
checked: SettingsData.notificationForegroundLayers ?? true
|
||||
onToggled: checked => SettingsData.set("notificationForegroundLayers", checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "notificationShowTimeoutBar"
|
||||
tags: ["notification", "timeout", "progress", "bar", "timer", "countdown"]
|
||||
|
||||
@@ -24,6 +24,8 @@ Item {
|
||||
property string matugenPreviewRequestKey: ""
|
||||
property var installedRegistryThemes: []
|
||||
property var templateDetection: []
|
||||
readonly property var neovimDarkBaseThemes: ["aquarium", "ashes", "aylin", "ayu_dark", "bearded-arc", "carbonfox", "catppuccin", "chadracula", "chadracula-evondev", "chadtain", "chocolate", "darcula-dark", "dark_horizon", "decay", "default-dark", "doomchad", "eldritch", "embark", "everblush", "everforest", "falcon", "flexoki", "flouromachine", "gatekeeper", "github_dark", "gruvbox", "gruvchad", "hiberbee", "horizon", "jabuti", "jellybeans", "kanagawa", "kanagawa-dragon", "material-darker", "material-deep-ocean", "melange", "midnight_breeze", "mito-laser", "monekai", "monochrome", "mountain", "neofusion", "nightfox", "nightlamp", "nightowl", "nord", "obsidian-ember", "oceanic-next", "onedark", "onenord", "oxocarbon", "palenight", "pastelDark", "pastelbeans", "penumbra_dark", "poimandres", "radium", "rosepine", "rxyhn", "scaryforest", "seoul256_dark", "solarized_dark", "solarized_osaka", "starlight", "sweetpastel", "tokyodark", "tokyonight", "tomorrow_night", "tundra", "vesper", "vscode_dark", "wombat", "yoru", "zenburn"]
|
||||
readonly property var neovimLightBaseThemes: ["ayu_light", "blossom_light", "catppuccin-latte", "default-light", "everforest_light", "flex-light", "flexoki-light", "github_light", "gruvbox_light", "material-lighter", "nano-light", "oceanic-light", "one_light", "onenord_light", "penumbra_light", "rosepine-dawn", "seoul256_light", "solarized_light", "sunrise_breeze", "vscode_light"]
|
||||
readonly property var matugenSchemeColorMap: {
|
||||
const map = {};
|
||||
const mode = SessionData.isLightMode ? "light" : "dark";
|
||||
@@ -1734,16 +1736,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
tags: ["foreground", "layers", "contrast", "surface", "blur", "glass", "frosted"]
|
||||
settingKey: "blurForegroundLayers"
|
||||
text: I18n.tr("Foreground Layers")
|
||||
description: I18n.tr("Show foreground surfaces on panels for stronger contrast")
|
||||
checked: SettingsData.blurForegroundLayers ?? true
|
||||
onToggled: checked => SettingsData.set("blurForegroundLayers", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tab: "theme"
|
||||
tags: ["surface", "popup", "transparency", "opacity", "modal"]
|
||||
@@ -1759,12 +1751,47 @@ Item {
|
||||
onSliderValueChanged: newValue => SettingsData.set("popupTransparency", newValue / 100)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
tags: ["foreground", "layers", "contrast", "surface", "blur", "glass", "frosted"]
|
||||
settingKey: "blurForegroundLayers"
|
||||
text: I18n.tr("Foreground Layers")
|
||||
description: I18n.tr("Show foreground surfaces on panels for stronger contrast")
|
||||
checked: SettingsData.blurForegroundLayers ?? true
|
||||
onToggled: checked => SettingsData.set("blurForegroundLayers", checked)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tab: "theme"
|
||||
tags: ["foreground", "layers", "outline", "border", "cards", "widgets", "notifications", "control center"]
|
||||
settingKey: "blurLayerOutlineOpacity"
|
||||
text: I18n.tr("Layer Outline Opacity")
|
||||
description: I18n.tr("Controls outlines around foreground cards, pills, and notification cards")
|
||||
value: Math.round((SettingsData.blurLayerOutlineOpacity ?? 0.12) * 100)
|
||||
minimum: 0
|
||||
maximum: 40
|
||||
unit: "%"
|
||||
defaultValue: 12
|
||||
onSliderValueChanged: newValue => SettingsData.set("blurLayerOutlineOpacity", newValue / 100)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
tags: ["surface", "popup", "modal", "border", "outline", "edge"]
|
||||
settingKey: "blurBorderEnabled"
|
||||
text: I18n.tr("Surface Border Outline")
|
||||
description: I18n.tr("Outline around shell surfaces")
|
||||
checked: SettingsData.blurBorderEnabled ?? true
|
||||
onToggled: checked => SettingsData.set("blurBorderEnabled", checked)
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
tab: "theme"
|
||||
tags: ["surface", "popup", "modal", "border", "outline", "edge"]
|
||||
settingKey: "blurBorderColor"
|
||||
text: I18n.tr("Surface Border Color")
|
||||
description: I18n.tr("Border color around popouts, modals, and other shell surfaces")
|
||||
visible: SettingsData.blurBorderEnabled ?? true
|
||||
options: [I18n.tr("Outline", "surface border color"), I18n.tr("Primary", "surface border color"), I18n.tr("Secondary", "surface border color"), I18n.tr("Text Color", "surface border color"), I18n.tr("Custom", "surface border color")]
|
||||
optionColorMap: ({
|
||||
[I18n.tr("Outline", "surface border color")]: Theme.outline,
|
||||
@@ -1809,6 +1836,7 @@ Item {
|
||||
settingKey: "blurBorderOpacity"
|
||||
text: I18n.tr("Surface Border Opacity")
|
||||
description: I18n.tr("Controls the outline of popouts, modals, and other shell surfaces")
|
||||
visible: SettingsData.blurBorderEnabled ?? true
|
||||
value: Math.round((SettingsData.blurBorderOpacity ?? 0.35) * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
@@ -1817,20 +1845,6 @@ Item {
|
||||
onSliderValueChanged: newValue => SettingsData.set("blurBorderOpacity", newValue / 100)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tab: "theme"
|
||||
tags: ["foreground", "layers", "outline", "border", "cards", "widgets", "notifications", "control center"]
|
||||
settingKey: "blurLayerOutlineOpacity"
|
||||
text: I18n.tr("Layer Outline Opacity")
|
||||
description: I18n.tr("Controls outlines around foreground cards, pills, and notification cards")
|
||||
value: Math.round((SettingsData.blurLayerOutlineOpacity ?? 0.12) * 100)
|
||||
minimum: 0
|
||||
maximum: 40
|
||||
unit: "%"
|
||||
defaultValue: 12
|
||||
onSliderValueChanged: newValue => SettingsData.set("blurLayerOutlineOpacity", newValue / 100)
|
||||
}
|
||||
|
||||
SettingsSliderRow {
|
||||
tab: "theme"
|
||||
tags: ["corner", "radius", "rounded", "square"]
|
||||
@@ -2104,32 +2118,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
tab: "theme"
|
||||
tags: ["modal", "darken", "background", "overlay"]
|
||||
title: I18n.tr("Modal Background")
|
||||
settingKey: "modalBackground"
|
||||
iconName: "layers"
|
||||
|
||||
SettingsControlledByFrame {
|
||||
visible: themeColorsTab.frameModeActive
|
||||
parentModal: themeColorsTab.parentModal
|
||||
settingLabel: I18n.tr("Darken Modal Background")
|
||||
reason: I18n.tr("Disabled by Frame Mode")
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
tab: "theme"
|
||||
tags: ["modal", "darken", "background", "overlay"]
|
||||
settingKey: "modalDarkenBackground"
|
||||
text: I18n.tr("Darken Modal Background")
|
||||
description: I18n.tr("Show darkened overlay behind modal dialogs")
|
||||
visible: !themeColorsTab.frameModeActive
|
||||
checked: SettingsData.modalDarkenBackground
|
||||
onToggled: checked => SettingsData.set("modalDarkenBackground", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
tab: "theme"
|
||||
tags: ["applications", "portal", "dark", "terminal"]
|
||||
@@ -2680,7 +2668,7 @@ Item {
|
||||
description: "Base to derive dark theme from"
|
||||
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
|
||||
currentValue: SettingsData.matugenTemplateNeovimSettings?.dark?.baseTheme ?? "github_dark"
|
||||
options: ["aquarium", "ashes", "aylin", "ayu_dark", "bearded-arc", "carbonfox", "catppuccin", "chadracula", "chadracula-evondev", "chadtain", "chocolate", "darcula-dark", "dark_horizon", "decay", "default-dark", "doomchad", "eldritch", "embark", "everblush", "everforest", "falcon", "flexoki", "flouromachine", "gatekeeper", "github_dark", "gruvbox", "gruvchad", "hiberbee", "horizon", "jabuti", "jellybeans", "kanagawa", "kanagawa-dragon", "material-darker", "material-deep-ocean", "melange", "midnight_breeze", "mito-laser", "monekai", "monochrome", "mountain", "neofusion", "nightfox", "nightlamp", "nightowl", "nord", "obsidian-ember", "oceanic-next", "onedark", "onenord", "oxocarbon", "palenight", "pastelDark", "pastelbeans", "penumbra_dark", "poimandres", "radium", "rosepine", "rxyhn", "scaryforest", "seoul256_dark", "solarized_dark", "solarized_osaka", "starlight", "sweetpastel", "tokyodark", "tokyonight", "tomorrow_night", "tundra", "vesper", "vscode_dark", "wombat", "yoru", "zenburn"]
|
||||
options: themeColorsTab.neovimDarkBaseThemes.concat(themeColorsTab.neovimLightBaseThemes)
|
||||
enableFuzzySearch: true
|
||||
onValueChanged: value => {
|
||||
const settings = SettingsData.matugenTemplateNeovimSettings;
|
||||
@@ -2697,7 +2685,7 @@ Item {
|
||||
description: "Base to derive light theme from"
|
||||
visible: neovimThemeToggle.visible && neovimThemeToggle.checked
|
||||
currentValue: SettingsData.matugenTemplateNeovimSettings?.light?.baseTheme ?? "github_light"
|
||||
options: ["ayu_light", "blossom_light", "catppuccin-latte", "default-light", "everforest_light", "flex-light", "flexoki-light", "github_light", "gruvbox_light", "material-lighter", "nano-light", "oceanic-light", "one_light", "onenord_light", "penumbra_light", "rosepine-dawn", "seoul256_light", "solarized_light", "sunrise_breeze", "vscode_light"]
|
||||
options: themeColorsTab.neovimLightBaseThemes.concat(themeColorsTab.neovimDarkBaseThemes)
|
||||
enableFuzzySearch: true
|
||||
onValueChanged: value => {
|
||||
const settings = SettingsData.matugenTemplateNeovimSettings;
|
||||
|
||||
@@ -1199,16 +1199,18 @@ Item {
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
}
|
||||
|
||||
DankButtonGroup {
|
||||
DankFilterChips {
|
||||
id: transitionGroup
|
||||
width: parent.width - Theme.spacingM * 2
|
||||
selectionMode: "multi"
|
||||
model: SessionData.availableWallpaperTransitions.filter(t => t !== "none")
|
||||
initialSelection: SessionData.includedTransitions
|
||||
currentSelection: SessionData.includedTransitions
|
||||
multiSelect: true
|
||||
model: SessionData.availableWallpaperTransitions.filter(t => t !== "none").map(t => ({
|
||||
"value": t,
|
||||
"label": t.replace(/\b\w/g, c => c.toUpperCase())
|
||||
}))
|
||||
selectedValues: SessionData.includedTransitions
|
||||
|
||||
onSelectionChanged: (index, selected) => {
|
||||
const transition = model[index];
|
||||
onSelectionToggled: (index, selected) => {
|
||||
const transition = model[index].value;
|
||||
let newIncluded = SessionData.includedTransitions.slice();
|
||||
|
||||
if (selected && !newIncluded.includes(transition)) {
|
||||
|
||||
@@ -557,20 +557,19 @@ Item {
|
||||
return sectionId === "left" ? leftSection : sectionId === "center" ? centerSection : sectionId === "right" ? rightSection : null;
|
||||
}
|
||||
|
||||
// Id-based reorder; rebuilds from authoritative objects so every prop (incl. hideWhenIdle) survives
|
||||
// Id-based reorder; rebuilds from authoritative objects so every prop (incl. hideWhenIdle) survives.
|
||||
// Consumes one entry per occurrence so duplicate ids (e.g. two spacers) don't collapse, and
|
||||
// appends unconsumed entries so nothing is silently dropped from the config array.
|
||||
function reorderSection(sectionId, orderedIds) {
|
||||
var current = getWidgetsForSection(sectionId);
|
||||
var byId = {};
|
||||
current.forEach(w => {
|
||||
var id = (typeof w === "string" ? w : w.id);
|
||||
byId[id] = w;
|
||||
});
|
||||
var remaining = getWidgetsForSection(sectionId).slice();
|
||||
var reordered = [];
|
||||
orderedIds.forEach(id => {
|
||||
if (byId[id] !== undefined)
|
||||
reordered.push(byId[id]);
|
||||
var idx = remaining.findIndex(w => (typeof w === "string" ? w : w.id) === id);
|
||||
if (idx < 0)
|
||||
return;
|
||||
reordered.push(remaining.splice(idx, 1)[0]);
|
||||
});
|
||||
setWidgetsForSection(sectionId, reordered);
|
||||
setWidgetsForSection(sectionId, reordered.concat(remaining));
|
||||
}
|
||||
|
||||
// Move a widget across sections (or within); committed as one atomic bar-config save
|
||||
@@ -979,8 +978,16 @@ Item {
|
||||
var isString = typeof widget === "string";
|
||||
var widgetId = isString ? widget : widget.id;
|
||||
var widgetDef = baseWidgetDefinitions.find(w => w.id === widgetId);
|
||||
if (!widgetDef)
|
||||
return;
|
||||
if (!widgetDef) {
|
||||
// Skipping entries would desync row indices from the config array (issue #2844)
|
||||
widgetDef = {
|
||||
"id": widgetId,
|
||||
"text": widgetId || I18n.tr("Unknown"),
|
||||
"description": "",
|
||||
"icon": "extension",
|
||||
"warning": I18n.tr("Unavailable")
|
||||
};
|
||||
}
|
||||
|
||||
var item = Object.assign({}, widgetDef);
|
||||
item.enabled = isString ? true : widget.enabled;
|
||||
|
||||
@@ -847,7 +847,7 @@ EOFCONFIG
|
||||
|
||||
const maxVol = root.sinkMaxVolume;
|
||||
const clampedVolume = Math.max(0, Math.min(maxVol, percentage));
|
||||
Quickshell.execDetached(["wpctl", "set-volume", "-l", String(maxVol / 100), "@DEFAULT_AUDIO_SINK@", String(clampedVolume / 100)]);
|
||||
root.sink.audio.volume = clampedVolume / 100;
|
||||
return `Volume set to ${clampedVolume}%`;
|
||||
}
|
||||
|
||||
@@ -857,14 +857,16 @@ EOFCONFIG
|
||||
}
|
||||
|
||||
function adjustDefaultSinkVolume(step, direction) {
|
||||
const audio = root.sink.audio;
|
||||
const maxVol = root.sinkMaxVolume;
|
||||
const stepValue = outputVolumeStep(step);
|
||||
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||
const currentVolume = Math.round(audio.volume * 100);
|
||||
const newVolume = Math.max(0, Math.min(maxVol, currentVolume + direction * stepValue));
|
||||
const suffix = direction > 0 ? "+" : "-";
|
||||
|
||||
Quickshell.execDetached(["wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "0"]);
|
||||
Quickshell.execDetached(["wpctl", "set-volume", "-l", String(maxVol / 100), "@DEFAULT_AUDIO_SINK@", `${stepValue}%${suffix}`]);
|
||||
if (audio.muted)
|
||||
audio.muted = false;
|
||||
|
||||
audio.volume = newVolume / 100;
|
||||
return newVolume;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ Singleton {
|
||||
|
||||
// These settings predate non-blurred surface borders, so keep their keys for compatibility.
|
||||
readonly property color borderColor: {
|
||||
if (!(SettingsData.blurBorderEnabled ?? true))
|
||||
return "transparent";
|
||||
const opacity = SettingsData.blurBorderOpacity ?? 0.35;
|
||||
switch (SettingsData.blurBorderColor ?? "outline") {
|
||||
case "primary":
|
||||
@@ -26,12 +28,12 @@ Singleton {
|
||||
case "surfaceText":
|
||||
return Theme.withAlpha(Theme.surfaceText, opacity);
|
||||
case "custom":
|
||||
return Theme.withAlpha(SettingsData.blurBorderCustomColor ?? "#ffffff", opacity);
|
||||
return Theme.withAlpha(Qt.color(SettingsData.blurBorderCustomColor ?? "#ffffff"), opacity);
|
||||
default:
|
||||
return Theme.withAlpha(Theme.outline, opacity);
|
||||
}
|
||||
}
|
||||
readonly property int borderWidth: 1
|
||||
readonly property int borderWidth: (SettingsData.blurBorderEnabled ?? true) ? 1 : 0
|
||||
|
||||
function hoverColor(baseColor, hoverAlpha) {
|
||||
if (!enabled)
|
||||
|
||||
@@ -511,7 +511,7 @@ Singleton {
|
||||
return MangoService.filterCurrentDisplay(toplevels, screenName);
|
||||
if (isHyprland)
|
||||
return filterHyprlandCurrentDisplaySafe(toplevels, screenName);
|
||||
return toplevels;
|
||||
return toplevels.filter(t => _toplevelOnScreen(t, screenName));
|
||||
}
|
||||
|
||||
function _screenName(screenOrName) {
|
||||
|
||||
@@ -67,6 +67,7 @@ Singleton {
|
||||
property var lockComponent: null
|
||||
property bool monitorsOff: false
|
||||
property bool isShellLocked: false
|
||||
property bool lockPowerOffRequested: false
|
||||
|
||||
function reapplyDpmsIfNeeded() {
|
||||
if (monitorsOff)
|
||||
@@ -79,6 +80,8 @@ Singleton {
|
||||
respectInhibitors: root.respectInhibitors
|
||||
enabled: false
|
||||
onIsIdleChanged: {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (isIdle) {
|
||||
if (SettingsData.fadeToDpmsEnabled) {
|
||||
root.fadeToDpmsRequested();
|
||||
@@ -100,6 +103,8 @@ Singleton {
|
||||
respectInhibitors: root.respectInhibitors
|
||||
enabled: false
|
||||
onIsIdleChanged: {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (isIdle) {
|
||||
root.requestMonitorOff();
|
||||
} else {
|
||||
@@ -114,6 +119,8 @@ Singleton {
|
||||
respectInhibitors: root.respectInhibitors
|
||||
enabled: false
|
||||
onIsIdleChanged: {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (isIdle) {
|
||||
if (SettingsData.fadeToLockEnabled) {
|
||||
root.fadeToLockRequested();
|
||||
@@ -134,6 +141,8 @@ Singleton {
|
||||
respectInhibitors: root.respectInhibitors
|
||||
enabled: false
|
||||
onIsIdleChanged: {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (isIdle)
|
||||
root.requestSuspend();
|
||||
}
|
||||
@@ -146,8 +155,10 @@ Singleton {
|
||||
id: lockWakeMonitor
|
||||
timeout: 1
|
||||
respectInhibitors: false
|
||||
enabled: root.enabled && root.isShellLocked && root.monitorsOff && SettingsData.lockScreenPowerOffMonitorsOnLock
|
||||
enabled: root.enabled && root.isShellLocked && root.monitorsOff && (SettingsData.lockScreenPowerOffMonitorsOnLock || root.lockPowerOffRequested)
|
||||
onIsIdleChanged: {
|
||||
if (!enabled)
|
||||
return;
|
||||
if (!isIdle && root.monitorsOff)
|
||||
root.requestMonitorOn();
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ Singleton {
|
||||
if (now - root._lastWatchedReloadAt < 700)
|
||||
return;
|
||||
root._lastWatchedReloadAt = now;
|
||||
root.reloadConfig(true, false);
|
||||
root.reloadConfig(false, false);
|
||||
}
|
||||
|
||||
function reloadConfig(showToast, suppressWatch) {
|
||||
|
||||
@@ -19,7 +19,8 @@ Singleton {
|
||||
const desktopEntry = ("desktopEntry" in p && p.desktopEntry) ? String(p.desktopEntry).toLowerCase() : "";
|
||||
return !excluded.some(ex => {
|
||||
const exLower = String(ex).toLowerCase().trim();
|
||||
if (!exLower) return false;
|
||||
if (!exLower)
|
||||
return false;
|
||||
|
||||
// 1. Substring match
|
||||
if (identity.includes(exLower) || desktopEntry.includes(exLower))
|
||||
@@ -43,43 +44,114 @@ Singleton {
|
||||
}
|
||||
property MprisPlayer activePlayer: null
|
||||
property real activePlayerStableLength: 0
|
||||
// Chromium can report blank metadata between tracks
|
||||
property string stableTitle: ""
|
||||
property string stableArtist: ""
|
||||
|
||||
Connections {
|
||||
target: root.activePlayer
|
||||
function onTrackTitleChanged() {
|
||||
root.activePlayerStableLength = (root.activePlayer && root.activePlayer.lengthSupported && root.activePlayer.length > 1) ? root.activePlayer.length : 0;
|
||||
root._syncStableMeta();
|
||||
root._checkIdle();
|
||||
}
|
||||
function onTrackArtistChanged() {
|
||||
root._syncStableMeta();
|
||||
root._checkIdle();
|
||||
}
|
||||
function onLengthChanged() {
|
||||
if (root.activePlayer && root.activePlayer.lengthSupported && root.activePlayer.length > 1) {
|
||||
root.activePlayerStableLength = root.activePlayer.length;
|
||||
}
|
||||
}
|
||||
function onPlaybackStateChanged() {
|
||||
root._syncStableMeta();
|
||||
root._checkIdle();
|
||||
}
|
||||
}
|
||||
|
||||
onActivePlayerChanged: {
|
||||
activePlayerStableLength = (activePlayer && activePlayer.lengthSupported && activePlayer.length > 1) ? activePlayer.length : 0;
|
||||
stableTitle = activePlayer?.trackTitle || "";
|
||||
stableArtist = activePlayer?.trackArtist || "";
|
||||
_checkIdle();
|
||||
}
|
||||
|
||||
function _syncStableMeta(): void {
|
||||
const p = activePlayer;
|
||||
if (!p) {
|
||||
stableTitle = "";
|
||||
stableArtist = "";
|
||||
return;
|
||||
}
|
||||
if (isFirefoxYoutubeHoverPreview(p))
|
||||
return;
|
||||
if (p.trackTitle)
|
||||
stableTitle = p.trackTitle;
|
||||
if (p.trackArtist)
|
||||
stableArtist = p.trackArtist;
|
||||
}
|
||||
|
||||
// Chromium reports stopped media w/blank metadata, resolve by checking idle status
|
||||
Timer {
|
||||
id: _idleGraceTimer
|
||||
interval: 1223
|
||||
onTriggered: {
|
||||
if (!root.isIdle(root.activePlayer))
|
||||
return;
|
||||
root.stableTitle = "";
|
||||
root.stableArtist = "";
|
||||
root._resolveActivePlayer();
|
||||
}
|
||||
}
|
||||
|
||||
function _checkIdle(): void {
|
||||
if (!isIdle(activePlayer)) {
|
||||
_idleGraceTimer.stop();
|
||||
return;
|
||||
}
|
||||
if (!_idleGraceTimer.running)
|
||||
_idleGraceTimer.start();
|
||||
}
|
||||
|
||||
onAvailablePlayersChanged: _resolveActivePlayer()
|
||||
Component.onCompleted: _resolveActivePlayer()
|
||||
|
||||
Instantiator {
|
||||
model: root.availablePlayers
|
||||
delegate: Connections {
|
||||
required property MprisPlayer modelData
|
||||
target: modelData
|
||||
function onIsPlayingChanged() {
|
||||
if (modelData.isPlaying)
|
||||
root._resolveActivePlayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isIdle(player: MprisPlayer): bool {
|
||||
return player
|
||||
&& player.playbackState === MprisPlaybackState.Stopped
|
||||
&& !player.trackTitle
|
||||
&& !player.trackArtist;
|
||||
return player && player.playbackState === MprisPlaybackState.Stopped && !player.trackTitle && !player.trackArtist;
|
||||
}
|
||||
|
||||
function _resolveActivePlayer(): void {
|
||||
// Keep the selected player stable across transient metadata changes.
|
||||
if (activePlayer && availablePlayers.indexOf(activePlayer) >= 0)
|
||||
return;
|
||||
// A playing player always wins; otherwise keep the selection stable w/idle
|
||||
const playing = availablePlayers.find(p => p.isPlaying);
|
||||
if (playing) {
|
||||
activePlayer = playing;
|
||||
_persistIdentity(playing.identity);
|
||||
if (activePlayer !== playing) {
|
||||
activePlayer = playing;
|
||||
_persistIdentity(playing.identity);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (activePlayer && availablePlayers.indexOf(activePlayer) >= 0 && (!isIdle(activePlayer) || _idleGraceTimer.running))
|
||||
return;
|
||||
if (activePlayer && availablePlayers.indexOf(activePlayer) < 0) {
|
||||
const successor = availablePlayers.find(p => p.identity === activePlayer.identity);
|
||||
if (successor) {
|
||||
activePlayer = successor;
|
||||
return;
|
||||
}
|
||||
}
|
||||
const savedId = SessionData.lastPlayerIdentity;
|
||||
if (savedId) {
|
||||
const match = availablePlayers.find(p => p.identity === savedId);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import Quickshell.Services.Polkit
|
||||
|
||||
PolkitAgent {}
|
||||
@@ -3,7 +3,6 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Polkit
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
@@ -12,10 +11,13 @@ Singleton {
|
||||
readonly property bool disablePolkitIntegration: Quickshell.env("DMS_DISABLE_POLKIT") === "1"
|
||||
|
||||
readonly property bool polkitAvailable: !disablePolkitIntegration
|
||||
readonly property alias agent: polkitAgentInstance
|
||||
readonly property var agent: polkitAgentLoader.item
|
||||
|
||||
PolkitAgent {
|
||||
id: polkitAgentInstance
|
||||
Loader {
|
||||
id: polkitAgentLoader
|
||||
active: root.polkitAvailable
|
||||
asynchronous: false
|
||||
source: "PolkitAgentInstance.qml"
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
@@ -3,7 +3,6 @@ pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
@@ -34,6 +33,18 @@ Singleton {
|
||||
|
||||
readonly property int updateCount: availableUpdates.length
|
||||
readonly property bool helperAvailable: sysupdateAvailable && backends.length > 0
|
||||
readonly property bool useCustomCommand: SettingsData.updaterUseCustomCommand && (SettingsData.updaterCustomCommand || "").trim().length > 0
|
||||
|
||||
// Dont allow partial updates on arch, if they wanna break their system they can do it outside of DMS:
|
||||
// https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported
|
||||
// AUR/Flatpak packages stay ignorable — holding those cannot break the repo dependency graph.
|
||||
readonly property bool systemHoldsAllowed: !["pacman", "paru", "yay"].includes(pkgManager)
|
||||
|
||||
function canIgnorePackage(pkg) {
|
||||
if (!pkg)
|
||||
return false;
|
||||
return systemHoldsAllowed || pkg.repo !== "system";
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
@@ -108,9 +119,11 @@ Singleton {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
backends = data.backends || [];
|
||||
const systemBackend = backends.find(b => b.repo === "system" || b.repo === "ostree");
|
||||
pkgManager = systemBackend ? systemBackend.id : (backends.length > 0 ? backends[0].id : "");
|
||||
_rawUpdates = data.packages || [];
|
||||
availableUpdates = _filterUpdates(_rawUpdates);
|
||||
backends = data.backends || [];
|
||||
distribution = data.distro || "";
|
||||
distributionPretty = data.distroPretty || "";
|
||||
distributionSupported = (backends.length > 0);
|
||||
@@ -145,13 +158,6 @@ Singleton {
|
||||
errorCode = "";
|
||||
errorHint = "";
|
||||
}
|
||||
|
||||
if (backends.length > 0) {
|
||||
const sys = backends.find(b => b.repo === "system" || b.repo === "ostree");
|
||||
pkgManager = sys ? sys.id : backends[0].id;
|
||||
} else {
|
||||
pkgManager = "";
|
||||
}
|
||||
}
|
||||
|
||||
function _filterUpdates(pkgs) {
|
||||
@@ -159,6 +165,8 @@ Singleton {
|
||||
return (pkgs || []).filter(p => {
|
||||
if (!SettingsData.updaterAllowAUR && p.repo === "aur")
|
||||
return false;
|
||||
if (!canIgnorePackage(p))
|
||||
return true;
|
||||
return ignored.indexOf(p.name) === -1;
|
||||
});
|
||||
}
|
||||
@@ -177,17 +185,27 @@ Singleton {
|
||||
SettingsData.set("updaterIgnoredPackages", list);
|
||||
}
|
||||
|
||||
function unignorePackage(name) {
|
||||
if (!name)
|
||||
return;
|
||||
const list = (SettingsData.updaterIgnoredPackages || []).filter(p => p !== name);
|
||||
SettingsData.set("updaterIgnoredPackages", list);
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
DMSService.sysupdateRefresh(false, null);
|
||||
}
|
||||
|
||||
function runUpdates(opts) {
|
||||
const params = opts || {};
|
||||
if (SettingsData.updaterUseCustomCommand && SettingsData.updaterCustomCommand.length > 0) {
|
||||
_runCustomTerminalCommand();
|
||||
return;
|
||||
}
|
||||
params.ignored = SettingsData.updaterIgnoredPackages || [];
|
||||
if (useCustomCommand) {
|
||||
params.customCommand = SettingsData.updaterCustomCommand.trim();
|
||||
const termArgs = (SettingsData.updaterTerminalAdditionalParams || "").trim();
|
||||
if (termArgs.length > 0) {
|
||||
params.terminalArgs = termArgs.split(/\s+/);
|
||||
}
|
||||
}
|
||||
DMSService.sysupdateUpgrade(params, null);
|
||||
}
|
||||
|
||||
@@ -199,30 +217,6 @@ Singleton {
|
||||
DMSService.sysupdateSetInterval(seconds, null);
|
||||
}
|
||||
|
||||
function _runCustomTerminalCommand() {
|
||||
const terminal = SessionData.resolveTerminal();
|
||||
if (!terminal || terminal.length === 0) {
|
||||
ToastService.showError(I18n.tr("No terminal configured"), I18n.tr("Pick a terminal in Settings → Launcher (or set $TERMINAL)."));
|
||||
return;
|
||||
}
|
||||
const updateCommand = `${SettingsData.updaterCustomCommand} && echo -n "Updates complete! " ; echo "Press Enter to close..." && read`;
|
||||
const termClass = SettingsData.updaterTerminalAdditionalParams || "";
|
||||
var argv = [terminal];
|
||||
if (termClass.length > 0) {
|
||||
argv = argv.concat(termClass.split(" "));
|
||||
}
|
||||
argv.push("-e");
|
||||
argv.push("sh");
|
||||
argv.push("-c");
|
||||
argv.push(updateCommand);
|
||||
customRunner.command = argv;
|
||||
customRunner.running = true;
|
||||
}
|
||||
|
||||
Process {
|
||||
id: customRunner
|
||||
}
|
||||
|
||||
property bool _startupCheckDone: false
|
||||
|
||||
function _maybeStartupCheck() {
|
||||
@@ -262,5 +256,4 @@ Singleton {
|
||||
}
|
||||
DMSService.sysupdateRelease(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,19 +29,17 @@ Singleton {
|
||||
function getArtworkUrl(player) {
|
||||
if (!player) return "";
|
||||
|
||||
// 1. If native trackArtUrl is present and valid
|
||||
let artUrl = player.trackArtUrl || "";
|
||||
if (artUrl !== "") {
|
||||
return artUrl;
|
||||
}
|
||||
|
||||
// 2. Fallback to raw metadata mpris:artUrl if present
|
||||
if (player.metadata && player.metadata["mpris:artUrl"]) {
|
||||
artUrl = player.metadata["mpris:artUrl"].toString();
|
||||
if (artUrl !== "") return artUrl;
|
||||
}
|
||||
|
||||
// 3. Fallback for YouTube from xesam:url
|
||||
// YouTube publishes no artUrl; derive the thumbnail from the video id.
|
||||
if (player.metadata && player.metadata["xesam:url"]) {
|
||||
const url = player.metadata["xesam:url"].toString();
|
||||
if (url.includes("youtube.com") || url.includes("youtu.be")) {
|
||||
@@ -71,9 +69,11 @@ Singleton {
|
||||
return;
|
||||
}
|
||||
_clearDebounce.stop();
|
||||
if (url === _lastArtUrl)
|
||||
// Same url must re-issue under a new serial; the bump cancelled the in-flight load.
|
||||
if (url === _lastArtUrl && requestSerial === _lastIssuedSerial)
|
||||
return;
|
||||
_lastArtUrl = url;
|
||||
_lastIssuedSerial = requestSerial;
|
||||
|
||||
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||
loading = true;
|
||||
@@ -83,7 +83,6 @@ Singleton {
|
||||
const filePath = cacheDir + "/remote_" + hash;
|
||||
const localFileUrl = "file://" + filePath;
|
||||
|
||||
// 1. First, check if the file already exists locally
|
||||
Proc.runCommand(null, ["test", "-f", filePath], (output, exitCode) => {
|
||||
if (_lastArtUrl !== targetUrl || _requestSerial !== requestSerial)
|
||||
return;
|
||||
@@ -94,7 +93,7 @@ Singleton {
|
||||
} else {
|
||||
const dlCmd = "mkdir -p \"$(dirname \"$1\")\" && curl -f -s -L -o \"$1\" \"$2\" && mv \"$1\" \"$3\" || { rm -f \"$1\"; exit 1; }";
|
||||
|
||||
// 2. Check if this is a YouTube URL to do high quality 16:9 fallback
|
||||
// YouTube: try the 16:9 maxres thumbnail before falling back.
|
||||
if (targetUrl.includes("img.youtube.com/vi/")) {
|
||||
const videoId = targetUrl.split("/vi/")[1].split("/")[0];
|
||||
const maxresUrl = "https://img.youtube.com/vi/" + videoId + "/maxresdefault.jpg";
|
||||
@@ -119,7 +118,6 @@ Singleton {
|
||||
}
|
||||
}, 50, 15000);
|
||||
} else {
|
||||
// Standard curl download for other remote URLs (e.g. SoundCloud)
|
||||
const tmpPath = filePath + ".tmp";
|
||||
Proc.runCommand(null, ["sh", "-c", dlCmd, "sh", tmpPath, targetUrl, filePath], (dlOutput, dlExitCode) => {
|
||||
if (_lastArtUrl !== targetUrl || _requestSerial !== requestSerial)
|
||||
@@ -168,6 +166,7 @@ Singleton {
|
||||
property string _pendingArtKey: ""
|
||||
property string _committedSrcUrl: ""
|
||||
property int _requestSerial: 0
|
||||
property int _lastIssuedSerial: -1
|
||||
|
||||
onActivePlayerChanged: _updateArtUrl()
|
||||
|
||||
@@ -183,8 +182,8 @@ Singleton {
|
||||
const p = activePlayer;
|
||||
if (!p)
|
||||
return "";
|
||||
// Scope artwork ownership to the MPRIS object and track.
|
||||
const playerId = p.uniqueId || p.identity || "";
|
||||
// dbusName is constant per player; uniqueId is per-track and would churn the key.
|
||||
const playerId = p.dbusName || p.identity || "";
|
||||
const tid = p.metadata && p.metadata["mpris:trackid"] ? p.metadata["mpris:trackid"].toString() : "";
|
||||
return playerId + " " + tid + " " + (p.trackTitle || "") + " " + (p.trackArtist || "");
|
||||
}
|
||||
|
||||
@@ -116,12 +116,28 @@ Item {
|
||||
|
||||
property var hyprlandOverviewLoaderRef: hyprlandOverviewLoader
|
||||
|
||||
// Horizontal bars must claim their exclusive zones first, so vertical bars wait for every enabled horizontal bar to load
|
||||
readonly property int horizontalWanted: SettingsData.barConfigs.filter(c => (c.enabled ?? false) && c.position !== SettingsData.Position.Left && c.position !== SettingsData.Position.Right).length
|
||||
property int horizontalReady: 0
|
||||
|
||||
function recountHorizontalReady() {
|
||||
let ready = 0;
|
||||
for (let i = 0; i < count; i++) {
|
||||
const loader = itemAt(i);
|
||||
if (loader?.item && !loader.isVertical)
|
||||
ready++;
|
||||
}
|
||||
horizontalReady = ready;
|
||||
}
|
||||
|
||||
delegate: Loader {
|
||||
id: barLoader
|
||||
required property var modelData
|
||||
property var barConfig: SettingsData.barConfigs.find(cfg => cfg.id === modelData.id) || null
|
||||
active: root.barSurfacesLoaded && (barConfig?.enabled ?? false)
|
||||
readonly property bool isVertical: modelData.position === SettingsData.Position.Left || modelData.position === SettingsData.Position.Right
|
||||
active: root.barSurfacesLoaded && (barConfig?.enabled ?? false) && (!isVertical || dankBarRepeater.horizontalReady >= dankBarRepeater.horizontalWanted)
|
||||
asynchronous: false
|
||||
onItemChanged: dankBarRepeater.recountHorizontalReady()
|
||||
|
||||
sourceComponent: DankBar {
|
||||
barConfig: barLoader.barConfig
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v1.5.1
|
||||
v1.5.2
|
||||
|
||||
@@ -7,12 +7,15 @@ Flow {
|
||||
|
||||
property var model: []
|
||||
property int currentIndex: 0
|
||||
property bool multiSelect: false
|
||||
property var selectedValues: []
|
||||
property int chipHeight: 32
|
||||
property int chipPadding: Theme.spacingM
|
||||
property bool showCheck: true
|
||||
property bool showCounts: true
|
||||
|
||||
signal selectionChanged(int index)
|
||||
signal selectionToggled(int index, bool selected)
|
||||
|
||||
spacing: Theme.spacingS
|
||||
width: parent ? parent.width : 400
|
||||
@@ -25,7 +28,8 @@ Flow {
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
property bool selected: index === root.currentIndex
|
||||
property var value: typeof modelData === "string" ? modelData : (modelData.value !== undefined ? modelData.value : (modelData.label || ""))
|
||||
property bool selected: root.multiSelect ? root.selectedValues.includes(value) : (index === root.currentIndex)
|
||||
property bool hovered: mouseArea.containsMouse
|
||||
property bool pressed: mouseArea.pressed
|
||||
property string label: typeof modelData === "string" ? modelData : (modelData.label || "")
|
||||
@@ -99,6 +103,10 @@ Flow {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => chipRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: {
|
||||
if (root.multiSelect) {
|
||||
root.selectionToggled(chip.index, !chip.selected);
|
||||
return;
|
||||
}
|
||||
root.currentIndex = chip.index;
|
||||
root.selectionChanged(chip.index);
|
||||
}
|
||||
|
||||
@@ -174,8 +174,15 @@ Item {
|
||||
_pendingOpen = false;
|
||||
_pendingOpenTimer.stop();
|
||||
transientSurfaceTracker?.closeAll?.();
|
||||
if (impl.item)
|
||||
if (impl.item) {
|
||||
impl.item.close();
|
||||
return;
|
||||
}
|
||||
PopoutManager.hidePopout(root);
|
||||
if (!shouldBeVisible)
|
||||
return;
|
||||
shouldBeVisible = false;
|
||||
popoutClosed();
|
||||
}
|
||||
|
||||
function cancelHoverDismiss() {
|
||||
@@ -315,7 +322,8 @@ Item {
|
||||
it.hoverDismissEnabled = Qt.binding(() => root.hoverDismissEnabled);
|
||||
it.hoverDismissSuspended = Qt.binding(() => root.effectiveHoverDismissSuspended);
|
||||
|
||||
it.shouldBeVisible = root.shouldBeVisible;
|
||||
if (root.shouldBeVisible && !_pendingOpen)
|
||||
root.shouldBeVisible = false;
|
||||
if (root._primeContent && typeof it.primeContent === "function")
|
||||
it.primeContent();
|
||||
if (_pendingOpen)
|
||||
|
||||
@@ -923,6 +923,13 @@ Item {
|
||||
visible: false
|
||||
color: "transparent"
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible || !Qt.inputMethod)
|
||||
return;
|
||||
Qt.inputMethod.hide();
|
||||
Qt.inputMethod.reset();
|
||||
}
|
||||
|
||||
PopoutHoverDismiss {
|
||||
id: hoverDismissController
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -79,6 +79,9 @@ Item {
|
||||
"rightBar": 0
|
||||
})
|
||||
property var screen: null
|
||||
// Output the surface binds to; retargeted only in open() while hidden. A live
|
||||
// screen change on a mapped surface loses the popup blur on niri.
|
||||
property var surfaceScreen: null
|
||||
readonly property bool frameGapStandaloneActive: CompositorService.frameConfiguredForScreen(screen) && !CompositorService.usesConnectedFrameChromeForScreen(screen)
|
||||
readonly property bool fluidStandaloneActive: Theme.isDirectionalEffect
|
||||
readonly property bool backgroundDismissWindowRequired: backgroundInteractive
|
||||
@@ -133,8 +136,6 @@ Item {
|
||||
signal popoutClosed
|
||||
signal backgroundClicked
|
||||
|
||||
property var _lastOpenedScreen: null
|
||||
|
||||
property int effectiveBarPosition: 0
|
||||
property real effectiveBarBottomGap: 0
|
||||
readonly property string autoBarShadowDirection: {
|
||||
@@ -338,14 +339,14 @@ Item {
|
||||
_frozenMaskWidth = maskWidth;
|
||||
_frozenMaskHeight = maskHeight;
|
||||
|
||||
const screenChanged = _lastOpenedScreen !== null && _lastOpenedScreen !== screen;
|
||||
const screenChanged = surfaceScreen !== null && surfaceScreen !== screen;
|
||||
if (screenChanged) {
|
||||
// Hide on this tick so Qt actually tears down the wl_surface; the show
|
||||
// gets deferred below so the unmap is processed before the remap.
|
||||
// Unmap before retargeting so the surface is destroyed and recreated
|
||||
// on the new output rather than live-migrated.
|
||||
contentWindow.visible = false;
|
||||
backgroundWindow.visible = false;
|
||||
}
|
||||
_lastOpenedScreen = screen;
|
||||
surfaceScreen = screen;
|
||||
|
||||
if (contentContainer && !shouldBeVisible) {
|
||||
// Snap morph closed only on a fresh open; on screen-change re-open we stay at 1
|
||||
@@ -559,7 +560,7 @@ Item {
|
||||
|
||||
PanelWindow {
|
||||
id: backgroundWindow
|
||||
screen: root.screen
|
||||
screen: root.surfaceScreen
|
||||
visible: false
|
||||
color: "transparent"
|
||||
// Skip buffer updates when there's nothing to render. Briefly flipped
|
||||
@@ -625,11 +626,18 @@ Item {
|
||||
|
||||
PanelWindow {
|
||||
id: contentWindow
|
||||
screen: root.screen
|
||||
screen: root.surfaceScreen
|
||||
visible: false
|
||||
color: "transparent"
|
||||
readonly property bool closeVisualActive: root.shouldBeVisible || root.isClosing
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible || !Qt.inputMethod)
|
||||
return;
|
||||
Qt.inputMethod.hide();
|
||||
Qt.inputMethod.reset();
|
||||
}
|
||||
|
||||
PopoutHoverDismiss {
|
||||
id: hoverDismissController
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -174,7 +174,7 @@ PanelWindow {
|
||||
id: contentRect
|
||||
layer.enabled: Quickshell.env("DMS_DISABLE_LAYER") !== "true" && Quickshell.env("DMS_DISABLE_LAYER") !== "1"
|
||||
layer.smooth: false
|
||||
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
|
||||
layer.textureSize: Qt.size(0, 0)
|
||||
opacity: 1
|
||||
|
||||
readonly property color slideoutSurfaceColor: root.customTransparency >= 0 ? Theme.withAlpha(Theme.surfaceContainer, root.customTransparency) : Theme.popupLayerColor(Theme.surfaceContainer)
|
||||
|
||||
@@ -70,6 +70,10 @@ Item {
|
||||
iconImage.source = "file:///run/current-system/profile/share/icons/hicolor/scalable/apps/guix-icon.svg"
|
||||
return
|
||||
}
|
||||
if (logo === "zirconium") {
|
||||
iconImage.source = "file:///usr/share/zirconium/pixmaps/logo-z.svg"
|
||||
return
|
||||
}
|
||||
iconImage.source = Quickshell.iconPath(logo, true)
|
||||
}, 0)
|
||||
}, 0)
|
||||
|
||||
@@ -131,7 +131,6 @@
|
||||
@define-color content_view_bg @view_bg_color;
|
||||
@define-color text_view_bg @view_bg_color;
|
||||
* {
|
||||
padding: 0;
|
||||
-GtkToolButton-icon-spacing: 4;
|
||||
-GtkTextView-error-underline-color: @error_bg_color;
|
||||
-GtkScrolledWindow-scrollbar-spacing: 0;
|
||||
|
||||
@@ -44,6 +44,10 @@ if mode ~= nil then
|
||||
end
|
||||
end
|
||||
|
||||
if settings.terminalsAlwaysDark then
|
||||
vim.o.background = "dark"
|
||||
end
|
||||
|
||||
local current_file_path = debug.getinfo(1, "S").source:sub(2)
|
||||
local theme_base = deepGet(settings, { "matugenTemplateNeovimSettings", vim.o.background, "baseTheme" })
|
||||
or ("github_" .. vim.o.background)
|
||||
|
||||
@@ -2374,6 +2374,29 @@
|
||||
],
|
||||
"icon": "extension"
|
||||
},
|
||||
{
|
||||
"section": "modalDarkenBackground",
|
||||
"label": "Darken Modal Background",
|
||||
"tabIndex": 9,
|
||||
"category": "Launcher",
|
||||
"keywords": [
|
||||
"background",
|
||||
"behind",
|
||||
"dark mode",
|
||||
"darken",
|
||||
"darkened",
|
||||
"dialogs",
|
||||
"drawer",
|
||||
"launcher",
|
||||
"menu",
|
||||
"modal",
|
||||
"night",
|
||||
"overlay",
|
||||
"show",
|
||||
"start"
|
||||
],
|
||||
"description": "Show darkened overlay behind modal dialogs"
|
||||
},
|
||||
{
|
||||
"section": "launcherStyle",
|
||||
"label": "Default Launcher",
|
||||
@@ -2614,6 +2637,30 @@
|
||||
],
|
||||
"icon": "apps"
|
||||
},
|
||||
{
|
||||
"section": "modalBackground",
|
||||
"label": "Modal Background",
|
||||
"tabIndex": 9,
|
||||
"category": "Launcher",
|
||||
"keywords": [
|
||||
"background",
|
||||
"behind",
|
||||
"dark mode",
|
||||
"darken",
|
||||
"darkened",
|
||||
"dialogs",
|
||||
"drawer",
|
||||
"launcher",
|
||||
"menu",
|
||||
"modal",
|
||||
"night",
|
||||
"overlay",
|
||||
"show",
|
||||
"start"
|
||||
],
|
||||
"icon": "layers",
|
||||
"description": "Show darkened overlay behind modal dialogs"
|
||||
},
|
||||
{
|
||||
"section": "spotlightCloseNiriOverview",
|
||||
"label": "Niri Integration",
|
||||
@@ -3383,31 +3430,6 @@
|
||||
],
|
||||
"description": "Base to derive dark theme from"
|
||||
},
|
||||
{
|
||||
"section": "modalDarkenBackground",
|
||||
"label": "Darken Modal Background",
|
||||
"tabIndex": 10,
|
||||
"category": "Theme & Colors",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"background",
|
||||
"behind",
|
||||
"colors",
|
||||
"dark mode",
|
||||
"darken",
|
||||
"darkened",
|
||||
"dialogs",
|
||||
"look",
|
||||
"modal",
|
||||
"night",
|
||||
"overlay",
|
||||
"scheme",
|
||||
"show",
|
||||
"style",
|
||||
"theme"
|
||||
],
|
||||
"description": "Show darkened overlay behind modal dialogs"
|
||||
},
|
||||
{
|
||||
"section": "matugenTemplateEmacs",
|
||||
"label": "Emacs",
|
||||
@@ -3827,32 +3849,6 @@
|
||||
"icon": "auto_awesome",
|
||||
"conditionKey": "matugenAvailable"
|
||||
},
|
||||
{
|
||||
"section": "modalBackground",
|
||||
"label": "Modal Background",
|
||||
"tabIndex": 10,
|
||||
"category": "Theme & Colors",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"background",
|
||||
"behind",
|
||||
"colors",
|
||||
"dark mode",
|
||||
"darken",
|
||||
"darkened",
|
||||
"dialogs",
|
||||
"look",
|
||||
"modal",
|
||||
"night",
|
||||
"overlay",
|
||||
"scheme",
|
||||
"show",
|
||||
"style",
|
||||
"theme"
|
||||
],
|
||||
"icon": "layers",
|
||||
"description": "Show darkened overlay behind modal dialogs"
|
||||
},
|
||||
{
|
||||
"section": "modalElevationEnabled",
|
||||
"label": "Modal Shadows",
|
||||
@@ -4142,6 +4138,30 @@
|
||||
],
|
||||
"description": "Controls the outline of popouts, modals, and other shell surfaces"
|
||||
},
|
||||
{
|
||||
"section": "blurBorderEnabled",
|
||||
"label": "Surface Border Outline",
|
||||
"tabIndex": 10,
|
||||
"category": "Theme & Colors",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"around",
|
||||
"border",
|
||||
"colors",
|
||||
"edge",
|
||||
"look",
|
||||
"modal",
|
||||
"outline",
|
||||
"popup",
|
||||
"scheme",
|
||||
"shell",
|
||||
"style",
|
||||
"surface",
|
||||
"surfaces",
|
||||
"theme"
|
||||
],
|
||||
"description": "Outline around shell surfaces"
|
||||
},
|
||||
{
|
||||
"section": "popupTransparency",
|
||||
"label": "Surface Opacity",
|
||||
@@ -4635,22 +4655,49 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"section": "lockAuthSource",
|
||||
"label": "Authentication Source",
|
||||
"section": "lockAppearance",
|
||||
"label": "Appearance",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"clock",
|
||||
"date",
|
||||
"font",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"time",
|
||||
"typography",
|
||||
"watch"
|
||||
],
|
||||
"icon": "palette",
|
||||
"description": "Font used for the clock and date on the lock screen"
|
||||
},
|
||||
{
|
||||
"section": "lockAuthSource",
|
||||
"label": "Authentication",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"authenticate",
|
||||
"authentication",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"pam",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"service",
|
||||
"source"
|
||||
"source",
|
||||
"uses"
|
||||
],
|
||||
"icon": "key"
|
||||
"icon": "key",
|
||||
"description": "Which PAM service the lock screen uses to authenticate"
|
||||
},
|
||||
{
|
||||
"section": "lockPamPath",
|
||||
@@ -4658,16 +4705,20 @@
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"authenticate",
|
||||
"authentication",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"pam",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"service",
|
||||
"source"
|
||||
]
|
||||
"source",
|
||||
"uses"
|
||||
],
|
||||
"description": "Which PAM service the lock screen uses to authenticate"
|
||||
},
|
||||
{
|
||||
"section": "lockScreenVideoCycling",
|
||||
@@ -4694,6 +4745,48 @@
|
||||
],
|
||||
"description": "Pick a different random video each time from the same folder"
|
||||
},
|
||||
{
|
||||
"section": "lockBehavior",
|
||||
"label": "Behavior",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"behavior",
|
||||
"bind",
|
||||
"dbus",
|
||||
"disable",
|
||||
"external",
|
||||
"integration",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"loginctl",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"signals"
|
||||
],
|
||||
"icon": "lock",
|
||||
"description": "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen"
|
||||
},
|
||||
{
|
||||
"section": "lockDisplay",
|
||||
"label": "Display Assignment",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"assignment",
|
||||
"display",
|
||||
"lock",
|
||||
"login",
|
||||
"monitor",
|
||||
"output",
|
||||
"password",
|
||||
"screen",
|
||||
"security"
|
||||
],
|
||||
"icon": "monitor"
|
||||
},
|
||||
{
|
||||
"section": "lockScreenVideoEnabled",
|
||||
"label": "Enable Video Screensaver",
|
||||
@@ -4728,10 +4821,14 @@
|
||||
"fprint",
|
||||
"lock",
|
||||
"login",
|
||||
"managed",
|
||||
"password",
|
||||
"primary",
|
||||
"screen",
|
||||
"security"
|
||||
]
|
||||
"security",
|
||||
"source"
|
||||
],
|
||||
"description": "Managed by the primary PAM source."
|
||||
},
|
||||
{
|
||||
"section": "loginctlLockIntegration",
|
||||
@@ -4769,12 +4866,41 @@
|
||||
"key",
|
||||
"lock",
|
||||
"login",
|
||||
"managed",
|
||||
"password",
|
||||
"primary",
|
||||
"screen",
|
||||
"security",
|
||||
"source",
|
||||
"u2f",
|
||||
"yubikey"
|
||||
]
|
||||
],
|
||||
"description": "Managed by the primary PAM source."
|
||||
},
|
||||
{
|
||||
"section": "lockLayout",
|
||||
"label": "Layout",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"actions",
|
||||
"appear",
|
||||
"field",
|
||||
"hidden",
|
||||
"layout",
|
||||
"lock",
|
||||
"login",
|
||||
"password",
|
||||
"power",
|
||||
"pressed",
|
||||
"reboot",
|
||||
"screen",
|
||||
"security",
|
||||
"shutdown",
|
||||
"soon"
|
||||
],
|
||||
"icon": "lock",
|
||||
"description": "If the field is hidden, it will appear as soon as a key is pressed."
|
||||
},
|
||||
{
|
||||
"section": "_tab_11",
|
||||
@@ -4791,97 +4917,6 @@
|
||||
],
|
||||
"icon": "lock"
|
||||
},
|
||||
{
|
||||
"section": "lockAppearance",
|
||||
"label": "Lock Screen Appearance",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"clock",
|
||||
"date",
|
||||
"font",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"time",
|
||||
"typography",
|
||||
"watch"
|
||||
],
|
||||
"icon": "palette",
|
||||
"description": "Font used for the clock and date on the lock screen"
|
||||
},
|
||||
{
|
||||
"section": "lockDisplay",
|
||||
"label": "Lock Screen Display",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"display",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"monitor",
|
||||
"output",
|
||||
"password",
|
||||
"screen",
|
||||
"security"
|
||||
],
|
||||
"icon": "monitor"
|
||||
},
|
||||
{
|
||||
"section": "lockBehavior",
|
||||
"label": "Lock Screen behaviour",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"behaviour",
|
||||
"bind",
|
||||
"dbus",
|
||||
"disable",
|
||||
"external",
|
||||
"integration",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"loginctl",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"signals"
|
||||
],
|
||||
"icon": "lock",
|
||||
"description": "Bind lock screen to dbus signals from loginctl. Disable if using an external lock screen"
|
||||
},
|
||||
{
|
||||
"section": "lockLayout",
|
||||
"label": "Lock Screen layout",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"actions",
|
||||
"appear",
|
||||
"field",
|
||||
"hidden",
|
||||
"layout",
|
||||
"lock",
|
||||
"lockscreen",
|
||||
"login",
|
||||
"password",
|
||||
"power",
|
||||
"pressed",
|
||||
"reboot",
|
||||
"screen",
|
||||
"security",
|
||||
"shutdown",
|
||||
"soon"
|
||||
],
|
||||
"icon": "lock",
|
||||
"description": "If the field is hidden, it will appear as soon as a key is pressed."
|
||||
},
|
||||
{
|
||||
"section": "lockAtStartup",
|
||||
"label": "Lock at startup",
|
||||
@@ -5005,6 +5040,29 @@
|
||||
],
|
||||
"description": "Turn off all displays immediately when the lock screen activates"
|
||||
},
|
||||
{
|
||||
"section": "lockU2fPamPath",
|
||||
"label": "Security Key PAM Source",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"auto",
|
||||
"bundled",
|
||||
"installed",
|
||||
"key",
|
||||
"lock",
|
||||
"login",
|
||||
"pam",
|
||||
"password",
|
||||
"screen",
|
||||
"security",
|
||||
"service",
|
||||
"source",
|
||||
"u2f",
|
||||
"uses"
|
||||
],
|
||||
"description": "Auto uses an installed or bundled key-only service."
|
||||
},
|
||||
{
|
||||
"section": "u2fMode",
|
||||
"label": "Security key mode",
|
||||
@@ -5159,6 +5217,25 @@
|
||||
"time"
|
||||
]
|
||||
},
|
||||
{
|
||||
"section": "lockPamExternallyManaged",
|
||||
"label": "Use system PAM authentication",
|
||||
"tabIndex": 11,
|
||||
"category": "Lock Screen",
|
||||
"keywords": [
|
||||
"authentication",
|
||||
"external",
|
||||
"lock",
|
||||
"login",
|
||||
"managed",
|
||||
"pam",
|
||||
"password",
|
||||
"policy",
|
||||
"screen",
|
||||
"security",
|
||||
"system"
|
||||
]
|
||||
},
|
||||
{
|
||||
"section": "videoScreensaver",
|
||||
"label": "Video Screensaver",
|
||||
@@ -6048,6 +6125,31 @@
|
||||
],
|
||||
"description": "Show notification popups only on the currently focused monitor"
|
||||
},
|
||||
{
|
||||
"section": "notificationForegroundLayers",
|
||||
"label": "Foreground Layers",
|
||||
"tabIndex": 17,
|
||||
"category": "Notifications",
|
||||
"keywords": [
|
||||
"alert",
|
||||
"alerts",
|
||||
"blur",
|
||||
"cards",
|
||||
"contrast",
|
||||
"foreground",
|
||||
"glass",
|
||||
"layers",
|
||||
"messages",
|
||||
"notif",
|
||||
"notification",
|
||||
"notifications",
|
||||
"show",
|
||||
"surface",
|
||||
"surfaces",
|
||||
"toast"
|
||||
],
|
||||
"description": "Show foreground surfaces on notification cards"
|
||||
},
|
||||
{
|
||||
"section": "notificationHistoryMaxAgeDays",
|
||||
"label": "History Retention",
|
||||
@@ -7804,6 +7906,47 @@
|
||||
],
|
||||
"description": "Change the locale used for date and time formatting, independent of the interface language."
|
||||
},
|
||||
{
|
||||
"section": "greeterAppearance",
|
||||
"label": "Appearance",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"display manager",
|
||||
"font",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"screen",
|
||||
"typography"
|
||||
],
|
||||
"icon": "palette",
|
||||
"description": "Font used on the login screen"
|
||||
},
|
||||
{
|
||||
"section": "greeterAuth",
|
||||
"label": "Authentication",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"auth",
|
||||
"authentication",
|
||||
"block",
|
||||
"display manager",
|
||||
"external",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"managed",
|
||||
"pam",
|
||||
"removes",
|
||||
"stops",
|
||||
"writing"
|
||||
],
|
||||
"icon": "fingerprint",
|
||||
"description": "DMS removes its managed block from /etc/pam.d/greetd and stops writing to it"
|
||||
},
|
||||
{
|
||||
"section": "greeterAutoLogin",
|
||||
"label": "Auto-login on startup",
|
||||
@@ -7837,6 +7980,25 @@
|
||||
],
|
||||
"description": "Skip the greeter password after boot until you sign out. Lock screen unlock is unchanged. Takes effect on the next reboot after sync."
|
||||
},
|
||||
{
|
||||
"section": "greeterBehavior",
|
||||
"label": "Behavior",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"behavior",
|
||||
"display manager",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"last",
|
||||
"login",
|
||||
"remember",
|
||||
"select",
|
||||
"session"
|
||||
],
|
||||
"icon": "history",
|
||||
"description": "Pre-select the last used session on the greeter"
|
||||
},
|
||||
{
|
||||
"section": "greeterLockDateFormat",
|
||||
"label": "Date Format",
|
||||
@@ -7914,57 +8076,6 @@
|
||||
],
|
||||
"icon": "login"
|
||||
},
|
||||
{
|
||||
"section": "greeterAppearance",
|
||||
"label": "Greeter Appearance",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"appearance",
|
||||
"display manager",
|
||||
"font",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"screen",
|
||||
"typography"
|
||||
],
|
||||
"icon": "palette",
|
||||
"description": "Font used on the login screen"
|
||||
},
|
||||
{
|
||||
"section": "greeterBehavior",
|
||||
"label": "Greeter Behavior",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"behavior",
|
||||
"display manager",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"last",
|
||||
"login",
|
||||
"remember",
|
||||
"select",
|
||||
"session"
|
||||
],
|
||||
"icon": "history",
|
||||
"description": "Pre-select the last used session on the greeter"
|
||||
},
|
||||
{
|
||||
"section": "greeterStatus",
|
||||
"label": "Greeter Status",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"display manager",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"status"
|
||||
],
|
||||
"icon": "info"
|
||||
},
|
||||
{
|
||||
"section": "greeterFontFamily",
|
||||
"label": "Greeter font",
|
||||
@@ -7981,29 +8092,6 @@
|
||||
],
|
||||
"description": "Font used on the login screen"
|
||||
},
|
||||
{
|
||||
"section": "greeterAuth",
|
||||
"label": "Login Authentication",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"auth",
|
||||
"authentication",
|
||||
"block",
|
||||
"display manager",
|
||||
"external",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"managed",
|
||||
"pam",
|
||||
"removes",
|
||||
"stops",
|
||||
"writing"
|
||||
],
|
||||
"icon": "fingerprint",
|
||||
"description": "DMS removes its managed block from /etc/pam.d/greetd and stops writing to it"
|
||||
},
|
||||
{
|
||||
"section": "greeterRememberLastSession",
|
||||
"label": "Remember last session",
|
||||
@@ -8040,17 +8128,31 @@
|
||||
],
|
||||
"description": "Pre-fill the last successful username on the greeter"
|
||||
},
|
||||
{
|
||||
"section": "greeterStatus",
|
||||
"label": "Status",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"display manager",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
"status"
|
||||
],
|
||||
"icon": "info"
|
||||
},
|
||||
{
|
||||
"section": "greeterPamExternallyManaged",
|
||||
"label": "greetd PAM is externally managed",
|
||||
"label": "Use system PAM authentication",
|
||||
"tabIndex": 31,
|
||||
"category": "Greeter",
|
||||
"keywords": [
|
||||
"auth",
|
||||
"authentication",
|
||||
"block",
|
||||
"display manager",
|
||||
"external",
|
||||
"externally",
|
||||
"greetd",
|
||||
"greeter",
|
||||
"login",
|
||||
@@ -8058,6 +8160,7 @@
|
||||
"pam",
|
||||
"removes",
|
||||
"stops",
|
||||
"system",
|
||||
"writing"
|
||||
],
|
||||
"description": "DMS removes its managed block from /etc/pam.d/greetd and stops writing to it"
|
||||
|
||||
@@ -48,7 +48,7 @@ for n in $refs; do
|
||||
gh issue comment "$n" --repo "$REPO" --body "$(cat <<EOF
|
||||
:package: A fix referencing this issue shipped in [**${TAG}**](${RELEASE_URL}).
|
||||
|
||||
Please retest on the new release when you get a chance — if it's resolved, this issue can be closed. Thanks!
|
||||
A New Release has been deployed! Please retest when you get a chance. If it's resolved, this issue can be closed. ~ Cheers, the DMS Team!
|
||||
EOF
|
||||
)"
|
||||
echo "notified #${n} — ${title}"
|
||||
|
||||
Reference in New Issue
Block a user