1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-12 23:32:50 -04:00

Compare commits

..

1 Commits

Author SHA1 Message Date
bbedward 22f384b821 blur: demo BackgroundEffect.blurRegion on some components 2026-02-16 09:47:30 -05:00
127 changed files with 2158 additions and 7803 deletions
+3 -3
View File
@@ -45,9 +45,9 @@ body:
- type: textarea
id: dms_doctor
attributes:
label: dms doctor -vC
description: Output of `dms doctor -vC` command
placeholder: Paste the output of `dms doctor -vC` here
label: dms doctor -v
description: Output of `dms doctor -v` command
placeholder: Paste the output of `dms doctor -v` here
validations:
required: true
- type: textarea
+3 -3
View File
@@ -30,9 +30,9 @@ body:
- type: textarea
id: dms_doctor
attributes:
label: dms doctor -vC
description: Output of `dms doctor -vC` command
placeholder: Paste the output of `dms doctor -vC` here
label: dms doctor -v
description: Output of `dms doctor -v` command
placeholder: Paste the output of `dms doctor -v` here
validations:
required: false
- type: textarea
+2 -2
View File
@@ -19,7 +19,7 @@ Built with [Quickshell](https://quickshell.org/) and [Go](https://go.dev/)
</div>
DankMaterialShell is a complete desktop shell for [niri](https://github.com/YaLTeR/niri), [Hyprland](https://hyprland.org/), [MangoWC](https://github.com/DreamMaoMao/mangowc), [Sway](https://swaywm.org), [labwc](https://labwc.github.io/), [Scroll](https://github.com/dawsers/scroll), [Miracle WM](https://github.com/miracle-wm-org/miracle-wm), and other Wayland compositors. It replaces waybar, swaylock, swayidle, mako, fuzzel, polkit, and everything else you'd normally stitch together to make a desktop.
DankMaterialShell is a complete desktop shell for [niri](https://github.com/YaLTeR/niri), [Hyprland](https://hyprland.org/), [MangoWC](https://github.com/DreamMaoMao/mangowc), [Sway](https://swaywm.org), [labwc](https://labwc.github.io/), [Scroll](https://github.com/dawsers/scroll), and other Wayland compositors. It replaces waybar, swaylock, swayidle, mako, fuzzel, polkit, and everything else you'd normally stitch together to make a desktop.
## Repository Structure
@@ -105,7 +105,7 @@ Extend functionality with the [plugin registry](https://plugins.danklinux.com).
## Supported Compositors
Works best with [niri](https://github.com/YaLTeR/niri), [Hyprland](https://hyprland.org/), [Sway](https://swaywm.org/), [MangoWC](https://github.com/DreamMaoMao/mangowc), [labwc](https://labwc.github.io/), [Scroll](https://github.com/dawsers/scroll), and [Miracle WM](https://github.com/miracle-wm-org/miracle-wm) with full workspace switching, overview integration, and monitor management. Other Wayland compositors work with reduced features.
Works best with [niri](https://github.com/YaLTeR/niri), [Hyprland](https://hyprland.org/), [Sway](https://swaywm.org/), [MangoWC](https://github.com/DreamMaoMao/mangowc), [labwc](https://labwc.github.io/), and [Scroll](https://github.com/dawsers/scroll) with full workspace switching, overview integration, and monitor management. Other Wayland compositors work with reduced features.
[Compositor configuration guide](https://danklinux.com/docs/dankmaterialshell/compositors)
+23 -56
View File
@@ -649,73 +649,40 @@ func checkI2CAvailability() checkResult {
return checkResult{catOptionalFeatures, "I2C/DDC", statusOK, fmt.Sprintf("%d monitor(s) detected", len(devices)), "External monitor brightness control", doctorDocsURL + "#optional-features"}
}
func checkImageFormatPlugins() []checkResult {
func checkKImageFormats() checkResult {
url := doctorDocsURL + "#optional-features"
desc := "Extra image format support (AVIF, HEIF, JXL)"
pluginDir := findQtPluginDir()
if pluginDir == "" {
return []checkResult{
{catOptionalFeatures, "qt6-imageformats", statusInfo, "Cannot detect (plugin dir not found)", "WebP, TIFF, JP2 support", url},
{catOptionalFeatures, "kimageformats", statusInfo, "Cannot detect (plugin dir not found)", "AVIF, HEIF, JXL support", url},
}
return checkResult{catOptionalFeatures, "kimageformats", statusInfo, "Cannot detect (qtpaths not found)", desc, url}
}
imageFormatsDir := filepath.Join(pluginDir, "imageformats")
type pluginCheck struct {
name string
desc string
plugins []struct{ file, format string }
keyPlugins := []struct{ file, format string }{
{"kimg_avif.so", "AVIF"},
{"kimg_heif.so", "HEIF"},
{"kimg_jxl.so", "JXL"},
{"kimg_exr.so", "EXR"},
}
checks := []pluginCheck{
{
name: "qt6-imageformats",
desc: "WebP, TIFF, GIF, JP2 support",
plugins: []struct{ file, format string }{
{"libqwebp.so", "WebP"},
{"libqtiff.so", "TIFF"},
{"libqgif.so", "GIF"},
{"libqjp2.so", "JP2"},
{"libqicns.so", "ICNS"},
},
},
{
name: "kimageformats",
desc: "AVIF, HEIF, JXL support",
plugins: []struct{ file, format string }{
{"kimg_avif.so", "AVIF"},
{"kimg_heif.so", "HEIF"},
{"kimg_jxl.so", "JXL"},
{"kimg_exr.so", "EXR"},
},
},
}
var results []checkResult
for _, c := range checks {
var found []string
for _, p := range c.plugins {
if _, err := os.Stat(filepath.Join(imageFormatsDir, p.file)); err == nil {
found = append(found, p.format)
}
var found []string
for _, p := range keyPlugins {
if _, err := os.Stat(filepath.Join(imageFormatsDir, p.file)); err == nil {
found = append(found, p.format)
}
var result checkResult
switch {
case len(found) == 0:
result = checkResult{catOptionalFeatures, c.name, statusWarn, "Not installed", c.desc, url}
default:
details := ""
if doctorVerbose {
details = fmt.Sprintf("Formats: %s (%s)", strings.Join(found, ", "), imageFormatsDir)
}
result = checkResult{catOptionalFeatures, c.name, statusOK, fmt.Sprintf("Installed (%d formats)", len(found)), details, url}
}
results = append(results, result)
}
return results
if len(found) == 0 {
return checkResult{catOptionalFeatures, "kimageformats", statusWarn, "Not installed", desc, url}
}
details := ""
if doctorVerbose {
details = fmt.Sprintf("Formats: %s (%s)", strings.Join(found, ", "), imageFormatsDir)
}
return checkResult{catOptionalFeatures, "kimageformats", statusOK, fmt.Sprintf("Installed (%d formats)", len(found)), details, url}
}
func findQtPluginDir() string {
@@ -806,7 +773,7 @@ func checkOptionalDependencies() []checkResult {
results = append(results, checkResult{catOptionalFeatures, "cups-pk-helper", cupsPkStatus, cupsPkMsg, "Printer management", optionalFeaturesURL})
results = append(results, checkI2CAvailability())
results = append(results, checkImageFormatPlugins()...)
results = append(results, checkKImageFormats())
terminals := []string{"ghostty", "kitty", "alacritty", "foot", "wezterm"}
if idx := slices.IndexFunc(terminals, utils.CommandExists); idx >= 0 {
+8 -22
View File
@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds/providers"
@@ -83,35 +82,24 @@ func init() {
func initializeProviders() {
registry := keybinds.GetDefaultRegistry()
hyprlandProvider := providers.NewHyprlandProvider("")
hyprlandProvider := providers.NewHyprlandProvider("$HOME/.config/hypr")
if err := registry.Register(hyprlandProvider); err != nil {
log.Warnf("Failed to register Hyprland provider: %v", err)
}
mangowcProvider := providers.NewMangoWCProvider("")
mangowcProvider := providers.NewMangoWCProvider("$HOME/.config/mango")
if err := registry.Register(mangowcProvider); err != nil {
log.Warnf("Failed to register MangoWC provider: %v", err)
}
configDir, _ := os.UserConfigDir()
if configDir != "" {
scrollProvider := providers.NewSwayProvider(filepath.Join(configDir, "scroll"))
if err := registry.Register(scrollProvider); err != nil {
log.Warnf("Failed to register Scroll provider: %v", err)
}
scrollProvider := providers.NewSwayProvider("$HOME/.config/scroll")
if err := registry.Register(scrollProvider); err != nil {
log.Warnf("Failed to register Scroll provider: %v", err)
}
miracleProvider := providers.NewMiracleProvider("")
if err := registry.Register(miracleProvider); err != nil {
log.Warnf("Failed to register Miracle WM provider: %v", err)
}
if configDir != "" {
swayProvider := providers.NewSwayProvider(filepath.Join(configDir, "sway"))
if err := registry.Register(swayProvider); err != nil {
log.Warnf("Failed to register Sway provider: %v", err)
}
swayProvider := providers.NewSwayProvider("$HOME/.config/sway")
if err := registry.Register(swayProvider); err != nil {
log.Warnf("Failed to register Sway provider: %v", err)
}
niriProvider := providers.NewNiriProvider("")
@@ -156,8 +144,6 @@ func makeProviderWithPath(name, path string) keybinds.Provider {
return providers.NewSwayProvider(path)
case "scroll":
return providers.NewSwayProvider(path)
case "miracle":
return providers.NewMiracleProvider(path)
case "niri":
return providers.NewNiriProvider(path)
default:
+13 -15
View File
@@ -13,16 +13,16 @@ import (
)
var (
ssOutputName string
ssCursor string
ssFormat string
ssQuality int
ssOutputDir string
ssFilename string
ssNoClipboard bool
ssNoFile bool
ssNoNotify bool
ssStdout bool
ssOutputName string
ssIncludeCursor bool
ssFormat string
ssQuality int
ssOutputDir string
ssFilename string
ssNoClipboard bool
ssNoFile bool
ssNoNotify bool
ssStdout bool
)
var screenshotCmd = &cobra.Command{
@@ -52,7 +52,7 @@ Examples:
dms screenshot last # Last region (pre-selected)
dms screenshot --no-clipboard # Save file only
dms screenshot --no-file # Clipboard only
dms screenshot --cursor=on # Include cursor
dms screenshot --cursor # Include cursor
dms screenshot -f jpg -q 85 # JPEG with quality 85`,
}
@@ -111,7 +111,7 @@ var notifyActionCmd = &cobra.Command{
func init() {
screenshotCmd.PersistentFlags().StringVarP(&ssOutputName, "output", "o", "", "Output name for 'output' mode")
screenshotCmd.PersistentFlags().StringVar(&ssCursor, "cursor", "off", "Include cursor in screenshot (on/off)")
screenshotCmd.PersistentFlags().BoolVar(&ssIncludeCursor, "cursor", false, "Include cursor in screenshot")
screenshotCmd.PersistentFlags().StringVarP(&ssFormat, "format", "f", "png", "Output format (png, jpg, ppm)")
screenshotCmd.PersistentFlags().IntVarP(&ssQuality, "quality", "q", 90, "JPEG quality (1-100)")
screenshotCmd.PersistentFlags().StringVarP(&ssOutputDir, "dir", "d", "", "Output directory")
@@ -136,9 +136,7 @@ func getScreenshotConfig(mode screenshot.Mode) screenshot.Config {
config := screenshot.DefaultConfig()
config.Mode = mode
config.OutputName = ssOutputName
if strings.EqualFold(ssCursor, "on") {
config.Cursor = screenshot.CursorOn
}
config.IncludeCursor = ssIncludeCursor
config.Clipboard = !ssNoClipboard
config.SaveFile = !ssNoFile
config.Notify = !ssNoNotify
+2 -2
View File
@@ -210,7 +210,7 @@ func runShellInteractive(session bool) {
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORMTHEME_QT6=gtk3")
}
if os.Getenv("QT_QPA_PLATFORM") == "" {
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORM=wayland;xcb")
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORM=wayland")
}
cmd.Stdin = os.Stdin
@@ -450,7 +450,7 @@ func runShellDaemon(session bool) {
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORMTHEME_QT6=gtk3")
}
if os.Getenv("QT_QPA_PLATFORM") == "" {
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORM=wayland;xcb")
cmd.Env = append(cmd.Env, "QT_QPA_PLATFORM=wayland")
}
devNull, err := os.OpenFile("/dev/null", os.O_RDWR, 0)
+5 -5
View File
@@ -19,7 +19,7 @@ require (
github.com/yuin/goldmark v1.7.16
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
go.etcd.io/bbolt v1.4.3
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a
golang.org/x/exp v0.0.0-20260211191109-2735e65f0518
golang.org/x/image v0.36.0
)
@@ -27,7 +27,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/clipperhouse/displaywidth v0.10.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
github.com/cloudflare/circl v1.6.3 // indirect
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
@@ -36,7 +36,7 @@ require (
github.com/go-git/go-billy/v6 v6.0.0-20260209124918-37866f83c2d3 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/kevinburke/ssh_config v1.6.0 // indirect
github.com/kevinburke/ssh_config v1.4.0 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/pjbgf/sha1cd v0.5.0 // indirect
github.com/sergi/go-diff v1.4.0 // indirect
@@ -55,7 +55,7 @@ require (
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/go-git/go-git/v6 v6.0.0-20260216160506-e6a3f881772f
github.com/go-git/go-git/v6 v6.0.0-20260210102253-e4d10f0e569a
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0
github.com/mattn/go-isatty v0.0.20 // indirect
@@ -71,7 +71,7 @@ require (
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/sys v0.41.0
golang.org/x/text v0.34.0
gopkg.in/yaml.v3 v3.0.1
gopkg.in/yaml.v3 v3.0.1 // indirect
)
// v0.0.1 tag is missing a LICENSE file; master has it.
+8 -8
View File
@@ -40,8 +40,8 @@ github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSg
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
github.com/clipperhouse/displaywidth v0.10.0 h1:GhBG8WuerxjFQQYeuZAeVTuyxuX+UraiZGD4HJQ3Y8g=
github.com/clipperhouse/displaywidth v0.10.0/go.mod h1:XqJajYsaiEwkxOj4bowCTMcT1SgvHo9flfF3jQasdbs=
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos=
github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -68,8 +68,8 @@ github.com/go-git/go-billy/v6 v6.0.0-20260209124918-37866f83c2d3 h1:UU7oARtwQ5g8
github.com/go-git/go-billy/v6 v6.0.0-20260209124918-37866f83c2d3/go.mod h1:ZW9JC5gionMP1kv5uiaOaV23q0FFmNrVOV8VW+y/acc=
github.com/go-git/go-git-fixtures/v5 v5.1.2-0.20260122163445-0622d7459a67 h1:3hutPZF+/FBjR/9MdsLJ7e1mlt9pwHgwxMW7CrbmWII=
github.com/go-git/go-git-fixtures/v5 v5.1.2-0.20260122163445-0622d7459a67/go.mod h1:xKt0pNHST9tYHvbiLxSY27CQWFwgIxBJuDrOE0JvbZw=
github.com/go-git/go-git/v6 v6.0.0-20260216160506-e6a3f881772f h1:TBkCJv9YwPOuXq1OG0r01bcxRrvs15Hp/DtZuPt4H6s=
github.com/go-git/go-git/v6 v6.0.0-20260216160506-e6a3f881772f/go.mod h1:B88nWzfnhTlIikoJ4d84Nc9noKS5mJoA7SgDdkt0aPU=
github.com/go-git/go-git/v6 v6.0.0-20260210102253-e4d10f0e569a h1:LLju0NuXQqR4WmGl1Dm86b9ZXsvXgLYbx/aaAjdQr6w=
github.com/go-git/go-git/v6 v6.0.0-20260210102253-e4d10f0e569a/go.mod h1:IdXOePSwsMKGpuAbpczsm+f0Uy5fdHHjwgDPOymKA78=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -86,8 +86,8 @@ github.com/holoplot/go-evdev v0.0.0-20250804134636-ab1d56a1fe83 h1:B+A58zGFuDrvE
github.com/holoplot/go-evdev v0.0.0-20250804134636-ab1d56a1fe83/go.mod h1:iHAf8OIncO2gcQ8XOjS7CMJ2aPbX2Bs0wl5pZyanEqk=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY=
github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ=
github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -152,8 +152,8 @@ go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a h1:ovFr6Z0MNmU7nH8VaX5xqw+05ST2uO1exVfZPVqRC5o=
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
golang.org/x/exp v0.0.0-20260211191109-2735e65f0518 h1:2E1CW7v5QB+Wi3N+MXllOtVR6SFmI8iJM8EdzgxrgrU=
golang.org/x/exp v0.0.0-20260211191109-2735e65f0518/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
golang.org/x/image v0.36.0 h1:Iknbfm1afbgtwPTmHnS2gTM/6PPZfH+z2EFuOkSbqwc=
golang.org/x/image v0.36.0/go.mod h1:YsWD2TyyGKiIX1kZlu9QfKIsQ4nAAK9bdgdrIsE7xy4=
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
+3 -3
View File
@@ -644,7 +644,7 @@ func (cd *ConfigDeployer) transformHyprlandConfigForNonSystemd(config, terminalC
if strings.HasPrefix(trimmed, "exec-once = systemctl --user start") {
startupSectionFound = true
result = append(result, "exec-once = dms run")
result = append(result, "env = QT_QPA_PLATFORM,wayland;xcb")
result = append(result, "env = QT_QPA_PLATFORM,wayland")
result = append(result, "env = ELECTRON_OZONE_PLATFORM_HINT,auto")
result = append(result, "env = QT_QPA_PLATFORMTHEME,gtk3")
result = append(result, "env = QT_QPA_PLATFORMTHEME_QT6,gtk3")
@@ -659,7 +659,7 @@ func (cd *ConfigDeployer) transformHyprlandConfigForNonSystemd(config, terminalC
if strings.Contains(line, "STARTUP APPS") {
insertLines := []string{
"exec-once = dms run",
"env = QT_QPA_PLATFORM,wayland;xcb",
"env = QT_QPA_PLATFORM,wayland",
"env = ELECTRON_OZONE_PLATFORM_HINT,auto",
"env = QT_QPA_PLATFORMTHEME,gtk3",
"env = QT_QPA_PLATFORMTHEME_QT6,gtk3",
@@ -677,7 +677,7 @@ func (cd *ConfigDeployer) transformHyprlandConfigForNonSystemd(config, terminalC
func (cd *ConfigDeployer) transformNiriConfigForNonSystemd(config, terminalCommand string) string {
envVars := fmt.Sprintf(`environment {
XDG_CURRENT_DESKTOP "niri"
QT_QPA_PLATFORM "wayland;xcb"
QT_QPA_PLATFORM "wayland"
ELECTRON_OZONE_PLATFORM_HINT "auto"
QT_QPA_PLATFORMTHEME "gtk3"
QT_QPA_PLATFORMTHEME_QT6 "gtk3"
@@ -111,7 +111,6 @@ windowrule = float on, match:class ^(zoom)$
# windowrule = float on, match:class ^(org.quickshell)$
layerrule = no_anim on, match:namespace ^(quickshell)$
layerrule = no_anim on, match:namespace ^dms:.*
source = ./dms/colors.conf
source = ./dms/outputs.conf
+1 -1
View File
@@ -430,7 +430,7 @@ func (d *DebianDistribution) enableOBSRepos(ctx context.Context, obsPkgs []Packa
}
// Add repository
repoLine := fmt.Sprintf("deb [signed-by=%s arch=%s] %s/ /", keyringPath, runtime.GOARCH, baseURL)
repoLine := fmt.Sprintf("deb [signed-by=%s, arch=%s] %s/ /", keyringPath, runtime.GOARCH, baseURL)
progressChan <- InstallProgressMsg{
Phase: PhaseSystemPackages,
@@ -1,95 +0,0 @@
package providers
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
"github.com/AvengeMedia/DankMaterialShell/core/internal/utils"
)
type MiracleProvider struct {
configPath string
}
func NewMiracleProvider(configPath string) *MiracleProvider {
if configPath == "" {
configDir, err := os.UserConfigDir()
if err == nil {
configPath = filepath.Join(configDir, "miracle-wm")
}
}
return &MiracleProvider{configPath: configPath}
}
func (m *MiracleProvider) Name() string {
return "miracle"
}
func (m *MiracleProvider) GetCheatSheet() (*keybinds.CheatSheet, error) {
config, err := ParseMiracleConfig(m.configPath)
if err != nil {
return nil, fmt.Errorf("failed to parse miracle-wm config: %w", err)
}
bindings := MiracleConfigToBindings(config)
categorizedBinds := make(map[string][]keybinds.Keybind)
for _, kb := range bindings {
category := m.categorizeAction(kb.Action)
bind := keybinds.Keybind{
Key: m.formatKey(kb),
Description: kb.Comment,
Action: kb.Action,
}
categorizedBinds[category] = append(categorizedBinds[category], bind)
}
return &keybinds.CheatSheet{
Title: "Miracle WM Keybinds",
Provider: m.Name(),
Binds: categorizedBinds,
}, nil
}
func (m *MiracleProvider) GetOverridePath() string {
expanded, err := utils.ExpandPath(m.configPath)
if err != nil {
return filepath.Join(m.configPath, "config.yaml")
}
return filepath.Join(expanded, "config.yaml")
}
func (m *MiracleProvider) formatKey(kb MiracleKeyBinding) string {
parts := make([]string, 0, len(kb.Mods)+1)
parts = append(parts, kb.Mods...)
parts = append(parts, kb.Key)
return strings.Join(parts, "+")
}
func (m *MiracleProvider) categorizeAction(action string) string {
switch {
case strings.HasPrefix(action, "select_workspace_") || strings.HasPrefix(action, "move_to_workspace_"):
return "Workspace"
case strings.Contains(action, "select_") || strings.Contains(action, "move_"):
return "Window"
case action == "toggle_resize" || strings.HasPrefix(action, "resize_"):
return "Window"
case action == "fullscreen" || action == "toggle_floating" || action == "quit_active_window" || action == "toggle_pinned_to_workspace":
return "Window"
case action == "toggle_tabbing" || action == "toggle_stacking" || action == "request_vertical" || action == "request_horizontal":
return "Layout"
case action == "quit_compositor":
return "System"
case action == "terminal":
return "Execute"
case strings.HasPrefix(action, "magnifier_"):
return "Accessibility"
case strings.HasPrefix(action, "dms ") || strings.Contains(action, "dms ipc"):
return "Execute"
default:
return "Execute"
}
}
@@ -1,320 +0,0 @@
package providers
import (
"os"
"path/filepath"
"strings"
"github.com/AvengeMedia/DankMaterialShell/core/internal/utils"
"gopkg.in/yaml.v3"
)
type MiracleConfig struct {
Terminal string `yaml:"terminal"`
ActionKey string `yaml:"action_key"`
DefaultActionOverrides []MiracleActionOverride `yaml:"default_action_overrides"`
CustomActions []MiracleCustomAction `yaml:"custom_actions"`
}
type MiracleActionOverride struct {
Name string `yaml:"name"`
Action string `yaml:"action"`
Modifiers []string `yaml:"modifiers"`
Key string `yaml:"key"`
}
type MiracleCustomAction struct {
Command string `yaml:"command"`
Action string `yaml:"action"`
Modifiers []string `yaml:"modifiers"`
Key string `yaml:"key"`
}
type MiracleKeyBinding struct {
Mods []string
Key string
Action string
Comment string
}
var miracleDefaultBinds = []MiracleKeyBinding{
{Mods: []string{"Super"}, Key: "Return", Action: "terminal", Comment: "Open terminal"},
{Mods: []string{"Super"}, Key: "v", Action: "request_vertical", Comment: "Layout windows vertically"},
{Mods: []string{"Super"}, Key: "h", Action: "request_horizontal", Comment: "Layout windows horizontally"},
{Mods: []string{"Super"}, Key: "Up", Action: "select_up", Comment: "Select window above"},
{Mods: []string{"Super"}, Key: "Down", Action: "select_down", Comment: "Select window below"},
{Mods: []string{"Super"}, Key: "Left", Action: "select_left", Comment: "Select window left"},
{Mods: []string{"Super"}, Key: "Right", Action: "select_right", Comment: "Select window right"},
{Mods: []string{"Super", "Shift"}, Key: "Up", Action: "move_up", Comment: "Move window up"},
{Mods: []string{"Super", "Shift"}, Key: "Down", Action: "move_down", Comment: "Move window down"},
{Mods: []string{"Super", "Shift"}, Key: "Left", Action: "move_left", Comment: "Move window left"},
{Mods: []string{"Super", "Shift"}, Key: "Right", Action: "move_right", Comment: "Move window right"},
{Mods: []string{"Super"}, Key: "r", Action: "toggle_resize", Comment: "Toggle resize mode"},
{Mods: []string{"Super"}, Key: "f", Action: "fullscreen", Comment: "Toggle fullscreen"},
{Mods: []string{"Super", "Shift"}, Key: "q", Action: "quit_active_window", Comment: "Close window"},
{Mods: []string{"Super", "Shift"}, Key: "e", Action: "quit_compositor", Comment: "Exit compositor"},
{Mods: []string{"Super"}, Key: "Space", Action: "toggle_floating", Comment: "Toggle floating"},
{Mods: []string{"Super", "Shift"}, Key: "p", Action: "toggle_pinned_to_workspace", Comment: "Toggle pinned to workspace"},
{Mods: []string{"Super"}, Key: "w", Action: "toggle_tabbing", Comment: "Toggle tabbing layout"},
{Mods: []string{"Super"}, Key: "s", Action: "toggle_stacking", Comment: "Toggle stacking layout"},
{Mods: []string{"Super"}, Key: "1", Action: "select_workspace_0", Comment: "Workspace 1"},
{Mods: []string{"Super"}, Key: "2", Action: "select_workspace_1", Comment: "Workspace 2"},
{Mods: []string{"Super"}, Key: "3", Action: "select_workspace_2", Comment: "Workspace 3"},
{Mods: []string{"Super"}, Key: "4", Action: "select_workspace_3", Comment: "Workspace 4"},
{Mods: []string{"Super"}, Key: "5", Action: "select_workspace_4", Comment: "Workspace 5"},
{Mods: []string{"Super"}, Key: "6", Action: "select_workspace_5", Comment: "Workspace 6"},
{Mods: []string{"Super"}, Key: "7", Action: "select_workspace_6", Comment: "Workspace 7"},
{Mods: []string{"Super"}, Key: "8", Action: "select_workspace_7", Comment: "Workspace 8"},
{Mods: []string{"Super"}, Key: "9", Action: "select_workspace_8", Comment: "Workspace 9"},
{Mods: []string{"Super"}, Key: "0", Action: "select_workspace_9", Comment: "Workspace 10"},
{Mods: []string{"Super", "Shift"}, Key: "1", Action: "move_to_workspace_0", Comment: "Move to workspace 1"},
{Mods: []string{"Super", "Shift"}, Key: "2", Action: "move_to_workspace_1", Comment: "Move to workspace 2"},
{Mods: []string{"Super", "Shift"}, Key: "3", Action: "move_to_workspace_2", Comment: "Move to workspace 3"},
{Mods: []string{"Super", "Shift"}, Key: "4", Action: "move_to_workspace_3", Comment: "Move to workspace 4"},
{Mods: []string{"Super", "Shift"}, Key: "5", Action: "move_to_workspace_4", Comment: "Move to workspace 5"},
{Mods: []string{"Super", "Shift"}, Key: "6", Action: "move_to_workspace_5", Comment: "Move to workspace 6"},
{Mods: []string{"Super", "Shift"}, Key: "7", Action: "move_to_workspace_6", Comment: "Move to workspace 7"},
{Mods: []string{"Super", "Shift"}, Key: "8", Action: "move_to_workspace_7", Comment: "Move to workspace 8"},
{Mods: []string{"Super", "Shift"}, Key: "9", Action: "move_to_workspace_8", Comment: "Move to workspace 9"},
{Mods: []string{"Super", "Shift"}, Key: "0", Action: "move_to_workspace_9", Comment: "Move to workspace 10"},
}
func ParseMiracleConfig(configPath string) (*MiracleConfig, error) {
expanded, err := utils.ExpandPath(configPath)
if err != nil {
return nil, err
}
info, err := os.Stat(expanded)
if err != nil {
return nil, err
}
var configFile string
if info.IsDir() {
configFile = filepath.Join(expanded, "config.yaml")
} else {
configFile = expanded
}
data, err := os.ReadFile(configFile)
if err != nil {
return nil, err
}
var config MiracleConfig
if err := yaml.Unmarshal(data, &config); err != nil {
return nil, err
}
if config.ActionKey == "" {
config.ActionKey = "meta"
}
return &config, nil
}
func resolveMiracleModifier(mod, actionKey string) string {
switch mod {
case "primary":
return resolveActionKey(actionKey)
case "alt", "alt_left", "alt_right":
return "Alt"
case "shift", "shift_left", "shift_right":
return "Shift"
case "ctrl", "ctrl_left", "ctrl_right":
return "Ctrl"
case "meta", "meta_left", "meta_right":
return "Super"
default:
return mod
}
}
func resolveActionKey(actionKey string) string {
switch actionKey {
case "meta":
return "Super"
case "alt":
return "Alt"
case "ctrl":
return "Ctrl"
default:
return "Super"
}
}
func miracleKeyCodeToName(keyCode string) string {
name := strings.TrimPrefix(keyCode, "KEY_")
name = strings.ToLower(name)
switch name {
case "enter":
return "Return"
case "space":
return "Space"
case "up":
return "Up"
case "down":
return "Down"
case "left":
return "Left"
case "right":
return "Right"
case "tab":
return "Tab"
case "escape", "esc":
return "Escape"
case "delete":
return "Delete"
case "backspace":
return "BackSpace"
case "home":
return "Home"
case "end":
return "End"
case "pageup":
return "Page_Up"
case "pagedown":
return "Page_Down"
case "print":
return "Print"
case "pause":
return "Pause"
case "volumeup":
return "XF86AudioRaiseVolume"
case "volumedown":
return "XF86AudioLowerVolume"
case "mute":
return "XF86AudioMute"
case "micmute":
return "XF86AudioMicMute"
case "brightnessup":
return "XF86MonBrightnessUp"
case "brightnessdown":
return "XF86MonBrightnessDown"
case "kbdillumup":
return "XF86KbdBrightnessUp"
case "kbdillumdown":
return "XF86KbdBrightnessDown"
case "comma":
return "comma"
case "minus":
return "minus"
case "equal":
return "equal"
}
if len(name) == 1 {
return name
}
return name
}
func MiracleConfigToBindings(config *MiracleConfig) []MiracleKeyBinding {
overridden := make(map[string]bool)
var bindings []MiracleKeyBinding
for _, override := range config.DefaultActionOverrides {
mods := make([]string, 0, len(override.Modifiers))
for _, mod := range override.Modifiers {
mods = append(mods, resolveMiracleModifier(mod, config.ActionKey))
}
bindings = append(bindings, MiracleKeyBinding{
Mods: mods,
Key: miracleKeyCodeToName(override.Key),
Action: override.Name,
Comment: miracleActionDescription(override.Name),
})
overridden[override.Name] = true
}
for _, def := range miracleDefaultBinds {
if overridden[def.Action] {
continue
}
bindings = append(bindings, def)
}
for _, custom := range config.CustomActions {
mods := make([]string, 0, len(custom.Modifiers))
for _, mod := range custom.Modifiers {
mods = append(mods, resolveMiracleModifier(mod, config.ActionKey))
}
bindings = append(bindings, MiracleKeyBinding{
Mods: mods,
Key: miracleKeyCodeToName(custom.Key),
Action: custom.Command,
Comment: custom.Command,
})
}
return bindings
}
func miracleActionDescription(action string) string {
switch action {
case "terminal":
return "Open terminal"
case "request_vertical":
return "Layout windows vertically"
case "request_horizontal":
return "Layout windows horizontally"
case "select_up":
return "Select window above"
case "select_down":
return "Select window below"
case "select_left":
return "Select window left"
case "select_right":
return "Select window right"
case "move_up":
return "Move window up"
case "move_down":
return "Move window down"
case "move_left":
return "Move window left"
case "move_right":
return "Move window right"
case "toggle_resize":
return "Toggle resize mode"
case "fullscreen":
return "Toggle fullscreen"
case "quit_active_window":
return "Close window"
case "quit_compositor":
return "Exit compositor"
case "toggle_floating":
return "Toggle floating"
case "toggle_pinned_to_workspace":
return "Toggle pinned to workspace"
case "toggle_tabbing":
return "Toggle tabbing layout"
case "toggle_stacking":
return "Toggle stacking layout"
case "magnifier_on":
return "Enable magnifier"
case "magnifier_off":
return "Disable magnifier"
case "magnifier_increase_size":
return "Increase magnifier area"
case "magnifier_decrease_size":
return "Decrease magnifier area"
case "magnifier_increase_scale":
return "Increase magnifier scale"
case "magnifier_decrease_scale":
return "Decrease magnifier scale"
}
if num, ok := strings.CutPrefix(action, "select_workspace_"); ok {
return "Workspace " + num
}
if num, ok := strings.CutPrefix(action, "move_to_workspace_"); ok {
return "Move to workspace " + num
}
return action
}
+11 -19
View File
@@ -3,7 +3,6 @@ package providers
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/AvengeMedia/DankMaterialShell/core/internal/keybinds"
@@ -19,21 +18,14 @@ func NewSwayProvider(configPath string) *SwayProvider {
_, scrollEnvSet := os.LookupEnv("SCROLLSOCK")
if configPath == "" {
configDir, err := os.UserConfigDir()
if err != nil {
configDir = ""
}
if scrollEnvSet {
if configDir != "" {
configPath = filepath.Join(configDir, "scroll")
}
configPath = "$HOME/.config/scroll"
isScroll = true
} else {
if configDir != "" {
configPath = filepath.Join(configDir, "sway")
}
configPath = "$HOME/.config/sway"
}
} else {
// Determine isScroll based on the provided config path
isScroll = strings.Contains(configPath, "scroll")
}
@@ -44,16 +36,16 @@ func NewSwayProvider(configPath string) *SwayProvider {
}
func (s *SwayProvider) Name() string {
if s == nil {
if os.Getenv("SCROLLSOCK") != "" {
return "scroll"
}
return "sway"
}
if s.isScroll {
if s != nil && s.isScroll {
return "scroll"
}
if s == nil {
_, ok := os.LookupEnv("SCROLLSOCK")
if ok {
return "scroll"
}
}
return "sway"
}
@@ -15,13 +15,8 @@ func TestSwayProviderName(t *testing.T) {
func TestSwayProviderDefaultPath(t *testing.T) {
provider := NewSwayProvider("")
configDir, err := os.UserConfigDir()
if err != nil {
t.Skip("UserConfigDir not available")
}
expected := filepath.Join(configDir, "sway")
if provider.configPath != expected {
t.Errorf("configPath = %q, want %q", provider.configPath, expected)
if provider.configPath != "$HOME/.config/sway" {
t.Errorf("configPath = %q, want %q", provider.configPath, "$HOME/.config/sway")
}
}
+50 -142
View File
@@ -33,7 +33,6 @@ const (
TemplateKindTerminal
TemplateKindGTK
TemplateKindVSCode
TemplateKindEmacs
)
type TemplateDef struct {
@@ -66,7 +65,7 @@ var templateRegistry = []TemplateDef{
{ID: "dgop", Commands: []string{"dgop"}, ConfigFile: "dgop.toml"},
{ID: "kcolorscheme", ConfigFile: "kcolorscheme.toml", RunUnconditionally: true},
{ID: "vscode", Kind: TemplateKindVSCode},
{ID: "emacs", Commands: []string{"emacs"}, ConfigFile: "emacs.toml", Kind: TemplateKindEmacs},
{ID: "emacs", Commands: []string{"emacs"}, ConfigFile: "emacs.toml"},
}
func (c *ColorMode) GTKTheme() string {
@@ -79,8 +78,7 @@ func (c *ColorMode) GTKTheme() string {
}
var (
matugenVersionMu sync.Mutex
matugenVersionOK bool
matugenVersionOnce sync.Once
matugenSupportsCOE bool
matugenIsV4 bool
)
@@ -336,10 +334,6 @@ output_path = '%s'
appendVSCodeConfig(cfgFile, "cursor", filepath.Join(homeDir, ".cursor/extensions"), opts.ShellDir)
appendVSCodeConfig(cfgFile, "windsurf", filepath.Join(homeDir, ".windsurf/extensions"), opts.ShellDir)
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)
}
default:
appendConfig(opts, cfgFile, tmpl.Commands, tmpl.Flatpaks, tmpl.ConfigFile)
}
@@ -497,9 +491,6 @@ func substituteVars(content, shellDir string) string {
result = strings.ReplaceAll(result, "'CONFIG_DIR/", "'"+utils.XDGConfigHome()+"/")
result = strings.ReplaceAll(result, "'DATA_DIR/", "'"+utils.XDGDataHome()+"/")
result = strings.ReplaceAll(result, "'CACHE_DIR/", "'"+utils.XDGCacheHome()+"/")
if emacsDir := utils.EmacsConfigDir(); emacsDir != "" {
result = strings.ReplaceAll(result, "'EMACS_DIR/", "'"+emacsDir+"/")
}
return result
}
@@ -520,159 +511,78 @@ func extractTOMLSection(content, startMarker, endMarker string) string {
return content[startIdx : startIdx+endIdx]
}
type matugenFlags struct {
supportsCOE bool
isV4 bool
func checkMatugenVersion() {
matugenVersionOnce.Do(func() {
cmd := exec.Command("matugen", "--version")
output, err := cmd.Output()
if err != nil {
return
}
versionStr := strings.TrimSpace(string(output))
versionStr = strings.TrimPrefix(versionStr, "matugen ")
parts := strings.Split(versionStr, ".")
if len(parts) < 2 {
return
}
major, err := strconv.Atoi(parts[0])
if err != nil {
return
}
minor, err := strconv.Atoi(parts[1])
if err != nil {
return
}
matugenSupportsCOE = major > 3 || (major == 3 && minor >= 1)
matugenIsV4 = major >= 4
if matugenSupportsCOE {
log.Infof("Matugen %s supports --continue-on-error", versionStr)
}
if matugenIsV4 {
log.Infof("Matugen %s: using v4 flags", versionStr)
}
})
}
func detectMatugenVersion() (matugenFlags, error) {
matugenVersionMu.Lock()
defer matugenVersionMu.Unlock()
if matugenVersionOK {
return matugenFlags{matugenSupportsCOE, matugenIsV4}, nil
}
return detectMatugenVersionLocked()
}
func redetectMatugenVersion(old matugenFlags) (matugenFlags, bool) {
matugenVersionMu.Lock()
defer matugenVersionMu.Unlock()
matugenVersionOK = false
flags, err := detectMatugenVersionLocked()
if err != nil {
return old, false
}
changed := flags.supportsCOE != old.supportsCOE || flags.isV4 != old.isV4
return flags, changed
}
func detectMatugenVersionLocked() (matugenFlags, error) {
cmd := exec.Command("matugen", "--version")
output, err := cmd.Output()
if err != nil {
return matugenFlags{}, fmt.Errorf("failed to get matugen version: %w", err)
}
versionStr := strings.TrimSpace(string(output))
versionStr = strings.TrimPrefix(versionStr, "matugen ")
parts := strings.Split(versionStr, ".")
if len(parts) < 2 {
return matugenFlags{}, fmt.Errorf("unexpected matugen version format: %q", versionStr)
}
major, err := strconv.Atoi(parts[0])
if err != nil {
return matugenFlags{}, fmt.Errorf("failed to parse matugen major version %q: %w", parts[0], err)
}
minor, err := strconv.Atoi(parts[1])
if err != nil {
return matugenFlags{}, fmt.Errorf("failed to parse matugen minor version %q: %w", parts[1], err)
}
matugenSupportsCOE = major > 3 || (major == 3 && minor >= 1)
matugenIsV4 = major >= 4
matugenVersionOK = true
func runMatugen(args []string) error {
checkMatugenVersion()
if matugenSupportsCOE {
log.Infof("Matugen %s supports --continue-on-error", versionStr)
args = append([]string{"--continue-on-error"}, args...)
}
if matugenIsV4 {
log.Infof("Matugen %s: using v4 flags", versionStr)
}
return matugenFlags{matugenSupportsCOE, matugenIsV4}, nil
}
func buildMatugenArgs(baseArgs []string, flags matugenFlags) []string {
args := make([]string, 0, len(baseArgs)+4)
if flags.supportsCOE {
args = append(args, "--continue-on-error")
}
args = append(args, baseArgs...)
if flags.isV4 {
args = append(args, "--source-color-index", "0")
}
return args
}
func runMatugen(baseArgs []string) error {
flags, err := detectMatugenVersion()
if err != nil {
return err
}
args := buildMatugenArgs(baseArgs, flags)
cmd := exec.Command("matugen", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
runErr := cmd.Run()
if runErr == nil {
return nil
}
log.Warnf("Matugen failed (v4=%v): %v", flags.isV4, runErr)
newFlags, changed := redetectMatugenVersion(flags)
if !changed {
return runErr
}
log.Warnf("Matugen version changed (v4: %v -> %v), retrying", flags.isV4, newFlags.isV4)
args = buildMatugenArgs(baseArgs, newFlags)
retryCmd := exec.Command("matugen", args...)
retryCmd.Stdout = os.Stdout
retryCmd.Stderr = os.Stderr
return retryCmd.Run()
return cmd.Run()
}
func runMatugenDryRun(opts *Options) (string, error) {
flags, err := detectMatugenVersion()
if err != nil {
return "", err
}
checkMatugenVersion()
output, dryErr := execDryRun(opts, flags)
if dryErr == nil {
return output, nil
}
log.Warnf("Matugen dry-run failed (v4=%v): %v", flags.isV4, dryErr)
newFlags, changed := redetectMatugenVersion(flags)
if !changed {
return "", dryErr
}
log.Warnf("Matugen version changed (v4: %v -> %v), retrying dry-run", flags.isV4, newFlags.isV4)
return execDryRun(opts, newFlags)
}
func execDryRun(opts *Options, flags matugenFlags) (string, error) {
var baseArgs []string
var args []string
switch opts.Kind {
case "hex":
baseArgs = []string{"color", "hex", opts.Value}
args = []string{"color", "hex", opts.Value}
default:
baseArgs = []string{opts.Kind, opts.Value}
args = []string{opts.Kind, opts.Value}
}
baseArgs = append(baseArgs, "-m", "dark", "-t", opts.MatugenType, "--json", "hex", "--dry-run")
if flags.isV4 {
baseArgs = append(baseArgs, "--source-color-index", "0", "--old-json-output")
args = append(args, "-m", "dark", "-t", opts.MatugenType, "--json", "hex", "--dry-run")
if matugenIsV4 {
args = append(args, "--source-color-index", "0", "--old-json-output")
}
cmd := exec.Command("matugen", baseArgs...)
var stderr strings.Builder
cmd.Stderr = &stderr
cmd := exec.Command("matugen", args...)
output, err := cmd.Output()
if err != nil {
if stderr.Len() > 0 {
return "", fmt.Errorf("matugen %v failed (v4=%v): %s", baseArgs, flags.isV4, strings.TrimSpace(stderr.String()))
}
return "", fmt.Errorf("matugen %v failed (v4=%v): %w", baseArgs, flags.isV4, err)
return "", err
}
return strings.ReplaceAll(string(output), "\n", ""), nil
}
@@ -909,8 +819,6 @@ func CheckTemplates(checker utils.AppChecker) []TemplateCheck {
detected = true
case tmpl.Kind == TemplateKindVSCode:
detected = checkVSCodeExtension(homeDir)
case tmpl.Kind == TemplateKindEmacs:
detected = appExists(checker, tmpl.Commands, tmpl.Flatpaks) && utils.EmacsConfigDir() != ""
default:
detected = appExists(checker, tmpl.Commands, tmpl.Flatpaks)
}
-10
View File
@@ -15,9 +15,6 @@ const (
notifyDest = "org.freedesktop.Notifications"
notifyPath = "/org/freedesktop/Notifications"
notifyInterface = "org.freedesktop.Notifications"
maxSummaryLen = 29
maxBodyLen = 80
)
type Notification struct {
@@ -42,13 +39,6 @@ func Send(n Notification) error {
n.Timeout = 5000
}
if len(n.Summary) > maxSummaryLen {
n.Summary = n.Summary[:maxSummaryLen-3] + "..."
}
if len(n.Body) > maxBodyLen {
n.Body = n.Body[:maxBodyLen-3] + "..."
}
var actions []string
if n.FilePath != "" {
actions = []string{
+1 -28
View File
@@ -21,7 +21,6 @@ const (
CompositorNiri
CompositorDWL
CompositorScroll
CompositorMiracle
)
var detectedCompositor Compositor = -1
@@ -35,7 +34,6 @@ func DetectCompositor() Compositor {
niriSocket := os.Getenv("NIRI_SOCKET")
swaySocket := os.Getenv("SWAYSOCK")
scrollSocket := os.Getenv("SCROLLSOCK")
miracleSocket := os.Getenv("MIRACLESOCK")
switch {
case niriSocket != "":
@@ -48,11 +46,7 @@ func DetectCompositor() Compositor {
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
@@ -266,25 +260,6 @@ func getScrollFocusedMonitor() string {
return ""
}
func getMiracleFocusedMonitor() string {
output, err := exec.Command("miraclemsg", "-t", "get_workspaces").Output()
if err != nil {
return ""
}
var workspaces []swayWorkspace
if err := json.Unmarshal(output, &workspaces); err != nil {
return ""
}
for _, ws := range workspaces {
if ws.Focused {
return ws.Output
}
}
return ""
}
type niriWorkspace struct {
Output string `json:"output"`
IsFocused bool `json:"is_focused"`
@@ -432,8 +407,6 @@ func GetFocusedMonitor() string {
return getSwayFocusedMonitor()
case CompositorScroll:
return getScrollFocusedMonitor()
case CompositorMiracle:
return getMiracleFocusedMonitor()
case CompositorNiri:
return getNiriFocusedMonitor()
case CompositorDWL:
+1 -1
View File
@@ -108,7 +108,7 @@ func NewRegionSelector(s *Screenshoter) *RegionSelector {
screenshoter: s,
outputs: make(map[uint32]*WaylandOutput),
preCapture: make(map[*WaylandOutput]*PreCapture),
showCapturedCursor: s.config.Cursor == CursorOn,
showCapturedCursor: true,
}
}
+8 -2
View File
@@ -453,7 +453,10 @@ func (s *Screenshoter) blitBuffer(dst, src *ShmBuffer, dstX, dstY int, yInverted
}
func (s *Screenshoter) captureWholeOutput(output *WaylandOutput) (*CaptureResult, error) {
cursor := int32(s.config.Cursor)
cursor := int32(0)
if s.config.IncludeCursor {
cursor = 1
}
frame, err := s.screencopy.CaptureOutput(cursor, output.wlOutput)
if err != nil {
@@ -621,7 +624,10 @@ func (s *Screenshoter) captureRegionOnOutput(output *WaylandOutput, region Regio
}
}
cursor := int32(s.config.Cursor)
cursor := int32(0)
if s.config.IncludeCursor {
cursor = 1
}
frame, err := s.screencopy.CaptureOutputRegion(cursor, output.wlOutput, localX, localY, w, h)
if err != nil {
+20 -27
View File
@@ -19,13 +19,6 @@ const (
FormatPPM
)
type CursorMode int
const (
CursorOff CursorMode = iota
CursorOn
)
type Region struct {
X int32 `json:"x"`
Y int32 `json:"y"`
@@ -49,29 +42,29 @@ type Output struct {
}
type Config struct {
Mode Mode
OutputName string
Cursor CursorMode
Format Format
Quality int
OutputDir string
Filename string
Clipboard bool
SaveFile bool
Notify bool
Stdout bool
Mode Mode
OutputName string
IncludeCursor bool
Format Format
Quality int
OutputDir string
Filename string
Clipboard bool
SaveFile bool
Notify bool
Stdout bool
}
func DefaultConfig() Config {
return Config{
Mode: ModeRegion,
Cursor: CursorOff,
Format: FormatPNG,
Quality: 90,
OutputDir: "",
Filename: "",
Clipboard: true,
SaveFile: true,
Notify: true,
Mode: ModeRegion,
IncludeCursor: false,
Format: FormatPNG,
Quality: 90,
OutputDir: "",
Filename: "",
Clipboard: true,
SaveFile: true,
Notify: true,
}
}
@@ -52,31 +52,11 @@ func (m *Manager) initializeScreensaver() error {
return nil
}
screensaverIface := introspect.Interface{
Name: dbusScreensaverInterface,
Methods: []introspect.Method{
{
Name: "Inhibit",
Args: []introspect.Arg{
{Name: "application_name", Type: "s", Direction: "in"},
{Name: "reason_for_inhibit", Type: "s", Direction: "in"},
{Name: "cookie", Type: "u", Direction: "out"},
},
},
{
Name: "UnInhibit",
Args: []introspect.Arg{
{Name: "cookie", Type: "u", Direction: "in"},
},
},
},
}
introNode := &introspect.Node{
Name: dbusScreensaverPath,
Interfaces: []introspect.Interface{
introspect.IntrospectData,
screensaverIface,
{Name: dbusScreensaverInterface},
},
}
if err := m.sessionConn.Export(introspect.NewIntrospectable(introNode), dbusScreensaverPath, "org.freedesktop.DBus.Introspectable"); err != nil {
@@ -87,7 +67,7 @@ func (m *Manager) initializeScreensaver() error {
Name: dbusScreensaverPath2,
Interfaces: []introspect.Interface{
introspect.IntrospectData,
screensaverIface,
{Name: dbusScreensaverInterface},
},
}
if err := m.sessionConn.Export(introspect.NewIntrospectable(introNode2), dbusScreensaverPath2, "org.freedesktop.DBus.Introspectable"); err != nil {
@@ -32,10 +32,8 @@ type SecretAgent struct {
backend *NetworkManagerBackend
}
type (
nmVariantMap map[string]dbus.Variant
nmSettingMap map[string]nmVariantMap
)
type nmVariantMap map[string]dbus.Variant
type nmSettingMap map[string]nmVariantMap
const introspectXML = `
<node>
@@ -310,63 +308,6 @@ func (a *SecretAgent) GetSecrets(
return out, nil
}
a.backend.cachedVPNCredsMu.Unlock()
a.backend.cachedGPSamlMu.Lock()
cachedGPSaml := a.backend.cachedGPSamlCookie
if cachedGPSaml != nil && cachedGPSaml.ConnectionUUID == connUuid {
a.backend.cachedGPSamlMu.Unlock()
log.Infof("[SecretAgent] Using cached GlobalProtect SAML cookie for %s", connUuid)
return buildGPSamlSecretsResponse(settingName, cachedGPSaml.Cookie, cachedGPSaml.Host, cachedGPSaml.Fingerprint), nil
}
a.backend.cachedGPSamlMu.Unlock()
if len(fields) == 1 && fields[0] == "gp-saml" {
gateway := ""
protocol := ""
if vpnSettings, ok := conn["vpn"]; ok {
if dataVariant, ok := vpnSettings["data"]; ok {
if dataMap, ok := dataVariant.Value().(map[string]string); ok {
if gw, ok := dataMap["gateway"]; ok {
gateway = gw
}
if proto, ok := dataMap["protocol"]; ok && proto != "" {
protocol = proto
}
}
}
}
if protocol != "gp" {
return nil, dbus.MakeFailedError(fmt.Errorf("gp-saml auth only supported for GlobalProtect (protocol=gp), got: %s", protocol))
}
log.Infof("[SecretAgent] Starting GlobalProtect SAML authentication for gateway=%s", gateway)
samlCtx, samlCancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer samlCancel()
authResult, err := a.backend.runGlobalProtectSAMLAuth(samlCtx, gateway, protocol)
if err != nil {
log.Warnf("[SecretAgent] GlobalProtect SAML authentication failed: %v", err)
return nil, dbus.MakeFailedError(fmt.Errorf("GlobalProtect SAML authentication failed: %w", err))
}
log.Infof("[SecretAgent] GlobalProtect SAML authentication successful, returning cookie to NetworkManager")
a.backend.cachedGPSamlMu.Lock()
a.backend.cachedGPSamlCookie = &cachedGPSamlCookie{
ConnectionUUID: connUuid,
Cookie: authResult.Cookie,
Host: authResult.Host,
User: authResult.User,
Fingerprint: authResult.Fingerprint,
}
a.backend.cachedGPSamlMu.Unlock()
return buildGPSamlSecretsResponse(settingName, authResult.Cookie, authResult.Host, authResult.Fingerprint), nil
}
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
@@ -718,25 +659,12 @@ func inferVPNFields(conn map[string]nmVariantMap, vpnService string) []string {
switch {
case strings.Contains(vpnService, "openconnect"):
protocol := dataMap["protocol"]
authType := dataMap["authtype"]
username := dataMap["username"]
if authType == "cert" && strings.HasPrefix(dataMap["usercert"], "pkcs11:") {
userCert := dataMap["usercert"]
if authType == "cert" && strings.HasPrefix(userCert, "pkcs11:") {
return []string{"key_pass"}
}
if needsExternalBrowserAuth(protocol, authType, username, dataMap) {
switch protocol {
case "gp":
log.Infof("[SecretAgent] GlobalProtect SAML auth detected")
return []string{"gp-saml"}
default:
log.Infof("[SecretAgent] External browser auth detected for protocol '%s' but only GlobalProtect (gp) SAML is currently supported, falling back to credentials", protocol)
}
}
if username == "" {
if dataMap["username"] == "" {
fields = []string{"username", "password"}
}
case strings.Contains(vpnService, "openvpn"):
@@ -755,31 +683,8 @@ func inferVPNFields(conn map[string]nmVariantMap, vpnService string) []string {
return fields
}
func needsExternalBrowserAuth(protocol, authType, username string, data map[string]string) bool {
if method, ok := data["saml-auth-method"]; ok {
if method == "REDIRECT" || method == "POST" {
return true
}
}
if authType != "" && authType != "password" && authType != "cert" {
return true
}
switch protocol {
case "gp":
if authType == "" && username == "" {
return true
}
}
return false
}
func vpnFieldMeta(field, vpnService string) (label string, isSecret bool) {
switch field {
case "gp-saml":
return "GlobalProtect SAML/SSO", false
case "key_pass":
return "PIN", true
case "password":
@@ -880,18 +785,3 @@ func reasonFromFlags(flags uint32) string {
}
return "required"
}
func buildGPSamlSecretsResponse(settingName, cookie, host, fingerprint string) nmSettingMap {
out := nmSettingMap{}
vpnSec := nmVariantMap{}
secrets := map[string]string{
"cookie": cookie,
"gateway": host,
"gwcert": fingerprint,
}
vpnSec["secrets"] = dbus.MakeVariant(secrets)
out[settingName] = vpnSec
return out
}
@@ -1,355 +0,0 @@
package network
import (
"testing"
"github.com/godbus/dbus/v5"
"github.com/stretchr/testify/assert"
)
func TestNeedsExternalBrowserAuth(t *testing.T) {
tests := []struct {
name string
protocol string
authType string
username string
data map[string]string
expected bool
}{
{
name: "GP with saml-auth-method REDIRECT",
protocol: "gp",
authType: "password",
username: "user",
data: map[string]string{"saml-auth-method": "REDIRECT"},
expected: true,
},
{
name: "GP with saml-auth-method POST",
protocol: "gp",
authType: "password",
username: "user",
data: map[string]string{"saml-auth-method": "POST"},
expected: true,
},
{
name: "GP with no authtype and no username",
protocol: "gp",
authType: "",
username: "",
data: map[string]string{},
expected: true,
},
{
name: "GP with username and password authtype",
protocol: "gp",
authType: "password",
username: "john",
data: map[string]string{},
expected: false,
},
{
name: "GP with username but no authtype",
protocol: "gp",
authType: "",
username: "john",
data: map[string]string{},
expected: false,
},
{
name: "GP with authtype but no username - should detect SAML",
protocol: "gp",
authType: "",
username: "",
data: map[string]string{},
expected: true,
},
{
name: "pulse with SAML",
protocol: "pulse",
authType: "",
username: "",
data: map[string]string{"saml-auth-method": "REDIRECT"},
expected: true,
},
{
name: "fortinet with non-password authtype",
protocol: "fortinet",
authType: "saml",
username: "",
data: map[string]string{},
expected: true,
},
{
name: "anyconnect with cert",
protocol: "anyconnect",
authType: "cert",
username: "",
data: map[string]string{},
expected: false,
},
{
name: "anyconnect with password",
protocol: "anyconnect",
authType: "password",
username: "user",
data: map[string]string{},
expected: false,
},
{
name: "empty protocol",
protocol: "",
authType: "",
username: "",
data: map[string]string{},
expected: false,
},
{
name: "GP with cert authtype",
protocol: "gp",
authType: "cert",
username: "",
data: map[string]string{},
expected: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := needsExternalBrowserAuth(tt.protocol, tt.authType, tt.username, tt.data)
assert.Equal(t, tt.expected, result)
})
}
}
func TestBuildGPSamlSecretsResponse(t *testing.T) {
tests := []struct {
name string
settingName string
cookie string
host string
fingerprint string
}{
{
name: "all fields populated",
settingName: "vpn",
cookie: "authcookie=abc123&portal=GATE",
host: "vpn.example.com",
fingerprint: "pin-sha256:ABCD1234",
},
{
name: "empty fingerprint",
settingName: "vpn",
cookie: "authcookie=xyz",
host: "10.0.0.1",
fingerprint: "",
},
{
name: "complex cookie with special chars",
settingName: "vpn",
cookie: "authcookie=077058d3bc81&portal=PANGP_GW_01-N&user=john.doe@example.com&domain=Default&preferred-ip=192.168.1.100",
host: "connect.seclore.com",
fingerprint: "pin-sha256:xp3scfzy3rOgQEXnfPiYKrUk7D66a8b8O+gEXaMPleE=",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := buildGPSamlSecretsResponse(tt.settingName, tt.cookie, tt.host, tt.fingerprint)
assert.NotNil(t, result)
assert.Contains(t, result, tt.settingName)
vpnSec := result[tt.settingName]
assert.NotNil(t, vpnSec)
secretsVariant, ok := vpnSec["secrets"]
assert.True(t, ok, "secrets key should exist")
secrets, ok := secretsVariant.Value().(map[string]string)
assert.True(t, ok, "secrets should be map[string]string")
assert.Equal(t, tt.cookie, secrets["cookie"])
assert.Equal(t, tt.host, secrets["gateway"])
assert.Equal(t, tt.fingerprint, secrets["gwcert"])
})
}
}
func TestVpnFieldMeta_GPSaml(t *testing.T) {
label, isSecret := vpnFieldMeta("gp-saml", "org.freedesktop.NetworkManager.openconnect")
assert.Equal(t, "GlobalProtect SAML/SSO", label)
assert.False(t, isSecret, "gp-saml should not be marked as secret")
}
func TestVpnFieldMeta_StandardFields(t *testing.T) {
tests := []struct {
field string
vpnService string
expectedLabel string
expectedSecret bool
}{
{
field: "username",
vpnService: "org.freedesktop.NetworkManager.openconnect",
expectedLabel: "Username",
expectedSecret: false,
},
{
field: "password",
vpnService: "org.freedesktop.NetworkManager.openconnect",
expectedLabel: "Password",
expectedSecret: true,
},
{
field: "key_pass",
vpnService: "org.freedesktop.NetworkManager.openconnect",
expectedLabel: "PIN",
expectedSecret: true,
},
}
for _, tt := range tests {
t.Run(tt.field, func(t *testing.T) {
label, isSecret := vpnFieldMeta(tt.field, tt.vpnService)
assert.Equal(t, tt.expectedLabel, label)
assert.Equal(t, tt.expectedSecret, isSecret)
})
}
}
func TestInferVPNFields_GPSaml(t *testing.T) {
tests := []struct {
name string
vpnService string
dataMap map[string]string
expectedLen int
shouldHave []string
}{
{
name: "GP with no authtype and no username - should require SAML",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
},
expectedLen: 1,
shouldHave: []string{"gp-saml"},
},
{
name: "GP with saml-auth-method REDIRECT",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
"saml-auth-method": "REDIRECT",
"username": "john",
},
expectedLen: 1,
shouldHave: []string{"gp-saml"},
},
{
name: "GP with saml-auth-method POST",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
"saml-auth-method": "POST",
},
expectedLen: 1,
shouldHave: []string{"gp-saml"},
},
{
name: "GP with username and password authtype - should use credentials",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
"authtype": "password",
"username": "john",
},
expectedLen: 1,
shouldHave: []string{"password"},
},
{
name: "GP with username but no authtype - password only",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
"username": "john",
},
expectedLen: 1,
shouldHave: []string{"password"},
},
{
name: "GP with PKCS11 cert",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "gp",
"gateway": "vpn.example.com",
"authtype": "cert",
"usercert": "pkcs11:model=PKCS%2315%20emulated;manufacturer=piv_II",
},
expectedLen: 1,
shouldHave: []string{"key_pass"},
},
{
name: "non-GP protocol (anyconnect)",
vpnService: "org.freedesktop.NetworkManager.openconnect",
dataMap: map[string]string{
"protocol": "anyconnect",
"gateway": "vpn.example.com",
},
expectedLen: 2,
shouldHave: []string{"username", "password"},
},
{
name: "OpenVPN with username",
vpnService: "org.freedesktop.NetworkManager.openvpn",
dataMap: map[string]string{
"connection-type": "password",
"username": "john",
},
expectedLen: 1,
shouldHave: []string{"password"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Convert dataMap to nmVariantMap
vpnSettings := make(nmVariantMap)
vpnSettings["data"] = dbus.MakeVariant(tt.dataMap)
vpnSettings["service-type"] = dbus.MakeVariant(tt.vpnService)
conn := make(map[string]nmVariantMap)
conn["vpn"] = vpnSettings
fields := inferVPNFields(conn, tt.vpnService)
assert.Len(t, fields, tt.expectedLen, "unexpected number of fields")
if len(tt.shouldHave) > 0 {
for _, expected := range tt.shouldHave {
assert.Contains(t, fields, expected, "should contain field: %s", expected)
}
}
})
}
}
func TestNmVariantMap(t *testing.T) {
// Test that nmVariantMap and nmSettingMap work correctly
settingMap := make(nmSettingMap)
variantMap := make(nmVariantMap)
variantMap["test-key"] = dbus.MakeVariant("test-value")
settingMap["test-setting"] = variantMap
assert.Contains(t, settingMap, "test-setting")
assert.Contains(t, settingMap["test-setting"], "test-key")
value := settingMap["test-setting"]["test-key"].Value()
assert.Equal(t, "test-value", value)
}
@@ -69,14 +69,12 @@ type NetworkManagerBackend struct {
lastFailedTime int64
failedMutex sync.RWMutex
pendingVPNSave *pendingVPNCredentials
pendingVPNSaveMu sync.Mutex
cachedVPNCreds *cachedVPNCredentials
cachedVPNCredsMu sync.Mutex
cachedPKCS11PIN *cachedPKCS11PIN
cachedPKCS11Mu sync.Mutex
cachedGPSamlCookie *cachedGPSamlCookie
cachedGPSamlMu sync.Mutex
pendingVPNSave *pendingVPNCredentials
pendingVPNSaveMu sync.Mutex
cachedVPNCreds *cachedVPNCredentials
cachedVPNCredsMu sync.Mutex
cachedPKCS11PIN *cachedPKCS11PIN
cachedPKCS11Mu sync.Mutex
onStateChange func()
}
@@ -99,14 +97,6 @@ type cachedPKCS11PIN struct {
PIN string
}
type cachedGPSamlCookie struct {
ConnectionUUID string
Cookie string
Host string
User string
Fingerprint string
}
func NewNetworkManagerBackend(nmConn ...gonetworkmanager.NetworkManager) (*NetworkManagerBackend, error) {
var nm gonetworkmanager.NetworkManager
var err error
@@ -1,203 +0,0 @@
package network
import (
"bufio"
"context"
"fmt"
"os/exec"
"strings"
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
)
type gpSamlAuthResult struct {
Cookie string
Host string
User string
Fingerprint string
}
// runGlobalProtectSAMLAuth handles GlobalProtect SAML/SSO authentication using gp-saml-gui.
// Only supports protocol=gp. Other protocols need their own implementations.
func (b *NetworkManagerBackend) runGlobalProtectSAMLAuth(ctx context.Context, gateway, protocol string) (*gpSamlAuthResult, error) {
if gateway == "" {
return nil, fmt.Errorf("GP SAML auth: gateway is empty")
}
if protocol != "gp" {
return nil, fmt.Errorf("only GlobalProtect (protocol=gp) SAML is supported, got: %s", protocol)
}
log.Infof("[GP-SAML] Starting GlobalProtect SAML authentication with gp-saml-gui for gateway=%s", gateway)
gpSamlPath, err := exec.LookPath("gp-saml-gui")
if err != nil {
return nil, fmt.Errorf("GlobalProtect SAML requires gp-saml-gui (install: pip install gp-saml-gui): %w", err)
}
args := []string{
"--gateway",
"--allow-insecure-crypto",
gateway,
}
cmd := exec.CommandContext(ctx, gpSamlPath, args...)
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, fmt.Errorf("GP SAML auth: failed to create stdout pipe: %w", err)
}
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, fmt.Errorf("GP SAML auth: failed to create stderr pipe: %w", err)
}
if err := cmd.Start(); err != nil {
return nil, fmt.Errorf("GP SAML auth: failed to start gp-saml-gui: %w", err)
}
go func() {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
log.Debugf("[GP-SAML] gp-saml-gui: %s", scanner.Text())
}
}()
result := &gpSamlAuthResult{Host: gateway}
var allOutput []string
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
line := scanner.Text()
allOutput = append(allOutput, line)
log.Infof("[GP-SAML] stdout: %s", line)
switch {
case strings.HasPrefix(line, "COOKIE="):
result.Cookie = unshellQuote(strings.TrimPrefix(line, "COOKIE="))
case strings.HasPrefix(line, "HOST="):
result.Host = unshellQuote(strings.TrimPrefix(line, "HOST="))
case strings.HasPrefix(line, "USER="):
result.User = unshellQuote(strings.TrimPrefix(line, "USER="))
case strings.HasPrefix(line, "FINGERPRINT="):
result.Fingerprint = unshellQuote(strings.TrimPrefix(line, "FINGERPRINT="))
default:
parseGPSamlFromCommandLine(line, result)
}
}
if err := cmd.Wait(); err != nil {
if ctx.Err() != nil {
return nil, fmt.Errorf("GP SAML auth timed out or was cancelled: %w", ctx.Err())
}
if result.Cookie == "" {
return nil, fmt.Errorf("GP SAML auth failed: %w (output: %s)", err, strings.Join(allOutput, "\n"))
}
log.Warnf("[GP-SAML] gp-saml-gui exited with error but cookie was captured: %v", err)
}
if result.Cookie == "" {
return nil, fmt.Errorf("GP SAML auth: no cookie in gp-saml-gui output")
}
log.Infof("[GP-SAML] Got prelogin-cookie from gp-saml-gui, converting to openconnect cookie via --authenticate")
// Convert prelogin-cookie to full openconnect cookie format
ocResult, err := convertGPPreloginCookie(ctx, gateway, result.Cookie, result.User)
if err != nil {
return nil, fmt.Errorf("GP SAML auth: failed to convert prelogin-cookie: %w", err)
}
result.Cookie = ocResult.Cookie
result.Host = ocResult.Host
result.Fingerprint = ocResult.Fingerprint
log.Infof("[GP-SAML] Authentication successful: user=%s, host=%s, cookie_len=%d, has_fingerprint=%v",
result.User, result.Host, len(result.Cookie), result.Fingerprint != "")
return result, nil
}
func convertGPPreloginCookie(ctx context.Context, gateway, preloginCookie, user string) (*gpSamlAuthResult, error) {
ocPath, err := exec.LookPath("openconnect")
if err != nil {
return nil, fmt.Errorf("openconnect not found: %w", err)
}
args := []string{
"--protocol=gp",
"--usergroup=gateway:prelogin-cookie",
"--user=" + user,
"--passwd-on-stdin",
"--allow-insecure-crypto",
"--authenticate",
gateway,
}
cmd := exec.CommandContext(ctx, ocPath, args...)
cmd.Stdin = strings.NewReader(preloginCookie)
output, err := cmd.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("openconnect --authenticate failed: %w\noutput: %s", err, string(output))
}
result := &gpSamlAuthResult{}
for _, line := range strings.Split(string(output), "\n") {
line = strings.TrimSpace(line)
switch {
case strings.HasPrefix(line, "COOKIE="):
result.Cookie = unshellQuote(strings.TrimPrefix(line, "COOKIE="))
case strings.HasPrefix(line, "HOST="):
result.Host = unshellQuote(strings.TrimPrefix(line, "HOST="))
case strings.HasPrefix(line, "FINGERPRINT="):
result.Fingerprint = unshellQuote(strings.TrimPrefix(line, "FINGERPRINT="))
case strings.HasPrefix(line, "CONNECT_URL="):
connectURL := unshellQuote(strings.TrimPrefix(line, "CONNECT_URL="))
if connectURL != "" && result.Host == "" {
result.Host = connectURL
}
}
}
if result.Cookie == "" {
return nil, fmt.Errorf("no COOKIE in openconnect --authenticate output: %s", string(output))
}
log.Infof("[GP-SAML] openconnect --authenticate: cookie_len=%d, host=%s, fingerprint=%s",
len(result.Cookie), result.Host, result.Fingerprint)
return result, nil
}
func unshellQuote(s string) string {
if len(s) >= 2 {
if (s[0] == '\'' && s[len(s)-1] == '\'') ||
(s[0] == '"' && s[len(s)-1] == '"') {
return s[1 : len(s)-1]
}
}
return s
}
func parseGPSamlFromCommandLine(line string, result *gpSamlAuthResult) {
if !strings.Contains(line, "openconnect") {
return
}
for _, part := range strings.Fields(line) {
switch {
case strings.HasPrefix(part, "--cookie="):
if result.Cookie == "" {
result.Cookie = strings.TrimPrefix(part, "--cookie=")
}
case strings.HasPrefix(part, "--servercert="):
if result.Fingerprint == "" {
result.Fingerprint = strings.TrimPrefix(part, "--servercert=")
}
case strings.HasPrefix(part, "--user="):
if result.User == "" {
result.User = strings.TrimPrefix(part, "--user=")
}
}
}
}
@@ -1,169 +0,0 @@
package network
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUnshellQuote(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "single quoted",
input: "'hello world'",
expected: "hello world",
},
{
name: "double quoted",
input: `"hello world"`,
expected: "hello world",
},
{
name: "unquoted",
input: "hello",
expected: "hello",
},
{
name: "empty single quotes",
input: "''",
expected: "",
},
{
name: "empty double quotes",
input: `""`,
expected: "",
},
{
name: "single quote only",
input: "'",
expected: "'",
},
{
name: "mismatched quotes",
input: "'hello\"",
expected: "'hello\"",
},
{
name: "with special chars",
input: "'cookie=abc123&user=john'",
expected: "cookie=abc123&user=john",
},
{
name: "complex cookie",
input: `'authcookie=077058d3bc81&portal=PANGP_GW_01-N&user=john.doe@example.com&domain=Default&preferred-ip=192.168.1.100'`,
expected: "authcookie=077058d3bc81&portal=PANGP_GW_01-N&user=john.doe@example.com&domain=Default&preferred-ip=192.168.1.100",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := unshellQuote(tt.input)
assert.Equal(t, tt.expected, result)
})
}
}
func TestParseGPSamlFromCommandLine(t *testing.T) {
tests := []struct {
name string
line string
initialResult *gpSamlAuthResult
expectedCookie string
expectedUser string
expectedFP string
}{
{
name: "full openconnect command",
line: "openconnect --protocol=gp --cookie=AUTH123 --servercert=pin-sha256:ABC --user=john",
initialResult: &gpSamlAuthResult{},
expectedCookie: "AUTH123",
expectedUser: "john",
expectedFP: "pin-sha256:ABC",
},
{
name: "with equals signs in cookie",
line: "openconnect --cookie=authcookie=xyz123&portal=GATE --user=jane",
initialResult: &gpSamlAuthResult{},
expectedCookie: "authcookie=xyz123&portal=GATE",
expectedUser: "jane",
expectedFP: "",
},
{
name: "non-openconnect line",
line: "some other output",
initialResult: &gpSamlAuthResult{},
expectedCookie: "",
expectedUser: "",
expectedFP: "",
},
{
name: "preserves existing values",
line: "openconnect --user=newuser",
initialResult: &gpSamlAuthResult{Cookie: "existing", Fingerprint: "existing-fp"},
expectedCookie: "existing",
expectedUser: "newuser",
expectedFP: "existing-fp",
},
{
name: "only updates empty fields",
line: "openconnect --cookie=NEW --user=NEW",
initialResult: &gpSamlAuthResult{Cookie: "OLD"},
expectedCookie: "OLD",
expectedUser: "NEW",
expectedFP: "",
},
{
name: "real gp-saml-gui output",
line: "openconnect --protocol=gp --user=john.doe@example.com --os=linux-64 --usergroup=gateway:prelogin-cookie --passwd-on-stdin",
initialResult: &gpSamlAuthResult{},
expectedCookie: "",
expectedUser: "john.doe@example.com",
expectedFP: "",
},
{
name: "with server cert flag",
line: "openconnect --servercert=pin-sha256:xp3scfzy3rOgQEXnfPiYKrUk7D66a8b8O+gEXaMPleE= vpn.example.com",
initialResult: &gpSamlAuthResult{},
expectedCookie: "",
expectedUser: "",
expectedFP: "pin-sha256:xp3scfzy3rOgQEXnfPiYKrUk7D66a8b8O+gEXaMPleE=",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := tt.initialResult
parseGPSamlFromCommandLine(tt.line, result)
assert.Equal(t, tt.expectedCookie, result.Cookie, "cookie mismatch")
assert.Equal(t, tt.expectedUser, result.User, "user mismatch")
assert.Equal(t, tt.expectedFP, result.Fingerprint, "fingerprint mismatch")
})
}
}
func TestParseGPSamlFromCommandLine_MultipleLines(t *testing.T) {
// Simulate gp-saml-gui output with command line suggestion
lines := []string{
"",
"SAML REDIRECT",
"Got SAML Login URL",
"POST to ACS endpoint...",
"Got 'prelogin-cookie': 'FAKE_cookie_12345'",
"openconnect --protocol=gp --user=john.doe@example.com --usergroup=gateway:prelogin-cookie --passwd-on-stdin vpn.example.com",
"",
}
result := &gpSamlAuthResult{}
for _, line := range lines {
parseGPSamlFromCommandLine(line, result)
}
assert.Equal(t, "john.doe@example.com", result.User)
assert.Empty(t, result.Cookie, "cookie should not be parsed from command line")
assert.Empty(t, result.Fingerprint)
}
@@ -304,51 +304,6 @@ func (b *NetworkManagerBackend) ConnectVPN(uuidOrName string, singleActive bool)
if err := b.handleOpenVPNUsernameAuth(targetConn, connName, targetUUID, vpnServiceType); err != nil {
return err
}
case "gp_saml":
gateway := vpnData["gateway"]
protocol := vpnData["protocol"]
if protocol != "gp" {
return fmt.Errorf("GlobalProtect SAML authentication only supported for protocol=gp, got: %s", protocol)
}
log.Infof("[ConnectVPN] GlobalProtect SAML/SSO authentication required for %s (gateway=%s)", connName, gateway)
samlCtx, samlCancel := context.WithTimeout(context.Background(), 5*time.Minute)
authResult, err := b.runGlobalProtectSAMLAuth(samlCtx, gateway, protocol)
samlCancel()
if err != nil {
errMsg := err.Error()
switch {
case strings.Contains(errMsg, "not installed"):
return fmt.Errorf("gp-saml-gui is not installed (required for GlobalProtect SAML/SSO VPN)")
case strings.Contains(errMsg, "timed out") || strings.Contains(errMsg, "cancelled"):
return fmt.Errorf("GlobalProtect SAML authentication timed out — please try again")
case strings.Contains(errMsg, "no cookie"):
return fmt.Errorf("GlobalProtect SAML login did not complete — browser was closed before authentication finished")
case strings.Contains(errMsg, "convert prelogin-cookie"):
return fmt.Errorf("GlobalProtect VPN authentication succeeded but cookie exchange failed: %w", err)
default:
return fmt.Errorf("GlobalProtect SAML authentication failed: %w", err)
}
}
b.cachedGPSamlMu.Lock()
b.cachedGPSamlCookie = &cachedGPSamlCookie{
ConnectionUUID: targetUUID,
Cookie: authResult.Cookie,
Host: authResult.Host,
User: authResult.User,
Fingerprint: authResult.Fingerprint,
}
b.cachedGPSamlMu.Unlock()
if err := targetConn.ClearSecrets(); err != nil {
log.Warnf("[ConnectVPN] ClearSecrets failed (non-fatal): %v", err)
} else {
log.Infof("[ConnectVPN] Cleared stale stored secrets for %s", connName)
}
log.Infof("[ConnectVPN] GlobalProtect SAML cookie cached for %s, proceeding with activation", connName)
}
b.stateMutex.Lock()
@@ -384,16 +339,6 @@ func detectVPNAuthAction(serviceType string, data map[string]string) string {
}
switch {
case strings.Contains(serviceType, "openconnect"):
protocol := data["protocol"]
if needsExternalBrowserAuth(protocol, data["authtype"], data["username"], data) {
switch protocol {
case "gp":
return "gp_saml"
default:
log.Infof("[VPN] External browser auth detected for protocol '%s' but only GlobalProtect (gp) is currently supported", protocol)
}
}
case strings.Contains(serviceType, "openvpn"):
connType := data["connection-type"]
username := data["username"]
@@ -725,13 +670,10 @@ func (b *NetworkManagerBackend) updateVPNConnectionState() {
b.state.LastError = ""
b.stateMutex.Unlock()
// Clear cached PKCS11 PIN and SAML cookie on success
// Clear cached PKCS11 PIN on success
b.cachedPKCS11Mu.Lock()
b.cachedPKCS11PIN = nil
b.cachedPKCS11Mu.Unlock()
b.cachedGPSamlMu.Lock()
b.cachedGPSamlCookie = nil
b.cachedGPSamlMu.Unlock()
b.pendingVPNSaveMu.Lock()
pending := b.pendingVPNSave
@@ -750,13 +692,10 @@ func (b *NetworkManagerBackend) updateVPNConnectionState() {
b.state.LastError = "VPN connection failed"
b.stateMutex.Unlock()
// Clear cached PKCS11 PIN and SAML cookie on failure
// Clear cached PKCS11 PIN on failure
b.cachedPKCS11Mu.Lock()
b.cachedPKCS11PIN = nil
b.cachedPKCS11Mu.Unlock()
b.cachedGPSamlMu.Lock()
b.cachedGPSamlCookie = nil
b.cachedGPSamlMu.Unlock()
return
}
}
@@ -770,13 +709,10 @@ func (b *NetworkManagerBackend) updateVPNConnectionState() {
b.state.LastError = "VPN connection failed"
b.stateMutex.Unlock()
// Clear cached PKCS11 PIN and SAML cookie
// Clear cached PKCS11 PIN
b.cachedPKCS11Mu.Lock()
b.cachedPKCS11PIN = nil
b.cachedPKCS11Mu.Unlock()
b.cachedGPSamlMu.Lock()
b.cachedGPSamlCookie = nil
b.cachedGPSamlMu.Unlock()
}
}
-16
View File
@@ -38,22 +38,6 @@ func XDGConfigHome() string {
return filepath.Join(home, ".config")
}
func EmacsConfigDir() string {
home, _ := os.UserHomeDir()
emacsD := filepath.Join(home, ".emacs.d")
if info, err := os.Stat(emacsD); err == nil && info.IsDir() {
return emacsD
}
xdgEmacs := filepath.Join(XDGConfigHome(), "emacs")
if info, err := os.Stat(xdgEmacs); err == nil && info.IsDir() {
return xdgEmacs
}
return ""
}
func ExpandPath(path string) (string, error) {
expanded := os.ExpandEnv(path)
expanded = filepath.Clean(expanded)
-1
View File
@@ -73,7 +73,6 @@ in
"labwc"
"mango"
"scroll"
"miracle"
];
description = "Compositor to run greeter in";
};
-1
View File
@@ -50,6 +50,5 @@ in
services.power-profiles-daemon.enable = lib.mkDefault true;
services.accounts-daemon.enable = lib.mkDefault true;
security.polkit.enable = lib.mkDefault true;
};
}
+1 -2
View File
@@ -48,7 +48,6 @@
sonnet
qtmultimedia
qtimageformats
kimageformats
];
in
{
@@ -80,7 +79,7 @@
inherit version;
pname = "dms-shell";
src = ./core;
vendorHash = "sha256-cVUJXgzYMRSM0od1xzDVkMTdxHu3OIQX2bQ8AJbGQ1Q=";
vendorHash = "sha256-Ij5jlmWpZkqQU8j8HXLt6RsRDK3pKfhLBbjlRq5UZms=";
subPackages = [ "cmd/dms" ];
-16
View File
@@ -123,8 +123,6 @@ Singleton {
property string vpnLastConnected: ""
property var deviceMaxVolumes: ({})
property var hiddenOutputDeviceNames: []
property var hiddenInputDeviceNames: []
Component.onCompleted: {
if (!isGreeterMode) {
@@ -1071,20 +1069,6 @@ Singleton {
saveSettings();
}
function setHiddenOutputDeviceNames(deviceNames) {
if (!Array.isArray(deviceNames))
return;
hiddenOutputDeviceNames = deviceNames;
saveSettings();
}
function setHiddenInputDeviceNames(deviceNames) {
if (!Array.isArray(deviceNames))
return;
hiddenInputDeviceNames = deviceNames;
saveSettings();
}
function getDeviceMaxVolume(nodeName) {
if (!nodeName)
return 100;
+2 -146
View File
@@ -60,7 +60,6 @@ Singleton {
property bool _hasLoaded: false
property bool _isReadOnly: false
property bool _hasUnsavedChanges: false
property bool _selfWrite: false
property var _loadedSettingsSnapshot: null
property var pluginSettings: ({})
property var builtInPluginSettings: ({})
@@ -315,7 +314,7 @@ Singleton {
property int dankLauncherV2BorderThickness: 2
property string dankLauncherV2BorderColor: "primary"
property bool dankLauncherV2ShowFooter: true
property bool dankLauncherV2UnloadOnClose: false
property bool dankLauncherV2UnloadOnClose: true
property string _legacyWeatherLocation: "New York, NY"
property string _legacyWeatherCoordinates: "40.7128,-74.0060"
@@ -473,8 +472,6 @@ Singleton {
property bool dockShowOverflowBadge: true
property bool notificationOverlayEnabled: false
property bool notificationPopupShadowEnabled: true
property bool notificationPopupPrivacyMode: false
property int overviewRows: 2
property int overviewColumns: 5
property real overviewScale: 0.16
@@ -504,8 +501,6 @@ Singleton {
property int notificationTimeoutCritical: 0
property bool notificationCompactMode: false
property int notificationPopupPosition: SettingsData.Position.Top
property int notificationAnimationSpeed: SettingsData.AnimationSpeed.Short
property int notificationCustomAnimationDuration: 400
property bool notificationHistoryEnabled: true
property int notificationHistoryMaxCount: 50
property int notificationHistoryMaxAgeDays: 7
@@ -1015,42 +1010,6 @@ Singleton {
function applyStoredIconTheme() {
updateGtkIconTheme();
updateQtIconTheme();
updateCosmicIconTheme();
}
function updateCosmicIconTheme() {
let cosmicThemeName = (iconTheme === "System Default") ? systemDefaultIconTheme : iconTheme;
if (!cosmicThemeName || cosmicThemeName === "System Default") {
const detectScript = `if command -v gsettings >/dev/null 2>&1; then
gsettings get org.gnome.desktop.interface icon-theme 2>/dev/null | sed "s/'//g"
elif command -v dconf >/dev/null 2>&1; then
dconf read /org/gnome/desktop/interface/icon-theme 2>/dev/null | sed "s/'//g"
fi`;
Proc.runCommand("detectCosmicIconTheme", ["sh", "-c", detectScript], (output, exitCode) => {
if (exitCode !== 0)
return;
const detected = (output || "").trim();
if (!detected || detected === "System Default")
return;
const detectedEscaped = detected.replace(/'/g, "'\\''");
const writeScript = `mkdir -p ${_configDir}/cosmic/com.system76.CosmicTk/v1
printf '"%s"\\n' '${detectedEscaped}' > ${_configDir}/cosmic/com.system76.CosmicTk/v1/icon_theme 2>/dev/null || true`;
Quickshell.execDetached(["sh", "-lc", writeScript]);
});
return;
}
const cosmicThemeNameEscaped = cosmicThemeName.replace(/'/g, "'\\''");
const script = `mkdir -p ${_configDir}/cosmic/com.system76.CosmicTk/v1
printf '"%s"\\n' '${cosmicThemeNameEscaped}' > ${_configDir}/cosmic/com.system76.CosmicTk/v1/icon_theme 2>/dev/null || true`;
Quickshell.execDetached(["sh", "-lc", script]);
}
function updateCosmicThemeMode(isLightMode) {
const isDark = isLightMode ? "false" : "true";
const script = `mkdir -p ${_configDir}/cosmic/com.system76.CosmicTheme.Mode/v1
printf '%s\\n' ${isDark} > ${_configDir}/cosmic/com.system76.CosmicTheme.Mode/v1/is_dark 2>/dev/null || true`;
Quickshell.execDetached(["sh", "-lc", script]);
}
function updateGtkIconTheme() {
@@ -1244,7 +1203,6 @@ Singleton {
function saveSettings() {
if (_loading || _parseError || !_hasLoaded)
return;
_selfWrite = true;
settingsFile.setText(JSON.stringify(Store.toJson(root), null, 2));
if (_isReadOnly)
_checkSettingsWritable();
@@ -1858,7 +1816,6 @@ Singleton {
iconTheme = themeName;
updateGtkIconTheme();
updateQtIconTheme();
updateCosmicIconTheme();
saveSettings();
if (typeof Theme !== "undefined" && Theme.currentTheme === Theme.dynamic)
Theme.generateSystemThemesFromCurrentTheme();
@@ -2181,9 +2138,6 @@ Singleton {
saveSettings();
}
property bool _pendingExpandNotificationRules: false
property int _pendingNotificationRuleIndex: -1
function addNotificationRule() {
var rules = JSON.parse(JSON.stringify(notificationRules || []));
rules.push({
@@ -2191,45 +2145,6 @@ Singleton {
field: "appName",
pattern: "",
matchType: "contains",
action: "default",
urgency: "default"
});
notificationRules = rules;
saveSettings();
}
function addNotificationRuleForNotification(appName, desktopEntry) {
var rules = JSON.parse(JSON.stringify(notificationRules || []));
var pattern = (desktopEntry && desktopEntry !== "") ? desktopEntry : (appName || "");
var field = (desktopEntry && desktopEntry !== "") ? "desktopEntry" : "appName";
var rule = {
enabled: true,
field: pattern ? field : "appName",
pattern: pattern || "",
matchType: pattern ? "exact" : "contains",
action: "default",
urgency: "default"
};
rules.push(rule);
notificationRules = rules;
saveSettings();
var index = rules.length - 1;
_pendingExpandNotificationRules = true;
_pendingNotificationRuleIndex = index;
return index;
}
function addMuteRuleForApp(appName, desktopEntry) {
var rules = JSON.parse(JSON.stringify(notificationRules || []));
var pattern = (desktopEntry && desktopEntry !== "") ? desktopEntry : (appName || "");
var field = (desktopEntry && desktopEntry !== "") ? "desktopEntry" : "appName";
if (pattern === "")
return;
rules.push({
enabled: true,
field: field,
pattern: pattern,
matchType: "exact",
action: "mute",
urgency: "default"
});
@@ -2237,51 +2152,6 @@ Singleton {
saveSettings();
}
function isAppMuted(appName, desktopEntry) {
const rules = notificationRules || [];
const pat = (desktopEntry && desktopEntry !== "" ? desktopEntry : appName || "").toString().toLowerCase();
if (!pat)
return false;
for (let i = 0; i < rules.length; i++) {
const r = rules[i];
if ((r.action || "").toString().toLowerCase() !== "mute" || r.enabled === false)
continue;
const field = (r.field || "appName").toString().toLowerCase();
const rulePat = (r.pattern || "").toString().toLowerCase();
if (!rulePat)
continue;
const useDesktop = field === "desktopentry";
const matches = (useDesktop && desktopEntry) ? (desktopEntry.toString().toLowerCase() === rulePat) : (appName && appName.toString().toLowerCase() === rulePat);
if (matches)
return true;
if (rulePat === pat)
return true;
}
return false;
}
function removeMuteRuleForApp(appName, desktopEntry) {
var rules = JSON.parse(JSON.stringify(notificationRules || []));
const app = (appName || "").toString().toLowerCase();
const desktop = (desktopEntry || "").toString().toLowerCase();
if (!app && !desktop)
return;
for (let i = rules.length - 1; i >= 0; i--) {
const r = rules[i];
if ((r.action || "").toString().toLowerCase() !== "mute")
continue;
const rulePat = (r.pattern || "").toString().toLowerCase();
if (!rulePat)
continue;
if (rulePat === app || rulePat === desktop) {
rules.splice(i, 1);
notificationRules = rules;
saveSettings();
return;
}
}
}
function updateNotificationRule(index, ruleData) {
var rules = JSON.parse(JSON.stringify(notificationRules || []));
if (index < 0 || index >= rules.length)
@@ -2576,13 +2446,6 @@ Singleton {
property alias settingsFile: settingsFile
Timer {
id: settingsFileReloadDebounce
interval: 50
onTriggered: settingsFile.reload()
repeat: false
}
FileView {
id: settingsFile
@@ -2590,14 +2453,7 @@ Singleton {
blockLoading: true
blockWrites: true
atomicWrites: true
watchChanges: true
onFileChanged: {
if (_selfWrite) {
_selfWrite = false;
return;
}
settingsFileReloadDebounce.restart();
}
watchChanges: !isGreeterMode
onLoaded: {
if (isGreeterMode)
return;
-52
View File
@@ -188,8 +188,6 @@ Singleton {
if (typeof SettingsData !== "undefined" && SettingsData.currentThemeName) {
switchTheme(SettingsData.currentThemeName, false, false);
const currentIsLight = (typeof SessionData !== "undefined") ? SessionData.isLightMode : false;
SettingsData.updateCosmicThemeMode(currentIsLight);
}
if (typeof SessionData !== "undefined" && SessionData.themeModeAutoEnabled) {
@@ -778,53 +776,6 @@ Singleton {
};
}
readonly property int notificationAnimationBaseDuration: {
if (typeof SettingsData === "undefined")
return 200;
if (SettingsData.notificationAnimationSpeed === SettingsData.AnimationSpeed.None)
return 0;
if (SettingsData.notificationAnimationSpeed === SettingsData.AnimationSpeed.Custom)
return SettingsData.notificationCustomAnimationDuration;
const presetMap = [0, 200, 400, 600];
return presetMap[SettingsData.notificationAnimationSpeed] ?? 200;
}
readonly property int notificationEnterDuration: {
const base = notificationAnimationBaseDuration;
return base === 0 ? 0 : Math.round(base * 0.875);
}
readonly property int notificationExitDuration: {
const base = notificationAnimationBaseDuration;
return base === 0 ? 0 : Math.round(base * 0.75);
}
readonly property int notificationExpandDuration: {
const base = notificationAnimationBaseDuration;
return base === 0 ? 0 : Math.round(base * 1.0);
}
readonly property int notificationCollapseDuration: {
const base = notificationAnimationBaseDuration;
return base === 0 ? 0 : Math.round(base * 0.85);
}
readonly property real notificationIconSizeNormal: 56
readonly property real notificationIconSizeCompact: 48
readonly property real notificationExpandedIconSizeNormal: 48
readonly property real notificationExpandedIconSizeCompact: 40
readonly property real notificationActionMinWidth: 48
readonly property real notificationButtonCornerRadius: cornerRadius / 2
readonly property real notificationHoverRevealMargin: spacingXL
readonly property real notificationContentSpacing: spacingXS
readonly property real notificationCardPadding: spacingM
readonly property real notificationCardPaddingCompact: spacingS
readonly property real stateLayerHover: 0.08
readonly property real stateLayerFocus: 0.12
readonly property real stateLayerPressed: 0.12
readonly property real stateLayerDrag: 0.16
readonly property int popoutAnimationDuration: {
if (typeof SettingsData === "undefined")
return 150;
@@ -965,9 +916,6 @@ Singleton {
if (!matugenAvailable) {
PortalService.setLightMode(light);
}
if (typeof SettingsData !== "undefined") {
SettingsData.updateCosmicThemeMode(light);
}
generateSystemThemesFromCurrentTheme();
}
}
+4 -15
View File
@@ -32,15 +32,8 @@ function markdownToHtml(text) {
return `\x00INLINECODE${inlineIndex++}\x00`;
});
// Extract plain URLs before escaping so & in query strings is preserved
const urls = [];
let urlIndex = 0;
html = html.replace(/(^|[\s])((?:https?|file):\/\/[^\s]+)/gm, (match, prefix, url) => {
urls.push(url);
return prefix + `\x00URL${urlIndex++}\x00`;
});
// Escape HTML entities (but not in code blocks or URLs)
// Now process everything else
// Escape HTML entities (but not in code blocks)
html = html.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
@@ -71,12 +64,8 @@ function markdownToHtml(text) {
return '<ul>' + match + '</ul>';
});
// Restore extracted URLs as anchor tags (preserves raw & in href)
html = html.replace(/\x00URL(\d+)\x00/g, (_, index) => {
const url = urls[parseInt(index)];
const display = url.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return `<a href="${url}">${display}</a>`;
});
// Detect plain URLs and wrap them in anchor tags (but not inside existing <a> or markdown links)
html = html.replace(/(^|[^"'>])((https?|file):\/\/[^\s<]+)/g, '$1<a href="$2">$2</a>');
// Restore code blocks and inline code BEFORE line break processing
html = html.replace(/\x00CODEBLOCK(\d+)\x00/g, (match, index) => {
+1 -3
View File
@@ -75,9 +75,7 @@ var SPEC = {
vpnLastConnected: { def: "" },
deviceMaxVolumes: { def: {} },
hiddenOutputDeviceNames: { def: [] },
hiddenInputDeviceNames: { def: [] }
deviceMaxVolumes: { def: {} }
};
function getValidKeys() {
+1 -5
View File
@@ -173,7 +173,7 @@ var SPEC = {
dankLauncherV2BorderThickness: { def: 2 },
dankLauncherV2BorderColor: { def: "primary" },
dankLauncherV2ShowFooter: { def: true },
dankLauncherV2UnloadOnClose: { def: false },
dankLauncherV2UnloadOnClose: { def: true },
useAutoLocation: { def: false },
weatherEnabled: { def: true },
@@ -297,8 +297,6 @@ var SPEC = {
dockShowOverflowBadge: { def: true },
notificationOverlayEnabled: { def: false },
notificationPopupShadowEnabled: { def: true },
notificationPopupPrivacyMode: { def: false },
overviewRows: { def: 2, persist: false },
overviewColumns: { def: 5, persist: false },
overviewScale: { def: 0.16, persist: false },
@@ -327,8 +325,6 @@ var SPEC = {
notificationTimeoutCritical: { def: 0 },
notificationCompactMode: { def: false },
notificationPopupPosition: { def: 0 },
notificationAnimationSpeed: { def: 1 },
notificationCustomAnimationDuration: { def: 400 },
notificationHistoryEnabled: { def: true },
notificationHistoryMaxCount: { def: 50 },
notificationHistoryMaxAgeDays: { def: 7 },
+1 -1
View File
@@ -197,7 +197,7 @@ Item {
if (CompositorService.isNiri && NiriService.currentOutput) {
return NiriService.currentOutput;
}
if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && I3.workspaces?.values) {
if ((CompositorService.isSway || CompositorService.isScroll) && I3.workspaces?.values) {
const focusedWs = I3.workspaces.values.find(ws => ws.focused === true);
return focusedWs?.monitor?.name || "";
}
@@ -65,7 +65,7 @@ Column {
StyledText {
id: codenameText
anchors.centerIn: parent
text: "Saffron Bloom"
text: "Spicy Miso"
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
color: Theme.primary
@@ -74,7 +74,7 @@ Column {
}
StyledText {
text: "New launcher, enhanced plugin system, KDE Connect, & more"
text: "Desktop widgets, theme registry, native clipboard & more"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
}
@@ -108,76 +108,67 @@ Column {
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "space_dashboard"
title: "Dank Launcher V2"
description: "New capabilities & plugins"
onClicked: PopoutService.openDankLauncherV2()
iconName: "widgets"
title: "Desktop Widgets"
description: "Widgets on your desktop"
onClicked: PopoutService.openSettingsWithTab("desktop_widgets")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "smartphone"
title: "Phone Connect"
description: "KDE Connect & Valent"
onClicked: Qt.openUrlExternally("https://github.com/AvengeMedia/dms-plugins/tree/master/DankKDEConnect")
iconName: "palette"
title: "Theme Registry"
description: "Community themes"
onClicked: PopoutService.openSettingsWithTab("theme")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "monitor_heart"
title: "System Monitor"
description: "Redesigned process list"
onClicked: PopoutService.showProcessListModal()
iconName: "content_paste"
title: "Native Clipboard"
description: "Zero-dependency history"
onClicked: PopoutService.openSettingsWithTab("clipboard")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "window"
title: "Window Rules"
description: "niri window rule manager"
visible: CompositorService.isNiri
onClicked: PopoutService.openSettingsWithTab("window_rules")
iconName: "display_settings"
title: "Monitor Config"
description: "Full display setup"
onClicked: PopoutService.openSettingsWithTab("display_config")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "notifications_active"
title: "Enhanced Notifications"
description: "Configurable rules & styling"
visible: !CompositorService.isNiri
title: "Notifications"
description: "History & gestures"
onClicked: PopoutService.openSettingsWithTab("notifications")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "dock_to_bottom"
title: "Dock Enhancements"
description: "Bar dock widget & more"
onClicked: PopoutService.openSettingsWithTab("dock")
iconName: "healing"
title: "DMS Doctor"
description: "Diagnose issues"
onClicked: FirstLaunchService.showDoctor()
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "volume_up"
title: "Audio Aliases"
description: "Custom device names"
onClicked: PopoutService.openSettingsWithTab("audio")
iconName: "keyboard"
title: "Keybinds Editor"
description: "niri, Hyprland, & MangoWC"
visible: KeybindsService.available
onClicked: PopoutService.openSettingsWithTab("keybinds")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "extension"
title: "Enhanced Plugin System"
description: "Enables new types of plugins"
onClicked: PopoutService.openSettingsWithTab("plugins")
}
ChangelogFeatureCard {
width: (parent.width - Theme.spacingS) / 2
iconName: "light_mode"
title: "Auto Light/Dark"
description: "Automatic mode switching"
onClicked: PopoutService.openSettingsWithTab("theme")
iconName: "search"
title: "Settings Search"
description: "Find settings fast"
onClicked: PopoutService.openSettings()
}
}
}
@@ -230,21 +221,26 @@ Column {
ChangelogUpgradeNote {
width: parent.width
text: "Spotlight replaced by Dank Launcher V2 — check settings for new options"
text: "Ghostty theme path changed to ~/.config/ghostty/themes/danktheme"
}
ChangelogUpgradeNote {
width: parent.width
text: "Plugin API updated — third-party plugins may need updates"
text: "VS Code theme reinstall required"
}
ChangelogUpgradeNote {
width: parent.width
text: "Clipboard history migration available from cliphist"
}
}
}
// StyledText {
// text: "See full release notes for migration steps"
// font.pixelSize: Theme.fontSizeSmall
// color: Theme.surfaceVariantText
// width: parent.width
// }
StyledText {
text: "See full release notes for migration steps"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
width: parent.width
}
}
}
@@ -129,7 +129,7 @@ FloatingWindow {
iconName: "open_in_new"
backgroundColor: Theme.surfaceContainerHighest
textColor: Theme.surfaceText
onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1-4-release")
onClicked: Qt.openUrlExternally("https://danklinux.com/blog/v1-2-release")
}
DankButton {
+7 -2
View File
@@ -246,6 +246,11 @@ Item {
bottom: root.useSingleWindow
}
BackgroundEffect.blurRegion: Region {
item: shouldBeVisible ? modalContainer : null
radius: root.cornerRadius
}
WlrLayershell.margins {
left: root.useSingleWindow ? 0 : Math.max(0, Theme.snap(root.alignedX - shadowBuffer, dpr))
top: root.useSingleWindow ? 0 : Math.max(0, Theme.snap(root.alignedY - shadowBuffer, dpr))
@@ -380,9 +385,9 @@ Item {
Rectangle {
anchors.fill: parent
color: root.backgroundColor
border.color: root.borderColor
border.width: root.borderWidth
radius: root.cornerRadius
border.color: Theme.outline
border.width: 1
}
FocusScope {
@@ -13,14 +13,10 @@ Item {
property bool spotlightOpen: false
property bool keyboardActive: false
property bool contentVisible: false
property var spotlightContent: launcherContentLoader.item
property alias spotlightContent: launcherContent
property bool openedFromOverview: false
property bool isClosing: false
property bool _windowEnabled: true
property bool _pendingInitialize: false
property string _pendingQuery: ""
property string _pendingMode: ""
readonly property bool unloadContentOnClose: SettingsData.dankLauncherV2UnloadOnClose
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
readonly property var effectiveScreen: launcherWindow.screen
@@ -79,22 +75,7 @@ Item {
signal dialogClosed
function _ensureContentLoadedAndInitialize(query, mode) {
_pendingQuery = query || "";
_pendingMode = mode || "";
_pendingInitialize = true;
contentVisible = true;
launcherContentLoader.active = true;
if (spotlightContent) {
_initializeAndShow(_pendingQuery, _pendingMode);
_pendingInitialize = false;
}
}
function _initializeAndShow(query, mode) {
if (!spotlightContent)
return;
contentVisible = true;
spotlightContent.searchField.forceActiveFocus();
@@ -140,7 +121,7 @@ Item {
if (useHyprlandFocusGrab)
focusGrab.active = true;
_ensureContentLoadedAndInitialize("", "");
_initializeAndShow("");
}
function showWithQuery(query) {
@@ -158,7 +139,7 @@ Item {
if (useHyprlandFocusGrab)
focusGrab.active = true;
_ensureContentLoadedAndInitialize(query, "");
_initializeAndShow(query);
}
function hide() {
@@ -195,7 +176,7 @@ Item {
if (useHyprlandFocusGrab)
focusGrab.active = true;
_ensureContentLoadedAndInitialize("", mode);
_initializeAndShow("", mode);
}
function toggleWithMode(mode) {
@@ -220,8 +201,6 @@ Item {
repeat: false
onTriggered: {
isClosing = false;
if (root.unloadContentOnClose)
launcherContentLoader.active = false;
dialogClosed();
}
}
@@ -284,7 +263,7 @@ Item {
PanelWindow {
id: launcherWindow
visible: root._windowEnabled && (!root.unloadContentOnClose || spotlightOpen || isClosing)
visible: root._windowEnabled
color: "transparent"
exclusionMode: ExclusionMode.Ignore
@@ -312,6 +291,14 @@ Item {
right: true
}
BackgroundEffect.blurRegion: Region {
x: contentVisible ? root.modalX : 0
y: contentVisible ? root.modalY : 0
width: contentVisible ? root.modalWidth : 0
height: contentVisible ? root.modalHeight : 0
radius: root.cornerRadius
}
mask: Region {
item: spotlightOpen ? fullScreenMask : null
}
@@ -380,8 +367,6 @@ Item {
Rectangle {
anchors.fill: parent
color: root.backgroundColor
border.color: root.borderColor
border.width: root.borderWidth
radius: root.cornerRadius
}
@@ -394,22 +379,12 @@ Item {
anchors.fill: parent
focus: keyboardActive
Loader {
id: launcherContentLoader
LauncherContent {
id: launcherContent
anchors.fill: parent
active: !root.unloadContentOnClose || root.spotlightOpen || root.isClosing || root.contentVisible || root._pendingInitialize
asynchronous: false
sourceComponent: LauncherContent {
focus: true
parentModal: root
}
onLoaded: {
if (root._pendingInitialize) {
root._initializeAndShow(root._pendingQuery, root._pendingMode);
root._pendingInitialize = false;
}
}
focus: true
parentModal: root
heavyContentActive: !SettingsData.dankLauncherV2UnloadOnClose || spotlightOpen || isClosing
}
Keys.onEscapePressed: event => {
@@ -417,6 +392,14 @@ Item {
event.accepted = true;
}
}
Rectangle {
anchors.fill: parent
radius: root.cornerRadius
color: "transparent"
border.color: Theme.outline
border.width: 1
}
}
}
}
@@ -12,10 +12,11 @@ FocusScope {
LayoutMirroring.childrenInherit: true
property var parentModal: null
property bool heavyContentActive: true
property string viewModeContext: "spotlight"
property alias searchField: searchField
property alias controller: controller
property alias resultsList: resultsList
property var resultsList: resultsLoader.item
property alias actionPanel: actionPanel
property bool editMode: false
@@ -23,7 +24,8 @@ FocusScope {
property string editAppId: ""
function resetScroll() {
resultsList.resetScroll();
if (resultsList)
resultsList.resetScroll();
}
function focusSearchField() {
@@ -222,7 +224,7 @@ FocusScope {
return;
case Qt.Key_Menu:
case Qt.Key_F10:
if (contextMenu.hasContextMenuActions(controller.selectedItem)) {
if (resultsList && contextMenu.hasContextMenuActions(controller.selectedItem)) {
var scenePos = resultsList.getSelectedItemPosition();
var localPos = root.mapFromItem(null, scenePos.x, scenePos.y);
showContextMenu(controller.selectedItem, localPos.x, localPos.y, true);
@@ -277,9 +279,6 @@ FocusScope {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: root.parentModal?.borderWidth ?? 1
anchors.rightMargin: root.parentModal?.borderWidth ?? 1
anchors.bottomMargin: root.parentModal?.borderWidth ?? 1
readonly property bool showFooter: SettingsData.dankLauncherV2Size !== "micro" && SettingsData.dankLauncherV2ShowFooter
height: showFooter ? 36 : 0
visible: showFooter
@@ -551,14 +550,15 @@ FocusScope {
}
}
Item {
Loader {
id: resultsLoader
width: parent.width
height: parent.height - searchField.height - categoryRow.height - actionPanel.height - Theme.spacingXS * (categoryRow.visible ? 3 : 2)
active: root.heavyContentActive
asynchronous: false
opacity: root.parentModal?.isClosing ? 0 : 1
ResultsList {
id: resultsList
anchors.fill: parent
sourceComponent: ResultsList {
controller: root.controller
onItemRightClicked: (index, item, sceneX, sceneY) => {
@@ -81,12 +81,6 @@ function calculateNextIndex(flatModel, selectedFlatIndex, sectionId, viewMode, g
return bounds.start + newPosInSection;
}
var currentRow = Math.floor(posInSection / cols);
var lastRow = Math.floor((bounds.count - 1) / cols);
if (currentRow < lastRow) {
return bounds.start + bounds.count - 1;
}
var nextSection = findNextNonHeaderIndex(flatModel, bounds.end + 1);
return nextSection !== -1 ? nextSection : selectedFlatIndex;
}
@@ -130,17 +130,24 @@ Item {
if (!entry || entry.isHeader)
return;
var rowIndex = _flatIndexToRowMap[index];
if (rowIndex === undefined)
if (rowIndex === undefined || rowIndex >= _cumulativeHeights.length)
return;
var row = _visualRows[rowIndex];
if (!row)
return;
mainListView.positionViewAtIndex(rowIndex, ListView.Contain);
var rowY = _cumulativeHeights[rowIndex];
var rowHeight = row.height;
var scrollY = mainListView.contentY - mainListView.originY;
var viewHeight = mainListView.height;
var headerH = stickyHeader.height;
if (stickyHeader.visible && rowIndex < _cumulativeHeights.length) {
var rowY = _cumulativeHeights[rowIndex];
var scrollY = mainListView.contentY - mainListView.originY;
if (rowY < scrollY + stickyHeader.height) {
mainListView.contentY = Math.max(mainListView.originY, rowY - stickyHeader.height + mainListView.originY);
}
if (rowY < scrollY + headerH) {
mainListView.contentY = Math.max(mainListView.originY, rowY - headerH + mainListView.originY);
return;
}
if (rowY + rowHeight > scrollY + viewHeight) {
mainListView.contentY = rowY + rowHeight - viewHeight + mainListView.originY;
}
}
+9 -50
View File
@@ -1,6 +1,4 @@
import QtQml
import QtQuick
import QtQuick.Layouts
import Quickshell.Hyprland
import qs.Common
import qs.Modals.Common
@@ -20,11 +18,7 @@ DankModal {
modalHeight: _maxH
onBackgroundClicked: close()
onOpened: {
Qt.callLater(() => {
modalFocusScope.forceActiveFocus();
if (contentLoader.item?.searchField)
contentLoader.item.searchField.forceActiveFocus();
});
Qt.callLater(() => modalFocusScope.forceActiveFocus());
if (!Object.keys(KeybindsService.cheatsheet).length && KeybindsService.cheatsheetAvailable)
KeybindsService.loadCheatsheet();
}
@@ -69,39 +63,17 @@ DankModal {
content: Component {
Item {
anchors.fill: parent
property alias searchField: searchField
Column {
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingL
RowLayout {
width: parent.width
StyledText {
Layout.alignment: Qt.AlignLeft
text: KeybindsService.cheatsheet.title || "Keybinds"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.primary
}
DankTextField {
id: searchField
Layout.alignment: Qt.AlignRight
leftIconName: "search"
onTextEdited: searchDebounce.restart()
}
}
Timer {
id: searchDebounce
interval: 50
repeat: false
onTriggered: {
mainFlickable.categories = mainFlickable.generateCategories(searchField.text);
}
StyledText {
text: KeybindsService.cheatsheet.title || "Keybinds"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.primary
}
DankFlickable {
@@ -115,26 +87,17 @@ DankModal {
Component.onCompleted: root.activeFlickable = mainFlickable
property var rawBinds: KeybindsService.cheatsheet.binds || {}
function generateCategories(query) {
const lowerQuery = query ? query.toLowerCase().trim() : "";
property var categories: {
const processed = {};
for (const cat in rawBinds) {
const binds = rawBinds[cat];
const catLower = cat.toLowerCase();
const subcats = {};
let hasSubcats = false;
for (let i = 0; i < binds.length; i++) {
const bind = binds[i];
const keyLower = bind.key.toLowerCase();
const descLower = bind.desc.toLowerCase();
const actionLower = bind.action.toLowerCase();
if (!(lowerQuery.length === 0 || keyLower.includes(lowerQuery) || descLower.includes(lowerQuery) || catLower.includes(lowerQuery) || actionLower.includes(lowerQuery)))
continue;
if (bind.hideOnOverlay)
continue;
if (bind.subcat) {
hasSubcats = true;
if (!subcats[bind.subcat])
@@ -156,11 +119,9 @@ DankModal {
subcatKeys: Object.keys(subcats)
};
}
return processed;
}
property var categories: generateCategories("");
property var categoryKeys: Object.keys(categories)
function estimateCategoryHeight(catName) {
const catData = categories[catName];
@@ -175,8 +136,6 @@ DankModal {
return 40 + bindCount * 28;
}
property var categoryKeys: Object.keys(categories);
function distributeCategories(cols) {
const columns = [];
const heights = [];
+2 -2
View File
@@ -70,8 +70,8 @@ DankModal {
NotificationService.dismissAllPopups();
}
modalWidth: Math.min(500, screenWidth - 48)
modalHeight: Math.min(700, screenHeight * 0.85)
modalWidth: 500
modalHeight: 700
backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
visible: false
onBackgroundClicked: hide()
+11 -46
View File
@@ -14,7 +14,6 @@ FloatingWindow {
property int currentTab: 0
property string searchText: ""
property string expandedPid: ""
property string processFilter: "all"
property bool shouldHaveFocus: visible
property alias shouldBeVisible: processListModal.visible
@@ -83,9 +82,9 @@ FloatingWindow {
objectName: "processListModal"
title: I18n.tr("System Monitor", "sysmon window title")
minimumSize: Qt.size(Math.min(Math.round(Theme.fontSizeMedium * 48), Screen.width), Math.min(Math.round(Theme.fontSizeMedium * 34), Screen.height))
implicitWidth: Math.round(Theme.fontSizeMedium * 71)
implicitHeight: Math.round(Theme.fontSizeMedium * 51)
minimumSize: Qt.size(750, 550)
implicitWidth: 1000
implicitHeight: 720
color: Theme.surfaceContainer
visible: false
@@ -99,8 +98,6 @@ FloatingWindow {
closingModal();
searchText = "";
expandedPid = "";
processFilter = "all";
processFilterGroup.currentIndex = 0;
if (processesTabLoader.item)
processesTabLoader.item.reset();
DgopService.removeRef(["cpu", "memory", "network", "disk", "system"]);
@@ -236,7 +233,7 @@ FloatingWindow {
Item {
Layout.fillWidth: true
Layout.preferredHeight: Math.round(Theme.fontSizeMedium * 3.4)
Layout.preferredHeight: 48
MouseArea {
anchors.fill: parent
@@ -293,10 +290,10 @@ FloatingWindow {
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: Math.round(Theme.fontSizeMedium * 3.7)
Layout.preferredHeight: 52
Layout.leftMargin: Theme.spacingL
Layout.rightMargin: Theme.spacingL
spacing: Theme.spacingM
spacing: Theme.spacingL
Row {
spacing: 2
@@ -322,15 +319,14 @@ FloatingWindow {
]
Rectangle {
width: tabRowContent.implicitWidth + Theme.spacingM * 2
height: Math.round(Theme.fontSizeMedium * 3.1)
width: 120
height: 44
radius: Theme.cornerRadius
color: currentTab === index ? Theme.primaryPressed : (tabMouseArea.containsMouse ? Theme.primaryHoverLight : "transparent")
border.color: currentTab === index ? Theme.primary : "transparent"
border.width: currentTab === index ? 1 : 0
Row {
id: tabRowContent
anchors.centerIn: parent
spacing: Theme.spacingXS
@@ -372,40 +368,10 @@ FloatingWindow {
Layout.fillWidth: true
}
DankButtonGroup {
id: processFilterGroup
model: [I18n.tr("All"), I18n.tr("User"), I18n.tr("System")]
currentIndex: 0
checkEnabled: false
buttonHeight: Math.round(Theme.fontSizeSmall * 2.6)
minButtonWidth: 0
buttonPadding: Theme.spacingS
textSize: Theme.fontSizeSmall
visible: currentTab === 0
onSelectionChanged: (index, selected) => {
if (!selected)
return;
currentIndex = index;
switch (index) {
case 0:
processListModal.processFilter = "all";
return;
case 1:
processListModal.processFilter = "user";
return;
case 2:
processListModal.processFilter = "system";
return;
}
}
}
DankTextField {
id: searchField
Layout.fillWidth: true
Layout.maximumWidth: Math.round(Theme.fontSizeMedium * 18)
Layout.minimumWidth: Theme.fontSizeMedium * 4
Layout.preferredHeight: Math.round(Theme.fontSizeMedium * 2.8)
Layout.preferredWidth: 250
Layout.preferredHeight: 40
placeholderText: I18n.tr("Search processes...", "process search placeholder")
leftIconName: "search"
showClearButton: true
@@ -437,7 +403,6 @@ FloatingWindow {
sourceComponent: ProcessesView {
searchText: processListModal.searchText
expandedPid: processListModal.expandedPid
processFilter: processListModal.processFilter
contextMenu: processContextMenu
onExpandedPidChanged: processListModal.expandedPid = expandedPid
}
@@ -473,7 +438,7 @@ FloatingWindow {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: Math.round(Theme.fontSizeSmall * 2.7)
Layout.preferredHeight: 32
Layout.leftMargin: Theme.spacingL
Layout.rightMargin: Theme.spacingL
Layout.bottomMargin: Theme.spacingM
@@ -209,7 +209,7 @@ Rectangle {
"children": [
{
"id": "display_config",
"text": I18n.tr("Configuration"),
"text": I18n.tr("Configuration") + " (Beta)",
"icon": "display_settings",
"tabIndex": 24
},
@@ -945,31 +945,22 @@ Column {
}
}
function tryCreatePluginInstance() {
const pluginComponent = PluginService.pluginWidgetComponents[pluginId];
if (!pluginComponent)
return false;
try {
const instance = pluginComponent.createObject(null, {
"pluginId": pluginId,
"pluginService": PluginService,
"visible": false,
"width": 0,
"height": 0
});
if (instance) {
pluginInstance = instance;
return true;
}
} catch (e) {
console.warn("DragDropGrid: stale plugin component for", pluginId, "- reloading");
PluginService.reloadPlugin(pluginId);
}
return false;
}
Component.onCompleted: {
Qt.callLater(() => tryCreatePluginInstance());
Qt.callLater(() => {
const pluginComponent = PluginService.pluginWidgetComponents[pluginId];
if (pluginComponent) {
const instance = pluginComponent.createObject(null, {
"pluginId": pluginId,
"pluginService": PluginService,
"visible": false,
"width": 0,
"height": 0
});
if (instance) {
pluginInstance = instance;
}
}
});
}
Connections {
@@ -979,11 +970,6 @@ Column {
pluginInstance.loadPluginData();
}
}
function onPluginLoaded(loadedPluginId) {
if (loadedPluginId !== pluginId || pluginInstance)
return;
Qt.callLater(() => tryCreatePluginInstance());
}
}
Component.onDestruction: {
@@ -13,8 +13,8 @@ Row {
property Item popoutContent: null
signal addWidget(string widgetId)
signal resetToDefault
signal clearAll
signal resetToDefault()
signal clearAll()
height: 48
spacing: Theme.spacingS
@@ -28,7 +28,7 @@ Row {
y: parent ? Math.round((parent.height - height) / 2) : 0
width: 400
height: 300
modal: false
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
@@ -133,7 +133,7 @@ Row {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.addWidget(modelData.id);
root.addWidget(modelData.id)
}
}
}
@@ -12,7 +12,6 @@ DankPopout {
id: root
layerNamespace: "dms:control-center"
fullHeightSurface: true
property string expandedSection: ""
property var triggerScreen: null
@@ -13,12 +13,15 @@ Rectangle {
LayoutMirroring.childrenInherit: true
implicitHeight: {
if (height > 0)
if (height > 0) {
return height;
if (NetworkService.wifiToggling)
}
if (NetworkService.wifiToggling) {
return headerRow.height + wifiToggleContent.height + Theme.spacingM;
if (NetworkService.wifiEnabled)
}
if (NetworkService.wifiEnabled) {
return headerRow.height + wifiContent.height + Theme.spacingM;
}
return headerRow.height + wifiOffContent.height + Theme.spacingM;
}
radius: Theme.cornerRadius
@@ -37,40 +40,34 @@ Rectangle {
property bool hasEthernetAvailable: (NetworkService.ethernetDevices?.length ?? 0) > 0
property bool hasWifiAvailable: (NetworkService.wifiDevices?.length ?? 0) > 0
property bool hasBothConnectionTypes: hasEthernetAvailable && hasWifiAvailable
property int maxPinnedNetworks: 3
function normalizePinList(value) {
if (Array.isArray(value))
return value.filter(v => v);
if (typeof value === "string" && value.length > 0)
return [value];
return [];
}
function getPinnedNetworks() {
const pins = SettingsData.wifiNetworkPins || {};
return normalizePinList(pins["preferredWifi"]);
}
property int currentPreferenceIndex: {
if (DMSService.apiVersion < 5)
if (DMSService.apiVersion < 5) {
return 1;
if (NetworkService.backend !== "networkmanager" || DMSService.apiVersion <= 10)
}
if (NetworkService.backend !== "networkmanager" || DMSService.apiVersion <= 10) {
return 1;
if (!hasEthernetAvailable)
}
if (!hasEthernetAvailable) {
return 1;
if (!hasWifiAvailable)
}
if (!hasWifiAvailable) {
return 0;
}
const pref = NetworkService.userPreference;
switch (pref) {
case "ethernet":
const status = NetworkService.networkStatus;
if (pref === "ethernet") {
return 0;
case "wifi":
return 1;
default:
return NetworkService.networkStatus === "ethernet" ? 0 : 1;
}
if (pref === "wifi") {
return 1;
}
return status === "ethernet" ? 0 : 1;
}
Row {
@@ -81,7 +78,7 @@ Rectangle {
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
anchors.topMargin: Theme.spacingS
height: Math.max(headerLeft.implicitHeight, rightControls.implicitHeight) + Theme.spacingS * 2
height: 40
StyledText {
id: headerLeft
@@ -165,10 +162,9 @@ Rectangle {
anchors.margins: Theme.spacingM
anchors.topMargin: Theme.spacingM
visible: currentPreferenceIndex === 1 && NetworkService.wifiToggling
height: visible ? wifiToggleColumn.implicitHeight + Theme.spacingM * 2 : 0
height: visible ? 80 : 0
Column {
id: wifiToggleColumn
anchors.centerIn: parent
spacing: Theme.spacingM
@@ -205,10 +201,9 @@ Rectangle {
anchors.margins: Theme.spacingM
anchors.topMargin: Theme.spacingM
visible: currentPreferenceIndex === 1 && !NetworkService.wifiEnabled && !NetworkService.wifiToggling
height: visible ? wifiOffColumn.implicitHeight + Theme.spacingM * 2 : 0
height: visible ? 120 : 0
Column {
id: wifiOffColumn
anchors.centerIn: parent
spacing: Theme.spacingL
width: parent.width
@@ -231,15 +226,14 @@ Rectangle {
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: enableWifiLabel.implicitWidth + Theme.spacingL * 2
height: enableWifiLabel.implicitHeight + Theme.spacingM * 2
radius: height / 2
width: 120
height: 36
radius: 18
color: enableWifiButton.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08)
border.width: 0
border.color: Theme.primary
StyledText {
id: enableWifiLabel
anchors.centerIn: parent
text: I18n.tr("Enable WiFi")
color: Theme.primary
@@ -258,25 +252,6 @@ Rectangle {
}
}
ScriptModel {
id: wiredConnectionsModel
objectProp: "uuid"
values: {
const networks = NetworkService.wiredConnections;
if (!networks)
return [];
let sorted = [...networks];
sorted.sort((a, b) => {
if (a.isActive && !b.isActive)
return -1;
if (!a.isActive && b.isActive)
return 1;
return a.id.localeCompare(b.id);
});
return sorted;
}
}
DankFlickable {
id: wiredContent
anchors.top: headerRow.bottom
@@ -295,25 +270,34 @@ Rectangle {
spacing: Theme.spacingS
Repeater {
model: wiredConnectionsModel
model: ScriptModel {
values: {
const currentUuid = NetworkService.ethernetConnectionUuid;
const networks = NetworkService.wiredConnections;
let sorted = [...networks];
sorted.sort((a, b) => {
if (a.isActive && !b.isActive)
return -1;
if (!a.isActive && b.isActive)
return 1;
return a.id.localeCompare(b.id);
});
return sorted;
}
}
delegate: Rectangle {
id: wiredDelegate
required property var modelData
required property int index
readonly property bool isActive: modelData.isActive
readonly property string configName: modelData.id || I18n.tr("Unknown Config")
width: parent.width
height: wiredContentRow.implicitHeight + Theme.spacingM * 2
height: 50
radius: Theme.cornerRadius
color: wiredNetworkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
border.color: Theme.primary
border.width: 0
Row {
id: wiredContentRow
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingM
@@ -322,7 +306,7 @@ Rectangle {
DankIcon {
name: "lan"
size: Theme.iconSize - 4
color: wiredDelegate.isActive ? Theme.primary : Theme.surfaceText
color: modelData.isActive ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
@@ -331,10 +315,10 @@ Rectangle {
width: 200
StyledText {
text: wiredDelegate.configName
text: modelData.id || I18n.tr("Unknown Config")
font.pixelSize: Theme.fontSizeMedium
color: wiredDelegate.isActive ? Theme.primary : Theme.surfaceText
font.weight: wiredDelegate.isActive ? Font.Medium : Font.Normal
color: modelData.isActive ? Theme.primary : Theme.surfaceText
font.weight: modelData.isActive ? Font.Medium : Font.Normal
elide: Text.ElideRight
width: parent.width
}
@@ -351,12 +335,12 @@ Rectangle {
onClicked: {
if (wiredNetworkContextMenu.visible) {
wiredNetworkContextMenu.close();
return;
} else {
wiredNetworkContextMenu.currentID = modelData.id;
wiredNetworkContextMenu.currentUUID = modelData.uuid;
wiredNetworkContextMenu.currentConnected = modelData.isActive;
wiredNetworkContextMenu.popup(wiredOptionsButton, -wiredNetworkContextMenu.width + wiredOptionsButton.width, wiredOptionsButton.height + Theme.spacingXS);
}
wiredNetworkContextMenu.currentID = modelData.id;
wiredNetworkContextMenu.currentUUID = modelData.uuid;
wiredNetworkContextMenu.currentConnected = wiredDelegate.isActive;
wiredNetworkContextMenu.popup(wiredOptionsButton, -wiredNetworkContextMenu.width + wiredOptionsButton.width, wiredOptionsButton.height + Theme.spacingXS);
}
}
@@ -373,8 +357,9 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
onPressed: mouse => wiredRipple.trigger(mouse.x, mouse.y)
onClicked: function (event) {
if (modelData.uuid !== NetworkService.ethernetConnectionUuid)
if (modelData.uuid !== NetworkService.ethernetConnectionUuid) {
NetworkService.connectToSpecificWiredConfig(modelData.uuid);
}
event.accepted = true;
}
}
@@ -418,8 +403,9 @@ Rectangle {
}
onTriggered: {
if (!wiredNetworkContextMenu.currentConnected)
if (!wiredNetworkContextMenu.currentConnected) {
NetworkService.connectToSpecificWiredConfig(wiredNetworkContextMenu.currentUUID);
}
}
}
@@ -465,46 +451,13 @@ Rectangle {
}
onTriggered: {
const networkData = NetworkService.getWiredNetworkInfo(wiredNetworkContextMenu.currentUUID);
networkWiredInfoModalLoader.active = true;
networkWiredInfoModalLoader.item.showNetworkInfo(wiredNetworkContextMenu.currentID, networkData);
let networkData = NetworkService.getWiredNetworkInfo(wiredNetworkContextMenu.currentUUID);
networkWiredInfoModal.showNetworkInfo(wiredNetworkContextMenu.currentID, networkData);
}
}
}
ScriptModel {
id: wifiNetworksModel
objectProp: "ssid"
values: wifiContent.menuOpen ? wifiContent.frozenNetworks : wifiContent.sortedNetworks
}
Item {
id: wifiScanningOverlay
anchors.top: headerRow.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Theme.spacingM
anchors.topMargin: Theme.spacingM
visible: currentPreferenceIndex === 1 && NetworkService.wifiEnabled && !NetworkService.wifiToggling && NetworkService.wifiInterface && (NetworkService.wifiNetworks?.length ?? 0) < 1 && NetworkService.isScanning
DankIcon {
anchors.centerIn: parent
name: "refresh"
size: 48
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
RotationAnimation on rotation {
running: wifiScanningOverlay.visible
loops: Animation.Infinite
from: 0
to: 360
duration: 1000
}
}
}
DankListView {
DankFlickable {
id: wifiContent
anchors.top: headerRow.bottom
anchors.left: parent.left
@@ -512,17 +465,31 @@ Rectangle {
anchors.bottom: parent.bottom
anchors.margins: Theme.spacingM
anchors.topMargin: Theme.spacingM
visible: currentPreferenceIndex === 1 && NetworkService.wifiEnabled && !NetworkService.wifiToggling && !wifiScanningOverlay.visible
visible: currentPreferenceIndex === 1 && NetworkService.wifiEnabled && !NetworkService.wifiToggling
contentHeight: wifiColumn.height
clip: true
spacing: Theme.spacingS
model: wifiNetworksModel
property int maxPinnedNetworks: 3
function normalizePinList(value) {
if (Array.isArray(value))
return value.filter(v => v);
if (typeof value === "string" && value.length > 0)
return [value];
return [];
}
function getPinnedNetworks() {
const pins = SettingsData.wifiNetworkPins || {};
return normalizePinList(pins["preferredWifi"]);
}
property var frozenNetworks: []
property bool menuOpen: false
property var sortedNetworks: {
const ssid = NetworkService.currentWifiSSID;
const networks = NetworkService.wifiNetworks;
const pinnedList = root.getPinnedNetworks();
const pinnedList = getPinnedNetworks();
let sorted = [...networks];
sorted.sort((a, b) => {
@@ -552,188 +519,229 @@ Rectangle {
frozenNetworks = sortedNetworks;
}
delegate: Rectangle {
id: wifiDelegate
required property var modelData
required property int index
Column {
id: wifiColumn
width: parent.width
spacing: Theme.spacingS
readonly property bool isConnected: modelData.ssid === NetworkService.currentWifiSSID
readonly property bool isPinned: root.getPinnedNetworks().includes(modelData.ssid)
readonly property string networkName: modelData.ssid || I18n.tr("Unknown Network")
readonly property int signalStrength: modelData.signal || 0
width: wifiContent.width
height: wifiContentRow.implicitHeight + Theme.spacingM * 2
radius: Theme.cornerRadius
color: networkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
border.color: wifiDelegate.isConnected ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
border.width: 0
Row {
id: wifiContentRow
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingM
spacing: Theme.spacingS
Item {
width: parent.width
height: 200
visible: NetworkService.wifiInterface && NetworkService.wifiNetworks?.length < 1 && !NetworkService.wifiToggling && NetworkService.isScanning
DankIcon {
name: {
if (wifiDelegate.signalStrength >= 50)
return "wifi";
if (wifiDelegate.signalStrength >= 25)
return "wifi_2_bar";
return "wifi_1_bar";
anchors.centerIn: parent
name: "refresh"
size: 48
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
RotationAnimation on rotation {
running: NetworkService.isScanning
loops: Animation.Infinite
from: 0
to: 360
duration: 1000
}
size: Theme.iconSize - 4
color: wifiDelegate.isConnected ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Repeater {
model: ScriptModel {
values: wifiContent.menuOpen ? wifiContent.frozenNetworks : wifiContent.sortedNetworks
}
Column {
anchors.verticalCenter: parent.verticalCenter
width: 200
delegate: Rectangle {
required property var modelData
required property int index
StyledText {
text: wifiDelegate.networkName
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: wifiDelegate.isConnected ? Font.Medium : Font.Normal
elide: Text.ElideRight
width: parent.width
}
width: parent.width
height: 50
radius: Theme.cornerRadius
color: networkMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
border.color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
border.width: 0
Row {
spacing: Theme.spacingXS
StyledText {
text: wifiDelegate.isConnected ? I18n.tr("Connected") + " \u2022" : (modelData.secured ? I18n.tr("Secured") + " \u2022" : I18n.tr("Open") + " \u2022")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: modelData.saved ? I18n.tr("Saved") : ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.primary
visible: text.length > 0
}
StyledText {
text: (modelData.saved ? "\u2022 " : "") + wifiDelegate.signalStrength + "%"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}
DankActionButton {
id: optionsButton
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
iconName: "more_horiz"
buttonSize: 28
onClicked: {
if (networkContextMenu.visible) {
networkContextMenu.close();
return;
}
wifiContent.menuOpen = true;
networkContextMenu.currentSSID = modelData.ssid;
networkContextMenu.currentSecured = modelData.secured;
networkContextMenu.currentConnected = wifiDelegate.isConnected;
networkContextMenu.currentSaved = modelData.saved;
networkContextMenu.currentSignal = modelData.signal;
networkContextMenu.currentAutoconnect = modelData.autoconnect || false;
networkContextMenu.popup(optionsButton, -networkContextMenu.width + optionsButton.width, optionsButton.height + Theme.spacingXS);
}
}
Rectangle {
anchors.right: parent.right
anchors.rightMargin: optionsButton.width + Theme.spacingM + Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
width: pinWifiRow.width + Theme.spacingS * 2
height: pinWifiRow.implicitHeight + Theme.spacingXS * 2
radius: height / 2
color: wifiDelegate.isPinned ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Theme.withAlpha(Theme.surfaceText, 0.05)
Row {
id: pinWifiRow
anchors.centerIn: parent
spacing: 4
DankIcon {
name: "push_pin"
size: 16
color: wifiDelegate.isPinned ? Theme.primary : Theme.surfaceText
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
anchors.leftMargin: Theme.spacingM
spacing: Theme.spacingS
StyledText {
text: wifiDelegate.isPinned ? I18n.tr("Pinned") : I18n.tr("Pin")
font.pixelSize: Theme.fontSizeSmall
color: wifiDelegate.isPinned ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
DankRipple {
id: pinRipple
cornerRadius: parent.radius
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
onClicked: {
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
let pinnedList = root.normalizePinList(pins["preferredWifi"]);
const pinIndex = pinnedList.indexOf(modelData.ssid);
if (pinIndex !== -1) {
pinnedList.splice(pinIndex, 1);
} else {
pinnedList.unshift(modelData.ssid);
if (pinnedList.length > root.maxPinnedNetworks)
pinnedList = pinnedList.slice(0, root.maxPinnedNetworks);
DankIcon {
name: {
let strength = modelData.signal || 0;
if (strength >= 50)
return "wifi";
if (strength >= 25)
return "wifi_2_bar";
return "wifi_1_bar";
}
size: Theme.iconSize - 4
color: modelData.ssid === NetworkService.currentWifiSSID ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
if (pinnedList.length > 0)
pins["preferredWifi"] = pinnedList;
else
delete pins["preferredWifi"];
Column {
anchors.verticalCenter: parent.verticalCenter
width: 200
SettingsData.set("wifiNetworkPins", pins);
}
}
}
StyledText {
text: modelData.ssid || I18n.tr("Unknown Network")
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
font.weight: modelData.ssid === NetworkService.currentWifiSSID ? Font.Medium : Font.Normal
elide: Text.ElideRight
width: parent.width
}
DankRipple {
id: wifiRipple
cornerRadius: parent.radius
}
Row {
spacing: Theme.spacingXS
MouseArea {
id: networkMouseArea
anchors.fill: parent
anchors.rightMargin: optionsButton.width + Theme.spacingM + Theme.spacingS + pinWifiRow.width + Theme.spacingS * 4
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => wifiRipple.trigger(mouse.x, mouse.y)
onClicked: function (event) {
if (wifiDelegate.isConnected) {
event.accepted = true;
return;
StyledText {
text: modelData.ssid === NetworkService.currentWifiSSID ? I18n.tr("Connected") + " •" : (modelData.secured ? I18n.tr("Secured") + " •" : I18n.tr("Open") + " •")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
StyledText {
text: modelData.saved ? I18n.tr("Saved") : ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.primary
visible: text.length > 0
}
StyledText {
text: (modelData.saved ? "• " : "") + modelData.signal + "%"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}
if (modelData.secured && !modelData.saved && DMSService.apiVersion < 7) {
PopoutService.showWifiPasswordModal(modelData.ssid);
} else {
NetworkService.connectToWifi(modelData.ssid);
DankActionButton {
id: optionsButton
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
iconName: "more_horiz"
buttonSize: 28
onClicked: {
if (networkContextMenu.visible) {
networkContextMenu.close();
} else {
wifiContent.menuOpen = true;
networkContextMenu.currentSSID = modelData.ssid;
networkContextMenu.currentSecured = modelData.secured;
networkContextMenu.currentConnected = modelData.ssid === NetworkService.currentWifiSSID;
networkContextMenu.currentSaved = modelData.saved;
networkContextMenu.currentSignal = modelData.signal;
networkContextMenu.currentAutoconnect = modelData.autoconnect || false;
networkContextMenu.popup(optionsButton, -networkContextMenu.width + optionsButton.width, optionsButton.height + Theme.spacingXS);
}
}
}
Rectangle {
anchors.right: parent.right
anchors.rightMargin: optionsButton.width + Theme.spacingM + Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
width: pinWifiRow.width + Theme.spacingS * 2
height: 28
radius: height / 2
color: {
const isThisNetworkPinned = wifiContent.getPinnedNetworks().includes(modelData.ssid);
return isThisNetworkPinned ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : Theme.withAlpha(Theme.surfaceText, 0.05);
}
Row {
id: pinWifiRow
anchors.centerIn: parent
spacing: 4
DankIcon {
name: "push_pin"
size: 16
color: {
const isThisNetworkPinned = wifiContent.getPinnedNetworks().includes(modelData.ssid);
return isThisNetworkPinned ? Theme.primary : Theme.surfaceText;
}
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: {
const isThisNetworkPinned = wifiContent.getPinnedNetworks().includes(modelData.ssid);
return isThisNetworkPinned ? I18n.tr("Pinned") : I18n.tr("Pin");
}
font.pixelSize: Theme.fontSizeSmall
color: {
const isThisNetworkPinned = wifiContent.getPinnedNetworks().includes(modelData.ssid);
return isThisNetworkPinned ? Theme.primary : Theme.surfaceText;
}
anchors.verticalCenter: parent.verticalCenter
}
}
DankRipple {
id: pinRipple
cornerRadius: parent.radius
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
onClicked: {
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
let pinnedList = wifiContent.normalizePinList(pins["preferredWifi"]);
const pinIndex = pinnedList.indexOf(modelData.ssid);
if (pinIndex !== -1) {
pinnedList.splice(pinIndex, 1);
} else {
pinnedList.unshift(modelData.ssid);
if (pinnedList.length > wifiContent.maxPinnedNetworks)
pinnedList = pinnedList.slice(0, wifiContent.maxPinnedNetworks);
}
if (pinnedList.length > 0)
pins["preferredWifi"] = pinnedList;
else
delete pins["preferredWifi"];
SettingsData.set("wifiNetworkPins", pins);
}
}
}
DankRipple {
id: wifiRipple
cornerRadius: parent.radius
}
MouseArea {
id: networkMouseArea
anchors.fill: parent
anchors.rightMargin: optionsButton.width + Theme.spacingM + Theme.spacingS + pinWifiRow.width + Theme.spacingS * 4
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => wifiRipple.trigger(mouse.x, mouse.y)
onClicked: function (event) {
if (modelData.ssid !== NetworkService.currentWifiSSID) {
if (modelData.secured && !modelData.saved) {
if (DMSService.apiVersion >= 7) {
NetworkService.connectToWifi(modelData.ssid);
} else {
PopoutService.showWifiPasswordModal(modelData.ssid);
}
} else {
NetworkService.connectToWifi(modelData.ssid);
}
}
event.accepted = true;
}
}
event.accepted = true;
}
}
}
@@ -751,8 +759,6 @@ Rectangle {
property int currentSignal: 0
property bool currentAutoconnect: false
readonly property bool showSavedOptions: currentSaved || currentConnected
onClosed: {
wifiContent.menuOpen = false;
}
@@ -784,13 +790,17 @@ Rectangle {
onTriggered: {
if (networkContextMenu.currentConnected) {
NetworkService.disconnectWifi();
return;
} else {
if (networkContextMenu.currentSecured && !networkContextMenu.currentSaved) {
if (DMSService.apiVersion >= 7) {
NetworkService.connectToWifi(networkContextMenu.currentSSID);
} else {
PopoutService.showWifiPasswordModal(networkContextMenu.currentSSID);
}
} else {
NetworkService.connectToWifi(networkContextMenu.currentSSID);
}
}
if (networkContextMenu.currentSecured && !networkContextMenu.currentSaved && DMSService.apiVersion < 7) {
PopoutService.showWifiPasswordModal(networkContextMenu.currentSSID);
return;
}
NetworkService.connectToWifi(networkContextMenu.currentSSID);
}
}
@@ -812,16 +822,15 @@ Rectangle {
}
onTriggered: {
const networkData = NetworkService.getNetworkInfo(networkContextMenu.currentSSID);
networkInfoModalLoader.active = true;
networkInfoModalLoader.item.showNetworkInfo(networkContextMenu.currentSSID, networkData);
let networkData = NetworkService.getNetworkInfo(networkContextMenu.currentSSID);
networkInfoModal.showNetworkInfo(networkContextMenu.currentSSID, networkData);
}
}
MenuItem {
text: networkContextMenu.currentAutoconnect ? I18n.tr("Disable Autoconnect") : I18n.tr("Enable Autoconnect")
height: networkContextMenu.showSavedOptions && DMSService.apiVersion > 13 ? 32 : 0
visible: networkContextMenu.showSavedOptions && DMSService.apiVersion > 13
height: (networkContextMenu.currentSaved || networkContextMenu.currentConnected) && DMSService.apiVersion > 13 ? 32 : 0
visible: (networkContextMenu.currentSaved || networkContextMenu.currentConnected) && DMSService.apiVersion > 13
contentItem: StyledText {
text: parent.text
@@ -843,8 +852,8 @@ Rectangle {
MenuItem {
text: I18n.tr("Forget Network")
height: networkContextMenu.showSavedOptions ? 32 : 0
visible: networkContextMenu.showSavedOptions
height: networkContextMenu.currentSaved || networkContextMenu.currentConnected ? 32 : 0
visible: networkContextMenu.currentSaved || networkContextMenu.currentConnected
contentItem: StyledText {
text: parent.text
@@ -865,15 +874,11 @@ Rectangle {
}
}
Loader {
id: networkInfoModalLoader
active: false
sourceComponent: NetworkInfoModal {}
NetworkInfoModal {
id: networkInfoModal
}
Loader {
id: networkWiredInfoModalLoader
active: false
sourceComponent: NetworkWiredInfoModal {}
NetworkWiredInfoModal {
id: networkWiredInfoModal
}
}
@@ -216,18 +216,14 @@ QtObject {
}
const pluginComponent = PluginService.pluginWidgetComponents[plugin.id];
if (!pluginComponent)
continue;
let tempInstance;
try {
tempInstance = pluginComponent.createObject(null);
} catch (e) {
PluginService.reloadPlugin(plugin.id);
if (!pluginComponent || typeof pluginComponent.createObject !== 'function') {
continue;
}
if (!tempInstance)
const tempInstance = pluginComponent.createObject(null);
if (!tempInstance) {
continue;
}
const hasCCWidget = tempInstance.ccWidgetIcon && tempInstance.ccWidgetIcon.length > 0;
tempInstance.destroy();
+2 -2
View File
@@ -96,7 +96,7 @@ Item {
focusedScreenName = Hyprland.focusedWorkspace.monitor.name;
} else if (CompositorService.isNiri && NiriService.currentOutput) {
focusedScreenName = NiriService.currentOutput;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
focusedScreenName = focusedWs?.monitor?.name || "";
} else if (CompositorService.isDwl && DwlService.activeOutput) {
@@ -125,7 +125,7 @@ Item {
focusedScreenName = Hyprland.focusedWorkspace.monitor.name;
} else if (CompositorService.isNiri && NiriService.currentOutput) {
focusedScreenName = NiriService.currentOutput;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
focusedScreenName = focusedWs?.monitor?.name || "";
} else if (CompositorService.isDwl && DwlService.activeOutput) {
@@ -103,7 +103,7 @@ Item {
}, (_, i) => i);
}
return DwlService.getVisibleTags(barWindow.screenName);
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const workspaces = I3.workspaces?.values || [];
if (workspaces.length === 0)
return [
@@ -145,7 +145,7 @@ Item {
return 0;
const activeTags = DwlService.getActiveTags(barWindow.screenName);
return activeTags.length > 0 ? activeTags[0] : 0;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
if (!barWindow.screenName || SettingsData.workspaceFollowFocus) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
return focusedWs ? focusedWs.num : 1;
@@ -194,7 +194,7 @@ Item {
if (nextIndex !== validIndex) {
DwlService.switchToTag(barWindow.screenName, realWorkspaces[nextIndex]);
}
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const currentWs = getCurrentWorkspace();
const currentIndex = realWorkspaces.findIndex(ws => ws.num === currentWs);
const validIndex = currentIndex === -1 ? 0 : currentIndex;
@@ -96,6 +96,10 @@ PanelWindow {
}
}
BackgroundEffect.blurRegion: Region {
item: barUnitInset
}
WlrLayershell.layer: dBarLayer
WlrLayershell.namespace: "dms:bar"
@@ -55,7 +55,7 @@ BasePill {
}
IconImage {
visible: SettingsData.launcherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle || CompositorService.isLabwc)
visible: SettingsData.launcherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isLabwc)
anchors.centerIn: parent
width: Theme.barIconSize(root.barThickness, SettingsData.launcherLogoSizeOffset, root.barConfig?.noBackground)
height: Theme.barIconSize(root.barThickness, SettingsData.launcherLogoSizeOffset, root.barConfig?.noBackground)
@@ -72,8 +72,6 @@ BasePill {
return "file://" + Theme.shellDir + "/assets/sway.svg";
} else if (CompositorService.isScroll) {
return "file://" + Theme.shellDir + "/assets/sway.svg";
} else if (CompositorService.isMiracle) {
return "file://" + Theme.shellDir + "/assets/miraclewm.svg";
} else if (CompositorService.isLabwc) {
return "file://" + Theme.shellDir + "/assets/labwc.png";
}
@@ -155,7 +155,6 @@ BasePill {
property real touchpadThreshold: 500
onWheel: function (wheelEvent) {
wheelEvent.accepted = true;
const deltaY = wheelEvent.angleDelta.y;
const isMouseWheel = Math.abs(deltaY) >= 120 && (Math.abs(deltaY) % 120) === 0;
@@ -10,45 +10,6 @@ BasePill {
property bool isActive: false
readonly property bool hasUpdates: SystemUpdateService.updateCount > 0
readonly property bool isChecking: SystemUpdateService.isChecking
readonly property bool shouldHide: SettingsData.updaterHideWidget && !hasUpdates && !isChecking && !SystemUpdateService.hasError
opacity: shouldHide ? 0 : 1
states: [
State {
name: "hidden_horizontal"
when: root.shouldHide && !isVerticalOrientation
PropertyChanges {
target: root
width: 0
}
},
State {
name: "hidden_vertical"
when: root.shouldHide && isVerticalOrientation
PropertyChanges {
target: root
height: 0
}
}
]
transitions: [
Transition {
NumberAnimation {
properties: "width,height"
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
]
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Ref {
service: SystemUpdateService
@@ -37,7 +37,6 @@ Item {
return DwlService.activeOutput || root.screenName;
case "sway":
case "scroll":
case "miracle":
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
return focusedWs?.monitor?.name || root.screenName;
default:
@@ -45,7 +44,7 @@ Item {
}
}
readonly property bool useExtWorkspace: DMSService.forceExtWorkspace || (!CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway && !CompositorService.isScroll && !CompositorService.isMiracle && ExtWorkspaceService.extWorkspaceAvailable)
readonly property bool useExtWorkspace: DMSService.forceExtWorkspace || (!CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway && !CompositorService.isScroll && ExtWorkspaceService.extWorkspaceAvailable)
Connections {
target: DesktopEntries
@@ -68,7 +67,6 @@ Item {
return activeTags.length > 0 ? activeTags[0] : -1;
case "sway":
case "scroll":
case "miracle":
return getSwayActiveWorkspace();
default:
return 1;
@@ -99,7 +97,6 @@ Item {
break;
case "sway":
case "scroll":
case "miracle":
baseList = getSwayWorkspaces();
break;
default:
@@ -117,23 +114,12 @@ Item {
}
];
function mapWorkspace(ws) {
return {
"num": ws.number,
"name": ws.name,
"focused": ws.focused,
"active": ws.active,
"urgent": ws.urgent,
"monitor": ws.monitor
};
}
if (!root.screenName || SettingsData.workspaceFollowFocus) {
return workspaces.slice().sort((a, b) => a.num - b.num).map(mapWorkspace);
return workspaces.slice().sort((a, b) => a.num - b.num);
}
const monitorWorkspaces = workspaces.filter(ws => ws.monitor?.name === root.screenName);
return monitorWorkspaces.length > 0 ? monitorWorkspaces.sort((a, b) => a.num - b.num).map(mapWorkspace) : [
return monitorWorkspaces.length > 0 ? monitorWorkspaces.sort((a, b) => a.num - b.num) : [
{
"num": 1
}
@@ -236,7 +222,7 @@ Item {
return [];
}
targetWorkspaceId = ws.tag;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
targetWorkspaceId = ws.num !== undefined ? ws.num : ws;
} else {
return [];
@@ -248,7 +234,7 @@ Item {
let isActiveWs = false;
if (CompositorService.isNiri) {
isActiveWs = NiriService.allWorkspaces.some(ws => ws.id === targetWorkspaceId && ws.is_active);
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
isActiveWs = focusedWs ? (focusedWs.num === targetWorkspaceId) : false;
} else if (CompositorService.isDwl) {
@@ -269,7 +255,7 @@ Item {
let winWs = null;
if (CompositorService.isNiri) {
winWs = w.workspace_id;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
winWs = w.workspace?.num;
} else {
const hyprlandToplevels = Array.from(Hyprland.toplevels?.values || []);
@@ -336,7 +322,7 @@ Item {
placeholder = {
"tag": -1
};
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
placeholder = {
"num": -1
};
@@ -530,7 +516,7 @@ Item {
return ws && ws.id !== -1;
if (CompositorService.isDwl)
return ws && ws.tag !== -1;
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
if (CompositorService.isSway || CompositorService.isScroll)
return ws && ws.num !== -1;
return ws !== -1;
});
@@ -602,7 +588,7 @@ Item {
}
DwlService.switchToTag(root.screenName, realWorkspaces[nextIndex].tag);
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
const realWorkspaces = getRealWorkspaces();
if (realWorkspaces.length < 2) {
return;
@@ -631,7 +617,7 @@ Item {
return modelData?.id || "";
if (CompositorService.isDwl)
return (modelData?.tag !== undefined) ? (modelData.tag + 1) : "";
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
if (CompositorService.isSway || CompositorService.isScroll)
return modelData?.num || "";
return modelData - 1;
}
@@ -646,7 +632,7 @@ Item {
isPlaceholder = modelData?.id === -1;
} else if (CompositorService.isDwl) {
isPlaceholder = modelData?.tag === -1;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
isPlaceholder = modelData?.num === -1;
} else {
isPlaceholder = modelData === -1;
@@ -679,7 +665,7 @@ Item {
return getWorkspaceIndexFallback(modelData, index);
}
readonly property bool hasNativeWorkspaceSupport: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
readonly property bool hasNativeWorkspaceSupport: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll
readonly property bool hasWorkspaces: getRealWorkspaces().length > 0
readonly property bool shouldShow: hasNativeWorkspaceSupport || (useExtWorkspace && hasWorkspaces)
@@ -879,7 +865,7 @@ Item {
return !!(modelData && modelData.id === root.currentWorkspace);
if (CompositorService.isDwl)
return !!(modelData && root.dwlActiveTags.includes(modelData.tag));
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
if (CompositorService.isSway || CompositorService.isScroll)
return !!(modelData && modelData.num === root.currentWorkspace);
return modelData === root.currentWorkspace;
}
@@ -903,7 +889,7 @@ Item {
return !!(modelData && modelData.id === -1);
if (CompositorService.isDwl)
return !!(modelData && modelData.tag === -1);
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
if (CompositorService.isSway || CompositorService.isScroll)
return !!(modelData && modelData.num === -1);
return modelData === -1;
}
@@ -920,17 +906,12 @@ Item {
return loadedIsUrgent;
if (CompositorService.isDwl)
return modelData?.state === 2;
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
if (CompositorService.isSway || CompositorService.isScroll)
return loadedIsUrgent;
return false;
}
readonly property var loadedIconData: {
if (isPlaceholder) return null;
const name = modelData?.name;
if (!name) return null;
return SettingsData.getWorkspaceNameIcon(name);
}
readonly property bool loadedHasIcon: loadedIconData !== null
property var loadedIconData: null
property bool loadedHasIcon: false
property var loadedIcons: []
readonly property int stableIconCount: {
@@ -946,7 +927,7 @@ Item {
targetWorkspaceId = modelData?.id;
} else if (CompositorService.isDwl) {
targetWorkspaceId = modelData?.tag;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
targetWorkspaceId = modelData?.num;
}
if (targetWorkspaceId === undefined || targetWorkspaceId === null)
@@ -965,7 +946,7 @@ Item {
let winWs = null;
if (CompositorService.isNiri) {
winWs = w.workspace_id;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
winWs = w.workspace?.num;
} else if (CompositorService.isHyprland) {
const hyprlandToplevels = Array.from(Hyprland.toplevels?.values || []);
@@ -990,9 +971,9 @@ Item {
readonly property real baseWidth: root.isVertical ? (SettingsData.showWorkspaceApps ? Math.max(widgetHeight * 0.7, root.appIconSize + Theme.spacingXS * 2) : widgetHeight * 0.5) : (isActive ? root.widgetHeight * 1.05 : root.widgetHeight * 0.7)
readonly property real baseHeight: root.isVertical ? (isActive ? root.widgetHeight * 1.05 : root.widgetHeight * 0.7) : (SettingsData.showWorkspaceApps ? Math.max(widgetHeight * 0.7, root.appIconSize + Theme.spacingXS * 2) : widgetHeight * 0.5)
readonly property bool hasWorkspaceName: SettingsData.showWorkspaceName && modelData?.name && modelData.name !== ""
readonly property bool workspaceNamesEnabled: SettingsData.showWorkspaceName && (CompositorService.isNiri || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
readonly property real contentImplicitWidth: hasWorkspaceName ? (appIconsLoader.item?.contentWidth ?? 0) : 0
readonly property real contentImplicitHeight: workspaceNamesEnabled ? (appIconsLoader.item?.contentHeight ?? 0) : 0
readonly property bool workspaceNamesEnabled: SettingsData.showWorkspaceName && CompositorService.isNiri
readonly property real contentImplicitWidth: (hasWorkspaceName || loadedHasIcon) ? (appIconsLoader.item?.contentWidth ?? 0) : 0
readonly property real contentImplicitHeight: (workspaceNamesEnabled || loadedHasIcon) ? (appIconsLoader.item?.contentHeight ?? 0) : 0
readonly property real iconsExtraWidth: {
if (!root.isVertical && SettingsData.showWorkspaceApps && stableIconCount > 0) {
@@ -1142,7 +1123,9 @@ Item {
return;
if (!dragHandler.dragging) {
const distance = root.isVertical ? Math.abs(mouse.y - dragHandler.dragStartPos.y) : Math.abs(mouse.x - dragHandler.dragStartPos.x);
const distance = root.isVertical
? Math.abs(mouse.y - dragHandler.dragStartPos.y)
: Math.abs(mouse.x - dragHandler.dragStartPos.x);
if (distance > 5) {
dragHandler.dragging = true;
root.dragSourceIndex = index;
@@ -1153,7 +1136,9 @@ Item {
if (!dragHandler.dragging)
return;
const rawAxisOffset = root.isVertical ? (mouse.y - dragHandler.dragStartPos.y) : (mouse.x - dragHandler.dragStartPos.x);
const rawAxisOffset = root.isVertical
? (mouse.y - dragHandler.dragStartPos.y)
: (mouse.x - dragHandler.dragStartPos.x);
const itemSize = (root.isVertical ? delegateRoot.height : delegateRoot.width) + Theme.spacingS;
const maxOffsetPositive = (root.workspaceList.length - 1 - index) * itemSize;
@@ -1204,7 +1189,7 @@ Item {
Hyprland.dispatch(`workspace ${modelData.id}`);
} else if (CompositorService.isDwl && modelData?.tag !== undefined) {
DwlService.switchToTag(root.screenName, modelData.tag);
} else if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && modelData?.num) {
} else if ((CompositorService.isSway || CompositorService.isScroll) && modelData?.num) {
try {
I3.dispatch(`workspace number ${modelData.num}`);
} catch (_) {}
@@ -1227,6 +1212,8 @@ Item {
onTriggered: {
if (isPlaceholder) {
delegateRoot.loadedWorkspaceData = null;
delegateRoot.loadedIconData = null;
delegateRoot.loadedHasIcon = false;
delegateRoot.loadedIcons = [];
delegateRoot.loadedIsUrgent = false;
return;
@@ -1241,7 +1228,7 @@ Item {
wsData = modelData;
} else if (CompositorService.isDwl) {
wsData = modelData;
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
} else if (CompositorService.isSway || CompositorService.isScroll) {
wsData = modelData;
}
delegateRoot.loadedWorkspaceData = wsData;
@@ -1252,8 +1239,15 @@ Item {
delegateRoot.loadedIsUrgent = wsData?.urgent ?? false;
}
var icData = null;
if (wsData?.name) {
icData = SettingsData.getWorkspaceNameIcon(wsData.name);
}
delegateRoot.loadedIconData = icData;
delegateRoot.loadedHasIcon = icData !== null;
if (SettingsData.showWorkspaceApps) {
if (CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
if (CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll) {
delegateRoot.loadedIcons = root.getWorkspaceIcons(modelData);
} else if (CompositorService.isNiri) {
delegateRoot.loadedIcons = root.getWorkspaceIcons(isPlaceholder ? null : modelData);
@@ -1416,7 +1410,7 @@ Item {
Item {
visible: loadedHasIcon && loadedIconData?.type === "icon"
width: wsIcon.width
width: wsIcon.width + (isActive && loadedIcons.length > 0 ? 4 : 0)
height: root.appIconSize
DankIcon {
@@ -1431,7 +1425,7 @@ Item {
Item {
visible: loadedHasIcon && loadedIconData?.type === "text"
width: wsText.implicitWidth
width: wsText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
height: root.appIconSize
StyledText {
@@ -1445,14 +1439,14 @@ Item {
}
Item {
visible: ((SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon) || (loadedHasIcon && SettingsData.showWorkspaceName && hasWorkspaceName)
width: wsIndexText.implicitWidth
visible: (SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon
width: wsIndexText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
height: root.appIconSize
StyledText {
id: wsIndexText
anchors.verticalCenter: parent.verticalCenter
text: loadedHasIcon ? (modelData?.name ?? "") : root.getWorkspaceIndex(modelData, index)
text: root.getWorkspaceIndex(modelData, index)
color: (isActive || isUrgent) ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
@@ -1570,9 +1564,9 @@ Item {
}
StyledText {
visible: ((SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon) || (loadedHasIcon && SettingsData.showWorkspaceName && hasWorkspaceName)
visible: (SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon
anchors.horizontalCenter: parent.horizontalCenter
text: loadedHasIcon ? (root.isVertical ? (modelData?.name ?? "").charAt(0) : (modelData?.name ?? "")) : root.getWorkspaceIndex(modelData, index)
text: root.getWorkspaceIndex(modelData, index)
color: (isActive || isUrgent) ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
@@ -1666,6 +1660,55 @@ Item {
}
}
// Loader for Custom Name Icon
Loader {
id: customIconLoader
anchors.fill: parent
active: !isPlaceholder && loadedHasIcon && loadedIconData.type === "icon" && !SettingsData.showWorkspaceApps
sourceComponent: Item {
DankIcon {
anchors.centerIn: parent
name: loadedIconData ? loadedIconData.value : "" // NULL CHECK
size: Theme.fontSizeSmall
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : Theme.surfaceTextMedium
weight: isActive && !isPlaceholder ? 500 : 400
}
}
}
// Loader for Custom Name Text
Loader {
id: customTextLoader
anchors.fill: parent
active: !isPlaceholder && loadedHasIcon && loadedIconData.type === "text" && !SettingsData.showWorkspaceApps
sourceComponent: Item {
StyledText {
anchors.centerIn: parent
text: loadedIconData ? loadedIconData.value : "" // NULL CHECK
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : Theme.surfaceTextMedium
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
}
}
}
// Loader for Workspace Index
Loader {
id: indexLoader
anchors.fill: parent
active: (SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon && !SettingsData.showWorkspaceApps
sourceComponent: Item {
StyledText {
anchors.centerIn: parent
text: {
return root.getWorkspaceIndex(modelData, index);
}
color: (isActive || isUrgent) ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
font.pixelSize: Theme.barTextSize(barThickness, barConfig?.fontScale)
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
}
}
}
}
Component.onCompleted: updateAllData()
@@ -1717,7 +1760,7 @@ Item {
}
Connections {
target: I3.workspaces
enabled: (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
enabled: (CompositorService.isSway || CompositorService.isScroll)
function onValuesChanged() {
delegateRoot.updateAllData();
}
@@ -74,8 +74,6 @@ Card {
return "on Sway";
if (CompositorService.isScroll)
return "on Scroll";
if (CompositorService.isMiracle)
return "on Miracle WM";
return "";
}
font.pixelSize: Theme.fontSizeSmall
+12 -7
View File
@@ -12,7 +12,7 @@ Item {
LayoutMirroring.childrenInherit: true
implicitWidth: 700
implicitHeight: 410
implicitHeight: root.available ? mainColumn.implicitHeight : unavailableColumn.implicitHeight + Theme.spacingXL * 2
property bool syncing: false
property bool showHourly: false
property bool available: WeatherService.weather.available
@@ -848,7 +848,6 @@ Item {
}
Item {
id: chipsRow
width: parent.width
height: forecastChips.height
@@ -940,7 +939,7 @@ Item {
Item {
width: parent.width
height: root.height - heroCard.height - skyDateRow.height - chipsRow.height - mainColumn.spacing * 3
height: root.showHourly ? ((hourlyLoader.item?.cardHeight ?? (Theme.fontSizeLarge * 6)) + Theme.spacingXS) : ((dailyLoader.item?.cardHeight ?? (Theme.fontSizeLarge * 6)) + Theme.spacingXS)
Loader {
id: dailyLoader
@@ -982,7 +981,8 @@ Item {
id: hourlyComponent
ListView {
id: hourlyList
anchors.fill: parent
width: parent.width
height: cardHeight + Theme.spacingXS
orientation: ListView.Horizontal
spacing: Theme.spacingS
clip: true
@@ -990,8 +990,10 @@ Item {
highlightRangeMode: ListView.StrictlyEnforceRange
highlightMoveDuration: 0
interactive: true
contentHeight: cardHeight
contentWidth: cardWidth
property var cardHeight: height
property var cardHeight: Theme.fontSizeLarge * 6
property var cardWidth: ((hourlyList.width + hourlyList.spacing) / hourlyList.visibleCount) - hourlyList.spacing
property int initialIndex: (new Date()).getHours()
property bool dense: !SessionData.weatherHourlyDetailed
@@ -1068,7 +1070,8 @@ Item {
id: dailyComponent
ListView {
id: dailyList
anchors.fill: parent
width: parent.width
height: cardHeight + Theme.spacingXS
orientation: ListView.Horizontal
spacing: Theme.spacingS
clip: true
@@ -1076,8 +1079,10 @@ Item {
highlightRangeMode: ListView.StrictlyEnforceRange
highlightMoveDuration: 0
interactive: true
contentHeight: cardHeight
contentWidth: cardWidth
property var cardHeight: height
property var cardHeight: Theme.fontSizeLarge * 6
property var cardWidth: ((dailyList.width + dailyList.spacing) / dailyList.visibleCount) - dailyList.spacing
property int initialIndex: 0
property bool dense: false
+4 -4
View File
@@ -500,10 +500,10 @@ Item {
anchors.top: SettingsData.dockPosition === SettingsData.Position.Top ? parent.top : undefined
anchors.left: SettingsData.dockPosition === SettingsData.Position.Left ? parent.left : undefined
anchors.right: SettingsData.dockPosition === SettingsData.Position.Right ? parent.right : undefined
anchors.bottomMargin: SettingsData.dockPosition === SettingsData.Position.Bottom ? -(SettingsData.dockSpacing / 2 + 1.4) : 0
anchors.topMargin: SettingsData.dockPosition === SettingsData.Position.Top ? -(SettingsData.dockSpacing / 2 + 1.4) : 0
anchors.leftMargin: SettingsData.dockPosition === SettingsData.Position.Left ? -(SettingsData.dockSpacing / 2 + 1.4) : 0
anchors.rightMargin: SettingsData.dockPosition === SettingsData.Position.Right ? -(SettingsData.dockSpacing / 2 + 1.4) : 0
anchors.bottomMargin: SettingsData.dockPosition === SettingsData.Position.Bottom ? -(SettingsData.dockSpacing / 2) : 0
anchors.topMargin: SettingsData.dockPosition === SettingsData.Position.Top ? -(SettingsData.dockSpacing / 2) : 0
anchors.leftMargin: SettingsData.dockPosition === SettingsData.Position.Left ? -(SettingsData.dockSpacing / 2) : 0
anchors.rightMargin: SettingsData.dockPosition === SettingsData.Position.Right ? -(SettingsData.dockSpacing / 2) : 0
sourceComponent: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right ? columnIndicator : rowIndicator
@@ -236,7 +236,7 @@ Item {
}
IconImage {
visible: SettingsData.dockLauncherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle || CompositorService.isLabwc)
visible: SettingsData.dockLauncherLogoMode === "compositor" && (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isLabwc)
anchors.centerIn: parent
width: actualIconSize + SettingsData.dockLauncherLogoSizeOffset
height: actualIconSize + SettingsData.dockLauncherLogoSizeOffset
@@ -253,8 +253,6 @@ Item {
return "file://" + Theme.shellDir + "/assets/sway.svg";
} else if (CompositorService.isScroll) {
return "file://" + Theme.shellDir + "/assets/sway.svg";
} else if (CompositorService.isMiracle) {
return "file://" + Theme.shellDir + "/assets/miraclewm.svg";
} else if (CompositorService.isLabwc) {
return "file://" + Theme.shellDir + "/assets/labwc.png";
}
+2 -20
View File
@@ -14,7 +14,7 @@ dms-greeter - DankMaterialShell greeter launcher
Usage: dms-greeter --command COMPOSITOR [OPTIONS]
Required:
--command COMPOSITOR Compositor to use (niri, hyprland, sway, scroll, miracle, mango, or labwc)
--command COMPOSITOR Compositor to use (niri, hyprland, sway, scroll, mango, or labwc)
Options:
-C, --config PATH Custom compositor config file
@@ -244,24 +244,6 @@ SCROLL_EOF
exec scroll -c "$COMPOSITOR_CONFIG"
;;
miracle|miracle-wm)
if [[ -z "$COMPOSITOR_CONFIG" ]]; then
TEMP_CONFIG=$(mktemp)
cat > "$TEMP_CONFIG" << MIRACLE_EOF
exec "$QS_CMD; miraclemsg exit"
MIRACLE_EOF
COMPOSITOR_CONFIG="$TEMP_CONFIG"
else
TEMP_CONFIG=$(mktemp)
cat "$COMPOSITOR_CONFIG" > "$TEMP_CONFIG"
cat >> "$TEMP_CONFIG" << MIRACLE_EOF
exec "$QS_CMD; miraclemsg exit"
MIRACLE_EOF
COMPOSITOR_CONFIG="$TEMP_CONFIG"
fi
exec miracle-wm -c "$COMPOSITOR_CONFIG"
;;
labwc)
if [[ -n "$COMPOSITOR_CONFIG" ]]; then
@@ -281,7 +263,7 @@ MIRACLE_EOF
*)
echo "Error: Unsupported compositor: $COMPOSITOR" >&2
echo "Supported compositors: niri, hyprland, sway, scroll, miracle, mango, labwc" >&2
echo "Supported compositors: niri, hyprland, sway, scroll, mango, labwc" >&2
exit 1
;;
esac
@@ -21,8 +21,8 @@ Rectangle {
}
readonly property bool compactMode: SettingsData.notificationCompactMode
readonly property real cardPadding: compactMode ? Theme.notificationCardPaddingCompact : Theme.notificationCardPadding
readonly property real iconSize: compactMode ? Theme.notificationIconSizeCompact : Theme.notificationIconSizeNormal
readonly property real cardPadding: compactMode ? Theme.spacingS : Theme.spacingM
readonly property real iconSize: compactMode ? 48 : 63
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
readonly property real collapsedContentHeight: iconSize + cardPadding
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight
@@ -93,7 +93,7 @@ Rectangle {
anchors.right: parent.right
anchors.topMargin: cardPadding
anchors.leftMargin: Theme.spacingL
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
anchors.rightMargin: Theme.spacingL + (compactMode ? 32 : 40)
height: collapsedContentHeight + extraHeight
DankCircularImage {
@@ -165,47 +165,32 @@ Rectangle {
Column {
width: parent.width
anchors.top: parent.top
spacing: Theme.notificationContentSpacing
spacing: compactMode ? 1 : 2
Row {
StyledText {
width: parent.width
spacing: Theme.spacingXS
readonly property real reservedTrailingWidth: historySeparator.implicitWidth + Math.max(historyTimeText.implicitWidth, 72) + spacing
text: {
const timeStr = NotificationService.formatHistoryTime(historyItem.timestamp);
const appName = historyItem.appName || "";
return timeStr.length > 0 ? `${appName} ${timeStr}` : appName;
}
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
id: historyTitleText
width: Math.min(implicitWidth, Math.max(0, parent.width - parent.reservedTrailingWidth))
text: {
let title = historyItem.summary || "";
const appName = historyItem.appName || "";
const prefix = appName + " • ";
if (appName && title.toLowerCase().startsWith(prefix.toLowerCase())) {
title = title.substring(prefix.length);
}
return title;
}
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
id: historySeparator
text: (historyTitleText.text.length > 0 && historyTimeText.text.length > 0) ? " • " : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
}
StyledText {
id: historyTimeText
text: NotificationService.formatHistoryTime(historyItem.timestamp)
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
visible: text.length > 0
}
StyledText {
text: historyItem.summary || ""
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
width: parent.width
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
@@ -278,7 +278,7 @@ Item {
Behavior on x {
enabled: !swipeDragHandler.active && delegateRoot.__delegateInitialized
NumberAnimation {
duration: Theme.notificationExitDuration
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
@@ -286,7 +286,7 @@ Item {
Behavior on opacity {
enabled: delegateRoot.__delegateInitialized
NumberAnimation {
duration: delegateRoot.__delegateInitialized ? Theme.notificationExitDuration : 0
duration: delegateRoot.__delegateInitialized ? Theme.shortDuration : 0
}
}
}
@@ -11,63 +11,15 @@ DankListView {
property bool autoScrollDisabled: false
property bool isAnimatingExpansion: false
property alias listContentHeight: listView.contentHeight
property real stableContentHeight: 0
property bool cardAnimateExpansion: true
property bool listInitialized: false
property int swipingCardIndex: -1
property real swipingCardOffset: 0
property real __pendingStableHeight: 0
property real __heightUpdateThreshold: 20
Component.onCompleted: {
Qt.callLater(() => {
if (listView) {
listView.listInitialized = true;
listView.stableContentHeight = listView.contentHeight;
}
listInitialized = true;
});
}
Timer {
id: heightUpdateDebounce
interval: Theme.mediumDuration + 20
repeat: false
onTriggered: {
if (!listView.isAnimatingExpansion && Math.abs(listView.__pendingStableHeight - listView.stableContentHeight) > listView.__heightUpdateThreshold) {
listView.stableContentHeight = listView.__pendingStableHeight;
}
}
}
onContentHeightChanged: {
if (!isAnimatingExpansion) {
__pendingStableHeight = contentHeight;
if (Math.abs(contentHeight - stableContentHeight) > __heightUpdateThreshold) {
heightUpdateDebounce.restart();
} else {
stableContentHeight = contentHeight;
}
}
}
onIsAnimatingExpansionChanged: {
if (isAnimatingExpansion) {
heightUpdateDebounce.stop();
let delta = 0;
for (let i = 0; i < count; i++) {
const item = itemAtIndex(i);
if (item && item.children[0] && item.children[0].isAnimating)
delta += item.children[0].targetHeight - item.height;
}
const targetHeight = contentHeight + delta;
// During expansion, always update immediately without threshold check
stableContentHeight = targetHeight;
} else {
__pendingStableHeight = contentHeight;
heightUpdateDebounce.restart();
}
}
clip: true
model: NotificationService.groupedNotifications
spacing: Theme.spacingL
@@ -134,47 +86,29 @@ DankListView {
readonly property real dismissThreshold: width * 0.35
property bool __delegateInitialized: false
readonly property bool isAdjacentToSwipe: listView.count >= 2 && listView.swipingCardIndex !== -1 &&
(index === listView.swipingCardIndex - 1 || index === listView.swipingCardIndex + 1)
readonly property real adjacentSwipeInfluence: isAdjacentToSwipe ? listView.swipingCardOffset * 0.10 : 0
readonly property real adjacentScaleInfluence: isAdjacentToSwipe ? 1.0 - Math.abs(listView.swipingCardOffset) / width * 0.02 : 1.0
readonly property real swipeFadeStartOffset: width * 0.75
readonly property real swipeFadeDistance: Math.max(1, width - swipeFadeStartOffset)
Component.onCompleted: {
Qt.callLater(() => {
if (delegateRoot)
delegateRoot.__delegateInitialized = true;
__delegateInitialized = true;
});
}
width: ListView.view.width
height: notificationCard.height
clip: notificationCard.isAnimating
height: isDismissing ? 0 : notificationCard.targetHeight
clip: isDismissing || notificationCard.isAnimating
NotificationCard {
id: notificationCard
width: parent.width
x: delegateRoot.swipeOffset + delegateRoot.adjacentSwipeInfluence
listLevelAdjacentScaleInfluence: delegateRoot.adjacentScaleInfluence
listLevelScaleAnimationsEnabled: listView.swipingCardIndex === -1 || !delegateRoot.isAdjacentToSwipe
x: delegateRoot.swipeOffset
notificationGroup: modelData
keyboardNavigationActive: listView.keyboardActive
animateExpansion: listView.cardAnimateExpansion && listView.listInitialized
opacity: {
const swipeAmount = Math.abs(delegateRoot.swipeOffset);
if (swipeAmount <= delegateRoot.swipeFadeStartOffset)
return 1;
const fadeProgress = (swipeAmount - delegateRoot.swipeFadeStartOffset) / delegateRoot.swipeFadeDistance;
return Math.max(0, 1 - fadeProgress);
}
opacity: 1 - Math.abs(delegateRoot.swipeOffset) / (delegateRoot.width * 0.5)
onIsAnimatingChanged: {
if (isAnimating) {
listView.isAnimatingExpansion = true;
} else {
Qt.callLater(() => {
if (!notificationCard || !listView)
return;
let anyAnimating = false;
for (let i = 0; i < listView.count; i++) {
const item = listView.itemAtIndex(i);
@@ -205,7 +139,7 @@ DankListView {
}
Behavior on x {
enabled: !swipeDragHandler.active && !delegateRoot.isDismissing && (listView.swipingCardIndex === -1 || !delegateRoot.isAdjacentToSwipe) && listView.listInitialized
enabled: !swipeDragHandler.active && listView.listInitialized
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -227,18 +161,12 @@ DankListView {
xAxis.enabled: true
onActiveChanged: {
if (active) {
listView.swipingCardIndex = index;
return;
}
listView.swipingCardIndex = -1;
listView.swipingCardOffset = 0;
if (delegateRoot.isDismissing)
if (active || delegateRoot.isDismissing)
return;
if (Math.abs(delegateRoot.swipeOffset) > delegateRoot.dismissThreshold) {
delegateRoot.isDismissing = true;
swipeDismissAnim.to = delegateRoot.swipeOffset > 0 ? delegateRoot.width : -delegateRoot.width;
swipeDismissAnim.start();
delegateRoot.swipeOffset = delegateRoot.swipeOffset > 0 ? delegateRoot.width : -delegateRoot.width;
dismissTimer.start();
} else {
delegateRoot.swipeOffset = 0;
}
@@ -248,18 +176,13 @@ DankListView {
if (delegateRoot.isDismissing)
return;
delegateRoot.swipeOffset = translation.x;
listView.swipingCardOffset = translation.x;
}
}
NumberAnimation {
id: swipeDismissAnim
target: delegateRoot
property: "swipeOffset"
to: 0
duration: Theme.notificationExitDuration
easing.type: Easing.OutCubic
onStopped: NotificationService.dismissGroup(delegateRoot.modelData?.key || "")
Timer {
id: dismissTimer
interval: Theme.shortDuration
onTriggered: NotificationService.dismissGroup(delegateRoot.modelData?.key || "")
}
}
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Services.Notifications
import qs.Common
@@ -19,43 +18,28 @@ Rectangle {
property bool isGroupSelected: false
property int selectedNotificationIndex: -1
property bool keyboardNavigationActive: false
property int swipingNotificationIndex: -1
property real swipingNotificationOffset: 0
property real listLevelAdjacentScaleInfluence: 1.0
property bool listLevelScaleAnimationsEnabled: true
readonly property bool compactMode: SettingsData.notificationCompactMode
readonly property real cardPadding: compactMode ? Theme.notificationCardPaddingCompact : Theme.notificationCardPadding
readonly property real iconSize: compactMode ? Theme.notificationIconSizeCompact : Theme.notificationIconSizeNormal
readonly property real cardPadding: compactMode ? Theme.spacingS : Theme.spacingM
readonly property real iconSize: compactMode ? 48 : 63
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
readonly property real collapsedDismissOffset: 5
readonly property real badgeSize: compactMode ? 16 : 18
readonly property real actionButtonHeight: compactMode ? 20 : 24
readonly property real collapsedContentHeight: Math.max(iconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2))
readonly property real collapsedContentHeight: iconSize
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing
width: parent ? parent.width : 400
height: expanded ? (expandedContent.height + cardPadding * 2) : (baseCardHeight + collapsedContent.extraHeight)
readonly property real targetHeight: expanded ? (expandedContent.height + cardPadding * 2) : (baseCardHeight + collapsedContent.extraHeight)
radius: Theme.cornerRadius
scale: (cardHoverHandler.hovered ? 1.01 : 1.0) * listLevelAdjacentScaleInfluence
property bool __initialized: false
Component.onCompleted: {
Qt.callLater(() => {
if (root)
root.__initialized = true;
__initialized = true;
});
}
Behavior on scale {
enabled: listLevelScaleAnimationsEnabled
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Behavior on border.color {
enabled: root.__initialized
ColorAnimation {
@@ -99,10 +83,6 @@ Rectangle {
}
clip: true
HoverHandler {
id: cardHoverHandler
}
Rectangle {
anchors.fill: parent
radius: parent.radius
@@ -129,16 +109,15 @@ Rectangle {
id: collapsedContent
readonly property real expandedTextHeight: descriptionText.contentHeight
readonly property real collapsedLineCount: compactMode ? 1 : 2
readonly property real collapsedLineHeight: Theme.fontSizeSmall * 1.2 * collapsedLineCount
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > collapsedLineHeight + 2) ? (expandedTextHeight - collapsedLineHeight) : 0
readonly property real twoLineHeight: descriptionText.font.pixelSize * 1.2 * 2
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > twoLineHeight + 2) ? (expandedTextHeight - twoLineHeight) : 0
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: cardPadding
anchors.leftMargin: Theme.spacingL
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
anchors.rightMargin: Theme.spacingL + (compactMode ? 32 : 40)
height: collapsedContentHeight + extraHeight
visible: !expanded
@@ -160,7 +139,6 @@ Rectangle {
height: iconSize
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: descriptionExpanded ? Math.max(0, Theme.fontSizeSmall * 1.2 + (Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)) / 2 - iconSize / 2) : Math.max(0, Theme.fontSizeSmall * 1.2 + (textContainer.height - Theme.fontSizeSmall * 1.2) / 2 - iconSize / 2)
imageSource: {
if (hasNotificationImage)
@@ -234,49 +212,29 @@ Rectangle {
Column {
width: parent.width
anchors.top: parent.top
spacing: Theme.notificationContentSpacing
spacing: compactMode ? 1 : 2
Row {
id: collapsedHeaderRow
StyledText {
width: parent.width
spacing: Theme.spacingXS
visible: (collapsedHeaderAppNameText.text.length > 0 || collapsedHeaderTimeText.text.length > 0)
StyledText {
id: collapsedHeaderAppNameText
text: notificationGroup?.appName || ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
elide: Text.ElideRight
maximumLineCount: 1
width: Math.min(implicitWidth, parent.width - collapsedHeaderSeparator.implicitWidth - collapsedHeaderTimeText.implicitWidth - parent.spacing * 2)
}
StyledText {
id: collapsedHeaderSeparator
text: (collapsedHeaderAppNameText.text.length > 0 && collapsedHeaderTimeText.text.length > 0) ? " • " : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
}
StyledText {
id: collapsedHeaderTimeText
text: notificationGroup?.latestNotification?.timeStr || ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
text: {
const timeStr = (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.timeStr) || "";
const appName = (notificationGroup && notificationGroup.appName) || "";
return timeStr.length > 0 ? `${appName} ${timeStr}` : appName;
}
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
id: collapsedTitleText
width: parent.width
text: notificationGroup?.latestNotification?.summary || ""
text: (notificationGroup && notificationGroup.latestNotification && notificationGroup.latestNotification.summary) || ""
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
width: parent.width
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
@@ -343,7 +301,7 @@ Rectangle {
Row {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
anchors.rightMargin: Theme.spacingL + (compactMode ? 32 : 40)
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS
@@ -385,331 +343,214 @@ Rectangle {
objectName: "notificationRepeater"
model: notificationGroup?.notifications?.slice(0, 10) || []
delegate: Item {
id: expandedDelegateWrapper
delegate: Rectangle {
required property var modelData
required property int index
readonly property bool messageExpanded: NotificationService.expandedMessages[modelData?.notification?.id] || false
readonly property bool isSelected: root.selectedNotificationIndex === index
readonly property bool actionsVisible: true
readonly property real expandedIconSize: compactMode ? Theme.notificationExpandedIconSizeCompact : Theme.notificationExpandedIconSizeNormal
HoverHandler {
id: expandedDelegateHoverHandler
}
readonly property real expandedIconSize: compactMode ? 40 : 48
readonly property real expandedItemPadding: compactMode ? Theme.spacingS : Theme.spacingM
readonly property real expandedBaseHeight: expandedItemPadding * 2 + Math.max(expandedIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * 2) + actionButtonHeight + contentSpacing * 2
readonly property real expandedBaseHeight: expandedItemPadding * 2 + expandedIconSize + actionButtonHeight + contentSpacing * 2
property bool __delegateInitialized: false
property real swipeOffset: 0
property bool isDismissing: false
readonly property real dismissThreshold: width * 0.35
Component.onCompleted: {
Qt.callLater(() => {
if (expandedDelegateWrapper)
expandedDelegateWrapper.__delegateInitialized = true;
__delegateInitialized = true;
});
}
width: parent.width
height: delegateRect.height
clip: true
Rectangle {
id: delegateRect
width: parent.width
readonly property bool isAdjacentToSwipe: root.swipingNotificationIndex !== -1 &&
(expandedDelegateWrapper.index === root.swipingNotificationIndex - 1 ||
expandedDelegateWrapper.index === root.swipingNotificationIndex + 1)
readonly property real adjacentSwipeInfluence: isAdjacentToSwipe ? root.swipingNotificationOffset * 0.10 : 0
readonly property real adjacentScaleInfluence: isAdjacentToSwipe ? 1.0 - Math.abs(root.swipingNotificationOffset) / width * 0.02 : 1.0
x: expandedDelegateWrapper.swipeOffset + adjacentSwipeInfluence
scale: adjacentScaleInfluence
transformOrigin: Item.Center
Behavior on x {
enabled: !expandedSwipeHandler.active && !expandedDelegateWrapper.isDismissing
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Behavior on scale {
enabled: !expandedSwipeHandler.active
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
height: {
if (!messageExpanded)
return expandedBaseHeight;
const twoLineHeight = bodyText.font.pixelSize * 1.2 * 2;
if (bodyText.implicitHeight > twoLineHeight + 2)
return expandedBaseHeight + bodyText.implicitHeight - twoLineHeight;
height: {
if (!messageExpanded)
return expandedBaseHeight;
}
radius: Theme.cornerRadius
color: isSelected ? Theme.primaryPressed : Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
border.color: isSelected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
border.width: 1
const twoLineHeight = bodyText.font.pixelSize * 1.2 * 2;
if (bodyText.implicitHeight > twoLineHeight + 2)
return expandedBaseHeight + bodyText.implicitHeight - twoLineHeight;
return expandedBaseHeight;
}
radius: Theme.cornerRadius
color: isSelected ? Theme.primaryPressed : Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
border.color: isSelected ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.4) : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
border.width: 1
Behavior on border.color {
enabled: __delegateInitialized
ColorAnimation {
duration: __delegateInitialized ? Theme.shortDuration : 0
easing.type: Theme.standardEasing
Behavior on border.color {
enabled: __delegateInitialized
ColorAnimation {
duration: __delegateInitialized ? Theme.shortDuration : 0
easing.type: Theme.standardEasing
}
}
Behavior on height {
enabled: false
}
Item {
anchors.fill: parent
anchors.margins: compactMode ? Theme.spacingS : Theme.spacingM
anchors.bottomMargin: contentSpacing
DankCircularImage {
id: messageIcon
readonly property string rawImage: modelData?.image || ""
readonly property string iconFromImage: {
if (rawImage.startsWith("image://icon/"))
return rawImage.substring(13);
return "";
}
}
readonly property bool imageHasSpecialPrefix: {
const icon = iconFromImage;
return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:");
}
readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/")
Behavior on height {
enabled: false
width: expandedIconSize
height: expandedIconSize
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: compactMode ? Theme.spacingM : Theme.spacingXL
imageSource: {
if (hasNotificationImage)
return modelData.cleanImage;
if (imageHasSpecialPrefix)
return "";
const appIcon = modelData?.appIcon;
if (!appIcon)
return iconFromImage ? "image://icon/" + iconFromImage : "";
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://") || appIcon.includes("/"))
return appIcon;
if (appIcon.startsWith("material:") || appIcon.startsWith("svg:") || appIcon.startsWith("unicode:") || appIcon.startsWith("image:"))
return "";
return Quickshell.iconPath(appIcon, true);
}
fallbackIcon: {
if (imageHasSpecialPrefix)
return iconFromImage;
return modelData?.appIcon || iconFromImage || "";
}
fallbackText: {
const appName = modelData?.appName || "?";
return appName.charAt(0).toUpperCase();
}
}
Item {
anchors.fill: parent
anchors.margins: compactMode ? Theme.spacingS : Theme.spacingM
anchors.bottomMargin: contentSpacing
anchors.left: messageIcon.right
anchors.leftMargin: Theme.spacingM
anchors.right: parent.right
anchors.rightMargin: Theme.spacingM
anchors.top: parent.top
anchors.bottom: parent.bottom
DankCircularImage {
id: messageIcon
readonly property string rawImage: modelData?.image || ""
readonly property string iconFromImage: {
if (rawImage.startsWith("image://icon/"))
return rawImage.substring(13);
return "";
}
readonly property bool imageHasSpecialPrefix: {
const icon = iconFromImage;
return icon.startsWith("material:") || icon.startsWith("svg:") || icon.startsWith("unicode:") || icon.startsWith("image:");
}
readonly property bool hasNotificationImage: rawImage !== "" && !rawImage.startsWith("image://icon/")
width: expandedIconSize
height: expandedIconSize
Column {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: Theme.fontSizeSmall * 1.2 + (compactMode ? Theme.spacingXS : Theme.spacingS)
anchors.bottom: buttonArea.top
anchors.bottomMargin: contentSpacing
spacing: compactMode ? 1 : 2
imageSource: {
if (hasNotificationImage)
return modelData.cleanImage;
if (imageHasSpecialPrefix)
return "";
const appIcon = modelData?.appIcon;
if (!appIcon)
return iconFromImage ? "image://icon/" + iconFromImage : "";
if (appIcon.startsWith("file://") || appIcon.startsWith("http://") || appIcon.startsWith("https://") || appIcon.includes("/"))
return appIcon;
if (appIcon.startsWith("material:") || appIcon.startsWith("svg:") || appIcon.startsWith("unicode:") || appIcon.startsWith("image:"))
return "";
return Quickshell.iconPath(appIcon, true);
StyledText {
width: parent.width
text: modelData?.timeStr || ""
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
fallbackIcon: {
if (imageHasSpecialPrefix)
return iconFromImage;
return modelData?.appIcon || iconFromImage || "";
StyledText {
width: parent.width
text: modelData?.summary || ""
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
fallbackText: {
const appName = modelData?.appName || "?";
return appName.charAt(0).toUpperCase();
StyledText {
id: bodyText
property bool hasMoreText: truncated
text: modelData?.htmlBody || ""
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
width: parent.width
elide: messageExpanded ? Text.ElideNone : Text.ElideRight
maximumLineCount: messageExpanded ? -1 : 2
wrapMode: Text.WordWrap
visible: text.length > 0
linkColor: Theme.primary
onLinkActivated: link => Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: mouse => {
if (!parent.hoveredLink && (bodyText.hasMoreText || messageExpanded)) {
NotificationService.toggleMessageExpansion(modelData?.notification?.id || "");
}
}
propagateComposedEvents: true
onPressed: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
onReleased: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
}
}
}
Item {
anchors.left: messageIcon.right
anchors.leftMargin: Theme.spacingM
id: buttonArea
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Theme.spacingM
anchors.top: parent.top
anchors.bottom: parent.bottom
height: actionButtonHeight + contentSpacing
Column {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: buttonArea.top
anchors.bottomMargin: contentSpacing
spacing: Theme.notificationContentSpacing
Row {
id: expandedDelegateHeaderRow
width: parent.width
spacing: Theme.spacingXS
visible: (expandedDelegateHeaderAppNameText.text.length > 0 || expandedDelegateHeaderTimeText.text.length > 0)
StyledText {
id: expandedDelegateHeaderAppNameText
text: modelData?.appName || ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
elide: Text.ElideRight
maximumLineCount: 1
width: Math.min(implicitWidth, parent.width - expandedDelegateHeaderSeparator.implicitWidth - expandedDelegateHeaderTimeText.implicitWidth - parent.spacing * 2)
}
StyledText {
id: expandedDelegateHeaderSeparator
text: (expandedDelegateHeaderAppNameText.text.length > 0 && expandedDelegateHeaderTimeText.text.length > 0) ? " • " : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
}
StyledText {
id: expandedDelegateHeaderTimeText
text: modelData?.timeStr || ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
}
}
StyledText {
id: expandedDelegateTitleText
width: parent.width
text: modelData?.summary || ""
color: Theme.surfaceText
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
elide: Text.ElideRight
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
id: bodyText
property bool hasMoreText: truncated
text: modelData?.htmlBody || ""
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
width: parent.width
elide: messageExpanded ? Text.ElideNone : Text.ElideRight
maximumLineCount: messageExpanded ? -1 : 2
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
visible: text.length > 0
linkColor: Theme.primary
onLinkActivated: link => Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : (bodyText.hasMoreText || messageExpanded) ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: mouse => {
if (!parent.hoveredLink && (bodyText.hasMoreText || messageExpanded)) {
NotificationService.toggleMessageExpansion(modelData?.notification?.id || "");
}
}
propagateComposedEvents: true
onPressed: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
onReleased: mouse => {
if (parent.hoveredLink) {
mouse.accepted = false;
}
}
}
}
}
Item {
id: buttonArea
anchors.left: parent.left
Row {
anchors.right: parent.right
anchors.bottom: parent.bottom
height: actionButtonHeight + contentSpacing
spacing: contentSpacing
Row {
visible: expandedDelegateWrapper.actionsVisible
opacity: visible ? 1 : 0
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: contentSpacing
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Repeater {
model: modelData?.actions || []
Rectangle {
property bool isHovered: false
width: Math.max(expandedActionText.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
StyledText {
id: expandedActionText
text: {
const baseText = modelData.text || "Open";
if (keyboardNavigationActive && (isGroupSelected || selectedNotificationIndex >= 0))
return `${baseText} (${index + 1})`;
return baseText;
}
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
anchors.centerIn: parent
elide: Text.ElideRight
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: parent.isHovered = true
onExited: parent.isHovered = false
onClicked: {
if (modelData && modelData.invoke)
modelData.invoke();
}
}
}
}
Repeater {
model: modelData?.actions || []
Rectangle {
id: expandedDelegateDismissBtn
property bool isHovered: false
visible: expandedDelegateWrapper.actionsVisible
opacity: visible ? 1 : 0
width: Math.max(expandedClearText.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
width: Math.max(expandedActionText.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
StyledText {
id: expandedClearText
text: I18n.tr("Dismiss")
id: expandedActionText
text: {
const baseText = modelData.text || "View";
if (keyboardNavigationActive && (isGroupSelected || selectedNotificationIndex >= 0))
return `${baseText} (${index + 1})`;
return baseText;
}
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
anchors.centerIn: parent
elide: Text.ElideRight
}
MouseArea {
@@ -718,56 +559,44 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
onEntered: parent.isHovered = true
onExited: parent.isHovered = false
onClicked: NotificationService.dismissNotification(modelData)
onClicked: {
if (modelData && modelData.invoke)
modelData.invoke();
}
}
}
}
Rectangle {
property bool isHovered: false
width: Math.max(expandedClearText.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
StyledText {
id: expandedClearText
text: I18n.tr("Dismiss")
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: parent.isHovered = true
onExited: parent.isHovered = false
onClicked: NotificationService.dismissNotification(modelData)
}
}
}
}
}
}
DragHandler {
id: expandedSwipeHandler
target: null
xAxis.enabled: true
yAxis.enabled: false
grabPermissions: PointerHandler.CanTakeOverFromItems | PointerHandler.CanTakeOverFromHandlersOfDifferentType
onActiveChanged: {
if (active) {
root.swipingNotificationIndex = expandedDelegateWrapper.index;
} else {
root.swipingNotificationIndex = -1;
root.swipingNotificationOffset = 0;
}
if (active || expandedDelegateWrapper.isDismissing)
return;
if (Math.abs(expandedDelegateWrapper.swipeOffset) > expandedDelegateWrapper.dismissThreshold) {
expandedDelegateWrapper.isDismissing = true;
expandedSwipeDismissAnim.start();
} else {
expandedDelegateWrapper.swipeOffset = 0;
}
}
onTranslationChanged: {
if (expandedDelegateWrapper.isDismissing)
return;
expandedDelegateWrapper.swipeOffset = translation.x;
root.swipingNotificationOffset = translation.x;
}
}
NumberAnimation {
id: expandedSwipeDismissAnim
target: expandedDelegateWrapper
property: "swipeOffset"
to: expandedDelegateWrapper.swipeOffset > 0 ? expandedDelegateWrapper.width : -expandedDelegateWrapper.width
duration: Theme.notificationExitDuration
easing.type: Easing.OutCubic
onStopped: NotificationService.dismissNotification(modelData)
}
}
}
}
@@ -778,7 +607,7 @@ Rectangle {
anchors.right: clearButton.visible ? clearButton.left : parent.right
anchors.rightMargin: clearButton.visible ? contentSpacing : Theme.spacingL
anchors.top: collapsedContent.bottom
anchors.topMargin: contentSpacing + collapsedDismissOffset
anchors.topMargin: contentSpacing
spacing: contentSpacing
Repeater {
@@ -787,15 +616,15 @@ Rectangle {
Rectangle {
property bool isHovered: false
width: Math.max(collapsedActionText.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
width: Math.max(collapsedActionText.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
StyledText {
id: collapsedActionText
text: {
const baseText = modelData.text || "Open";
const baseText = modelData.text || "View";
if (keyboardNavigationActive && isGroupSelected) {
return `${baseText} (${index + 1})`;
}
@@ -834,11 +663,11 @@ Rectangle {
anchors.right: parent.right
anchors.rightMargin: Theme.spacingL
anchors.top: collapsedContent.bottom
anchors.topMargin: contentSpacing + collapsedDismissOffset
width: Math.max(collapsedClearText.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
anchors.topMargin: contentSpacing
width: Math.max(collapsedClearText.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
StyledText {
id: collapsedClearText
@@ -862,7 +691,6 @@ Rectangle {
MouseArea {
anchors.fill: parent
visible: !expanded && (notificationGroup?.count || 0) > 1 && !descriptionExpanded
cursorShape: Qt.PointingHandCursor
onClicked: {
root.userInitiatedExpansion = true;
NotificationService.toggleGroupExpansion(notificationGroup?.key || "");
@@ -903,11 +731,11 @@ Rectangle {
}
Behavior on height {
enabled: root.__initialized && root.userInitiatedExpansion && root.animateExpansion
enabled: root.userInitiatedExpansion && root.animateExpansion
NumberAnimation {
duration: root.expanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration
duration: Theme.expressiveDurations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.emphasized
easing.bezierCurve: Theme.expressiveCurves.standard
onRunningChanged: {
if (running) {
root.isAnimating = true;
@@ -918,102 +746,4 @@ Rectangle {
}
}
}
Menu {
id: notificationCardContextMenu
width: 220
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle {
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.width: 0
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
MenuItem {
id: setNotificationRulesItem
text: I18n.tr("Set notification rules")
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: {
const appName = notificationGroup?.appName || "";
const desktopEntry = notificationGroup?.latestNotification?.desktopEntry || "";
SettingsData.addNotificationRuleForNotification(appName, desktopEntry);
PopoutService.openSettingsWithTab("notifications");
}
}
MenuItem {
id: muteUnmuteItem
readonly property bool isMuted: SettingsData.isAppMuted(notificationGroup?.appName || "", notificationGroup?.latestNotification?.desktopEntry || "")
text: isMuted ? I18n.tr("Unmute popups for %1").arg(notificationGroup?.appName || I18n.tr("this app")) : I18n.tr("Mute popups for %1").arg(notificationGroup?.appName || I18n.tr("this app"))
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: {
const appName = notificationGroup?.appName || "";
const desktopEntry = notificationGroup?.latestNotification?.desktopEntry || "";
if (isMuted) {
SettingsData.removeMuteRuleForApp(appName, desktopEntry);
} else {
SettingsData.addMuteRuleForApp(appName, desktopEntry);
NotificationService.dismissGroup(notificationGroup?.key || "");
}
}
}
MenuItem {
text: I18n.tr("Dismiss")
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: NotificationService.dismissGroup(notificationGroup?.key || "")
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
z: -2
onClicked: mouse => {
if (mouse.button === Qt.RightButton && notificationGroup) {
notificationCardContextMenu.popup();
}
}
}
}
@@ -7,21 +7,9 @@ DankPopout {
id: root
layerNamespace: "dms:notification-center-popout"
fullHeightSurface: true
property bool notificationHistoryVisible: false
property var triggerScreen: null
property real stablePopupHeight: 400
property real _lastAlignedContentHeight: -1
function updateStablePopupHeight() {
const item = contentLoader.item;
const target = item ? Theme.px(item.implicitHeight, dpr) : 400;
if (Math.abs(target - _lastAlignedContentHeight) < 0.5)
return;
_lastAlignedContentHeight = target;
stablePopupHeight = target;
}
NotificationKeyboardController {
id: keyboardController
@@ -32,12 +20,11 @@ DankPopout {
}
}
popupWidth: triggerScreen ? Math.min(500, Math.max(380, triggerScreen.width - 48)) : 400
popupHeight: stablePopupHeight
popupWidth: 400
popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 400
positioning: ""
animationScaleCollapsed: 0.94
animationScaleCollapsed: 1.0
animationOffset: 0
suspendShadowWhileResizing: false
screen: triggerScreen
shouldBeVisible: notificationHistoryVisible
@@ -81,32 +68,19 @@ DankPopout {
Connections {
target: contentLoader
function onLoaded() {
root.updateStablePopupHeight();
if (root.shouldBeVisible)
Qt.callLater(root.setupKeyboardNavigation);
}
}
Connections {
target: contentLoader.item
function onImplicitHeightChanged() {
root.updateStablePopupHeight();
}
}
onDprChanged: updateStablePopupHeight()
onShouldBeVisibleChanged: {
if (shouldBeVisible) {
NotificationService.onOverlayOpen();
updateStablePopupHeight();
if (contentLoader.item)
Qt.callLater(setupKeyboardNavigation);
} else {
NotificationService.onOverlayClose();
keyboardController.keyboardNavigationActive = false;
NotificationService.expandedGroups = {};
NotificationService.expandedMessages = {};
}
}
@@ -139,7 +113,7 @@ DankPopout {
baseHeight += Theme.spacingM * 2;
const settingsHeight = notificationSettings.expanded ? notificationSettings.contentHeight : 0;
let listHeight = notificationHeader.currentTab === 0 ? notificationList.stableContentHeight : Math.max(200, NotificationService.historyList.length * 80);
let listHeight = notificationHeader.currentTab === 0 ? notificationList.listContentHeight : Math.max(200, NotificationService.historyList.length * 80);
if (notificationHeader.currentTab === 0 && NotificationService.groupedNotifications.length === 0) {
listHeight = 200;
}
@@ -262,50 +262,6 @@ Rectangle {
}
}
Item {
width: parent.width
height: Math.max(privacyRow.implicitHeight, privacyToggle.implicitHeight) + Theme.spacingS
Row {
id: privacyRow
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingM
DankIcon {
name: "privacy_tip"
size: Theme.iconSizeSmall
color: SettingsData.notificationPopupPrivacyMode ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
Column {
spacing: 2
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: I18n.tr("Privacy Mode")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
}
StyledText {
text: I18n.tr("Hide notification content until expanded")
font.pixelSize: Theme.fontSizeSmall - 1
color: Theme.surfaceVariantText
}
}
}
DankToggle {
id: privacyToggle
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.notificationPopupPrivacyMode
onToggled: toggled => SettingsData.set("notificationPopupPrivacyMode", toggled)
}
}
Rectangle {
width: parent.width
height: 1
@@ -13,46 +13,35 @@ PanelWindow {
WlrLayershell.namespace: "dms:notification-popup"
BackgroundEffect.blurRegion: Region {
x: content.x + bgShadowLayer.x
y: content.y + bgShadowLayer.y
width: bgShadowLayer.width
height: bgShadowLayer.height
radius: !win._finalized && !win.exiting ? Theme.cornerRadius : 0
}
required property var notificationData
required property string notificationId
readonly property bool hasValidData: notificationData && notificationData.notification
readonly property alias hovered: cardHoverHandler.hovered
property int screenY: 0
property bool exiting: false
property bool _isDestroying: false
property bool _finalized: false
property real _lastReportedAlignedHeight: -1
property real _storedTopMargin: 0
property real _storedBottomMargin: 0
readonly property string clearText: I18n.tr("Dismiss")
property bool descriptionExpanded: false
readonly property bool hasExpandableBody: (notificationData?.htmlBody || "").replace(/<[^>]*>/g, "").trim().length > 0
onDescriptionExpandedChanged: {
popupHeightChanged();
}
onImplicitHeightChanged: {
const aligned = Theme.px(implicitHeight, dpr);
if (Math.abs(aligned - _lastReportedAlignedHeight) < 0.5)
return;
_lastReportedAlignedHeight = aligned;
popupHeightChanged();
}
readonly property bool compactMode: SettingsData.notificationCompactMode
readonly property real cardPadding: compactMode ? Theme.notificationCardPaddingCompact : Theme.notificationCardPadding
readonly property real popupIconSize: compactMode ? Theme.notificationIconSizeCompact : Theme.notificationIconSizeNormal
readonly property real cardPadding: compactMode ? Theme.spacingS : Theme.spacingM
readonly property real popupIconSize: compactMode ? 48 : 63
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
readonly property real contentBottomClearance: 8
readonly property real actionButtonHeight: compactMode ? 20 : 24
readonly property real collapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)) + contentBottomClearance
readonly property real privacyCollapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2) + contentBottomClearance
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing
readonly property real basePopupHeightPrivacy: cardPadding * 2 + privacyCollapsedContentHeight + actionButtonHeight + contentSpacing
readonly property real collapsedContentHeight: popupIconSize
readonly property real basePopupHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + Theme.spacingS
signal entered
signal exitStarted
signal exitFinished
signal popupHeightChanged
function startExit() {
if (exiting || _isDestroying) {
@@ -118,40 +107,22 @@ PanelWindow {
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
color: "transparent"
implicitWidth: screen ? Math.min(400, Math.max(320, screen.width * 0.23)) : 380
implicitWidth: 400
implicitHeight: {
if (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded)
return basePopupHeightPrivacy;
if (!descriptionExpanded)
return basePopupHeight;
const bodyTextHeight = bodyText.contentHeight || 0;
const collapsedBodyHeight = Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2);
if (bodyTextHeight > collapsedBodyHeight + 2)
return basePopupHeight + bodyTextHeight - collapsedBodyHeight;
const twoLineHeight = Theme.fontSizeSmall * 1.2 * 2;
if (bodyTextHeight > twoLineHeight + 2)
return basePopupHeight + bodyTextHeight - twoLineHeight;
return basePopupHeight;
}
Behavior on implicitHeight {
enabled: !exiting && !_isDestroying
NumberAnimation {
id: implicitHeightAnim
duration: descriptionExpanded ? Theme.notificationExpandDuration : Theme.notificationCollapseDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.emphasized
}
}
onHasValidDataChanged: {
if (!hasValidData && !exiting && !_isDestroying) {
forceExit();
}
}
Component.onCompleted: {
_lastReportedAlignedHeight = Theme.px(implicitHeight, dpr);
_storedTopMargin = getTopMargin();
_storedBottomMargin = getBottomMargin();
if (SettingsData.notificationPopupPrivacyMode)
descriptionExpanded = false;
if (hasValidData) {
Qt.callLater(() => enterX.restart());
} else {
@@ -160,8 +131,6 @@ PanelWindow {
}
onNotificationDataChanged: {
if (!_isDestroying) {
if (SettingsData.notificationPopupPrivacyMode)
descriptionExpanded = false;
wrapperConn.target = win.notificationData || null;
notificationConn.target = (win.notificationData && win.notificationData.notification && win.notificationData.notification.Retainable) || null;
}
@@ -180,33 +149,15 @@ PanelWindow {
}
property bool isTopCenter: SettingsData.notificationPopupPosition === -1
property bool isBottomCenter: SettingsData.notificationPopupPosition === SettingsData.Position.BottomCenter
property bool isCenterPosition: isTopCenter || isBottomCenter
anchors.top: true
anchors.bottom: true
anchors.top: isTopCenter || SettingsData.notificationPopupPosition === SettingsData.Position.Top || SettingsData.notificationPopupPosition === SettingsData.Position.Left
anchors.bottom: SettingsData.notificationPopupPosition === SettingsData.Position.Bottom || SettingsData.notificationPopupPosition === SettingsData.Position.Right
anchors.left: SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom
anchors.right: SettingsData.notificationPopupPosition === SettingsData.Position.Top || SettingsData.notificationPopupPosition === SettingsData.Position.Right
mask: contentInputMask
Region {
id: contentInputMask
item: contentMaskRect
}
Item {
id: contentMaskRect
visible: false
x: content.x
y: content.y
width: alignedWidth
height: alignedHeight
}
margins {
top: _storedTopMargin
bottom: _storedBottomMargin
top: getTopMargin()
bottom: getBottomMargin()
left: getLeftMargin()
right: getRightMargin()
}
@@ -239,7 +190,7 @@ PanelWindow {
function getBottomMargin() {
const popupPos = SettingsData.notificationPopupPosition;
const isBottom = isBottomCenter || popupPos === SettingsData.Position.Bottom || popupPos === SettingsData.Position.Right;
const isBottom = popupPos === SettingsData.Position.Bottom || popupPos === SettingsData.Position.Right;
if (!isBottom)
return 0;
@@ -249,7 +200,7 @@ PanelWindow {
}
function getLeftMargin() {
if (isCenterPosition)
if (isTopCenter)
return screen ? (screen.width - implicitWidth) / 2 : 0;
const popupPos = SettingsData.notificationPopupPosition;
@@ -262,7 +213,7 @@ PanelWindow {
}
function getRightMargin() {
if (isCenterPosition)
if (isTopCenter)
return 0;
const popupPos = SettingsData.notificationPopupPosition;
@@ -283,57 +234,22 @@ PanelWindow {
id: content
x: Theme.snap((win.width - alignedWidth) / 2, dpr)
y: {
const isTop = isTopCenter || SettingsData.notificationPopupPosition === SettingsData.Position.Top || SettingsData.notificationPopupPosition === SettingsData.Position.Left;
if (isTop) {
return Theme.snap(screenY, dpr);
} else {
return Theme.snap(win.height - alignedHeight - screenY, dpr);
}
}
y: Theme.snap((win.height - alignedHeight) / 2, dpr)
width: alignedWidth
height: alignedHeight
visible: !win._finalized
scale: cardHoverHandler.hovered ? 1.01 : 1.0
transformOrigin: Item.Center
Behavior on scale {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
property real swipeOffset: 0
readonly property real dismissThreshold: isCenterPosition ? height * 0.4 : width * 0.35
readonly property real swipeFadeStartRatio: 0.75
readonly property real swipeTravelDistance: isCenterPosition ? height : width
readonly property real swipeFadeStartOffset: swipeTravelDistance * swipeFadeStartRatio
readonly property real swipeFadeDistance: Math.max(1, swipeTravelDistance - swipeFadeStartOffset)
readonly property real dismissThreshold: isTopCenter ? height * 0.4 : width * 0.35
readonly property bool swipeActive: swipeDragHandler.active
property bool swipeDismissing: false
readonly property real radiusForShadow: Theme.cornerRadius
property real shadowBlurPx: SettingsData.notificationPopupShadowEnabled ? ((2 + radiusForShadow * 0.2) * (cardHoverHandler.hovered ? 1.2 : 1)) : 0
property real shadowSpreadPx: SettingsData.notificationPopupShadowEnabled ? (radiusForShadow * (cardHoverHandler.hovered ? 0.06 : 0)) : 0
property real shadowBaseAlpha: 0.35
property real shadowBlurPx: 10
property real shadowSpreadPx: 0
property real shadowBaseAlpha: 0.60
readonly property real popupSurfaceAlpha: SettingsData.popupTransparency
readonly property real effectiveShadowAlpha: Math.max(0, Math.min(1, shadowBaseAlpha * popupSurfaceAlpha))
Behavior on shadowBlurPx {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Behavior on shadowSpreadPx {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Item {
id: bgShadowLayer
anchors.fill: parent
@@ -348,7 +264,7 @@ PanelWindow {
layer.effect: MultiEffect {
id: shadowFx
autoPaddingEnabled: true
shadowEnabled: SettingsData.notificationPopupShadowEnabled
shadowEnabled: true
blurEnabled: false
maskEnabled: false
shadowBlur: Math.max(0, Math.min(1, content.shadowBlurPx / bgShadowLayer.blurMax))
@@ -360,7 +276,15 @@ PanelWindow {
}
Rectangle {
id: shadowShapeSource
anchors.fill: parent
radius: Theme.cornerRadius
color: "transparent"
border.color: Theme.outline
border.width: 1
}
Rectangle {
id: backgroundShape
anchors.fill: parent
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
@@ -370,7 +294,7 @@ PanelWindow {
Rectangle {
anchors.fill: parent
radius: shadowShapeSource.radius
radius: backgroundShape.radius
visible: notificationData && notificationData.urgency === NotificationUrgency.Critical
opacity: 1
clip: true
@@ -402,24 +326,6 @@ PanelWindow {
anchors.margins: Theme.snap(4, win.dpr)
clip: true
HoverHandler {
id: cardHoverHandler
}
Connections {
target: cardHoverHandler
function onHoveredChanged() {
if (!notificationData || win.exiting || win._isDestroying)
return;
if (cardHoverHandler.hovered) {
if (notificationData.timer)
notificationData.timer.stop();
} else if (notificationData.popup && notificationData.timer) {
notificationData.timer.restart();
}
}
}
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
@@ -427,18 +333,16 @@ PanelWindow {
id: notificationContent
readonly property real expandedTextHeight: bodyText.contentHeight || 0
readonly property real collapsedBodyHeight: Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)
readonly property real effectiveCollapsedHeight: (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) ? win.privacyCollapsedContentHeight : win.collapsedContentHeight
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > collapsedBodyHeight + 2) ? (expandedTextHeight - collapsedBodyHeight) : 0
readonly property real twoLineHeight: Theme.fontSizeSmall * 1.2 * 2
readonly property real extraHeight: (descriptionExpanded && expandedTextHeight > twoLineHeight + 2) ? (expandedTextHeight - twoLineHeight) : 0
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: cardPadding
anchors.leftMargin: Theme.spacingL
anchors.rightMargin: Theme.spacingL + Theme.notificationHoverRevealMargin
height: effectiveCollapsedHeight + extraHeight
clip: SettingsData.notificationPopupPrivacyMode && !descriptionExpanded
anchors.rightMargin: Theme.spacingL + (compactMode ? 32 : 40)
height: collapsedContentHeight + extraHeight
DankCircularImage {
id: iconContainer
@@ -460,15 +364,6 @@ PanelWindow {
height: popupIconSize
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: {
if (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) {
const headerSummary = Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2;
return Math.max(0, headerSummary / 2 - popupIconSize / 2);
}
if (descriptionExpanded)
return Math.max(0, Theme.fontSizeSmall * 1.2 + (Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2)) / 2 - popupIconSize / 2);
return Math.max(0, Theme.fontSizeSmall * 1.2 + (textContainer.height - Theme.fontSizeSmall * 1.2) / 2 - popupIconSize / 2);
}
imageSource: {
if (!notificationData)
@@ -522,40 +417,24 @@ PanelWindow {
anchors.leftMargin: Theme.spacingM
anchors.right: parent.right
anchors.top: parent.top
spacing: Theme.notificationContentSpacing
spacing: compactMode ? 1 : 2
Row {
id: headerRow
StyledText {
width: parent.width
spacing: Theme.spacingXS
visible: headerAppNameText.text.length > 0 || headerTimeText.text.length > 0
StyledText {
id: headerAppNameText
text: notificationData ? (notificationData.appName || "") : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
elide: Text.ElideRight
maximumLineCount: 1
width: Math.min(implicitWidth, parent.width - headerSeparator.implicitWidth - headerTimeText.implicitWidth - parent.spacing * 2)
}
StyledText {
id: headerSeparator
text: (headerAppNameText.text.length > 0 && headerTimeText.text.length > 0) ? " • " : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
}
StyledText {
id: headerTimeText
text: notificationData ? (notificationData.timeStr || "") : ""
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Normal
text: {
if (!notificationData)
return "";
const appName = notificationData.appName || "";
const timeStr = notificationData.timeStr || "";
return timeStr.length > 0 ? appName + " • " + timeStr : appName;
}
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
maximumLineCount: 1
visible: text.length > 0
}
StyledText {
@@ -581,9 +460,8 @@ PanelWindow {
elide: descriptionExpanded ? Text.ElideNone : Text.ElideRight
horizontalAlignment: Text.AlignLeft
maximumLineCount: descriptionExpanded ? -1 : (compactMode ? 1 : 2)
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
wrapMode: Text.WordWrap
visible: text.length > 0
opacity: (SettingsData.notificationPopupPrivacyMode && !descriptionExpanded) ? 0 : 1
linkColor: Theme.primary
onLinkActivated: link => Qt.openUrlExternally(link)
@@ -607,14 +485,6 @@ PanelWindow {
}
}
}
StyledText {
text: I18n.tr("Message Content", "notification privacy mode placeholder")
color: Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
width: parent.width
visible: SettingsData.notificationPopupPrivacyMode && !descriptionExpanded && win.hasExpandableBody
}
}
}
@@ -626,38 +496,16 @@ PanelWindow {
anchors.topMargin: cardPadding
anchors.rightMargin: Theme.spacingL
iconName: "close"
iconSize: compactMode ? 14 : 16
buttonSize: compactMode ? 20 : 24
iconSize: compactMode ? 16 : 18
buttonSize: compactMode ? 24 : 28
z: 15
onClicked: {
if (notificationData && !win.exiting)
notificationData.popup = false;
}
}
DankActionButton {
id: expandButton
anchors.right: closeButton.left
anchors.rightMargin: Theme.spacingXS
anchors.top: parent.top
anchors.topMargin: cardPadding
iconName: descriptionExpanded ? "expand_less" : "expand_more"
iconSize: compactMode ? 14 : 16
buttonSize: compactMode ? 20 : 24
z: 15
visible: SettingsData.notificationPopupPrivacyMode && win.hasExpandableBody
onClicked: {
if (win.hasExpandableBody)
win.descriptionExpanded = !win.descriptionExpanded;
}
}
Row {
visible: cardHoverHandler.hovered
opacity: visible ? 1 : 0
anchors.right: clearButton.visible ? clearButton.left : parent.right
anchors.rightMargin: clearButton.visible ? contentSpacing : Theme.spacingL
anchors.top: notificationContent.bottom
@@ -665,28 +513,21 @@ PanelWindow {
spacing: contentSpacing
z: 20
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
Repeater {
model: notificationData ? (notificationData.actions || []) : []
Rectangle {
property bool isHovered: false
width: Math.max(actionText.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
width: Math.max(actionText.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
StyledText {
id: actionText
text: modelData.text || "Open"
text: modelData.text || "View"
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.weight: Font.Medium
@@ -718,22 +559,15 @@ PanelWindow {
property bool isHovered: false
readonly property int actionCount: notificationData ? (notificationData.actions || []).length : 0
visible: actionCount < 3 && cardHoverHandler.hovered
opacity: visible ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
visible: actionCount < 3
anchors.right: parent.right
anchors.rightMargin: Theme.spacingL
anchors.top: notificationContent.bottom
anchors.topMargin: contentSpacing
width: Math.max(clearTextLabel.implicitWidth + Theme.spacingM, Theme.notificationActionMinWidth)
width: Math.max(clearTextLabel.implicitWidth + Theme.spacingM, compactMode ? 40 : 50)
height: actionButtonHeight
radius: Theme.notificationButtonCornerRadius
color: isHovered ? Theme.withAlpha(Theme.primary, Theme.stateLayerHover) : "transparent"
radius: Theme.spacingXS
color: isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1) : "transparent"
z: 20
StyledText {
@@ -766,19 +600,23 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true
z: -1
onEntered: {
if (notificationData && notificationData.timer)
notificationData.timer.stop();
}
onExited: {
if (notificationData && notificationData.popup && notificationData.timer)
notificationData.timer.restart();
}
onClicked: mouse => {
if (!notificationData || win.exiting)
return;
if (mouse.button === Qt.RightButton) {
popupContextMenu.popup();
NotificationService.dismissNotification(notificationData);
} else if (mouse.button === Qt.LeftButton) {
const canExpand = bodyText.hasMoreText || win.descriptionExpanded || (SettingsData.notificationPopupPrivacyMode && win.hasExpandableBody);
if (canExpand) {
win.descriptionExpanded = !win.descriptionExpanded;
} else if (notificationData.actions && notificationData.actions.length > 0) {
if (notificationData.actions && notificationData.actions.length > 0) {
notificationData.actions[0].invoke();
NotificationService.dismissNotification(notificationData);
} else {
@@ -792,8 +630,8 @@ PanelWindow {
DragHandler {
id: swipeDragHandler
target: null
xAxis.enabled: !isCenterPosition
yAxis.enabled: isCenterPosition
xAxis.enabled: !isTopCenter
yAxis.enabled: isTopCenter
onActiveChanged: {
if (active || win.exiting || content.swipeDismissing)
@@ -811,11 +649,9 @@ PanelWindow {
if (win.exiting)
return;
const raw = isCenterPosition ? translation.y : translation.x;
const raw = isTopCenter ? translation.y : translation.x;
if (isTopCenter) {
content.swipeOffset = Math.min(0, raw);
} else if (isBottomCenter) {
content.swipeOffset = Math.max(0, raw);
} else {
const isLeft = SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom;
content.swipeOffset = isLeft ? Math.min(0, raw) : Math.max(0, raw);
@@ -823,13 +659,7 @@ PanelWindow {
}
}
opacity: {
const swipeAmount = Math.abs(content.swipeOffset);
if (swipeAmount <= content.swipeFadeStartOffset)
return 1;
const fadeProgress = (swipeAmount - content.swipeFadeStartOffset) / content.swipeFadeDistance;
return Math.max(0, 1 - fadeProgress);
}
opacity: 1 - Math.abs(content.swipeOffset) / (isTopCenter ? content.height : content.width * 0.6)
Behavior on opacity {
enabled: !content.swipeActive
@@ -841,7 +671,7 @@ PanelWindow {
Behavior on swipeOffset {
enabled: !content.swipeActive && !content.swipeDismissing
NumberAnimation {
duration: Theme.notificationExitDuration
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
@@ -850,8 +680,8 @@ PanelWindow {
id: swipeDismissAnim
target: content
property: "swipeOffset"
to: isTopCenter ? -content.height : isBottomCenter ? content.height : (SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom ? -content.width : content.width)
duration: Theme.notificationExitDuration
to: isTopCenter ? -content.height : (SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom ? -content.width : content.width)
duration: Theme.shortDuration
easing.type: Easing.OutCubic
onStopped: {
NotificationService.dismissNotification(notificationData);
@@ -862,18 +692,18 @@ PanelWindow {
transform: [
Translate {
id: swipeTx
x: isCenterPosition ? 0 : content.swipeOffset
y: isCenterPosition ? content.swipeOffset : 0
x: isTopCenter ? 0 : content.swipeOffset
y: isTopCenter ? content.swipeOffset : 0
},
Translate {
id: tx
x: {
if (isCenterPosition)
if (isTopCenter)
return 0;
const isLeft = SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom;
return isLeft ? -Anims.slidePx : Anims.slidePx;
}
y: isTopCenter ? -Anims.slidePx : isBottomCenter ? Anims.slidePx : 0
y: isTopCenter ? -Anims.slidePx : 0
}
]
}
@@ -882,22 +712,20 @@ PanelWindow {
id: enterX
target: tx
property: isCenterPosition ? "y" : "x"
property: isTopCenter ? "y" : "x"
from: {
if (isTopCenter)
return -Anims.slidePx;
if (isBottomCenter)
return Anims.slidePx;
const isLeft = SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom;
return isLeft ? -Anims.slidePx : Anims.slidePx;
}
to: 0
duration: Theme.notificationEnterDuration
duration: Theme.mediumDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: isCenterPosition ? Theme.expressiveCurves.standardDecel : Theme.expressiveCurves.emphasizedDecel
easing.bezierCurve: isTopCenter ? Theme.expressiveCurves.standardDecel : Theme.expressiveCurves.emphasizedDecel
onStopped: {
if (!win.exiting && !win._isDestroying) {
if (isCenterPosition) {
if (isTopCenter) {
if (Math.abs(tx.y) < 0.5)
win.entered();
} else {
@@ -915,17 +743,15 @@ PanelWindow {
PropertyAnimation {
target: tx
property: isCenterPosition ? "y" : "x"
property: isTopCenter ? "y" : "x"
from: 0
to: {
if (isTopCenter)
return -Anims.slidePx;
if (isBottomCenter)
return Anims.slidePx;
const isLeft = SettingsData.notificationPopupPosition === SettingsData.Position.Left || SettingsData.notificationPopupPosition === SettingsData.Position.Bottom;
return isLeft ? -Anims.slidePx : Anims.slidePx;
}
duration: Theme.notificationExitDuration
duration: Theme.shortDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.emphasizedAccel
}
@@ -935,7 +761,7 @@ PanelWindow {
property: "opacity"
from: 1
to: 0
duration: Theme.notificationExitDuration
duration: Theme.shortDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.standardAccel
}
@@ -945,7 +771,7 @@ PanelWindow {
property: "scale"
from: 1
to: 0.98
duration: Theme.notificationExitDuration
duration: Theme.shortDuration
easing.type: Easing.BezierSpline
easing.bezierCurve: Theme.expressiveCurves.emphasizedAccel
}
@@ -1009,98 +835,4 @@ PanelWindow {
easing.bezierCurve: Theme.expressiveCurves.standardDecel
}
}
Menu {
id: popupContextMenu
width: 220
contentHeight: 130
margins: -1
popupType: Popup.Window
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle {
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.width: 0
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
}
MenuItem {
id: setNotificationRulesItem
text: I18n.tr("Set notification rules")
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: {
const appName = notificationData?.appName || "";
const desktopEntry = notificationData?.desktopEntry || "";
SettingsData.addNotificationRuleForNotification(appName, desktopEntry);
PopoutService.openSettingsWithTab("notifications");
}
}
MenuItem {
id: muteUnmuteItem
readonly property bool isMuted: SettingsData.isAppMuted(notificationData?.appName || "", notificationData?.desktopEntry || "")
text: isMuted ? I18n.tr("Unmute popups for %1").arg(notificationData?.appName || I18n.tr("this app")) : I18n.tr("Mute popups for %1").arg(notificationData?.appName || I18n.tr("this app"))
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: {
const appName = notificationData?.appName || "";
const desktopEntry = notificationData?.desktopEntry || "";
if (isMuted) {
SettingsData.removeMuteRuleForApp(appName, desktopEntry);
} else {
SettingsData.addMuteRuleForApp(appName, desktopEntry);
if (notificationData && !exiting)
NotificationService.dismissNotification(notificationData);
}
}
}
MenuItem {
text: I18n.tr("Dismiss")
contentItem: StyledText {
text: parent.text
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
leftPadding: Theme.spacingS
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: parent.hovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent"
radius: Theme.cornerRadius / 2
}
onTriggered: {
if (notificationData && !exiting)
NotificationService.dismissNotification(notificationData);
}
}
}
}
@@ -8,23 +8,26 @@ QtObject {
property var modelData
property int topMargin: 0
readonly property bool compactMode: SettingsData.notificationCompactMode
readonly property real cardPadding: compactMode ? Theme.notificationCardPaddingCompact : Theme.notificationCardPadding
readonly property real popupIconSize: compactMode ? Theme.notificationIconSizeCompact : Theme.notificationIconSizeNormal
readonly property real cardPadding: compactMode ? Theme.spacingS : Theme.spacingM
readonly property real popupIconSize: compactMode ? 48 : 63
readonly property real actionButtonHeight: compactMode ? 20 : 24
readonly property real contentSpacing: compactMode ? Theme.spacingXS : Theme.spacingS
readonly property real popupSpacing: compactMode ? 0 : Theme.spacingXS
readonly property real collapsedContentHeight: Math.max(popupIconSize, Theme.fontSizeSmall * 1.2 + Theme.fontSizeMedium * 1.2 + Theme.fontSizeSmall * 1.2 * (compactMode ? 1 : 2))
readonly property int baseNotificationHeight: cardPadding * 2 + collapsedContentHeight + actionButtonHeight + contentSpacing + popupSpacing
property var popupWindows: []
readonly property real popupSpacing: 4
readonly property int baseNotificationHeight: cardPadding * 2 + popupIconSize + actionButtonHeight + Theme.spacingS + popupSpacing
property int maxTargetNotifications: 4
property var popupWindows: [] // strong refs to windows (live until exitFinished)
property var destroyingWindows: new Set()
property var pendingDestroys: []
property int destroyDelayMs: 100
property var pendingCreates: []
property int createDelayMs: 50
property bool createBusy: false
property Component popupComponent
popupComponent: Component {
NotificationPopup {
onEntered: manager._onPopupEntered(this)
onExitStarted: manager._onPopupExitStarted(this)
onExitFinished: manager._onPopupExitFinished(this)
onPopupHeightChanged: manager._onPopupHeightChanged(this)
}
}
@@ -68,6 +71,36 @@ QtObject {
destroyTimer.restart();
}
property Timer createTimer: Timer {
interval: createDelayMs
running: false
repeat: false
onTriggered: manager._processCreateQueue()
}
function _processCreateQueue() {
createBusy = false;
if (pendingCreates.length === 0)
return;
const wrapper = pendingCreates.shift();
if (wrapper)
_doInsertNewestAtTop(wrapper);
if (pendingCreates.length > 0) {
createBusy = true;
createTimer.restart();
}
}
function _scheduleCreate(wrapper) {
if (!wrapper)
return;
pendingCreates.push(wrapper);
if (!createBusy) {
createBusy = true;
createTimer.restart();
}
}
sweeper: Timer {
interval: 500
running: false
@@ -93,10 +126,14 @@ QtObject {
}
if (toRemove.length) {
popupWindows = popupWindows.filter(p => toRemove.indexOf(p) === -1);
_repositionAll();
const survivors = _active().sort((a, b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k) {
survivors[k].screenY = topMargin + k * baseNotificationHeight;
}
}
if (popupWindows.length === 0)
if (popupWindows.length === 0) {
sweeper.stop();
}
}
}
@@ -108,29 +145,105 @@ QtObject {
return p && p.status !== Component.Null && !p._isDestroying && p.hasValidData;
}
function _sync(newWrappers) {
for (const p of popupWindows.slice()) {
if (!_isValidWindow(p) || p.exiting)
function _canMakeRoomFor(wrapper) {
const activeWindows = _active();
if (activeWindows.length < maxTargetNotifications) {
return true;
}
if (!wrapper || !wrapper.notification) {
return false;
}
const incomingUrgency = wrapper.urgency || 0;
for (const p of activeWindows) {
if (!p.notificationData || !p.notificationData.notification) {
continue;
if (p.notificationData && newWrappers.indexOf(p.notificationData) === -1) {
}
const existingUrgency = p.notificationData.urgency || 0;
if (existingUrgency < incomingUrgency) {
return true;
}
if (existingUrgency === incomingUrgency) {
const timer = p.notificationData.timer;
if (timer && !timer.running) {
return true;
}
}
}
return false;
}
function _makeRoomForNew(wrapper) {
const activeWindows = _active();
if (activeWindows.length < maxTargetNotifications) {
return;
}
const toRemove = _selectPopupToRemove(activeWindows, wrapper);
if (toRemove && !toRemove.exiting) {
toRemove.notificationData.removedByLimit = true;
toRemove.notificationData.popup = false;
if (toRemove.notificationData.timer) {
toRemove.notificationData.timer.stop();
}
}
}
function _selectPopupToRemove(activeWindows, incomingWrapper) {
const sortedWindows = activeWindows.slice().sort((a, b) => {
const aUrgency = (a.notificationData) ? a.notificationData.urgency || 0 : 0;
const bUrgency = (b.notificationData) ? b.notificationData.urgency || 0 : 0;
if (aUrgency !== bUrgency) {
return aUrgency - bUrgency;
}
const aTimer = a.notificationData && a.notificationData.timer;
const bTimer = b.notificationData && b.notificationData.timer;
const aRunning = aTimer && aTimer.running;
const bRunning = bTimer && bTimer.running;
if (aRunning !== bRunning) {
return aRunning ? 1 : -1;
}
return b.screenY - a.screenY;
});
return sortedWindows[0];
}
function _sync(newWrappers) {
for (const w of newWrappers) {
if (w && !_hasWindowFor(w)) {
insertNewestAtTop(w);
}
}
for (const p of popupWindows.slice()) {
if (!_isValidWindow(p)) {
continue;
}
if (p.notificationData && newWrappers.indexOf(p.notificationData) === -1 && !p.exiting) {
p.notificationData.removedByLimit = true;
p.notificationData.popup = false;
}
}
for (const w of newWrappers) {
if (w && !_hasWindowFor(w))
_insertAtTop(w);
}
}
function _popupHeight(p) {
return (p.alignedHeight || p.implicitHeight || (baseNotificationHeight - popupSpacing)) + popupSpacing;
}
function _insertAtTop(wrapper) {
function insertNewestAtTop(wrapper) {
if (!wrapper)
return;
const notificationId = wrapper?.notification ? wrapper.notification.id : "";
if (createBusy || pendingCreates.length > 0) {
_scheduleCreate(wrapper);
return;
}
_doInsertNewestAtTop(wrapper);
}
function _doInsertNewestAtTop(wrapper) {
if (!wrapper)
return;
for (const p of popupWindows) {
if (!_isValidWindow(p))
continue;
if (p.exiting)
continue;
p.screenY = p.screenY + baseNotificationHeight;
}
const notificationId = wrapper && wrapper.notification ? wrapper.notification.id : "";
const win = popupComponent.createObject(null, {
"notificationData": wrapper,
"notificationId": notificationId,
@@ -143,70 +256,72 @@ QtObject {
win.destroy();
return;
}
popupWindows.unshift(win);
_repositionAll();
popupWindows.push(win);
createBusy = true;
createTimer.restart();
if (!sweeper.running)
sweeper.start();
}
function _repositionAll() {
const active = popupWindows.filter(p => _isValidWindow(p) && p.notificationData?.popup && !p.exiting);
const pinnedSlots = [];
for (const p of active) {
if (!p.hovered)
continue;
pinnedSlots.push({
y: p.screenY,
end: p.screenY + _popupHeight(p)
});
}
pinnedSlots.sort((a, b) => a.y - b.y);
let currentY = topMargin;
for (const win of active) {
if (win.hovered)
continue;
for (const slot of pinnedSlots) {
if (currentY >= slot.y - 1 && currentY < slot.end)
currentY = slot.end;
}
win.screenY = currentY;
currentY += _popupHeight(win);
}
function _active() {
return popupWindows.filter(p => _isValidWindow(p) && p.notificationData && p.notificationData.popup && !p.exiting);
}
function _onPopupHeightChanged(p) {
if (!p || p.exiting || p._isDestroying)
function _bottom() {
let b = null;
let maxY = -1;
for (const p of _active()) {
if (p.screenY > maxY) {
maxY = p.screenY;
b = p;
}
}
return b;
}
function _onPopupEntered(p) {
}
function _onPopupExitStarted(p) {
if (!p)
return;
if (popupWindows.indexOf(p) === -1)
return;
_repositionAll();
const survivors = _active().sort((a, b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k)
survivors[k].screenY = topMargin + k * baseNotificationHeight;
}
function _onPopupExitFinished(p) {
if (!p)
if (!p) {
return;
}
const windowId = p.toString();
if (destroyingWindows.has(windowId))
if (destroyingWindows.has(windowId)) {
return;
}
destroyingWindows.add(windowId);
const i = popupWindows.indexOf(p);
if (i !== -1) {
popupWindows.splice(i, 1);
popupWindows = popupWindows.slice();
}
if (NotificationService.releaseWrapper && p.notificationData)
if (NotificationService.releaseWrapper && p.notificationData) {
NotificationService.releaseWrapper(p.notificationData);
}
_scheduleDestroy(p);
Qt.callLater(() => destroyingWindows.delete(windowId));
_repositionAll();
const survivors = _active().sort((a, b) => a.screenY - b.screenY);
for (let k = 0; k < survivors.length; ++k) {
survivors[k].screenY = topMargin + k * baseNotificationHeight;
}
}
function cleanupAllWindows() {
sweeper.stop();
destroyTimer.stop();
createTimer.stop();
pendingDestroys = [];
pendingCreates = [];
createBusy = false;
for (const p of popupWindows.slice()) {
if (p) {
try {
+53 -32
View File
@@ -7,10 +7,9 @@ DankOSD {
id: root
readonly property bool useVertical: isVerticalLayout
property int _displayBrightness: 0
function _syncBrightness() {
_displayBrightness = DisplayService.brightnessLevel;
property int targetBrightness: {
DisplayService.brightnessVersion;
return DisplayService.brightnessLevel;
}
osdWidth: useVertical ? (40 + Theme.spacingS * 2) : Math.min(260, Screen.width - Theme.spacingM * 2)
@@ -21,9 +20,9 @@ DankOSD {
Connections {
target: DisplayService
function onBrightnessChanged(showOsd) {
root._syncBrightness();
if (showOsd && SettingsData.osdBrightnessEnabled)
if (showOsd && SettingsData.osdBrightnessEnabled) {
root.show();
}
}
}
@@ -54,11 +53,13 @@ DankOSD {
anchors.centerIn: parent
name: {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc")
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
return "brightness_medium";
if (deviceInfo.name.includes("kbd"))
} else if (deviceInfo.name.includes("kbd")) {
return "keyboard";
return "lightbulb";
} else {
return "lightbulb";
}
}
size: Theme.iconSize
color: Theme.primary
@@ -76,16 +77,20 @@ DankOSD {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo)
return 1;
if (SessionData.getBrightnessExponential(deviceInfo.id))
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
if (isExponential) {
return 1;
}
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0;
}
maximum: {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo)
return 100;
if (SessionData.getBrightnessExponential(deviceInfo.id))
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
if (isExponential) {
return 100;
}
return deviceInfo.displayMax || 100;
}
enabled: DisplayService.brightnessAvailable
@@ -94,24 +99,28 @@ DankOSD {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo)
return "%";
if (SessionData.getBrightnessExponential(deviceInfo.id))
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
if (isExponential) {
return "%";
}
return deviceInfo.class === "ddc" ? "" : "%";
}
thumbOutlineColor: Theme.surfaceContainer
alwaysShowValue: SettingsData.osdAlwaysShowValue
onSliderValueChanged: newValue => {
if (!DisplayService.brightnessAvailable)
return;
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
resetHideTimer();
if (DisplayService.brightnessAvailable) {
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
resetHideTimer();
}
}
onContainsMouseChanged: setChildHovered(containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse);
}
Binding on value {
value: root._displayBrightness
value: root.targetBrightness
when: !brightnessSlider.isDragging
}
}
@@ -137,11 +146,13 @@ DankOSD {
anchors.centerIn: parent
name: {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc")
if (!deviceInfo || deviceInfo.class === "backlight" || deviceInfo.class === "ddc") {
return "brightness_medium";
if (deviceInfo.name.includes("kbd"))
} else if (deviceInfo.name.includes("kbd")) {
return "keyboard";
return "lightbulb";
} else {
return "lightbulb";
}
}
size: Theme.iconSize
color: Theme.primary
@@ -159,7 +170,7 @@ DankOSD {
property int value: 50
Binding on value {
value: root._displayBrightness
value: root.targetBrightness
when: !vertSlider.dragging
}
@@ -167,7 +178,8 @@ DankOSD {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo)
return 1;
if (SessionData.getBrightnessExponential(deviceInfo.id))
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
if (isExponential)
return 1;
return (deviceInfo.class === "backlight" || deviceInfo.class === "ddc") ? 1 : 0;
}
@@ -176,7 +188,8 @@ DankOSD {
const deviceInfo = DisplayService.getCurrentDeviceInfo();
if (!deviceInfo)
return 100;
if (SessionData.getBrightnessExponential(deviceInfo.id))
const isExponential = SessionData.getBrightnessExponential(deviceInfo.id);
if (isExponential)
return 100;
return deviceInfo.displayMax || 100;
}
@@ -227,25 +240,33 @@ DankOSD {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: setChildHovered(containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse);
}
onPressed: mouse => {
vertSlider.dragging = true;
updateBrightness(mouse);
}
onReleased: vertSlider.dragging = false
onPositionChanged: mouse => {
if (pressed)
updateBrightness(mouse);
onReleased: {
vertSlider.dragging = false;
}
onClicked: mouse => updateBrightness(mouse)
onPositionChanged: mouse => {
if (pressed) {
updateBrightness(mouse);
}
}
onClicked: mouse => {
updateBrightness(mouse);
}
function updateBrightness(mouse) {
if (!DisplayService.brightnessAvailable)
if (!DisplayService.brightnessAvailable) {
return;
}
const ratio = 1.0 - (mouse.y / height);
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum));
vertSlider.value = newValue;
+68 -35
View File
@@ -8,20 +8,13 @@ DankOSD {
readonly property bool useVertical: isVerticalLayout
readonly property var player: MprisController.activePlayer
readonly property int currentVolume: player ? Math.min(100, Math.round(player.volume * 100)) : 0
readonly property bool volumeSupported: player?.volumeSupported ?? false
property bool _suppressNewPlayer: false
property int _displayVolume: 0
function _syncVolume() {
if (!player)
return;
_displayVolume = Math.min(100, Math.round(player.volume * 100));
}
onPlayerChanged: {
_suppressNewPlayer = true;
_suppressTimer.restart();
_syncVolume();
}
Timer {
@@ -44,25 +37,25 @@ DankOSD {
}
function toggleMute() {
if (!player)
return;
player.volume = player.volume > 0 ? 0 : 1;
if (player) {
player.volume = player.volume > 0 ? 0 : 1;
}
}
function setVolume(volumePercent) {
if (!player)
return;
player.volume = volumePercent / 100;
resetHideTimer();
if (player) {
player.volume = volumePercent / 100;
resetHideTimer();
}
}
Connections {
target: player
function onVolumeChanged() {
root._syncVolume();
if (SettingsData.osdMediaVolumeEnabled && volumeSupported && !_suppressNewPlayer)
if (SettingsData.osdMediaVolumeEnabled && volumeSupported && !_suppressNewPlayer) {
root.show();
}
}
}
@@ -103,7 +96,9 @@ DankOSD {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: toggleMute()
onContainsMouseChanged: setChildHovered(containsMouse || volumeSlider.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || volumeSlider.containsMouse);
}
}
}
@@ -120,21 +115,29 @@ DankOSD {
showValue: true
unit: "%"
thumbOutlineColor: Theme.surfaceContainer
valueOverride: root._displayVolume
valueOverride: currentVolume
alwaysShowValue: SettingsData.osdAlwaysShowValue
Component.onCompleted: {
root._syncVolume();
value = root._displayVolume;
value = currentVolume;
}
onSliderValueChanged: newValue => setVolume(newValue)
onSliderValueChanged: newValue => {
setVolume(newValue);
}
onContainsMouseChanged: setChildHovered(containsMouse || muteButton.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || muteButton.containsMouse);
}
Binding on value {
value: root._displayVolume
when: !volumeSlider.pressed
Connections {
target: player
function onVolumeChanged() {
if (volumeSlider && !volumeSlider.pressed) {
volumeSlider.value = currentVolume;
}
}
}
}
}
@@ -169,7 +172,9 @@ DankOSD {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: toggleMute()
onContainsMouseChanged: setChildHovered(containsMouse || vertSliderArea.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || vertSliderArea.containsMouse);
}
}
}
@@ -181,7 +186,7 @@ DankOSD {
y: gap * 2 + Theme.iconSize
property bool dragging: false
property int value: root._displayVolume
property int value: currentVolume
Rectangle {
id: vertTrack
@@ -226,21 +231,28 @@ DankOSD {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: setChildHovered(containsMouse || muteButtonVert.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || muteButtonVert.containsMouse);
}
onPressed: mouse => {
vertSlider.dragging = true;
updateVolume(mouse);
}
onReleased: vertSlider.dragging = false
onPositionChanged: mouse => {
if (pressed)
updateVolume(mouse);
onReleased: {
vertSlider.dragging = false;
}
onClicked: mouse => updateVolume(mouse)
onPositionChanged: mouse => {
if (pressed) {
updateVolume(mouse);
}
}
onClicked: mouse => {
updateVolume(mouse);
}
function updateVolume(mouse) {
const ratio = 1.0 - (mouse.y / height);
@@ -248,6 +260,16 @@ DankOSD {
setVolume(volume);
}
}
Connections {
target: player
function onVolumeChanged() {
if (!vertSlider.dragging) {
vertSlider.value = currentVolume;
}
}
}
}
StyledText {
@@ -261,4 +283,15 @@ DankOSD {
}
}
}
onOsdShown: {
if (player && contentLoader.item && contentLoader.item.item) {
if (!useVertical) {
const slider = contentLoader.item.item.children[0].children[1];
if (slider && slider.value !== undefined) {
slider.value = currentVolume;
}
}
}
}
}
+88 -49
View File
@@ -7,13 +7,6 @@ DankOSD {
id: root
readonly property bool useVertical: isVerticalLayout
property int _displayVolume: 0
function _syncVolume() {
if (!AudioService.sink?.audio)
return;
_displayVolume = Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100));
}
osdWidth: useVertical ? (40 + Theme.spacingS * 2) : Math.min(260, Screen.width - Theme.spacingM * 2)
osdHeight: useVertical ? Math.min(260, Screen.height - Theme.spacingM * 2) : (40 + Theme.spacingS * 2)
@@ -21,17 +14,18 @@ DankOSD {
enableMouseInteraction: true
Connections {
target: AudioService.sink?.audio ?? null
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
root._syncVolume();
if (SettingsData.osdVolumeEnabled)
if (SettingsData.osdVolumeEnabled) {
root.show();
}
}
function onMutedChanged() {
if (SettingsData.osdVolumeEnabled)
if (SettingsData.osdVolumeEnabled) {
root.show();
}
}
}
@@ -39,9 +33,9 @@ DankOSD {
target: AudioService
function onSinkChanged() {
root._syncVolume();
if (root.shouldBeVisible && SettingsData.osdVolumeEnabled)
if (root.shouldBeVisible && SettingsData.osdVolumeEnabled) {
root.show();
}
}
}
@@ -70,7 +64,7 @@ DankOSD {
DankIcon {
anchors.centerIn: parent
name: AudioService.sink?.audio?.muted ? "volume_off" : "volume_up"
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ? "volume_off" : "volume_up"
size: Theme.iconSize
color: muteButton.containsMouse ? Theme.primary : Theme.surfaceText
}
@@ -81,45 +75,60 @@ DankOSD {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: AudioService.toggleMute()
onContainsMouseChanged: setChildHovered(containsMouse || volumeSlider.containsMouse)
onClicked: {
AudioService.toggleMute();
}
onContainsMouseChanged: {
setChildHovered(containsMouse || volumeSlider.containsMouse);
}
}
}
DankSlider {
id: volumeSlider
readonly property real actualVolumePercent: AudioService.sink && AudioService.sink.audio ? Math.round(AudioService.sink.audio.volume * 100) : 0
readonly property real displayPercent: actualVolumePercent
width: parent.width - Theme.iconSize - parent.gap * 3
height: 40
x: parent.gap * 2 + Theme.iconSize
anchors.verticalCenter: parent.verticalCenter
minimum: 0
maximum: AudioService.sinkMaxVolume
enabled: AudioService.sink?.audio
enabled: AudioService.sink && AudioService.sink.audio
showValue: true
unit: "%"
thumbOutlineColor: Theme.surfaceContainer
valueOverride: root._displayVolume
valueOverride: displayPercent
alwaysShowValue: SettingsData.osdAlwaysShowValue
Component.onCompleted: {
root._syncVolume();
value = root._displayVolume;
if (AudioService.sink && AudioService.sink.audio) {
value = Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100));
}
}
onSliderValueChanged: newValue => {
if (!AudioService.sink?.audio)
return;
SessionData.suppressOSDTemporarily();
AudioService.sink.audio.volume = newValue / 100;
resetHideTimer();
if (AudioService.sink && AudioService.sink.audio) {
SessionData.suppressOSDTemporarily();
AudioService.sink.audio.volume = newValue / 100;
resetHideTimer();
}
}
onContainsMouseChanged: setChildHovered(containsMouse || muteButton.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || muteButton.containsMouse);
}
Binding on value {
value: root._displayVolume
when: !volumeSlider.pressed
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
if (volumeSlider && !volumeSlider.pressed) {
volumeSlider.value = Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100));
}
}
}
}
}
@@ -142,7 +151,7 @@ DankOSD {
DankIcon {
anchors.centerIn: parent
name: AudioService.sink?.audio?.muted ? "volume_off" : "volume_up"
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ? "volume_off" : "volume_up"
size: Theme.iconSize
color: muteButtonVert.containsMouse ? Theme.primary : Theme.surfaceText
}
@@ -153,8 +162,12 @@ DankOSD {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: AudioService.toggleMute()
onContainsMouseChanged: setChildHovered(containsMouse || vertSliderArea.containsMouse)
onClicked: {
AudioService.toggleMute();
}
onContainsMouseChanged: {
setChildHovered(containsMouse || vertSliderArea.containsMouse);
}
}
}
@@ -166,7 +179,7 @@ DankOSD {
y: gap * 2 + Theme.iconSize
property bool dragging: false
property int value: root._displayVolume
property int value: AudioService.sink && AudioService.sink.audio ? Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100)) : 0
Rectangle {
id: vertTrack
@@ -207,35 +220,50 @@ DankOSD {
id: vertSliderArea
anchors.fill: parent
anchors.margins: -12
enabled: AudioService.sink?.audio
enabled: AudioService.sink && AudioService.sink.audio
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: setChildHovered(containsMouse || muteButtonVert.containsMouse)
onContainsMouseChanged: {
setChildHovered(containsMouse || muteButtonVert.containsMouse);
}
onPressed: mouse => {
vertSlider.dragging = true;
updateVolume(mouse);
}
onReleased: vertSlider.dragging = false
onPositionChanged: mouse => {
if (pressed)
updateVolume(mouse);
onReleased: {
vertSlider.dragging = false;
}
onClicked: mouse => updateVolume(mouse)
onPositionChanged: mouse => {
if (pressed) {
updateVolume(mouse);
}
}
onClicked: mouse => {
updateVolume(mouse);
}
function updateVolume(mouse) {
if (!AudioService.sink?.audio)
return;
const maxVol = AudioService.sinkMaxVolume;
const ratio = 1.0 - (mouse.y / height);
const volume = Math.max(0, Math.min(maxVol, Math.round(ratio * maxVol)));
SessionData.suppressOSDTemporarily();
AudioService.sink.audio.volume = volume / 100;
resetHideTimer();
if (AudioService.sink && AudioService.sink.audio) {
const maxVol = AudioService.sinkMaxVolume;
const ratio = 1.0 - (mouse.y / height);
const volume = Math.max(0, Math.min(maxVol, Math.round(ratio * maxVol)));
SessionData.suppressOSDTemporarily();
AudioService.sink.audio.volume = volume / 100;
resetHideTimer();
}
}
}
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
vertSlider.value = Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100));
}
}
}
@@ -251,4 +279,15 @@ DankOSD {
}
}
}
onOsdShown: {
if (AudioService.sink && AudioService.sink.audio && contentLoader.item && contentLoader.item.item) {
if (!useVertical) {
const slider = contentLoader.item.item.children[0].children[1];
if (slider && slider.value !== undefined) {
slider.value = Math.min(AudioService.sinkMaxVolume, Math.round(AudioService.sink.audio.volume * 100));
}
}
}
}
}
+25 -24
View File
@@ -18,41 +18,36 @@ Column {
property bool isInitialized: false
function loadValue() {
const settings = findSettings();
const settings = findSettings()
if (settings && settings.pluginService) {
const loadedValue = settings.loadValue(settingKey, defaultValue);
if (textField.activeFocus && isInitialized)
return;
value = loadedValue;
textField.text = loadedValue;
isInitialized = true;
const loadedValue = settings.loadValue(settingKey, defaultValue)
value = loadedValue
textField.text = loadedValue
isInitialized = true
}
}
Component.onCompleted: {
Qt.callLater(loadValue);
Qt.callLater(loadValue)
}
function commit() {
if (!isInitialized)
return;
if (textField.text === value)
return;
value = textField.text;
const settings = findSettings();
if (settings)
settings.saveValue(settingKey, value);
onValueChanged: {
if (!isInitialized) return
const settings = findSettings()
if (settings) {
settings.saveValue(settingKey, value)
}
}
function findSettings() {
let item = parent;
let item = parent
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item;
return item
}
item = item.parent;
item = item.parent
}
return null;
return null
}
StyledText {
@@ -75,10 +70,16 @@ Column {
id: textField
width: parent.width
placeholderText: root.placeholder
onEditingFinished: root.commit()
onTextEdited: {
root.value = text
}
onEditingFinished: {
root.value = text
}
onActiveFocusChanged: {
if (!activeFocus)
root.commit();
if (!activeFocus) {
root.value = text
}
}
}
}
@@ -14,7 +14,6 @@ DankPopout {
property var triggerScreen: null
property string searchText: ""
property string expandedPid: ""
property string processFilter: "all"
function hide() {
close();
@@ -26,8 +25,8 @@ DankPopout {
open();
}
popupWidth: Math.round(Theme.fontSizeMedium * 46)
popupHeight: Math.round(Theme.fontSizeMedium * 39)
popupWidth: 650
popupHeight: 550
triggerWidth: 55
positioning: ""
screen: triggerScreen
@@ -43,7 +42,6 @@ DankPopout {
if (!shouldBeVisible) {
searchText = "";
expandedPid = "";
processFilter = "all";
}
}
@@ -112,7 +110,6 @@ DankPopout {
Qt.callLater(() => searchField.forceActiveFocus());
} else {
processesView.reset();
processFilterGroup.currentIndex = 0;
}
}
}
@@ -149,38 +146,9 @@ DankPopout {
Layout.fillWidth: true
}
DankButtonGroup {
id: processFilterGroup
Layout.minimumWidth: implicitWidth
model: [I18n.tr("All"), I18n.tr("User"), I18n.tr("System")]
currentIndex: 0
checkEnabled: false
buttonHeight: Math.round(Theme.fontSizeSmall * 2.4)
minButtonWidth: 0
buttonPadding: Theme.spacingM
textSize: Theme.fontSizeSmall
onSelectionChanged: (index, selected) => {
if (!selected)
return;
currentIndex = index;
switch (index) {
case 0:
processListPopout.processFilter = "all";
return;
case 1:
processListPopout.processFilter = "user";
return;
case 2:
processListPopout.processFilter = "system";
return;
}
}
}
DankTextField {
id: searchField
Layout.fillWidth: true
Layout.minimumWidth: Theme.fontSizeMedium * 8
Layout.preferredWidth: Theme.fontSizeMedium * 14
Layout.preferredHeight: Theme.fontSizeMedium * 2.5
placeholderText: I18n.tr("Search...")
leftIconName: "search"
@@ -366,7 +334,6 @@ DankPopout {
anchors.margins: Theme.spacingS
searchText: processListPopout.searchText
expandedPid: processListPopout.expandedPid
processFilter: processListPopout.processFilter
contextMenu: processContextMenu
onExpandedPidChanged: processListPopout.expandedPid = expandedPid
}
@@ -387,7 +354,7 @@ DankPopout {
readonly property real thickness: Math.max(4, Math.min(width, height) / 15)
readonly property real glowExtra: thickness * 1.4
readonly property real arcPadding: (thickness + glowExtra) / 2
readonly property real arcPadding: thickness / 1.3
readonly property real innerDiameter: width - (arcPadding + thickness + glowExtra) * 2
readonly property real maxTextWidth: innerDiameter * 0.9
@@ -11,7 +11,6 @@ Item {
property string searchText: ""
property string expandedPid: ""
property var contextMenu: null
property string processFilter: "all" // "all", "user", "system"
property int selectedIndex: -1
property bool keyboardNavigationActive: false
@@ -42,12 +41,6 @@ Item {
let procs = DgopService.allProcesses.slice();
if (processFilter === "user") {
procs = procs.filter(p => p.username === UserInfoService.username);
} else if (processFilter === "system") {
procs = procs.filter(p => p.username !== UserInfoService.username);
}
if (searchText.length > 0) {
const search = searchText.toLowerCase();
procs = procs.filter(p => {
+2 -11
View File
@@ -14,7 +14,6 @@ Item {
property bool isNiri: CompositorService.isNiri
property bool isSway: CompositorService.isSway
property bool isScroll: CompositorService.isScroll
property bool isMiracle: CompositorService.isMiracle
property bool isDwl: CompositorService.isDwl
property bool isLabwc: CompositorService.isLabwc
@@ -25,8 +24,6 @@ Item {
return "sway";
if (isScroll)
return "scroll";
if (isMiracle)
return "miracle";
if (isDwl)
return "mangowc";
if (isLabwc)
@@ -41,8 +38,6 @@ Item {
return "/assets/sway.svg";
if (isScroll)
return "/assets/sway.svg";
if (isMiracle)
return "/assets/miraclewm.svg";
if (isDwl)
return "/assets/mango.png";
if (isLabwc)
@@ -57,8 +52,6 @@ Item {
return "https://swaywm.org";
if (isScroll)
return "https://github.com/dawsers/scroll";
if (isMiracle)
return "https://github.com/miracle-wm-org/miracle-wm";
if (isDwl)
return "https://github.com/DreamMaoMao/mangowc";
if (isLabwc)
@@ -73,8 +66,6 @@ Item {
return "Sway Website";
if (isScroll)
return "Scroll Github";
if (isMiracle)
return "Miracle WM GitHub";
if (isDwl)
return "mangowc GitHub";
if (isLabwc)
@@ -107,9 +98,9 @@ Item {
property string ircUrl: "https://web.libera.chat/gamja/?channels=#labwc"
property string ircTooltip: "LabWC IRC Channel"
property bool showMatrix: isNiri && !isHyprland && !isSway && !isScroll && !isMiracle && !isDwl && !isLabwc
property bool showMatrix: isNiri && !isHyprland && !isSway && !isScroll && !isDwl && !isLabwc
property bool showCompositorDiscord: isHyprland || isDwl
property bool showReddit: isNiri && !isHyprland && !isSway && !isScroll && !isMiracle && !isDwl && !isLabwc
property bool showReddit: isNiri && !isHyprland && !isSway && !isScroll && !isDwl && !isLabwc
property bool showIrc: isLabwc
DankFlickable {
+5 -191
View File
@@ -18,22 +18,6 @@ Item {
property string editingDeviceType: ""
property string newDeviceName: ""
property bool isReloadingAudio: false
property var hiddenOutputDeviceNames: SessionData.hiddenOutputDeviceNames ?? []
property var hiddenInputDeviceNames: SessionData.hiddenInputDeviceNames ?? []
property bool showHiddenOutputDevices: false
property bool showHiddenInputDevices: false
function persistHiddenOutputDeviceNames(deviceNames) {
const uniqueNames = [...new Set(deviceNames)];
hiddenOutputDeviceNames = uniqueNames;
SessionData.setHiddenOutputDeviceNames(uniqueNames);
}
function persistHiddenInputDeviceNames(deviceNames) {
const uniqueNames = [...new Set(deviceNames)];
hiddenInputDeviceNames = uniqueNames;
SessionData.setHiddenInputDeviceNames(uniqueNames);
}
function updateDeviceList() {
const allNodes = Pipewire.nodes.values;
@@ -72,8 +56,6 @@ Item {
}
Component.onCompleted: {
hiddenOutputDeviceNames = SessionData.hiddenOutputDeviceNames ?? [];
hiddenInputDeviceNames = SessionData.hiddenInputDeviceNames ?? [];
updateDeviceList();
}
@@ -150,7 +132,7 @@ Item {
}
Repeater {
model: root.outputDevices.filter(d => !root.hiddenOutputDeviceNames.includes(d.name))
model: root.outputDevices
delegate: Column {
required property var modelData
@@ -160,7 +142,6 @@ Item {
DeviceAliasRow {
deviceNode: modelData
deviceType: "output"
showHideButton: true
onEditRequested: device => {
root.editingDevice = device;
@@ -172,10 +153,6 @@ Item {
onResetRequested: device => {
AudioService.removeDeviceAlias(device.name);
}
onHideRequested: device => {
root.persistHiddenOutputDeviceNames([...root.hiddenOutputDeviceNames, device.name]);
}
}
Item {
@@ -184,7 +161,7 @@ Item {
StyledText {
id: maxVolLabel
text: I18n.tr("Max Volume", "Audio settings: maximum volume limit per device") + " · " + maxVolSlider.value + "%"
text: I18n.tr("Max Volume", "Audio settings: maximum volume limit per device")
anchors.left: parent.left
anchors.leftMargin: Theme.spacingM + Theme.iconSize + Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
@@ -205,8 +182,6 @@ Item {
maximum: 200
step: 5
showValue: true
wheelEnabled: false
centerMinimum: true
unit: "%"
onSliderValueChanged: newValue => {
SessionData.setDeviceMaxVolume(modelData.name, newValue);
@@ -229,87 +204,9 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
horizontalAlignment: Text.AlignHCenter
visible: root.outputDevices.filter(d => !root.hiddenOutputDeviceNames.includes(d.name)).length === 0 && root.hiddenOutputDeviceNames.length === 0
visible: root.outputDevices.length === 0
topPadding: Theme.spacingM
}
Column {
width: parent.width
spacing: 0
visible: root.hiddenOutputDeviceNames.length > 0
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
}
Item {
width: parent.width
height: 36
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS
DankIcon {
name: "visibility_off"
size: Theme.iconSize - 4
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: I18n.tr("Hidden (%1)", "count of hidden audio devices").arg(root.hiddenOutputDeviceNames.length)
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
DankIcon {
name: root.showHiddenOutputDevices ? "expand_less" : "expand_more"
size: Theme.iconSize - 4
color: Theme.surfaceVariantText
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.showHiddenOutputDevices = !root.showHiddenOutputDevices
}
}
Column {
width: parent.width
spacing: 0
visible: root.showHiddenOutputDevices
Repeater {
model: root.outputDevices.filter(d => root.hiddenOutputDeviceNames.includes(d.name))
delegate: DeviceAliasRow {
required property var modelData
deviceNode: modelData
deviceType: "output"
isHidden: true
showHideButton: true
onHideRequested: device => {
root.persistHiddenOutputDeviceNames(root.hiddenOutputDeviceNames.filter(n => n !== device.name));
}
onResetRequested: device => {
AudioService.removeDeviceAlias(device.name);
}
}
}
}
}
}
}
@@ -341,14 +238,13 @@ Item {
}
Repeater {
model: root.inputDevices.filter(d => !root.hiddenInputDeviceNames.includes(d.name))
model: root.inputDevices
delegate: DeviceAliasRow {
required property var modelData
deviceNode: modelData
deviceType: "input"
showHideButton: true
onEditRequested: device => {
root.editingDevice = device;
@@ -360,10 +256,6 @@ Item {
onResetRequested: device => {
AudioService.removeDeviceAlias(device.name);
}
onHideRequested: device => {
root.persistHiddenInputDeviceNames([...root.hiddenInputDeviceNames, device.name]);
}
}
}
@@ -373,87 +265,9 @@ Item {
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
horizontalAlignment: Text.AlignHCenter
visible: root.inputDevices.filter(d => !root.hiddenInputDeviceNames.includes(d.name)).length === 0 && root.hiddenInputDeviceNames.length === 0
visible: root.inputDevices.length === 0
topPadding: Theme.spacingM
}
Column {
width: parent.width
spacing: 0
visible: root.hiddenInputDeviceNames.length > 0
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
}
Item {
width: parent.width
height: 36
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS
DankIcon {
name: "visibility_off"
size: Theme.iconSize - 4
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: I18n.tr("Hidden (%1)", "count of hidden audio devices").arg(root.hiddenInputDeviceNames.length)
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
DankIcon {
name: root.showHiddenInputDevices ? "expand_less" : "expand_more"
size: Theme.iconSize - 4
color: Theme.surfaceVariantText
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.showHiddenInputDevices = !root.showHiddenInputDevices
}
}
Column {
width: parent.width
spacing: 0
visible: root.showHiddenInputDevices
Repeater {
model: root.inputDevices.filter(d => root.hiddenInputDeviceNames.includes(d.name))
delegate: DeviceAliasRow {
required property var modelData
deviceNode: modelData
deviceType: "input"
isHidden: true
showHideButton: true
onHideRequested: device => {
root.persistHiddenInputDeviceNames(root.hiddenInputDeviceNames.filter(n => n !== device.name));
}
onResetRequested: device => {
AudioService.removeDeviceAlias(device.name);
}
}
}
}
}
}
}
}
@@ -1493,10 +1493,6 @@ Singleton {
}
const original = originalOutputs ? JSON.parse(JSON.stringify(originalOutputs)) : buildOutputsWithPendingChanges();
for (const name in savedOutputs) {
if (!original[name])
original[name] = JSON.parse(JSON.stringify(savedOutputs[name]));
}
backendWriteOutputsConfig(original);
clearPendingChanges();
if (originalOutputs)
@@ -21,9 +21,8 @@ Rectangle {
continue;
const x = output.logical.x;
const y = output.logical.y;
const size = DisplayConfigState.getLogicalSize(output);
const w = size.w || 1920;
const h = size.h || 1080;
const w = output.logical.width || 1920;
const h = output.logical.height || 1080;
minX = Math.min(minX, x);
minY = Math.min(minY, y);
maxX = Math.max(maxX, x + w);
-3
View File
@@ -264,8 +264,6 @@ Item {
modes.push("Sway");
} else if (CompositorService.isScroll) {
modes.push("Scroll");
} else if (CompositorService.isMiracle) {
modes.push("Miracle");
} else {
modes.push(I18n.tr("Compositor"));
}
@@ -509,7 +507,6 @@ Item {
value: SettingsData.dockIconSize
minimum: 24
maximum: 96
unit: "px"
defaultValue: 48
onSliderValueChanged: newValue => SettingsData.set("dockIconSize", newValue)
}
@@ -67,8 +67,6 @@ Item {
modes.push("Sway");
} else if (CompositorService.isScroll) {
modes.push("Scroll");
} else if (CompositorService.isMiracle) {
modes.push("Miracle");
} else {
modes.push(I18n.tr("Compositor"));
}
@@ -6,25 +6,6 @@ import qs.Modules.Settings.Widgets
Item {
id: root
Component.onCompleted: {
if (SettingsData._pendingExpandNotificationRules) {
SettingsData._pendingExpandNotificationRules = false;
notificationRulesCard.userToggledCollapse = true;
notificationRulesCard.expanded = true;
SettingsData._pendingNotificationRuleIndex = -1;
}
}
readonly property var mutedRules: {
var rules = SettingsData.notificationRules || [];
var out = [];
for (var i = 0; i < rules.length; i++) {
if ((rules[i].action || "").toString().toLowerCase() === "mute")
out.push({ rule: rules[i], index: i });
}
return out;
}
readonly property var timeoutOptions: [
{
text: I18n.tr("Never"),
@@ -220,33 +201,22 @@ Item {
return I18n.tr("Top Left", "screen position option");
case SettingsData.Position.Right:
return I18n.tr("Bottom Right", "screen position option");
case SettingsData.Position.BottomCenter:
return I18n.tr("Bottom Center", "screen position option");
default:
return I18n.tr("Top Right", "screen position option");
}
}
options: [I18n.tr("Top Right", "screen position option"), I18n.tr("Top Left", "screen position option"), I18n.tr("Top Center", "screen position option"), I18n.tr("Bottom Center", "screen position option"), I18n.tr("Bottom Right", "screen position option"), I18n.tr("Bottom Left", "screen position option")]
options: [I18n.tr("Top Right", "screen position option"), I18n.tr("Top Left", "screen position option"), I18n.tr("Top Center", "screen position option"), I18n.tr("Bottom Right", "screen position option"), I18n.tr("Bottom Left", "screen position option")]
onValueChanged: value => {
switch (value) {
case I18n.tr("Top Right", "screen position option"):
if (value === I18n.tr("Top Right", "screen position option")) {
SettingsData.set("notificationPopupPosition", SettingsData.Position.Top);
break;
case I18n.tr("Top Left", "screen position option"):
} else if (value === I18n.tr("Top Left", "screen position option")) {
SettingsData.set("notificationPopupPosition", SettingsData.Position.Left);
break;
case I18n.tr("Top Center", "screen position option"):
} else if (value === I18n.tr("Top Center", "screen position option")) {
SettingsData.set("notificationPopupPosition", -1);
break;
case I18n.tr("Bottom Center", "screen position option"):
SettingsData.set("notificationPopupPosition", SettingsData.Position.BottomCenter);
break;
case I18n.tr("Bottom Right", "screen position option"):
} else if (value === I18n.tr("Bottom Right", "screen position option")) {
SettingsData.set("notificationPopupPosition", SettingsData.Position.Right);
break;
case I18n.tr("Bottom Left", "screen position option"):
} else if (value === I18n.tr("Bottom Left", "screen position option")) {
SettingsData.set("notificationPopupPosition", SettingsData.Position.Bottom);
break;
}
SettingsData.sendTestNotifications();
}
@@ -269,95 +239,6 @@ Item {
checked: SettingsData.notificationCompactMode
onToggled: checked => SettingsData.set("notificationCompactMode", checked)
}
SettingsToggleRow {
settingKey: "notificationPopupShadowEnabled"
tags: ["notification", "popup", "shadow", "radius", "rounded"]
text: I18n.tr("Popup Shadow")
description: I18n.tr("Show drop shadow on notification popups")
checked: SettingsData.notificationPopupShadowEnabled
onToggled: checked => SettingsData.set("notificationPopupShadowEnabled", checked)
}
SettingsToggleRow {
settingKey: "notificationPopupPrivacyMode"
tags: ["notification", "popup", "privacy", "body", "content", "hide"]
text: I18n.tr("Privacy Mode")
description: I18n.tr("Hide notification content until expanded; popups show collapsed by default")
checked: SettingsData.notificationPopupPrivacyMode
onToggled: checked => SettingsData.set("notificationPopupPrivacyMode", checked)
}
Item {
width: parent.width
height: notificationAnimationColumn.implicitHeight + Theme.spacingM * 2
Column {
id: notificationAnimationColumn
width: parent.width - Theme.spacingM * 2
x: Theme.spacingM
anchors.top: parent.top
anchors.topMargin: Theme.spacingM
spacing: Theme.spacingS
StyledText {
text: I18n.tr("Animation Speed")
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
}
StyledText {
text: I18n.tr("Control animation duration for notification popups and history")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
DankButtonGroup {
id: notificationSpeedGroup
anchors.horizontalCenter: parent.horizontalCenter
buttonPadding: parent.width < 480 ? Theme.spacingS : Theme.spacingM
minButtonWidth: parent.width < 480 ? 44 : 56
textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
model: [I18n.tr("None"), I18n.tr("Short"), I18n.tr("Medium"), I18n.tr("Long"), I18n.tr("Custom")]
selectionMode: "single"
currentIndex: SettingsData.notificationAnimationSpeed
onSelectionChanged: (index, selected) => {
if (!selected)
return;
SettingsData.set("notificationAnimationSpeed", index);
}
Connections {
target: SettingsData
function onNotificationAnimationSpeedChanged() {
notificationSpeedGroup.currentIndex = SettingsData.notificationAnimationSpeed;
}
}
}
SettingsSliderRow {
settingKey: "notificationCustomAnimationDuration"
tags: ["notification", "animation", "duration", "custom", "speed"]
text: I18n.tr("Duration")
description: I18n.tr("Base duration for animations (drag to use Custom)")
minimum: 100
maximum: 800
value: Theme.notificationAnimationBaseDuration
unit: "ms"
defaultValue: 400
onSliderValueChanged: newValue => {
if (SettingsData.notificationAnimationSpeed !== SettingsData.AnimationSpeed.Custom) {
SettingsData.set("notificationAnimationSpeed", SettingsData.AnimationSpeed.Custom);
}
SettingsData.set("notificationCustomAnimationDuration", newValue);
}
}
}
}
}
SettingsCard {
@@ -377,7 +258,6 @@ Item {
}
SettingsCard {
id: notificationRulesCard
width: parent.width
iconName: "rule_settings"
title: I18n.tr("Notification Rules")
@@ -402,11 +282,7 @@ Item {
iconSize: 20
backgroundColor: Theme.surfaceContainer
iconColor: Theme.primary
onClicked: {
SettingsData.addNotificationRule();
notificationRulesCard.userToggledCollapse = true;
notificationRulesCard.expanded = true;
}
onClicked: SettingsData.addNotificationRule()
}
]
@@ -415,7 +291,7 @@ Item {
spacing: Theme.spacingS
StyledText {
text: I18n.tr("Create rules to mute, ignore, hide from history, or override notification priority. Default only overrides priority; notifications still show normally.")
text: I18n.tr("Create rules to mute, ignore, hide from history, or override notification priority.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
@@ -531,7 +407,6 @@ Item {
width: parent.width
compactMode: true
dropdownWidth: parent.width
popupWidth: 165
currentValue: root.getRuleOptionLabel(root.notificationRuleFieldOptions, modelData.field, root.notificationRuleFieldOptions[0].label)
options: root.notificationRuleFieldOptions.map(o => o.label)
onValueChanged: value => SettingsData.updateNotificationRuleField(index, "field", root.getRuleOptionValue(root.notificationRuleFieldOptions, value, "appName"))
@@ -572,7 +447,6 @@ Item {
width: parent.width
compactMode: true
dropdownWidth: parent.width
popupWidth: 170
currentValue: root.getRuleOptionLabel(root.notificationRuleActionOptions, modelData.action, root.notificationRuleActionOptions[0].label)
options: root.notificationRuleActionOptions.map(o => o.label)
onValueChanged: value => SettingsData.updateNotificationRuleField(index, "action", root.getRuleOptionValue(root.notificationRuleActionOptions, value, "default"))
@@ -593,7 +467,6 @@ Item {
width: parent.width
compactMode: true
dropdownWidth: parent.width
popupWidth: 165
currentValue: root.getRuleOptionLabel(root.notificationRuleUrgencyOptions, modelData.urgency, root.notificationRuleUrgencyOptions[0].label)
options: root.notificationRuleUrgencyOptions.map(o => o.label)
onValueChanged: value => SettingsData.updateNotificationRuleField(index, "urgency", root.getRuleOptionValue(root.notificationRuleUrgencyOptions, value, "default"))
@@ -606,95 +479,6 @@ Item {
}
}
SettingsCard {
width: parent.width
iconName: "volume_off"
title: I18n.tr("Muted Apps")
settingKey: "mutedApps"
tags: ["notification", "mute", "unmute", "popup"]
Column {
width: parent.width
spacing: Theme.spacingS
StyledText {
text: mutedRules.length > 0 ? I18n.tr("Apps with notification popups muted. Unmute or delete to remove.") : I18n.tr("No apps muted. Right-click a notification and choose \"Mute popups\" to add one here.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
bottomPadding: Theme.spacingS
}
Repeater {
model: mutedRules
delegate: Rectangle {
width: parent.width
height: mutedRow.implicitHeight + Theme.spacingS * 2
radius: Theme.cornerRadius
color: Theme.withAlpha(Theme.surfaceContainer, 0.5)
Row {
id: mutedRow
anchors.fill: parent
anchors.margins: Theme.spacingS
spacing: Theme.spacingM
StyledText {
id: mutedAppLabel
text: (modelData.rule && modelData.rule.pattern) ? modelData.rule.pattern : I18n.tr("Unknown")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
Item {
width: Math.max(0, parent.width - parent.spacing - mutedAppLabel.width - unmuteBtn.width - deleteBtn.width - Theme.spacingS * 5)
height: 1
}
DankButton {
id: unmuteBtn
text: I18n.tr("Unmute")
backgroundColor: Theme.surfaceContainer
textColor: Theme.primary
onClicked: SettingsData.removeNotificationRule(modelData.index)
}
Item {
id: deleteBtn
width: 28
height: 28
anchors.verticalCenter: parent.verticalCenter
Rectangle {
anchors.fill: parent
radius: Theme.cornerRadius
color: deleteArea.containsMouse ? Theme.withAlpha(Theme.error, 0.2) : "transparent"
}
DankIcon {
anchors.centerIn: parent
name: "delete"
size: 18
color: deleteArea.containsMouse ? Theme.error : Theme.surfaceVariantText
}
MouseArea {
id: deleteArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: SettingsData.removeNotificationRule(modelData.index)
}
}
}
}
}
}
}
SettingsCard {
width: parent.width
iconName: "lock"
+2 -14
View File
@@ -375,20 +375,8 @@ FocusScope {
if (!plugin || !PluginService.isPluginLoaded(pluginId))
return;
var isLauncher = plugin.type === "launcher" || (plugin.capabilities && plugin.capabilities.includes("launcher"));
if (isLauncher) {
pluginReloadTimer.pendingPluginId = pluginId;
pluginReloadTimer.restart();
}
}
}
Timer {
id: pluginReloadTimer
property string pendingPluginId: ""
interval: 500
onTriggered: {
if (pendingPluginId)
PluginService.reloadPlugin(pendingPluginId);
if (isLauncher)
PluginService.reloadPlugin(pluginId);
}
}
+23 -11
View File
@@ -16,7 +16,7 @@ Item {
property var cachedCursorThemes: SettingsData.availableCursorThemes
property var cachedMatugenSchemes: Theme.availableMatugenSchemes.map(option => option.label)
property var installedRegistryThemes: []
property var templateDetection: []
property var templateDetection: ({})
property var cursorIncludeStatus: ({
"exists": false,
@@ -106,10 +106,9 @@ Item {
}
function isTemplateDetected(templateId) {
if (!templateDetection || templateDetection.length === 0)
if (!templateDetection || Object.keys(templateDetection).length === 0)
return true;
var item = templateDetection.find(i => i.id === templateId);
return !item || item.detected !== false;
return templateDetection[templateId] !== false;
}
function getTemplateDescription(templateId, baseDescription) {
@@ -146,17 +145,30 @@ Item {
DMSService.listInstalledThemes();
if (PopoutService.pendingThemeInstall)
Qt.callLater(() => showThemeBrowser());
Proc.runCommand("template-check", ["dms", "matugen", "check"], (output, exitCode) => {
if (exitCode !== 0)
return;
try {
themeColorsTab.templateDetection = JSON.parse(output.trim());
} catch (e) {}
});
templateCheckProcess.running = true;
if (CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl)
checkCursorIncludeStatus();
}
Process {
id: templateCheckProcess
command: ["dms", "matugen", "check"]
running: false
stdout: StdioCollector {
onStreamFinished: {
try {
const results = JSON.parse(text);
const detection = {};
for (const item of results) {
detection[item.id] = item.detected;
}
themeColorsTab.templateDetection = detection;
} catch (e) {}
}
}
}
Connections {
target: DMSService
function onInstalledThemesReceived(themes) {
@@ -14,12 +14,8 @@ Rectangle {
required property var deviceNode
property string deviceType: "output"
property bool showHideButton: false
property bool isHidden: false
signal editRequested(var deviceNode)
signal resetRequested(var deviceNode)
signal hideRequested(var deviceNode)
width: parent?.width ?? 0
height: deviceRowContent.height + Theme.spacingM * 2
@@ -131,21 +127,6 @@ Rectangle {
}
}
DankActionButton {
id: hideButton
visible: root.showHideButton
buttonSize: 36
iconName: root.isHidden ? "visibility" : "visibility_off"
iconSize: 20
backgroundColor: Theme.surfaceContainerHigh
iconColor: root.isHidden ? Theme.primary : Theme.surfaceVariantText
tooltipText: root.isHidden ? I18n.tr("Show device") : I18n.tr("Hide device")
anchors.verticalCenter: parent.verticalCenter
onClicked: {
root.hideRequested(root.deviceNode);
}
}
DankActionButton {
id: editButton
buttonSize: 36
@@ -155,7 +136,6 @@ Rectangle {
iconColor: Theme.buttonText
tooltipText: I18n.tr("Set custom name")
anchors.verticalCenter: parent.verticalCenter
visible: !root.isHidden
onClicked: {
root.editRequested(root.deviceNode);
}
@@ -131,7 +131,7 @@ Item {
text: I18n.tr("Follow Monitor Focus")
description: I18n.tr("Show workspaces of the currently focused monitor")
checked: SettingsData.workspaceFollowFocus
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll
onToggled: checked => SettingsData.set("workspaceFollowFocus", checked)
}
@@ -296,12 +296,12 @@ Item {
height: 1
color: Theme.outline
opacity: 0.15
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll
}
SettingsButtonGroupRow {
text: I18n.tr("Urgent Color")
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll
model: ["err", "pri", "sec", "s", "sc"]
buttonHeight: 22
minButtonWidth: 36
+1 -1
View File
@@ -66,7 +66,7 @@ Singleton {
return Hyprland.focusedWorkspace.monitor.name;
if (CompositorService.isNiri && NiriService.currentOutput)
return NiriService.currentOutput;
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
if (CompositorService.isSway || CompositorService.isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
return focusedWs?.monitor?.name || "";
}
+2 -2
View File
@@ -10,8 +10,8 @@ import qs.Common
Singleton {
id: root
readonly property string currentVersion: "1.4"
readonly property bool changelogEnabled: true
readonly property string currentVersion: "1.2"
readonly property bool changelogEnabled: false
readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation)) + "/DankMaterialShell"
readonly property string changelogMarkerPath: configDir + "/.changelog-" + currentVersion
+6 -32
View File
@@ -16,7 +16,6 @@ Singleton {
property bool isDwl: false
property bool isSway: false
property bool isScroll: false
property bool isMiracle: false
property bool isLabwc: false
property string compositor: "unknown"
readonly property bool useHyprlandFocusGrab: isHyprland && Quickshell.env("DMS_HYPRLAND_EXCLUSIVE_FOCUS") !== "1"
@@ -25,7 +24,6 @@ Singleton {
readonly property string niriSocket: Quickshell.env("NIRI_SOCKET")
readonly property string swaySocket: Quickshell.env("SWAYSOCK")
readonly property string scrollSocket: Quickshell.env("SWAYSOCK")
readonly property string miracleSocket: Quickshell.env("MIRACLESOCK")
readonly property string labwcPid: Quickshell.env("LABWC_PID")
property bool useNiriSorting: isNiri && NiriService
@@ -76,7 +74,7 @@ Singleton {
screenName = Hyprland.focusedWorkspace.monitor.name;
else if (isNiri && NiriService.currentOutput)
screenName = NiriService.currentOutput;
else if (isSway || isScroll || isMiracle) {
else if (isSway || isScroll) {
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
screenName = focusedWs?.monitor?.name || "";
} else if (isDwl && DwlService.activeOutput)
@@ -445,13 +443,12 @@ Singleton {
}
function detectCompositor() {
if (hyprlandSignature && hyprlandSignature.length > 0 && !niriSocket && !swaySocket && !scrollSocket && !miracleSocket && !labwcPid) {
if (hyprlandSignature && hyprlandSignature.length > 0 && !niriSocket && !swaySocket && !scrollSocket && !labwcPid) {
isHyprland = true;
isNiri = false;
isDwl = false;
isSway = false;
isScroll = false;
isMiracle = false;
isLabwc = false;
compositor = "hyprland";
console.info("CompositorService: Detected Hyprland");
@@ -466,7 +463,6 @@ Singleton {
isDwl = false;
isSway = false;
isScroll = false;
isMiracle = false;
isLabwc = false;
compositor = "niri";
console.info("CompositorService: Detected Niri with socket:", niriSocket);
@@ -476,7 +472,7 @@ Singleton {
return;
}
if (swaySocket && swaySocket.length > 0 && !scrollSocket && scrollSocket.length == 0 && !miracleSocket) {
if (swaySocket && swaySocket.length > 0 && !scrollSocket && scrollSocket.length == 0) {
Proc.runCommand("swaySocketCheck", ["test", "-S", swaySocket], (output, exitCode) => {
if (exitCode === 0) {
isNiri = false;
@@ -484,7 +480,6 @@ Singleton {
isDwl = false;
isSway = true;
isScroll = false;
isMiracle = false;
isLabwc = false;
compositor = "sway";
console.info("CompositorService: Detected Sway with socket:", swaySocket);
@@ -493,24 +488,7 @@ Singleton {
return;
}
if (miracleSocket && miracleSocket.length > 0) {
Proc.runCommand("miracleSocketCheck", ["test", "-S", miracleSocket], (output, exitCode) => {
if (exitCode === 0) {
isNiri = false;
isHyprland = false;
isDwl = false;
isSway = false;
isScroll = false;
isMiracle = true;
isLabwc = false;
compositor = "miracle";
console.info("CompositorService: Detected Miracle WM with socket:", miracleSocket);
}
}, 0);
return;
}
if (scrollSocket && scrollSocket.length > 0 && !miracleSocket) {
if (scrollSocket && scrollSocket.length > 0) {
Proc.runCommand("scrollSocketCheck", ["test", "-S", scrollSocket], (output, exitCode) => {
if (exitCode === 0) {
isNiri = false;
@@ -518,7 +496,6 @@ Singleton {
isDwl = false;
isSway = false;
isScroll = true;
isMiracle = false;
isLabwc = false;
compositor = "scroll";
console.info("CompositorService: Detected Scroll with socket:", scrollSocket);
@@ -533,7 +510,6 @@ Singleton {
isDwl = false;
isSway = false;
isScroll = false;
isMiracle = false;
isLabwc = true;
compositor = "labwc";
console.info("CompositorService: Detected LabWC with PID:", labwcPid);
@@ -548,7 +524,6 @@ Singleton {
isDwl = false;
isSway = false;
isScroll = false;
isMiracle = false;
isLabwc = false;
compositor = "unknown";
console.warn("CompositorService: No compositor detected");
@@ -571,7 +546,6 @@ Singleton {
isDwl = true;
isSway = false;
isScroll = false;
isMiracle = false;
isLabwc = false;
compositor = "dwl";
console.info("CompositorService: Detected DWL via DMS capability");
@@ -585,7 +559,7 @@ Singleton {
return Hyprland.dispatch("dpms off");
if (isDwl)
return _dwlPowerOffMonitors();
if (isSway || isScroll || isMiracle) {
if (isSway || isScroll) {
try {
I3.dispatch("output * dpms off");
} catch (_) {}
@@ -604,7 +578,7 @@ Singleton {
return Hyprland.dispatch("dpms on");
if (isDwl)
return _dwlPowerOnMonitors();
if (isSway || isScroll || isMiracle) {
if (isSway || isScroll) {
try {
I3.dispatch("output * dpms on");
} catch (_) {}
-1
View File
@@ -395,7 +395,6 @@ Singleton {
"memoryKB": proc.memoryKB || proc.pssKB || 0,
"command": proc.command || "",
"fullCommand": proc.fullCommand || "",
"username": proc.username || "",
"displayName": (proc.command && proc.command.length > 15) ? proc.command.substring(0, 15) + "..." : (proc.command || "")
});
}
+90 -94
View File
@@ -11,83 +11,83 @@ Singleton {
property var groups: []
property var _cachedWorkspaces: ({})
signal stateChanged
signal stateChanged()
Connections {
target: DMSService
function onCapabilitiesReceived() {
checkCapabilities();
checkCapabilities()
}
function onConnectionStateChanged() {
if (DMSService.isConnected) {
checkCapabilities();
checkCapabilities()
} else {
extWorkspaceAvailable = false;
extWorkspaceAvailable = false
}
}
function onExtWorkspaceStateUpdate(data) {
if (extWorkspaceAvailable) {
handleStateUpdate(data);
handleStateUpdate(data)
}
}
}
Component.onCompleted: {
if (DMSService.dmsAvailable) {
checkCapabilities();
checkCapabilities()
}
}
function checkCapabilities() {
if (!DMSService.capabilities || !Array.isArray(DMSService.capabilities)) {
extWorkspaceAvailable = false;
return;
extWorkspaceAvailable = false
return
}
const hasExtWorkspace = DMSService.capabilities.includes("extworkspace");
const hasExtWorkspace = DMSService.capabilities.includes("extworkspace")
if (hasExtWorkspace && !extWorkspaceAvailable) {
if (typeof CompositorService !== "undefined") {
const useExtWorkspace = DMSService.forceExtWorkspace || (!CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway && !CompositorService.isScroll && !CompositorService.isMiracle);
const useExtWorkspace = DMSService.forceExtWorkspace || (!CompositorService.isNiri && !CompositorService.isHyprland && !CompositorService.isDwl && !CompositorService.isSway && !CompositorService.isScroll)
if (!useExtWorkspace) {
console.info("ExtWorkspaceService: ext-workspace available but compositor has native support");
extWorkspaceAvailable = false;
return;
console.info("ExtWorkspaceService: ext-workspace available but compositor has native support")
extWorkspaceAvailable = false
return
}
}
extWorkspaceAvailable = true;
console.info("ExtWorkspaceService: ext-workspace capability detected");
DMSService.addSubscription("extworkspace");
requestState();
extWorkspaceAvailable = true
console.info("ExtWorkspaceService: ext-workspace capability detected")
DMSService.addSubscription("extworkspace")
requestState()
} else if (!hasExtWorkspace) {
extWorkspaceAvailable = false;
extWorkspaceAvailable = false
}
}
function requestState() {
if (!DMSService.isConnected || !extWorkspaceAvailable) {
return;
return
}
DMSService.sendRequest("extworkspace.getState", null, response => {
if (response.result) {
handleStateUpdate(response.result);
handleStateUpdate(response.result)
}
});
})
}
function handleStateUpdate(state) {
groups = state.groups || [];
groups = state.groups || []
if (groups.length === 0) {
console.warn("ExtWorkspaceService: Received empty workspace groups from backend");
console.warn("ExtWorkspaceService: Received empty workspace groups from backend")
} else {
console.log("ExtWorkspaceService: Updated with", groups.length, "workspace groups");
console.log("ExtWorkspaceService: Updated with", groups.length, "workspace groups")
}
stateChanged();
stateChanged()
}
function activateWorkspace(workspaceID, groupID = "") {
if (!DMSService.isConnected || !extWorkspaceAvailable) {
return;
return
}
DMSService.sendRequest("extworkspace.activateWorkspace", {
@@ -95,14 +95,14 @@ Singleton {
"groupID": groupID
}, response => {
if (response.error) {
console.warn("ExtWorkspaceService: activateWorkspace error:", response.error);
console.warn("ExtWorkspaceService: activateWorkspace error:", response.error)
}
});
})
}
function deactivateWorkspace(workspaceID, groupID = "") {
if (!DMSService.isConnected || !extWorkspaceAvailable) {
return;
return
}
DMSService.sendRequest("extworkspace.deactivateWorkspace", {
@@ -110,14 +110,14 @@ Singleton {
"groupID": groupID
}, response => {
if (response.error) {
console.warn("ExtWorkspaceService: deactivateWorkspace error:", response.error);
console.warn("ExtWorkspaceService: deactivateWorkspace error:", response.error)
}
});
})
}
function removeWorkspace(workspaceID, groupID = "") {
if (!DMSService.isConnected || !extWorkspaceAvailable) {
return;
return
}
DMSService.sendRequest("extworkspace.removeWorkspace", {
@@ -125,14 +125,14 @@ Singleton {
"groupID": groupID
}, response => {
if (response.error) {
console.warn("ExtWorkspaceService: removeWorkspace error:", response.error);
console.warn("ExtWorkspaceService: removeWorkspace error:", response.error)
}
});
})
}
function createWorkspace(groupID, name) {
if (!DMSService.isConnected || !extWorkspaceAvailable) {
return;
return
}
DMSService.sendRequest("extworkspace.createWorkspace", {
@@ -140,138 +140,134 @@ Singleton {
"name": name
}, response => {
if (response.error) {
console.warn("ExtWorkspaceService: createWorkspace error:", response.error);
console.warn("ExtWorkspaceService: createWorkspace error:", response.error)
}
});
})
}
function getGroupForOutput(outputName) {
for (const group of groups) {
if (group.outputs && group.outputs.includes(outputName)) {
return group;
return group
}
}
return null;
return null
}
function getWorkspacesForOutput(outputName) {
const group = getGroupForOutput(outputName);
return group ? (group.workspaces || []) : [];
const group = getGroupForOutput(outputName)
return group ? (group.workspaces || []) : []
}
function getActiveWorkspaces() {
const active = [];
const active = []
for (const group of groups) {
if (!group.workspaces)
continue;
if (!group.workspaces) continue
for (const ws of group.workspaces) {
if (ws.active) {
active.push({
workspace: ws,
group: group,
outputs: group.outputs || []
});
})
}
}
}
return active;
return active
}
function getActiveWorkspaceForOutput(outputName) {
const group = getGroupForOutput(outputName);
if (!group || !group.workspaces)
return null;
const group = getGroupForOutput(outputName)
if (!group || !group.workspaces) return null
for (const ws of group.workspaces) {
if (ws.active) {
return ws;
return ws
}
}
return null;
return null
}
function getVisibleWorkspaces(outputName) {
const workspaces = getWorkspacesForOutput(outputName);
let visible = workspaces.filter(ws => !ws.hidden);
const workspaces = getWorkspacesForOutput(outputName)
let visible = workspaces.filter(ws => !ws.hidden)
const hasValidCoordinates = visible.some(ws => ws.coordinates && ws.coordinates.length > 0);
const hasValidCoordinates = visible.some(ws => ws.coordinates && ws.coordinates.length > 0)
if (hasValidCoordinates) {
visible = visible.sort((a, b) => {
const coordsA = a.coordinates || [0, 0];
const coordsB = b.coordinates || [0, 0];
if (coordsA[0] !== coordsB[0])
return coordsA[0] - coordsB[0];
return coordsA[1] - coordsB[1];
});
const coordsA = a.coordinates || [0, 0]
const coordsB = b.coordinates || [0, 0]
if (coordsA[0] !== coordsB[0]) return coordsA[0] - coordsB[0]
return coordsA[1] - coordsB[1]
})
}
const cacheKey = outputName;
const cacheKey = outputName
if (!_cachedWorkspaces[cacheKey]) {
_cachedWorkspaces[cacheKey] = {
workspaces: [],
lastNames: []
};
}
}
const cache = _cachedWorkspaces[cacheKey];
const currentNames = visible.map(ws => ws.name || ws.id);
const namesChanged = JSON.stringify(cache.lastNames) !== JSON.stringify(currentNames);
const cache = _cachedWorkspaces[cacheKey]
const currentNames = visible.map(ws => ws.name || ws.id)
const namesChanged = JSON.stringify(cache.lastNames) !== JSON.stringify(currentNames)
if (namesChanged || cache.workspaces.length !== visible.length) {
cache.workspaces = visible.map(ws => ({
id: ws.id,
name: ws.name,
coordinates: ws.coordinates,
state: ws.state,
active: ws.active,
urgent: ws.urgent,
hidden: ws.hidden
}));
cache.lastNames = currentNames;
return cache.workspaces;
id: ws.id,
name: ws.name,
coordinates: ws.coordinates,
state: ws.state,
active: ws.active,
urgent: ws.urgent,
hidden: ws.hidden
}))
cache.lastNames = currentNames
return cache.workspaces
}
for (let i = 0; i < visible.length; i++) {
const src = visible[i];
const dst = cache.workspaces[i];
dst.id = src.id;
dst.name = src.name;
dst.coordinates = src.coordinates;
dst.state = src.state;
dst.active = src.active;
dst.urgent = src.urgent;
dst.hidden = src.hidden;
const src = visible[i]
const dst = cache.workspaces[i]
dst.id = src.id
dst.name = src.name
dst.coordinates = src.coordinates
dst.state = src.state
dst.active = src.active
dst.urgent = src.urgent
dst.hidden = src.hidden
}
return cache.workspaces;
return cache.workspaces
}
function getUrgentWorkspaces() {
const urgent = [];
const urgent = []
for (const group of groups) {
if (!group.workspaces)
continue;
if (!group.workspaces) continue
for (const ws of group.workspaces) {
if (ws.urgent) {
urgent.push({
workspace: ws,
group: group,
outputs: group.outputs || []
});
})
}
}
}
return urgent;
return urgent
}
function switchToWorkspace(outputName, workspaceName) {
const workspaces = getWorkspacesForOutput(outputName);
const workspaces = getWorkspacesForOutput(outputName)
for (const ws of workspaces) {
if (ws.name === workspaceName || ws.id === workspaceName) {
activateWorkspace(ws.name || ws.id);
return;
activateWorkspace(ws.name || ws.id)
return
}
}
console.warn("ExtWorkspaceService: workspace not found:", workspaceName);
console.warn("ExtWorkspaceService: workspace not found:", workspaceName)
}
}
+36 -142
View File
@@ -22,7 +22,7 @@ Singleton {
property list<NotifWrapper> notificationQueue: []
property list<NotifWrapper> visibleNotifications: []
property int maxVisibleNotifications: 4
property int maxVisibleNotifications: 3
property bool addGateBusy: false
property int enterAnimMs: 400
property int seqCounter: 0
@@ -158,7 +158,10 @@ Singleton {
continue;
const urg = typeof item.urgency === "number" ? item.urgency : 1;
const body = item.body || "";
const htmlBody = item.htmlBody || _resolveHtmlBody(body);
let htmlBody = item.htmlBody || "";
if (!htmlBody && body) {
htmlBody = (body.includes('<') && body.includes('>')) ? body : Markdown2Html.markdownToHtml(body);
}
loaded.push({
id: item.id || "",
summary: item.summary || "",
@@ -248,15 +251,9 @@ Singleton {
const timeStr = SettingsData.use24HourClock ? date.toLocaleTimeString(Qt.locale(), "HH:mm") : date.toLocaleTimeString(Qt.locale(), "h:mm AP");
if (daysDiff === 0)
return timeStr;
try {
const localeName = (typeof Qt !== "undefined" && Qt.locale) ? Qt.locale().name : "en-US";
const weekday = date.toLocaleDateString(localeName, {
weekday: "long"
});
return weekday + ", " + timeStr;
} catch (e) {
return timeStr;
}
if (daysDiff === 1)
return I18n.tr("yesterday") + ", " + timeStr;
return I18n.tr("%1 days ago").arg(daysDiff);
}
function _nowSec() {
@@ -487,7 +484,7 @@ Singleton {
Timer {
id: addGate
interval: 80
interval: enterAnimMs + 50
running: false
repeat: false
onTriggered: {
@@ -691,15 +688,11 @@ Singleton {
return formatTime(time);
}
try {
const localeName = (typeof Qt !== "undefined" && Qt.locale) ? Qt.locale().name : "en-US";
const weekday = time.toLocaleDateString(localeName, {
weekday: "long"
});
return `${weekday}, ${formatTime(time)}`;
} catch (e) {
return formatTime(time);
if (daysDiff === 1) {
return `yesterday, ${formatTime(time)}`;
}
return `${daysDiff} days ago`;
}
function formatTime(date) {
@@ -722,7 +715,13 @@ Singleton {
required property Notification notification
readonly property string summary: notification?.summary ?? ""
readonly property string body: notification?.body ?? ""
readonly property string htmlBody: root._resolveHtmlBody(body)
readonly property string htmlBody: {
if (!body)
return "";
if (body.includes('<') && body.includes('>'))
return body;
return Markdown2Html.markdownToHtml(body);
}
readonly property string appIcon: notification?.appIcon ?? ""
readonly property string appName: {
if (!notification)
@@ -838,54 +837,39 @@ Singleton {
}
}
property bool _processingQueue: false
function processQueue() {
if (addGateBusy || _processingQueue)
if (addGateBusy) {
return;
if (popupsDisabled)
}
if (popupsDisabled) {
return;
if (SessionData.doNotDisturb)
}
if (SessionData.doNotDisturb) {
return;
if (notificationQueue.length === 0)
}
if (notificationQueue.length === 0) {
return;
}
_processingQueue = true;
const activePopupCount = visibleNotifications.filter(n => n && n.popup).length;
if (activePopupCount >= 4) {
return;
}
const next = notificationQueue.shift();
if (!next) {
_processingQueue = false;
if (!next)
return;
}
next.seq = ++seqCounter;
const activePopups = visibleNotifications.filter(n => n && n.popup);
let evicted = null;
if (activePopups.length >= maxVisibleNotifications) {
const unhovered = activePopups.filter(n => n.timer?.running);
const pool = unhovered.length > 0 ? unhovered : activePopups;
evicted = pool.reduce((min, n) => (n.seq < min.seq) ? n : min, pool[0]);
if (evicted)
evicted.removedByLimit = true;
}
if (evicted) {
visibleNotifications = [...visibleNotifications.filter(n => n !== evicted), next];
} else {
visibleNotifications = [...visibleNotifications, next];
}
if (evicted)
evicted.popup = false;
visibleNotifications = [...visibleNotifications, next];
next.popup = true;
if (next.timer.interval > 0)
if (next.timer.interval > 0) {
next.timer.start();
}
addGateBusy = true;
addGate.restart();
_processingQueue = false;
}
function removeFromVisibleNotifications(wrapper) {
@@ -906,96 +890,6 @@ Singleton {
}
}
function _decodeEntities(s) {
s = s.replace(/&#(\d+);/g, (_, n) => String.fromCodePoint(parseInt(n, 10)));
s = s.replace(/&#x([0-9a-fA-F]+);/g, (_, n) => String.fromCodePoint(parseInt(n, 16)));
return s.replace(/&([a-zA-Z][a-zA-Z0-9]*);/g, (match, name) => {
switch (name) {
case "amp":
return "&";
case "lt":
return "<";
case "gt":
return ">";
case "quot":
return "\"";
case "apos":
return "'";
case "nbsp":
return "\u00A0";
case "ndash":
return "\u2013";
case "mdash":
return "\u2014";
case "lsquo":
return "\u2018";
case "rsquo":
return "\u2019";
case "ldquo":
return "\u201C";
case "rdquo":
return "\u201D";
case "bull":
return "\u2022";
case "hellip":
return "\u2026";
case "trade":
return "\u2122";
case "copy":
return "\u00A9";
case "reg":
return "\u00AE";
case "deg":
return "\u00B0";
case "plusmn":
return "\u00B1";
case "times":
return "\u00D7";
case "divide":
return "\u00F7";
case "micro":
return "\u00B5";
case "middot":
return "\u00B7";
case "laquo":
return "\u00AB";
case "raquo":
return "\u00BB";
case "larr":
return "\u2190";
case "rarr":
return "\u2192";
case "uarr":
return "\u2191";
case "darr":
return "\u2193";
default:
return match;
}
});
}
function _resolveHtmlBody(body) {
if (!body)
return "";
if (/<\/?[a-z][\s\S]*>/i.test(body))
return body;
// Decode percent-encoded URLs (e.g. https%3A%2F%2F https://)
body = body.replace(/\bhttps?%3A%2F%2F[^\s]+/gi, match => {
try { return decodeURIComponent(match); }
catch (e) { return match; }
});
if (/&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]+);/.test(body)) {
const decoded = _decodeEntities(body);
if (/<\/?[a-z][\s\S]*>/i.test(decoded))
return decoded;
return Markdown2Html.markdownToHtml(decoded);
}
return Markdown2Html.markdownToHtml(body);
}
function getGroupKey(wrapper) {
if (wrapper.desktopEntry && wrapper.desktopEntry !== "") {
return wrapper.desktopEntry.toLowerCase();
+1 -1
View File
@@ -314,7 +314,7 @@ Singleton {
return;
}
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
if (CompositorService.isSway || CompositorService.isScroll) {
try {
I3.dispatch("exit");
} catch (_) {}

Some files were not shown because too many files have changed in this diff Show More