mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
Compare commits
17 Commits
0e0a8ae0fb
...
52068fb61b
| Author | SHA1 | Date | |
|---|---|---|---|
| 52068fb61b | |||
| 64461c534f | |||
| 73da4879f6 | |||
| 8594a414ec | |||
| df396bfa43 | |||
| 33677150b1 | |||
| c67b185076 | |||
| bab2078dfd | |||
| e9bc0169f6 | |||
| 59c83d19e4 | |||
| 9b7d3c64fe | |||
| c367153bac | |||
| 1f94c3cbd4 | |||
| 564583951c | |||
| eed3617a0d | |||
| 24cb3d19a0 | |||
| 3182c70857 |
@@ -968,11 +968,32 @@ func applyKDEColorScheme(mode ColorMode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func gtkThemeInstalled(theme string) bool {
|
||||||
|
home, _ := os.UserHomeDir()
|
||||||
|
candidates := []string{
|
||||||
|
filepath.Join(home, ".local/share/themes", theme),
|
||||||
|
filepath.Join(home, ".themes", theme),
|
||||||
|
filepath.Join("/usr/share/themes", theme),
|
||||||
|
filepath.Join("/usr/local/share/themes", theme),
|
||||||
|
}
|
||||||
|
for _, dir := range candidates {
|
||||||
|
if info, err := os.Stat(dir); err == nil && info.IsDir() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func refreshGTKTheme(mode ColorMode) {
|
func refreshGTKTheme(mode ColorMode) {
|
||||||
|
theme := mode.GTKTheme()
|
||||||
|
if !gtkThemeInstalled(theme) {
|
||||||
|
log.Infof("Skipping gtk-theme refresh: %s is not installed", theme)
|
||||||
|
return
|
||||||
|
}
|
||||||
if err := utils.GsettingsSet("org.gnome.desktop.interface", "gtk-theme", ""); err != nil {
|
if err := utils.GsettingsSet("org.gnome.desktop.interface", "gtk-theme", ""); err != nil {
|
||||||
log.Warnf("Failed to reset gtk-theme: %v", err)
|
log.Warnf("Failed to reset gtk-theme: %v", err)
|
||||||
}
|
}
|
||||||
if err := utils.GsettingsSet("org.gnome.desktop.interface", "gtk-theme", mode.GTKTheme()); err != nil {
|
if err := utils.GsettingsSet("org.gnome.desktop.interface", "gtk-theme", theme); err != nil {
|
||||||
log.Warnf("Failed to set gtk-theme: %v", err)
|
log.Warnf("Failed to set gtk-theme: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,9 @@ func (m *Manager) snapshotState() CUPSState {
|
|||||||
func (m *Manager) Subscribe(id string) chan CUPSState {
|
func (m *Manager) Subscribe(id string) chan CUPSState {
|
||||||
ch := make(chan CUPSState, 64)
|
ch := make(chan CUPSState, 64)
|
||||||
|
|
||||||
|
m.subLifecycleMu.Lock()
|
||||||
|
defer m.subLifecycleMu.Unlock()
|
||||||
|
|
||||||
wasEmpty := true
|
wasEmpty := true
|
||||||
m.subscribers.Range(func(key string, ch chan CUPSState) bool {
|
m.subscribers.Range(func(key string, ch chan CUPSState) bool {
|
||||||
wasEmpty = false
|
wasEmpty = false
|
||||||
@@ -237,19 +240,25 @@ func (m *Manager) Subscribe(id string) chan CUPSState {
|
|||||||
|
|
||||||
m.subscribers.Store(id, ch)
|
m.subscribers.Store(id, ch)
|
||||||
|
|
||||||
if wasEmpty && m.subscription != nil {
|
if !wasEmpty || m.subscription == nil {
|
||||||
if err := m.subscription.Start(); err != nil {
|
return ch
|
||||||
log.Warnf("[CUPS] Failed to start subscription manager: %v", err)
|
|
||||||
} else {
|
|
||||||
m.eventWG.Add(1)
|
|
||||||
go m.eventHandler()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := m.subscription.Start(); err != nil {
|
||||||
|
log.Warnf("[CUPS] Failed to start subscription manager: %v", err)
|
||||||
|
return ch
|
||||||
|
}
|
||||||
|
|
||||||
|
m.eventWG.Add(1)
|
||||||
|
go m.eventHandler()
|
||||||
|
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) Unsubscribe(id string) {
|
func (m *Manager) Unsubscribe(id string) {
|
||||||
|
m.subLifecycleMu.Lock()
|
||||||
|
defer m.subLifecycleMu.Unlock()
|
||||||
|
|
||||||
if val, ok := m.subscribers.LoadAndDelete(id); ok {
|
if val, ok := m.subscribers.LoadAndDelete(id); ok {
|
||||||
close(val)
|
close(val)
|
||||||
}
|
}
|
||||||
@@ -260,18 +269,22 @@ func (m *Manager) Unsubscribe(id string) {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
if isEmpty && m.subscription != nil {
|
if !isEmpty || m.subscription == nil {
|
||||||
m.subscription.Stop()
|
return
|
||||||
m.eventWG.Wait()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.subscription.Stop()
|
||||||
|
m.eventWG.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) Close() {
|
func (m *Manager) Close() {
|
||||||
close(m.stopChan)
|
close(m.stopChan)
|
||||||
|
|
||||||
|
m.subLifecycleMu.Lock()
|
||||||
if m.subscription != nil {
|
if m.subscription != nil {
|
||||||
m.subscription.Stop()
|
m.subscription.Stop()
|
||||||
}
|
}
|
||||||
|
m.subLifecycleMu.Unlock()
|
||||||
|
|
||||||
m.eventWG.Wait()
|
m.eventWG.Wait()
|
||||||
m.notifierWg.Wait()
|
m.notifierWg.Wait()
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package cups
|
package cups
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
mocks_cups "github.com/AvengeMedia/DankMaterialShell/core/internal/mocks/cups"
|
mocks_cups "github.com/AvengeMedia/DankMaterialShell/core/internal/mocks/cups"
|
||||||
@@ -75,6 +78,67 @@ func TestManager_Subscribe(t *testing.T) {
|
|||||||
assert.Equal(t, 0, count)
|
assert.Equal(t, 0, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mirrors the real managers: eventChan guarded by mu, conn/running deliberately
|
||||||
|
// unsynchronized so overlapping Start/Stop trips the race detector
|
||||||
|
type stubSubscription struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
events chan SubscriptionEvent
|
||||||
|
conn *int
|
||||||
|
running bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stubSubscription) Start() error {
|
||||||
|
if s.running {
|
||||||
|
return errors.New("already running")
|
||||||
|
}
|
||||||
|
s.running = true
|
||||||
|
|
||||||
|
s.mu.Lock()
|
||||||
|
s.events = make(chan SubscriptionEvent)
|
||||||
|
s.mu.Unlock()
|
||||||
|
|
||||||
|
v := 0
|
||||||
|
s.conn = &v
|
||||||
|
*s.conn++
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stubSubscription) Stop() {
|
||||||
|
if !s.running {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.running = false
|
||||||
|
s.conn = nil
|
||||||
|
|
||||||
|
s.mu.Lock()
|
||||||
|
close(s.events)
|
||||||
|
s.mu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *stubSubscription) Events() <-chan SubscriptionEvent {
|
||||||
|
s.mu.Lock()
|
||||||
|
defer s.mu.Unlock()
|
||||||
|
return s.events
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_SubscribeUnsubscribeRace(t *testing.T) {
|
||||||
|
m := NewTestManager(mocks_cups.NewMockCUPSClientInterface(t), nil)
|
||||||
|
m.subscription = &stubSubscription{}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
for i := range 8 {
|
||||||
|
wg.Go(func() {
|
||||||
|
id := fmt.Sprintf("client-%d", i)
|
||||||
|
for range 50 {
|
||||||
|
m.Subscribe(id)
|
||||||
|
m.Unsubscribe(id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
func TestManager_Close(t *testing.T) {
|
func TestManager_Close(t *testing.T) {
|
||||||
mockClient := mocks_cups.NewMockCUPSClientInterface(t)
|
mockClient := mocks_cups.NewMockCUPSClientInterface(t)
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ type Manager struct {
|
|||||||
client CUPSClientInterface
|
client CUPSClientInterface
|
||||||
pkHelper PkHelper
|
pkHelper PkHelper
|
||||||
subscription SubscriptionManagerInterface
|
subscription SubscriptionManagerInterface
|
||||||
|
subLifecycleMu sync.Mutex
|
||||||
stateMutex sync.RWMutex
|
stateMutex sync.RWMutex
|
||||||
subscribers syncmap.Map[string, chan CUPSState]
|
subscribers syncmap.Map[string, chan CUPSState]
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ func wrapInTerminal(term, title, shellCmd string, extraArgs []string) []string {
|
|||||||
case "konsole":
|
case "konsole":
|
||||||
argv = []string{term, "-p", "tabtitle=" + title}
|
argv = []string{term, "-p", "tabtitle=" + title}
|
||||||
case "gnome-terminal":
|
case "gnome-terminal":
|
||||||
argv = []string{term, "--title=" + title}
|
// --wait: the factory process otherwise returns immediately
|
||||||
|
argv = []string{term, "--wait", "--title=" + title}
|
||||||
execFlag = "--"
|
execFlag = "--"
|
||||||
default:
|
default:
|
||||||
argv = []string{term}
|
argv = []string{term}
|
||||||
|
|||||||
@@ -412,25 +412,30 @@ func (m *Manager) runCustomUpgrade(ctx context.Context, opts UpgradeOptions) {
|
|||||||
onLine := func(line string) { m.appendLog(line) }
|
onLine := func(line string) { m.appendLog(line) }
|
||||||
argv := wrapInTerminal(term, "DMS — System Update (custom)", opts.CustomCommand, opts.TerminalArgs)
|
argv := wrapInTerminal(term, "DMS — System Update (custom)", opts.CustomCommand, opts.TerminalArgs)
|
||||||
if err := Run(ctx, argv, RunOptions{OnLine: onLine}); err != nil {
|
if err := Run(ctx, argv, RunOptions{OnLine: onLine}); err != nil {
|
||||||
code := ErrCodeBackendFailed
|
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(ctx.Err(), context.DeadlineExceeded):
|
case errors.Is(ctx.Err(), context.DeadlineExceeded):
|
||||||
code = ErrCodeTimeout
|
m.failCustomUpgrade(ErrCodeTimeout, err)
|
||||||
|
return
|
||||||
case errors.Is(ctx.Err(), context.Canceled):
|
case errors.Is(ctx.Err(), context.Canceled):
|
||||||
code = ErrCodeCancelled
|
m.failCustomUpgrade(ErrCodeCancelled, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
m.mu.Lock()
|
// exit status reflects the trailing `read`, not the update command
|
||||||
m.state.Phase = PhaseError
|
m.appendLog(fmt.Sprintf("Terminal exited early: %v", err))
|
||||||
m.state.Error = &ErrorInfo{Code: code, Message: err.Error()}
|
|
||||||
m.mu.Unlock()
|
|
||||||
m.markDirty()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m.finishSuccessfulUpgrade(false)
|
m.finishSuccessfulUpgrade(false)
|
||||||
m.runRefresh(context.Background(), false)
|
m.runRefresh(context.Background(), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Manager) failCustomUpgrade(code ErrorCode, err error) {
|
||||||
|
m.mu.Lock()
|
||||||
|
m.state.Phase = PhaseError
|
||||||
|
m.state.Error = &ErrorInfo{Code: code, Message: err.Error()}
|
||||||
|
m.mu.Unlock()
|
||||||
|
m.markDirty()
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Manager) finishSuccessfulUpgrade(clearPackages bool) {
|
func (m *Manager) finishSuccessfulUpgrade(clearPackages bool) {
|
||||||
m.appendLog("Upgrade complete.")
|
m.appendLog("Upgrade complete.")
|
||||||
|
|
||||||
|
|||||||
@@ -233,3 +233,27 @@ func TestUpgradeBackendsFiltersFlatpakOnly(t *testing.T) {
|
|||||||
t.Fatalf("upgradeBackends(mixed) = %#v, want dnf5 then flatpak", got)
|
t.Fatalf("upgradeBackends(mixed) = %#v, want dnf5 then flatpak", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWrapInTerminal(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
term string
|
||||||
|
wantPrefix []string
|
||||||
|
}{
|
||||||
|
{"kitty", []string{"kitty", "--class", "com.danklinux.dms", "-T", "Title"}},
|
||||||
|
{"gnome-terminal", []string{"gnome-terminal", "--wait", "--title=Title"}},
|
||||||
|
{"foot", []string{"foot", "--app-id=com.danklinux.dms", "--title=Title"}},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
got := wrapInTerminal(tt.term, "Title", "echo hi", nil)
|
||||||
|
if len(got) < len(tt.wantPrefix) || !reflect.DeepEqual(got[:len(tt.wantPrefix)], tt.wantPrefix) {
|
||||||
|
t.Errorf("wrapInTerminal(%q) = %#v, want prefix %#v", tt.term, got, tt.wantPrefix)
|
||||||
|
}
|
||||||
|
tail := got[len(got)-3:]
|
||||||
|
if tail[0] != "sh" || tail[1] != "-c" {
|
||||||
|
t.Errorf("wrapInTerminal(%q) tail = %#v, want [sh -c <cmd>]", tt.term, tail)
|
||||||
|
}
|
||||||
|
if !strings.Contains(tail[2], "echo hi") {
|
||||||
|
t.Errorf("wrapInTerminal(%q) command %q does not contain shell command", tt.term, tail[2])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
Submodule dank-qml-common updated: a172b39841...7cc4564e59
Generated
+3
-3
@@ -3,11 +3,11 @@
|
|||||||
"dank-qml-common": {
|
"dank-qml-common": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784935106,
|
"lastModified": 1785121997,
|
||||||
"narHash": "sha256-aVgOBRynme6XNKYCZlf/oCjPDZFwddyUQPRRkEupC3c=",
|
"narHash": "sha256-/MslqFCpjxws8DZqipEKCCTBa0m/SCV3+v1NRT6EuvQ=",
|
||||||
"owner": "AvengeMedia",
|
"owner": "AvengeMedia",
|
||||||
"repo": "dank-qml-common",
|
"repo": "dank-qml-common",
|
||||||
"rev": "a172b39841d8f42bac46ac133b76cade1fae91b4",
|
"rev": "7cc4564e5903a2955fe7da76969f20252cacf9bf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -11,16 +11,27 @@ Singleton {
|
|||||||
id: root
|
id: root
|
||||||
readonly property var log: Log.scoped("CacheData")
|
readonly property var log: Log.scoped("CacheData")
|
||||||
|
|
||||||
readonly property int cacheConfigVersion: 1
|
readonly property int cacheConfigVersion: 2
|
||||||
|
|
||||||
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericCacheLocation)
|
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericCacheLocation)
|
||||||
readonly property string _stateDir: Paths.strip(_stateUrl)
|
readonly property string _stateDir: Paths.strip(_stateUrl)
|
||||||
|
|
||||||
property bool _loading: false
|
property bool _loading: false
|
||||||
|
property bool _hasLoaded: false
|
||||||
|
property int _loadedCacheVersion: 0
|
||||||
|
|
||||||
|
readonly property var _pinKeys: ["brightnessDevicePins", "wifiNetworkPins", "bluetoothDevicePins", "audioInputDevicePins", "audioOutputDevicePins"]
|
||||||
|
readonly property var _dataKeys: ["wallpaperLastPath", "profileLastPath", "fileBrowserSettings"].concat(_pinKeys)
|
||||||
|
|
||||||
property string wallpaperLastPath: ""
|
property string wallpaperLastPath: ""
|
||||||
property string profileLastPath: ""
|
property string profileLastPath: ""
|
||||||
|
|
||||||
|
property var brightnessDevicePins: ({})
|
||||||
|
property var wifiNetworkPins: ({})
|
||||||
|
property var bluetoothDevicePins: ({})
|
||||||
|
property var audioInputDevicePins: ({})
|
||||||
|
property var audioOutputDevicePins: ({})
|
||||||
|
|
||||||
property var fileBrowserSettings: ({
|
property var fileBrowserSettings: ({
|
||||||
"wallpaper": {
|
"wallpaper": {
|
||||||
"lastPath": "",
|
"lastPath": "",
|
||||||
@@ -78,8 +89,46 @@ Singleton {
|
|||||||
|
|
||||||
function loadCache() {
|
function loadCache() {
|
||||||
_loading = true;
|
_loading = true;
|
||||||
parseCache(cacheFile.text());
|
try {
|
||||||
_loading = false;
|
parseCache(cacheFile.text());
|
||||||
|
} finally {
|
||||||
|
_loading = false;
|
||||||
|
_hasLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function set(key, value) {
|
||||||
|
if (_dataKeys.indexOf(key) < 0) {
|
||||||
|
log.warn("Unknown cache key:", key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
root[key] = value;
|
||||||
|
saveCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
function migratePins(pins) {
|
||||||
|
if (!pins)
|
||||||
|
return;
|
||||||
|
if (!_hasLoaded)
|
||||||
|
loadCache();
|
||||||
|
if (_loadedCacheVersion >= cacheConfigVersion)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let migrated = false;
|
||||||
|
for (const key of _pinKeys) {
|
||||||
|
const legacy = pins[key];
|
||||||
|
if (!legacy || Object.keys(legacy).length === 0)
|
||||||
|
continue;
|
||||||
|
if (Object.keys(root[key] || {}).length > 0)
|
||||||
|
continue;
|
||||||
|
root[key] = legacy;
|
||||||
|
migrated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!migrated)
|
||||||
|
return;
|
||||||
|
log.info("Migrated device pins from settings.json");
|
||||||
|
saveCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseCache(content) {
|
function parseCache(content) {
|
||||||
@@ -87,6 +136,7 @@ Singleton {
|
|||||||
try {
|
try {
|
||||||
if (content && content.trim()) {
|
if (content && content.trim()) {
|
||||||
const cache = JSON.parse(content);
|
const cache = JSON.parse(content);
|
||||||
|
_loadedCacheVersion = cache.configVersion || 0;
|
||||||
|
|
||||||
wallpaperLastPath = cache.wallpaperLastPath !== undefined ? cache.wallpaperLastPath : "";
|
wallpaperLastPath = cache.wallpaperLastPath !== undefined ? cache.wallpaperLastPath : "";
|
||||||
profileLastPath = cache.profileLastPath !== undefined ? cache.profileLastPath : "";
|
profileLastPath = cache.profileLastPath !== undefined ? cache.profileLastPath : "";
|
||||||
@@ -122,6 +172,10 @@ Singleton {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const key of _pinKeys) {
|
||||||
|
root[key] = cache[key] !== undefined ? cache[key] : {};
|
||||||
|
}
|
||||||
|
|
||||||
if (cache.configVersion === undefined) {
|
if (cache.configVersion === undefined) {
|
||||||
migrateFromUndefinedToV1(cache);
|
migrateFromUndefinedToV1(cache);
|
||||||
cleanupUnusedKeys();
|
cleanupUnusedKeys();
|
||||||
@@ -138,12 +192,16 @@ Singleton {
|
|||||||
function saveCache() {
|
function saveCache() {
|
||||||
if (_loading)
|
if (_loading)
|
||||||
return;
|
return;
|
||||||
cacheFile.setText(JSON.stringify({
|
const data = {
|
||||||
"wallpaperLastPath": wallpaperLastPath,
|
"wallpaperLastPath": wallpaperLastPath,
|
||||||
"profileLastPath": profileLastPath,
|
"profileLastPath": profileLastPath,
|
||||||
"fileBrowserSettings": fileBrowserSettings,
|
"fileBrowserSettings": fileBrowserSettings,
|
||||||
"configVersion": cacheConfigVersion
|
"configVersion": cacheConfigVersion
|
||||||
}, null, 2));
|
};
|
||||||
|
for (const key of _pinKeys) {
|
||||||
|
data[key] = root[key];
|
||||||
|
}
|
||||||
|
cacheFile.setText(JSON.stringify(data, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrateFromUndefinedToV1(cache) {
|
function migrateFromUndefinedToV1(cache) {
|
||||||
@@ -151,7 +209,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanupUnusedKeys() {
|
function cleanupUnusedKeys() {
|
||||||
const validKeys = ["wallpaperLastPath", "profileLastPath", "fileBrowserSettings", "configVersion"];
|
const validKeys = _dataKeys.concat(["configVersion"]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const content = cacheFile.text();
|
const content = cacheFile.text();
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
pragma Singleton
|
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
import QtQuick
|
|
||||||
import Quickshell
|
|
||||||
import qs.Common
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
function clearImageCache() {
|
|
||||||
Quickshell.execDetached(["rm", "-rf", Paths.stringify(Paths.imagecache)]);
|
|
||||||
Paths.mkdir(Paths.imagecache);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearOldCache(ageInMinutes) {
|
|
||||||
Quickshell.execDetached(["find", Paths.stringify(Paths.imagecache), "-name", "*.png", "-mmin", `+${ageInMinutes}`, "-delete"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearCacheForSize(size) {
|
|
||||||
Quickshell.execDetached(["find", Paths.stringify(Paths.imagecache), "-name", `*@${size}x${size}.png`, "-delete"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheSize(callback) {
|
|
||||||
Proc.runCommand("cache_size", ["du", "-sm", Paths.stringify(Paths.imagecache)], function (output, exitCode) {
|
|
||||||
const sizeMB = parseInt(output.split("\t")[0]) || 0;
|
|
||||||
callback(sizeMB);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -114,26 +114,6 @@ function withRevision(descriptor, revision) {
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
function withAnimationOffset(descriptor, x, y) {
|
|
||||||
var next = normalize(descriptor);
|
|
||||||
next.animationOffset = {
|
|
||||||
"x": x === undefined ? next.animationOffset.x : _number(x, next.animationOffset.x),
|
|
||||||
"y": y === undefined ? next.animationOffset.y : _number(y, next.animationOffset.y)
|
|
||||||
};
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
function withBodyRect(descriptor, x, y, width, height) {
|
|
||||||
var next = normalize(descriptor);
|
|
||||||
next.bodyRect = {
|
|
||||||
"x": x === undefined ? next.bodyRect.x : _number(x, next.bodyRect.x),
|
|
||||||
"y": y === undefined ? next.bodyRect.y : _number(y, next.bodyRect.y),
|
|
||||||
"width": width === undefined ? next.bodyRect.width : Math.max(0, _number(width, next.bodyRect.width)),
|
|
||||||
"height": height === undefined ? next.bodyRect.height : Math.max(0, _number(height, next.bodyRect.height))
|
|
||||||
};
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
function same(a, b, threshold) {
|
function same(a, b, threshold) {
|
||||||
if (!a || !b)
|
if (!a || !b)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -162,21 +162,6 @@ function fillBounds(rect, side, seamOverlap, dpr) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function clipEnvelope(rect, side, radii, seamOverlap, dpr) {
|
|
||||||
var fill = fillBounds(rect, side, seamOverlap, dpr);
|
|
||||||
var chrome = chromeBounds(fill, side, radii.start, radii.end, radii.farExtent, dpr);
|
|
||||||
return {
|
|
||||||
"x": chrome.x,
|
|
||||||
"y": chrome.y,
|
|
||||||
"width": chrome.width,
|
|
||||||
"height": chrome.height,
|
|
||||||
"bodyX": snap(fill.x - chrome.x, dpr),
|
|
||||||
"bodyY": snap(fill.y - chrome.y, dpr),
|
|
||||||
"bodyWidth": fill.width,
|
|
||||||
"bodyHeight": fill.height
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function blurRegions(descriptor, rect, radii, dpr) {
|
function blurRegions(descriptor, rect, radii, dpr) {
|
||||||
var side = descriptor.barSide;
|
var side = descriptor.barSide;
|
||||||
var regions = [bodyRect(rect, dpr)];
|
var regions = [bodyRect(rect, dpr)];
|
||||||
@@ -219,14 +204,3 @@ function unionBounds(rects, padding, dpr) {
|
|||||||
"height": Math.max(0, snap(maxY - minY + pad * 2, dpr))
|
"height": Math.max(0, snap(maxY - minY + pad * 2, dpr))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function shadowSourceBounds(descriptor, rect, radii, padding, dpr) {
|
|
||||||
return unionBounds(blurRegions(descriptor, rect, radii, dpr), padding, dpr);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stableEqual(a, b, dpr) {
|
|
||||||
if (!a || !b)
|
|
||||||
return false;
|
|
||||||
var threshold = 0.5 / (dpr || 1);
|
|
||||||
return Math.abs(a.x - b.x) < threshold && Math.abs(a.y - b.y) < threshold && Math.abs(a.width - b.width) < threshold && Math.abs(a.height - b.height) < threshold;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -44,16 +44,6 @@ function connectorX(barSide, baseX, bodyWidth, placement, spacing, radius) {
|
|||||||
return barSide === "left" ? s : s - w;
|
return barSide === "left" ? s : s - w;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectorY(barSide, baseY, bodyHeight, placement, spacing, radius) {
|
|
||||||
var s = seamY(barSide, baseY, bodyHeight, placement);
|
|
||||||
var h = connectorHeight(barSide, spacing, radius);
|
|
||||||
if (barSide === "top")
|
|
||||||
return s;
|
|
||||||
if (barSide === "bottom")
|
|
||||||
return s - h;
|
|
||||||
return placement === "left" ? s - h : s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Which corner of the connector's bounding rect hosts the concave arc that
|
// Which corner of the connector's bounding rect hosts the concave arc that
|
||||||
// carves into the body. Used for arc-sweep orientation.
|
// carves into the body. Used for arc-sweep orientation.
|
||||||
function arcCorner(barSide, placement) {
|
function arcCorner(barSide, placement) {
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
.pragma library
|
||||||
|
|
||||||
|
function formatRate(bytesPerSec, gbDecimals) {
|
||||||
|
if (bytesPerSec < 1024)
|
||||||
|
return bytesPerSec.toFixed(0) + " B/s";
|
||||||
|
if (bytesPerSec < 1024 * 1024)
|
||||||
|
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
|
||||||
|
if (bytesPerSec < 1024 * 1024 * 1024)
|
||||||
|
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
|
||||||
|
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(gbDecimals ?? 2) + " GB/s";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatBytes(bytes) {
|
||||||
|
if (bytes < 1024)
|
||||||
|
return bytes.toFixed(0) + "B";
|
||||||
|
if (bytes < 1024 * 1024)
|
||||||
|
return (bytes / 1024).toFixed(0) + "K";
|
||||||
|
if (bytes < 1024 * 1024 * 1024)
|
||||||
|
return (bytes / (1024 * 1024)).toFixed(1) + "M";
|
||||||
|
return (bytes / (1024 * 1024 * 1024)).toFixed(1) + "G";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatIsoTime(isoString) {
|
||||||
|
if (!isoString)
|
||||||
|
return "";
|
||||||
|
try {
|
||||||
|
const date = new Date(isoString);
|
||||||
|
if (isNaN(date.getTime()))
|
||||||
|
return "";
|
||||||
|
return date.toLocaleTimeString(Qt.locale(), "HH:mm");
|
||||||
|
} catch (e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatRemaining(ms, zeroText, minText, hText, hmText) {
|
||||||
|
if (ms <= 0)
|
||||||
|
return zeroText;
|
||||||
|
const totalMinutes = Math.ceil(ms / 60000);
|
||||||
|
if (totalMinutes < 60)
|
||||||
|
return minText.arg(totalMinutes);
|
||||||
|
const hours = Math.floor(totalMinutes / 60);
|
||||||
|
const mins = totalMinutes - hours * 60;
|
||||||
|
if (mins === 0)
|
||||||
|
return hText.arg(hours);
|
||||||
|
return hmText.arg(hours).arg(mins);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pad2(n) {
|
||||||
|
return n < 10 ? "0" + n : "" + n;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatUntil(ts, use24h) {
|
||||||
|
if (!ts)
|
||||||
|
return "";
|
||||||
|
const d = new Date(ts);
|
||||||
|
const hours = d.getHours();
|
||||||
|
const minutes = d.getMinutes();
|
||||||
|
if (use24h)
|
||||||
|
return pad2(hours) + ":" + pad2(minutes);
|
||||||
|
const suffix = hours >= 12 ? "PM" : "AM";
|
||||||
|
const h12 = ((hours + 11) % 12) + 1;
|
||||||
|
return h12 + ":" + pad2(minutes) + " " + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addToHistory(arr, val, max) {
|
||||||
|
const newArr = arr.slice();
|
||||||
|
newArr.push(val);
|
||||||
|
if (newArr.length > max)
|
||||||
|
newArr.shift();
|
||||||
|
return newArr;
|
||||||
|
}
|
||||||
@@ -1370,10 +1370,3 @@ function buildDmsAction(baseKey, args) {
|
|||||||
|
|
||||||
return parts.join(" ");
|
return parts.join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScreenshotOptions() {
|
|
||||||
return [
|
|
||||||
{ id: "write-to-disk", label: "Save to disk", type: "bool" },
|
|
||||||
{ id: "show-pointer", label: "Show pointer", type: "bool" }
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ Singleton {
|
|||||||
|
|
||||||
readonly property url imagecache: `${cache}/imagecache`
|
readonly property url imagecache: `${cache}/imagecache`
|
||||||
|
|
||||||
|
property var iconResolver: null
|
||||||
|
property var desktopIconResolver: null
|
||||||
|
property var trashHandler: null
|
||||||
|
|
||||||
Component.onCompleted: mkdir(imagecache)
|
Component.onCompleted: mkdir(imagecache)
|
||||||
|
|
||||||
function stringify(path: url): string {
|
function stringify(path: url): string {
|
||||||
@@ -88,7 +92,7 @@ Singleton {
|
|||||||
function themedIconPath(name: string): string {
|
function themedIconPath(name: string): string {
|
||||||
if (!name)
|
if (!name)
|
||||||
return "";
|
return "";
|
||||||
const themed = (typeof IconThemeService !== "undefined") ? IconThemeService.resolve(name) : "";
|
const themed = iconResolver ? iconResolver(name) : "";
|
||||||
if (themed)
|
if (themed)
|
||||||
return themed;
|
return themed;
|
||||||
return Quickshell.iconPath(name, true);
|
return Quickshell.iconPath(name, true);
|
||||||
@@ -105,11 +109,15 @@ Singleton {
|
|||||||
return moddedId;
|
return moddedId;
|
||||||
return themedIconPath(moddedId);
|
return themedIconPath(moddedId);
|
||||||
}
|
}
|
||||||
return themedIconPath(iconName) || DesktopService.resolveIconPath(iconName);
|
if (!desktopIconResolver)
|
||||||
|
return themedIconPath(iconName);
|
||||||
|
return themedIconPath(iconName) || desktopIconResolver(iconName);
|
||||||
}
|
}
|
||||||
|
|
||||||
function trashPath(path: string, callback): void {
|
function trashPath(path: string, callback): void {
|
||||||
TrashService.trashPath(path, callback);
|
if (!trashHandler)
|
||||||
|
return;
|
||||||
|
trashHandler(path, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyPathToClipboard(path: string): void {
|
function copyPathToClipboard(path: string): void {
|
||||||
@@ -125,7 +133,7 @@ Singleton {
|
|||||||
return toFileUrl(expandTilde(target));
|
return toFileUrl(expandTilde(target));
|
||||||
if (target.startsWith("file://"))
|
if (target.startsWith("file://"))
|
||||||
return target;
|
return target;
|
||||||
const themed = (typeof IconThemeService !== "undefined") ? IconThemeService.resolve(target) : "";
|
const themed = iconResolver ? iconResolver(target) : "";
|
||||||
if (themed)
|
if (themed)
|
||||||
return themed;
|
return themed;
|
||||||
return "image://icon/" + target;
|
return "image://icon/" + target;
|
||||||
@@ -148,7 +156,9 @@ Singleton {
|
|||||||
if (icon && icon !== "")
|
if (icon && icon !== "")
|
||||||
return icon;
|
return icon;
|
||||||
|
|
||||||
return DesktopService.resolveIconPath(appId);
|
if (!desktopIconResolver)
|
||||||
|
return "";
|
||||||
|
return desktopIconResolver(appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAppName(appId: string, desktopEntry: var): string {
|
function getAppName(appId: string, desktopEntry: var): string {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
.pragma library
|
||||||
|
|
||||||
|
function findParentFlickable(item) {
|
||||||
|
while (item) {
|
||||||
|
if (item.hasOwnProperty("contentY") && item.hasOwnProperty("contentItem"))
|
||||||
|
return item;
|
||||||
|
item = item.parent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findSettings(item) {
|
||||||
|
while (item) {
|
||||||
|
if (item.saveValue !== undefined && item.loadValue !== undefined)
|
||||||
|
return item;
|
||||||
|
item = item.parent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizePinList(value) {
|
||||||
|
if (Array.isArray(value))
|
||||||
|
return value.filter(v => v);
|
||||||
|
if (typeof value === "string" && value.length > 0)
|
||||||
|
return [value];
|
||||||
|
return [];
|
||||||
|
}
|
||||||
@@ -16,6 +16,10 @@ Singleton {
|
|||||||
|
|
||||||
readonly property int sessionConfigVersion: 3
|
readonly property int sessionConfigVersion: 3
|
||||||
|
|
||||||
|
signal loaded
|
||||||
|
signal brightnessDisplayHintChanged(string deviceName)
|
||||||
|
signal loadErrorOccurred(string file, string message)
|
||||||
|
|
||||||
property bool _parseError: false
|
property bool _parseError: false
|
||||||
property bool _hasLoaded: false
|
property bool _hasLoaded: false
|
||||||
property bool _isReadOnly: false
|
property bool _isReadOnly: false
|
||||||
@@ -276,15 +280,14 @@ Singleton {
|
|||||||
if (typeof Theme !== "undefined")
|
if (typeof Theme !== "undefined")
|
||||||
Theme.generateSystemThemesFromCurrentTheme();
|
Theme.generateSystemThemesFromCurrentTheme();
|
||||||
|
|
||||||
if (typeof WallpaperCyclingService !== "undefined")
|
loaded();
|
||||||
WallpaperCyclingService.updateCyclingState();
|
|
||||||
|
|
||||||
_checkSessionWritable();
|
_checkSessionWritable();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_parseError = true;
|
_parseError = true;
|
||||||
const msg = e.message;
|
const msg = e.message;
|
||||||
log.error("Failed to parse session.json - file will not be overwritten.");
|
log.error("Failed to parse session.json - file will not be overwritten.");
|
||||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("session.json"), msg));
|
Qt.callLater(() => loadErrorOccurred("session.json", msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,13 +361,12 @@ Singleton {
|
|||||||
if (typeof Theme !== "undefined")
|
if (typeof Theme !== "undefined")
|
||||||
Theme.generateSystemThemesFromCurrentTheme();
|
Theme.generateSystemThemesFromCurrentTheme();
|
||||||
|
|
||||||
if (typeof WallpaperCyclingService !== "undefined")
|
loaded();
|
||||||
WallpaperCyclingService.updateCyclingState();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_parseError = true;
|
_parseError = true;
|
||||||
const msg = e.message;
|
const msg = e.message;
|
||||||
log.error("Failed to parse session.json - file will not be overwritten.");
|
log.error("Failed to parse session.json - file will not be overwritten.");
|
||||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse %1").arg("session.json"), msg));
|
Qt.callLater(() => loadErrorOccurred("session.json", msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,11 +467,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWallpaperPath(path) {
|
|
||||||
wallpaperPath = path;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setWallpaper(imagePath) {
|
function setWallpaper(imagePath) {
|
||||||
wallpaperPath = imagePath;
|
wallpaperPath = imagePath;
|
||||||
if (perModeWallpaper) {
|
if (perModeWallpaper) {
|
||||||
@@ -848,11 +845,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNightModeLocationProvider(provider) {
|
|
||||||
nightModeLocationProvider = provider;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setThemeModeAutoEnabled(enabled) {
|
function setThemeModeAutoEnabled(enabled) {
|
||||||
themeModeAutoEnabled = enabled;
|
themeModeAutoEnabled = enabled;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@@ -941,10 +933,6 @@ Singleton {
|
|||||||
setBarPinnedApps(currentPinned);
|
setBarPinnedApps(currentPinned);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isBarPinnedApp(appId) {
|
|
||||||
return appId && barPinnedApps.indexOf(appId) !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideTrayId(trayId) {
|
function hideTrayId(trayId) {
|
||||||
if (!trayId)
|
if (!trayId)
|
||||||
return;
|
return;
|
||||||
@@ -1007,11 +995,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLaunchPrefix(prefix) {
|
|
||||||
launchPrefix = prefix;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setLastBrightnessDevice(device) {
|
function setLastBrightnessDevice(device) {
|
||||||
lastBrightnessDevice = device;
|
lastBrightnessDevice = device;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@@ -1026,10 +1009,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
brightnessExponentialDevices = newSettings;
|
brightnessExponentialDevices = newSettings;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
brightnessDisplayHintChanged(deviceName);
|
||||||
if (typeof DisplayService !== "undefined") {
|
|
||||||
DisplayService.updateDeviceBrightnessDisplay(deviceName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBrightnessExponential(deviceName) {
|
function getBrightnessExponential(deviceName) {
|
||||||
@@ -1043,10 +1023,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBrightnessUserSetValue(deviceName) {
|
|
||||||
return brightnessUserSetValues[deviceName];
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearBrightnessUserSetValue(deviceName) {
|
function clearBrightnessUserSetValue(deviceName) {
|
||||||
var newValues = Object.assign({}, brightnessUserSetValues);
|
var newValues = Object.assign({}, brightnessUserSetValues);
|
||||||
delete newValues[deviceName];
|
delete newValues[deviceName];
|
||||||
@@ -1070,21 +1046,6 @@ Singleton {
|
|||||||
return value !== undefined ? value : 1.2;
|
return value !== undefined ? value : 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSelectedGpuIndex(index) {
|
|
||||||
selectedGpuIndex = index;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNvidiaGpuTempEnabled(enabled) {
|
|
||||||
nvidiaGpuTempEnabled = enabled;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNonNvidiaGpuTempEnabled(enabled) {
|
|
||||||
nonNvidiaGpuTempEnabled = enabled;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setEnabledGpuPciIds(pciIds) {
|
function setEnabledGpuPciIds(pciIds) {
|
||||||
enabledGpuPciIds = pciIds;
|
enabledGpuPciIds = pciIds;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@@ -1200,15 +1161,6 @@ Singleton {
|
|||||||
return deviceMaxVolumes[nodeName] ?? 100;
|
return deviceMaxVolumes[nodeName] ?? 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeDeviceMaxVolume(nodeName) {
|
|
||||||
if (!nodeName)
|
|
||||||
return;
|
|
||||||
const updated = Object.assign({}, deviceMaxVolumes);
|
|
||||||
delete updated[nodeName];
|
|
||||||
deviceMaxVolumes = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateLocale() {
|
function updateLocale() {
|
||||||
if (!locale) {
|
if (!locale) {
|
||||||
I18n._pickTranslation();
|
I18n._pickTranslation();
|
||||||
@@ -1272,12 +1224,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearLauncherHistory() {
|
|
||||||
launcherLastQuery = "";
|
|
||||||
launcherSearchHistory = [];
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAppDrawerLastMode(mode) {
|
function setAppDrawerLastMode(mode) {
|
||||||
appDrawerLastMode = mode;
|
appDrawerLastMode = mode;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
@@ -1417,141 +1363,4 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "wallpaper"
|
|
||||||
|
|
||||||
function get(): string {
|
|
||||||
if (root.perMonitorWallpaper) {
|
|
||||||
return "ERROR: Per-monitor mode enabled. Use getFor(screenName) instead.";
|
|
||||||
}
|
|
||||||
return root.wallpaperPath || "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function set(path: string): string {
|
|
||||||
if (root.perMonitorWallpaper) {
|
|
||||||
return "ERROR: Per-monitor mode enabled. Use setFor(screenName, path) instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
return "ERROR: No path provided";
|
|
||||||
}
|
|
||||||
|
|
||||||
var absolutePath = path.startsWith("/") ? path : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/" + path;
|
|
||||||
|
|
||||||
try {
|
|
||||||
root.setWallpaper(absolutePath);
|
|
||||||
return "SUCCESS: Wallpaper set to " + absolutePath;
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to set wallpaper: " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function clear(): string {
|
|
||||||
root.setWallpaper("");
|
|
||||||
root.setPerMonitorWallpaper(false);
|
|
||||||
root.monitorWallpapers = {};
|
|
||||||
root.saveSettings();
|
|
||||||
return "SUCCESS: All wallpapers cleared";
|
|
||||||
}
|
|
||||||
|
|
||||||
function next(): string {
|
|
||||||
if (root.perMonitorWallpaper) {
|
|
||||||
return "ERROR: Per-monitor mode enabled. Use nextFor(screenName) instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!root.wallpaperPath) {
|
|
||||||
return "ERROR: No wallpaper set";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
WallpaperCyclingService.cycleNextManually();
|
|
||||||
return "SUCCESS: Cycling to next wallpaper";
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to cycle wallpaper: " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function prev(): string {
|
|
||||||
if (root.perMonitorWallpaper) {
|
|
||||||
return "ERROR: Per-monitor mode enabled. Use prevFor(screenName) instead.";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!root.wallpaperPath) {
|
|
||||||
return "ERROR: No wallpaper set";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
WallpaperCyclingService.cyclePrevManually();
|
|
||||||
return "SUCCESS: Cycling to previous wallpaper";
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to cycle wallpaper: " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFor(screenName: string): string {
|
|
||||||
if (!screenName) {
|
|
||||||
return "ERROR: No screen name provided";
|
|
||||||
}
|
|
||||||
return root.getMonitorWallpaper(screenName) || "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFor(screenName: string, path: string): string {
|
|
||||||
if (!screenName) {
|
|
||||||
return "ERROR: No screen name provided";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
return "ERROR: No path provided";
|
|
||||||
}
|
|
||||||
|
|
||||||
var absolutePath = path.startsWith("/") ? path : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/" + path;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!root.perMonitorWallpaper) {
|
|
||||||
root.setPerMonitorWallpaper(true);
|
|
||||||
}
|
|
||||||
root.setMonitorWallpaper(screenName, absolutePath);
|
|
||||||
return "SUCCESS: Wallpaper set for " + screenName + " to " + absolutePath;
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to set wallpaper for " + screenName + ": " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function nextFor(screenName: string): string {
|
|
||||||
if (!screenName) {
|
|
||||||
return "ERROR: No screen name provided";
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentWallpaper = root.getMonitorWallpaper(screenName);
|
|
||||||
if (!currentWallpaper) {
|
|
||||||
return "ERROR: No wallpaper set for " + screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
WallpaperCyclingService.cycleNextForMonitor(screenName);
|
|
||||||
return "SUCCESS: Cycling to next wallpaper for " + screenName;
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to cycle wallpaper for " + screenName + ": " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function prevFor(screenName: string): string {
|
|
||||||
if (!screenName) {
|
|
||||||
return "ERROR: No screen name provided";
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentWallpaper = root.getMonitorWallpaper(screenName);
|
|
||||||
if (!currentWallpaper) {
|
|
||||||
return "ERROR: No wallpaper set for " + screenName;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
WallpaperCyclingService.cyclePrevForMonitor(screenName);
|
|
||||||
return "SUCCESS: Cycling to previous wallpaper for " + screenName;
|
|
||||||
} catch (e) {
|
|
||||||
return "ERROR: Failed to cycle wallpaper for " + screenName + ": " + e.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Singleton {
|
|||||||
id: root
|
id: root
|
||||||
readonly property var log: Log.scoped("SettingsData")
|
readonly property var log: Log.scoped("SettingsData")
|
||||||
|
|
||||||
readonly property int settingsConfigVersion: 12
|
readonly property int settingsConfigVersion: 13
|
||||||
|
|
||||||
enum Position {
|
enum Position {
|
||||||
Top,
|
Top,
|
||||||
@@ -712,16 +712,23 @@ Singleton {
|
|||||||
property bool notepadUseCompositorGap: false
|
property bool notepadUseCompositorGap: false
|
||||||
property int notepadEdgeGap: 0
|
property int notepadEdgeGap: 0
|
||||||
|
|
||||||
|
property string activeCompositor: ""
|
||||||
|
|
||||||
// Compositor layout gap when enabled and available, else the manual value.
|
// Compositor layout gap when enabled and available, else the manual value.
|
||||||
readonly property int notepadEffectiveEdgeGap: {
|
readonly property int notepadEffectiveEdgeGap: {
|
||||||
if (notepadUseCompositorGap) {
|
if (notepadUseCompositorGap) {
|
||||||
var g = -1;
|
var g = -1;
|
||||||
if (CompositorService.isNiri)
|
switch (activeCompositor) {
|
||||||
|
case "niri":
|
||||||
g = niriLayoutGapsOverride;
|
g = niriLayoutGapsOverride;
|
||||||
else if (CompositorService.isHyprland)
|
break;
|
||||||
|
case "hyprland":
|
||||||
g = hyprlandLayoutGapsOverride;
|
g = hyprlandLayoutGapsOverride;
|
||||||
else if (CompositorService.isMango)
|
break;
|
||||||
|
case "mango":
|
||||||
g = mangoLayoutGapsOverride;
|
g = mangoLayoutGapsOverride;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (g >= 0)
|
if (g >= 0)
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
@@ -790,11 +797,6 @@ Singleton {
|
|||||||
property bool fadeToDpmsEnabled: true
|
property bool fadeToDpmsEnabled: true
|
||||||
property int fadeToDpmsGracePeriod: 5
|
property int fadeToDpmsGracePeriod: 5
|
||||||
property string launchPrefix: ""
|
property string launchPrefix: ""
|
||||||
property var brightnessDevicePins: ({})
|
|
||||||
property var wifiNetworkPins: ({})
|
|
||||||
property var bluetoothDevicePins: ({})
|
|
||||||
property var audioInputDevicePins: ({})
|
|
||||||
property var audioOutputDevicePins: ({})
|
|
||||||
|
|
||||||
property bool gtkThemingEnabled: false
|
property bool gtkThemingEnabled: false
|
||||||
property bool qtThemingEnabled: false
|
property bool qtThemingEnabled: false
|
||||||
@@ -1131,44 +1133,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSystemMonitorVariants() {
|
|
||||||
return systemMonitorVariants || [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function createSystemMonitorVariant(name, config) {
|
|
||||||
const id = "sysmon_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9);
|
|
||||||
const variant = {
|
|
||||||
id: id,
|
|
||||||
name: name,
|
|
||||||
config: config || getDefaultSystemMonitorConfig()
|
|
||||||
};
|
|
||||||
const variants = JSON.parse(JSON.stringify(systemMonitorVariants || []));
|
|
||||||
variants.push(variant);
|
|
||||||
systemMonitorVariants = variants;
|
|
||||||
saveSettings();
|
|
||||||
return variant;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateSystemMonitorVariant(variantId, updates) {
|
|
||||||
const variants = JSON.parse(JSON.stringify(systemMonitorVariants || []));
|
|
||||||
const idx = variants.findIndex(v => v.id === variantId);
|
|
||||||
if (idx === -1)
|
|
||||||
return;
|
|
||||||
Object.assign(variants[idx], updates);
|
|
||||||
systemMonitorVariants = variants;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeSystemMonitorVariant(variantId) {
|
|
||||||
const variants = (systemMonitorVariants || []).filter(v => v.id !== variantId);
|
|
||||||
systemMonitorVariants = variants;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSystemMonitorVariant(variantId) {
|
|
||||||
return (systemMonitorVariants || []).find(v => v.id === variantId) || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultSystemMonitorConfig() {
|
function getDefaultSystemMonitorConfig() {
|
||||||
return {
|
return {
|
||||||
showHeader: true,
|
showHeader: true,
|
||||||
@@ -1309,70 +1273,6 @@ Singleton {
|
|||||||
return (desktopWidgetInstances || []).find(inst => inst.id === instanceId) || null;
|
return (desktopWidgetInstances || []).find(inst => inst.id === instanceId) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDesktopWidgetInstancesOfType(widgetType) {
|
|
||||||
return (desktopWidgetInstances || []).filter(inst => inst.widgetType === widgetType);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEnabledDesktopWidgetInstances() {
|
|
||||||
return (desktopWidgetInstances || []).filter(inst => inst.enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
function moveDesktopWidgetInstance(instanceId, direction) {
|
|
||||||
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
|
|
||||||
const idx = instances.findIndex(inst => inst.id === instanceId);
|
|
||||||
if (idx === -1)
|
|
||||||
return false;
|
|
||||||
const targetIdx = direction === "up" ? idx - 1 : idx + 1;
|
|
||||||
if (targetIdx < 0 || targetIdx >= instances.length)
|
|
||||||
return false;
|
|
||||||
const temp = instances[idx];
|
|
||||||
instances[idx] = instances[targetIdx];
|
|
||||||
instances[targetIdx] = temp;
|
|
||||||
desktopWidgetInstances = instances;
|
|
||||||
saveSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function reorderDesktopWidgetInstance(instanceId, newIndex) {
|
|
||||||
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
|
|
||||||
const idx = instances.findIndex(inst => inst.id === instanceId);
|
|
||||||
if (idx === -1 || newIndex < 0 || newIndex >= instances.length)
|
|
||||||
return false;
|
|
||||||
const [item] = instances.splice(idx, 1);
|
|
||||||
instances.splice(newIndex, 0, item);
|
|
||||||
desktopWidgetInstances = instances;
|
|
||||||
saveSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function reorderDesktopWidgetInstanceInGroup(instanceId, groupId, newIndexInGroup) {
|
|
||||||
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
|
|
||||||
const groups = desktopWidgetGroups || [];
|
|
||||||
const groupMatches = inst => {
|
|
||||||
if (groupId === null)
|
|
||||||
return !inst.group || !groups.some(g => g.id === inst.group);
|
|
||||||
return inst.group === groupId;
|
|
||||||
};
|
|
||||||
const groupInstances = instances.filter(groupMatches);
|
|
||||||
const currentGroupIdx = groupInstances.findIndex(inst => inst.id === instanceId);
|
|
||||||
if (currentGroupIdx === -1 || currentGroupIdx === newIndexInGroup)
|
|
||||||
return false;
|
|
||||||
if (newIndexInGroup < 0 || newIndexInGroup >= groupInstances.length)
|
|
||||||
return false;
|
|
||||||
const globalIdx = instances.findIndex(inst => inst.id === instanceId);
|
|
||||||
if (globalIdx === -1)
|
|
||||||
return false;
|
|
||||||
const [item] = instances.splice(globalIdx, 1);
|
|
||||||
const targetInstance = groupInstances[newIndexInGroup];
|
|
||||||
let targetGlobalIdx = instances.findIndex(inst => inst.id === targetInstance.id);
|
|
||||||
if (newIndexInGroup > currentGroupIdx)
|
|
||||||
targetGlobalIdx++;
|
|
||||||
instances.splice(targetGlobalIdx, 0, item);
|
|
||||||
desktopWidgetInstances = instances;
|
|
||||||
saveSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function moveDesktopWidgetInstanceToGroup(instanceId, groupId, newIndexInGroup) {
|
function moveDesktopWidgetInstanceToGroup(instanceId, groupId, newIndexInGroup) {
|
||||||
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
|
const instances = JSON.parse(JSON.stringify(desktopWidgetInstances || []));
|
||||||
const groups = desktopWidgetGroups || [];
|
const groups = desktopWidgetGroups || [];
|
||||||
@@ -1438,22 +1338,14 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDesktopWidgetGroup(groupId) {
|
|
||||||
return (desktopWidgetGroups || []).find(g => g.id === groupId) || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDesktopWidgetInstancesByGroup(groupId) {
|
|
||||||
return (desktopWidgetInstances || []).filter(inst => inst.group === groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getUngroupedDesktopWidgetInstances() {
|
|
||||||
return (desktopWidgetInstances || []).filter(inst => !inst.group);
|
|
||||||
}
|
|
||||||
|
|
||||||
signal forceDankBarLayoutRefresh
|
signal forceDankBarLayoutRefresh
|
||||||
signal forceDockLayoutRefresh
|
signal forceDockLayoutRefresh
|
||||||
signal widgetDataChanged
|
signal widgetDataChanged
|
||||||
signal workspaceIconsUpdated
|
signal workspaceIconsUpdated
|
||||||
|
signal compositorLayoutRefreshNeeded(bool frame)
|
||||||
|
signal compositorInputRefreshNeeded
|
||||||
|
signal compositorCursorRefreshNeeded
|
||||||
|
signal notificationPopupsInvalidated
|
||||||
|
|
||||||
function refreshAuthAvailability() {
|
function refreshAuthAvailability() {
|
||||||
Processes.detectAuthCapabilities();
|
Processes.detectAuthCapabilities();
|
||||||
@@ -1488,31 +1380,15 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateCompositorLayout() {
|
function updateCompositorLayout() {
|
||||||
if (typeof CompositorService === "undefined")
|
compositorLayoutRefreshNeeded(false);
|
||||||
return;
|
|
||||||
if (CompositorService.isNiri && typeof NiriService !== "undefined")
|
|
||||||
NiriService.generateNiriLayoutConfig();
|
|
||||||
if (CompositorService.isHyprland && typeof HyprlandService !== "undefined")
|
|
||||||
HyprlandService.generateLayoutConfig();
|
|
||||||
if (CompositorService.isMango && typeof MangoService !== "undefined")
|
|
||||||
MangoService.generateLayoutConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCompositorInput() {
|
function updateCompositorInput() {
|
||||||
if (typeof CompositorService === "undefined")
|
compositorInputRefreshNeeded();
|
||||||
return;
|
|
||||||
if (CompositorService.isNiri && typeof NiriService !== "undefined")
|
|
||||||
NiriService.generateNiriInputConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFrameCompositorLayout() {
|
function updateFrameCompositorLayout() {
|
||||||
// Generate before begin() so compositor readiness is already pending at transitionRequested
|
compositorLayoutRefreshNeeded(true);
|
||||||
if (typeof CompositorService !== "undefined") {
|
|
||||||
if (CompositorService.isNiri && typeof NiriService !== "undefined")
|
|
||||||
NiriService.generateNiriLayoutConfig(true);
|
|
||||||
if (CompositorService.isHyprland && typeof HyprlandService !== "undefined")
|
|
||||||
HyprlandService.generateLayoutConfig(true);
|
|
||||||
}
|
|
||||||
FrameTransitionState.begin();
|
FrameTransitionState.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1757,6 +1633,7 @@ Singleton {
|
|||||||
let obj = (txt && txt.trim()) ? JSON.parse(txt) : null;
|
let obj = (txt && txt.trim()) ? JSON.parse(txt) : null;
|
||||||
|
|
||||||
const oldVersion = obj?.configVersion ?? 0;
|
const oldVersion = obj?.configVersion ?? 0;
|
||||||
|
const legacyPins = oldVersion < 13 ? Store.extractPins(obj) : null;
|
||||||
if (oldVersion < settingsConfigVersion) {
|
if (oldVersion < settingsConfigVersion) {
|
||||||
const migrated = Store.migrateToVersion(obj, settingsConfigVersion);
|
const migrated = Store.migrateToVersion(obj, settingsConfigVersion);
|
||||||
if (migrated) {
|
if (migrated) {
|
||||||
@@ -1764,6 +1641,8 @@ Singleton {
|
|||||||
obj = migrated;
|
obj = migrated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (legacyPins)
|
||||||
|
Qt.callLater(() => CacheData.migratePins(legacyPins));
|
||||||
|
|
||||||
if (obj?.lockScreenActiveMonitor !== undefined) {
|
if (obj?.lockScreenActiveMonitor !== undefined) {
|
||||||
var oldVal = obj.lockScreenActiveMonitor;
|
var oldVal = obj.lockScreenActiveMonitor;
|
||||||
@@ -2162,14 +2041,6 @@ Singleton {
|
|||||||
return showSeconds ? "h:mm:ss AP" : "h:mm AP";
|
return showSeconds ? "h:mm:ss AP" : "h:mm AP";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEffectiveClockDateFormat() {
|
|
||||||
return clockDateFormat && clockDateFormat.length > 0 ? clockDateFormat : "ddd d";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEffectiveLockDateFormat() {
|
|
||||||
return lockDateFormat && lockDateFormat.length > 0 ? lockDateFormat : Locale.LongFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initializeListModels() {
|
function initializeListModels() {
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
const defaultBar = barConfigs[0] || getBarConfig("default");
|
||||||
if (defaultBar) {
|
if (defaultBar) {
|
||||||
@@ -2182,39 +2053,6 @@ Singleton {
|
|||||||
widgetDataChanged();
|
widgetDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasNamedWorkspaces() {
|
|
||||||
if (typeof NiriService === "undefined" || !CompositorService.isNiri)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (var i = 0; i < NiriService.allWorkspaces.length; i++) {
|
|
||||||
var ws = NiriService.allWorkspaces[i];
|
|
||||||
if (ws.name && ws.name.trim() !== "")
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNamedWorkspaces() {
|
|
||||||
var namedWorkspaces = [];
|
|
||||||
if (typeof NiriService === "undefined" || !CompositorService.isNiri)
|
|
||||||
return namedWorkspaces;
|
|
||||||
|
|
||||||
for (const ws of NiriService.allWorkspaces) {
|
|
||||||
if (ws.name && ws.name.trim() !== "") {
|
|
||||||
namedWorkspaces.push(ws.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return namedWorkspaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPopupYPosition(barHeight) {
|
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
|
||||||
const gothOffset = defaultBar?.gothCornersEnabled ? Theme.cornerRadius : 0;
|
|
||||||
const spacing = defaultBar?.spacing ?? 4;
|
|
||||||
const bottomGap = defaultBar?.bottomGap ?? 0;
|
|
||||||
return barHeight + spacing + bottomGap - gothOffset + Theme.popupDistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPopupTriggerPosition(pos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) {
|
function getPopupTriggerPosition(pos, screen, barThickness, widgetWidth, barSpacing, barPosition, barConfig) {
|
||||||
const relativeX = pos.x;
|
const relativeX = pos.x;
|
||||||
const relativeY = pos.y;
|
const relativeY = pos.y;
|
||||||
@@ -2508,51 +2346,10 @@ Singleton {
|
|||||||
updateBarConfigs();
|
updateBarConfigs();
|
||||||
|
|
||||||
if (positionChanged) {
|
if (positionChanged) {
|
||||||
NotificationService.dismissAllPopups();
|
notificationPopupsInvalidated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkBarCollisions(barId) {
|
|
||||||
const bar = getBarConfig(barId);
|
|
||||||
if (!bar || !bar.enabled)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
const conflicts = [];
|
|
||||||
const enabledBars = getEnabledBarConfigs();
|
|
||||||
|
|
||||||
for (var i = 0; i < enabledBars.length; i++) {
|
|
||||||
const other = enabledBars[i];
|
|
||||||
if (other.id === barId)
|
|
||||||
continue;
|
|
||||||
const samePosition = bar.position === other.position;
|
|
||||||
if (!samePosition)
|
|
||||||
continue;
|
|
||||||
const barScreens = bar.screenPreferences || ["all"];
|
|
||||||
const otherScreens = other.screenPreferences || ["all"];
|
|
||||||
|
|
||||||
const hasAll = barScreens.includes("all") || otherScreens.includes("all");
|
|
||||||
if (hasAll) {
|
|
||||||
conflicts.push({
|
|
||||||
"barId": other.id,
|
|
||||||
"barName": other.name,
|
|
||||||
"reason": "Same position on all screens"
|
|
||||||
});
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const overlapping = barScreens.some(screen => otherScreens.includes(screen));
|
|
||||||
if (overlapping) {
|
|
||||||
conflicts.push({
|
|
||||||
"barId": other.id,
|
|
||||||
"barName": other.name,
|
|
||||||
"reason": "Same position on overlapping screens"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return conflicts;
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteBarConfig(barId) {
|
function deleteBarConfig(barId) {
|
||||||
if (barId === "default")
|
if (barId === "default")
|
||||||
return;
|
return;
|
||||||
@@ -2701,38 +2498,6 @@ Singleton {
|
|||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFrameFilteredScreens() {
|
|
||||||
var prefs = frameScreenPreferences || ["all"];
|
|
||||||
if (!prefs || prefs.length === 0 || prefs.includes("all")) {
|
|
||||||
return Quickshell.screens;
|
|
||||||
}
|
|
||||||
return Quickshell.screens.filter(screen => isScreenInPreferences(screen, prefs));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActiveBarEdgeForScreen(screen) {
|
|
||||||
if (!screen)
|
|
||||||
return "";
|
|
||||||
for (var i = 0; i < barConfigs.length; i++) {
|
|
||||||
var bc = barConfigs[i];
|
|
||||||
if (!bc.enabled)
|
|
||||||
continue;
|
|
||||||
var prefs = bc.screenPreferences || ["all"];
|
|
||||||
if (!prefs.includes("all") && !isScreenInPreferences(screen, prefs))
|
|
||||||
continue;
|
|
||||||
switch (bc.position ?? 0) {
|
|
||||||
case SettingsData.Position.Top:
|
|
||||||
return "top";
|
|
||||||
case SettingsData.Position.Bottom:
|
|
||||||
return "bottom";
|
|
||||||
case SettingsData.Position.Left:
|
|
||||||
return "left";
|
|
||||||
case SettingsData.Position.Right:
|
|
||||||
return "right";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActiveBarEdgesForScreen(screen) {
|
function getActiveBarEdgesForScreen(screen) {
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return [];
|
return [];
|
||||||
@@ -2791,51 +2556,19 @@ Singleton {
|
|||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
function frameEdgeInsetForSide(screen, side) {
|
readonly property real frameBarContentGap: frameBarInsetPadding < 0 ? frameThickness : frameBarInsetPadding
|
||||||
if (!frameEnabled || !screen)
|
readonly property real frameBarContentGapExtra: Math.max(0, frameBarContentGap - frameThickness)
|
||||||
return 0;
|
|
||||||
const edges = getActiveBarEdgesForScreen(screen);
|
|
||||||
return edges.includes(side) ? frameBarSize : frameThickness;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getActiveBarThicknessForScreen(screen) {
|
function frameEdgeReservation(screen, edge) {
|
||||||
if (frameEnabled)
|
|
||||||
return frameBarSize;
|
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return frameThickness;
|
return 0;
|
||||||
for (var i = 0; i < barConfigs.length; i++) {
|
return getActiveBarEdgesForScreen(screen).includes(edge) ? frameBarSize : frameThickness;
|
||||||
var bc = barConfigs[i];
|
|
||||||
if (!bc.enabled)
|
|
||||||
continue;
|
|
||||||
var prefs = bc.screenPreferences || ["all"];
|
|
||||||
if (!prefs.includes("all") && !isScreenInPreferences(screen, prefs))
|
|
||||||
continue;
|
|
||||||
const innerPadding = bc.innerPadding ?? 4;
|
|
||||||
const barT = Math.max(26 + innerPadding * 0.6, Theme.barHeight - 4 - (8 - innerPadding));
|
|
||||||
const spacing = bc.spacing ?? 4;
|
|
||||||
const bottomGap = bc.bottomGap ?? 0;
|
|
||||||
return barT + spacing + bottomGap;
|
|
||||||
}
|
|
||||||
return frameThickness;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendTestNotifications() {
|
function frameEdgeInsetForSide(screen, side) {
|
||||||
NotificationService.dismissAllPopups();
|
if (!frameEnabled)
|
||||||
sendTestNotification(0);
|
return 0;
|
||||||
testNotifTimer1.start();
|
return frameEdgeReservation(screen, side);
|
||||||
testNotifTimer2.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendTestNotification(index) {
|
|
||||||
const notifications = [["Notification Position Test", "DMS test notification 1 of 3 ~ Hi there!", "preferences-system"], ["Second Test", "DMS Notification 2 of 3 ~ Check it out!", "applications-graphics"], ["Third Test", "DMS notification 3 of 3 ~ Enjoy!", "face-smile"]];
|
|
||||||
|
|
||||||
if (index < 0 || index >= notifications.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const notif = notifications[index];
|
|
||||||
testNotificationProcess.command = ["notify-send", "-h", "int:transient:1", "-a", "DMS", "-i", notif[2], notif[0], notif[1]];
|
|
||||||
testNotificationProcess.running = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMatugenScheme(scheme) {
|
function setMatugenScheme(scheme) {
|
||||||
@@ -2854,15 +2587,6 @@ Singleton {
|
|||||||
set("matugenContrast", value);
|
set("matugenContrast", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setRunUserMatugenTemplates(enabled) {
|
|
||||||
if (runUserMatugenTemplates === enabled)
|
|
||||||
return;
|
|
||||||
set("runUserMatugenTemplates", enabled);
|
|
||||||
if (typeof Theme !== "undefined") {
|
|
||||||
Theme.generateSystemThemesFromCurrentTheme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setMatugenTargetMonitor(monitorName) {
|
function setMatugenTargetMonitor(monitorName) {
|
||||||
if (matugenTargetMonitor === monitorName)
|
if (matugenTargetMonitor === monitorName)
|
||||||
return;
|
return;
|
||||||
@@ -2881,11 +2605,6 @@ Singleton {
|
|||||||
SessionData.setWeatherLocation(displayName, coordinates);
|
SessionData.setWeatherLocation(displayName, coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setIconTheme(themeName) {
|
|
||||||
const light = iconThemePerMode && typeof SessionData !== "undefined" && SessionData.isLightMode;
|
|
||||||
setIconThemeForMode(themeName, light);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setIconThemeForMode(themeName, light) {
|
function setIconThemeForMode(themeName, light) {
|
||||||
if (light)
|
if (light)
|
||||||
iconThemeLight = themeName;
|
iconThemeLight = themeName;
|
||||||
@@ -2931,20 +2650,7 @@ Singleton {
|
|||||||
// https://github.com/Supreeeme/xwayland-satellite/issues/104
|
// https://github.com/Supreeeme/xwayland-satellite/issues/104
|
||||||
// no idea if this matters on other compositors but we also set XCURSOR stuff in the launcher
|
// no idea if this matters on other compositors but we also set XCURSOR stuff in the launcher
|
||||||
function updateCompositorCursor() {
|
function updateCompositorCursor() {
|
||||||
if (typeof CompositorService === "undefined")
|
compositorCursorRefreshNeeded();
|
||||||
return;
|
|
||||||
if (CompositorService.isNiri && typeof NiriService !== "undefined") {
|
|
||||||
NiriService.generateNiriCursorConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (CompositorService.isHyprland && typeof HyprlandService !== "undefined") {
|
|
||||||
HyprlandService.generateCursorConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (CompositorService.isMango && typeof MangoService !== "undefined") {
|
|
||||||
MangoService.generateCursorConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateXResources() {
|
function updateXResources() {
|
||||||
@@ -3012,20 +2718,6 @@ Singleton {
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGtkThemingEnabled(enabled) {
|
|
||||||
set("gtkThemingEnabled", enabled);
|
|
||||||
if (enabled && typeof Theme !== "undefined") {
|
|
||||||
Theme.generateSystemThemesFromCurrentTheme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setQtThemingEnabled(enabled) {
|
|
||||||
set("qtThemingEnabled", enabled);
|
|
||||||
if (enabled && typeof Theme !== "undefined") {
|
|
||||||
Theme.generateSystemThemesFromCurrentTheme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setShowDock(enabled) {
|
function setShowDock(enabled) {
|
||||||
showDock = enabled;
|
showDock = enabled;
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
const defaultBar = barConfigs[0] || getBarConfig("default");
|
||||||
@@ -3071,16 +2763,6 @@ Singleton {
|
|||||||
Qt.callLater(() => forceDockLayoutRefresh());
|
Qt.callLater(() => forceDockLayoutRefresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDankBarSpacing(spacing) {
|
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
|
||||||
if (defaultBar) {
|
|
||||||
updateBarConfig(defaultBar.id, {
|
|
||||||
"spacing": spacing
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateCompositorLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDankBarPosition(position) {
|
function setDankBarPosition(position) {
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
const defaultBar = barConfigs[0] || getBarConfig("default");
|
||||||
if (!defaultBar)
|
if (!defaultBar)
|
||||||
@@ -3136,39 +2818,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetDankBarWidgetsToDefault() {
|
|
||||||
var defaultLeft = ["launcherButton", "workspaceSwitcher", "focusedWindow"];
|
|
||||||
var defaultCenter = ["music", "clock", "weather"];
|
|
||||||
var defaultRight = ["systemTray", "clipboard", "notificationButton", "battery", "controlCenterButton"];
|
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
|
||||||
if (defaultBar) {
|
|
||||||
updateBarConfig(defaultBar.id, {
|
|
||||||
"leftWidgets": defaultLeft,
|
|
||||||
"centerWidgets": defaultCenter,
|
|
||||||
"rightWidgets": defaultRight
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateListModel(leftWidgetsModel, defaultLeft);
|
|
||||||
updateListModel(centerWidgetsModel, defaultCenter);
|
|
||||||
updateListModel(rightWidgetsModel, defaultRight);
|
|
||||||
showLauncherButton = true;
|
|
||||||
showWorkspaceSwitcher = true;
|
|
||||||
showFocusedWindow = true;
|
|
||||||
showWeather = true;
|
|
||||||
showMusic = true;
|
|
||||||
showClipboard = true;
|
|
||||||
showCpuUsage = true;
|
|
||||||
showMemUsage = true;
|
|
||||||
showCpuTemp = true;
|
|
||||||
showGpuTemp = true;
|
|
||||||
showSystemTray = true;
|
|
||||||
showClock = true;
|
|
||||||
showNotificationButton = true;
|
|
||||||
showBattery = true;
|
|
||||||
showControlCenterButton = true;
|
|
||||||
showCapsLockIndicator = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setWorkspaceNameIcon(workspaceName, iconData) {
|
function setWorkspaceNameIcon(workspaceName, iconData) {
|
||||||
var iconMap = JSON.parse(JSON.stringify(workspaceNameIcons));
|
var iconMap = JSON.parse(JSON.stringify(workspaceNameIcons));
|
||||||
iconMap[workspaceName] = iconData;
|
iconMap[workspaceName] = iconData;
|
||||||
@@ -3450,15 +3099,6 @@ Singleton {
|
|||||||
Theme.reloadCustomThemeVariant();
|
Theme.reloadCustomThemeVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleDankBarVisible() {
|
|
||||||
const defaultBar = barConfigs[0] || getBarConfig("default");
|
|
||||||
if (defaultBar) {
|
|
||||||
updateBarConfig(defaultBar.id, {
|
|
||||||
"visible": !defaultBar.visible
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleShowDock() {
|
function toggleShowDock() {
|
||||||
setShowDock(!showDock);
|
setShowDock(!showDock);
|
||||||
}
|
}
|
||||||
@@ -3480,13 +3120,6 @@ Singleton {
|
|||||||
savePluginSettings();
|
savePluginSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePluginSettings(pluginId) {
|
|
||||||
if (pluginSettings[pluginId]) {
|
|
||||||
delete pluginSettings[pluginId];
|
|
||||||
savePluginSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPluginSettingsForPlugin(pluginId) {
|
function getPluginSettingsForPlugin(pluginId) {
|
||||||
const settings = pluginSettings[pluginId];
|
const settings = pluginSettings[pluginId];
|
||||||
return settings ? JSON.parse(JSON.stringify(settings)) : {};
|
return settings ? JSON.parse(JSON.stringify(settings)) : {};
|
||||||
@@ -3512,22 +3145,6 @@ Singleton {
|
|||||||
return settings ? JSON.parse(JSON.stringify(settings)) : {};
|
return settings ? JSON.parse(JSON.stringify(settings)) : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNiriOutputSettings(outputId, settings) {
|
|
||||||
const updated = JSON.parse(JSON.stringify(niriOutputSettings));
|
|
||||||
updated[outputId] = settings;
|
|
||||||
niriOutputSettings = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeNiriOutputSettings(outputId) {
|
|
||||||
if (!niriOutputSettings[outputId])
|
|
||||||
return;
|
|
||||||
const updated = JSON.parse(JSON.stringify(niriOutputSettings));
|
|
||||||
delete updated[outputId];
|
|
||||||
niriOutputSettings = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHyprlandOutputSetting(outputId, key, defaultValue) {
|
function getHyprlandOutputSetting(outputId, key, defaultValue) {
|
||||||
if (!hyprlandOutputSettings[outputId])
|
if (!hyprlandOutputSettings[outputId])
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@@ -3552,40 +3169,6 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHyprlandOutputSettings(outputId) {
|
|
||||||
const settings = hyprlandOutputSettings[outputId];
|
|
||||||
return settings ? JSON.parse(JSON.stringify(settings)) : {};
|
|
||||||
}
|
|
||||||
|
|
||||||
function setHyprlandOutputSettings(outputId, settings) {
|
|
||||||
const updated = JSON.parse(JSON.stringify(hyprlandOutputSettings));
|
|
||||||
updated[outputId] = settings;
|
|
||||||
hyprlandOutputSettings = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeHyprlandOutputSettings(outputId) {
|
|
||||||
if (!hyprlandOutputSettings[outputId])
|
|
||||||
return;
|
|
||||||
const updated = JSON.parse(JSON.stringify(hyprlandOutputSettings));
|
|
||||||
delete updated[outputId];
|
|
||||||
hyprlandOutputSettings = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDisplayProfiles(compositor) {
|
|
||||||
return displayProfiles[compositor] || {};
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDisplayProfile(compositor, profileId, data) {
|
|
||||||
const updated = JSON.parse(JSON.stringify(displayProfiles));
|
|
||||||
if (!updated[compositor])
|
|
||||||
updated[compositor] = {};
|
|
||||||
updated[compositor][profileId] = data;
|
|
||||||
displayProfiles = updated;
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeDisplayProfile(compositor, profileId) {
|
function removeDisplayProfile(compositor, profileId) {
|
||||||
if (!displayProfiles[compositor] || !displayProfiles[compositor][profileId])
|
if (!displayProfiles[compositor] || !displayProfiles[compositor][profileId])
|
||||||
return;
|
return;
|
||||||
@@ -3639,29 +3222,6 @@ Singleton {
|
|||||||
id: rightWidgetsModel
|
id: rightWidgetsModel
|
||||||
}
|
}
|
||||||
|
|
||||||
property Process testNotificationProcess
|
|
||||||
|
|
||||||
testNotificationProcess: Process {
|
|
||||||
command: []
|
|
||||||
running: false
|
|
||||||
}
|
|
||||||
|
|
||||||
property Timer testNotifTimer1
|
|
||||||
|
|
||||||
testNotifTimer1: Timer {
|
|
||||||
interval: 400
|
|
||||||
repeat: false
|
|
||||||
onTriggered: sendTestNotification(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
property Timer testNotifTimer2
|
|
||||||
|
|
||||||
testNotifTimer2: Timer {
|
|
||||||
interval: 800
|
|
||||||
repeat: false
|
|
||||||
onTriggered: sendTestNotification(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias settingsFile: settingsFile
|
property alias settingsFile: settingsFile
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
|||||||
@@ -416,24 +416,6 @@ const StockThemes = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ThemeCategories = {
|
|
||||||
GENERIC: {
|
|
||||||
name: "Generic",
|
|
||||||
variants: [
|
|
||||||
"blue",
|
|
||||||
"purple",
|
|
||||||
"green",
|
|
||||||
"orange",
|
|
||||||
"red",
|
|
||||||
"cyan",
|
|
||||||
"pink",
|
|
||||||
"amber",
|
|
||||||
"coral",
|
|
||||||
"monochrome",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const ThemeNames = {
|
const ThemeNames = {
|
||||||
BLUE: "blue",
|
BLUE: "blue",
|
||||||
PURPLE: "purple",
|
PURPLE: "purple",
|
||||||
@@ -448,10 +430,6 @@ const ThemeNames = {
|
|||||||
DYNAMIC: "dynamic",
|
DYNAMIC: "dynamic",
|
||||||
};
|
};
|
||||||
|
|
||||||
function isStockTheme(themeName) {
|
|
||||||
return Object.keys(StockThemes.DARK).includes(themeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAvailableThemes(isLight = false) {
|
function getAvailableThemes(isLight = false) {
|
||||||
return isLight ? StockThemes.LIGHT : StockThemes.DARK;
|
return isLight ? StockThemes.LIGHT : StockThemes.DARK;
|
||||||
}
|
}
|
||||||
@@ -464,7 +442,3 @@ function getThemeByName(themeName, isLight = false) {
|
|||||||
function getAllThemeNames() {
|
function getAllThemeNames() {
|
||||||
return Object.keys(StockThemes.DARK);
|
return Object.keys(StockThemes.DARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThemeCategories() {
|
|
||||||
return ThemeCategories;
|
|
||||||
}
|
|
||||||
|
|||||||
+26
-607
@@ -107,8 +107,11 @@ Singleton {
|
|||||||
property int _colorsRetryCount: 0
|
property int _colorsRetryCount: 0
|
||||||
property double _lastGenerateMs: 0
|
property double _lastGenerateMs: 0
|
||||||
|
|
||||||
property bool themeModeAutomationActive: false
|
property bool blurLayersActive: false
|
||||||
property bool dmsServiceWasDisconnected: true
|
property bool matugenToastSuppressed: false
|
||||||
|
|
||||||
|
signal screenTransitionNeeded
|
||||||
|
signal themeGenerationStarting
|
||||||
|
|
||||||
readonly property var dank16: {
|
readonly property var dank16: {
|
||||||
const raw = matugenColors?.dank16;
|
const raw = matugenColors?.dank16;
|
||||||
@@ -144,7 +147,7 @@ Singleton {
|
|||||||
Quickshell.execDetached(["mkdir", "-p", stateDir]);
|
Quickshell.execDetached(["mkdir", "-p", stateDir]);
|
||||||
// shellDir may be an embedded-UI extraction, which is read-only and
|
// shellDir may be an embedded-UI extraction, which is read-only and
|
||||||
// unexecutable (dankgo shellapp/shellfs makeReadOnly chmods 0444)
|
// unexecutable (dankgo shellapp/shellfs makeReadOnly chmods 0444)
|
||||||
Quickshell.execDetached(["bash", shellDir + "/scripts/gtk.sh", configDir, "", "", shellDir]);
|
Quickshell.execDetached(["bash", shellDir + "/scripts/gtk.sh", configDir, "assets", "", shellDir]);
|
||||||
Proc.runCommand("matugenCheck", ["sh", "-c", "command -v matugen"], (output, code) => {
|
Proc.runCommand("matugenCheck", ["sh", "-c", "command -v matugen"], (output, code) => {
|
||||||
matugenAvailable = (code === 0) && !envDisableMatugen;
|
matugenAvailable = (code === 0) && !envDisableMatugen;
|
||||||
|
|
||||||
@@ -196,235 +199,6 @@ Singleton {
|
|||||||
const currentIsLight = (typeof SessionData !== "undefined") ? SessionData.isLightMode : false;
|
const currentIsLight = (typeof SessionData !== "undefined") ? SessionData.isLightMode : false;
|
||||||
SettingsData.updateCosmicThemeMode(currentIsLight);
|
SettingsData.updateCosmicThemeMode(currentIsLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof SessionData !== "undefined" && SessionData.themeModeAutoEnabled) {
|
|
||||||
startThemeModeAutomation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: SessionData
|
|
||||||
enabled: typeof SessionData !== "undefined"
|
|
||||||
|
|
||||||
function onThemeModeAutoEnabledChanged() {
|
|
||||||
if (SessionData.themeModeAutoEnabled) {
|
|
||||||
root.startThemeModeAutomation();
|
|
||||||
} else {
|
|
||||||
root.stopThemeModeAutomation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeAutoModeChanged() {
|
|
||||||
if (root.themeModeAutomationActive) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeStartHourChanged() {
|
|
||||||
if (root.themeModeAutomationActive && !SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeStartMinuteChanged() {
|
|
||||||
if (root.themeModeAutomationActive && !SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeEndHourChanged() {
|
|
||||||
if (root.themeModeAutomationActive && !SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeEndMinuteChanged() {
|
|
||||||
if (root.themeModeAutomationActive && !SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onThemeModeShareGammaSettingsChanged() {
|
|
||||||
if (root.themeModeAutomationActive) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNightModeStartHourChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNightModeStartMinuteChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNightModeEndHourChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNightModeEndMinuteChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeShareGammaSettings) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLatitudeChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeAutoMode === "location") {
|
|
||||||
if (!SessionData.nightModeUseIPLocation && SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0 && typeof DMSService !== "undefined") {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
});
|
|
||||||
}
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLongitudeChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeAutoMode === "location") {
|
|
||||||
if (!SessionData.nightModeUseIPLocation && SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0 && typeof DMSService !== "undefined") {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
});
|
|
||||||
}
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNightModeUseIPLocationChanged() {
|
|
||||||
if (root.themeModeAutomationActive && SessionData.themeModeAutoMode === "location") {
|
|
||||||
if (typeof DMSService !== "undefined") {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setUseIPLocation", {
|
|
||||||
"use": SessionData.nightModeUseIPLocation
|
|
||||||
}, response => {
|
|
||||||
if (!response.error && !SessionData.nightModeUseIPLocation && SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// React to gamma backend's isDay state changes for location-based mode
|
|
||||||
Connections {
|
|
||||||
target: DisplayService
|
|
||||||
enabled: typeof DisplayService !== "undefined" && typeof SessionData !== "undefined" && SessionData.themeModeAutoEnabled && SessionData.themeModeAutoMode === "location" && !themeAutoBackendAvailable()
|
|
||||||
|
|
||||||
function onGammaIsDayChanged() {
|
|
||||||
if (root.isLightMode !== DisplayService.gammaIsDay) {
|
|
||||||
root.setLightMode(DisplayService.gammaIsDay, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: DMSService
|
|
||||||
|
|
||||||
function onThemeAutoStateUpdate(data) {
|
|
||||||
if (!SessionData.themeModeAutoEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
applyThemeAutoState(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onConnectionStateChanged() {
|
|
||||||
if (DMSService.isConnected && SessionData.themeModeAutoMode === "time") {
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DMSService.isConnected && SessionData.themeModeAutoMode === "location") {
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (themeAutoBackendAvailable() && SessionData.themeModeAutoEnabled) {
|
|
||||||
DMSService.sendRequest("theme.auto.getState", null, response => {
|
|
||||||
if (response && response.result) {
|
|
||||||
applyThemeAutoState(response.result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SessionData.themeModeAutoEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DMSService.isConnected && SessionData.themeModeAutoMode === "location") {
|
|
||||||
if (SessionData.nightModeUseIPLocation) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setUseIPLocation", {
|
|
||||||
"use": true
|
|
||||||
}, response => {
|
|
||||||
if (!response.error) {
|
|
||||||
log.info("Theme automation: IP location enabled after connection");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setUseIPLocation", {
|
|
||||||
"use": false
|
|
||||||
}, response => {
|
|
||||||
if (!response.error) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
}, locationResponse => {
|
|
||||||
if (locationResponse?.error) {
|
|
||||||
log.warn("Theme automation: Failed to set location", locationResponse.error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
log.warn("Theme automation: No location configured");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: SessionService
|
|
||||||
enabled: SessionData.themeModeAutoEnabled
|
|
||||||
|
|
||||||
function onSessionUnlocked() {
|
|
||||||
root.triggerThemeAutomationRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSessionResumed() {
|
|
||||||
root.triggerThemeAutomationRefresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function triggerThemeAutomationRefresh() {
|
|
||||||
if (!themeAutoBackendAvailable()) {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DMSService.sendRequest("theme.auto.trigger", {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMatugenColor(path, fallback) {
|
function getMatugenColor(path, fallback) {
|
||||||
@@ -571,8 +345,8 @@ Singleton {
|
|||||||
property color surfaceVariantAlpha: withAlpha(surfaceVariant, 0.2)
|
property color surfaceVariantAlpha: withAlpha(surfaceVariant, 0.2)
|
||||||
|
|
||||||
readonly property bool foregroundLayers: typeof SettingsData === "undefined" || (SettingsData.blurForegroundLayers ?? true)
|
readonly property bool foregroundLayers: typeof SettingsData === "undefined" || (SettingsData.blurForegroundLayers ?? true)
|
||||||
readonly property bool blurForegroundLayers: BlurService.enabled && foregroundLayers
|
readonly property bool blurForegroundLayers: blurLayersActive && foregroundLayers
|
||||||
readonly property bool transparentBlurLayers: BlurService.enabled && !foregroundLayers
|
readonly property bool transparentBlurLayers: blurLayersActive && !foregroundLayers
|
||||||
readonly property bool notificationForegroundLayers: typeof SettingsData === "undefined" || (SettingsData.notificationForegroundLayers ?? true)
|
readonly property bool notificationForegroundLayers: typeof SettingsData === "undefined" || (SettingsData.notificationForegroundLayers ?? true)
|
||||||
readonly property color readableSurface: withAlpha(surfaceContainer, popupTransparency)
|
readonly property color readableSurface: withAlpha(surfaceContainer, popupTransparency)
|
||||||
readonly property color readableSurfaceHigh: withAlpha(surfaceContainerHigh, popupTransparency)
|
readonly property color readableSurfaceHigh: withAlpha(surfaceContainerHigh, popupTransparency)
|
||||||
@@ -658,7 +432,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property color ccTileInactiveBg: transparentBlurLayers ? withAlpha(surfaceContainerHigh, 0.16) : (foregroundLayers ? withAlpha(surfaceContainerHigh, BlurService.enabled ? Math.min(popupTransparency, 0.24) : popupTransparency) : withAlpha(surfaceContainer, 0))
|
readonly property color ccTileInactiveBg: transparentBlurLayers ? withAlpha(surfaceContainerHigh, 0.16) : (foregroundLayers ? withAlpha(surfaceContainerHigh, blurLayersActive ? Math.min(popupTransparency, 0.24) : popupTransparency) : withAlpha(surfaceContainer, 0))
|
||||||
readonly property color ccPillInactiveBg: transparentBlurLayers ? withAlpha(surfaceContainerHigh, 0.08) : nestedSurface
|
readonly property color ccPillInactiveBg: transparentBlurLayers ? withAlpha(surfaceContainerHigh, 0.08) : nestedSurface
|
||||||
readonly property color ccPillInactiveHoverBg: transparentBlurLayers ? withAlpha(primary, 0.10) : primaryPressed
|
readonly property color ccPillInactiveHoverBg: transparentBlurLayers ? withAlpha(primary, 0.10) : primaryPressed
|
||||||
readonly property color ccSliderTrackColor: transparentBlurLayers ? surfaceText : surfaceContainerHigh
|
readonly property color ccSliderTrackColor: transparentBlurLayers ? surfaceText : surfaceContainerHigh
|
||||||
@@ -978,22 +752,6 @@ Singleton {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function elevationTintOpacity(level) {
|
|
||||||
if (!level)
|
|
||||||
return 0;
|
|
||||||
if (level === elevationLevel1)
|
|
||||||
return 0.05;
|
|
||||||
if (level === elevationLevel2)
|
|
||||||
return 0.08;
|
|
||||||
if (level === elevationLevel3)
|
|
||||||
return 0.11;
|
|
||||||
if (level === elevationLevel4)
|
|
||||||
return 0.12;
|
|
||||||
if (level === elevationLevel5)
|
|
||||||
return 0.14;
|
|
||||||
return 0.08;
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property var animationDurations: [
|
readonly property var animationDurations: [
|
||||||
{
|
{
|
||||||
"shorter": 0,
|
"shorter": 0,
|
||||||
@@ -1261,9 +1019,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function screenTransition() {
|
function screenTransition() {
|
||||||
if (CompositorService.isNiri) {
|
screenTransitionNeeded();
|
||||||
NiriService.doScreenTransition();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchTheme(themeName, savePrefs = true, enableTransition = true) {
|
function switchTheme(themeName, savePrefs = true, enableTransition = true) {
|
||||||
@@ -1315,7 +1071,6 @@ Singleton {
|
|||||||
SessionData.setLightMode(light);
|
SessionData.setLightMode(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
PortalService.setLightMode(light);
|
|
||||||
if (typeof SettingsData !== "undefined") {
|
if (typeof SettingsData !== "undefined") {
|
||||||
SettingsData.updateCosmicThemeMode(light);
|
SettingsData.updateCosmicThemeMode(light);
|
||||||
}
|
}
|
||||||
@@ -1326,22 +1081,6 @@ Singleton {
|
|||||||
setLightMode(!isLightMode, savePrefs, true);
|
setLightMode(!isLightMode, savePrefs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function forceGenerateSystemThemes() {
|
|
||||||
if (!matugenAvailable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
generateSystemThemesFromCurrentTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAvailableThemes() {
|
|
||||||
return StockThemes.getAllThemeNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getThemeDisplayName(themeName) {
|
|
||||||
const themeData = StockThemes.getThemeByName(themeName, isLightMode);
|
|
||||||
return themeData.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getThemeColors(themeName) {
|
function getThemeColors(themeName) {
|
||||||
if (themeName === "custom" && customThemeData) {
|
if (themeName === "custom" && customThemeData) {
|
||||||
return customThemeData;
|
return customThemeData;
|
||||||
@@ -1457,10 +1196,6 @@ Singleton {
|
|||||||
readonly property var _availableThemeNames: StockThemes.getAllThemeNames()
|
readonly property var _availableThemeNames: StockThemes.getAllThemeNames()
|
||||||
property string currentThemeName: currentTheme
|
property string currentThemeName: currentTheme
|
||||||
|
|
||||||
function panelBackground() {
|
|
||||||
return withAlpha(surfaceContainer, panelTransparency);
|
|
||||||
}
|
|
||||||
|
|
||||||
property real notepadTransparency: SettingsData.notepadTransparencyOverride >= 0 ? SettingsData.notepadTransparencyOverride : popupTransparency
|
property real notepadTransparency: SettingsData.notepadTransparencyOverride >= 0 ? SettingsData.notepadTransparencyOverride : popupTransparency
|
||||||
|
|
||||||
property bool widgetBackgroundHasAlpha: {
|
property bool widgetBackgroundHasAlpha: {
|
||||||
@@ -1537,10 +1272,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isColorDark(c) {
|
|
||||||
return (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) < 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
function barIconSize(barThickness, offset, maximizeIcon, iconScale) {
|
function barIconSize(barThickness, offset, maximizeIcon, iconScale) {
|
||||||
const defaultOffset = offset !== undefined ? offset : -6;
|
const defaultOffset = offset !== undefined ? offset : -6;
|
||||||
const size = (maximizeIcon ?? false) ? iconSizeLarge : iconSize;
|
const size = (maximizeIcon ?? false) ? iconSizeLarge : iconSize;
|
||||||
@@ -1623,19 +1354,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPowerProfileDescription(profile) {
|
|
||||||
switch (profile) {
|
|
||||||
case 0:
|
|
||||||
return I18n.tr("Extend battery life", "power profile description");
|
|
||||||
case 1:
|
|
||||||
return I18n.tr("Balance power and performance", "power profile description");
|
|
||||||
case 2:
|
|
||||||
return I18n.tr("Prioritize performance", "power profile description");
|
|
||||||
default:
|
|
||||||
return I18n.tr("Custom power profile", "power profile description");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLightModeChanged() {
|
function onLightModeChanged() {
|
||||||
if (currentTheme === "custom" && customThemeFileView.path) {
|
if (currentTheme === "custom" && customThemeFileView.path) {
|
||||||
customThemeFileView.reload();
|
customThemeFileView.reload();
|
||||||
@@ -1663,9 +1381,7 @@ Singleton {
|
|||||||
|
|
||||||
log.info("Setting desired theme -", kind, "mode:", isLight ? "light" : "dark", stockColors ? "(stock colors)" : "(dynamic)");
|
log.info("Setting desired theme -", kind, "mode:", isLight ? "light" : "dark", stockColors ? "(stock colors)" : "(dynamic)");
|
||||||
|
|
||||||
if (typeof NiriService !== "undefined" && CompositorService.isNiri) {
|
themeGenerationStarting();
|
||||||
NiriService.suppressNextToast();
|
|
||||||
}
|
|
||||||
|
|
||||||
const desired = {
|
const desired = {
|
||||||
"kind": kind,
|
"kind": kind,
|
||||||
@@ -1777,8 +1493,7 @@ Singleton {
|
|||||||
|
|
||||||
if (currentTheme === dynamic) {
|
if (currentTheme === dynamic) {
|
||||||
if (!rawWallpaperPath) {
|
if (!rawWallpaperPath) {
|
||||||
log.warn("Auto theme has no wallpaper - skipping matugen, syncing portal mode only");
|
log.warn("Auto theme has no wallpaper - skipping matugen");
|
||||||
PortalService.setLightMode(isLight);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot";
|
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot";
|
||||||
@@ -1955,7 +1670,13 @@ Singleton {
|
|||||||
function patchGtk3colors() {
|
function patchGtk3colors() {
|
||||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode);
|
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode);
|
||||||
Proc.runCommand("gtk3Patcher", ["bash", shellDir + "/scripts/gtk.sh", configDir, "patch", isLight, shellDir], (output, exitCode) => {
|
Proc.runCommand("gtk3Patcher", ["bash", shellDir + "/scripts/gtk.sh", configDir, "patch", isLight, shellDir], (output, exitCode) => {
|
||||||
if (exitCode !== 0) {
|
switch (exitCode) {
|
||||||
|
case 0:
|
||||||
|
refreshGtkTheme();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
log.warn(`Failed to patch GTK3 colors: ${output}`);
|
log.warn(`Failed to patch GTK3 colors: ${output}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1972,7 +1693,7 @@ Singleton {
|
|||||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
||||||
Proc.runCommand("gtkApplier", ["bash", shellDir + "/scripts/gtk.sh", configDir, "apply", isLight, shellDir], (output, exitCode) => {
|
Proc.runCommand("gtkApplier", ["bash", shellDir + "/scripts/gtk.sh", configDir, "apply", isLight, shellDir], (output, exitCode) => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) {
|
if (typeof ToastService !== "undefined" && !root.matugenToastSuppressed) {
|
||||||
ToastService.showInfo(I18n.tr("GTK colors applied successfully"));
|
ToastService.showInfo(I18n.tr("GTK colors applied successfully"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2010,18 +1731,17 @@ Singleton {
|
|||||||
return Qt.rgba(c.r, c.g, c.b, a);
|
return Qt.rgba(c.r, c.g, c.b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
function popupLayerColor(baseColor) {
|
|
||||||
if (isConnectedEffect)
|
|
||||||
return connectedSurfaceColor;
|
|
||||||
return withAlpha(baseColor, popupTransparency);
|
|
||||||
}
|
|
||||||
|
|
||||||
function blendAlpha(c, a) {
|
function blendAlpha(c, a) {
|
||||||
if (!c || c.r === undefined)
|
if (!c || c.r === undefined)
|
||||||
return Qt.rgba(0, 0, 0, 0);
|
return Qt.rgba(0, 0, 0, 0);
|
||||||
return Qt.rgba(c.r, c.g, c.b, c.a * a);
|
return Qt.rgba(c.r, c.g, c.b, c.a * a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hoverTint(base) {
|
||||||
|
const factor = 1.2;
|
||||||
|
return isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
||||||
|
}
|
||||||
|
|
||||||
function blend(c1, c2, r) {
|
function blend(c1, c2, r) {
|
||||||
return Qt.rgba(c1.r * (1 - r) + c2.r * r, c1.g * (1 - r) + c2.g * r, c1.b * (1 - r) + c2.b * r, c1.a * (1 - r) + c2.a * r);
|
return Qt.rgba(c1.r * (1 - r) + c2.r * r, c1.g * (1 - r) + c2.g * r, c1.b * (1 - r) + c2.b * r, c1.a * (1 - r) + c2.a * r);
|
||||||
}
|
}
|
||||||
@@ -2167,10 +1887,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pendingThemeRequest) {
|
if (!pendingThemeRequest) {
|
||||||
if (SettingsData.matugenTemplateGtk) {
|
if (SettingsData.matugenTemplateGtk)
|
||||||
patchGtk3colors();
|
patchGtk3colors();
|
||||||
refreshGtkTheme();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2340,303 +2058,4 @@ Singleton {
|
|||||||
root.switchTheme(defaultTheme, true, false);
|
root.switchTheme(defaultTheme, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Theme mode automation functions
|
|
||||||
function themeAutoBackendAvailable() {
|
|
||||||
return typeof DMSService !== "undefined" && DMSService.isConnected && Array.isArray(DMSService.capabilities) && DMSService.capabilities.includes("theme.auto");
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyThemeAutoState(state) {
|
|
||||||
if (!state) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (state.config && state.config.mode && state.config.mode !== SessionData.themeModeAutoMode) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof SessionData !== "undefined" && state.nextTransition !== undefined) {
|
|
||||||
SessionData.themeModeNextTransition = state.nextTransition || "";
|
|
||||||
}
|
|
||||||
if (state.isLight !== undefined && root.isLightMode !== state.isLight) {
|
|
||||||
root.setLightMode(state.isLight, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncTimeThemeSchedule() {
|
|
||||||
if (typeof SessionData === "undefined" || typeof DMSService === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DMSService.isConnected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeModeActive = SessionData.themeModeAutoEnabled && SessionData.themeModeAutoMode === "time";
|
|
||||||
|
|
||||||
if (!timeModeActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DMSService.sendRequest("theme.auto.setMode", {
|
|
||||||
"mode": "time"
|
|
||||||
});
|
|
||||||
|
|
||||||
const shareSettings = SessionData.themeModeShareGammaSettings;
|
|
||||||
const startHour = shareSettings ? SessionData.nightModeStartHour : SessionData.themeModeStartHour;
|
|
||||||
const startMinute = shareSettings ? SessionData.nightModeStartMinute : SessionData.themeModeStartMinute;
|
|
||||||
const endHour = shareSettings ? SessionData.nightModeEndHour : SessionData.themeModeEndHour;
|
|
||||||
const endMinute = shareSettings ? SessionData.nightModeEndMinute : SessionData.themeModeEndMinute;
|
|
||||||
|
|
||||||
DMSService.sendRequest("theme.auto.setSchedule", {
|
|
||||||
"startHour": startHour,
|
|
||||||
"startMinute": startMinute,
|
|
||||||
"endHour": endHour,
|
|
||||||
"endMinute": endMinute
|
|
||||||
}, response => {
|
|
||||||
if (response && response.error) {
|
|
||||||
log.error("Theme automation: Failed to sync time schedule:", response.error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
DMSService.sendRequest("theme.auto.setEnabled", {
|
|
||||||
"enabled": true
|
|
||||||
});
|
|
||||||
DMSService.sendRequest("theme.auto.trigger", {});
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncLocationThemeSchedule() {
|
|
||||||
if (typeof SessionData === "undefined" || typeof DMSService === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DMSService.isConnected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const locationModeActive = SessionData.themeModeAutoEnabled && SessionData.themeModeAutoMode === "location";
|
|
||||||
|
|
||||||
if (!locationModeActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DMSService.sendRequest("theme.auto.setMode", {
|
|
||||||
"mode": "location"
|
|
||||||
});
|
|
||||||
|
|
||||||
if (SessionData.nightModeUseIPLocation) {
|
|
||||||
DMSService.sendRequest("theme.auto.setUseIPLocation", {
|
|
||||||
"use": true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
DMSService.sendRequest("theme.auto.setUseIPLocation", {
|
|
||||||
"use": false
|
|
||||||
});
|
|
||||||
if (SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0) {
|
|
||||||
DMSService.sendRequest("theme.auto.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DMSService.sendRequest("theme.auto.setEnabled", {
|
|
||||||
"enabled": true
|
|
||||||
});
|
|
||||||
DMSService.sendRequest("theme.auto.trigger", {});
|
|
||||||
}
|
|
||||||
|
|
||||||
function evaluateThemeMode() {
|
|
||||||
if (typeof SessionData === "undefined" || !SessionData.themeModeAutoEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (themeAutoBackendAvailable()) {
|
|
||||||
DMSService.sendRequest("theme.auto.getState", null, response => {
|
|
||||||
if (response && response.result) {
|
|
||||||
applyThemeAutoState(response.result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const mode = SessionData.themeModeAutoMode;
|
|
||||||
|
|
||||||
if (mode === "location") {
|
|
||||||
evaluateLocationBasedThemeMode();
|
|
||||||
} else {
|
|
||||||
evaluateTimeBasedThemeMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function evaluateLocationBasedThemeMode() {
|
|
||||||
if (typeof DisplayService !== "undefined") {
|
|
||||||
const shouldBeLight = DisplayService.gammaIsDay;
|
|
||||||
if (root.isLightMode !== shouldBeLight) {
|
|
||||||
root.setLightMode(shouldBeLight, true, true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SessionData.nightModeUseIPLocation && SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0) {
|
|
||||||
const shouldBeLight = calculateIsDaytime(SessionData.latitude, SessionData.longitude);
|
|
||||||
if (root.isLightMode !== shouldBeLight) {
|
|
||||||
root.setLightMode(shouldBeLight, true, true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.themeModeAutomationActive) {
|
|
||||||
if (SessionData.nightModeUseIPLocation) {
|
|
||||||
log.warn("Theme automation: Waiting for IP location from backend");
|
|
||||||
} else {
|
|
||||||
log.warn("Theme automation: Location mode requires coordinates");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function evaluateTimeBasedThemeMode() {
|
|
||||||
const shareSettings = SessionData.themeModeShareGammaSettings;
|
|
||||||
|
|
||||||
const startHour = shareSettings ? SessionData.nightModeStartHour : SessionData.themeModeStartHour;
|
|
||||||
const startMinute = shareSettings ? SessionData.nightModeStartMinute : SessionData.themeModeStartMinute;
|
|
||||||
const endHour = shareSettings ? SessionData.nightModeEndHour : SessionData.themeModeEndHour;
|
|
||||||
const endMinute = shareSettings ? SessionData.nightModeEndMinute : SessionData.themeModeEndMinute;
|
|
||||||
|
|
||||||
const now = new Date();
|
|
||||||
const currentMinutes = now.getHours() * 60 + now.getMinutes();
|
|
||||||
const startMinutes = startHour * 60 + startMinute;
|
|
||||||
const endMinutes = endHour * 60 + endMinute;
|
|
||||||
|
|
||||||
let shouldBeLight;
|
|
||||||
if (startMinutes < endMinutes) {
|
|
||||||
shouldBeLight = currentMinutes < startMinutes || currentMinutes >= endMinutes;
|
|
||||||
} else {
|
|
||||||
shouldBeLight = currentMinutes >= endMinutes && currentMinutes < startMinutes;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.isLightMode !== shouldBeLight) {
|
|
||||||
root.setLightMode(shouldBeLight, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculateIsDaytime(lat, lng) {
|
|
||||||
const now = new Date();
|
|
||||||
const start = new Date(now.getFullYear(), 0, 0);
|
|
||||||
const diff = now - start;
|
|
||||||
const dayOfYear = Math.floor(diff / 86400000);
|
|
||||||
const latRad = lat * Math.PI / 180;
|
|
||||||
|
|
||||||
const declination = 23.45 * Math.sin((360 / 365) * (dayOfYear - 81) * Math.PI / 180);
|
|
||||||
const declinationRad = declination * Math.PI / 180;
|
|
||||||
|
|
||||||
const cosHourAngle = -Math.tan(latRad) * Math.tan(declinationRad);
|
|
||||||
|
|
||||||
if (cosHourAngle > 1) {
|
|
||||||
return false; // Polar night
|
|
||||||
}
|
|
||||||
if (cosHourAngle < -1) {
|
|
||||||
return true; // Midnight sun
|
|
||||||
}
|
|
||||||
|
|
||||||
const hourAngle = Math.acos(cosHourAngle);
|
|
||||||
const hourAngleDeg = hourAngle * 180 / Math.PI;
|
|
||||||
|
|
||||||
const sunriseHour = 12 - hourAngleDeg / 15;
|
|
||||||
const sunsetHour = 12 + hourAngleDeg / 15;
|
|
||||||
|
|
||||||
const timeZoneOffset = now.getTimezoneOffset() / 60;
|
|
||||||
const localSunrise = sunriseHour - lng / 15 - timeZoneOffset;
|
|
||||||
const localSunset = sunsetHour - lng / 15 - timeZoneOffset;
|
|
||||||
|
|
||||||
const currentHour = now.getHours() + now.getMinutes() / 60;
|
|
||||||
|
|
||||||
const normalizeSunrise = ((localSunrise % 24) + 24) % 24;
|
|
||||||
const normalizeSunset = ((localSunset % 24) + 24) % 24;
|
|
||||||
|
|
||||||
return currentHour >= normalizeSunrise && currentHour < normalizeSunset;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to send location to backend
|
|
||||||
function sendLocationToBackend() {
|
|
||||||
if (typeof SessionData === "undefined" || typeof DMSService === "undefined") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DMSService.isConnected) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SessionData.nightModeUseIPLocation) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setUseIPLocation", {
|
|
||||||
"use": true
|
|
||||||
}, response => {
|
|
||||||
if (response?.error) {
|
|
||||||
log.warn("Theme automation: Failed to enable IP location", response.error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
} else if (SessionData.latitude !== 0.0 && SessionData.longitude !== 0.0) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setUseIPLocation", {
|
|
||||||
"use": false
|
|
||||||
}, response => {
|
|
||||||
if (!response.error) {
|
|
||||||
DMSService.sendRequest("wayland.gamma.setLocation", {
|
|
||||||
"latitude": SessionData.latitude,
|
|
||||||
"longitude": SessionData.longitude
|
|
||||||
}, locResp => {
|
|
||||||
if (locResp?.error) {
|
|
||||||
log.warn("Theme automation: Failed to set location", locResp.error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: locationRetryTimer
|
|
||||||
interval: 1000
|
|
||||||
repeat: true
|
|
||||||
running: false
|
|
||||||
property int retryCount: 0
|
|
||||||
|
|
||||||
onTriggered: {
|
|
||||||
if (root.sendLocationToBackend()) {
|
|
||||||
stop();
|
|
||||||
retryCount = 0;
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
} else {
|
|
||||||
retryCount++;
|
|
||||||
if (retryCount >= 10) {
|
|
||||||
stop();
|
|
||||||
retryCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function startThemeModeAutomation() {
|
|
||||||
root.themeModeAutomationActive = true;
|
|
||||||
|
|
||||||
root.syncTimeThemeSchedule();
|
|
||||||
root.syncLocationThemeSchedule();
|
|
||||||
|
|
||||||
const sent = root.sendLocationToBackend();
|
|
||||||
|
|
||||||
if (!sent && typeof SessionData !== "undefined" && SessionData.themeModeAutoMode === "location") {
|
|
||||||
locationRetryTimer.start();
|
|
||||||
} else {
|
|
||||||
root.evaluateThemeMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopThemeModeAutomation() {
|
|
||||||
root.themeModeAutomationActive = false;
|
|
||||||
if (typeof DMSService !== "undefined" && DMSService.isConnected) {
|
|
||||||
DMSService.sendRequest("theme.auto.setEnabled", {
|
|
||||||
"enabled": false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,13 @@
|
|||||||
function markdownToHtml(text) {
|
function markdownToHtml(text) {
|
||||||
if (!text) return "";
|
if (!text) return "";
|
||||||
|
|
||||||
// Store code blocks and inline code to protect them from further processing
|
|
||||||
const codeBlocks = [];
|
const codeBlocks = [];
|
||||||
const inlineCode = [];
|
const inlineCode = [];
|
||||||
let blockIndex = 0;
|
let blockIndex = 0;
|
||||||
let inlineIndex = 0;
|
let inlineIndex = 0;
|
||||||
|
|
||||||
// First, extract and replace code blocks with placeholders
|
|
||||||
let html = text.replace(/```([\s\S]*?)```/g, (match, code) => {
|
let html = text.replace(/```([\s\S]*?)```/g, (match, code) => {
|
||||||
// Trim leading and trailing blank lines only
|
|
||||||
const trimmedCode = code.replace(/^\n+|\n+$/g, '');
|
const trimmedCode = code.replace(/^\n+|\n+$/g, '');
|
||||||
// Escape HTML entities in code
|
|
||||||
const escapedCode = trimmedCode.replace(/&/g, '&')
|
const escapedCode = trimmedCode.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
@@ -22,9 +18,7 @@ function markdownToHtml(text) {
|
|||||||
return `\x00CODEBLOCK${blockIndex++}\x00`;
|
return `\x00CODEBLOCK${blockIndex++}\x00`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Extract and replace inline code
|
|
||||||
html = html.replace(/`([^`]+)`/g, (match, code) => {
|
html = html.replace(/`([^`]+)`/g, (match, code) => {
|
||||||
// Escape HTML entities in code
|
|
||||||
const escapedCode = code.replace(/&/g, '&')
|
const escapedCode = code.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
@@ -40,12 +34,10 @@ function markdownToHtml(text) {
|
|||||||
return prefix + `\x00URL${urlIndex++}\x00`;
|
return prefix + `\x00URL${urlIndex++}\x00`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Escape HTML entities (but not in code blocks or URLs)
|
|
||||||
html = html.replace(/&/g, '&')
|
html = html.replace(/&/g, '&')
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
|
|
||||||
// Headers
|
|
||||||
html = html.replace(/^### (.*?)$/gm, '<h3>$1</h3>');
|
html = html.replace(/^### (.*?)$/gm, '<h3>$1</h3>');
|
||||||
html = html.replace(/^## (.*?)$/gm, '<h2>$1</h2>');
|
html = html.replace(/^## (.*?)$/gm, '<h2>$1</h2>');
|
||||||
html = html.replace(/^# (.*?)$/gm, '<h1>$1</h1>');
|
html = html.replace(/^# (.*?)$/gm, '<h1>$1</h1>');
|
||||||
@@ -58,20 +50,16 @@ function markdownToHtml(text) {
|
|||||||
html = html.replace(/__(.*?)__/g, '<b>$1</b>');
|
html = html.replace(/__(.*?)__/g, '<b>$1</b>');
|
||||||
html = html.replace(/_(.*?)_/g, '<i>$1</i>');
|
html = html.replace(/_(.*?)_/g, '<i>$1</i>');
|
||||||
|
|
||||||
// Links
|
|
||||||
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
||||||
|
|
||||||
// Lists
|
|
||||||
html = html.replace(/^\* (.*?)$/gm, '<li>$1</li>');
|
html = html.replace(/^\* (.*?)$/gm, '<li>$1</li>');
|
||||||
html = html.replace(/^- (.*?)$/gm, '<li>$1</li>');
|
html = html.replace(/^- (.*?)$/gm, '<li>$1</li>');
|
||||||
html = html.replace(/^\d+\. (.*?)$/gm, '<li>$1</li>');
|
html = html.replace(/^\d+\. (.*?)$/gm, '<li>$1</li>');
|
||||||
|
|
||||||
// Wrap consecutive list items in ul/ol tags
|
|
||||||
html = html.replace(/(<li>[\s\S]*?<\/li>\s*)+/g, function(match) {
|
html = html.replace(/(<li>[\s\S]*?<\/li>\s*)+/g, function(match) {
|
||||||
return '<ul>' + match + '</ul>';
|
return '<ul>' + match + '</ul>';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Restore extracted URLs as anchor tags (preserves raw & in href)
|
|
||||||
html = html.replace(/\x00URL(\d+)\x00/g, (_, index) => {
|
html = html.replace(/\x00URL(\d+)\x00/g, (_, index) => {
|
||||||
const url = urls[parseInt(index)];
|
const url = urls[parseInt(index)];
|
||||||
const display = url.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
const display = url.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||||
@@ -87,30 +75,23 @@ function markdownToHtml(text) {
|
|||||||
return inlineCode[parseInt(index)];
|
return inlineCode[parseInt(index)];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Line breaks (after code blocks are restored)
|
|
||||||
html = html.replace(/\n\n/g, '</p><p>');
|
html = html.replace(/\n\n/g, '</p><p>');
|
||||||
html = html.replace(/\n/g, '<br/>');
|
html = html.replace(/\n/g, '<br/>');
|
||||||
|
|
||||||
// Wrap in paragraph tags if not already wrapped
|
|
||||||
if (!html.startsWith('<')) {
|
if (!html.startsWith('<')) {
|
||||||
html = '<p>' + html + '</p>';
|
html = '<p>' + html + '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up the final HTML
|
|
||||||
// Remove <br/> tags immediately before block elements
|
|
||||||
html = html.replace(/<br\/>\s*<pre>/g, '<pre>');
|
html = html.replace(/<br\/>\s*<pre>/g, '<pre>');
|
||||||
html = html.replace(/<br\/>\s*<ul>/g, '<ul>');
|
html = html.replace(/<br\/>\s*<ul>/g, '<ul>');
|
||||||
html = html.replace(/<br\/>\s*<h[1-6]>/g, '<h$1>');
|
html = html.replace(/<br\/>\s*<h[1-6]>/g, '<h$1>');
|
||||||
|
|
||||||
// Remove empty paragraphs
|
|
||||||
html = html.replace(/<p>\s*<\/p>/g, '');
|
html = html.replace(/<p>\s*<\/p>/g, '');
|
||||||
html = html.replace(/<p>\s*<br\/>\s*<\/p>/g, '');
|
html = html.replace(/<p>\s*<br\/>\s*<\/p>/g, '');
|
||||||
|
|
||||||
// Remove excessive line breaks
|
html = html.replace(/(<br\/>){3,}/g, '<br/><br/>');
|
||||||
html = html.replace(/(<br\/>){3,}/g, '<br/><br/>'); // Max 2 consecutive line breaks
|
html = html.replace(/(<\/p>)\s*(<p>)/g, '$1$2');
|
||||||
html = html.replace(/(<\/p>)\s*(<p>)/g, '$1$2'); // Remove whitespace between paragraphs
|
|
||||||
|
|
||||||
// Remove leading/trailing whitespace
|
|
||||||
html = html.trim();
|
html = html.trim();
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ import QtQuick
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
signal toastRequested(int severity, string title, string body, string command, string category)
|
||||||
|
signal toastCategoryDismissed(string category)
|
||||||
|
|
||||||
property var settingsRoot: null
|
property var settingsRoot: null
|
||||||
|
|
||||||
onSettingsRootChanged: {
|
onSettingsRootChanged: {
|
||||||
@@ -317,7 +319,7 @@ Singleton {
|
|||||||
function launchAuthApplyTerminalFallback(fromPrecheck, details) {
|
function launchAuthApplyTerminalFallback(fromPrecheck, details) {
|
||||||
authApplyTerminalFallbackFromPrecheck = fromPrecheck;
|
authApplyTerminalFallbackFromPrecheck = fromPrecheck;
|
||||||
if (details && details !== "")
|
if (details && details !== "")
|
||||||
ToastService.showInfo(I18n.tr("Authentication changes need sudo. Opening terminal so you can use password or fingerprint."), details, "", "auth-sync");
|
toastRequested(0, I18n.tr("Authentication changes need sudo. Opening terminal so you can use password or fingerprint."), details, "", "auth-sync");
|
||||||
authApplyTerminalFallbackStderr = "";
|
authApplyTerminalFallbackStderr = "";
|
||||||
authApplyTerminalFallbackProcess.running = true;
|
authApplyTerminalFallbackProcess.running = true;
|
||||||
}
|
}
|
||||||
@@ -364,21 +366,21 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deferGreeterAutoLoginSyncToPill(details) {
|
function deferGreeterAutoLoginSyncToPill(details) {
|
||||||
ToastService.dismissCategory("greeter-autologin-sync");
|
toastCategoryDismissed("greeter-autologin-sync");
|
||||||
if (settingsRoot)
|
if (settingsRoot)
|
||||||
settingsRoot.set("greeterSyncPending", true);
|
settingsRoot.set("greeterSyncPending", true);
|
||||||
ToastService.showWarning(I18n.tr("Auto-login change needs a sync"), I18n.tr("Administrator access is required. Use the Sync button in Settings → Greeter to apply.") + (details ? "\n\n" + details : ""), "dms-greeter sync --autologin", "greeter-autologin-sync");
|
toastRequested(1, I18n.tr("Auto-login change needs a sync"), I18n.tr("Administrator access is required. Use the Sync button in Settings → Greeter to apply.") + (details ? "\n\n" + details : ""), "dms-greeter sync --autologin", "greeter-autologin-sync");
|
||||||
finishGreeterAutoLoginSync();
|
finishGreeterAutoLoginSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
function greeterAutoLoginSyncSuccessToast(details) {
|
function greeterAutoLoginSyncSuccessToast(details) {
|
||||||
const enabling = settingsRoot && settingsRoot.greeterAutoLogin;
|
const enabling = settingsRoot && settingsRoot.greeterAutoLogin;
|
||||||
// Clear the sticky in-progress toast, then confirm with an auto-dismissing toast.
|
// Clear the sticky in-progress toast, then confirm with an auto-dismissing toast.
|
||||||
ToastService.dismissCategory("greeter-autologin-sync");
|
toastCategoryDismissed("greeter-autologin-sync");
|
||||||
if (enabling) {
|
if (enabling) {
|
||||||
ToastService.showWarning(I18n.tr("Auto-login enabled"), I18n.tr("You'll skip the greeter password after the next reboot. The lock screen and signing out still require your password.") + (details ? "\n\n" + details : ""));
|
toastRequested(1, I18n.tr("Auto-login enabled"), I18n.tr("You'll skip the greeter password after the next reboot. The lock screen and signing out still require your password.") + (details ? "\n\n" + details : ""), "", "");
|
||||||
} else {
|
} else {
|
||||||
ToastService.showInfo(I18n.tr("Auto-login disabled"), I18n.tr("You'll enter your password at the greeter after the next reboot.") + (details ? "\n\n" + details : ""));
|
toastRequested(0, I18n.tr("Auto-login disabled"), I18n.tr("You'll enter your password at the greeter after the next reboot.") + (details ? "\n\n" + details : ""), "", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,7 +577,7 @@ Singleton {
|
|||||||
onExited: exitCode => {
|
onExited: exitCode => {
|
||||||
const enabling = root.settingsRoot && root.settingsRoot.greeterAutoLogin;
|
const enabling = root.settingsRoot && root.settingsRoot.greeterAutoLogin;
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
ToastService.showWarning(enabling ? I18n.tr("Applying auto-login on startup...") : I18n.tr("Disabling auto-login on startup..."), "", "dms-greeter sync --autologin", "greeter-autologin-sync");
|
root.toastRequested(1, enabling ? I18n.tr("Applying auto-login on startup...") : I18n.tr("Disabling auto-login on startup..."), "", "dms-greeter sync --autologin", "greeter-autologin-sync");
|
||||||
root.greeterAutoLoginSyncProcess.running = true;
|
root.greeterAutoLoginSyncProcess.running = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -604,7 +606,7 @@ Singleton {
|
|||||||
let details = out;
|
let details = out;
|
||||||
if (err !== "")
|
if (err !== "")
|
||||||
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
||||||
ToastService.showInfo(I18n.tr("Authentication changes applied"), details, "", "auth-sync");
|
root.toastRequested(0, I18n.tr("Authentication changes applied"), details, "", "auth-sync");
|
||||||
root.detectAuthCapabilities();
|
root.detectAuthCapabilities();
|
||||||
root.finishAuthApply();
|
root.finishAuthApply();
|
||||||
return;
|
return;
|
||||||
@@ -615,7 +617,7 @@ Singleton {
|
|||||||
details = out;
|
details = out;
|
||||||
if (err !== "")
|
if (err !== "")
|
||||||
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
details = details !== "" ? details + "\n\nstderr:\n" + err : "stderr:\n" + err;
|
||||||
ToastService.showWarning(I18n.tr("Background authentication sync failed. Trying terminal mode."), details, "", "auth-sync");
|
root.toastRequested(1, I18n.tr("Background authentication sync failed. Trying terminal mode."), details, "", "auth-sync");
|
||||||
root.launchAuthApplyTerminalFallback(false, "");
|
root.launchAuthApplyTerminalFallback(false, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,7 +633,7 @@ Singleton {
|
|||||||
onExited: exitCode => {
|
onExited: exitCode => {
|
||||||
const err = (root.authApplySudoProbeStderr || "").trim();
|
const err = (root.authApplySudoProbeStderr || "").trim();
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
ToastService.showInfo(I18n.tr("Applying authentication changes..."), "", "", "auth-sync");
|
root.toastRequested(0, I18n.tr("Applying authentication changes..."), "", "", "auth-sync");
|
||||||
root.authApplyProcess.running = true;
|
root.authApplyProcess.running = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -651,10 +653,10 @@ Singleton {
|
|||||||
onExited: exitCode => {
|
onExited: exitCode => {
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
const message = root.authApplyTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete authentication there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete authentication there; it will close automatically when done.");
|
const message = root.authApplyTerminalFallbackFromPrecheck ? I18n.tr("Terminal opened. Complete authentication there; it will close automatically when done.") : I18n.tr("Terminal fallback opened. Complete authentication there; it will close automatically when done.");
|
||||||
ToastService.showInfo(message, "", "", "auth-sync");
|
root.toastRequested(0, message, "", "", "auth-sync");
|
||||||
} else {
|
} else {
|
||||||
let details = (root.authApplyTerminalFallbackStderr || "").trim();
|
let details = (root.authApplyTerminalFallbackStderr || "").trim();
|
||||||
ToastService.showError(I18n.tr("Terminal fallback failed. Install a supported terminal emulator or run 'dms auth sync' manually.") + " (exit " + exitCode + ")", details, "", "auth-sync");
|
root.toastRequested(2, I18n.tr("Terminal fallback failed. Install a supported terminal emulator or run 'dms auth sync' manually.") + " (exit " + exitCode + ")", details, "", "auth-sync");
|
||||||
}
|
}
|
||||||
root.finishAuthApply();
|
root.finishAuthApply();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,26 +75,3 @@ function migrateToVersion(obj, targetVersion, settingsData) {
|
|||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup(fileText) {
|
|
||||||
var getValidKeys = SpecModule.getValidKeys;
|
|
||||||
if (!fileText || !fileText.trim()) return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var session = JSON.parse(fileText);
|
|
||||||
var validKeys = getValidKeys();
|
|
||||||
var needsSave = false;
|
|
||||||
|
|
||||||
for (var key in session) {
|
|
||||||
if (validKeys.indexOf(key) < 0) {
|
|
||||||
delete session[key];
|
|
||||||
needsSave = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return needsSave ? JSON.stringify(session, null, 2) : null;
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("SessionData: Failed to cleanup unused keys:", e.message);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -373,11 +373,6 @@ var SPEC = {
|
|||||||
fadeToDpmsEnabled: { def: true },
|
fadeToDpmsEnabled: { def: true },
|
||||||
fadeToDpmsGracePeriod: { def: 5 },
|
fadeToDpmsGracePeriod: { def: 5 },
|
||||||
launchPrefix: { def: "" },
|
launchPrefix: { def: "" },
|
||||||
brightnessDevicePins: { def: {} },
|
|
||||||
wifiNetworkPins: { def: {} },
|
|
||||||
bluetoothDevicePins: { def: {} },
|
|
||||||
audioInputDevicePins: { def: {} },
|
|
||||||
audioOutputDevicePins: { def: {} },
|
|
||||||
|
|
||||||
gtkThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
gtkThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
||||||
qtThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
qtThemingEnabled: { def: false, onChange: "regenSystemThemes" },
|
||||||
|
|||||||
@@ -2,6 +2,21 @@
|
|||||||
|
|
||||||
.import "./SettingsSpec.js" as SpecModule
|
.import "./SettingsSpec.js" as SpecModule
|
||||||
|
|
||||||
|
var PIN_KEYS = ["brightnessDevicePins", "wifiNetworkPins", "bluetoothDevicePins", "audioInputDevicePins", "audioOutputDevicePins"];
|
||||||
|
|
||||||
|
function extractPins(obj) {
|
||||||
|
if (!obj) return null;
|
||||||
|
|
||||||
|
var pins = null;
|
||||||
|
for (var i = 0; i < PIN_KEYS.length; i++) {
|
||||||
|
var value = obj[PIN_KEYS[i]];
|
||||||
|
if (!value || Object.keys(value).length === 0) continue;
|
||||||
|
if (!pins) pins = {};
|
||||||
|
pins[PIN_KEYS[i]] = value;
|
||||||
|
}
|
||||||
|
return pins;
|
||||||
|
}
|
||||||
|
|
||||||
function parse(root, jsonObj) {
|
function parse(root, jsonObj) {
|
||||||
var SPEC = SpecModule.SPEC;
|
var SPEC = SpecModule.SPEC;
|
||||||
|
|
||||||
@@ -263,28 +278,16 @@ function migrateToVersion(obj, targetVersion) {
|
|||||||
settings.configVersion = 12;
|
settings.configVersion = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
return settings;
|
if (currentVersion < 13) {
|
||||||
}
|
console.info("Migrating settings from version", currentVersion, "to version 13");
|
||||||
|
console.info("Moving device and network pins to cache.json");
|
||||||
|
|
||||||
function cleanup(fileText) {
|
for (var p = 0; p < PIN_KEYS.length; p++) {
|
||||||
var getValidKeys = SpecModule.getValidKeys;
|
delete settings[PIN_KEYS[p]];
|
||||||
if (!fileText || !fileText.trim()) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
var settings = JSON.parse(fileText);
|
|
||||||
var validKeys = getValidKeys();
|
|
||||||
var needsSave = false;
|
|
||||||
|
|
||||||
for (var key in settings) {
|
|
||||||
if (validKeys.indexOf(key) < 0) {
|
|
||||||
delete settings[key];
|
|
||||||
needsSave = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return needsSave ? JSON.stringify(settings, null, 2) : null;
|
settings.configVersion = 13;
|
||||||
} catch (e) {
|
|
||||||
console.warn("SettingsData: Failed to cleanup unused keys:", e.message);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,11 +122,6 @@ const times = [
|
|||||||
|
|
||||||
// adds a custom time to the times config
|
// adds a custom time to the times config
|
||||||
|
|
||||||
function addTime(angle, riseName, setName) {
|
|
||||||
times.push([angle, riseName, setName]);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// calculations for sun times
|
// calculations for sun times
|
||||||
|
|
||||||
const J0 = 0.0009;
|
const J0 = 0.0009;
|
||||||
@@ -246,63 +241,3 @@ function getMoonIllumination(date) {
|
|||||||
angle
|
angle
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function hoursLater(date, h) {
|
|
||||||
return new Date(date.valueOf() + h * dayMs / 24);
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article
|
|
||||||
|
|
||||||
function getMoonTimes(date, lat, lng, inUTC) {
|
|
||||||
const t = new Date(date);
|
|
||||||
if (inUTC) t.setUTCHours(0, 0, 0, 0);
|
|
||||||
else t.setHours(0, 0, 0, 0);
|
|
||||||
|
|
||||||
const hc = 0.133 * rad;
|
|
||||||
let h0 = getMoonPosition(t, lat, lng).altitude - hc,
|
|
||||||
rise, set, ye;
|
|
||||||
|
|
||||||
// go in 2-hour chunks, each time seeing if a 3-point quadratic curve crosses zero (which means rise or set)
|
|
||||||
for (let i = 1; i <= 24; i += 2) {
|
|
||||||
const h1 = getMoonPosition(hoursLater(t, i), lat, lng).altitude - hc;
|
|
||||||
const h2 = getMoonPosition(hoursLater(t, i + 1), lat, lng).altitude - hc;
|
|
||||||
const a = (h0 + h2) / 2 - h1;
|
|
||||||
const b = (h2 - h0) / 2;
|
|
||||||
const xe = -b / (2 * a);
|
|
||||||
const d = b * b - 4 * a * h1;
|
|
||||||
let roots = 0, x1 = 0, x2 = 0;
|
|
||||||
ye = (a * xe + b) * xe + h1;
|
|
||||||
|
|
||||||
if (d >= 0) {
|
|
||||||
const dx = Math.sqrt(d) / (Math.abs(a) * 2);
|
|
||||||
x1 = xe - dx;
|
|
||||||
x2 = xe + dx;
|
|
||||||
if (Math.abs(x1) <= 1) roots++;
|
|
||||||
if (Math.abs(x2) <= 1) roots++;
|
|
||||||
if (x1 < -1) x1 = x2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roots === 1) {
|
|
||||||
if (h0 < 0) rise = i + x1;
|
|
||||||
else set = i + x1;
|
|
||||||
|
|
||||||
} else if (roots === 2) {
|
|
||||||
rise = i + (ye < 0 ? x2 : x1);
|
|
||||||
set = i + (ye < 0 ? x1 : x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rise && set) break;
|
|
||||||
|
|
||||||
h0 = h2;
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = {};
|
|
||||||
|
|
||||||
if (rise) result.rise = hoursLater(t, rise);
|
|
||||||
if (set) result.set = hoursLater(t, set);
|
|
||||||
|
|
||||||
if (!rise && !set) result[ye > 0 ? 'alwaysUp' : 'alwaysDown'] = true;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ Item {
|
|||||||
id: root
|
id: root
|
||||||
readonly property var log: Log.scoped("DMSShell")
|
readonly property var log: Log.scoped("DMSShell")
|
||||||
readonly property var _sessionsServiceRef: SessionsService
|
readonly property var _sessionsServiceRef: SessionsService
|
||||||
|
// Keep the optional integration service alive
|
||||||
|
readonly property var _dankConnectServiceRef: DankConnectService
|
||||||
|
|
||||||
property var core: null
|
property var core: null
|
||||||
|
|
||||||
@@ -233,6 +235,11 @@ Item {
|
|||||||
PolkitService.polkitAvailable;
|
PolkitService.polkitAvailable;
|
||||||
DisplayConfigState.hasOutputBackend;
|
DisplayConfigState.hasOutputBackend;
|
||||||
PortalService.systemColorScheme;
|
PortalService.systemColorScheme;
|
||||||
|
IconThemeService.revision;
|
||||||
|
DesktopService.isSystemd;
|
||||||
|
TrashService.count;
|
||||||
|
WallpaperCyclingService.cyclingActive;
|
||||||
|
ThemeAutoService.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
+58
-27
@@ -285,28 +285,66 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _resolvePosition(position) {
|
||||||
|
switch ((position || "").toLowerCase()) {
|
||||||
|
case "left":
|
||||||
|
return "left";
|
||||||
|
case "center":
|
||||||
|
return "center";
|
||||||
|
case "right":
|
||||||
|
return "right";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _dashBar(position) {
|
||||||
|
if (position)
|
||||||
|
return root.getPreferredBar();
|
||||||
|
return root.getPreferredBar("clockButtonRef") || root.getPreferredBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _openDash(tab, position) {
|
||||||
|
const bar = _dashBar(position);
|
||||||
|
if (!bar)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const tabId = _resolveTabId(tab);
|
||||||
|
const dash = root.dankDashPopoutLoader.item;
|
||||||
|
if (dash && dash.shouldBeVisible && dash.triggerScreen?.name === bar.screen?.name) {
|
||||||
|
if (position && bar.positionDash)
|
||||||
|
bar.positionDash(dash, position);
|
||||||
|
dash.requestTab(tabId);
|
||||||
|
if (dash.updateSurfacePosition)
|
||||||
|
dash.updateSurfacePosition();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bar.triggerDashTab(tabId, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _toggleDash(tab, position) {
|
||||||
|
if (root.dankDashPopoutLoader.item?.dashVisible) {
|
||||||
|
root.dankDashPopoutLoader.item.dashVisible = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bar = _dashBar(position);
|
||||||
|
if (!bar)
|
||||||
|
return false;
|
||||||
|
return bar.triggerDashTab(_resolveTabId(tab), position);
|
||||||
|
}
|
||||||
|
|
||||||
function resolveTabIndex(tab: string): int {
|
function resolveTabIndex(tab: string): int {
|
||||||
return SettingsData.dashTabIndexForId(_resolveTabId(tab));
|
return SettingsData.dashTabIndexForId(_resolveTabId(tab));
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(tab: string): string {
|
function open(tab: string): string {
|
||||||
const bar = root.getPreferredBar("clockButtonRef") || root.getPreferredBar();
|
return _openDash(tab, "") ? "DASH_OPEN_SUCCESS" : "DASH_OPEN_FAILED";
|
||||||
if (!bar)
|
}
|
||||||
return "DASH_OPEN_FAILED";
|
|
||||||
|
|
||||||
const tabId = _resolveTabId(tab);
|
function openAt(tab: string, position: string): string {
|
||||||
const dash = root.dankDashPopoutLoader.item;
|
return _openDash(tab, _resolvePosition(position)) ? "DASH_OPEN_SUCCESS" : "DASH_OPEN_FAILED";
|
||||||
if (dash && dash.shouldBeVisible && dash.triggerScreen?.name === bar.screen?.name) {
|
|
||||||
dash.requestTab(tabId);
|
|
||||||
if (dash.updateSurfacePosition)
|
|
||||||
dash.updateSurfacePosition();
|
|
||||||
return "DASH_OPEN_SUCCESS";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bar.triggerDashTab(tabId))
|
|
||||||
return "DASH_OPEN_FAILED";
|
|
||||||
|
|
||||||
return "DASH_OPEN_SUCCESS";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(): string {
|
function close(): string {
|
||||||
@@ -318,18 +356,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggle(tab: string): string {
|
function toggle(tab: string): string {
|
||||||
if (root.dankDashPopoutLoader.item?.dashVisible) {
|
return _toggleDash(tab, "") ? "DASH_TOGGLE_SUCCESS" : "DASH_TOGGLE_FAILED";
|
||||||
root.dankDashPopoutLoader.item.dashVisible = false;
|
}
|
||||||
return "DASH_TOGGLE_SUCCESS";
|
|
||||||
}
|
|
||||||
|
|
||||||
const bar = root.getPreferredBar("clockButtonRef") || root.getPreferredBar();
|
function toggleAt(tab: string, position: string): string {
|
||||||
if (bar) {
|
return _toggleDash(tab, _resolvePosition(position)) ? "DASH_TOGGLE_SUCCESS" : "DASH_TOGGLE_FAILED";
|
||||||
if (!bar.triggerDashTab(_resolveTabId(tab)))
|
|
||||||
return "DASH_TOGGLE_FAILED";
|
|
||||||
return "DASH_TOGGLE_SUCCESS";
|
|
||||||
}
|
|
||||||
return "DASH_TOGGLE_FAILED";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target: "dash"
|
target: "dash"
|
||||||
|
|||||||
@@ -314,26 +314,20 @@ Item {
|
|||||||
readonly property real alignedWidth: Theme.px(modalWidth, dpr)
|
readonly property real alignedWidth: Theme.px(modalWidth, dpr)
|
||||||
readonly property real alignedHeight: Theme.px(modalHeight, dpr)
|
readonly property real alignedHeight: Theme.px(modalHeight, dpr)
|
||||||
|
|
||||||
function _frameEdgeInset(side) {
|
|
||||||
if (!effectiveScreen)
|
|
||||||
return 0;
|
|
||||||
return SettingsData.frameEdgeInsetForSide(effectiveScreen, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property real _connectedAlignedX: {
|
readonly property real _connectedAlignedX: {
|
||||||
switch (resolvedConnectedBarSide) {
|
switch (resolvedConnectedBarSide) {
|
||||||
case "top":
|
case "top":
|
||||||
case "bottom":
|
case "bottom":
|
||||||
{
|
{
|
||||||
const insetL = _frameEdgeInset("left");
|
const insetL = SettingsData.frameEdgeInsetForSide(effectiveScreen, "left");
|
||||||
const insetR = _frameEdgeInset("right");
|
const insetR = SettingsData.frameEdgeInsetForSide(effectiveScreen, "right");
|
||||||
const usable = Math.max(0, screenWidth - insetL - insetR);
|
const usable = Math.max(0, screenWidth - insetL - insetR);
|
||||||
return insetL + Math.max(0, (usable - alignedWidth) / 2);
|
return insetL + Math.max(0, (usable - alignedWidth) / 2);
|
||||||
}
|
}
|
||||||
case "left":
|
case "left":
|
||||||
return _frameEdgeInset("left");
|
return SettingsData.frameEdgeInsetForSide(effectiveScreen, "left");
|
||||||
case "right":
|
case "right":
|
||||||
return screenWidth - alignedWidth - _frameEdgeInset("right");
|
return screenWidth - alignedWidth - SettingsData.frameEdgeInsetForSide(effectiveScreen, "right");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -341,14 +335,14 @@ Item {
|
|||||||
readonly property real _connectedAlignedY: {
|
readonly property real _connectedAlignedY: {
|
||||||
switch (resolvedConnectedBarSide) {
|
switch (resolvedConnectedBarSide) {
|
||||||
case "top":
|
case "top":
|
||||||
return _frameEdgeInset("top");
|
return SettingsData.frameEdgeInsetForSide(effectiveScreen, "top");
|
||||||
case "bottom":
|
case "bottom":
|
||||||
return screenHeight - alignedHeight - _frameEdgeInset("bottom");
|
return screenHeight - alignedHeight - SettingsData.frameEdgeInsetForSide(effectiveScreen, "bottom");
|
||||||
case "left":
|
case "left":
|
||||||
case "right":
|
case "right":
|
||||||
{
|
{
|
||||||
const insetT = _frameEdgeInset("top");
|
const insetT = SettingsData.frameEdgeInsetForSide(effectiveScreen, "top");
|
||||||
const insetB = _frameEdgeInset("bottom");
|
const insetB = SettingsData.frameEdgeInsetForSide(effectiveScreen, "bottom");
|
||||||
const usable = Math.max(0, screenHeight - insetT - insetB);
|
const usable = Math.max(0, screenHeight - insetT - insetB);
|
||||||
return insetT + Math.max(0, (usable - alignedHeight) / 2);
|
return insetT + Math.max(0, (usable - alignedHeight) / 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,12 +105,6 @@ Item {
|
|||||||
}
|
}
|
||||||
readonly property bool _dockBlocksEmergence: frameOwnsConnectedChrome && _dockOccupiesSide(resolvedConnectedBarSide)
|
readonly property bool _dockBlocksEmergence: frameOwnsConnectedChrome && _dockOccupiesSide(resolvedConnectedBarSide)
|
||||||
|
|
||||||
function _frameEdgeInset(side) {
|
|
||||||
if (!effectiveScreen)
|
|
||||||
return 0;
|
|
||||||
return SettingsData.frameEdgeInsetForSide(effectiveScreen, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property var _connectedModalPos: {
|
readonly property var _connectedModalPos: {
|
||||||
const fallback = {
|
const fallback = {
|
||||||
"x": (screenWidth - modalWidth) / 2,
|
"x": (screenWidth - modalWidth) / 2,
|
||||||
@@ -120,10 +114,10 @@ Item {
|
|||||||
case "top":
|
case "top":
|
||||||
case "bottom":
|
case "bottom":
|
||||||
{
|
{
|
||||||
const insetL = _frameEdgeInset("left");
|
const insetL = SettingsData.frameEdgeInsetForSide(effectiveScreen, "left");
|
||||||
const insetR = _frameEdgeInset("right");
|
const insetR = SettingsData.frameEdgeInsetForSide(effectiveScreen, "right");
|
||||||
const insetT = _frameEdgeInset("top");
|
const insetT = SettingsData.frameEdgeInsetForSide(effectiveScreen, "top");
|
||||||
const insetB = _frameEdgeInset("bottom");
|
const insetB = SettingsData.frameEdgeInsetForSide(effectiveScreen, "bottom");
|
||||||
const usable = Math.max(0, screenWidth - insetL - insetR);
|
const usable = Math.max(0, screenWidth - insetL - insetR);
|
||||||
const usableH = Math.max(0, screenHeight - insetT - insetB);
|
const usableH = Math.max(0, screenHeight - insetT - insetB);
|
||||||
return {
|
return {
|
||||||
@@ -134,11 +128,11 @@ Item {
|
|||||||
case "left":
|
case "left":
|
||||||
case "right":
|
case "right":
|
||||||
{
|
{
|
||||||
const insetT = _frameEdgeInset("top");
|
const insetT = SettingsData.frameEdgeInsetForSide(effectiveScreen, "top");
|
||||||
const insetB = _frameEdgeInset("bottom");
|
const insetB = SettingsData.frameEdgeInsetForSide(effectiveScreen, "bottom");
|
||||||
const usable = Math.max(0, screenHeight - insetT - insetB);
|
const usable = Math.max(0, screenHeight - insetT - insetB);
|
||||||
return {
|
return {
|
||||||
"x": resolvedConnectedBarSide === "left" ? _frameEdgeInset("left") : screenWidth - modalWidth - _frameEdgeInset("right"),
|
"x": resolvedConnectedBarSide === "left" ? SettingsData.frameEdgeInsetForSide(effectiveScreen, "left") : screenWidth - modalWidth - SettingsData.frameEdgeInsetForSide(effectiveScreen, "right"),
|
||||||
"y": insetT + Math.max(0, (usable - modalHeight) / 2)
|
"y": insetT + Math.max(0, (usable - modalHeight) / 2)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -188,16 +182,16 @@ Item {
|
|||||||
readonly property real _connectedChromeY: {
|
readonly property real _connectedChromeY: {
|
||||||
if (!launcherArcExtenderActive)
|
if (!launcherArcExtenderActive)
|
||||||
return alignedY;
|
return alignedY;
|
||||||
return resolvedConnectedBarSide === "top" ? Theme.snap(_frameEdgeInset("top"), dpr) : alignedY;
|
return resolvedConnectedBarSide === "top" ? Theme.snap(SettingsData.frameEdgeInsetForSide(effectiveScreen, "top"), dpr) : alignedY;
|
||||||
}
|
}
|
||||||
readonly property real _connectedChromeWidth: alignedWidth
|
readonly property real _connectedChromeWidth: alignedWidth
|
||||||
readonly property real _connectedChromeHeight: {
|
readonly property real _connectedChromeHeight: {
|
||||||
if (!launcherArcExtenderActive)
|
if (!launcherArcExtenderActive)
|
||||||
return alignedHeight;
|
return alignedHeight;
|
||||||
if (resolvedConnectedBarSide === "top")
|
if (resolvedConnectedBarSide === "top")
|
||||||
return Theme.snap(Math.max(alignedHeight, alignedY + alignedHeight - _frameEdgeInset("top")), dpr);
|
return Theme.snap(Math.max(alignedHeight, alignedY + alignedHeight - SettingsData.frameEdgeInsetForSide(effectiveScreen, "top")), dpr);
|
||||||
if (resolvedConnectedBarSide === "bottom")
|
if (resolvedConnectedBarSide === "bottom")
|
||||||
return Theme.snap(Math.max(alignedHeight, screenHeight - _frameEdgeInset("bottom") - alignedY), dpr);
|
return Theme.snap(Math.max(alignedHeight, screenHeight - SettingsData.frameEdgeInsetForSide(effectiveScreen, "bottom") - alignedY), dpr);
|
||||||
return alignedHeight;
|
return alignedHeight;
|
||||||
}
|
}
|
||||||
readonly property real contentSurfaceHeight: launcherArcExtenderActive ? _connectedChromeHeight : alignedHeight
|
readonly property real contentSurfaceHeight: launcherArcExtenderActive ? _connectedChromeHeight : alignedHeight
|
||||||
|
|||||||
@@ -89,15 +89,6 @@ function fuzzyScore(text, query) {
|
|||||||
return bestScore
|
return bestScore
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeBucketWeight(daysSinceUsed) {
|
|
||||||
for (var i = 0; i < TimeBuckets.length; i++) {
|
|
||||||
if (daysSinceUsed <= TimeBuckets[i].maxDays) {
|
|
||||||
return TimeBuckets[i].weight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 10
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculateTextScore(name, query) {
|
function calculateTextScore(name, query) {
|
||||||
if (name === query) return Weights.exactMatch
|
if (name === query) return Weights.exactMatch
|
||||||
if (name.startsWith(query)) return Weights.prefixMatch
|
if (name.startsWith(query)) return Weights.prefixMatch
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ DankModal {
|
|||||||
NotificationService.dismissAllPopups();
|
NotificationService.dismissAllPopups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dismissLastNotification() {
|
||||||
|
NotificationService.dismissLastNotification();
|
||||||
|
}
|
||||||
|
|
||||||
modalWidth: Math.min(500, screenWidth - 48)
|
modalWidth: Math.min(500, screenWidth - 48)
|
||||||
modalHeight: Math.min(700, screenHeight * 0.85)
|
modalHeight: Math.min(700, screenHeight * 0.85)
|
||||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
backgroundColor: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
@@ -190,6 +194,11 @@ DankModal {
|
|||||||
return "NOTIFICATION_MODAL_DISMISS_ALL_POPUPS_SUCCESS";
|
return "NOTIFICATION_MODAL_DISMISS_ALL_POPUPS_SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dismiss(): string {
|
||||||
|
notificationModal.dismissLastNotification();
|
||||||
|
return "NOTIFICATION_DISMISS_SUCCESS";
|
||||||
|
}
|
||||||
|
|
||||||
target: "notifications"
|
target: "notifications"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,19 @@ DankModal {
|
|||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPowerProfileDescription(profile) {
|
||||||
|
switch (profile) {
|
||||||
|
case 0:
|
||||||
|
return I18n.tr("Extend battery life", "power profile description");
|
||||||
|
case 1:
|
||||||
|
return I18n.tr("Balance power and performance", "power profile description");
|
||||||
|
case 2:
|
||||||
|
return I18n.tr("Prioritize performance", "power profile description");
|
||||||
|
default:
|
||||||
|
return I18n.tr("Custom power profile", "power profile description");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function hideDialog() {
|
function hideDialog() {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@@ -244,7 +257,7 @@ DankModal {
|
|||||||
|
|
||||||
// Selected power profile description
|
// Selected power profile description
|
||||||
StyledText {
|
StyledText {
|
||||||
text: (root.selectedIndex >= 0 && root.selectedIndex < root.profileModel.length) ? Theme.getPowerProfileDescription(root.profileModel[root.selectedIndex]) : ""
|
text: (root.selectedIndex >= 0 && root.selectedIndex < root.profileModel.length) ? root.getPowerProfileDescription(root.profileModel[root.selectedIndex]) : ""
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: Theme.surfaceTextMedium
|
color: Theme.surfaceTextMedium
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import qs.Common
|
|||||||
import qs.Modules.ProcessList
|
import qs.Modules.ProcessList
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../Common/Format.js" as Format
|
||||||
|
|
||||||
FloatingWindow {
|
FloatingWindow {
|
||||||
id: processListModal
|
id: processListModal
|
||||||
@@ -67,16 +68,6 @@ FloatingWindow {
|
|||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBytes(bytes) {
|
|
||||||
if (bytes < 1024)
|
|
||||||
return bytes.toFixed(0) + " B/s";
|
|
||||||
if (bytes < 1024 * 1024)
|
|
||||||
return (bytes / 1024).toFixed(1) + " KB/s";
|
|
||||||
if (bytes < 1024 * 1024 * 1024)
|
|
||||||
return (bytes / (1024 * 1024)).toFixed(1) + " MB/s";
|
|
||||||
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
|
|
||||||
}
|
|
||||||
|
|
||||||
function nextTab() {
|
function nextTab() {
|
||||||
currentTab = (currentTab + 1) % 4;
|
currentTab = (currentTab + 1) % 4;
|
||||||
}
|
}
|
||||||
@@ -541,7 +532,7 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "↓" + formatBytes(DgopService.networkRxRate) + " ↑" + formatBytes(DgopService.networkTxRate)
|
text: "↓" + Format.formatRate(DgopService.networkRxRate) + " ↑" + Format.formatRate(DgopService.networkTxRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
@@ -559,7 +550,7 @@ FloatingWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "↓" + formatBytes(DgopService.diskReadRate) + " ↑" + formatBytes(DgopService.diskWriteRate)
|
text: "↓" + Format.formatRate(DgopService.diskReadRate) + " ↑" + Format.formatRate(DgopService.diskWriteRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
|
|||||||
@@ -25,29 +25,6 @@ Item {
|
|||||||
property bool effectActive: false
|
property bool effectActive: false
|
||||||
property bool useNextForEffect: false
|
property bool useNextForEffect: false
|
||||||
|
|
||||||
function getFillMode(modeName) {
|
|
||||||
switch (modeName) {
|
|
||||||
case "Stretch":
|
|
||||||
return Image.Stretch;
|
|
||||||
case "Fit":
|
|
||||||
case "PreserveAspectFit":
|
|
||||||
return Image.PreserveAspectFit;
|
|
||||||
case "Fill":
|
|
||||||
case "PreserveAspectCrop":
|
|
||||||
return Image.PreserveAspectCrop;
|
|
||||||
case "Tile":
|
|
||||||
return Image.Tile;
|
|
||||||
case "TileVertically":
|
|
||||||
return Image.TileVertically;
|
|
||||||
case "TileHorizontally":
|
|
||||||
return Image.TileHorizontally;
|
|
||||||
case "Pad":
|
|
||||||
return Image.Pad;
|
|
||||||
default:
|
|
||||||
return Image.PreserveAspectCrop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (initialSource && initialSource !== wallpaperSource && !(CompositorService.isNiri && SessionData.isSwitchingMode)) {
|
if (initialSource && initialSource !== wallpaperSource && !(CompositorService.isNiri && SessionData.isSwitchingMode)) {
|
||||||
currentWallpaper.source = initialSource;
|
currentWallpaper.source = initialSource;
|
||||||
@@ -144,7 +121,7 @@ Item {
|
|||||||
smooth: true
|
smooth: true
|
||||||
cache: true
|
cache: true
|
||||||
sourceSize: root.blurTextureSize
|
sourceSize: root.blurTextureSize
|
||||||
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(root.screenName))
|
fillMode: Theme.getFillMode(SessionData.getMonitorWallpaperFillMode(root.screenName))
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Error) {
|
if (status === Image.Error) {
|
||||||
@@ -166,7 +143,7 @@ Item {
|
|||||||
smooth: true
|
smooth: true
|
||||||
cache: true
|
cache: true
|
||||||
sourceSize: root.blurTextureSize
|
sourceSize: root.blurTextureSize
|
||||||
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(root.screenName))
|
fillMode: Theme.getFillMode(SessionData.getMonitorWallpaperFillMode(root.screenName))
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Image.Error) {
|
if (status === Image.Error) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Quickshell
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/Format.js" as Format
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -188,16 +189,6 @@ Item {
|
|||||||
return DgopService.availableGpus.find(g => g.pciId === selectedGpuPciId);
|
return DgopService.availableGpus.find(g => g.pciId === selectedGpuPciId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatBytes(bytes) {
|
|
||||||
if (bytes < 1024)
|
|
||||||
return bytes.toFixed(0) + "B";
|
|
||||||
if (bytes < 1024 * 1024)
|
|
||||||
return (bytes / 1024).toFixed(0) + "K";
|
|
||||||
if (bytes < 1024 * 1024 * 1024)
|
|
||||||
return (bytes / (1024 * 1024)).toFixed(1) + "M";
|
|
||||||
return (bytes / (1024 * 1024 * 1024)).toFixed(1) + "G";
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatMemKB(kb) {
|
function formatMemKB(kb) {
|
||||||
if (kb < 1024)
|
if (kb < 1024)
|
||||||
return kb.toFixed(0) + "K";
|
return kb.toFixed(0) + "K";
|
||||||
@@ -206,26 +197,18 @@ Item {
|
|||||||
return (kb / (1024 * 1024)).toFixed(1) + "G";
|
return (kb / (1024 * 1024)).toFixed(1) + "G";
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToHistory(arr, val) {
|
|
||||||
var newArr = arr.slice();
|
|
||||||
newArr.push(val);
|
|
||||||
if (newArr.length > historySize)
|
|
||||||
newArr.shift();
|
|
||||||
return newArr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sampleData() {
|
function sampleData() {
|
||||||
if (showCpuGraph)
|
if (showCpuGraph)
|
||||||
cpuHistory = addToHistory(cpuHistory, DgopService.cpuUsage);
|
cpuHistory = Format.addToHistory(cpuHistory, DgopService.cpuUsage, historySize);
|
||||||
if (showMemoryGraph)
|
if (showMemoryGraph)
|
||||||
memHistory = addToHistory(memHistory, DgopService.memoryUsage);
|
memHistory = Format.addToHistory(memHistory, DgopService.memoryUsage, historySize);
|
||||||
if (showNetworkGraph) {
|
if (showNetworkGraph) {
|
||||||
netRxHistory = addToHistory(netRxHistory, DgopService.networkRxRate);
|
netRxHistory = Format.addToHistory(netRxHistory, DgopService.networkRxRate, historySize);
|
||||||
netTxHistory = addToHistory(netTxHistory, DgopService.networkTxRate);
|
netTxHistory = Format.addToHistory(netTxHistory, DgopService.networkTxRate, historySize);
|
||||||
}
|
}
|
||||||
if (showDisk) {
|
if (showDisk) {
|
||||||
diskReadHistory = addToHistory(diskReadHistory, DgopService.diskReadRate);
|
diskReadHistory = Format.addToHistory(diskReadHistory, DgopService.diskReadRate, historySize);
|
||||||
diskWriteHistory = addToHistory(diskWriteHistory, DgopService.diskWriteRate);
|
diskWriteHistory = Format.addToHistory(diskWriteHistory, DgopService.diskWriteRate, historySize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +502,7 @@ Item {
|
|||||||
color: root.accentColor
|
color: root.accentColor
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatBytes(DgopService.networkRxRate) + "/s"
|
text: Format.formatBytes(DgopService.networkRxRate) + "/s"
|
||||||
isMonospace: true
|
isMonospace: true
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
@@ -533,7 +516,7 @@ Item {
|
|||||||
color: root.dimColor
|
color: root.dimColor
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatBytes(DgopService.networkTxRate) + "/s"
|
text: Format.formatBytes(DgopService.networkTxRate) + "/s"
|
||||||
isMonospace: true
|
isMonospace: true
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
@@ -552,7 +535,7 @@ Item {
|
|||||||
color: root.accentColor
|
color: root.accentColor
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatBytes(DgopService.diskReadRate) + "/s"
|
text: Format.formatBytes(DgopService.diskReadRate) + "/s"
|
||||||
isMonospace: true
|
isMonospace: true
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
@@ -566,7 +549,7 @@ Item {
|
|||||||
color: root.dimColor
|
color: root.dimColor
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatBytes(DgopService.diskWriteRate) + "/s"
|
text: Format.formatBytes(DgopService.diskWriteRate) + "/s"
|
||||||
isMonospace: true
|
isMonospace: true
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Modules.ControlCenter.Details
|
||||||
import qs.Modules.Plugins
|
import qs.Modules.Plugins
|
||||||
|
|
||||||
PluginComponent {
|
PluginComponent {
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Common
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
LayoutMirroring.enabled: I18n.isRtl
|
|
||||||
LayoutMirroring.childrenInherit: true
|
|
||||||
|
|
||||||
property string iconName: ""
|
|
||||||
property string text: ""
|
|
||||||
property string secondaryText: ""
|
|
||||||
property bool isActive: false
|
|
||||||
property int widgetIndex: 0
|
|
||||||
property var widgetData: null
|
|
||||||
property bool editMode: false
|
|
||||||
|
|
||||||
signal clicked
|
|
||||||
|
|
||||||
width: parent ? parent.width : 200
|
|
||||||
height: 60
|
|
||||||
radius: {
|
|
||||||
if (Theme.cornerRadius === 0)
|
|
||||||
return 0;
|
|
||||||
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
|
||||||
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
|
||||||
readonly property color _tileRingActive: Theme.ccTileRing
|
|
||||||
|
|
||||||
color: isActive ? _tileBgActive : _tileBgInactive
|
|
||||||
border.color: isActive ? _tileRingActive : Theme.outlineMedium
|
|
||||||
border.width: isActive ? 1 : Theme.layerOutlineWidth
|
|
||||||
opacity: enabled ? 1.0 : 0.6
|
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: mouseArea.containsMouse ? hoverTint(root.color) : Theme.withAlpha(hoverTint(root.color), 0)
|
|
||||||
opacity: mouseArea.containsMouse ? 0.08 : 0.0
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: Theme.spacingL + 2
|
|
||||||
anchors.rightMargin: Theme.spacingM
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: root.iconName
|
|
||||||
size: Theme.iconSize
|
|
||||||
color: isActive ? Theme.ccTileActiveText : Theme.ccTileInactiveIcon
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: parent.width - Theme.iconSize - parent.spacing
|
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: Theme.spacingXXS
|
|
||||||
|
|
||||||
Typography {
|
|
||||||
width: parent.width
|
|
||||||
text: root.text
|
|
||||||
style: Typography.Style.Body
|
|
||||||
color: isActive ? Theme.ccTileActiveText : Theme.surfaceText
|
|
||||||
elide: Text.ElideRight
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
Typography {
|
|
||||||
width: parent.width
|
|
||||||
text: root.secondaryText
|
|
||||||
style: Typography.Style.Caption
|
|
||||||
color: isActive ? Theme.ccTileActiveText : Theme.surfaceVariantText
|
|
||||||
visible: text.length > 0
|
|
||||||
elide: Text.ElideRight
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DankRipple {
|
|
||||||
id: ripple
|
|
||||||
cornerRadius: root.radius
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
enabled: root.enabled
|
|
||||||
onPressed: mouse => ripple.trigger(mouse.x, mouse.y)
|
|
||||||
onClicked: root.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on radius {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Common
|
|
||||||
import qs.Modules.ControlCenter.Details
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string expandedSection: ""
|
|
||||||
property var expandedWidgetData: null
|
|
||||||
|
|
||||||
height: active ? 250 : 0
|
|
||||||
visible: active
|
|
||||||
|
|
||||||
readonly property bool active: expandedSection !== ""
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: Theme.spacingS
|
|
||||||
sourceComponent: {
|
|
||||||
if (!root.active)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (expandedSection.startsWith("diskUsage_")) {
|
|
||||||
return diskUsageDetailComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (expandedSection) {
|
|
||||||
case "wifi":
|
|
||||||
return networkDetailComponent;
|
|
||||||
case "bluetooth":
|
|
||||||
return bluetoothDetailComponent;
|
|
||||||
case "audioOutput":
|
|
||||||
return audioOutputDetailComponent;
|
|
||||||
case "audioInput":
|
|
||||||
return audioInputDetailComponent;
|
|
||||||
case "battery":
|
|
||||||
return batteryDetailComponent;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: networkDetailComponent
|
|
||||||
NetworkDetail {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: bluetoothDetailComponent
|
|
||||||
BluetoothDetail {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: audioOutputDetailComponent
|
|
||||||
AudioOutputDetail {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: audioInputDetailComponent
|
|
||||||
AudioInputDetail {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: batteryDetailComponent
|
|
||||||
BatteryDetail {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: diskUsageDetailComponent
|
|
||||||
DiskUsageDetail {
|
|
||||||
currentMountPath: root.expandedWidgetData?.mountPath || "/"
|
|
||||||
instanceId: root.expandedWidgetData?.instanceId || ""
|
|
||||||
|
|
||||||
onMountPathChanged: newMountPath => {
|
|
||||||
if (root.expandedWidgetData && root.expandedWidgetData.id === "diskUsage") {
|
|
||||||
const widgets = SettingsData.controlCenterWidgets || [];
|
|
||||||
const newWidgets = widgets.map(w => {
|
|
||||||
if (w.id === "diskUsage" && w.instanceId === root.expandedWidgetData.instanceId) {
|
|
||||||
const updatedWidget = Object.assign({}, w);
|
|
||||||
updatedWidget.mountPath = newMountPath;
|
|
||||||
return updatedWidget;
|
|
||||||
}
|
|
||||||
return w;
|
|
||||||
});
|
|
||||||
SettingsData.set("controlCenterWidgets", newWidgets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Common
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
LayoutMirroring.enabled: I18n.isRtl
|
|
||||||
LayoutMirroring.childrenInherit: true
|
|
||||||
|
|
||||||
property string iconName: ""
|
|
||||||
property string text: ""
|
|
||||||
|
|
||||||
signal pressed
|
|
||||||
|
|
||||||
height: 34
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: mouseArea.containsMouse ? Theme.primaryHover : Theme.withAlpha(Theme.surfaceVariant, 0.5)
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: root.iconName
|
|
||||||
size: Theme.fontSizeSmall
|
|
||||||
color: mouseArea.containsMouse ? Theme.primary : Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Typography {
|
|
||||||
text: root.text
|
|
||||||
style: Typography.Style.Button
|
|
||||||
color: mouseArea.containsMouse ? Theme.primary : Theme.surfaceText
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DankRipple {
|
|
||||||
id: ripple
|
|
||||||
cornerRadius: root.radius
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onPressed: mouse => {
|
|
||||||
ripple.trigger(mouse.x, mouse.y);
|
|
||||||
root.pressed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ import Quickshell.Services.Pipewire
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -150,17 +151,9 @@ Rectangle {
|
|||||||
|
|
||||||
property int maxPinnedInputs: 3
|
property int maxPinnedInputs: 3
|
||||||
|
|
||||||
function normalizePinList(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value.filter(v => v);
|
|
||||||
if (typeof value === "string" && value.length > 0)
|
|
||||||
return [value];
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPinnedInputs() {
|
function getPinnedInputs() {
|
||||||
const pins = SettingsData.audioInputDevicePins || {};
|
const pins = CacheData.audioInputDevicePins || {};
|
||||||
return normalizePinList(pins["preferredInput"]);
|
return QmlUtils.normalizePinList(pins["preferredInput"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -315,8 +308,8 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.audioInputDevicePins || {}));
|
const pins = JSON.parse(JSON.stringify(CacheData.audioInputDevicePins || {}));
|
||||||
let pinnedList = audioContent.normalizePinList(pins["preferredInput"]);
|
let pinnedList = QmlUtils.normalizePinList(pins["preferredInput"]);
|
||||||
const pinIndex = pinnedList.indexOf(modelData.name);
|
const pinIndex = pinnedList.indexOf(modelData.name);
|
||||||
|
|
||||||
if (pinIndex !== -1) {
|
if (pinIndex !== -1) {
|
||||||
@@ -332,7 +325,7 @@ Rectangle {
|
|||||||
else
|
else
|
||||||
delete pins["preferredInput"];
|
delete pins["preferredInput"];
|
||||||
|
|
||||||
SettingsData.set("audioInputDevicePins", pins);
|
CacheData.set("audioInputDevicePins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Quickshell.Services.Pipewire
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -160,17 +161,9 @@ Rectangle {
|
|||||||
|
|
||||||
property int maxPinnedOutputs: 3
|
property int maxPinnedOutputs: 3
|
||||||
|
|
||||||
function normalizePinList(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value.filter(v => v);
|
|
||||||
if (typeof value === "string" && value.length > 0)
|
|
||||||
return [value];
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPinnedOutputs() {
|
function getPinnedOutputs() {
|
||||||
const pins = SettingsData.audioOutputDevicePins || {};
|
const pins = CacheData.audioOutputDevicePins || {};
|
||||||
return normalizePinList(pins["preferredOutput"]);
|
return QmlUtils.normalizePinList(pins["preferredOutput"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -324,8 +317,8 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.audioOutputDevicePins || {}));
|
const pins = JSON.parse(JSON.stringify(CacheData.audioOutputDevicePins || {}));
|
||||||
let pinnedList = audioContent.normalizePinList(pins["preferredOutput"]);
|
let pinnedList = QmlUtils.normalizePinList(pins["preferredOutput"]);
|
||||||
const pinIndex = pinnedList.indexOf(modelData.name);
|
const pinIndex = pinnedList.indexOf(modelData.name);
|
||||||
|
|
||||||
if (pinIndex !== -1) {
|
if (pinIndex !== -1) {
|
||||||
@@ -341,7 +334,7 @@ Rectangle {
|
|||||||
else
|
else
|
||||||
delete pins["preferredOutput"];
|
delete pins["preferredOutput"];
|
||||||
|
|
||||||
SettingsData.set("audioOutputDevicePins", pins);
|
CacheData.set("audioOutputDevicePins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Quickshell.Bluetooth
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -95,17 +96,9 @@ Rectangle {
|
|||||||
BluetoothService.updateDeviceCodec(deviceAddress, codecName);
|
BluetoothService.updateDeviceCodec(deviceAddress, codecName);
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePinList(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value.filter(v => v);
|
|
||||||
if (typeof value === "string" && value.length > 0)
|
|
||||||
return [value];
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPinnedDevices() {
|
function getPinnedDevices() {
|
||||||
const pins = SettingsData.bluetoothDevicePins || {};
|
const pins = CacheData.bluetoothDevicePins || {};
|
||||||
return normalizePinList(pins["preferredDevice"]);
|
return QmlUtils.normalizePinList(pins["preferredDevice"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -395,8 +388,8 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.bluetoothDevicePins || {}));
|
const pins = JSON.parse(JSON.stringify(CacheData.bluetoothDevicePins || {}));
|
||||||
let pinnedList = root.normalizePinList(pins["preferredDevice"]);
|
let pinnedList = QmlUtils.normalizePinList(pins["preferredDevice"]);
|
||||||
const pinIndex = pinnedList.indexOf(pairedDelegate.modelData.address);
|
const pinIndex = pinnedList.indexOf(pairedDelegate.modelData.address);
|
||||||
|
|
||||||
if (pinIndex !== -1) {
|
if (pinIndex !== -1) {
|
||||||
@@ -413,7 +406,7 @@ Rectangle {
|
|||||||
delete pins["preferredDevice"];
|
delete pins["preferredDevice"];
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsData.set("bluetoothDevicePins", pins);
|
CacheData.set("bluetoothDevicePins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Rectangle {
|
|||||||
|
|
||||||
const pinKey = getScreenPinKey();
|
const pinKey = getScreenPinKey();
|
||||||
if (pinKey.length > 0) {
|
if (pinKey.length > 0) {
|
||||||
const pins = SettingsData.brightnessDevicePins || {};
|
const pins = CacheData.brightnessDevicePins || {};
|
||||||
const pinnedDevice = pins[pinKey];
|
const pinnedDevice = pins[pinKey];
|
||||||
if (pinnedDevice && pinnedDevice.length > 0) {
|
if (pinnedDevice && pinnedDevice.length > 0) {
|
||||||
const found = devices.find(d => d.name === pinnedDevice);
|
const found = devices.find(d => d.name === pinnedDevice);
|
||||||
@@ -85,12 +85,12 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
const pinKey = getScreenPinKey();
|
const pinKey = getScreenPinKey();
|
||||||
if (pinKey.length > 0) {
|
if (pinKey.length > 0) {
|
||||||
const pins = SettingsData.brightnessDevicePins || {};
|
const pins = CacheData.brightnessDevicePins || {};
|
||||||
const existing = pins[pinKey];
|
const existing = pins[pinKey];
|
||||||
if (existing && existing !== deviceName) {
|
if (existing && existing !== deviceName) {
|
||||||
const next = JSON.parse(JSON.stringify(pins));
|
const next = JSON.parse(JSON.stringify(pins));
|
||||||
delete next[pinKey];
|
delete next[pinKey];
|
||||||
SettingsData.set("brightnessDevicePins", next);
|
CacheData.set("brightnessDevicePins", next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.currentDeviceName = deviceName;
|
root.currentDeviceName = deviceName;
|
||||||
@@ -106,7 +106,7 @@ Rectangle {
|
|||||||
const pinKey = getScreenPinKey();
|
const pinKey = getScreenPinKey();
|
||||||
if (!pinKey || !deviceName)
|
if (!pinKey || !deviceName)
|
||||||
return false;
|
return false;
|
||||||
const pins = SettingsData.brightnessDevicePins || {};
|
const pins = CacheData.brightnessDevicePins || {};
|
||||||
return pins[pinKey] === deviceName;
|
return pins[pinKey] === deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,13 +114,13 @@ Rectangle {
|
|||||||
const pinKey = getScreenPinKey();
|
const pinKey = getScreenPinKey();
|
||||||
if (!pinKey || !deviceName)
|
if (!pinKey || !deviceName)
|
||||||
return;
|
return;
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}));
|
const pins = JSON.parse(JSON.stringify(CacheData.brightnessDevicePins || {}));
|
||||||
if (pins[pinKey] === deviceName) {
|
if (pins[pinKey] === deviceName) {
|
||||||
delete pins[pinKey];
|
delete pins[pinKey];
|
||||||
} else {
|
} else {
|
||||||
pins[pinKey] = deviceName;
|
pins[pinKey] = deviceName;
|
||||||
}
|
}
|
||||||
SettingsData.set("brightnessDevicePins", pins);
|
CacheData.set("brightnessDevicePins", pins);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
@@ -269,7 +269,7 @@ Rectangle {
|
|||||||
|
|
||||||
readonly property bool selected: !!(modelData && modelData.name === root.currentDeviceName)
|
readonly property bool selected: !!(modelData && modelData.name === root.currentDeviceName)
|
||||||
readonly property bool devicePinnedHere: {
|
readonly property bool devicePinnedHere: {
|
||||||
SettingsData.brightnessDevicePins;
|
CacheData.brightnessDevicePins;
|
||||||
return root.isDevicePinnedToScreen(modelData ? modelData.name : "");
|
return root.isDevicePinnedToScreen(modelData ? modelData.name : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/Format.js" as Format
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -23,33 +24,8 @@ Rectangle {
|
|||||||
onTriggered: root.nowMs = Date.now()
|
onTriggered: root.nowMs = Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
function _pad2(n) {
|
|
||||||
return n < 10 ? "0" + n : "" + n;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatUntil(ts) {
|
|
||||||
if (!ts)
|
|
||||||
return "";
|
|
||||||
const d = new Date(ts);
|
|
||||||
const use24h = (typeof SettingsData !== "undefined") ? SettingsData.use24HourClock : true;
|
|
||||||
if (use24h)
|
|
||||||
return _pad2(d.getHours()) + ":" + _pad2(d.getMinutes());
|
|
||||||
const suffix = d.getHours() >= 12 ? "PM" : "AM";
|
|
||||||
const h12 = ((d.getHours() + 11) % 12) + 1;
|
|
||||||
return h12 + ":" + _pad2(d.getMinutes()) + " " + suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatRemaining(ms) {
|
function formatRemaining(ms) {
|
||||||
if (ms <= 0)
|
return Format.formatRemaining(ms, "", I18n.tr("%1 min left"), I18n.tr("%1 h left"), I18n.tr("%1 h %2 m left"));
|
||||||
return "";
|
|
||||||
const totalMinutes = Math.ceil(ms / 60000);
|
|
||||||
if (totalMinutes < 60)
|
|
||||||
return I18n.tr("%1 min left").arg(totalMinutes);
|
|
||||||
const hours = Math.floor(totalMinutes / 60);
|
|
||||||
const mins = totalMinutes - hours * 60;
|
|
||||||
if (mins === 0)
|
|
||||||
return I18n.tr("%1 h left").arg(hours);
|
|
||||||
return I18n.tr("%1 h %2 m left").arg(hours).arg(mins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function minutesUntilTomorrowMorning() {
|
function minutesUntilTomorrowMorning() {
|
||||||
@@ -125,7 +101,7 @@ Rectangle {
|
|||||||
if (SessionData.doNotDisturbUntil <= 0)
|
if (SessionData.doNotDisturbUntil <= 0)
|
||||||
return I18n.tr("On indefinitely");
|
return I18n.tr("On indefinitely");
|
||||||
const remaining = Math.max(0, SessionData.doNotDisturbUntil - root.nowMs);
|
const remaining = Math.max(0, SessionData.doNotDisturbUntil - root.nowMs);
|
||||||
return root.formatRemaining(remaining) + " · " + I18n.tr("until %1").arg(root.formatUntil(SessionData.doNotDisturbUntil));
|
return root.formatRemaining(remaining) + " · " + I18n.tr("until %1").arg(Format.formatUntil(SessionData.doNotDisturbUntil, SettingsData.use24HourClock));
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.surfaceVariantText
|
color: Theme.surfaceVariantText
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import qs.Services
|
|||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
import qs.Modals
|
import qs.Modals
|
||||||
import qs.Modals.Common
|
import qs.Modals.Common
|
||||||
|
import "../../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -66,17 +67,9 @@ Rectangle {
|
|||||||
PopoutService.openSettingsWithTab("network_wifi");
|
PopoutService.openSettingsWithTab("network_wifi");
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePinList(value) {
|
|
||||||
if (Array.isArray(value))
|
|
||||||
return value.filter(v => v);
|
|
||||||
if (typeof value === "string" && value.length > 0)
|
|
||||||
return [value];
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPinnedNetworks() {
|
function getPinnedNetworks() {
|
||||||
const pins = SettingsData.wifiNetworkPins || {};
|
const pins = CacheData.wifiNetworkPins || {};
|
||||||
return normalizePinList(pins["preferredWifi"]);
|
return QmlUtils.normalizePinList(pins["preferredWifi"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
property int currentPreferenceIndex: {
|
property int currentPreferenceIndex: {
|
||||||
@@ -907,8 +900,8 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
|
const pins = JSON.parse(JSON.stringify(CacheData.wifiNetworkPins || {}));
|
||||||
let pinnedList = root.normalizePinList(pins["preferredWifi"]);
|
let pinnedList = QmlUtils.normalizePinList(pins["preferredWifi"]);
|
||||||
const pinIndex = pinnedList.indexOf(modelData.ssid);
|
const pinIndex = pinnedList.indexOf(modelData.ssid);
|
||||||
|
|
||||||
if (pinIndex !== -1) {
|
if (pinIndex !== -1) {
|
||||||
@@ -924,7 +917,7 @@ Rectangle {
|
|||||||
else
|
else
|
||||||
delete pins["preferredWifi"];
|
delete pins["preferredWifi"];
|
||||||
|
|
||||||
SettingsData.set("wifiNetworkPins", pins);
|
CacheData.set("wifiNetworkPins", pins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Row {
|
|||||||
if (screenName && screenName.length > 0) {
|
if (screenName && screenName.length > 0) {
|
||||||
const screen = Quickshell.screens.find(s => s.name === screenName);
|
const screen = Quickshell.screens.find(s => s.name === screenName);
|
||||||
const pinKey = screen ? SettingsData.getScreenDisplayName(screen) : screenName;
|
const pinKey = screen ? SettingsData.getScreenDisplayName(screen) : screenName;
|
||||||
const pins = SettingsData.brightnessDevicePins || {};
|
const pins = CacheData.brightnessDevicePins || {};
|
||||||
const pinnedDevice = pins[pinKey];
|
const pinnedDevice = pins[pinKey];
|
||||||
if (pinnedDevice && pinnedDevice.length > 0) {
|
if (pinnedDevice && pinnedDevice.length > 0) {
|
||||||
const found = DisplayService.devices.find(dev => dev.name === pinnedDevice);
|
const found = DisplayService.devices.find(dev => dev.name === pinnedDevice);
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Common
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
LayoutMirroring.enabled: I18n.isRtl
|
|
||||||
LayoutMirroring.childrenInherit: true
|
|
||||||
|
|
||||||
property string iconName: ""
|
|
||||||
property color iconColor: Theme.surfaceText
|
|
||||||
property string labelText: ""
|
|
||||||
property real value: 0.0
|
|
||||||
property real maximumValue: 1.0
|
|
||||||
property real minimumValue: 0.0
|
|
||||||
|
|
||||||
signal sliderValueChanged(real value)
|
|
||||||
|
|
||||||
width: parent ? parent.width : 200
|
|
||||||
height: 60
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Theme.nestedSurface
|
|
||||||
border.color: Theme.outlineMedium
|
|
||||||
border.width: Theme.layerOutlineWidth
|
|
||||||
opacity: enabled ? 1.0 : 0.6
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: Theme.spacingM
|
|
||||||
anchors.right: sliderContainer.left
|
|
||||||
anchors.rightMargin: Theme.spacingS
|
|
||||||
spacing: Theme.spacingS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: root.iconName
|
|
||||||
size: Theme.iconSize
|
|
||||||
color: root.iconColor
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: root.labelText
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: sliderContainer
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.rightMargin: Theme.spacingM
|
|
||||||
width: 120
|
|
||||||
height: parent.height - Theme.spacingS * 2
|
|
||||||
|
|
||||||
DankSlider {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width
|
|
||||||
enabled: root.enabled
|
|
||||||
minimum: Math.round(root.minimumValue * 100)
|
|
||||||
maximum: Math.round(root.maximumValue * 100)
|
|
||||||
value: Math.round(root.value * 100)
|
|
||||||
trackColor: Theme.ccSliderTrackColor
|
|
||||||
trackOpacity: Theme.ccSliderTrackOpacity
|
|
||||||
onSliderValueChanged: root.sliderValueChanged(newValue / 100.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,11 +25,6 @@ Rectangle {
|
|||||||
height: 60
|
height: 60
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _containerBg: Theme.ccPillInactiveBg
|
readonly property color _containerBg: Theme.ccPillInactiveBg
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
@@ -61,7 +56,7 @@ Rectangle {
|
|||||||
radius: root.radius
|
radius: root.radius
|
||||||
z: 0
|
z: 0
|
||||||
visible: false
|
visible: false
|
||||||
color: hoverTint(_containerBg)
|
color: Theme.hoverTint(_containerBg)
|
||||||
opacity: 0.08
|
opacity: 0.08
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
@@ -98,7 +93,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: _tileRadius
|
radius: _tileRadius
|
||||||
color: hoverTint(iconTile.color)
|
color: Theme.hoverTint(iconTile.color)
|
||||||
opacity: tileMouse.pressed ? 0.3 : (tileMouse.containsMouse ? 0.2 : 0.0)
|
opacity: tileMouse.pressed ? 0.3 : (tileMouse.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string title: ""
|
|
||||||
property Component content: null
|
|
||||||
property bool isVisible: true
|
|
||||||
property int contentHeight: 300
|
|
||||||
|
|
||||||
width: parent ? parent.width : 400
|
|
||||||
implicitHeight: isVisible ? contentHeight : 0
|
|
||||||
height: implicitHeight
|
|
||||||
color: "transparent"
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: contentLoader
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceComponent: root.content
|
|
||||||
asynchronous: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,11 +22,6 @@ Rectangle {
|
|||||||
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
||||||
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
||||||
readonly property color _tileRingActive: Theme.ccTileRing
|
readonly property color _tileRingActive: Theme.ccTileRing
|
||||||
@@ -47,7 +42,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: hoverTint(root.color)
|
color: Theme.hoverTint(root.color)
|
||||||
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ Rectangle {
|
|||||||
height: 48
|
height: 48
|
||||||
radius: Theme.cornerRadius === 0 ? 0 : Theme.cornerRadius
|
radius: Theme.cornerRadius === 0 ? 0 : Theme.cornerRadius
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
border.color: Theme.ccTileRing
|
border.color: Theme.ccTileRing
|
||||||
border.width: 1
|
border.width: 1
|
||||||
@@ -29,7 +24,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: hoverTint(root.color)
|
color: Theme.hoverTint(root.color)
|
||||||
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ Rectangle {
|
|||||||
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
||||||
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
||||||
readonly property color _tileRingActive: Theme.ccTileRing
|
readonly property color _tileRingActive: Theme.ccTileRing
|
||||||
@@ -50,7 +45,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: hoverTint(root.color)
|
color: Theme.hoverTint(root.color)
|
||||||
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ Rectangle {
|
|||||||
height: 48
|
height: 48
|
||||||
radius: Theme.cornerRadius + 4
|
radius: Theme.cornerRadius + 4
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _tileBg: Theme.ccPillInactiveBg
|
readonly property color _tileBg: Theme.ccPillInactiveBg
|
||||||
|
|
||||||
color: mouseArea.containsMouse ? Theme.ccPillInactiveHoverBg : _tileBg
|
color: mouseArea.containsMouse ? Theme.ccPillInactiveHoverBg : _tileBg
|
||||||
@@ -50,7 +45,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: hoverTint(root.color)
|
color: Theme.hoverTint(root.color)
|
||||||
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ Rectangle {
|
|||||||
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
return isActive ? Theme.cornerRadius : Theme.cornerRadius + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
readonly property color _tileBgActive: Theme.ccTileActiveBg
|
||||||
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
readonly property color _tileBgInactive: Theme.ccPillInactiveBg
|
||||||
readonly property color _tileRingActive: Theme.ccTileRing
|
readonly property color _tileRingActive: Theme.ccTileRing
|
||||||
@@ -45,7 +40,7 @@ Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: parent.radius
|
radius: parent.radius
|
||||||
color: hoverTint(root.color)
|
color: Theme.hoverTint(root.color)
|
||||||
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
opacity: mouseArea.pressed ? 0.3 : (mouseArea.containsMouse ? 0.2 : 0.0)
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|||||||
@@ -39,17 +39,12 @@ Rectangle {
|
|||||||
border.width: isActive ? 1 : Theme.layerOutlineWidth
|
border.width: isActive ? 1 : Theme.layerOutlineWidth
|
||||||
opacity: enabled ? 1.0 : 0.6
|
opacity: enabled ? 1.0 : 0.6
|
||||||
|
|
||||||
function hoverTint(base) {
|
|
||||||
const factor = 1.2;
|
|
||||||
return Theme.isLightMode ? Qt.darker(base, factor) : Qt.lighter(base, factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property color _containerBg: Theme.ccPillInactiveBg
|
readonly property color _containerBg: Theme.ccPillInactiveBg
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: mouseArea.containsMouse ? hoverTint(_containerBg) : Theme.withAlpha(_containerBg, 0)
|
color: mouseArea.containsMouse ? Theme.hoverTint(_containerBg) : Theme.withAlpha(_containerBg, 0)
|
||||||
opacity: mouseArea.containsMouse ? 0.08 : 0.0
|
opacity: mouseArea.containsMouse ? 0.08 : 0.0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ Item {
|
|||||||
property var centerWidgets: []
|
property var centerWidgets: []
|
||||||
property int totalWidgets: 0
|
property int totalWidgets: 0
|
||||||
property real totalSize: 0
|
property real totalSize: 0
|
||||||
|
property real contentStart: 0
|
||||||
|
property real contentSize: 0
|
||||||
|
|
||||||
function updateLayout() {
|
function updateLayout() {
|
||||||
if (SettingsData.centeringMode === "geometric") {
|
if (SettingsData.centeringMode === "geometric") {
|
||||||
@@ -36,6 +38,25 @@ Item {
|
|||||||
} else {
|
} else {
|
||||||
applyIndexLayout();
|
applyIndexLayout();
|
||||||
}
|
}
|
||||||
|
updateContentExtent();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateContentExtent() {
|
||||||
|
if (centerWidgets.length === 0) {
|
||||||
|
contentStart = 0;
|
||||||
|
contentSize = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let start = Infinity;
|
||||||
|
let end = -Infinity;
|
||||||
|
for (const widget of centerWidgets) {
|
||||||
|
const pos = isVertical ? widget.y : widget.x;
|
||||||
|
const size = isVertical ? widget.height : widget.width;
|
||||||
|
start = Math.min(start, pos);
|
||||||
|
end = Math.max(end, pos + size);
|
||||||
|
}
|
||||||
|
contentStart = start;
|
||||||
|
contentSize = end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyGeometricLayout() {
|
function applyGeometricLayout() {
|
||||||
|
|||||||
@@ -69,7 +69,62 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerDashTab(tabId) {
|
function dashSectionAnchor(section) {
|
||||||
|
let item;
|
||||||
|
switch (section) {
|
||||||
|
case "left":
|
||||||
|
item = barWindow.isVertical ? topBarContent.vLeftSection : topBarContent.hLeftSection;
|
||||||
|
break;
|
||||||
|
case "right":
|
||||||
|
item = barWindow.isVertical ? topBarContent.vRightSection : topBarContent.hRightSection;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
item = barWindow.isVertical ? topBarContent.vCenterSection : topBarContent.hCenterSection;
|
||||||
|
}
|
||||||
|
if (!item)
|
||||||
|
return null;
|
||||||
|
if (barWindow.isVertical)
|
||||||
|
return {
|
||||||
|
"pos": item.mapToItem(null, 0, item.height / 2),
|
||||||
|
"width": item.height
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
"pos": item.mapToItem(null, 0, 0),
|
||||||
|
"width": item.width
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function positionDash(popout, position) {
|
||||||
|
if (!popout.setTriggerPosition) {
|
||||||
|
popout.triggerScreen = barWindow.screen;
|
||||||
|
return "center";
|
||||||
|
}
|
||||||
|
|
||||||
|
const explicit = position === "left" || position === "center" || position === "right";
|
||||||
|
const section = explicit ? position : (clockButtonRef?.section || "center");
|
||||||
|
const clockAnchor = clockButtonRef?.visualContent ? {
|
||||||
|
"pos": clockButtonRef.visualContent.mapToItem(null, 0, 0),
|
||||||
|
"width": clockButtonRef.visualWidth
|
||||||
|
} : null;
|
||||||
|
|
||||||
|
let anchor;
|
||||||
|
if (!explicit && section !== "center" && clockAnchor)
|
||||||
|
anchor = clockAnchor;
|
||||||
|
else
|
||||||
|
anchor = dashSectionAnchor(section) || clockAnchor;
|
||||||
|
|
||||||
|
if (!anchor) {
|
||||||
|
popout.triggerScreen = barWindow.screen;
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
|
||||||
|
const pos = SettingsData.getPopupTriggerPosition(anchor.pos, barWindow.screen, barWindow.effectiveBarThickness, anchor.width, barConfig?.spacing ?? 4, barPosition, barConfig);
|
||||||
|
popout.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig);
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerDashTab(tabId, position) {
|
||||||
const loader = PopoutService.dankDashPopoutLoader;
|
const loader = PopoutService.dankDashPopoutLoader;
|
||||||
if (!loader)
|
if (!loader)
|
||||||
return false;
|
return false;
|
||||||
@@ -78,38 +133,7 @@ Item {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let section = "center";
|
const section = positionDash(loader.item, position);
|
||||||
if (clockButtonRef && clockButtonRef.visualContent && loader.item.setTriggerPosition) {
|
|
||||||
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
|
|
||||||
section = clockButtonRef.section || "center";
|
|
||||||
|
|
||||||
let triggerPos, triggerWidth;
|
|
||||||
if (section === "center") {
|
|
||||||
const centerSection = barWindow.isVertical ? (barWindow.axis?.edge === "left" ? topBarContent.vCenterSection : topBarContent.vCenterSection) : topBarContent.hCenterSection;
|
|
||||||
if (centerSection) {
|
|
||||||
if (barWindow.isVertical) {
|
|
||||||
const centerY = centerSection.height / 2;
|
|
||||||
triggerPos = centerSection.mapToItem(null, 0, centerY);
|
|
||||||
triggerWidth = centerSection.height;
|
|
||||||
} else {
|
|
||||||
triggerPos = centerSection.mapToItem(null, 0, 0);
|
|
||||||
triggerWidth = centerSection.width;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
|
|
||||||
triggerWidth = clockButtonRef.visualWidth;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
|
|
||||||
triggerWidth = clockButtonRef.visualWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, barConfig?.spacing ?? 4, barPosition, barConfig);
|
|
||||||
loader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig);
|
|
||||||
} else {
|
|
||||||
loader.item.triggerScreen = barWindow.screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loader.item.requestTab)
|
if (loader.item.requestTab)
|
||||||
loader.item.requestTab(tabId);
|
loader.item.requestTab(tabId);
|
||||||
PopoutManager.requestPopout(loader.item, undefined, (barConfig?.id ?? "default") + "-" + section + "-" + tabId);
|
PopoutManager.requestPopout(loader.item, undefined, (barConfig?.id ?? "default") + "-" + section + "-" + tabId);
|
||||||
@@ -808,16 +832,30 @@ Item {
|
|||||||
const pos = section.mapToItem(barWindow.hostWindow.contentItem, 0, 0);
|
const pos = section.mapToItem(barWindow.hostWindow.contentItem, 0, 0);
|
||||||
const implW = section.implicitWidth || 0;
|
const implW = section.implicitWidth || 0;
|
||||||
const implH = section.implicitHeight || 0;
|
const implH = section.implicitHeight || 0;
|
||||||
|
const contentSize = isCenter ? (section.contentSize || 0) : 0;
|
||||||
|
|
||||||
const offsetX = isCenter && !barWindow.isVertical ? (section.width - implW) / 2 : 0;
|
let offsetX = isCenter && !barWindow.isVertical ? (section.width - implW) / 2 : 0;
|
||||||
const offsetY = !barWindow.isVertical ? (section.height - implH) / 2 : (isCenter ? (section.height - implH) / 2 : 0);
|
let offsetY = !barWindow.isVertical ? (section.height - implH) / 2 : (isCenter ? (section.height - implH) / 2 : 0);
|
||||||
|
let w = implW;
|
||||||
|
let h = implH;
|
||||||
|
|
||||||
|
// index centering lays content out asymmetrically; use the real extent
|
||||||
|
if (contentSize > 0) {
|
||||||
|
if (barWindow.isVertical) {
|
||||||
|
offsetY = section.contentStart;
|
||||||
|
h = contentSize;
|
||||||
|
} else {
|
||||||
|
offsetX = section.contentStart;
|
||||||
|
w = contentSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const edgePad = 2;
|
const edgePad = 2;
|
||||||
return {
|
return {
|
||||||
"x": pos.x + offsetX - edgePad,
|
"x": pos.x + offsetX - edgePad,
|
||||||
"y": pos.y + offsetY - edgePad,
|
"y": pos.y + offsetY - edgePad,
|
||||||
"w": implW + edgePad * 2,
|
"w": w + edgePad * 2,
|
||||||
"h": implH + edgePad * 2
|
"h": h + edgePad * 2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,10 @@ Item {
|
|||||||
readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1)
|
readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1)
|
||||||
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
|
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
|
||||||
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
|
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
|
||||||
// Connected-frame Bar Inset Padding: absolute free-end gap the hosted bar spans full-width into
|
// Hosted bars span their edge fully; frameBarContentGap is the free-end gap measured from the
|
||||||
// (auto < 0 = frameThickness so widgets align with the interior cutout, 0 = edge-to-edge). The extra
|
// screen edge (auto = frameThickness, aligning widgets with the interior cutout).
|
||||||
// beyond frameThickness is what an adjacent bar end adds on top of its corner alignment.
|
readonly property real _frameInsetResolved: SettingsData.frameBarContentGap
|
||||||
readonly property real _frameInsetResolved: SettingsData.frameBarInsetPadding < 0 ? SettingsData.frameThickness : SettingsData.frameBarInsetPadding
|
readonly property real _frameInsetExtra: SettingsData.frameBarContentGapExtra
|
||||||
readonly property real _frameInsetExtra: Math.max(0, _frameInsetResolved - SettingsData.frameThickness)
|
|
||||||
|
|
||||||
// Horizontal bars span the full width and own the corners; the perpendicular vertical bar
|
// Horizontal bars span the full width and own the corners; the perpendicular vertical bar
|
||||||
// tucks in below/above. Where they meet, inset the corner widget so it centres in the
|
// tucks in below/above. Where they meet, inset the corner widget so it centres in the
|
||||||
@@ -274,22 +273,6 @@ Item {
|
|||||||
return ws.num !== -1 ? ws.num : ws.name;
|
return ws.num !== -1 ? ws.num : ws.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeSwayWorkspaceName(name) {
|
|
||||||
return String(name ?? "").replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispatchSwayWorkspace(ws) {
|
|
||||||
if (!ws)
|
|
||||||
return;
|
|
||||||
try {
|
|
||||||
if (ws.num !== undefined && ws.num !== -1) {
|
|
||||||
I3.dispatch(`workspace number ${ws.num}`);
|
|
||||||
} else if (ws.name) {
|
|
||||||
I3.dispatch(`workspace "${escapeSwayWorkspaceName(ws.name)}"`);
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function switchWorkspace(direction) {
|
function switchWorkspace(direction) {
|
||||||
const realWorkspaces = getRealWorkspaces();
|
const realWorkspaces = getRealWorkspaces();
|
||||||
if (realWorkspaces.length < 2) {
|
if (realWorkspaces.length < 2) {
|
||||||
@@ -334,7 +317,7 @@ Item {
|
|||||||
const nextIndex = direction > 0 ? Math.min(validIndex + 1, realWorkspaces.length - 1) : Math.max(validIndex - 1, 0);
|
const nextIndex = direction > 0 ? Math.min(validIndex + 1, realWorkspaces.length - 1) : Math.max(validIndex - 1, 0);
|
||||||
|
|
||||||
if (nextIndex !== validIndex) {
|
if (nextIndex !== validIndex) {
|
||||||
dispatchSwayWorkspace(realWorkspaces[nextIndex]);
|
CompositorService.dispatchSwayWorkspace(realWorkspaces[nextIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,21 @@ PanelWindow {
|
|||||||
readonly property int barPos: body.barPos
|
readonly property int barPos: body.barPos
|
||||||
readonly property bool barRevealed: body.barRevealed
|
readonly property bool barRevealed: body.barRevealed
|
||||||
|
|
||||||
|
property alias controlCenterButtonRef: body.controlCenterButtonRef
|
||||||
|
property alias clockButtonRef: body.clockButtonRef
|
||||||
|
property alias systemUpdateButtonRef: body.systemUpdateButtonRef
|
||||||
|
|
||||||
function triggerSystemUpdate() {
|
function triggerSystemUpdate() {
|
||||||
body.triggerSystemUpdate();
|
body.triggerSystemUpdate();
|
||||||
}
|
}
|
||||||
function triggerControlCenter() {
|
function triggerControlCenter() {
|
||||||
body.triggerControlCenter();
|
body.triggerControlCenter();
|
||||||
}
|
}
|
||||||
function triggerDashTab(tabId) {
|
function triggerDashTab(tabId, position) {
|
||||||
body.triggerDashTab(tabId);
|
return body.triggerDashTab(tabId, position);
|
||||||
|
}
|
||||||
|
function positionDash(popout, position) {
|
||||||
|
return body.positionDash(popout, position);
|
||||||
}
|
}
|
||||||
function triggerWallpaperBrowser() {
|
function triggerWallpaperBrowser() {
|
||||||
body.triggerWallpaperBrowser();
|
body.triggerWallpaperBrowser();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import qs.Modules.ControlCenter.Details
|
||||||
|
|
||||||
DankPopout {
|
DankPopout {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ BasePill {
|
|||||||
const pinKey = getScreenPinKey();
|
const pinKey = getScreenPinKey();
|
||||||
if (!pinKey)
|
if (!pinKey)
|
||||||
return "";
|
return "";
|
||||||
const pins = SettingsData.brightnessDevicePins || {};
|
const pins = CacheData.brightnessDevicePins || {};
|
||||||
return pins[pinKey] || "";
|
return pins[pinKey] || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,22 +3,11 @@ import qs.Common
|
|||||||
import qs.Modules.Plugins
|
import qs.Modules.Plugins
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/Format.js" as Format
|
||||||
|
|
||||||
BasePill {
|
BasePill {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
function formatNetworkSpeed(bytesPerSec) {
|
|
||||||
if (bytesPerSec < 1024) {
|
|
||||||
return bytesPerSec.toFixed(0) + " B/s";
|
|
||||||
} else if (bytesPerSec < 1024 * 1024) {
|
|
||||||
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
|
|
||||||
} else if (bytesPerSec < 1024 * 1024 * 1024) {
|
|
||||||
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
|
|
||||||
} else {
|
|
||||||
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(1) + " GB/s";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
DgopService.addRef(["network"]);
|
DgopService.addRef(["network"]);
|
||||||
}
|
}
|
||||||
@@ -97,7 +86,7 @@ BasePill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: DgopService.networkRxRate > 0 ? root.formatNetworkSpeed(DgopService.networkRxRate) : "0 B/s"
|
text: DgopService.networkRxRate > 0 ? Format.formatRate(DgopService.networkRxRate, 1) : "0 B/s"
|
||||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||||
color: Theme.widgetTextColor
|
color: Theme.widgetTextColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -126,7 +115,7 @@ BasePill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: DgopService.networkTxRate > 0 ? root.formatNetworkSpeed(DgopService.networkTxRate) : "0 B/s"
|
text: DgopService.networkTxRate > 0 ? Format.formatRate(DgopService.networkTxRate, 1) : "0 B/s"
|
||||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||||
color: Theme.widgetTextColor
|
color: Theme.widgetTextColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|||||||
@@ -35,44 +35,42 @@ BasePill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightClicked: (rx, ry) => {
|
onRightClicked: {
|
||||||
const screen = root.parentScreen || Screen;
|
const screen = root.parentScreen || Screen;
|
||||||
if (!screen)
|
if (!screen)
|
||||||
return;
|
return;
|
||||||
const globalPos = root.visualContent.mapToItem(null, 0, 0);
|
|
||||||
const isVertical = root.axis?.isVertical ?? false;
|
const isVertical = root.axis?.isVertical ?? false;
|
||||||
const edge = root.axis?.edge ?? "top";
|
const edge = root.axis?.edge ?? "top";
|
||||||
const gap = Math.max(Theme.spacingXS, root.barSpacing ?? Theme.spacingXS);
|
const gap = Math.max(Theme.spacingXS, root.barSpacing ?? Theme.spacingXS);
|
||||||
const barOffset = root.barThickness + root.barSpacing + gap;
|
const barOffset = root.barThickness + root.barSpacing + gap;
|
||||||
|
const localPos = root.visualContent.mapToItem(null, root.visualContent.width / 2, root.visualContent.height / 2);
|
||||||
|
|
||||||
let anchorX;
|
let anchorX;
|
||||||
let anchorY;
|
let anchorY;
|
||||||
let anchorEdge;
|
|
||||||
if (isVertical) {
|
if (isVertical) {
|
||||||
anchorY = globalPos.y - (screen.y || 0) + root.visualContent.height / 2;
|
anchorX = edge === "left" ? barOffset : screen.width - barOffset;
|
||||||
if (edge === "left") {
|
anchorY = localPos.y;
|
||||||
anchorX = barOffset;
|
|
||||||
anchorEdge = "top";
|
|
||||||
} else {
|
|
||||||
anchorX = screen.width - barOffset;
|
|
||||||
anchorEdge = "top";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
anchorX = globalPos.x - (screen.x || 0) + root.visualContent.width / 2;
|
anchorX = localPos.x;
|
||||||
if (edge === "bottom") {
|
anchorY = edge === "bottom" ? screen.height - barOffset : barOffset;
|
||||||
anchorY = screen.height - barOffset;
|
|
||||||
anchorEdge = "bottom";
|
|
||||||
} else {
|
|
||||||
anchorY = barOffset;
|
|
||||||
anchorEdge = "top";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dndPopupLoader.active = true;
|
dndPopupLoader.active = true;
|
||||||
const popup = dndPopupLoader.item;
|
const popup = dndPopupLoader.item;
|
||||||
if (!popup)
|
if (!popup)
|
||||||
return;
|
return;
|
||||||
popup.showAt(anchorX, anchorY, screen, anchorEdge);
|
|
||||||
|
popup.showAt(anchorX, anchorY, isVertical, edge, screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.MiddleButton
|
||||||
|
onPressed: mouse => {
|
||||||
|
root.triggerRipple(this, mouse.x, mouse.y);
|
||||||
|
SessionData.setDoNotDisturb(!SessionData.doNotDisturb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -228,22 +228,6 @@ Item {
|
|||||||
return ws.num !== -1 ? ws.num : ws.name;
|
return ws.num !== -1 ? ws.num : ws.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeSwayWorkspaceName(name) {
|
|
||||||
return String(name ?? "").replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispatchSwayWorkspace(ws) {
|
|
||||||
if (!ws)
|
|
||||||
return;
|
|
||||||
try {
|
|
||||||
if (ws.num !== undefined && ws.num !== -1) {
|
|
||||||
I3.dispatch(`workspace number ${ws.num}`);
|
|
||||||
} else if (ws.name) {
|
|
||||||
I3.dispatch(`workspace "${escapeSwayWorkspaceName(ws.name)}"`);
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSwayActiveWorkspace() {
|
function getSwayActiveWorkspace() {
|
||||||
if (!root.screenName || SettingsData.workspaceFollowFocus) {
|
if (!root.screenName || SettingsData.workspaceFollowFocus) {
|
||||||
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
||||||
@@ -711,7 +695,7 @@ Item {
|
|||||||
case "sway":
|
case "sway":
|
||||||
case "scroll":
|
case "scroll":
|
||||||
case "miracle":
|
case "miracle":
|
||||||
dispatchSwayWorkspace(data);
|
CompositorService.dispatchSwayWorkspace(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -818,7 +802,7 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchSwayWorkspace(realWorkspaces[nextIndex]);
|
CompositorService.dispatchSwayWorkspace(realWorkspaces[nextIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1486,7 +1470,7 @@ Item {
|
|||||||
} else if (root.isMango && modelData?.tag !== undefined) {
|
} else if (root.isMango && modelData?.tag !== undefined) {
|
||||||
MangoService.switchToTag(root.screenName, modelData.tag);
|
MangoService.switchToTag(root.screenName, modelData.tag);
|
||||||
} else if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && modelData?.num !== undefined) {
|
} else if ((CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) && modelData?.num !== undefined) {
|
||||||
root.dispatchSwayWorkspace(modelData);
|
CompositorService.dispatchSwayWorkspace(modelData);
|
||||||
}
|
}
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
if (CompositorService.isNiri) {
|
if (CompositorService.isNiri) {
|
||||||
|
|||||||
@@ -415,11 +415,24 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onWheel: wheelEvent => {
|
onWheel: wheelEvent => {
|
||||||
if (SettingsData.audioDeviceScrollVolumeEnabled && wheelEvent.x >= deviceMouseArea.width / 2) {
|
if (!SettingsData.audioDeviceScrollVolumeEnabled || wheelEvent.x < deviceMouseArea.width / 2) {
|
||||||
AudioService.handleNodeVolumeWheel(modelData, wheelEvent);
|
|
||||||
} else {
|
|
||||||
wheelEvent.accepted = false;
|
wheelEvent.accepted = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (!modelData?.audio)
|
||||||
|
return;
|
||||||
|
SessionData.suppressOSDTemporarily();
|
||||||
|
const delta = wheelEvent.angleDelta.y;
|
||||||
|
if (delta === 0)
|
||||||
|
return;
|
||||||
|
const current = Math.round(modelData.audio.volume * 100);
|
||||||
|
const maxVol = AudioService.getMaxVolumePercent(modelData);
|
||||||
|
const newVolume = delta > 0 ? Math.min(maxVol, current + AudioService.wheelVolumeStep) : Math.max(0, current - AudioService.wheelVolumeStep);
|
||||||
|
modelData.audio.muted = false;
|
||||||
|
modelData.audio.volume = newVolume / 100;
|
||||||
|
if (modelData === AudioService.sink)
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled();
|
||||||
|
wheelEvent.accepted = true;
|
||||||
}
|
}
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
|
|||||||
@@ -451,6 +451,9 @@ Item {
|
|||||||
height: width
|
height: width
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
activePlayer: root.activePlayer
|
activePlayer: root.activePlayer
|
||||||
|
artUrl: TrackArtService.resolvedArtUrl
|
||||||
|
accentColor: MediaAccentService.accent
|
||||||
|
cavaService: CavaService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,6 +525,10 @@ Item {
|
|||||||
height: 20
|
height: 20
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
activePlayer: root.activePlayer
|
activePlayer: root.activePlayer
|
||||||
|
stableLength: MprisController.activePlayerStableLength
|
||||||
|
accentColor: MediaAccentService.accent
|
||||||
|
accentTrackColor: MediaAccentService.accentTrack
|
||||||
|
accentSubtleColor: MediaAccentService.accentSubtle
|
||||||
isSeeking: root.isSeeking
|
isSeeking: root.isSeeking
|
||||||
onIsSeekingChanged: root.isSeeking = isSeeking
|
onIsSeekingChanged: root.isSeeking = isSeeking
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,209 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
import qs.Widgets
|
||||||
|
|
||||||
|
Card {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
LayoutMirroring.enabled: I18n.isRtl
|
||||||
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
|
readonly property var device: DankConnectService.primaryDevice
|
||||||
|
readonly property var pairingRequest: DankConnectService.pairingRequest
|
||||||
|
readonly property bool hasBattery: !!device && typeof device.batteryCharge === "number" && device.batteryCharge >= 0
|
||||||
|
|
||||||
|
function statusText() {
|
||||||
|
if (!DankConnectService.connected)
|
||||||
|
return I18n.tr("Disconnected");
|
||||||
|
if (!device)
|
||||||
|
return I18n.tr("No devices");
|
||||||
|
const connection = device.isReachable ? I18n.tr("Connected") : I18n.tr("Disconnected");
|
||||||
|
const pairing = device.isPaired ? I18n.tr("Paired") : I18n.tr("Not paired");
|
||||||
|
return connection + " • " + pairing;
|
||||||
|
}
|
||||||
|
|
||||||
|
function batteryText() {
|
||||||
|
if (!hasBattery)
|
||||||
|
return "";
|
||||||
|
const charge = Math.round(device.batteryCharge) + "%";
|
||||||
|
return device.batteryCharging ? charge + " • " + I18n.tr("Charging") : charge;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportError(title, response) {
|
||||||
|
if (response?.error)
|
||||||
|
ToastService.showError(title, response.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: contentRow
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingL
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: Math.max(180, contentRow.width - actionRow.width - trailingPanel.width - contentRow.spacing * 2)
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
name: "smartphone"
|
||||||
|
size: 36
|
||||||
|
color: root.device?.isReachable ? Theme.primary : Theme.surfaceTextSecondary
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: parent.width - 36 - parent.spacing
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: root.device?.name || "DankConnect"
|
||||||
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: root.statusText()
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceTextMedium
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
visible: root.hasBattery
|
||||||
|
text: root.batteryText()
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceTextMedium
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: actionRow
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: implicitWidth
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 34
|
||||||
|
iconSize: 17
|
||||||
|
iconName: "ring_volume"
|
||||||
|
iconColor: Theme.primary
|
||||||
|
tooltipText: I18n.tr("Ring")
|
||||||
|
enabled: DankConnectService.canRing(root.device)
|
||||||
|
onClicked: DankConnectService.ringDevice(root.device.id, response => root.reportError(I18n.tr("Ring"), response))
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 34
|
||||||
|
iconSize: 17
|
||||||
|
iconName: "network_ping"
|
||||||
|
iconColor: Theme.primary
|
||||||
|
tooltipText: I18n.tr("Ping")
|
||||||
|
enabled: DankConnectService.canPing(root.device)
|
||||||
|
onClicked: DankConnectService.pingDevice(root.device.id, response => root.reportError(I18n.tr("Ping"), response))
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 34
|
||||||
|
iconSize: 17
|
||||||
|
iconName: "content_paste_go"
|
||||||
|
iconColor: Theme.primary
|
||||||
|
tooltipText: I18n.tr("Send Clipboard")
|
||||||
|
enabled: DankConnectService.canSendClipboard(root.device)
|
||||||
|
onClicked: DankConnectService.sendClipboard(root.device.id, response => root.reportError(I18n.tr("Send Clipboard"), response))
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 34
|
||||||
|
iconSize: 17
|
||||||
|
iconName: "open_in_new"
|
||||||
|
iconColor: Theme.primary
|
||||||
|
tooltipText: I18n.tr("Open App")
|
||||||
|
onClicked: DankConnectService.openApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: trailingPanel
|
||||||
|
|
||||||
|
width: root.pairingRequest ? 270 : 52
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: !root.pairingRequest && root.hasBattery
|
||||||
|
name: root.hasBattery ? Theme.getBatteryIcon(root.device.batteryCharge, root.device.batteryCharging, true) : "battery_std"
|
||||||
|
size: 28
|
||||||
|
color: Theme.primary
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
visible: root.pairingRequest !== null
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Pairing request from %1").arg(root.pairingRequest?.name || I18n.tr("Device"))
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
width: parent.width
|
||||||
|
text: root.pairingRequest?.verificationKey || I18n.tr("Unknown")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Theme.primary
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
maximumLineCount: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankButton {
|
||||||
|
text: I18n.tr("Reject")
|
||||||
|
buttonHeight: 30
|
||||||
|
horizontalPadding: Theme.spacingM
|
||||||
|
onClicked: DankConnectService.rejectPairing(root.pairingRequest.deviceId, response => root.reportError(I18n.tr("Failed to reject pairing"), response))
|
||||||
|
}
|
||||||
|
|
||||||
|
DankButton {
|
||||||
|
text: I18n.tr("Accept")
|
||||||
|
buttonHeight: 30
|
||||||
|
horizontalPadding: Theme.spacingM
|
||||||
|
backgroundColor: Theme.primary
|
||||||
|
textColor: Theme.primaryText
|
||||||
|
onClicked: DankConnectService.acceptPairing(root.pairingRequest.deviceId, response => root.reportError(I18n.tr("Failed to accept pairing"), response))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,6 +77,9 @@ Card {
|
|||||||
height: 80
|
height: 80
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
activePlayer: root.activePlayer
|
activePlayer: root.activePlayer
|
||||||
|
artUrl: TrackArtService.resolvedArtUrl
|
||||||
|
accentColor: MediaAccentService.accent
|
||||||
|
cavaService: CavaService
|
||||||
albumSize: 76
|
albumSize: 76
|
||||||
animationScale: 1.05
|
animationScale: 1.05
|
||||||
}
|
}
|
||||||
@@ -114,6 +117,10 @@ Card {
|
|||||||
height: 20
|
height: 20
|
||||||
x: -2
|
x: -2
|
||||||
activePlayer: root.activePlayer
|
activePlayer: root.activePlayer
|
||||||
|
stableLength: MprisController.activePlayerStableLength
|
||||||
|
accentColor: MediaAccentService.accent
|
||||||
|
accentTrackColor: MediaAccentService.accentTrack
|
||||||
|
accentSubtleColor: MediaAccentService.accentSubtle
|
||||||
isSeeking: root.isSeeking
|
isSeeking: root.isSeeking
|
||||||
onIsSeekingChanged: root.isSeeking = isSeeking
|
onIsSeekingChanged: root.isSeeking = isSeeking
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ Item {
|
|||||||
LayoutMirroring.enabled: I18n.isRtl
|
LayoutMirroring.enabled: I18n.isRtl
|
||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
|
readonly property int overviewGridHeight: 410
|
||||||
|
readonly property int dankConnectCardHeight: 124
|
||||||
|
|
||||||
implicitWidth: SettingsData.showWeekNumber ? 736 : 700
|
implicitWidth: SettingsData.showWeekNumber ? 736 : 700
|
||||||
implicitHeight: 410
|
implicitHeight: overviewGridHeight + Theme.spacingM + dankConnectCardHeight
|
||||||
|
|
||||||
signal switchToWeatherTab
|
signal switchToWeatherTab
|
||||||
signal switchToMediaTab
|
signal switchToMediaTab
|
||||||
@@ -89,5 +92,12 @@ Item {
|
|||||||
|
|
||||||
onClicked: root.switchToMediaTab()
|
onClicked: root.switchToMediaTab()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankConnectOverviewCard {
|
||||||
|
x: 0
|
||||||
|
y: root.overviewGridHeight + Theme.spacingM
|
||||||
|
width: parent.width
|
||||||
|
height: root.dankConnectCardHeight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,10 +114,6 @@ Item {
|
|||||||
readonly property real positionSpacing: barSpacing + effectiveDockBottomGap + effectiveDockMargin
|
readonly property real positionSpacing: barSpacing + effectiveDockBottomGap + effectiveDockMargin
|
||||||
readonly property real joinedEdgeMargin: dockGeometry.joinedEdgeMargin
|
readonly property real joinedEdgeMargin: dockGeometry.joinedEdgeMargin
|
||||||
readonly property real _dpr: (dock.screen && dock.screen.devicePixelRatio) ? dock.screen.devicePixelRatio : 1
|
readonly property real _dpr: (dock.screen && dock.screen.devicePixelRatio) ? dock.screen.devicePixelRatio : 1
|
||||||
function px(v) {
|
|
||||||
return Math.round(v * _dpr) / _dpr;
|
|
||||||
}
|
|
||||||
|
|
||||||
DockGeometry {
|
DockGeometry {
|
||||||
id: dockGeometry
|
id: dockGeometry
|
||||||
|
|
||||||
@@ -397,8 +393,8 @@ Item {
|
|||||||
|
|
||||||
property real animationHeadroom: Math.ceil(SettingsData.dockIconSize * 0.35)
|
property real animationHeadroom: Math.ceil(SettingsData.dockIconSize * 0.35)
|
||||||
|
|
||||||
readonly property real surfaceImplicitWidth: isVertical ? (px(dockGeometry.surfaceThickness + SettingsData.dockIconSize * 0.3) + animationHeadroom) : 0
|
readonly property real surfaceImplicitWidth: isVertical ? (Theme.px(dockGeometry.surfaceThickness + SettingsData.dockIconSize * 0.3, _dpr) + animationHeadroom) : 0
|
||||||
readonly property real surfaceImplicitHeight: !isVertical ? (px(dockGeometry.surfaceThickness + SettingsData.dockIconSize * 0.3) + animationHeadroom) : 0
|
readonly property real surfaceImplicitHeight: !isVertical ? (Theme.px(dockGeometry.surfaceThickness + SettingsData.dockIconSize * 0.3, _dpr) + animationHeadroom) : 0
|
||||||
|
|
||||||
readonly property real blurX: dockBackground.x + dockContainer.x + dockMouseArea.x + dockCore.x + dockSlide.x
|
readonly property real blurX: dockBackground.x + dockContainer.x + dockMouseArea.x + dockCore.x + dockSlide.x
|
||||||
readonly property real blurY: dockBackground.y + dockContainer.y + dockMouseArea.y + dockCore.y + dockSlide.y
|
readonly property real blurY: dockBackground.y + dockContainer.y + dockMouseArea.y + dockCore.y + dockSlide.y
|
||||||
@@ -585,11 +581,11 @@ Item {
|
|||||||
// Keep the taller hit area regardless of the reveal state to prevent shrinking loop
|
// Keep the taller hit area regardless of the reveal state to prevent shrinking loop
|
||||||
return Math.min(Math.max(dockBackground.height + 64, 200), maxDockHeight);
|
return Math.min(Math.max(dockBackground.height + 64, 200), maxDockHeight);
|
||||||
}
|
}
|
||||||
return dock.reveal ? px(dockGeometry.motionThickness) : 1;
|
return dock.reveal ? Theme.px(dockGeometry.motionThickness, _dpr) : 1;
|
||||||
}
|
}
|
||||||
width: {
|
width: {
|
||||||
if (dock.isVertical) {
|
if (dock.isVertical) {
|
||||||
return dock.reveal ? px(dockGeometry.motionThickness) : 1;
|
return dock.reveal ? Theme.px(dockGeometry.motionThickness, _dpr) : 1;
|
||||||
}
|
}
|
||||||
// Keep the wider hit area regardless of the reveal state to prevent shrinking loop
|
// Keep the wider hit area regardless of the reveal state to prevent shrinking loop
|
||||||
return Math.min(dockBackground.width + 8 + dock.borderThickness, maxDockWidth);
|
return Math.min(dockBackground.width + 8 + dock.borderThickness, maxDockWidth);
|
||||||
|
|||||||
@@ -19,17 +19,12 @@ QtObject {
|
|||||||
property real barSpacing: 0
|
property real barSpacing: 0
|
||||||
property real dpr: 1
|
property real dpr: 1
|
||||||
|
|
||||||
function px(value) {
|
|
||||||
return Math.round(value * dpr) / dpr;
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen)
|
readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen)
|
||||||
readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen)
|
readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen)
|
||||||
readonly property bool connectedBarActiveOnEdge: usesConnectedFrameChrome && !!screen && SettingsData.getActiveBarEdgesForScreen(screen).includes(edge)
|
|
||||||
|
|
||||||
readonly property real connectedJoinInset: {
|
readonly property real connectedJoinInset: {
|
||||||
if (usesConnectedFrameChrome)
|
if (usesConnectedFrameChrome)
|
||||||
return connectedBarActiveOnEdge ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
return SettingsData.frameEdgeReservation(screen, edge);
|
||||||
if (frameExclusionActive)
|
if (frameExclusionActive)
|
||||||
return SettingsData.frameEdgeInsetForSide(screen, edge);
|
return SettingsData.frameEdgeInsetForSide(screen, edge);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -56,6 +51,6 @@ QtObject {
|
|||||||
|
|
||||||
// Frame/bar edge exclusions already reserve the edge itself, so the dock
|
// Frame/bar edge exclusions already reserve the edge itself, so the dock
|
||||||
// reservation covers only the dock body and user offset beyond that edge.
|
// reservation covers only the dock body and user offset beyond that edge.
|
||||||
readonly property real reserveZone: px(bodyThickness + reserveOffset + effectiveMargin)
|
readonly property real reserveZone: Theme.px(bodyThickness + reserveOffset + effectiveMargin, dpr)
|
||||||
readonly property bool shouldReserveSpace: dockVisible && !autoHide && barSpacing <= 0
|
readonly property bool shouldReserveSpace: dockVisible && !autoHide && barSpacing <= 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exclusionSizeForEdge(edge) {
|
function exclusionSizeForEdge(edge) {
|
||||||
return root.barEdges.includes(edge) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
return SettingsData.frameEdgeReservation(root.screen, edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -262,10 +262,22 @@ PanelWindow {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
readonly property int cutoutTopInset: {
|
||||||
readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
SettingsData.barConfigs;
|
||||||
readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "top"));
|
||||||
readonly property int cutoutRightInset: win._regionInt(barEdges.includes("right") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
}
|
||||||
|
readonly property int cutoutBottomInset: {
|
||||||
|
SettingsData.barConfigs;
|
||||||
|
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "bottom"));
|
||||||
|
}
|
||||||
|
readonly property int cutoutLeftInset: {
|
||||||
|
SettingsData.barConfigs;
|
||||||
|
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "left"));
|
||||||
|
}
|
||||||
|
readonly property int cutoutRightInset: {
|
||||||
|
SettingsData.barConfigs;
|
||||||
|
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "right"));
|
||||||
|
}
|
||||||
readonly property int cutoutWidth: Math.max(0, win._windowRegionWidth - win.cutoutLeftInset - win.cutoutRightInset)
|
readonly property int cutoutWidth: Math.max(0, win._windowRegionWidth - win.cutoutLeftInset - win.cutoutRightInset)
|
||||||
readonly property int cutoutHeight: Math.max(0, win._windowRegionHeight - win.cutoutTopInset - win.cutoutBottomInset)
|
readonly property int cutoutHeight: Math.max(0, win._windowRegionHeight - win.cutoutTopInset - win.cutoutBottomInset)
|
||||||
readonly property int cutoutRadius: {
|
readonly property int cutoutRadius: {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import QtQuick
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../../Common/Format.js" as Format
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -22,36 +23,8 @@ Rectangle {
|
|||||||
onTriggered: root.nowMs = Date.now()
|
onTriggered: root.nowMs = Date.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
function _pad2(n) {
|
|
||||||
return n < 10 ? "0" + n : "" + n;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatRemaining(ms) {
|
function formatRemaining(ms) {
|
||||||
if (ms <= 0)
|
return Format.formatRemaining(ms, I18n.tr("Off"), I18n.tr("%1 min left"), I18n.tr("%1 h left"), I18n.tr("%1 h %2 m left"));
|
||||||
return I18n.tr("Off");
|
|
||||||
const totalMinutes = Math.ceil(ms / 60000);
|
|
||||||
if (totalMinutes < 60)
|
|
||||||
return I18n.tr("%1 min left").arg(totalMinutes);
|
|
||||||
const hours = Math.floor(totalMinutes / 60);
|
|
||||||
const mins = totalMinutes - hours * 60;
|
|
||||||
if (mins === 0)
|
|
||||||
return I18n.tr("%1 h left").arg(hours);
|
|
||||||
return I18n.tr("%1 h %2 m left").arg(hours).arg(mins);
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatUntilTimestamp(ts) {
|
|
||||||
if (!ts)
|
|
||||||
return "";
|
|
||||||
const d = new Date(ts);
|
|
||||||
const hours = d.getHours();
|
|
||||||
const minutes = d.getMinutes();
|
|
||||||
const use24h = (typeof SettingsData !== "undefined") ? SettingsData.use24HourClock : true;
|
|
||||||
if (use24h) {
|
|
||||||
return _pad2(hours) + ":" + _pad2(minutes);
|
|
||||||
}
|
|
||||||
const suffix = hours >= 12 ? "PM" : "AM";
|
|
||||||
const h12 = ((hours + 11) % 12) + 1;
|
|
||||||
return h12 + ":" + _pad2(minutes) + " " + suffix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function minutesUntilTomorrowMorning() {
|
function minutesUntilTomorrowMorning() {
|
||||||
@@ -149,7 +122,7 @@ Rectangle {
|
|||||||
visible: root.currentlyActive
|
visible: root.currentlyActive
|
||||||
text: {
|
text: {
|
||||||
if (SessionData.doNotDisturbUntil > 0) {
|
if (SessionData.doNotDisturbUntil > 0) {
|
||||||
return root.formatRemaining(root.currentRemainingMs) + " · " + I18n.tr("until %1").arg(root.formatUntilTimestamp(SessionData.doNotDisturbUntil));
|
return root.formatRemaining(root.currentRemainingMs) + " · " + I18n.tr("until %1").arg(Format.formatUntil(SessionData.doNotDisturbUntil, SettingsData.use24HourClock));
|
||||||
}
|
}
|
||||||
return I18n.tr("On indefinitely");
|
return I18n.tr("On indefinitely");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,14 +31,16 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property point anchorPos: Qt.point(0, 0)
|
property point anchorPos: Qt.point(0, 0)
|
||||||
property string anchorEdge: "top"
|
property bool isVertical: false
|
||||||
|
property string edge: "top"
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
function showAt(x, y, targetScreen, edge) {
|
function showAt(x, y, vertical, barEdge, targetScreen) {
|
||||||
if (targetScreen)
|
if (targetScreen)
|
||||||
root.screen = targetScreen;
|
root.screen = targetScreen;
|
||||||
anchorPos = Qt.point(x, y);
|
anchorPos = Qt.point(x, y);
|
||||||
anchorEdge = edge || "top";
|
isVertical = vertical ?? false;
|
||||||
|
edge = barEdge ?? "top";
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,21 +68,19 @@ PanelWindow {
|
|||||||
visible: root.visible
|
visible: root.visible
|
||||||
|
|
||||||
x: {
|
x: {
|
||||||
const left = 10;
|
if (root.isVertical) {
|
||||||
const right = root.width - width - 10;
|
if (root.edge === "left")
|
||||||
const want = root.anchorPos.x - width / 2;
|
return Math.min(root.width - width - 10, root.anchorPos.x);
|
||||||
return Math.max(left, Math.min(right, want));
|
return Math.max(10, root.anchorPos.x - width);
|
||||||
|
}
|
||||||
|
return Math.max(10, Math.min(root.width - width - 10, root.anchorPos.x - width / 2));
|
||||||
}
|
}
|
||||||
y: {
|
y: {
|
||||||
switch (root.anchorEdge) {
|
if (root.isVertical)
|
||||||
case "bottom":
|
|
||||||
return Math.max(10, root.anchorPos.y - height);
|
|
||||||
case "left":
|
|
||||||
case "right":
|
|
||||||
return Math.max(10, Math.min(root.height - height - 10, root.anchorPos.y - height / 2));
|
return Math.max(10, Math.min(root.height - height - 10, root.anchorPos.y - height / 2));
|
||||||
default:
|
if (root.edge === "bottom")
|
||||||
return Math.min(root.height - height - 10, root.anchorPos.y);
|
return Math.max(10, root.anchorPos.y - height);
|
||||||
}
|
return Math.min(root.height - height - 10, root.anchorPos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDismissed: root.closeMenu()
|
onDismissed: root.closeMenu()
|
||||||
|
|||||||
@@ -27,6 +27,36 @@ Rectangle {
|
|||||||
readonly property real collapsedContentHeight: iconSize + cardPadding
|
readonly property real collapsedContentHeight: iconSize + cardPadding
|
||||||
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight
|
readonly property real baseCardHeight: cardPadding * 2 + collapsedContentHeight
|
||||||
|
|
||||||
|
function formatHistoryTime(timestamp) {
|
||||||
|
NotificationService.timeUpdateTick;
|
||||||
|
NotificationService.clockFormatChanged;
|
||||||
|
const now = new Date();
|
||||||
|
const date = new Date(timestamp);
|
||||||
|
const diff = now.getTime() - timestamp;
|
||||||
|
const minutes = Math.floor(diff / 60000);
|
||||||
|
const hours = Math.floor(minutes / 60);
|
||||||
|
if (hours < 1) {
|
||||||
|
if (minutes < 1)
|
||||||
|
return I18n.tr("now");
|
||||||
|
return I18n.tr("%1m ago").arg(minutes);
|
||||||
|
}
|
||||||
|
const nowDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||||
|
const itemDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||||
|
const daysDiff = Math.floor((nowDate - itemDate) / (1000 * 60 * 60 * 24));
|
||||||
|
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 I18n !== "undefined" && I18n.locale) ? I18n.locale().name : "en-US";
|
||||||
|
const weekday = date.toLocaleDateString(localeName, {
|
||||||
|
weekday: "long"
|
||||||
|
});
|
||||||
|
return weekday + ", " + timeStr;
|
||||||
|
} catch (e) {
|
||||||
|
return timeStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: parent ? parent.width : 400
|
width: parent ? parent.width : 400
|
||||||
height: baseCardHeight + contentItem.extraHeight
|
height: baseCardHeight + contentItem.extraHeight
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -219,7 +249,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
id: historyTimeText
|
id: historyTimeText
|
||||||
text: NotificationService.formatHistoryTime(historyItem.timestamp)
|
text: root.formatHistoryTime(historyItem.timestamp)
|
||||||
color: Theme.surfaceTextMedium
|
color: Theme.surfaceTextMedium
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
|
|||||||
@@ -360,8 +360,7 @@ QtObject {
|
|||||||
function _frameEdgeInset(side) {
|
function _frameEdgeInset(side) {
|
||||||
if (!manager.modelData)
|
if (!manager.modelData)
|
||||||
return 0;
|
return 0;
|
||||||
const edges = SettingsData.getActiveBarEdgesForScreen(manager.modelData);
|
const raw = SettingsData.frameEdgeReservation(manager.modelData, side);
|
||||||
const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
|
||||||
const dpr = CompositorService.getScreenScale(manager.modelData);
|
const dpr = CompositorService.getScreenScale(manager.modelData);
|
||||||
return Math.max(0, Math.round(Theme.px(raw, dpr)));
|
return Math.max(0, Math.round(Theme.px(raw, dpr)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import QtQuick
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -18,7 +19,7 @@ Column {
|
|||||||
property bool isInitialized: false
|
property bool isInitialized: false
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings && settings.pluginService) {
|
if (settings && settings.pluginService) {
|
||||||
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
||||||
value = loadedValue;
|
value = loadedValue;
|
||||||
@@ -33,23 +34,12 @@ Column {
|
|||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
if (!isInitialized)
|
if (!isInitialized)
|
||||||
return;
|
return;
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, value);
|
settings.saveValue(settingKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.label
|
text: root.label
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -16,30 +17,19 @@ Column {
|
|||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
items = settings.loadValue(settingKey, defaultValue);
|
items = settings.loadValue(settingKey, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemsChanged: {
|
onItemsChanged: {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, items);
|
settings.saveValue(settingKey, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addItem(item) {
|
function addItem(item) {
|
||||||
items = items.concat([item]);
|
items = items.concat([item]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -22,7 +23,7 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
items = settings.loadValue(settingKey, defaultValue);
|
items = settings.loadValue(settingKey, defaultValue);
|
||||||
@@ -34,23 +35,12 @@ Column {
|
|||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, items);
|
settings.saveValue(settingKey, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addItem(item) {
|
function addItem(item) {
|
||||||
items = items.concat([item]);
|
items = items.concat([item]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import qs.Common
|
|
||||||
import qs.Services
|
|
||||||
import qs.Widgets
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string pluginId: ""
|
|
||||||
property var pluginInstance: null
|
|
||||||
property bool isCompoundPill: false
|
|
||||||
property bool isSmallToggle: false
|
|
||||||
|
|
||||||
readonly property bool hasDetail: pluginInstance?.ccDetailContent !== null
|
|
||||||
readonly property string iconName: pluginInstance?.ccWidgetIcon || "extension"
|
|
||||||
readonly property string primaryText: pluginInstance?.ccWidgetPrimaryText || "Plugin"
|
|
||||||
readonly property string secondaryText: pluginInstance?.ccWidgetSecondaryText || ""
|
|
||||||
readonly property bool isActive: pluginInstance?.ccWidgetIsActive || false
|
|
||||||
readonly property Component detailContent: pluginInstance?.ccDetailContent || null
|
|
||||||
readonly property real detailHeight: pluginInstance?.ccDetailHeight || 250
|
|
||||||
|
|
||||||
signal toggled
|
|
||||||
signal expanded
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (pluginInstance) {
|
|
||||||
pluginInstance.ccWidgetToggled.connect(toggled);
|
|
||||||
pluginInstance.ccWidgetExpanded.connect(expanded);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function invokeToggle() {
|
|
||||||
if (pluginInstance) {
|
|
||||||
pluginInstance.ccWidgetToggled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function invokeExpand() {
|
|
||||||
if (pluginInstance) {
|
|
||||||
pluginInstance.ccWidgetExpanded();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -16,68 +17,57 @@ Column {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings()
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings && settings.pluginService) {
|
if (settings && settings.pluginService) {
|
||||||
value = settings.loadValue(settingKey, defaultValue)
|
value = settings.loadValue(settingKey, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadValue()
|
loadValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var optionLabels: {
|
readonly property var optionLabels: {
|
||||||
const labels = []
|
const labels = [];
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
labels.push(options[i].label || options[i])
|
labels.push(options[i].label || options[i]);
|
||||||
}
|
}
|
||||||
return labels
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var valueToLabel: {
|
readonly property var valueToLabel: {
|
||||||
const map = {}
|
const map = {};
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
const opt = options[i]
|
const opt = options[i];
|
||||||
if (typeof opt === 'object') {
|
if (typeof opt === 'object') {
|
||||||
map[opt.value] = opt.label
|
map[opt.value] = opt.label;
|
||||||
} else {
|
} else {
|
||||||
map[opt] = opt
|
map[opt] = opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var labelToValue: {
|
readonly property var labelToValue: {
|
||||||
const map = {}
|
const map = {};
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
const opt = options[i]
|
const opt = options[i];
|
||||||
if (typeof opt === 'object') {
|
if (typeof opt === 'object') {
|
||||||
map[opt.label] = opt.value
|
map[opt.label] = opt.value;
|
||||||
} else {
|
} else {
|
||||||
map[opt] = opt
|
map[opt] = opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
const settings = findSettings()
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, value)
|
settings.saveValue(settingKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item
|
|
||||||
}
|
|
||||||
item = item.parent
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
DankDropdown {
|
DankDropdown {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: root.label
|
text: root.label
|
||||||
@@ -85,7 +75,7 @@ Column {
|
|||||||
currentValue: root.valueToLabel[root.value] || root.value
|
currentValue: root.valueToLabel[root.value] || root.value
|
||||||
options: root.optionLabels
|
options: root.optionLabels
|
||||||
onValueChanged: newValue => {
|
onValueChanged: newValue => {
|
||||||
root.value = root.labelToValue[newValue] || newValue
|
root.value = root.labelToValue[newValue] || newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -20,7 +21,7 @@ Column {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings && settings.pluginService) {
|
if (settings && settings.pluginService) {
|
||||||
value = settings.loadValue(settingKey, defaultValue);
|
value = settings.loadValue(settingKey, defaultValue);
|
||||||
}
|
}
|
||||||
@@ -31,23 +32,12 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, value);
|
settings.saveValue(settingKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.label
|
text: root.label
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
@@ -18,7 +19,7 @@ Column {
|
|||||||
property bool isInitialized: false
|
property bool isInitialized: false
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings && settings.pluginService) {
|
if (settings && settings.pluginService) {
|
||||||
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
||||||
if (textField.activeFocus && isInitialized)
|
if (textField.activeFocus && isInitialized)
|
||||||
@@ -39,22 +40,11 @@ Column {
|
|||||||
if (textField.text === value)
|
if (textField.text === value)
|
||||||
return;
|
return;
|
||||||
value = textField.text;
|
value = textField.text;
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings)
|
if (settings)
|
||||||
settings.saveValue(settingKey, value);
|
settings.saveValue(settingKey, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.label
|
text: root.label
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/QmlUtils.js" as QmlUtils
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: root
|
id: root
|
||||||
@@ -17,7 +18,7 @@ Row {
|
|||||||
property bool isInitialized: false
|
property bool isInitialized: false
|
||||||
|
|
||||||
function loadValue() {
|
function loadValue() {
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings && settings.pluginService) {
|
if (settings && settings.pluginService) {
|
||||||
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
const loadedValue = settings.loadValue(settingKey, defaultValue);
|
||||||
value = loadedValue;
|
value = loadedValue;
|
||||||
@@ -32,23 +33,12 @@ Row {
|
|||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
if (!isInitialized)
|
if (!isInitialized)
|
||||||
return;
|
return;
|
||||||
const settings = findSettings();
|
const settings = QmlUtils.findSettings(root.parent);
|
||||||
if (settings) {
|
if (settings) {
|
||||||
settings.saveValue(settingKey, value);
|
settings.saveValue(settingKey, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSettings() {
|
|
||||||
let item = parent;
|
|
||||||
while (item) {
|
|
||||||
if (item.saveValue !== undefined && item.loadValue !== undefined) {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
item = item.parent;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width - toggle.width - Theme.spacingM
|
width: parent.width - toggle.width - Theme.spacingM
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|||||||
@@ -3,20 +3,11 @@ import QtQuick.Layouts
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/Format.js" as Format
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
function formatSpeed(bytesPerSec) {
|
|
||||||
if (bytesPerSec < 1024)
|
|
||||||
return bytesPerSec.toFixed(0) + " B/s";
|
|
||||||
if (bytesPerSec < 1024 * 1024)
|
|
||||||
return (bytesPerSec / 1024).toFixed(1) + " KB/s";
|
|
||||||
if (bytesPerSec < 1024 * 1024 * 1024)
|
|
||||||
return (bytesPerSec / (1024 * 1024)).toFixed(1) + " MB/s";
|
|
||||||
return (bytesPerSec / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
DgopService.addRef(["disk", "diskmounts"]);
|
DgopService.addRef(["disk", "diskmounts"]);
|
||||||
}
|
}
|
||||||
@@ -76,7 +67,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatSpeed(DgopService.diskReadRate)
|
text: Format.formatRate(DgopService.diskReadRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -94,7 +85,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: root.formatSpeed(DgopService.diskWriteRate)
|
text: Format.formatRate(DgopService.diskWriteRate)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Quickshell
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import "../../Common/Format.js" as Format
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -17,31 +18,13 @@ Item {
|
|||||||
property var diskReadHistory: []
|
property var diskReadHistory: []
|
||||||
property var diskWriteHistory: []
|
property var diskWriteHistory: []
|
||||||
|
|
||||||
function formatBytes(bytes) {
|
|
||||||
if (bytes < 1024)
|
|
||||||
return bytes.toFixed(0) + " B/s";
|
|
||||||
if (bytes < 1024 * 1024)
|
|
||||||
return (bytes / 1024).toFixed(1) + " KB/s";
|
|
||||||
if (bytes < 1024 * 1024 * 1024)
|
|
||||||
return (bytes / (1024 * 1024)).toFixed(1) + " MB/s";
|
|
||||||
return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB/s";
|
|
||||||
}
|
|
||||||
|
|
||||||
function addToHistory(arr, val) {
|
|
||||||
const newArr = arr.slice();
|
|
||||||
newArr.push(val);
|
|
||||||
if (newArr.length > historySize)
|
|
||||||
newArr.shift();
|
|
||||||
return newArr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sampleData() {
|
function sampleData() {
|
||||||
cpuHistory = addToHistory(cpuHistory, DgopService.cpuUsage);
|
cpuHistory = Format.addToHistory(cpuHistory, DgopService.cpuUsage, historySize);
|
||||||
memoryHistory = addToHistory(memoryHistory, DgopService.memoryUsage);
|
memoryHistory = Format.addToHistory(memoryHistory, DgopService.memoryUsage, historySize);
|
||||||
networkRxHistory = addToHistory(networkRxHistory, DgopService.networkRxRate);
|
networkRxHistory = Format.addToHistory(networkRxHistory, DgopService.networkRxRate, historySize);
|
||||||
networkTxHistory = addToHistory(networkTxHistory, DgopService.networkTxRate);
|
networkTxHistory = Format.addToHistory(networkTxHistory, DgopService.networkTxRate, historySize);
|
||||||
diskReadHistory = addToHistory(diskReadHistory, DgopService.diskReadRate);
|
diskReadHistory = Format.addToHistory(diskReadHistory, DgopService.diskReadRate, historySize);
|
||||||
diskWriteHistory = addToHistory(diskWriteHistory, DgopService.diskWriteRate);
|
diskWriteHistory = Format.addToHistory(diskWriteHistory, DgopService.diskWriteRate, historySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@@ -111,8 +94,8 @@ Item {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
title: I18n.tr("Network")
|
title: I18n.tr("Network")
|
||||||
icon: "swap_horiz"
|
icon: "swap_horiz"
|
||||||
value: "↓ " + root.formatBytes(DgopService.networkRxRate)
|
value: "↓ " + Format.formatRate(DgopService.networkRxRate)
|
||||||
subtitle: "↑ " + root.formatBytes(DgopService.networkTxRate)
|
subtitle: "↑ " + Format.formatRate(DgopService.networkTxRate)
|
||||||
accentColor: Theme.info
|
accentColor: Theme.info
|
||||||
history: root.networkRxHistory
|
history: root.networkRxHistory
|
||||||
history2: root.networkTxHistory
|
history2: root.networkTxHistory
|
||||||
@@ -127,8 +110,8 @@ Item {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
title: I18n.tr("Disk")
|
title: I18n.tr("Disk")
|
||||||
icon: "storage"
|
icon: "storage"
|
||||||
value: "R: " + root.formatBytes(DgopService.diskReadRate)
|
value: "R: " + Format.formatRate(DgopService.diskReadRate)
|
||||||
subtitle: "W: " + root.formatBytes(DgopService.diskWriteRate)
|
subtitle: "W: " + Format.formatRate(DgopService.diskWriteRate)
|
||||||
accentColor: Theme.warning
|
accentColor: Theme.warning
|
||||||
history: root.diskReadHistory
|
history: root.diskReadHistory
|
||||||
history2: root.diskWriteHistory
|
history2: root.diskWriteHistory
|
||||||
|
|||||||
@@ -36,6 +36,36 @@ Item {
|
|||||||
cachedProcesses = filteredProcesses;
|
cachedProcesses = filteredProcesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getProcessIcon(command) {
|
||||||
|
const cmd = command.toLowerCase();
|
||||||
|
if (cmd.includes("firefox") || cmd.includes("chrome") || cmd.includes("browser") || cmd.includes("chromium"))
|
||||||
|
return "web";
|
||||||
|
if (cmd.includes("code") || cmd.includes("editor") || cmd.includes("vim"))
|
||||||
|
return "code";
|
||||||
|
if (cmd.includes("terminal") || cmd.includes("bash") || cmd.includes("zsh"))
|
||||||
|
return "terminal";
|
||||||
|
if (cmd.includes("music") || cmd.includes("audio") || cmd.includes("spotify"))
|
||||||
|
return "music_note";
|
||||||
|
if (cmd.includes("video") || cmd.includes("vlc") || cmd.includes("mpv"))
|
||||||
|
return "play_circle";
|
||||||
|
if (cmd.includes("systemd") || cmd.includes("elogind") || cmd.includes("kernel") || cmd.includes("kthread") || cmd.includes("kworker"))
|
||||||
|
return "settings";
|
||||||
|
return "memory";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatCpuUsage(cpu) {
|
||||||
|
return (cpu || 0).toFixed(1) + "%";
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatMemoryUsage(memoryKB) {
|
||||||
|
const mem = memoryKB || 0;
|
||||||
|
if (mem < 1024)
|
||||||
|
return mem.toFixed(0) + " KB";
|
||||||
|
if (mem < 1024 * 1024)
|
||||||
|
return (mem / 1024).toFixed(1) + " MB";
|
||||||
|
return (mem / (1024 * 1024)).toFixed(1) + " GB";
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var filteredProcesses: {
|
readonly property var filteredProcesses: {
|
||||||
if (!DgopService.allProcesses || DgopService.allProcesses.length === 0)
|
if (!DgopService.allProcesses || DgopService.allProcesses.length === 0)
|
||||||
return [];
|
return [];
|
||||||
@@ -521,7 +551,7 @@ Item {
|
|||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: DgopService.getProcessIcon(processItemRoot.processCmd)
|
name: root.getProcessIcon(processItemRoot.processCmd)
|
||||||
size: Theme.iconSize - 4
|
size: Theme.iconSize - 4
|
||||||
color: {
|
color: {
|
||||||
if (processItemRoot.processCpu > 80)
|
if (processItemRoot.processCpu > 80)
|
||||||
@@ -566,7 +596,7 @@ Item {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: DgopService.formatCpuUsage(processItemRoot.processCpu)
|
text: root.formatCpuUsage(processItemRoot.processCpu)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
@@ -600,7 +630,7 @@ Item {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: DgopService.formatMemoryUsage(processItemRoot.processMemKB)
|
text: root.formatMemoryUsage(processItemRoot.processMemKB)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
|
|||||||
@@ -375,6 +375,8 @@ Item {
|
|||||||
visible: DesktopService.autostartAvailable
|
visible: DesktopService.autostartAvailable
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "autostartAddEntry"
|
||||||
|
tags: ["autostart", "add", "entry", "command", "startup"]
|
||||||
width: parent.width
|
width: parent.width
|
||||||
iconName: "add_circle"
|
iconName: "add_circle"
|
||||||
title: I18n.tr("Add Entry")
|
title: I18n.tr("Add Entry")
|
||||||
@@ -764,6 +766,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "autostartTrayIconFix"
|
||||||
|
tags: ["tray", "icons", "fix", "systemd"]
|
||||||
width: parent.width
|
width: parent.width
|
||||||
iconName: "handyman"
|
iconName: "handyman"
|
||||||
title: I18n.tr("Tray Icon Fix")
|
title: I18n.tr("Tray Icon Fix")
|
||||||
|
|||||||
@@ -463,6 +463,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "barEnable"
|
||||||
iconName: selectedBarConfig?.enabled ? "visibility" : "visibility_off"
|
iconName: selectedBarConfig?.enabled ? "visibility" : "visibility_off"
|
||||||
title: I18n.tr("Enable Bar")
|
title: I18n.tr("Enable Bar")
|
||||||
visible: !dankBarTab.appearanceOnly && selectedBarId !== "default"
|
visible: !dankBarTab.appearanceOnly && selectedBarId !== "default"
|
||||||
@@ -651,6 +652,8 @@ Item {
|
|||||||
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barAutoHide"
|
||||||
|
tags: ["autohide", "auto-hide", "reveal", "intellihide"]
|
||||||
text: I18n.tr("Auto-hide")
|
text: I18n.tr("Auto-hide")
|
||||||
description: I18n.tr("Automatically hide the bar when the pointer moves away")
|
description: I18n.tr("Automatically hide the bar when the pointer moves away")
|
||||||
checked: selectedBarConfig?.autoHide ?? false
|
checked: selectedBarConfig?.autoHide ?? false
|
||||||
@@ -700,6 +703,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barAutoHideStrict"
|
||||||
|
tags: ["autohide", "strict", "popout"]
|
||||||
width: parent.width - parent.leftPadding
|
width: parent.width - parent.leftPadding
|
||||||
text: I18n.tr("Strict auto-hide", "Dank bar setting: hide the bar when the pointer leaves even if a menu or bar popover is still open")
|
text: I18n.tr("Strict auto-hide", "Dank bar setting: hide the bar when the pointer leaves even if a menu or bar popover is still open")
|
||||||
description: I18n.tr("Hide the bar when the pointer leaves even if a popout is still open")
|
description: I18n.tr("Hide the bar when the pointer leaves even if a popout is still open")
|
||||||
@@ -713,6 +718,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barHideWhenWindowsOpen"
|
||||||
|
tags: ["hide", "windows", "empty", "workspace"]
|
||||||
width: parent.width - parent.leftPadding
|
width: parent.width - parent.leftPadding
|
||||||
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isMango
|
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isMango
|
||||||
text: I18n.tr("Hide When Windows Open")
|
text: I18n.tr("Hide When Windows Open")
|
||||||
@@ -734,6 +741,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barManualVisibility"
|
||||||
|
tags: ["manual", "show", "hide", "ipc", "toggle"]
|
||||||
text: I18n.tr("Manual Show/Hide")
|
text: I18n.tr("Manual Show/Hide")
|
||||||
description: I18n.tr("Toggle bar visibility manually via IPC")
|
description: I18n.tr("Toggle bar visibility manually via IPC")
|
||||||
checked: selectedBarConfig?.visible ?? true
|
checked: selectedBarConfig?.visible ?? true
|
||||||
@@ -753,6 +762,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barClickThrough"
|
||||||
|
tags: ["clickthrough", "click", "through", "mouse", "input", "mask", "passthrough"]
|
||||||
text: I18n.tr("Click Through")
|
text: I18n.tr("Click Through")
|
||||||
description: I18n.tr("Mouse clicks pass through the bar to windows behind it")
|
description: I18n.tr("Mouse clicks pass through the bar to windows behind it")
|
||||||
checked: selectedBarConfig?.clickThrough ?? false
|
checked: selectedBarConfig?.clickThrough ?? false
|
||||||
@@ -908,6 +919,8 @@ Item {
|
|||||||
|
|
||||||
SettingsSliderRow {
|
SettingsSliderRow {
|
||||||
id: exclusiveZoneSlider
|
id: exclusiveZoneSlider
|
||||||
|
settingKey: "barExclusiveZone"
|
||||||
|
tags: ["exclusive", "zone", "reserved", "offset"]
|
||||||
visible: !SettingsData.frameEnabled
|
visible: !SettingsData.frameEnabled
|
||||||
text: I18n.tr("Exclusive Zone Offset")
|
text: I18n.tr("Exclusive Zone Offset")
|
||||||
description: I18n.tr("Fine-tune the space reserved for the bar from the screen edge")
|
description: I18n.tr("Fine-tune the space reserved for the bar from the screen edge")
|
||||||
@@ -931,6 +944,8 @@ Item {
|
|||||||
|
|
||||||
SettingsSliderRow {
|
SettingsSliderRow {
|
||||||
id: sizeSlider
|
id: sizeSlider
|
||||||
|
settingKey: "barSize"
|
||||||
|
tags: ["size", "thickness", "height", "inner"]
|
||||||
visible: !SettingsData.frameEnabled
|
visible: !SettingsData.frameEnabled
|
||||||
text: I18n.tr("Size")
|
text: I18n.tr("Size")
|
||||||
description: I18n.tr("Adjust the bar height via inner padding")
|
description: I18n.tr("Adjust the bar height via inner padding")
|
||||||
@@ -1152,6 +1167,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barSquareCorners"
|
||||||
|
tags: ["square", "corners", "rounding"]
|
||||||
text: I18n.tr("Square Corners")
|
text: I18n.tr("Square Corners")
|
||||||
description: I18n.tr("Remove corner rounding from the bar")
|
description: I18n.tr("Remove corner rounding from the bar")
|
||||||
visible: !SettingsData.frameEnabled
|
visible: !SettingsData.frameEnabled
|
||||||
@@ -1162,6 +1179,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barNoBackground"
|
||||||
|
tags: ["transparent", "background", "invisible"]
|
||||||
text: I18n.tr("No Background")
|
text: I18n.tr("No Background")
|
||||||
description: I18n.tr("Make the bar background fully transparent")
|
description: I18n.tr("Make the bar background fully transparent")
|
||||||
visible: !SettingsData.frameEnabled
|
visible: !SettingsData.frameEnabled
|
||||||
@@ -1172,6 +1191,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barMaximizeWidgetIcons"
|
||||||
|
tags: ["maximize", "icons", "stretch"]
|
||||||
text: I18n.tr("Maximize Widget Icons")
|
text: I18n.tr("Maximize Widget Icons")
|
||||||
description: I18n.tr("Stretch widget icons to fill the available bar height")
|
description: I18n.tr("Stretch widget icons to fill the available bar height")
|
||||||
checked: selectedBarConfig?.maximizeWidgetIcons ?? false
|
checked: selectedBarConfig?.maximizeWidgetIcons ?? false
|
||||||
@@ -1181,6 +1202,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barMaximizeWidgetText"
|
||||||
|
tags: ["maximize", "text", "stretch"]
|
||||||
text: I18n.tr("Maximize Widget Text")
|
text: I18n.tr("Maximize Widget Text")
|
||||||
description: I18n.tr("Stretch widget text to fill the available bar height")
|
description: I18n.tr("Stretch widget text to fill the available bar height")
|
||||||
checked: selectedBarConfig?.maximizeWidgetText ?? false
|
checked: selectedBarConfig?.maximizeWidgetText ?? false
|
||||||
@@ -1190,6 +1213,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barRemoveWidgetPadding"
|
||||||
|
tags: ["padding", "compact", "widgets"]
|
||||||
text: I18n.tr("Remove Widget Padding")
|
text: I18n.tr("Remove Widget Padding")
|
||||||
description: I18n.tr("Remove inner padding from all widgets")
|
description: I18n.tr("Remove inner padding from all widgets")
|
||||||
checked: selectedBarConfig?.removeWidgetPadding ?? false
|
checked: selectedBarConfig?.removeWidgetPadding ?? false
|
||||||
@@ -1206,6 +1231,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleRow {
|
SettingsToggleRow {
|
||||||
|
settingKey: "barGothCorners"
|
||||||
|
tags: ["goth", "corners", "concave", "cutout"]
|
||||||
text: I18n.tr("Goth Corners")
|
text: I18n.tr("Goth Corners")
|
||||||
description: I18n.tr("Apply inverse concave corner cutouts to the bar")
|
description: I18n.tr("Apply inverse concave corner cutouts to the bar")
|
||||||
visible: !SettingsData.frameEnabled
|
visible: !SettingsData.frameEnabled
|
||||||
@@ -1302,6 +1329,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsToggleCard {
|
SettingsToggleCard {
|
||||||
|
settingKey: "barMaximizeDetection"
|
||||||
|
tags: ["maximize", "gaps", "border", "fullscreen"]
|
||||||
iconName: "fit_screen"
|
iconName: "fit_screen"
|
||||||
title: I18n.tr("Maximize Detection")
|
title: I18n.tr("Maximize Detection")
|
||||||
description: I18n.tr("Remove gaps and border when windows are maximized")
|
description: I18n.tr("Remove gaps and border when windows are maximized")
|
||||||
@@ -1844,6 +1873,8 @@ Item {
|
|||||||
|
|
||||||
SettingsToggleCard {
|
SettingsToggleCard {
|
||||||
iconName: "mouse"
|
iconName: "mouse"
|
||||||
|
settingKey: "barScrollWheel"
|
||||||
|
tags: ["scroll", "wheel", "workspace", "axis"]
|
||||||
title: I18n.tr("Scroll Wheel")
|
title: I18n.tr("Scroll Wheel")
|
||||||
description: I18n.tr("Control workspaces and columns by scrolling on the bar")
|
description: I18n.tr("Control workspaces and columns by scrolling on the bar")
|
||||||
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled
|
||||||
|
|||||||
@@ -267,6 +267,8 @@ Item {
|
|||||||
spacing: Theme.spacingXL
|
spacing: Theme.spacingXL
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "defaultAppsInternet"
|
||||||
|
tags: ["browser", "mail", "email", "web"]
|
||||||
title: I18n.tr("Internet", "Internet")
|
title: I18n.tr("Internet", "Internet")
|
||||||
iconName: "public"
|
iconName: "public"
|
||||||
|
|
||||||
@@ -293,6 +295,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "defaultAppsUtilities"
|
||||||
|
tags: ["file", "manager", "terminal", "editor"]
|
||||||
title: I18n.tr("Utilities", "Utilities")
|
title: I18n.tr("Utilities", "Utilities")
|
||||||
iconName: "terminal"
|
iconName: "terminal"
|
||||||
|
|
||||||
@@ -316,6 +320,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "defaultAppsDocuments"
|
||||||
|
tags: ["pdf", "text", "reader", "office"]
|
||||||
title: I18n.tr("Documents", "Documents")
|
title: I18n.tr("Documents", "Documents")
|
||||||
iconName: "edit_document"
|
iconName: "edit_document"
|
||||||
|
|
||||||
@@ -333,6 +339,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "defaultAppsMultimedia"
|
||||||
|
tags: ["image", "video", "music", "viewer", "player"]
|
||||||
title: I18n.tr("Multimedia", "Multimedia")
|
title: I18n.tr("Multimedia", "Multimedia")
|
||||||
iconName: "movie"
|
iconName: "movie"
|
||||||
AppSelector {
|
AppSelector {
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ Item {
|
|||||||
spacing: Theme.spacingXL
|
spacing: Theme.spacingXL
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "desktopWidgetsManage"
|
||||||
|
tags: ["desktop", "widgets", "clock", "conky"]
|
||||||
width: parent.width
|
width: parent.width
|
||||||
iconName: "widgets"
|
iconName: "widgets"
|
||||||
title: I18n.tr("Desktop Widgets")
|
title: I18n.tr("Desktop Widgets")
|
||||||
@@ -203,6 +205,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsCard {
|
SettingsCard {
|
||||||
|
settingKey: "desktopWidgetGroups"
|
||||||
|
tags: ["groups", "profiles", "layouts"]
|
||||||
width: parent.width
|
width: parent.width
|
||||||
iconName: "folder"
|
iconName: "folder"
|
||||||
title: I18n.tr("Groups")
|
title: I18n.tr("Groups")
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Singleton {
|
|||||||
readonly property var wlrOutputs: WlrOutputService.outputs
|
readonly property var wlrOutputs: WlrOutputService.outputs
|
||||||
property var outputs: ({})
|
property var outputs: ({})
|
||||||
property var savedOutputs: ({})
|
property var savedOutputs: ({})
|
||||||
|
property var savedParsedOutputs: ({})
|
||||||
property var allOutputs: buildAllOutputsMap()
|
property var allOutputs: buildAllOutputsMap()
|
||||||
|
|
||||||
property var includeStatus: ({
|
property var includeStatus: ({
|
||||||
@@ -386,7 +387,6 @@ Singleton {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract neutral per-output config from current live state
|
|
||||||
function extractOutputNeutralConfig(outputName, outputData, niriSettings, hyprlandSettings) {
|
function extractOutputNeutralConfig(outputName, outputData, niriSettings, hyprlandSettings) {
|
||||||
const modeData = (outputData.modes && outputData.current_mode !== undefined) ? outputData.modes[outputData.current_mode] : null;
|
const modeData = (outputData.modes && outputData.current_mode !== undefined) ? outputData.modes[outputData.current_mode] : null;
|
||||||
const modeStr = modeData ? modeData.width + "x" + modeData.height + "@" + (modeData.refresh_rate / 1000).toFixed(3) : null;
|
const modeStr = modeData ? modeData.width + "x" + modeData.height + "@" + (modeData.refresh_rate / 1000).toFixed(3) : null;
|
||||||
@@ -420,7 +420,6 @@ Singleton {
|
|||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert monitors.json config entry → internal outputsData map
|
|
||||||
function profileKeyMatchesOutput(outputId, output, name) {
|
function profileKeyMatchesOutput(outputId, output, name) {
|
||||||
if (name === outputId || getOutputIdentifier(output, name) === outputId)
|
if (name === outputId || getOutputIdentifier(output, name) === outputId)
|
||||||
return true;
|
return true;
|
||||||
@@ -437,7 +436,6 @@ Singleton {
|
|||||||
const cfgOutputs = configEntry.outputs || {};
|
const cfgOutputs = configEntry.outputs || {};
|
||||||
for (const outputId in cfgOutputs) {
|
for (const outputId in cfgOutputs) {
|
||||||
const cfg = cfgOutputs[outputId];
|
const cfg = cfgOutputs[outputId];
|
||||||
// Find matching live output to get modes list
|
|
||||||
let liveOutput = null;
|
let liveOutput = null;
|
||||||
for (const name in outputs) {
|
for (const name in outputs) {
|
||||||
if (profileKeyMatchesOutput(outputId, outputs[name], name)) {
|
if (profileKeyMatchesOutput(outputId, outputs[name], name)) {
|
||||||
@@ -475,7 +473,6 @@ Singleton {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract niri settings map from a neutral config entry.
|
|
||||||
function getNiriSettingsFromConfig(configEntry) {
|
function getNiriSettingsFromConfig(configEntry) {
|
||||||
const result = {};
|
const result = {};
|
||||||
for (const outputId in (configEntry.outputs || {})) {
|
for (const outputId in (configEntry.outputs || {})) {
|
||||||
@@ -489,7 +486,6 @@ Singleton {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract hyprland settings map from neutral config entry
|
|
||||||
function getHyprlandSettingsFromConfig(configEntry) {
|
function getHyprlandSettingsFromConfig(configEntry) {
|
||||||
const result = {};
|
const result = {};
|
||||||
for (const outputId in (configEntry.outputs || {})) {
|
for (const outputId in (configEntry.outputs || {})) {
|
||||||
@@ -536,7 +532,6 @@ Singleton {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write compositor config from a neutral config entry and optionally reload
|
|
||||||
function applyConfigEntry(configEntry, configId, profileName, isManual) {
|
function applyConfigEntry(configEntry, configId, profileName, isManual) {
|
||||||
if (CompositorService.isHyprland && readOnly) {
|
if (CompositorService.isHyprland && readOnly) {
|
||||||
if (isManual) {
|
if (isManual) {
|
||||||
@@ -579,8 +574,6 @@ Singleton {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Profile management ─────────────────────────────────────────────────
|
|
||||||
|
|
||||||
function validateProfiles() {
|
function validateProfiles() {
|
||||||
log.info("Validating profiles against current outputs...");
|
log.info("Validating profiles against current outputs...");
|
||||||
readMonitorsJson(data => {
|
readMonitorsJson(data => {
|
||||||
@@ -942,15 +935,18 @@ Singleton {
|
|||||||
const paths = getConfigPaths();
|
const paths = getConfigPaths();
|
||||||
if (!paths) {
|
if (!paths) {
|
||||||
savedOutputs = {};
|
savedOutputs = {};
|
||||||
|
savedParsedOutputs = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Proc.runCommand("load-saved-outputs", ["cat", paths.outputsFile], (content, exitCode) => {
|
Proc.runCommand("load-saved-outputs", ["cat", paths.outputsFile], (content, exitCode) => {
|
||||||
if (exitCode !== 0 || !content.trim()) {
|
if (exitCode !== 0 || !content.trim()) {
|
||||||
savedOutputs = {};
|
savedOutputs = {};
|
||||||
|
savedParsedOutputs = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const parsed = parseOutputsConfig(content);
|
const parsed = parseOutputsConfig(content);
|
||||||
|
savedParsedOutputs = parsed;
|
||||||
const filtered = filterDisconnectedOnly(parsed);
|
const filtered = filterDisconnectedOnly(parsed);
|
||||||
savedOutputs = filtered;
|
savedOutputs = filtered;
|
||||||
|
|
||||||
@@ -1123,20 +1119,7 @@ Singleton {
|
|||||||
const name = match[1];
|
const name = match[1];
|
||||||
const body = match[2];
|
const body = match[2];
|
||||||
|
|
||||||
if (body.trim() === "off") {
|
const disabled = /^\s*off\s*$/m.test(body);
|
||||||
result[name] = {
|
|
||||||
"name": name,
|
|
||||||
"disabled": true,
|
|
||||||
"logical": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"scale": 1.0,
|
|
||||||
"transform": "Normal"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const modeMatch = body.match(/mode\s+"(\d+)x(\d+)@([\d.]+)"/);
|
const modeMatch = body.match(/mode\s+"(\d+)x(\d+)@([\d.]+)"/);
|
||||||
const posMatch = body.match(/position\s+x=(-?\d+)\s+y=(-?\d+)/);
|
const posMatch = body.match(/position\s+x=(-?\d+)\s+y=(-?\d+)/);
|
||||||
const scaleMatch = body.match(/scale\s+([\d.]+)/);
|
const scaleMatch = body.match(/scale\s+([\d.]+)/);
|
||||||
@@ -1146,6 +1129,7 @@ Singleton {
|
|||||||
|
|
||||||
result[name] = {
|
result[name] = {
|
||||||
"name": name,
|
"name": name,
|
||||||
|
"disabled": disabled,
|
||||||
"logical": {
|
"logical": {
|
||||||
"x": posMatch ? parseInt(posMatch[1]) : 0,
|
"x": posMatch ? parseInt(posMatch[1]) : 0,
|
||||||
"y": posMatch ? parseInt(posMatch[2]) : 0,
|
"y": posMatch ? parseInt(posMatch[2]) : 0,
|
||||||
@@ -1809,6 +1793,41 @@ Singleton {
|
|||||||
return normalized;
|
return normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findSavedParsedOutput(outputName) {
|
||||||
|
const output = outputs[outputName];
|
||||||
|
const candidates = [outputName];
|
||||||
|
if (output?.make && output?.model) {
|
||||||
|
candidates.push(output.make + " " + output.model + " " + (output.serial || "Unknown"));
|
||||||
|
candidates.push(output.make + " " + output.model);
|
||||||
|
}
|
||||||
|
for (const savedName in savedParsedOutputs) {
|
||||||
|
if (candidates.includes(savedName.trim()))
|
||||||
|
return savedParsedOutputs[savedName];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A disabled wlr head reports no current mode, scale 0 and position 0,0 —
|
||||||
|
// overlay the last written config so rewrites don't discard real settings.
|
||||||
|
function overlaySavedDisabledOutput(entry, outputName) {
|
||||||
|
const saved = findSavedParsedOutput(outputName);
|
||||||
|
if (!saved)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const savedMode = saved.modes?.[saved.current_mode ?? 0];
|
||||||
|
if (savedMode && !entry.configured_mode)
|
||||||
|
entry.configured_mode = savedMode.width + "x" + savedMode.height + "@" + (savedMode.refresh_rate / 1000).toFixed(3);
|
||||||
|
if (saved.vrr_enabled !== undefined)
|
||||||
|
entry.vrr_enabled = saved.vrr_enabled;
|
||||||
|
if (!saved.logical || !entry.logical)
|
||||||
|
return;
|
||||||
|
|
||||||
|
entry.logical.x = saved.logical.x;
|
||||||
|
entry.logical.y = saved.logical.y;
|
||||||
|
entry.logical.scale = saved.logical.scale;
|
||||||
|
entry.logical.transform = saved.logical.transform;
|
||||||
|
}
|
||||||
|
|
||||||
function buildOutputsWithPendingChanges() {
|
function buildOutputsWithPendingChanges() {
|
||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
@@ -1818,7 +1837,10 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const outputName in outputs) {
|
for (const outputName in outputs) {
|
||||||
result[outputName] = JSON.parse(JSON.stringify(outputs[outputName]));
|
const entry = JSON.parse(JSON.stringify(outputs[outputName]));
|
||||||
|
if (entry.enabled === false)
|
||||||
|
overlaySavedDisabledOutput(entry, outputName);
|
||||||
|
result[outputName] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const outputName in pendingChanges) {
|
for (const outputName in pendingChanges) {
|
||||||
@@ -1830,6 +1852,8 @@ Singleton {
|
|||||||
result[outputName].logical.y = changes.position.y;
|
result[outputName].logical.y = changes.position.y;
|
||||||
}
|
}
|
||||||
if (changes.mode !== undefined && result[outputName].modes) {
|
if (changes.mode !== undefined && result[outputName].modes) {
|
||||||
|
if (result[outputName].configured_mode)
|
||||||
|
result[outputName].configured_mode = changes.mode;
|
||||||
for (var i = 0; i < result[outputName].modes.length; i++) {
|
for (var i = 0; i < result[outputName].modes.length; i++) {
|
||||||
if (formatMode(result[outputName].modes[i]) === changes.mode) {
|
if (formatMode(result[outputName].modes[i]) === changes.mode) {
|
||||||
result[outputName].current_mode = i;
|
result[outputName].current_mode = i;
|
||||||
@@ -2040,7 +2064,6 @@ Singleton {
|
|||||||
return pending !== undefined ? pending : originalValue;
|
return pending !== undefined ? pending : originalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the given output can currently be disabled.
|
|
||||||
// Prevents disabling all outputs and prevents disabling the only output
|
// Prevents disabling all outputs and prevents disabling the only output
|
||||||
// in a single-display configuration.
|
// in a single-display configuration.
|
||||||
function canDisableOutput() {
|
function canDisableOutput() {
|
||||||
|
|||||||
@@ -617,6 +617,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SettingsSliderRow {
|
SettingsSliderRow {
|
||||||
|
settingKey: "dockExclusiveZone"
|
||||||
|
tags: ["exclusive", "zone", "reserved", "offset"]
|
||||||
text: I18n.tr("Exclusive Zone Offset")
|
text: I18n.tr("Exclusive Zone Offset")
|
||||||
visible: !root.connectedFrameModeActive || root.connectedPersistentDockActive
|
visible: !root.connectedFrameModeActive || root.connectedPersistentDockActive
|
||||||
value: SettingsData.dockBottomGap
|
value: SettingsData.dockBottomGap
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Item {
|
|||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
// Bar Inset Padding: resolve the "auto" sentinel (stored < 0) to the frame thickness for the slider display.
|
// Bar Inset Padding: resolve the "auto" sentinel (stored < 0) to the frame thickness for the slider display.
|
||||||
readonly property int frameInsetPaddingDisplay: SettingsData.frameBarInsetPadding < 0 ? Math.round(SettingsData.frameThickness) : SettingsData.frameBarInsetPadding
|
readonly property int frameInsetPaddingDisplay: Math.round(SettingsData.frameBarContentGap)
|
||||||
|
|
||||||
DankFlickable {
|
DankFlickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user