mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4aac70ab5f | ||
|
|
980aec714a | ||
|
|
af8ee5af0f | ||
|
|
32d9aa0cf2 | ||
|
|
7e49631912 | ||
|
|
43970d34aa | ||
|
|
abb3c40697 | ||
|
|
2757a41102 | ||
|
|
1f8bddaa5e | ||
|
|
4c3b7ca60f | ||
|
|
d9d83e5767 | ||
|
|
b4ebde47be | ||
|
|
ef9f76190d | ||
|
|
71b96efca0 | ||
|
|
7158e09b0e | ||
|
|
8ef125bed2 | ||
|
|
0b11fb2fd5 | ||
|
|
3871f3cf3d | ||
|
|
7c5d1ec0f6 | ||
|
|
b507b08e34 | ||
|
|
1b06090f72 | ||
|
|
5460c20ac3 | ||
|
|
2ccec607a0 | ||
|
|
8a99fcf188 | ||
|
|
1e2489ca76 | ||
|
|
89793d2d62 | ||
|
|
11a1af89f4 | ||
|
|
e24ddb804d | ||
|
|
3524d365be | ||
|
|
2b3b9d037c | ||
|
|
5140cd9d7f | ||
|
|
2df9437b39 | ||
|
|
db440b8a14 | ||
|
|
c3dd70bc99 | ||
|
|
223e783bbc | ||
|
|
ca086dbf16 | ||
|
|
523422cf6c | ||
|
|
2dc310dcbc | ||
|
|
c092cd2921 | ||
|
|
2b14ef76c9 | ||
|
|
fbbf10078f | ||
|
|
2315d423c4 | ||
|
|
9a43465ebf | ||
|
|
fc1444763d | ||
|
|
804bf879ed | ||
|
|
ad44f09421 | ||
|
|
df2469468b | ||
|
|
f8f4fe11eb | ||
|
|
039a370add | ||
|
|
6feebc086d | ||
|
|
bc335c7d72 | ||
|
|
a6dd7254b2 | ||
|
|
7b1026c624 | ||
|
|
4758393cc1 | ||
|
|
52373a3a7d | ||
|
|
c30f9a2841 | ||
|
|
44d6f8f15c | ||
|
|
5ada12f989 | ||
|
|
d213045168 | ||
|
|
d83478239e | ||
|
|
3869955357 | ||
|
|
345d37edf8 | ||
|
|
2788ef28cf | ||
|
|
0d5c1bb3df | ||
|
|
c3d505cdad |
95
.github/workflows/release.yml
vendored
95
.github/workflows/release.yml
vendored
@@ -1,70 +1,97 @@
|
||||
name: Create Release
|
||||
# Release from a dispatch event from the danklinux repo
|
||||
name: Create Release from DMS
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
repository_dispatch:
|
||||
types: [dms_release]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.ref_name }}
|
||||
group: release-${{ github.event.client_payload.tag }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
create_release:
|
||||
name: 📦 Create GitHub Release
|
||||
create_release_from_dms:
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
TAG: ${{ github.event.client_payload.tag }}
|
||||
DMS_REPO: ${{ github.event.client_payload.dms_repo }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Fetch full history for changelog generation
|
||||
fetch-depth: 0
|
||||
|
||||
# Create VERSION file
|
||||
- name: Create VERSION file
|
||||
- name: Ensure VERSION and tag
|
||||
run: |
|
||||
echo "${{ github.ref_name }}" > VERSION
|
||||
git config user.name "github-actions[bot]"
|
||||
set -euxo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add VERSION
|
||||
git commit -m "Add VERSION file for ${{ github.ref_name }}"
|
||||
git tag -f ${{ github.ref_name }}
|
||||
git push origin ${{ github.ref_name }} --force
|
||||
|
||||
# Generate changelog
|
||||
# create/update VERSION file to match incoming tag
|
||||
echo "${TAG}" > VERSION
|
||||
if ! git diff --quiet -- VERSION; then
|
||||
git add VERSION
|
||||
git commit -m "Add VERSION file for ${TAG} (from DMS)"
|
||||
fi
|
||||
|
||||
# If tag doesn't exist (or differs), (re)create it
|
||||
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
|
||||
echo "Tag ${TAG} already exists"
|
||||
else
|
||||
git tag "${TAG}"
|
||||
fi
|
||||
|
||||
# Push commit (if any) and tag
|
||||
git push --follow-tags origin HEAD
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
run: |
|
||||
# Get the previous tag
|
||||
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
|
||||
set -e
|
||||
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || echo "")
|
||||
if [ -z "$PREVIOUS_TAG" ]; then
|
||||
echo "No previous tag found, using all commits"
|
||||
CHANGELOG=$(git log --oneline --pretty=format:"- %s (%h)" | head -50)
|
||||
else
|
||||
echo "Generating changelog from $PREVIOUS_TAG to HEAD"
|
||||
CHANGELOG=$(git log --oneline --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD)
|
||||
CHANGELOG=$(git log --oneline --pretty=format:"- %s (%h)" "${PREVIOUS_TAG}..${TAG}")
|
||||
fi
|
||||
|
||||
# Create the changelog with proper formatting
|
||||
cat > CHANGELOG.md << EOF
|
||||
## What's Changed
|
||||
|
||||
$CHANGELOG
|
||||
|
||||
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_TAG}...${{ github.ref_name }}
|
||||
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_TAG}...${TAG}
|
||||
EOF
|
||||
|
||||
# Set output for use in release step
|
||||
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
||||
cat CHANGELOG.md >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
# Create GitHub Release
|
||||
- name: Create GitHub Release
|
||||
uses: comnoco/create-release-action@v2.0.5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create/Update DankMaterialShell Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
tag_name: ${{ env.TAG }}
|
||||
name: Release ${{ env.TAG }}
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(github.ref_name, '-') }}
|
||||
prerelease: ${{ contains(env.TAG, '-') }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Download DMS release assets
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
# gh is preinstalled on ubuntu-24.04; auth via GH_TOKEN env
|
||||
gh release download "${TAG}" -R "${DMS_REPO}" --dir ./_dms_assets
|
||||
|
||||
- name: Attach DMS assets to DankMaterialShell release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ env.TAG }}
|
||||
files: _dms_assets/**
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
68
CLAUDE.md
68
CLAUDE.md
@@ -448,7 +448,13 @@ When modifying the shell:
|
||||
|
||||
### Creating Plugins
|
||||
|
||||
Plugins are external, dynamically-loaded components that extend DankBar functionality. Plugins are stored in `~/.config/DankMaterialShell/plugins/` and have their settings isolated from core DMS settings.
|
||||
Plugins are external, dynamically-loaded components that extend DankMaterialShell functionality. Plugins are stored in `~/.config/DankMaterialShell/plugins/` and have their settings isolated from core DMS settings.
|
||||
|
||||
**Plugin Types:**
|
||||
- **Widget plugins** (`"type": "widget"` or omit type field): Display UI components in DankBar
|
||||
- **Daemon plugins** (`"type": "daemon"`): Run invisibly in the background without UI
|
||||
|
||||
#### Widget Plugins
|
||||
|
||||
1. **Create plugin directory**:
|
||||
```bash
|
||||
@@ -464,6 +470,7 @@ Plugins are external, dynamically-loaded components that extend DankBar function
|
||||
"version": "1.0.0",
|
||||
"author": "Your Name",
|
||||
"icon": "extension",
|
||||
"type": "widget",
|
||||
"component": "./YourWidget.qml",
|
||||
"settings": "./YourSettings.qml",
|
||||
"permissions": ["settings_read", "settings_write"]
|
||||
@@ -545,6 +552,65 @@ Plugins are external, dynamically-loaded components that extend DankBar function
|
||||
- Toggle plugin to enable
|
||||
- Add plugin ID to DankBar widget list
|
||||
|
||||
#### Daemon Plugins
|
||||
|
||||
Daemon plugins run invisibly in the background without any UI components. They're useful for monitoring system events, background tasks, or data synchronization.
|
||||
|
||||
1. **Create plugin directory**:
|
||||
```bash
|
||||
mkdir -p ~/.config/DankMaterialShell/plugins/YourDaemon
|
||||
```
|
||||
|
||||
2. **Create manifest** (`plugin.json`):
|
||||
```json
|
||||
{
|
||||
"id": "yourDaemon",
|
||||
"name": "Your Daemon",
|
||||
"description": "Background daemon description",
|
||||
"version": "1.0.0",
|
||||
"author": "Your Name",
|
||||
"icon": "settings_applications",
|
||||
"type": "daemon",
|
||||
"component": "./YourDaemon.qml",
|
||||
"permissions": ["settings_read", "settings_write"]
|
||||
}
|
||||
```
|
||||
|
||||
3. **Create daemon component** (`YourDaemon.qml`):
|
||||
```qml
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var pluginService: null
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onWallpaperPathChanged() {
|
||||
console.log("Wallpaper changed:", SessionData.wallpaperPath)
|
||||
if (pluginService) {
|
||||
pluginService.savePluginData("yourDaemon", "lastEvent", Date.now())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("Daemon started")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. **Enable daemon**:
|
||||
- Open Settings → Plugins
|
||||
- Click "Scan for Plugins"
|
||||
- Toggle daemon to enable
|
||||
- Daemon runs automatically in background
|
||||
|
||||
**Example**: See `PLUGINS/WallpaperWatcherDaemon/` for a complete daemon plugin that monitors wallpaper changes
|
||||
|
||||
**Plugin Directory Structure:**
|
||||
```
|
||||
~/.config/DankMaterialShell/
|
||||
|
||||
@@ -70,6 +70,8 @@ Singleton {
|
||||
property int batteryHibernateTimeout: 0 // Never
|
||||
|
||||
property bool lockBeforeSuspend: false
|
||||
property var recentColors: []
|
||||
property bool showThirdPartyPlugins: false
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
@@ -150,6 +152,8 @@ Singleton {
|
||||
batterySuspendTimeout = settings.batterySuspendTimeout !== undefined ? settings.batterySuspendTimeout : 0
|
||||
batteryHibernateTimeout = settings.batteryHibernateTimeout !== undefined ? settings.batteryHibernateTimeout : 0
|
||||
lockBeforeSuspend = settings.lockBeforeSuspend !== undefined ? settings.lockBeforeSuspend : false
|
||||
recentColors = settings.recentColors !== undefined ? settings.recentColors : []
|
||||
showThirdPartyPlugins = settings.showThirdPartyPlugins !== undefined ? settings.showThirdPartyPlugins : false
|
||||
|
||||
if (!isGreeterMode) {
|
||||
if (typeof Theme !== "undefined") {
|
||||
@@ -210,7 +214,9 @@ Singleton {
|
||||
"batteryLockTimeout": batteryLockTimeout,
|
||||
"batterySuspendTimeout": batterySuspendTimeout,
|
||||
"batteryHibernateTimeout": batteryHibernateTimeout,
|
||||
"lockBeforeSuspend": lockBeforeSuspend
|
||||
"lockBeforeSuspend": lockBeforeSuspend,
|
||||
"recentColors": recentColors,
|
||||
"showThirdPartyPlugins": showThirdPartyPlugins
|
||||
}, null, 2))
|
||||
}
|
||||
|
||||
@@ -359,6 +365,16 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function addRecentColor(color) {
|
||||
const colorStr = color.toString()
|
||||
let recent = recentColors.slice()
|
||||
recent = recent.filter(c => c !== colorStr)
|
||||
recent.unshift(colorStr)
|
||||
if (recent.length > 5) recent = recent.slice(0, 5)
|
||||
recentColors = recent
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function addPinnedApp(appId) {
|
||||
if (!appId)
|
||||
return
|
||||
@@ -627,6 +643,11 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setShowThirdPartyPlugins(enabled) {
|
||||
showThirdPartyPlugins = enabled
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: settingsFile
|
||||
|
||||
|
||||
@@ -103,15 +103,19 @@ Singleton {
|
||||
property bool qt5ctAvailable: false
|
||||
property bool qt6ctAvailable: false
|
||||
property bool gtkAvailable: false
|
||||
property bool useOSLogo: false
|
||||
property string osLogoColorOverride: ""
|
||||
property real osLogoBrightness: 0.5
|
||||
property real osLogoContrast: 1
|
||||
property string launcherLogoMode: "apps"
|
||||
property string launcherLogoCustomPath: ""
|
||||
property string launcherLogoColorOverride: ""
|
||||
property bool launcherLogoColorInvertOnMode: false
|
||||
property real launcherLogoBrightness: 0.5
|
||||
property real launcherLogoContrast: 1
|
||||
property int launcherLogoSizeOffset: 0
|
||||
property bool weatherEnabled: true
|
||||
property string fontFamily: "Inter Variable"
|
||||
property string monoFontFamily: "Fira Code"
|
||||
property int fontWeight: Font.Normal
|
||||
property real fontScale: 1.0
|
||||
property real dankBarFontScale: 1.0
|
||||
property bool notepadUseMonospace: true
|
||||
property string notepadFontFamily: ""
|
||||
property real notepadFontSize: 14
|
||||
@@ -150,6 +154,7 @@ Singleton {
|
||||
property bool dankBarSquareCorners: false
|
||||
property bool dankBarNoBackground: false
|
||||
property bool dankBarGothCornersEnabled: false
|
||||
property bool dankBarBorderEnabled: false
|
||||
property int dankBarPosition: SettingsData.Position.Top
|
||||
property bool dankBarIsVertical: dankBarPosition === SettingsData.Position.Left || dankBarPosition === SettingsData.Position.Right
|
||||
property bool lockScreenShowPowerActions: true
|
||||
@@ -160,6 +165,7 @@ Singleton {
|
||||
property int notificationTimeoutNormal: 5000
|
||||
property int notificationTimeoutCritical: 0
|
||||
property int notificationPopupPosition: SettingsData.Position.Top
|
||||
property bool osdAlwaysShowValue: false
|
||||
property var screenPreferences: ({})
|
||||
property int animationSpeed: SettingsData.AnimationSpeed.Short
|
||||
readonly property string defaultFontFamily: "Inter Variable"
|
||||
@@ -167,6 +173,7 @@ Singleton {
|
||||
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
|
||||
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
|
||||
readonly property string _configDir: Paths.strip(_configUrl)
|
||||
readonly property string pluginSettingsPath: _configDir + "/DankMaterialShell/plugin_settings.json"
|
||||
|
||||
signal forceDankBarLayoutRefresh
|
||||
signal forceDockLayoutRefresh
|
||||
@@ -174,6 +181,7 @@ Singleton {
|
||||
signal workspaceIconsUpdated
|
||||
|
||||
property bool _loading: false
|
||||
property bool _pluginSettingsLoading: false
|
||||
|
||||
property var pluginSettings: ({})
|
||||
|
||||
@@ -202,7 +210,8 @@ Singleton {
|
||||
"size": 20,
|
||||
"selectedGpuIndex": 0,
|
||||
"pciId": "",
|
||||
"mountPath": "/"
|
||||
"mountPath": "/",
|
||||
"minimumWidth": true
|
||||
}
|
||||
leftWidgetsModel.append(dummyItem)
|
||||
centerWidgetsModel.append(dummyItem)
|
||||
@@ -217,13 +226,41 @@ Singleton {
|
||||
_loading = true
|
||||
parseSettings(settingsFile.text())
|
||||
_loading = false
|
||||
loadPluginSettings()
|
||||
}
|
||||
|
||||
function loadPluginSettings() {
|
||||
_pluginSettingsLoading = true
|
||||
parsePluginSettings(pluginSettingsFile.text())
|
||||
_pluginSettingsLoading = false
|
||||
}
|
||||
|
||||
function parsePluginSettings(content) {
|
||||
_pluginSettingsLoading = true
|
||||
try {
|
||||
if (content && content.trim()) {
|
||||
pluginSettings = JSON.parse(content)
|
||||
} else {
|
||||
pluginSettings = {}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("SettingsData: Failed to parse plugin settings:", e.message)
|
||||
pluginSettings = {}
|
||||
} finally {
|
||||
_pluginSettingsLoading = false
|
||||
}
|
||||
}
|
||||
|
||||
function parseSettings(content) {
|
||||
_loading = true
|
||||
var shouldMigrate = false
|
||||
try {
|
||||
if (content && content.trim()) {
|
||||
var settings = JSON.parse(content)
|
||||
if (settings.pluginSettings !== undefined) {
|
||||
pluginSettings = settings.pluginSettings
|
||||
shouldMigrate = true
|
||||
}
|
||||
// Auto-migrate from old theme system
|
||||
if (settings.themeIndex !== undefined || settings.themeIsDynamic !== undefined) {
|
||||
const themeNames = ["blue", "deepBlue", "purple", "green", "orange", "red", "cyan", "pink", "amber", "coral"]
|
||||
@@ -319,14 +356,25 @@ Singleton {
|
||||
spotlightModalViewMode = settings.spotlightModalViewMode !== undefined ? settings.spotlightModalViewMode : "list"
|
||||
networkPreference = settings.networkPreference !== undefined ? settings.networkPreference : "auto"
|
||||
iconTheme = settings.iconTheme !== undefined ? settings.iconTheme : "System Default"
|
||||
useOSLogo = settings.useOSLogo !== undefined ? settings.useOSLogo : false
|
||||
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : ""
|
||||
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5
|
||||
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1
|
||||
if (settings.useOSLogo !== undefined) {
|
||||
launcherLogoMode = settings.useOSLogo ? "os" : "apps"
|
||||
launcherLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : ""
|
||||
launcherLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5
|
||||
launcherLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1
|
||||
} else {
|
||||
launcherLogoMode = settings.launcherLogoMode !== undefined ? settings.launcherLogoMode : "apps"
|
||||
launcherLogoCustomPath = settings.launcherLogoCustomPath !== undefined ? settings.launcherLogoCustomPath : ""
|
||||
launcherLogoColorOverride = settings.launcherLogoColorOverride !== undefined ? settings.launcherLogoColorOverride : ""
|
||||
launcherLogoColorInvertOnMode = settings.launcherLogoColorInvertOnMode !== undefined ? settings.launcherLogoColorInvertOnMode : false
|
||||
launcherLogoBrightness = settings.launcherLogoBrightness !== undefined ? settings.launcherLogoBrightness : 0.5
|
||||
launcherLogoContrast = settings.launcherLogoContrast !== undefined ? settings.launcherLogoContrast : 1
|
||||
launcherLogoSizeOffset = settings.launcherLogoSizeOffset !== undefined ? settings.launcherLogoSizeOffset : 0
|
||||
}
|
||||
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily
|
||||
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
||||
fontScale = settings.fontScale !== undefined ? settings.fontScale : 1.0
|
||||
dankBarFontScale = settings.dankBarFontScale !== undefined ? settings.dankBarFontScale : 1.0
|
||||
notepadUseMonospace = settings.notepadUseMonospace !== undefined ? settings.notepadUseMonospace : true
|
||||
notepadFontFamily = settings.notepadFontFamily !== undefined ? settings.notepadFontFamily : ""
|
||||
notepadFontSize = settings.notepadFontSize !== undefined ? settings.notepadFontSize : 14
|
||||
@@ -351,19 +399,20 @@ Singleton {
|
||||
notificationTimeoutNormal = settings.notificationTimeoutNormal !== undefined ? settings.notificationTimeoutNormal : 5000
|
||||
notificationTimeoutCritical = settings.notificationTimeoutCritical !== undefined ? settings.notificationTimeoutCritical : 0
|
||||
notificationPopupPosition = settings.notificationPopupPosition !== undefined ? settings.notificationPopupPosition : SettingsData.Position.Top
|
||||
osdAlwaysShowValue = settings.osdAlwaysShowValue !== undefined ? settings.osdAlwaysShowValue : false
|
||||
dankBarSpacing = settings.dankBarSpacing !== undefined ? settings.dankBarSpacing : (settings.topBarSpacing !== undefined ? settings.topBarSpacing : 4)
|
||||
dankBarBottomGap = settings.dankBarBottomGap !== undefined ? settings.dankBarBottomGap : (settings.topBarBottomGap !== undefined ? settings.topBarBottomGap : 0)
|
||||
dankBarInnerPadding = settings.dankBarInnerPadding !== undefined ? settings.dankBarInnerPadding : (settings.topBarInnerPadding !== undefined ? settings.topBarInnerPadding : 4)
|
||||
dankBarSquareCorners = settings.dankBarSquareCorners !== undefined ? settings.dankBarSquareCorners : (settings.topBarSquareCorners !== undefined ? settings.topBarSquareCorners : false)
|
||||
dankBarNoBackground = settings.dankBarNoBackground !== undefined ? settings.dankBarNoBackground : (settings.topBarNoBackground !== undefined ? settings.topBarNoBackground : false)
|
||||
dankBarGothCornersEnabled = settings.dankBarGothCornersEnabled !== undefined ? settings.dankBarGothCornersEnabled : (settings.topBarGothCornersEnabled !== undefined ? settings.topBarGothCornersEnabled : false)
|
||||
dankBarBorderEnabled = settings.dankBarBorderEnabled !== undefined ? settings.dankBarBorderEnabled : false
|
||||
dankBarPosition = settings.dankBarPosition !== undefined ? settings.dankBarPosition : (settings.dankBarAtBottom !== undefined ? (settings.dankBarAtBottom ? SettingsData.Position.Bottom : SettingsData.Position.Top) : (settings.topBarAtBottom !== undefined ? (settings.topBarAtBottom ? SettingsData.Position.Bottom : SettingsData.Position.Top) : SettingsData.Position.Top))
|
||||
lockScreenShowPowerActions = settings.lockScreenShowPowerActions !== undefined ? settings.lockScreenShowPowerActions : true
|
||||
hideBrightnessSlider = settings.hideBrightnessSlider !== undefined ? settings.hideBrightnessSlider : false
|
||||
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
||||
surfaceBase = settings.surfaceBase !== undefined ? settings.surfaceBase : "s"
|
||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
||||
pluginSettings = settings.pluginSettings !== undefined ? settings.pluginSettings : ({})
|
||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : SettingsData.AnimationSpeed.Short
|
||||
applyStoredTheme()
|
||||
detectAvailableIconThemes()
|
||||
@@ -378,6 +427,11 @@ Singleton {
|
||||
} finally {
|
||||
_loading = false
|
||||
}
|
||||
|
||||
if (shouldMigrate) {
|
||||
savePluginSettings()
|
||||
saveSettings()
|
||||
}
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
@@ -440,14 +494,18 @@ Singleton {
|
||||
"spotlightModalViewMode": spotlightModalViewMode,
|
||||
"networkPreference": networkPreference,
|
||||
"iconTheme": iconTheme,
|
||||
"useOSLogo": useOSLogo,
|
||||
"osLogoColorOverride": osLogoColorOverride,
|
||||
"osLogoBrightness": osLogoBrightness,
|
||||
"osLogoContrast": osLogoContrast,
|
||||
"launcherLogoMode": launcherLogoMode,
|
||||
"launcherLogoCustomPath": launcherLogoCustomPath,
|
||||
"launcherLogoColorOverride": launcherLogoColorOverride,
|
||||
"launcherLogoColorInvertOnMode": launcherLogoColorInvertOnMode,
|
||||
"launcherLogoBrightness": launcherLogoBrightness,
|
||||
"launcherLogoContrast": launcherLogoContrast,
|
||||
"launcherLogoSizeOffset": launcherLogoSizeOffset,
|
||||
"fontFamily": fontFamily,
|
||||
"monoFontFamily": monoFontFamily,
|
||||
"fontWeight": fontWeight,
|
||||
"fontScale": fontScale,
|
||||
"dankBarFontScale": dankBarFontScale,
|
||||
"notepadUseMonospace": notepadUseMonospace,
|
||||
"notepadFontFamily": notepadFontFamily,
|
||||
"notepadFontSize": notepadFontSize,
|
||||
@@ -474,6 +532,7 @@ Singleton {
|
||||
"dankBarSquareCorners": dankBarSquareCorners,
|
||||
"dankBarNoBackground": dankBarNoBackground,
|
||||
"dankBarGothCornersEnabled": dankBarGothCornersEnabled,
|
||||
"dankBarBorderEnabled": dankBarBorderEnabled,
|
||||
"dankBarPosition": dankBarPosition,
|
||||
"lockScreenShowPowerActions": lockScreenShowPowerActions,
|
||||
"hideBrightnessSlider": hideBrightnessSlider,
|
||||
@@ -483,12 +542,18 @@ Singleton {
|
||||
"notificationTimeoutNormal": notificationTimeoutNormal,
|
||||
"notificationTimeoutCritical": notificationTimeoutCritical,
|
||||
"notificationPopupPosition": notificationPopupPosition,
|
||||
"osdAlwaysShowValue": osdAlwaysShowValue,
|
||||
"screenPreferences": screenPreferences,
|
||||
"pluginSettings": pluginSettings,
|
||||
"animationSpeed": animationSpeed
|
||||
}, null, 2))
|
||||
}
|
||||
|
||||
function savePluginSettings() {
|
||||
if (_pluginSettingsLoading)
|
||||
return
|
||||
pluginSettingsFile.setText(JSON.stringify(pluginSettings, null, 2))
|
||||
}
|
||||
|
||||
function setShowWorkspaceIndex(enabled) {
|
||||
showWorkspaceIndex = enabled
|
||||
saveSettings()
|
||||
@@ -805,6 +870,7 @@ Singleton {
|
||||
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
||||
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
||||
var mountPath = typeof order[i] === "string" ? undefined : order[i].mountPath
|
||||
var minimumWidth = typeof order[i] === "string" ? undefined : order[i].minimumWidth
|
||||
var item = {
|
||||
"widgetId": widgetId,
|
||||
"enabled": enabled
|
||||
@@ -817,6 +883,8 @@ Singleton {
|
||||
item.pciId = pciId
|
||||
if (mountPath !== undefined)
|
||||
item.mountPath = mountPath
|
||||
if (minimumWidth !== undefined)
|
||||
item.minimumWidth = minimumWidth
|
||||
|
||||
listModel.append(item)
|
||||
}
|
||||
@@ -939,23 +1007,38 @@ Singleton {
|
||||
updateQtIconTheme(iconTheme)
|
||||
}
|
||||
|
||||
function setUseOSLogo(enabled) {
|
||||
useOSLogo = enabled
|
||||
function setLauncherLogoMode(mode) {
|
||||
launcherLogoMode = mode
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setOSLogoColorOverride(color) {
|
||||
osLogoColorOverride = color
|
||||
function setLauncherLogoCustomPath(path) {
|
||||
launcherLogoCustomPath = path
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setOSLogoBrightness(brightness) {
|
||||
osLogoBrightness = brightness
|
||||
function setLauncherLogoColorOverride(color) {
|
||||
launcherLogoColorOverride = color
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setOSLogoContrast(contrast) {
|
||||
osLogoContrast = contrast
|
||||
function setLauncherLogoColorInvertOnMode(invert) {
|
||||
launcherLogoColorInvertOnMode = invert
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setLauncherLogoBrightness(brightness) {
|
||||
launcherLogoBrightness = brightness
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setLauncherLogoContrast(contrast) {
|
||||
launcherLogoContrast = contrast
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setLauncherLogoSizeOffset(offset) {
|
||||
launcherLogoSizeOffset = offset
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
@@ -979,6 +1062,11 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setDankBarFontScale(scale) {
|
||||
dankBarFontScale = scale
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setGtkThemingEnabled(enabled) {
|
||||
gtkThemingEnabled = enabled
|
||||
saveSettings()
|
||||
@@ -1083,6 +1171,11 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setOsdAlwaysShowValue(enabled) {
|
||||
osdAlwaysShowValue = enabled
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function sendTestNotifications() {
|
||||
sendTestNotification(0)
|
||||
testNotifTimer1.start()
|
||||
@@ -1158,6 +1251,11 @@ Singleton {
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setDankBarBorderEnabled(enabled) {
|
||||
dankBarBorderEnabled = enabled
|
||||
saveSettings()
|
||||
}
|
||||
|
||||
function setDankBarPosition(position) {
|
||||
dankBarPosition = position
|
||||
if (position === SettingsData.Position.Bottom && dockPosition === SettingsData.Position.Bottom && showDock) {
|
||||
@@ -1283,13 +1381,13 @@ Singleton {
|
||||
pluginSettings[pluginId] = {}
|
||||
}
|
||||
pluginSettings[pluginId][key] = value
|
||||
saveSettings()
|
||||
savePluginSettings()
|
||||
}
|
||||
|
||||
function removePluginSettings(pluginId) {
|
||||
if (pluginSettings[pluginId]) {
|
||||
delete pluginSettings[pluginId]
|
||||
saveSettings()
|
||||
savePluginSettings()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,6 +1471,26 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: pluginSettingsFile
|
||||
|
||||
path: isGreeterMode ? "" : pluginSettingsPath
|
||||
blockLoading: true
|
||||
blockWrites: true
|
||||
atomicWrites: true
|
||||
watchChanges: !isGreeterMode
|
||||
onLoaded: {
|
||||
if (!isGreeterMode) {
|
||||
parsePluginSettings(pluginSettingsFile.text())
|
||||
}
|
||||
}
|
||||
onLoadFailed: error => {
|
||||
if (!isGreeterMode) {
|
||||
pluginSettings = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: systemDefaultDetectionProcess
|
||||
|
||||
|
||||
@@ -473,6 +473,19 @@ Singleton {
|
||||
return (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) < 0.5
|
||||
}
|
||||
|
||||
function barIconSize(barThickness, offset) {
|
||||
const defaultOffset = offset !== undefined ? offset : -6
|
||||
return Math.round((barThickness / 48) * (iconSize + defaultOffset))
|
||||
}
|
||||
|
||||
function barTextSize(barThickness) {
|
||||
const scale = barThickness / 48
|
||||
const dankBarScale = (typeof SettingsData !== "undefined" ? SettingsData.dankBarFontScale : 1.0)
|
||||
if (scale <= 0.75) return fontSizeSmall * 0.9 * dankBarScale
|
||||
if (scale >= 1.25) return fontSizeMedium * dankBarScale
|
||||
return fontSizeSmall * dankBarScale
|
||||
}
|
||||
|
||||
function getBatteryIcon(level, isCharging, batteryAvailable) {
|
||||
if (!batteryAvailable)
|
||||
return _getBatteryPowerProfileIcon()
|
||||
@@ -602,10 +615,10 @@ Singleton {
|
||||
console.log("calling matugen worker")
|
||||
systemThemeGenerator.command = [
|
||||
"sh", "-c",
|
||||
`sleep 1 && ${shellDir}/scripts/matugen-worker.sh '${stateDir}' '${shellDir}' --run`
|
||||
`sleep 1 && ${shellDir}/scripts/matugen-worker.sh '${stateDir}' '${shellDir}' '${configDir}' --run`
|
||||
]
|
||||
} else {
|
||||
systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, "--run"]
|
||||
systemThemeGenerator.command = [shellDir + "/scripts/matugen-worker.sh", stateDir, shellDir, configDir, "--run"]
|
||||
}
|
||||
systemThemeGenerator.running = true
|
||||
}
|
||||
@@ -682,6 +695,50 @@ Singleton {
|
||||
return Math.round(value * dpr) / dpr
|
||||
}
|
||||
|
||||
function invertHex(hex) {
|
||||
hex = hex.replace('#', '');
|
||||
|
||||
if (!/^[0-9A-Fa-f]{6}$/.test(hex)) {
|
||||
return hex;
|
||||
}
|
||||
|
||||
const r = parseInt(hex.substr(0, 2), 16);
|
||||
const g = parseInt(hex.substr(2, 2), 16);
|
||||
const b = parseInt(hex.substr(4, 2), 16);
|
||||
|
||||
const invR = (255 - r).toString(16).padStart(2, '0');
|
||||
const invG = (255 - g).toString(16).padStart(2, '0');
|
||||
const invB = (255 - b).toString(16).padStart(2, '0');
|
||||
|
||||
return `#${invR}${invG}${invB}`;
|
||||
}
|
||||
|
||||
property string baseLogoColor: {
|
||||
if (typeof SettingsData === "undefined") return ""
|
||||
const colorOverride = SettingsData.launcherLogoColorOverride
|
||||
if (!colorOverride || colorOverride === "") return ""
|
||||
return colorOverride
|
||||
}
|
||||
|
||||
property string effectiveLogoColor: {
|
||||
if (typeof SettingsData === "undefined") return ""
|
||||
|
||||
const colorOverride = SettingsData.launcherLogoColorOverride
|
||||
if (!colorOverride || colorOverride === "") return ""
|
||||
|
||||
if (!SettingsData.launcherLogoColorInvertOnMode) {
|
||||
return colorOverride
|
||||
}
|
||||
|
||||
if (typeof SessionData !== "undefined" && SessionData.isLightMode) {
|
||||
return invertHex(baseLogoColor)
|
||||
}
|
||||
|
||||
return baseLogoColor
|
||||
}
|
||||
|
||||
|
||||
|
||||
Process {
|
||||
id: matugenCheck
|
||||
command: ["which", "matugen"]
|
||||
@@ -881,7 +938,7 @@ Singleton {
|
||||
|
||||
function toggle(): string {
|
||||
root.toggleLightMode()
|
||||
return root.isLightMode ? "light" : "dark"
|
||||
return root.isLightMode ? "dark" : "light"
|
||||
}
|
||||
|
||||
function light(): string {
|
||||
|
||||
155
DMSShell.qml
155
DMSShell.qml
@@ -32,14 +32,38 @@ import qs.Services
|
||||
ShellRoot {
|
||||
id: root
|
||||
|
||||
property bool servicesReady: false
|
||||
|
||||
Component.onCompleted: {
|
||||
PortalService.init()
|
||||
// Initialize DisplayService night mode functionality
|
||||
DisplayService.nightModeEnabled
|
||||
// Initialize WallpaperCyclingService
|
||||
WallpaperCyclingService.cyclingActive
|
||||
// Initialize PluginService by accessing its properties
|
||||
PluginService.pluginDirectory
|
||||
Qt.callLater(() => {
|
||||
servicesReady = true
|
||||
})
|
||||
}
|
||||
|
||||
Instantiator {
|
||||
id: daemonPluginInstantiator
|
||||
model: servicesReady ? Object.keys(PluginService.pluginDaemonComponents) : []
|
||||
|
||||
delegate: Loader {
|
||||
id: daemonLoader
|
||||
property string pluginId: modelData
|
||||
sourceComponent: PluginService.pluginDaemonComponents[pluginId]
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
item.pluginService = PluginService
|
||||
if (item.popoutService !== undefined) {
|
||||
item.popoutService = PopoutService
|
||||
}
|
||||
item.pluginId = pluginId
|
||||
console.log("Daemon plugin loaded:", pluginId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WallpaperBackground {}
|
||||
@@ -55,17 +79,22 @@ ShellRoot {
|
||||
asynchronous: false
|
||||
|
||||
property var currentPosition: SettingsData.dankBarPosition
|
||||
property bool initialized: false
|
||||
|
||||
sourceComponent: DankBar {
|
||||
onColorPickerRequested: colorPickerModal.show()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
initialized = true
|
||||
}
|
||||
|
||||
onCurrentPositionChanged: {
|
||||
if (!initialized) return
|
||||
|
||||
const component = sourceComponent
|
||||
sourceComponent = null
|
||||
Qt.callLater(() => {
|
||||
sourceComponent = component
|
||||
})
|
||||
sourceComponent = component
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +104,7 @@ ShellRoot {
|
||||
asynchronous: false
|
||||
|
||||
property var currentPosition: SettingsData.dockPosition
|
||||
property bool initialized: false
|
||||
|
||||
sourceComponent: Dock {
|
||||
contextMenu: dockContextMenuLoader.item ? dockContextMenuLoader.item : null
|
||||
@@ -86,13 +116,17 @@ ShellRoot {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
initialized = true
|
||||
}
|
||||
|
||||
onCurrentPositionChanged: {
|
||||
if (!initialized) return
|
||||
|
||||
console.log("DEBUG: Dock position changed to:", currentPosition, "- recreating dock")
|
||||
const comp = sourceComponent
|
||||
sourceComponent = null
|
||||
Qt.callLater(() => {
|
||||
sourceComponent = comp
|
||||
})
|
||||
sourceComponent = comp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +139,10 @@ ShellRoot {
|
||||
sourceComponent: Component {
|
||||
DankDashPopout {
|
||||
id: dankDashPopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.dankDashPopout = dankDashPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +164,10 @@ ShellRoot {
|
||||
|
||||
NotificationCenterPopout {
|
||||
id: notificationCenter
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.notificationCenterPopout = notificationCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +195,10 @@ ShellRoot {
|
||||
onLockRequested: {
|
||||
lock.activate()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.controlCenterPopout = controlCenterPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +209,10 @@ ShellRoot {
|
||||
|
||||
WifiPasswordModal {
|
||||
id: wifiPasswordModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.wifiPasswordModal = wifiPasswordModal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +223,10 @@ ShellRoot {
|
||||
|
||||
NetworkInfoModal {
|
||||
id: networkInfoModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.networkInfoModal = networkInfoModal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +237,10 @@ ShellRoot {
|
||||
|
||||
BatteryPopout {
|
||||
id: batteryPopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.batteryPopout = batteryPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +251,10 @@ ShellRoot {
|
||||
|
||||
VpnPopout {
|
||||
id: vpnPopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.vpnPopout = vpnPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,11 +311,19 @@ ShellRoot {
|
||||
|
||||
ProcessListPopout {
|
||||
id: processListPopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.processListPopout = processListPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsModal {
|
||||
id: settingsModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.settingsModal = settingsModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
@@ -263,22 +333,43 @@ ShellRoot {
|
||||
|
||||
AppDrawerPopout {
|
||||
id: appDrawerPopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.appDrawerPopout = appDrawerPopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpotlightModal {
|
||||
id: spotlightModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.spotlightModal = spotlightModal
|
||||
}
|
||||
}
|
||||
|
||||
ClipboardHistoryModal {
|
||||
id: clipboardHistoryModalPopup
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.clipboardHistoryModal = clipboardHistoryModalPopup
|
||||
}
|
||||
}
|
||||
|
||||
NotificationModal {
|
||||
id: notificationModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.notificationModal = notificationModal
|
||||
}
|
||||
}
|
||||
ColorPickerModal {
|
||||
|
||||
DankColorPickerModal {
|
||||
id: colorPickerModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.colorPickerModal = colorPickerModal
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
@@ -288,6 +379,10 @@ ShellRoot {
|
||||
|
||||
ProcessListModal {
|
||||
id: processListModal
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.processListModal = processListModal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +393,10 @@ ShellRoot {
|
||||
|
||||
SystemUpdatePopout {
|
||||
id: systemUpdatePopout
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.systemUpdatePopout = systemUpdatePopout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +464,10 @@ ShellRoot {
|
||||
}, function () {})
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
PopoutService.powerMenuModal = powerMenuModal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,6 +688,38 @@ ShellRoot {
|
||||
target: "notepad"
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
function toggle(): string {
|
||||
SessionService.toggleIdleInhibit()
|
||||
return SessionService.idleInhibited ? "Idle inhibit enabled" : "Idle inhibit disabled"
|
||||
}
|
||||
|
||||
function enable(): string {
|
||||
SessionService.enableIdleInhibit()
|
||||
return "Idle inhibit enabled"
|
||||
}
|
||||
|
||||
function disable(): string {
|
||||
SessionService.disableIdleInhibit()
|
||||
return "Idle inhibit disabled"
|
||||
}
|
||||
|
||||
function status(): string {
|
||||
return SessionService.idleInhibited ? "Idle inhibit is enabled" : "Idle inhibit is disabled"
|
||||
}
|
||||
|
||||
function reason(newReason: string): string {
|
||||
if (!newReason) {
|
||||
return `Current reason: ${SessionService.inhibitReason}`
|
||||
}
|
||||
|
||||
SessionService.setInhibitReason(newReason)
|
||||
return `Inhibit reason set to: ${newReason}`
|
||||
}
|
||||
|
||||
target: "inhibit"
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: SettingsData.getFilteredScreens("toast")
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No clipboard entries found"
|
||||
text: qsTr("No clipboard entries found")
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
|
||||
@@ -26,7 +26,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Shift+Del: Clear All • Esc: Close"
|
||||
text: qsTr("Shift+Del: Clear All • Esc: Close")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import QtQuick
|
||||
import Qt.labs.platform
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: colorPickerModal
|
||||
|
||||
signal colorSelected(color selectedColor)
|
||||
|
||||
function show() {
|
||||
colorDialog.open()
|
||||
}
|
||||
|
||||
function hide() {
|
||||
colorDialog.close()
|
||||
}
|
||||
|
||||
function copyColorToClipboard(colorValue) {
|
||||
Quickshell.execDetached(["sh", "-c", `echo "${colorValue}" | wl-copy`])
|
||||
ToastService.showInfo(`Color ${colorValue} copied to clipboard`)
|
||||
console.log("Copied color to clipboard:", colorValue)
|
||||
}
|
||||
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
title: "Color Picker - Select and copy color"
|
||||
color: Theme.primary
|
||||
|
||||
onAccepted: {
|
||||
const colorString = color.toString()
|
||||
copyColorToClipboard(colorString)
|
||||
colorSelected(color)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,6 +157,7 @@ PanelWindow {
|
||||
radius: root.cornerRadius
|
||||
border.color: root.borderColor
|
||||
border.width: root.borderWidth
|
||||
clip: false
|
||||
layer.enabled: true
|
||||
transform: root.animationType === "slide" ? slideTransform : null
|
||||
|
||||
@@ -167,12 +168,26 @@ PanelWindow {
|
||||
y: root.shouldBeVisible ? 0 : -30
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
FocusScope {
|
||||
anchors.fill: parent
|
||||
active: root.keepContentLoaded || root.shouldBeVisible || root.visible
|
||||
asynchronous: false
|
||||
focus: root.shouldBeVisible
|
||||
clip: false
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
anchors.fill: parent
|
||||
active: root.keepContentLoaded || root.shouldBeVisible || root.visible
|
||||
asynchronous: false
|
||||
focus: true
|
||||
clip: false
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
Qt.callLater(() => item.forceActiveFocus())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layer.effect: MultiEffect {
|
||||
|
||||
580
Modals/DankColorPickerModal.qml
Normal file
580
Modals/DankColorPickerModal.qml
Normal file
@@ -0,0 +1,580 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
property string pickerTitle: "Choose Color"
|
||||
property color selectedColor: Theme.primary
|
||||
property bool shouldBeVisible: false
|
||||
property var onColorSelectedCallback: null
|
||||
|
||||
signal colorSelected(color selectedColor)
|
||||
|
||||
property color currentColor: Theme.primary
|
||||
property real hue: 0
|
||||
property real saturation: 1
|
||||
property real value: 1
|
||||
property real alpha: 1
|
||||
property real gradientX: 0
|
||||
property real gradientY: 0
|
||||
|
||||
function open() {
|
||||
currentColor = selectedColor
|
||||
updateFromColor(currentColor)
|
||||
shouldBeVisible = true
|
||||
Qt.callLater(() => colorContent.forceActiveFocus())
|
||||
}
|
||||
|
||||
function close() {
|
||||
shouldBeVisible = false
|
||||
onColorSelectedCallback = null
|
||||
}
|
||||
|
||||
function show() {
|
||||
open()
|
||||
}
|
||||
|
||||
function hide() {
|
||||
close()
|
||||
}
|
||||
|
||||
onColorSelected: (color) => {
|
||||
if (onColorSelectedCallback) {
|
||||
onColorSelectedCallback(color)
|
||||
}
|
||||
}
|
||||
|
||||
function copyColorToClipboard(colorValue) {
|
||||
Quickshell.execDetached(["sh", "-c", `echo "${colorValue}" | wl-copy`])
|
||||
ToastService.showInfo(`Color ${colorValue} copied`)
|
||||
SessionData.addRecentColor(currentColor)
|
||||
}
|
||||
|
||||
function updateFromColor(color) {
|
||||
hue = color.hsvHue
|
||||
saturation = color.hsvSaturation
|
||||
value = color.hsvValue
|
||||
alpha = color.a
|
||||
gradientX = saturation
|
||||
gradientY = 1 - value
|
||||
}
|
||||
|
||||
function updateColor() {
|
||||
currentColor = Qt.hsva(hue, saturation, value, alpha)
|
||||
}
|
||||
|
||||
function updateColorFromGradient(x, y) {
|
||||
saturation = Math.max(0, Math.min(1, x))
|
||||
value = Math.max(0, Math.min(1, 1 - y))
|
||||
updateColor()
|
||||
}
|
||||
|
||||
function pickColorFromScreen() {
|
||||
close()
|
||||
hyprpickerProcess.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: hyprpickerProcess
|
||||
running: false
|
||||
command: ["hyprpicker", "--format=hex"]
|
||||
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
const colorStr = data.trim()
|
||||
if (colorStr.length >= 7 && colorStr.startsWith('#')) {
|
||||
root.currentColor = colorStr
|
||||
root.updateFromColor(root.currentColor)
|
||||
hexInput.text = root.currentColor.toString()
|
||||
copyColorToClipboard(colorStr)
|
||||
root.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onExited: (exitCode, exitStatus) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("hyprpicker exited with code:", exitCode)
|
||||
}
|
||||
root.open()
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var standardColors: [
|
||||
"#f44336", "#e91e63", "#9c27b0", "#673ab7", "#3f51b5", "#2196f3", "#03a9f4", "#00bcd4",
|
||||
"#009688", "#4caf50", "#8bc34a", "#cddc39", "#ffeb3b", "#ffc107", "#ff9800", "#ff5722",
|
||||
"#d32f2f", "#c2185b", "#7b1fa2", "#512da8", "#303f9f", "#1976d2", "#0288d1", "#0097a7",
|
||||
"#00796b", "#388e3c", "#689f38", "#afb42b", "#fbc02d", "#ffa000", "#f57c00", "#e64a19",
|
||||
"#c62828", "#ad1457", "#6a1b9a", "#4527a0", "#283593", "#1565c0", "#0277bd", "#00838f",
|
||||
"#00695c", "#2e7d32", "#558b2f", "#9e9d24", "#f9a825", "#ff8f00", "#ef6c00", "#d84315",
|
||||
"#ffffff", "#9e9e9e", "#212121"
|
||||
]
|
||||
|
||||
visible: shouldBeVisible
|
||||
|
||||
WlrLayershell.namespace: "quickshell:color-picker"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.close()
|
||||
|
||||
Rectangle {
|
||||
color: "#80000000"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: 680
|
||||
height: 680
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainer
|
||||
border.color: Theme.outlineMedium
|
||||
border.width: 1
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {} // Prevent clicks from propagating to background
|
||||
}
|
||||
|
||||
FocusScope {
|
||||
id: colorContent
|
||||
|
||||
anchors.fill: parent
|
||||
focus: root.shouldBeVisible
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Column {
|
||||
width: parent.width - 90
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: root.pickerTitle
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Select a color from the palette or use custom sliders")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
iconName: "colorize"
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: () => {
|
||||
pickColorFromScreen()
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
iconName: "close"
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: () => {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Rectangle {
|
||||
id: gradientPicker
|
||||
width: parent.width - 70
|
||||
height: 280
|
||||
radius: Theme.cornerRadius
|
||||
border.color: Theme.outlineStrong
|
||||
border.width: 1
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.hsva(root.hue, 1, 1, 1)
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Horizontal
|
||||
GradientStop { position: 0.0; color: "#ffffff" }
|
||||
GradientStop { position: 1.0; color: "transparent" }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Vertical
|
||||
GradientStop { position: 0.0; color: "transparent" }
|
||||
GradientStop { position: 1.0; color: "#000000" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: pickerCircle
|
||||
width: 16
|
||||
height: 16
|
||||
radius: 8
|
||||
border.color: "white"
|
||||
border.width: 2
|
||||
color: "transparent"
|
||||
x: root.gradientX * parent.width - width / 2
|
||||
y: root.gradientY * parent.height - height / 2
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - 4
|
||||
height: parent.height - 4
|
||||
radius: width / 2
|
||||
border.color: "black"
|
||||
border.width: 1
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.CrossCursor
|
||||
onPressed: mouse => {
|
||||
const x = Math.max(0, Math.min(1, mouse.x / width))
|
||||
const y = Math.max(0, Math.min(1, mouse.y / height))
|
||||
root.gradientX = x
|
||||
root.gradientY = y
|
||||
root.updateColorFromGradient(x, y)
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed) {
|
||||
const x = Math.max(0, Math.min(1, mouse.x / width))
|
||||
const y = Math.max(0, Math.min(1, mouse.y / height))
|
||||
root.gradientX = x
|
||||
root.gradientY = y
|
||||
root.updateColorFromGradient(x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: hueSlider
|
||||
width: 50
|
||||
height: 280
|
||||
radius: Theme.cornerRadius
|
||||
border.color: Theme.outlineStrong
|
||||
border.width: 1
|
||||
|
||||
gradient: Gradient {
|
||||
orientation: Gradient.Vertical
|
||||
GradientStop { position: 0.00; color: "#ff0000" }
|
||||
GradientStop { position: 0.17; color: "#ffff00" }
|
||||
GradientStop { position: 0.33; color: "#00ff00" }
|
||||
GradientStop { position: 0.50; color: "#00ffff" }
|
||||
GradientStop { position: 0.67; color: "#0000ff" }
|
||||
GradientStop { position: 0.83; color: "#ff00ff" }
|
||||
GradientStop { position: 1.00; color: "#ff0000" }
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: hueIndicator
|
||||
width: parent.width
|
||||
height: 4
|
||||
color: "white"
|
||||
border.color: "black"
|
||||
border.width: 1
|
||||
y: root.hue * parent.height - height / 2
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.SizeVerCursor
|
||||
onPressed: mouse => {
|
||||
const h = Math.max(0, Math.min(1, mouse.y / height))
|
||||
root.hue = h
|
||||
root.updateColor()
|
||||
}
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed) {
|
||||
const h = Math.max(0, Math.min(1, mouse.y / height))
|
||||
root.hue = h
|
||||
root.updateColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Material Colors")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
GridView {
|
||||
width: parent.width
|
||||
height: 140
|
||||
cellWidth: 38
|
||||
cellHeight: 38
|
||||
clip: true
|
||||
interactive: false
|
||||
model: root.standardColors
|
||||
|
||||
delegate: Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
color: modelData
|
||||
radius: 4
|
||||
border.color: Theme.outlineStrong
|
||||
border.width: 1
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: () => {
|
||||
root.currentColor = modelData
|
||||
root.updateFromColor(root.currentColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Column {
|
||||
width: 210
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Recent Colors")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Repeater {
|
||||
model: 5
|
||||
|
||||
Rectangle {
|
||||
width: 36
|
||||
height: 36
|
||||
radius: 4
|
||||
border.color: Theme.outlineStrong
|
||||
border.width: 1
|
||||
|
||||
color: {
|
||||
if (index < SessionData.recentColors.length) {
|
||||
return SessionData.recentColors[index]
|
||||
}
|
||||
return Theme.surfaceContainerHigh
|
||||
}
|
||||
|
||||
opacity: index < SessionData.recentColors.length ? 1.0 : 0.3
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: index < SessionData.recentColors.length ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
enabled: index < SessionData.recentColors.length
|
||||
onClicked: () => {
|
||||
if (index < SessionData.recentColors.length) {
|
||||
root.currentColor = SessionData.recentColors[index]
|
||||
root.updateFromColor(root.currentColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - 330
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Opacity")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
value: Math.round(root.alpha * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
showValue: false
|
||||
onSliderValueChanged: (newValue) => {
|
||||
root.alpha = newValue / 100
|
||||
root.updateColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 100
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: root.currentColor
|
||||
border.color: Theme.outlineStrong
|
||||
border.width: 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Hex:")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceTextMedium
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
DankTextField {
|
||||
id: hexInput
|
||||
width: 120
|
||||
height: 38
|
||||
text: root.currentColor.toString()
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
textColor: {
|
||||
if (text.length === 0) return Theme.surfaceText
|
||||
const hexPattern = /^#?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/
|
||||
return hexPattern.test(text) ? Theme.surfaceText : Theme.error
|
||||
}
|
||||
placeholderText: "#000000"
|
||||
backgroundColor: Theme.surfaceHover
|
||||
borderWidth: 1
|
||||
focusedBorderWidth: 2
|
||||
topPadding: Theme.spacingS
|
||||
bottomPadding: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onAccepted: () => {
|
||||
const hexPattern = /^#?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/
|
||||
if (!hexPattern.test(text)) return
|
||||
const color = Qt.color(text)
|
||||
if (color) {
|
||||
root.currentColor = color
|
||||
root.updateFromColor(color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankButton {
|
||||
width: 80
|
||||
buttonHeight: 36
|
||||
text: qsTr("Apply")
|
||||
backgroundColor: Theme.primary
|
||||
textColor: Theme.background
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: {
|
||||
const hexPattern = /^#?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/
|
||||
if (!hexPattern.test(hexInput.text)) return
|
||||
const color = Qt.color(hexInput.text)
|
||||
if (color) {
|
||||
root.currentColor = color
|
||||
root.updateFromColor(color)
|
||||
root.selectedColor = root.currentColor
|
||||
colorSelected(root.currentColor)
|
||||
SessionData.addRecentColor(root.currentColor)
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width - 460
|
||||
height: 1
|
||||
}
|
||||
|
||||
DankButton {
|
||||
width: 70
|
||||
buttonHeight: 36
|
||||
text: qsTr("Cancel")
|
||||
backgroundColor: "transparent"
|
||||
textColor: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: root.close()
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
border.color: Theme.surfaceVariantAlpha
|
||||
border.width: 1
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
|
||||
DankButton {
|
||||
width: 70
|
||||
buttonHeight: 36
|
||||
text: qsTr("Copy")
|
||||
backgroundColor: Theme.primary
|
||||
textColor: Theme.background
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: {
|
||||
const colorString = root.currentColor.toString()
|
||||
copyColorToClipboard(colorString)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ DankModal {
|
||||
property bool weAvailable: false
|
||||
property string wePath: ""
|
||||
property bool weMode: false
|
||||
property var parentModal: null
|
||||
|
||||
signal fileSelected(string path)
|
||||
|
||||
@@ -131,6 +132,8 @@ DankModal {
|
||||
|
||||
objectName: "fileBrowserModal"
|
||||
allowStacking: true
|
||||
closeOnEscapeKey: false
|
||||
shouldHaveFocus: shouldBeVisible
|
||||
Component.onCompleted: {
|
||||
currentPath = getLastPath()
|
||||
}
|
||||
@@ -165,10 +168,23 @@ DankModal {
|
||||
visible: false
|
||||
onBackgroundClicked: close()
|
||||
onOpened: {
|
||||
modalFocusScope.forceActiveFocus()
|
||||
if (parentModal) {
|
||||
parentModal.shouldHaveFocus = false
|
||||
parentModal.allowFocusOverride = true
|
||||
}
|
||||
Qt.callLater(() => {
|
||||
if (contentLoader && contentLoader.item) {
|
||||
contentLoader.item.forceActiveFocus()
|
||||
}
|
||||
})
|
||||
}
|
||||
modalFocusScope.Keys.onPressed: function (event) {
|
||||
keyboardController.handleKey(event)
|
||||
onDialogClosed: {
|
||||
if (parentModal) {
|
||||
parentModal.allowFocusOverride = false
|
||||
parentModal.shouldHaveFocus = Qt.binding(() => {
|
||||
return parentModal.shouldBeVisible
|
||||
})
|
||||
}
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
@@ -455,6 +471,16 @@ DankModal {
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
Keys.onPressed: event => {
|
||||
keyboardController.handleKey(event)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
@@ -755,7 +781,7 @@ DankModal {
|
||||
width: parent.width - saveButton.width - Theme.spacingM
|
||||
height: 40
|
||||
text: defaultFileName
|
||||
placeholderText: "Enter filename..."
|
||||
placeholderText: qsTr("Enter filename...")
|
||||
ignoreLeftRightKeys: false
|
||||
focus: saveMode
|
||||
topPadding: Theme.spacingS
|
||||
@@ -788,7 +814,7 @@ DankModal {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Save"
|
||||
text: qsTr("Save")
|
||||
color: fileNameInput.text.trim() !== "" ? Theme.primaryText : Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "File Information"
|
||||
text: qsTr("File Information")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -56,7 +56,7 @@ DankModal {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Network Information"
|
||||
text: qsTr("Network Information")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -126,7 +126,7 @@ DankModal {
|
||||
id: closeText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: "Close"
|
||||
text: qsTr("Close")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.background
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -32,24 +32,24 @@ DankModal {
|
||||
close();
|
||||
const actions = {
|
||||
"logout": {
|
||||
"title": "Log Out",
|
||||
"message": "Are you sure you want to log out?"
|
||||
"title": qsTr("Log Out"),
|
||||
"message": qsTr("Are you sure you want to log out?")
|
||||
},
|
||||
"suspend": {
|
||||
"title": "Suspend",
|
||||
"message": "Are you sure you want to suspend the system?"
|
||||
"title": qsTr("Suspend"),
|
||||
"message": qsTr("Are you sure you want to suspend the system?")
|
||||
},
|
||||
"hibernate": {
|
||||
"title": "Hibernate",
|
||||
"message": "Are you sure you want to hibernate the system?"
|
||||
"title": qsTr("Hibernate"),
|
||||
"message": qsTr("Are you sure you want to hibernate the system?")
|
||||
},
|
||||
"reboot": {
|
||||
"title": "Reboot",
|
||||
"message": "Are you sure you want to reboot the system?"
|
||||
"title": qsTr("Reboot"),
|
||||
"message": qsTr("Are you sure you want to reboot the system?")
|
||||
},
|
||||
"poweroff": {
|
||||
"title": "Power Off",
|
||||
"message": "Are you sure you want to power off the system?"
|
||||
"title": qsTr("Power Off"),
|
||||
"message": qsTr("Are you sure you want to power off the system?")
|
||||
}
|
||||
}
|
||||
const selected = actions[action]
|
||||
@@ -144,7 +144,7 @@ DankModal {
|
||||
width: parent.width
|
||||
|
||||
StyledText {
|
||||
text: "Power Options"
|
||||
text: qsTr("Power Options")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -201,7 +201,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Log Out"
|
||||
text: qsTr("Log Out")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -254,7 +254,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Suspend"
|
||||
text: qsTr("Suspend")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -308,7 +308,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Hibernate"
|
||||
text: qsTr("Hibernate")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -362,7 +362,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Reboot"
|
||||
text: qsTr("Reboot")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: rebootArea.containsMouse ? Theme.warning : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -416,7 +416,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Power Off"
|
||||
text: qsTr("Power Off")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: powerOffArea.containsMouse ? Theme.error : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -123,7 +123,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "System Monitor Unavailable"
|
||||
text: qsTr("System Monitor Unavailable")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Bold
|
||||
color: Theme.error
|
||||
@@ -154,7 +154,7 @@ DankModal {
|
||||
height: 40
|
||||
|
||||
StyledText {
|
||||
text: "System Monitor"
|
||||
text: qsTr("System Monitor")
|
||||
font.pixelSize: Theme.fontSizeLarge + 4
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
|
||||
@@ -19,7 +19,7 @@ Item {
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
StyledText {
|
||||
text: "Battery not detected - only AC power settings available"
|
||||
text: qsTr("Battery not detected - only AC power settings available")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
visible: !BatteryService.batteryAvailable
|
||||
@@ -51,7 +51,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Idle Settings"
|
||||
text: qsTr("Idle Settings")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -79,7 +79,7 @@ Item {
|
||||
property var timeoutOptions: ["Never", "1 minute", "2 minutes", "3 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "30 minutes", "1 hour", "1 hour 30 minutes", "2 hours", "3 hours"]
|
||||
property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
||||
|
||||
text: "Automatically lock after"
|
||||
text: qsTr("Automatically lock after")
|
||||
options: timeoutOptions
|
||||
|
||||
Connections {
|
||||
@@ -115,7 +115,7 @@ Item {
|
||||
property var timeoutOptions: ["Never", "1 minute", "2 minutes", "3 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "30 minutes", "1 hour", "1 hour 30 minutes", "2 hours", "3 hours"]
|
||||
property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
||||
|
||||
text: "Turn off monitors after"
|
||||
text: qsTr("Turn off monitors after")
|
||||
options: timeoutOptions
|
||||
|
||||
Connections {
|
||||
@@ -151,7 +151,7 @@ Item {
|
||||
property var timeoutOptions: ["Never", "1 minute", "2 minutes", "3 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "30 minutes", "1 hour", "1 hour 30 minutes", "2 hours", "3 hours"]
|
||||
property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
||||
|
||||
text: "Suspend system after"
|
||||
text: qsTr("Suspend system after")
|
||||
options: timeoutOptions
|
||||
|
||||
Connections {
|
||||
@@ -187,7 +187,7 @@ Item {
|
||||
property var timeoutOptions: ["Never", "1 minute", "2 minutes", "3 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "30 minutes", "1 hour", "1 hour 30 minutes", "2 hours", "3 hours"]
|
||||
property var timeoutValues: [0, 60, 120, 180, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 10800]
|
||||
|
||||
text: "Hibernate system after"
|
||||
text: qsTr("Hibernate system after")
|
||||
options: timeoutOptions
|
||||
visible: SessionService.hibernateSupported
|
||||
|
||||
@@ -221,14 +221,14 @@ Item {
|
||||
|
||||
DankToggle {
|
||||
width: parent.width
|
||||
text: "Lock before suspend"
|
||||
text: qsTr("Lock before suspend")
|
||||
description: "Automatically lock the screen when the system prepares to suspend"
|
||||
checked: SessionData.lockBeforeSuspend
|
||||
onToggled: checked => SessionData.setLockBeforeSuspend(checked)
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Idle monitoring not supported - requires newer Quickshell version"
|
||||
text: qsTr("Idle monitoring not supported - requires newer Quickshell version")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.error
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -2,11 +2,12 @@ import QtQuick
|
||||
import qs.Common
|
||||
import qs.Modules.Settings
|
||||
|
||||
Item {
|
||||
FocusScope {
|
||||
id: root
|
||||
|
||||
property int currentIndex: 0
|
||||
property var parentModal: null
|
||||
focus: true
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
@@ -68,6 +69,7 @@ Item {
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: DankBarTab {
|
||||
parentModal: root.parentModal
|
||||
}
|
||||
|
||||
}
|
||||
@@ -162,6 +164,7 @@ Item {
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: PluginsTab {
|
||||
parentModal: root.parentModal
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ DankModal {
|
||||
id: profileBrowser
|
||||
|
||||
allowStacking: true
|
||||
parentModal: settingsModal
|
||||
browserTitle: "Select Profile Image"
|
||||
browserIcon: "person"
|
||||
browserType: "profile"
|
||||
@@ -87,12 +88,6 @@ DankModal {
|
||||
close();
|
||||
}
|
||||
onDialogClosed: () => {
|
||||
if (settingsModal) {
|
||||
settingsModal.allowFocusOverride = false;
|
||||
settingsModal.shouldHaveFocus = Qt.binding(() => {
|
||||
return settingsModal.shouldBeVisible;
|
||||
});
|
||||
}
|
||||
allowStacking = true;
|
||||
}
|
||||
}
|
||||
@@ -101,6 +96,7 @@ DankModal {
|
||||
id: wallpaperBrowser
|
||||
|
||||
allowStacking: true
|
||||
parentModal: settingsModal
|
||||
browserTitle: "Select Wallpaper"
|
||||
browserIcon: "wallpaper"
|
||||
browserType: "wallpaper"
|
||||
@@ -115,7 +111,7 @@ DankModal {
|
||||
}
|
||||
|
||||
settingsContent: Component {
|
||||
Item {
|
||||
FocusScope {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
|
||||
@@ -144,7 +140,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Settings"
|
||||
text: qsTr("Settings")
|
||||
font.pixelSize: Theme.fontSizeXLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -13,8 +13,13 @@ Item {
|
||||
property alias searchField: searchField
|
||||
property var parentModal: null
|
||||
|
||||
function resetScroll() {
|
||||
resultsView.resetScroll()
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
clip: false
|
||||
Keys.onPressed: event => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
if (parentModal)
|
||||
@@ -101,27 +106,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingM
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: categorySelector.height + Theme.spacingS * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
visible: appLauncher.categories.length > 1 || appLauncher.model.count > 0
|
||||
|
||||
CategorySelector {
|
||||
id: categorySelector
|
||||
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
categories: appLauncher.categories
|
||||
selectedCategory: appLauncher.selectedCategory
|
||||
compact: false
|
||||
onCategorySelected: category => {
|
||||
appLauncher.setCategory(category)
|
||||
}
|
||||
}
|
||||
}
|
||||
clip: false
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
@@ -228,6 +213,7 @@ Item {
|
||||
}
|
||||
|
||||
SpotlightResults {
|
||||
id: resultsView
|
||||
appLauncher: spotlightKeyHandler.appLauncher
|
||||
contextMenu: contextMenu
|
||||
}
|
||||
@@ -245,7 +231,7 @@ Item {
|
||||
visible: contextMenu.visible
|
||||
z: 999
|
||||
onClicked: () => {
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -1,65 +1,72 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
Popup {
|
||||
id: contextMenu
|
||||
|
||||
property var currentApp: null
|
||||
property bool menuVisible: false
|
||||
property var appLauncher: null
|
||||
property var parentHandler: null
|
||||
|
||||
function show(x, y, app) {
|
||||
currentApp = app
|
||||
const menuWidth = 180
|
||||
const menuHeight = menuColumn.implicitHeight + Theme.spacingS * 2
|
||||
let finalX = x + 8
|
||||
let finalY = y + 8
|
||||
if (parentHandler) {
|
||||
if (finalX + menuWidth > parentHandler.width)
|
||||
finalX = x - menuWidth - 8
|
||||
|
||||
if (finalY + menuHeight > parentHandler.height)
|
||||
finalY = y - menuHeight - 8
|
||||
|
||||
finalX = Math.max(8, Math.min(finalX, parentHandler.width - menuWidth - 8))
|
||||
finalY = Math.max(8, Math.min(finalY, parentHandler.height - menuHeight - 8))
|
||||
}
|
||||
contextMenu.x = finalX
|
||||
contextMenu.y = finalY
|
||||
contextMenu.visible = true
|
||||
contextMenu.menuVisible = true
|
||||
contextMenu.x = x + 4
|
||||
contextMenu.y = y + 4
|
||||
contextMenu.open()
|
||||
}
|
||||
|
||||
function close() {
|
||||
contextMenu.menuVisible = false
|
||||
Qt.callLater(() => {
|
||||
contextMenu.visible = false
|
||||
})
|
||||
function hide() {
|
||||
contextMenu.close()
|
||||
}
|
||||
|
||||
visible: false
|
||||
width: 180
|
||||
width: Math.max(180, Math.min(300, menuColumn.implicitWidth + Theme.spacingS * 2))
|
||||
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.popupBackground()
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
z: 1000
|
||||
opacity: menuVisible ? 1 : 0
|
||||
scale: menuVisible ? 1 : 0.85
|
||||
padding: 0
|
||||
closePolicy: Popup.CloseOnPressOutside
|
||||
modal: false
|
||||
dim: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: -2
|
||||
anchors.bottomMargin: -4
|
||||
radius: parent.radius
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
z: parent.z - 1
|
||||
background: Rectangle {
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.popupBackground()
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: -2
|
||||
anchors.bottomMargin: -4
|
||||
radius: parent.radius
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -125,7 +132,7 @@ Rectangle {
|
||||
SessionData.removePinnedApp(appId)
|
||||
else
|
||||
SessionData.addPinnedApp(appId)
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,6 +151,82 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: contextMenu.currentApp && contextMenu.currentApp.desktopEntry && contextMenu.currentApp.desktopEntry.actions ? contextMenu.currentApp.desktopEntry.actions : []
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: actionMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.iconSize - 2
|
||||
height: Theme.iconSize - 2
|
||||
visible: modelData.icon && modelData.icon !== ""
|
||||
|
||||
IconImage {
|
||||
anchors.fill: parent
|
||||
source: modelData.icon ? Quickshell.iconPath(modelData.icon, true) : ""
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.name || ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
elide: Text.ElideRight
|
||||
width: parent.width - (modelData.icon && modelData.icon !== "" ? (Theme.iconSize - 2 + Theme.spacingS) : 0)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: actionMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (modelData && contextMenu.currentApp && contextMenu.currentApp.desktopEntry) {
|
||||
SessionService.launchDesktopAction(contextMenu.currentApp.desktopEntry, modelData)
|
||||
if (appLauncher) {
|
||||
appLauncher.appLaunched(contextMenu.currentApp)
|
||||
}
|
||||
}
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: contextMenu.currentApp && contextMenu.currentApp.desktopEntry && contextMenu.currentApp.desktopEntry.actions && contextMenu.currentApp.desktopEntry.actions.length > 0
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: "transparent"
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -165,7 +248,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Launch"
|
||||
text: qsTr("Launch")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
@@ -183,23 +266,72 @@ Rectangle {
|
||||
if (contextMenu.currentApp && appLauncher)
|
||||
appLauncher.launchApp(contextMenu.currentApp)
|
||||
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: SessionService.hasPrimeRun
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: "transparent"
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: SessionService.hasPrimeRun
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: primeRunMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 2
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Launch on dGPU")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: primeRunMouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: () => {
|
||||
if (contextMenu.currentApp && contextMenu.currentApp.desktopEntry) {
|
||||
SessionService.launchDesktopEntry(contextMenu.currentApp.desktopEntry, true)
|
||||
if (appLauncher) {
|
||||
appLauncher.appLaunched(contextMenu.currentApp)
|
||||
}
|
||||
}
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +18,33 @@ DankModal {
|
||||
function show() {
|
||||
spotlightOpen = true
|
||||
open()
|
||||
if (contentLoader.item && contentLoader.item.appLauncher) {
|
||||
contentLoader.item.appLauncher.searchQuery = ""
|
||||
}
|
||||
|
||||
Qt.callLater(() => {
|
||||
if (contentLoader.item && contentLoader.item.searchField) {
|
||||
contentLoader.item.searchField.forceActiveFocus()
|
||||
}
|
||||
})
|
||||
if (contentLoader.item && contentLoader.item.searchField) {
|
||||
contentLoader.item.searchField.forceActiveFocus()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function hide() {
|
||||
spotlightOpen = false
|
||||
close()
|
||||
cleanupTimer.restart()
|
||||
}
|
||||
|
||||
onDialogClosed: {
|
||||
if (contentLoader.item) {
|
||||
if (contentLoader.item.appLauncher) {
|
||||
contentLoader.item.appLauncher.searchQuery = ""
|
||||
contentLoader.item.appLauncher.selectedIndex = 0
|
||||
contentLoader.item.appLauncher.setCategory("All")
|
||||
}
|
||||
if (contentLoader.item.resetScroll) {
|
||||
contentLoader.item.resetScroll()
|
||||
}
|
||||
if (contentLoader.item.searchField) {
|
||||
contentLoader.item.searchField.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
@@ -45,7 +57,7 @@ DankModal {
|
||||
|
||||
shouldBeVisible: spotlightOpen
|
||||
width: 550
|
||||
height: 600
|
||||
height: 700
|
||||
backgroundColor: Theme.popupBackground()
|
||||
cornerRadius: Theme.cornerRadius
|
||||
borderColor: Theme.outlineMedium
|
||||
@@ -69,19 +81,6 @@ DankModal {
|
||||
}
|
||||
content: spotlightContent
|
||||
|
||||
Timer {
|
||||
id: cleanupTimer
|
||||
|
||||
interval: animationDuration + 50
|
||||
onTriggered: {
|
||||
if (contentLoader.item && contentLoader.item.appLauncher) {
|
||||
contentLoader.item.appLauncher.searchQuery = ""
|
||||
contentLoader.item.appLauncher.selectedIndex = 0
|
||||
contentLoader.item.appLauncher.setCategory("All")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onCloseAllModalsExcept(excludedModal) {
|
||||
if (excludedModal !== spotlightModal && !allowStacking && spotlightOpen) {
|
||||
|
||||
@@ -10,10 +10,16 @@ Rectangle {
|
||||
property var appLauncher: null
|
||||
property var contextMenu: null
|
||||
|
||||
function resetScroll() {
|
||||
resultsList.contentY = 0
|
||||
resultsGrid.contentY = 0
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
height: parent.height - y
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
clip: false
|
||||
|
||||
DankListView {
|
||||
id: resultsList
|
||||
@@ -157,7 +163,8 @@ Rectangle {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
resultsList.itemClicked(index, model)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
const modalPos = mapToItem(resultsContainer.parent, mouse.x, mouse.y)
|
||||
const globalPos = mapToItem(null, mouse.x, mouse.y)
|
||||
const modalPos = resultsContainer.parent.mapFromItem(null, globalPos.x, globalPos.y)
|
||||
resultsList.itemRightClicked(index, model, modalPos.x, modalPos.y)
|
||||
}
|
||||
}
|
||||
@@ -308,7 +315,8 @@ Rectangle {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
resultsGrid.itemClicked(index, model)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
const modalPos = mapToItem(resultsContainer.parent, mouse.x, mouse.y)
|
||||
const globalPos = mapToItem(null, mouse.x, mouse.y)
|
||||
const modalPos = resultsContainer.parent.mapFromItem(null, globalPos.x, globalPos.y)
|
||||
resultsGrid.itemRightClicked(index, model, modalPos.x, modalPos.y)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ DankModal {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Connect to Wi-Fi"
|
||||
text: qsTr("Connect to Wi-Fi")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -201,7 +201,7 @@ DankModal {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Show password"
|
||||
text: qsTr("Show password")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -229,7 +229,7 @@ DankModal {
|
||||
id: cancelText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: "Cancel"
|
||||
text: qsTr("Cancel")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -260,7 +260,7 @@ DankModal {
|
||||
id: connectText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: "Connect"
|
||||
text: qsTr("Connect")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.background
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
@@ -186,7 +187,7 @@ DankPopout {
|
||||
|
||||
StyledText {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Applications"
|
||||
text: qsTr("Applications")
|
||||
font.pixelSize: Theme.fontSizeLarge + 4
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
@@ -488,7 +489,8 @@ DankPopout {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
appList.itemClicked(index, model)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
var panelPos = mapToItem(contextMenu.parent, mouse.x, mouse.y)
|
||||
var globalPos = mapToItem(null, mouse.x, mouse.y)
|
||||
var panelPos = contextMenu.parent.mapFromItem(null, globalPos.x, globalPos.y)
|
||||
appList.itemRightClicked(index, model, panelPos.x, panelPos.y)
|
||||
}
|
||||
}
|
||||
@@ -649,7 +651,8 @@ DankPopout {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
appGrid.itemClicked(index, model)
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
var panelPos = mapToItem(contextMenu.parent, mouse.x, mouse.y)
|
||||
var globalPos = mapToItem(null, mouse.x, mouse.y)
|
||||
var panelPos = contextMenu.parent.mapFromItem(null, globalPos.x, globalPos.y)
|
||||
appGrid.itemRightClicked(index, model, panelPos.x, panelPos.y)
|
||||
}
|
||||
}
|
||||
@@ -662,68 +665,68 @@ DankPopout {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Popup {
|
||||
id: contextMenu
|
||||
|
||||
property var currentApp: null
|
||||
property bool menuVisible: false
|
||||
|
||||
readonly property string appId: (currentApp && currentApp.desktopEntry) ? (currentApp.desktopEntry.id || currentApp.desktopEntry.execString || "") : ""
|
||||
readonly property bool isPinned: appId && SessionData.isPinnedApp(appId)
|
||||
|
||||
function show(x, y, app) {
|
||||
currentApp = app
|
||||
|
||||
const menuWidth = 180
|
||||
const menuHeight = menuColumn.implicitHeight + Theme.spacingS * 2
|
||||
|
||||
let finalX = x + 8
|
||||
let finalY = y + 8
|
||||
|
||||
if (finalX + menuWidth > appDrawerPopout.popupWidth) {
|
||||
finalX = x - menuWidth - 8
|
||||
}
|
||||
|
||||
if (finalY + menuHeight > appDrawerPopout.popupHeight) {
|
||||
finalY = y - menuHeight - 8
|
||||
}
|
||||
|
||||
finalX = Math.max(8, Math.min(finalX, appDrawerPopout.popupWidth - menuWidth - 8))
|
||||
finalY = Math.max(8, Math.min(finalY, appDrawerPopout.popupHeight - menuHeight - 8))
|
||||
|
||||
contextMenu.x = finalX
|
||||
contextMenu.y = finalY
|
||||
contextMenu.visible = true
|
||||
contextMenu.menuVisible = true
|
||||
contextMenu.x = x + 4
|
||||
contextMenu.y = y + 4
|
||||
contextMenu.open()
|
||||
}
|
||||
|
||||
function close() {
|
||||
contextMenu.menuVisible = false
|
||||
Qt.callLater(() => {
|
||||
contextMenu.visible = false
|
||||
})
|
||||
function hide() {
|
||||
contextMenu.close()
|
||||
}
|
||||
|
||||
visible: false
|
||||
width: 180
|
||||
height: menuColumn.implicitHeight + Theme.spacingS * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.popupBackground()
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 0
|
||||
z: 1000
|
||||
opacity: menuVisible ? 1 : 0
|
||||
scale: menuVisible ? 1 : 0.85
|
||||
padding: 0
|
||||
closePolicy: Popup.CloseOnPressOutside
|
||||
modal: false
|
||||
dim: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: -2
|
||||
anchors.bottomMargin: -4
|
||||
radius: parent.radius
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
z: parent.z - 1
|
||||
background: Rectangle {
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.popupBackground()
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 4
|
||||
anchors.leftMargin: 2
|
||||
anchors.rightMargin: -2
|
||||
anchors.bottomMargin: -4
|
||||
radius: parent.radius
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
z: -1
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -778,7 +781,7 @@ DankPopout {
|
||||
} else {
|
||||
SessionData.addPinnedApp(contextMenu.appId)
|
||||
}
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -797,6 +800,76 @@ DankPopout {
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: contextMenu.currentApp && contextMenu.currentApp.desktopEntry && contextMenu.currentApp.desktopEntry.actions ? contextMenu.currentApp.desktopEntry.actions : []
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: actionMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.iconSize - 2
|
||||
height: Theme.iconSize - 2
|
||||
visible: modelData.icon && modelData.icon !== ""
|
||||
|
||||
IconImage {
|
||||
anchors.fill: parent
|
||||
source: modelData.icon ? Quickshell.iconPath(modelData.icon, true) : ""
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: modelData.name || ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: actionMouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (modelData && contextMenu.currentApp && contextMenu.currentApp.desktopEntry) {
|
||||
SessionService.launchDesktopAction(contextMenu.currentApp.desktopEntry, modelData)
|
||||
appLauncher.appLaunched(contextMenu.currentApp)
|
||||
}
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: contextMenu.currentApp && contextMenu.currentApp.desktopEntry && contextMenu.currentApp.desktopEntry.actions && contextMenu.currentApp.desktopEntry.actions.length > 0
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: "transparent"
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 32
|
||||
@@ -818,7 +891,7 @@ DankPopout {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Launch"
|
||||
text: qsTr("Launch")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
@@ -836,23 +909,70 @@ DankPopout {
|
||||
if (contextMenu.currentApp)
|
||||
appLauncher.launchApp(contextMenu.currentApp)
|
||||
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
Rectangle {
|
||||
visible: SessionService.hasPrimeRun
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
height: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: "transparent"
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
Rectangle {
|
||||
visible: SessionService.hasPrimeRun
|
||||
width: parent.width
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: primeRunMouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 2
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Launch on dGPU")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: primeRunMouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (contextMenu.currentApp && contextMenu.currentApp.desktopEntry) {
|
||||
SessionService.launchDesktopEntry(contextMenu.currentApp.desktopEntry, true)
|
||||
appLauncher.appLaunched(contextMenu.currentApp)
|
||||
}
|
||||
contextMenu.hide()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -862,7 +982,7 @@ DankPopout {
|
||||
visible: contextMenu.visible
|
||||
z: 999
|
||||
onClicked: {
|
||||
contextMenu.close()
|
||||
contextMenu.hide()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -18,7 +18,6 @@ Item {
|
||||
readonly property color unselectedBorderColor: "transparent"
|
||||
|
||||
function handleCategoryClick(category) {
|
||||
selectedCategory = category
|
||||
categorySelected(category)
|
||||
}
|
||||
|
||||
|
||||
241
Modules/ControlCenter/BuiltinPlugins/VpnWidget.qml
Normal file
241
Modules/ControlCenter/BuiltinPlugins/VpnWidget.qml
Normal file
@@ -0,0 +1,241 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.Plugins
|
||||
|
||||
PluginComponent {
|
||||
id: root
|
||||
|
||||
ccWidgetIcon: VpnService.isBusy ? "sync" : (VpnService.connected ? "vpn_lock" : "vpn_key_off")
|
||||
ccWidgetPrimaryText: "VPN"
|
||||
ccWidgetSecondaryText: {
|
||||
if (!VpnService.connected)
|
||||
return "Disconnected"
|
||||
const names = VpnService.activeNames || []
|
||||
if (names.length <= 1)
|
||||
return names[0] || "Connected"
|
||||
return names[0] + " +" + (names.length - 1)
|
||||
}
|
||||
ccWidgetIsActive: VpnService.connected
|
||||
|
||||
onCcWidgetToggled: {
|
||||
if (VpnService.connected) {
|
||||
VpnService.disconnectAllActive()
|
||||
} else if (VpnService.profiles.length > 0) {
|
||||
VpnService.connect(VpnService.profiles[0].uuid)
|
||||
}
|
||||
}
|
||||
|
||||
ccDetailContent: Component {
|
||||
Rectangle {
|
||||
id: detailRoot
|
||||
implicitHeight: detailColumn.implicitHeight + Theme.spacingM * 2
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainerHigh
|
||||
|
||||
Column {
|
||||
id: detailColumn
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
RowLayout {
|
||||
spacing: Theme.spacingS
|
||||
width: parent.width
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (!VpnService.connected)
|
||||
return "Active: None"
|
||||
const names = VpnService.activeNames || []
|
||||
if (names.length <= 1)
|
||||
return "Active: " + (names[0] || "VPN")
|
||||
return "Active: " + names[0] + " +" + (names.length - 1)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 28
|
||||
radius: 14
|
||||
color: discAllArea.containsMouse ? Theme.errorHover : Theme.surfaceLight
|
||||
visible: VpnService.connected
|
||||
width: 110
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
DankIcon {
|
||||
name: "link_off"
|
||||
size: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Disconnect")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: discAllArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: VpnService.disconnectAllActive()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 1
|
||||
width: parent.width
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.12)
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
width: parent.width
|
||||
height: 160
|
||||
contentHeight: listCol.height
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
id: listCol
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: VpnService.profiles.length === 0 ? 120 : 0
|
||||
visible: height > 0
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: "playlist_remove"
|
||||
size: 36
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("No VPN profiles found")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Add a VPN in NetworkManager")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: VpnService.profiles
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
|
||||
width: parent ? parent.width : 300
|
||||
height: 50
|
||||
radius: Theme.cornerRadius
|
||||
color: rowArea.containsMouse ? Theme.primaryHoverLight : (VpnService.isActiveUuid(modelData.uuid) ? Theme.primaryPressed : Theme.surfaceLight)
|
||||
border.width: VpnService.isActiveUuid(modelData.uuid) ? 2 : 1
|
||||
border.color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.outlineLight
|
||||
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.margins: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: VpnService.isActiveUuid(modelData.uuid) ? "vpn_lock" : "vpn_key_off"
|
||||
size: Theme.iconSize - 4
|
||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 2
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
StyledText {
|
||||
text: modelData.name
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: VpnService.isActiveUuid(modelData.uuid) ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (modelData.type === "wireguard")
|
||||
return "WireGuard"
|
||||
const svc = modelData.serviceType || ""
|
||||
if (svc.indexOf("openvpn") !== -1)
|
||||
return "OpenVPN"
|
||||
if (svc.indexOf("wireguard") !== -1)
|
||||
return "WireGuard (plugin)"
|
||||
if (svc.indexOf("openconnect") !== -1)
|
||||
return "OpenConnect"
|
||||
if (svc.indexOf("fortissl") !== -1 || svc.indexOf("forti") !== -1)
|
||||
return "Fortinet"
|
||||
if (svc.indexOf("strongswan") !== -1)
|
||||
return "IPsec (strongSwan)"
|
||||
if (svc.indexOf("libreswan") !== -1)
|
||||
return "IPsec (Libreswan)"
|
||||
if (svc.indexOf("l2tp") !== -1)
|
||||
return "L2TP/IPsec"
|
||||
if (svc.indexOf("pptp") !== -1)
|
||||
return "PPTP"
|
||||
if (svc.indexOf("vpnc") !== -1)
|
||||
return "Cisco (vpnc)"
|
||||
if (svc.indexOf("sstp") !== -1)
|
||||
return "SSTP"
|
||||
if (svc)
|
||||
return svc.split('.').pop()
|
||||
return "VPN"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: rowArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: VpnService.toggle(modelData.uuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Modules.ControlCenter.Details
|
||||
import qs.Modules.ControlCenter.Models
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -9,31 +11,94 @@ Item {
|
||||
property var expandedWidgetData: null
|
||||
property var bluetoothCodecSelector: null
|
||||
|
||||
property var pluginDetailInstance: null
|
||||
property var widgetModel: null
|
||||
|
||||
Loader {
|
||||
id: pluginDetailLoader
|
||||
width: parent.width
|
||||
height: 250
|
||||
y: Theme.spacingS
|
||||
active: parent.height > 0
|
||||
property string sectionKey: root.expandedSection
|
||||
sourceComponent: {
|
||||
switch (root.expandedSection) {
|
||||
case "network":
|
||||
case "wifi": return networkDetailComponent
|
||||
case "bluetooth": return bluetoothDetailComponent
|
||||
case "audioOutput": return audioOutputDetailComponent
|
||||
case "audioInput": return audioInputDetailComponent
|
||||
case "battery": return batteryDetailComponent
|
||||
default:
|
||||
if (root.expandedSection.startsWith("diskUsage_")) {
|
||||
return diskUsageDetailComponent
|
||||
}
|
||||
return null
|
||||
active: false
|
||||
sourceComponent: null
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: coreDetailLoader
|
||||
width: parent.width
|
||||
height: 250
|
||||
y: Theme.spacingS
|
||||
active: false
|
||||
sourceComponent: null
|
||||
}
|
||||
|
||||
onExpandedSectionChanged: {
|
||||
if (pluginDetailInstance) {
|
||||
pluginDetailInstance.destroy()
|
||||
pluginDetailInstance = null
|
||||
}
|
||||
pluginDetailLoader.active = false
|
||||
coreDetailLoader.active = false
|
||||
|
||||
if (!root.expandedSection) {
|
||||
return
|
||||
}
|
||||
|
||||
if (root.expandedSection.startsWith("builtin_")) {
|
||||
const builtinId = root.expandedSection
|
||||
let builtinInstance = null
|
||||
|
||||
if (builtinId === "builtin_vpn" && widgetModel?.vpnBuiltinInstance) {
|
||||
builtinInstance = widgetModel.vpnBuiltinInstance
|
||||
}
|
||||
|
||||
if (!builtinInstance || !builtinInstance.ccDetailContent) {
|
||||
return
|
||||
}
|
||||
|
||||
pluginDetailLoader.sourceComponent = builtinInstance.ccDetailContent
|
||||
pluginDetailLoader.active = parent.height > 0
|
||||
return
|
||||
}
|
||||
onSectionKeyChanged: {
|
||||
active = false
|
||||
active = true
|
||||
|
||||
if (root.expandedSection.startsWith("plugin_")) {
|
||||
const pluginId = root.expandedSection.replace("plugin_", "")
|
||||
const pluginComponent = PluginService.pluginWidgetComponents[pluginId]
|
||||
if (!pluginComponent) {
|
||||
return
|
||||
}
|
||||
|
||||
pluginDetailInstance = pluginComponent.createObject(null)
|
||||
if (!pluginDetailInstance || !pluginDetailInstance.ccDetailContent) {
|
||||
if (pluginDetailInstance) {
|
||||
pluginDetailInstance.destroy()
|
||||
pluginDetailInstance = null
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
pluginDetailLoader.sourceComponent = pluginDetailInstance.ccDetailContent
|
||||
pluginDetailLoader.active = parent.height > 0
|
||||
return
|
||||
}
|
||||
|
||||
if (root.expandedSection.startsWith("diskUsage_")) {
|
||||
coreDetailLoader.sourceComponent = diskUsageDetailComponent
|
||||
coreDetailLoader.active = parent.height > 0
|
||||
return
|
||||
}
|
||||
|
||||
switch (root.expandedSection) {
|
||||
case "network":
|
||||
case "wifi": coreDetailLoader.sourceComponent = networkDetailComponent; break
|
||||
case "bluetooth": coreDetailLoader.sourceComponent = bluetoothDetailComponent; break
|
||||
case "audioOutput": coreDetailLoader.sourceComponent = audioOutputDetailComponent; break
|
||||
case "audioInput": coreDetailLoader.sourceComponent = audioInputDetailComponent; break
|
||||
case "battery": coreDetailLoader.sourceComponent = batteryDetailComponent; break
|
||||
default: return
|
||||
}
|
||||
|
||||
coreDetailLoader.active = parent.height > 0
|
||||
}
|
||||
|
||||
Component {
|
||||
|
||||
@@ -62,7 +62,8 @@ Column {
|
||||
property var rowWidgets: modelData
|
||||
property bool isSliderOnlyRow: {
|
||||
const widgets = rowWidgets || []
|
||||
if (widgets.length === 0) return false
|
||||
if (widgets.length === 0)
|
||||
return false
|
||||
return widgets.every(w => w.id === "volumeSlider" || w.id === "brightnessSlider" || w.id === "inputVolumeSlider")
|
||||
}
|
||||
topPadding: isSliderOnlyRow ? (root.editMode ? 4 : -6) : 0
|
||||
@@ -121,7 +122,11 @@ Column {
|
||||
|
||||
widgetComponent: {
|
||||
const id = modelData.id || ""
|
||||
if (id === "wifi" || id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
||||
if (id.startsWith("builtin_")) {
|
||||
return builtinPluginWidgetComponent
|
||||
} else if (id.startsWith("plugin_")) {
|
||||
return pluginWidgetComponent
|
||||
} else if (id === "wifi" || id === "bluetooth" || id === "audioOutput" || id === "audioInput") {
|
||||
return compoundPillComponent
|
||||
} else if (id === "volumeSlider") {
|
||||
return audioSliderComponent
|
||||
@@ -151,7 +156,8 @@ Column {
|
||||
width: parent.width
|
||||
height: active ? (250 + Theme.spacingS) : 0
|
||||
property bool active: {
|
||||
if (root.expandedSection === "") return false
|
||||
if (root.expandedSection === "")
|
||||
return false
|
||||
|
||||
if (root.expandedSection.startsWith("diskUsage_") && root.expandedWidgetData) {
|
||||
const expandedInstanceId = root.expandedWidgetData.instanceId
|
||||
@@ -164,6 +170,7 @@ Column {
|
||||
expandedSection: root.expandedSection
|
||||
expandedWidgetData: root.expandedWidgetData
|
||||
bluetoothCodecSelector: root.bluetoothCodecSelector
|
||||
widgetModel: root.model
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,7 +352,8 @@ Column {
|
||||
}
|
||||
enabled: widgetDef?.enabled ?? true
|
||||
onToggled: {
|
||||
if (root.editMode) return
|
||||
if (root.editMode)
|
||||
return
|
||||
switch (widgetData.id || "") {
|
||||
case "wifi":
|
||||
{
|
||||
@@ -378,11 +386,13 @@ Column {
|
||||
}
|
||||
}
|
||||
onExpandClicked: {
|
||||
if (root.editMode) return
|
||||
if (root.editMode)
|
||||
return
|
||||
root.expandClicked(widgetData, widgetIndex)
|
||||
}
|
||||
onWheelEvent: function (wheelEvent) {
|
||||
if (root.editMode) return
|
||||
if (root.editMode)
|
||||
return
|
||||
const id = widgetData.id || ""
|
||||
if (id === "audioOutput") {
|
||||
if (!AudioService.sink || !AudioService.sink.audio)
|
||||
@@ -537,9 +547,10 @@ Column {
|
||||
}
|
||||
|
||||
iconRotation: {
|
||||
if (widgetData.id !== "darkMode") return 0
|
||||
if (widgetData.id !== "darkMode")
|
||||
return 0
|
||||
if (darkModeTransitionPending) {
|
||||
return SessionData.isLightMode ? 0 : 180
|
||||
return SessionData.isLightMode ? 180 : 0
|
||||
}
|
||||
return SessionData.isLightMode ? 180 : 0
|
||||
}
|
||||
@@ -549,7 +560,7 @@ Column {
|
||||
case "nightMode":
|
||||
return DisplayService.nightModeEnabled || false
|
||||
case "darkMode":
|
||||
return !SessionData.isLightMode
|
||||
return SessionData.isLightMode
|
||||
case "doNotDisturb":
|
||||
return SessionData.doNotDisturb || false
|
||||
case "idleInhibitor":
|
||||
@@ -559,15 +570,7 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
enabled: !root.editMode
|
||||
|
||||
onIconRotationCompleted: {
|
||||
if (root.darkModeTransitionPending && widgetData.id === "darkMode") {
|
||||
root.darkModeTransitionPending = false
|
||||
Theme.screenTransition()
|
||||
Theme.toggleLightMode()
|
||||
}
|
||||
}
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
@@ -581,7 +584,8 @@ enabled: !root.editMode
|
||||
}
|
||||
case "darkMode":
|
||||
{
|
||||
root.darkModeTransitionPending = true
|
||||
Theme.screenTransition()
|
||||
Theme.setLightMode(!SessionData.isLightMode)
|
||||
break
|
||||
}
|
||||
case "doNotDisturb":
|
||||
@@ -623,9 +627,10 @@ enabled: !root.editMode
|
||||
}
|
||||
|
||||
iconRotation: {
|
||||
if (widgetData.id !== "darkMode") return 0
|
||||
if (widgetData.id !== "darkMode")
|
||||
return 0
|
||||
if (darkModeTransitionPending) {
|
||||
return SessionData.isLightMode ? 0 : 180
|
||||
return SessionData.isLightMode ? 180 : 0
|
||||
}
|
||||
return SessionData.isLightMode ? 180 : 0
|
||||
}
|
||||
@@ -635,7 +640,7 @@ enabled: !root.editMode
|
||||
case "nightMode":
|
||||
return DisplayService.nightModeEnabled || false
|
||||
case "darkMode":
|
||||
return !SessionData.isLightMode
|
||||
return SessionData.isLightMode
|
||||
case "doNotDisturb":
|
||||
return SessionData.doNotDisturb || false
|
||||
case "idleInhibitor":
|
||||
@@ -645,15 +650,7 @@ enabled: !root.editMode
|
||||
}
|
||||
}
|
||||
|
||||
enabled: !root.editMode
|
||||
|
||||
onIconRotationCompleted: {
|
||||
if (root.darkModeTransitionPending && widgetData.id === "darkMode") {
|
||||
root.darkModeTransitionPending = false
|
||||
Theme.screenTransition()
|
||||
Theme.toggleLightMode()
|
||||
}
|
||||
}
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
@@ -667,7 +664,8 @@ enabled: !root.editMode
|
||||
}
|
||||
case "darkMode":
|
||||
{
|
||||
root.darkModeTransitionPending = true
|
||||
Theme.screenTransition()
|
||||
Theme.setLightMode(!SessionData.isLightMode)
|
||||
break
|
||||
}
|
||||
case "doNotDisturb":
|
||||
@@ -715,4 +713,247 @@ enabled: !root.editMode
|
||||
colorPickerModal: root.colorPickerModal
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: builtinPluginWidgetComponent
|
||||
Loader {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property int widgetWidth: widgetData.width || 50
|
||||
width: parent.width
|
||||
height: 60
|
||||
|
||||
property var builtinInstance: {
|
||||
const id = widgetData.id || ""
|
||||
if (id === "builtin_vpn") {
|
||||
return root.model?.vpnBuiltinInstance
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
sourceComponent: {
|
||||
if (!builtinInstance)
|
||||
return null
|
||||
|
||||
const hasDetail = builtinInstance.ccDetailContent !== null
|
||||
|
||||
if (widgetWidth <= 25) {
|
||||
return builtinSmallToggleComponent
|
||||
} else if (hasDetail) {
|
||||
return builtinCompoundPillComponent
|
||||
} else {
|
||||
return builtinToggleComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: builtinCompoundPillComponent
|
||||
CompoundPill {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var builtinInstance: parent.builtinInstance
|
||||
|
||||
iconName: builtinInstance?.ccWidgetIcon || "extension"
|
||||
primaryText: builtinInstance?.ccWidgetPrimaryText || "Built-in"
|
||||
secondaryText: builtinInstance?.ccWidgetSecondaryText || ""
|
||||
isActive: builtinInstance?.ccWidgetIsActive || false
|
||||
|
||||
onToggled: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (builtinInstance) {
|
||||
builtinInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
|
||||
onExpandClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
root.expandClicked(widgetData, widgetIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: builtinToggleComponent
|
||||
ToggleButton {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var builtinInstance: parent.builtinInstance
|
||||
|
||||
iconName: builtinInstance?.ccWidgetIcon || "extension"
|
||||
text: builtinInstance?.ccWidgetPrimaryText || "Built-in"
|
||||
isActive: builtinInstance?.ccWidgetIsActive || false
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (builtinInstance) {
|
||||
builtinInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: builtinSmallToggleComponent
|
||||
SmallToggleButton {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var builtinInstance: parent.builtinInstance
|
||||
|
||||
iconName: builtinInstance?.ccWidgetIcon || "extension"
|
||||
isActive: builtinInstance?.ccWidgetIsActive || false
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (builtinInstance) {
|
||||
builtinInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pluginWidgetComponent
|
||||
Loader {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property int widgetWidth: widgetData.width || 50
|
||||
width: parent.width
|
||||
height: 60
|
||||
|
||||
property var pluginInstance: null
|
||||
property string pluginId: widgetData.id?.replace("plugin_", "") || ""
|
||||
|
||||
sourceComponent: {
|
||||
if (!pluginInstance)
|
||||
return null
|
||||
|
||||
const hasDetail = pluginInstance.ccDetailContent !== null
|
||||
|
||||
if (widgetWidth <= 25) {
|
||||
return pluginSmallToggleComponent
|
||||
} else if (hasDetail) {
|
||||
return pluginCompoundPillComponent
|
||||
} else {
|
||||
return pluginToggleComponent
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => {
|
||||
const pluginComponent = PluginService.pluginWidgetComponents[pluginId]
|
||||
if (pluginComponent) {
|
||||
const instance = pluginComponent.createObject(null, {
|
||||
"pluginId": pluginId,
|
||||
"pluginService": PluginService,
|
||||
"visible": false,
|
||||
"width": 0,
|
||||
"height": 0
|
||||
})
|
||||
if (instance) {
|
||||
pluginInstance = instance
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PluginService
|
||||
function onPluginDataChanged(changedPluginId) {
|
||||
if (changedPluginId === pluginId && pluginInstance) {
|
||||
pluginInstance.loadPluginData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (pluginInstance) {
|
||||
pluginInstance.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pluginCompoundPillComponent
|
||||
CompoundPill {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var pluginInstance: parent.pluginInstance
|
||||
|
||||
iconName: pluginInstance?.ccWidgetIcon || "extension"
|
||||
primaryText: pluginInstance?.ccWidgetPrimaryText || "Plugin"
|
||||
secondaryText: pluginInstance?.ccWidgetSecondaryText || ""
|
||||
isActive: pluginInstance?.ccWidgetIsActive || false
|
||||
|
||||
onToggled: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (pluginInstance) {
|
||||
pluginInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
|
||||
onExpandClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
root.expandClicked(widgetData, widgetIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pluginToggleComponent
|
||||
ToggleButton {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var pluginInstance: parent.pluginInstance
|
||||
property var widgetDef: root.model?.getWidgetForId(widgetData.id || "")
|
||||
|
||||
iconName: pluginInstance?.ccWidgetIcon || widgetDef?.icon || "extension"
|
||||
text: pluginInstance?.ccWidgetPrimaryText || widgetDef?.text || "Plugin"
|
||||
secondaryText: pluginInstance?.ccWidgetSecondaryText || ""
|
||||
isActive: pluginInstance?.ccWidgetIsActive || false
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (pluginInstance) {
|
||||
pluginInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pluginSmallToggleComponent
|
||||
SmallToggleButton {
|
||||
property var widgetData: parent.widgetData || {}
|
||||
property int widgetIndex: parent.widgetIndex || 0
|
||||
property var pluginInstance: parent.pluginInstance
|
||||
property var widgetDef: root.model?.getWidgetForId(widgetData.id || "")
|
||||
|
||||
iconName: pluginInstance?.ccWidgetIcon || widgetDef?.icon || "extension"
|
||||
isActive: pluginInstance?.ccWidgetIsActive || false
|
||||
enabled: !root.editMode
|
||||
|
||||
onClicked: {
|
||||
if (root.editMode)
|
||||
return
|
||||
if (pluginInstance && pluginInstance.ccDetailContent) {
|
||||
root.expandClicked(widgetData, widgetIndex)
|
||||
} else if (pluginInstance) {
|
||||
pluginInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ Row {
|
||||
}
|
||||
|
||||
Typography {
|
||||
text: "Add Widget"
|
||||
text: qsTr("Add Widget")
|
||||
style: Typography.Style.Subtitle
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -155,7 +155,7 @@ Row {
|
||||
}
|
||||
|
||||
Typography {
|
||||
text: "Add Widget"
|
||||
text: qsTr("Add Widget")
|
||||
style: Typography.Style.Button
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -189,7 +189,7 @@ Row {
|
||||
}
|
||||
|
||||
Typography {
|
||||
text: "Defaults"
|
||||
text: qsTr("Defaults")
|
||||
style: Typography.Style.Button
|
||||
color: Theme.warning
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -223,7 +223,7 @@ Row {
|
||||
}
|
||||
|
||||
Typography {
|
||||
text: "Reset"
|
||||
text: qsTr("Reset")
|
||||
style: Typography.Style.Button
|
||||
color: Theme.error
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -167,8 +167,10 @@ DankPopout {
|
||||
visible: editMode
|
||||
popoutContent: controlContent
|
||||
availableWidgets: {
|
||||
if (!editMode) return []
|
||||
const existingIds = (SettingsData.controlCenterWidgets || []).map(w => w.id)
|
||||
return widgetModel.baseWidgetDefinitions.filter(w => w.allowMultiple || !existingIds.includes(w.id))
|
||||
const allWidgets = widgetModel.baseWidgetDefinitions.concat(widgetModel.getPluginWidgets())
|
||||
return allWidgets.filter(w => w.allowMultiple || !existingIds.includes(w.id))
|
||||
}
|
||||
onAddWidget: (widgetId) => widgetModel.addWidget(widgetId)
|
||||
onResetToDefault: () => widgetModel.resetToDefault()
|
||||
|
||||
@@ -30,7 +30,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: "Input Devices"
|
||||
text: qsTr("Input Devices")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -30,7 +30,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: "Audio Devices"
|
||||
text: qsTr("Audio Devices")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -133,7 +133,7 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Health"
|
||||
text: qsTr("Health")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
font.weight: Font.Medium
|
||||
@@ -168,7 +168,7 @@ Rectangle {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Capacity"
|
||||
text: qsTr("Capacity")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
font.weight: Font.Medium
|
||||
@@ -237,7 +237,7 @@ Rectangle {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Power Profile Degradation"
|
||||
text: qsTr("Power Profile Degradation")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.error
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -170,7 +170,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Audio Codec Selection"
|
||||
text: qsTr("Audio Codec Selection")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: "Bluetooth Settings"
|
||||
text: qsTr("Bluetooth Settings")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -422,7 +422,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "No Bluetooth adapter found"
|
||||
text: qsTr("No Bluetooth adapter found")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
@@ -473,7 +473,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Audio Codec"
|
||||
text: qsTr("Audio Codec")
|
||||
height: bluetoothContextMenu.currentDevice && BluetoothService.isAudioDevice(bluetoothContextMenu.currentDevice) && bluetoothContextMenu.currentDevice.connected ? 32 : 0
|
||||
visible: bluetoothContextMenu.currentDevice && BluetoothService.isAudioDevice(bluetoothContextMenu.currentDevice) && bluetoothContextMenu.currentDevice.connected
|
||||
|
||||
@@ -498,7 +498,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Forget Device"
|
||||
text: qsTr("Forget Device")
|
||||
height: 32
|
||||
|
||||
contentItem: StyledText {
|
||||
|
||||
@@ -44,7 +44,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: "Network Settings"
|
||||
text: qsTr("Network Settings")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -136,7 +136,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: "WiFi is off"
|
||||
text: qsTr("WiFi is off")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -154,7 +154,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Enable WiFi"
|
||||
text: qsTr("Enable WiFi")
|
||||
color: Theme.primary
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
@@ -380,7 +380,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Network Info"
|
||||
text: qsTr("Network Info")
|
||||
height: 32
|
||||
|
||||
contentItem: StyledText {
|
||||
@@ -403,7 +403,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Forget Network"
|
||||
text: qsTr("Forget Network")
|
||||
height: networkContextMenu.currentSaved || networkContextMenu.currentConnected ? 32 : 0
|
||||
visible: networkContextMenu.currentSaved || networkContextMenu.currentConnected
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Modules.ControlCenter.BuiltinPlugins
|
||||
import "../utils/widgets.js" as WidgetUtils
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
readonly property var baseWidgetDefinitions: [
|
||||
{
|
||||
property var vpnBuiltinInstance: VpnWidget {}
|
||||
|
||||
readonly property var coreWidgetDefinitions: [{
|
||||
"id": "nightMode",
|
||||
"text": "Night Mode",
|
||||
"description": "Blue light filter",
|
||||
@@ -15,32 +17,28 @@ QtObject {
|
||||
"type": "toggle",
|
||||
"enabled": DisplayService.automationAvailable,
|
||||
"warning": !DisplayService.automationAvailable ? "Requires night mode support" : undefined
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "darkMode",
|
||||
"text": "Dark Mode",
|
||||
"description": "System theme toggle",
|
||||
"icon": "contrast",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "doNotDisturb",
|
||||
"text": "Do Not Disturb",
|
||||
"description": "Block notifications",
|
||||
"icon": "do_not_disturb_on",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "idleInhibitor",
|
||||
"text": "Keep Awake",
|
||||
"description": "Prevent screen timeout",
|
||||
"icon": "motion_sensor_active",
|
||||
"type": "toggle",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "wifi",
|
||||
"text": "Network",
|
||||
"description": "Wi-Fi and Ethernet connection",
|
||||
@@ -48,8 +46,7 @@ QtObject {
|
||||
"type": "connection",
|
||||
"enabled": NetworkService.wifiAvailable,
|
||||
"warning": !NetworkService.wifiAvailable ? "Wi-Fi not available" : undefined
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "bluetooth",
|
||||
"text": "Bluetooth",
|
||||
"description": "Device connections",
|
||||
@@ -57,32 +54,28 @@ QtObject {
|
||||
"type": "connection",
|
||||
"enabled": BluetoothService.available,
|
||||
"warning": !BluetoothService.available ? "Bluetooth not available" : undefined
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "audioOutput",
|
||||
"text": "Audio Output",
|
||||
"description": "Speaker settings",
|
||||
"icon": "volume_up",
|
||||
"type": "connection",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "audioInput",
|
||||
"text": "Audio Input",
|
||||
"description": "Microphone settings",
|
||||
"icon": "mic",
|
||||
"type": "connection",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "volumeSlider",
|
||||
"text": "Volume Slider",
|
||||
"description": "Audio volume control",
|
||||
"icon": "volume_up",
|
||||
"type": "slider",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "brightnessSlider",
|
||||
"text": "Brightness Slider",
|
||||
"description": "Display brightness control",
|
||||
@@ -90,24 +83,21 @@ QtObject {
|
||||
"type": "slider",
|
||||
"enabled": DisplayService.brightnessAvailable,
|
||||
"warning": !DisplayService.brightnessAvailable ? "Brightness control not available" : undefined
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "inputVolumeSlider",
|
||||
"text": "Input Volume Slider",
|
||||
"description": "Microphone volume control",
|
||||
"icon": "mic",
|
||||
"type": "slider",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "battery",
|
||||
"text": "Battery",
|
||||
"description": "Battery and power management",
|
||||
"icon": "battery_std",
|
||||
"type": "action",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "diskUsage",
|
||||
"text": "Disk Usage",
|
||||
"description": "Filesystem usage monitoring",
|
||||
@@ -116,16 +106,68 @@ QtObject {
|
||||
"enabled": DgopService.dgopAvailable,
|
||||
"warning": !DgopService.dgopAvailable ? "Requires 'dgop' tool" : undefined,
|
||||
"allowMultiple": true
|
||||
},
|
||||
{
|
||||
}, {
|
||||
"id": "colorPicker",
|
||||
"text": "Color Picker",
|
||||
"description": "Choose colors from palette",
|
||||
"icon": "palette",
|
||||
"type": "action",
|
||||
"enabled": true
|
||||
}, {
|
||||
"id": "builtin_vpn",
|
||||
"text": "VPN",
|
||||
"description": "VPN connections",
|
||||
"icon": "vpn_key",
|
||||
"type": "builtin_plugin",
|
||||
"enabled": VpnService.available,
|
||||
"warning": !VpnService.available ? "VPN not available" : undefined,
|
||||
"isBuiltinPlugin": true
|
||||
}]
|
||||
|
||||
function getPluginWidgets() {
|
||||
const plugins = []
|
||||
const loadedPlugins = PluginService.getLoadedPlugins()
|
||||
|
||||
for (var i = 0; i < loadedPlugins.length; i++) {
|
||||
const plugin = loadedPlugins[i]
|
||||
|
||||
if (plugin.type === "daemon") {
|
||||
continue
|
||||
}
|
||||
|
||||
const pluginComponent = PluginService.pluginWidgetComponents[plugin.id]
|
||||
if (!pluginComponent) {
|
||||
continue
|
||||
}
|
||||
|
||||
const tempInstance = pluginComponent.createObject(null)
|
||||
if (!tempInstance) {
|
||||
continue
|
||||
}
|
||||
|
||||
const hasCCWidget = tempInstance.ccWidgetIcon && tempInstance.ccWidgetIcon.length > 0
|
||||
tempInstance.destroy()
|
||||
|
||||
if (!hasCCWidget) {
|
||||
continue
|
||||
}
|
||||
|
||||
plugins.push({
|
||||
"id": "plugin_" + plugin.id,
|
||||
"pluginId": plugin.id,
|
||||
"text": plugin.name || "Plugin",
|
||||
"description": plugin.description || "",
|
||||
"icon": plugin.icon || "extension",
|
||||
"type": "plugin",
|
||||
"enabled": true,
|
||||
"isPlugin": true
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
return plugins
|
||||
}
|
||||
|
||||
readonly property var baseWidgetDefinitions: coreWidgetDefinitions
|
||||
|
||||
function getWidgetForId(widgetId) {
|
||||
return WidgetUtils.getWidgetForId(baseWidgetDefinitions, widgetId)
|
||||
@@ -154,4 +196,4 @@ QtObject {
|
||||
function clearAll() {
|
||||
WidgetUtils.clearAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ PanelWindow {
|
||||
width: parent.width
|
||||
|
||||
StyledText {
|
||||
text: "Power Options"
|
||||
text: qsTr("Power Options")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -118,7 +118,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Log Out"
|
||||
text: qsTr("Log Out")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -168,7 +168,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Suspend"
|
||||
text: qsTr("Suspend")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -218,7 +218,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Reboot"
|
||||
text: qsTr("Reboot")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: rebootArea.containsMouse ? Theme.warning : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -268,7 +268,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Power Off"
|
||||
text: qsTr("Power Off")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: powerOffArea.containsMouse ? Theme.error : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -69,9 +69,6 @@ Row {
|
||||
valueOverride: actualVolumePercent
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
trackColor: root.sliderTrackColor.a > 0 ? root.sliderTrackColor : Theme.surfaceContainerHigh
|
||||
onIsDraggingChanged: {
|
||||
AudioService.suppressOSD = isDragging
|
||||
}
|
||||
onSliderValueChanged: function(newValue) {
|
||||
if (defaultSink) {
|
||||
defaultSink.audio.volume = newValue / 100.0
|
||||
|
||||
@@ -207,4 +207,121 @@ Item {
|
||||
ctx.fill()
|
||||
}
|
||||
}
|
||||
|
||||
Canvas {
|
||||
id: barBorder
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
visible: SettingsData.dankBarBorderEnabled
|
||||
renderTarget: Canvas.FramebufferObject
|
||||
renderStrategy: Canvas.Cooperative
|
||||
|
||||
readonly property real correctWidth: root.width
|
||||
readonly property real correctHeight: root.height
|
||||
canvasSize: Qt.size(barWindow.px(correctWidth), barWindow.px(correctHeight))
|
||||
|
||||
property real wing: SettingsData.dankBarGothCornersEnabled ? barWindow._wingR : 0
|
||||
property real rt: SettingsData.dankBarSquareCorners ? 0 : Theme.cornerRadius
|
||||
property bool borderEnabled: SettingsData.dankBarBorderEnabled
|
||||
|
||||
onWingChanged: requestPaint()
|
||||
onRtChanged: requestPaint()
|
||||
onBorderEnabledChanged: requestPaint()
|
||||
onCorrectWidthChanged: requestPaint()
|
||||
onCorrectHeightChanged: requestPaint()
|
||||
onVisibleChanged: if (visible) requestPaint()
|
||||
Component.onCompleted: requestPaint()
|
||||
|
||||
Connections {
|
||||
target: barWindow
|
||||
function on_DprChanged() { barBorder.requestPaint() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Theme
|
||||
function onSecondaryChanged() { barBorder.requestPaint() }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onDankBarSpacingChanged() { barBorder.requestPaint() }
|
||||
function onDankBarSquareCornersChanged() { barBorder.requestPaint() }
|
||||
function onCornerRadiusChanged() { barBorder.requestPaint() }
|
||||
}
|
||||
|
||||
onPaint: {
|
||||
if (!borderEnabled) return
|
||||
|
||||
const ctx = getContext("2d")
|
||||
const scale = barWindow._dpr
|
||||
const W = barWindow.px(barWindow.isVertical ? correctHeight : correctWidth)
|
||||
const H_raw = barWindow.px(barWindow.isVertical ? correctWidth : correctHeight)
|
||||
const R = barWindow.px(wing)
|
||||
const RT = barWindow.px(rt)
|
||||
const H = H_raw - (R > 0 ? R : 0)
|
||||
const isTop = SettingsData.dankBarPosition === SettingsData.Position.Top
|
||||
const isBottom = SettingsData.dankBarPosition === SettingsData.Position.Bottom
|
||||
const isLeft = SettingsData.dankBarPosition === SettingsData.Position.Left
|
||||
const isRight = SettingsData.dankBarPosition === SettingsData.Position.Right
|
||||
|
||||
const spacing = SettingsData.dankBarSpacing
|
||||
const hasEdgeGap = spacing > 0 || RT > 0
|
||||
|
||||
ctx.scale(scale, scale)
|
||||
|
||||
function drawTopBorder() {
|
||||
ctx.beginPath()
|
||||
|
||||
if (!hasEdgeGap) {
|
||||
ctx.moveTo(0, H)
|
||||
ctx.lineTo(W, H)
|
||||
} else {
|
||||
ctx.moveTo(RT, 0)
|
||||
ctx.lineTo(W - RT, 0)
|
||||
ctx.arcTo(W, 0, W, RT, RT)
|
||||
ctx.lineTo(W, H)
|
||||
|
||||
if (R > 0) {
|
||||
ctx.lineTo(W, H + R)
|
||||
ctx.arc(W - R, H + R, R, 0, -Math.PI / 2, true)
|
||||
ctx.lineTo(R, H)
|
||||
ctx.arc(R, H + R, R, -Math.PI / 2, -Math.PI, true)
|
||||
ctx.lineTo(0, H + R)
|
||||
} else {
|
||||
ctx.lineTo(W, H - RT)
|
||||
ctx.arcTo(W, H, W - RT, H, RT)
|
||||
ctx.lineTo(RT, H)
|
||||
ctx.arcTo(0, H, 0, H - RT, RT)
|
||||
}
|
||||
|
||||
ctx.lineTo(0, RT)
|
||||
ctx.arcTo(0, 0, RT, 0, RT)
|
||||
}
|
||||
|
||||
ctx.closePath()
|
||||
}
|
||||
|
||||
ctx.reset()
|
||||
ctx.clearRect(0, 0, W, H_raw)
|
||||
|
||||
ctx.save()
|
||||
if (isBottom) {
|
||||
ctx.translate(W, H_raw)
|
||||
ctx.rotate(Math.PI)
|
||||
} else if (isLeft) {
|
||||
ctx.translate(0, W)
|
||||
ctx.rotate(-Math.PI / 2)
|
||||
} else if (isRight) {
|
||||
ctx.translate(H_raw, 0)
|
||||
ctx.rotate(Math.PI / 2)
|
||||
}
|
||||
|
||||
drawTopBorder()
|
||||
ctx.restore()
|
||||
|
||||
ctx.lineWidth = 1
|
||||
ctx.strokeStyle = Theme.secondary
|
||||
ctx.stroke()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,8 +308,10 @@ Item {
|
||||
}
|
||||
|
||||
// For plugin components, get from PluginService
|
||||
let pluginMap = PluginService.getWidgetComponents()
|
||||
return pluginMap[widgetId] || null
|
||||
var parts = widgetId.split(":")
|
||||
var pluginId = parts[0]
|
||||
let pluginComponents = PluginService.getWidgetComponents()
|
||||
return pluginComponents[pluginId] || null
|
||||
}
|
||||
|
||||
height: parent.height
|
||||
@@ -397,12 +399,26 @@ Item {
|
||||
|
||||
// Inject PluginService for plugin widgets
|
||||
if (item.pluginService !== undefined) {
|
||||
var parts = model.widgetId.split(":")
|
||||
var pluginId = parts[0]
|
||||
var variantId = parts.length > 1 ? parts[1] : null
|
||||
|
||||
if (item.pluginId !== undefined) {
|
||||
item.pluginId = model.widgetId
|
||||
item.pluginId = pluginId
|
||||
}
|
||||
if (item.variantId !== undefined) {
|
||||
item.variantId = variantId
|
||||
}
|
||||
if (item.variantData !== undefined && variantId) {
|
||||
item.variantData = PluginService.getPluginVariantData(pluginId, variantId)
|
||||
}
|
||||
item.pluginService = PluginService
|
||||
}
|
||||
|
||||
if (item.popoutService !== undefined) {
|
||||
item.popoutService = PopoutService
|
||||
}
|
||||
|
||||
layoutTimer.restart()
|
||||
}
|
||||
|
||||
@@ -426,8 +442,8 @@ Item {
|
||||
// Force refresh of component lookups
|
||||
for (var i = 0; i < centerRepeater.count; i++) {
|
||||
var item = centerRepeater.itemAt(i)
|
||||
if (item && item.widgetId === pluginId) {
|
||||
item.sourceComponent = root.getWidgetComponent(pluginId)
|
||||
if (item && item.widgetId.startsWith(pluginId)) {
|
||||
item.sourceComponent = root.getWidgetComponent(item.widgetId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -435,8 +451,8 @@ Item {
|
||||
// Force refresh of component lookups
|
||||
for (var i = 0; i < centerRepeater.count; i++) {
|
||||
var item = centerRepeater.itemAt(i)
|
||||
if (item && item.widgetId === pluginId) {
|
||||
item.sourceComponent = root.getWidgetComponent(pluginId)
|
||||
if (item && item.widgetId.startsWith(pluginId)) {
|
||||
item.sourceComponent = root.getWidgetComponent(item.widgetId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,8 @@ Item {
|
||||
implicitWidth: isVertical ? px(effectiveBarThickness + SettingsData.dankBarSpacing + (SettingsData.dankBarGothCornersEnabled ? _wingR : 0)) : 0
|
||||
color: "transparent"
|
||||
|
||||
property var nativeInhibitor: null
|
||||
|
||||
Component.onCompleted: {
|
||||
const fonts = Qt.fontFamilies()
|
||||
if (fonts.indexOf("Material Symbols Rounded") === -1) {
|
||||
@@ -93,6 +95,10 @@ Item {
|
||||
|
||||
updateGpuTempConfig()
|
||||
Qt.callLater(() => Qt.callLater(forceWidgetRefresh))
|
||||
|
||||
if (SessionService.nativeInhibitorAvailable) {
|
||||
createNativeInhibitor()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -124,6 +130,38 @@ Item {
|
||||
DgopService.nonNvidiaGpuTempEnabled = hasGpuTempWidget || SessionData.nonNvidiaGpuTempEnabled
|
||||
}
|
||||
|
||||
function createNativeInhibitor() {
|
||||
if (!SessionService.nativeInhibitorAvailable) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const qmlString = `
|
||||
import QtQuick
|
||||
import Quickshell.Wayland
|
||||
|
||||
IdleInhibitor {
|
||||
enabled: false
|
||||
}
|
||||
`
|
||||
|
||||
nativeInhibitor = Qt.createQmlObject(qmlString, barWindow, "DankBar.NativeInhibitor")
|
||||
nativeInhibitor.window = barWindow
|
||||
nativeInhibitor.enabled = Qt.binding(() => SessionService.idleInhibited)
|
||||
nativeInhibitor.enabledChanged.connect(function() {
|
||||
console.log("DankBar: Native inhibitor enabled changed to:", nativeInhibitor.enabled)
|
||||
if (SessionService.idleInhibited !== nativeInhibitor.enabled) {
|
||||
SessionService.idleInhibited = nativeInhibitor.enabled
|
||||
SessionService.inhibitorChanged()
|
||||
}
|
||||
})
|
||||
console.log("DankBar: Created native Wayland IdleInhibitor for", barWindow.screenName)
|
||||
} catch (e) {
|
||||
console.warn("DankBar: Failed to create native IdleInhibitor:", e)
|
||||
nativeInhibitor = null
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onDankBarLeftWidgetsChanged() {
|
||||
barWindow.updateGpuTempConfig()
|
||||
@@ -189,8 +227,10 @@ Item {
|
||||
|
||||
readonly property int barThickness: px(barWindow.effectiveBarThickness + SettingsData.dankBarSpacing)
|
||||
|
||||
readonly property bool showing: SettingsData.dankBarVisible && (topBarCore.reveal
|
||||
|| (CompositorService.isNiri && NiriService.inOverview && SettingsData.dankBarOpenOnOverview)
|
||||
readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && SettingsData.dankBarOpenOnOverview
|
||||
readonly property bool effectiveVisible: SettingsData.dankBarVisible || inOverviewWithShow
|
||||
readonly property bool showing: effectiveVisible && (topBarCore.reveal
|
||||
|| inOverviewWithShow
|
||||
|| !topBarCore.autoHide)
|
||||
|
||||
readonly property int maskThickness: showing ? barThickness : 1
|
||||
@@ -789,6 +829,7 @@ Item {
|
||||
return processListPopoutLoader.item
|
||||
}
|
||||
parentScreen: barWindow.screen
|
||||
widgetData: parent.widgetData
|
||||
toggleProcessList: () => {
|
||||
processListPopoutLoader.active = true
|
||||
return processListPopoutLoader.item?.toggle()
|
||||
@@ -808,6 +849,7 @@ Item {
|
||||
return processListPopoutLoader.item
|
||||
}
|
||||
parentScreen: barWindow.screen
|
||||
widgetData: parent.widgetData
|
||||
toggleProcessList: () => {
|
||||
processListPopoutLoader.active = true
|
||||
return processListPopoutLoader.item?.toggle()
|
||||
@@ -837,6 +879,7 @@ Item {
|
||||
return processListPopoutLoader.item
|
||||
}
|
||||
parentScreen: barWindow.screen
|
||||
widgetData: parent.widgetData
|
||||
toggleProcessList: () => {
|
||||
processListPopoutLoader.active = true
|
||||
return processListPopoutLoader.item?.toggle()
|
||||
|
||||
@@ -311,7 +311,7 @@ DankPopout {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Health"
|
||||
text: qsTr("Health")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
font.weight: Font.Medium
|
||||
@@ -346,7 +346,7 @@ DankPopout {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Capacity"
|
||||
text: qsTr("Capacity")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.primary
|
||||
font.weight: Font.Medium
|
||||
@@ -415,7 +415,7 @@ DankPopout {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Power Profile Degradation"
|
||||
text: qsTr("Power Profile Degradation")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.error
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -96,7 +96,7 @@ DankPopout {
|
||||
height: 32
|
||||
|
||||
StyledText {
|
||||
text: "VPN Connections"
|
||||
text: qsTr("VPN Connections")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -206,7 +206,7 @@ DankPopout {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Disconnect"
|
||||
text: qsTr("Disconnect")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -262,14 +262,14 @@ DankPopout {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No VPN profiles found"
|
||||
text: qsTr("No VPN profiles found")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Add a VPN in NetworkManager"
|
||||
text: qsTr("Add a VPN in NetworkManager")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -65,6 +65,14 @@ Loader {
|
||||
restoreMode: Binding.RestoreNone
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: root.item
|
||||
when: root.item && "widgetData" in root.item
|
||||
property: "widgetData"
|
||||
value: root.widgetData
|
||||
restoreMode: Binding.RestoreNone
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
contentItemReady(item)
|
||||
@@ -79,11 +87,25 @@ Loader {
|
||||
}
|
||||
|
||||
if (item.pluginService !== undefined) {
|
||||
var parts = widgetId.split(":")
|
||||
var pluginId = parts[0]
|
||||
var variantId = parts.length > 1 ? parts[1] : null
|
||||
|
||||
if (item.pluginId !== undefined) {
|
||||
item.pluginId = widgetId
|
||||
item.pluginId = pluginId
|
||||
}
|
||||
if (item.variantId !== undefined) {
|
||||
item.variantId = variantId
|
||||
}
|
||||
if (item.variantData !== undefined && variantId) {
|
||||
item.variantData = PluginService.getPluginVariantData(pluginId, variantId)
|
||||
}
|
||||
item.pluginService = PluginService
|
||||
}
|
||||
|
||||
if (item.popoutService !== undefined) {
|
||||
item.popoutService = PopoutService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,8 +144,11 @@ Loader {
|
||||
return componentMap[widgetId]
|
||||
}
|
||||
|
||||
var parts = widgetId.split(":")
|
||||
var pluginId = parts[0]
|
||||
|
||||
let pluginMap = PluginService.getWidgetComponents()
|
||||
return pluginMap[widgetId] || null
|
||||
return pluginMap[pluginId] || null
|
||||
}
|
||||
|
||||
function getWidgetVisible(widgetId, dgopAvailable) {
|
||||
|
||||
@@ -40,7 +40,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: BatteryService.getBatteryIcon()
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (!BatteryService.batteryAvailable) {
|
||||
return Theme.surfaceText
|
||||
@@ -61,7 +61,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: BatteryService.batteryLevel.toString()
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -77,7 +77,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: BatteryService.getBatteryIcon()
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: {
|
||||
if (!BatteryService.batteryAvailable) {
|
||||
return Theme.surfaceText;
|
||||
@@ -98,7 +98,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: `${BatteryService.batteryLevel}%`
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -50,7 +50,7 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: "content_paste"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ Rectangle {
|
||||
return String(display).padStart(2, '0').charAt(0)
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
width: 9
|
||||
@@ -67,7 +67,7 @@ Rectangle {
|
||||
return String(display).padStart(2, '0').charAt(1)
|
||||
}
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
width: 9
|
||||
@@ -81,7 +81,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: String(systemClock?.date?.getMinutes()).padStart(2, '0').charAt(0)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
width: 9
|
||||
@@ -90,7 +90,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: String(systemClock?.date?.getMinutes()).padStart(2, '0').charAt(1)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
width: 9
|
||||
@@ -123,7 +123,7 @@ Rectangle {
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0')
|
||||
return value.charAt(0)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.primary
|
||||
font.weight: Font.Light
|
||||
width: 9
|
||||
@@ -138,7 +138,7 @@ Rectangle {
|
||||
const value = dayFirst ? String(systemClock?.date?.getDate()).padStart(2, '0') : String(systemClock?.date?.getMonth() + 1).padStart(2, '0')
|
||||
return value.charAt(1)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.primary
|
||||
font.weight: Font.Light
|
||||
width: 9
|
||||
@@ -158,7 +158,7 @@ Rectangle {
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0')
|
||||
return value.charAt(0)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.primary
|
||||
font.weight: Font.Light
|
||||
width: 9
|
||||
@@ -173,7 +173,7 @@ Rectangle {
|
||||
const value = dayFirst ? String(systemClock?.date?.getMonth() + 1).padStart(2, '0') : String(systemClock?.date?.getDate()).padStart(2, '0')
|
||||
return value.charAt(1)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.primary
|
||||
font.weight: Font.Light
|
||||
width: 9
|
||||
@@ -194,7 +194,7 @@ Rectangle {
|
||||
const format = SettingsData.use24HourClock ? "HH:mm" : "h:mm AP"
|
||||
return systemClock?.date?.toLocaleTimeString(Qt.locale(), format)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium - 1
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -215,7 +215,7 @@ Rectangle {
|
||||
|
||||
return systemClock?.date?.toLocaleDateString(Qt.locale(), "ddd d")
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium - 1
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.clockCompactMode
|
||||
|
||||
@@ -34,7 +34,7 @@ Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
name: "palette"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: colorPickerArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Rectangle {
|
||||
|
||||
return NetworkService.wifiSignalIcon
|
||||
}
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return Theme.primary
|
||||
@@ -66,7 +66,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "bluetooth"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
||||
@@ -94,7 +94,7 @@ Rectangle {
|
||||
}
|
||||
return "volume_up"
|
||||
}
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
@@ -124,7 +124,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "settings"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: controlCenterArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: !root.showNetworkIcon && !root.showBluetoothIcon && !root.showAudioIcon
|
||||
@@ -151,7 +151,7 @@ Rectangle {
|
||||
|
||||
return NetworkService.wifiSignalIcon;
|
||||
}
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (NetworkService.wifiToggling) {
|
||||
return Theme.primary;
|
||||
@@ -169,7 +169,7 @@ Rectangle {
|
||||
id: bluetoothIcon
|
||||
|
||||
name: "bluetooth"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: BluetoothService.enabled ? Theme.primary : Theme.outlineButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: root.showBluetoothIcon && BluetoothService.available && BluetoothService.enabled
|
||||
@@ -197,7 +197,7 @@ Rectangle {
|
||||
}
|
||||
return "volume_up";
|
||||
}
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
@@ -230,7 +230,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "mic"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: false // TODO: Add mic detection
|
||||
@@ -239,7 +239,7 @@ Rectangle {
|
||||
// Fallback settings icon when all other icons are hidden
|
||||
DankIcon {
|
||||
name: "settings"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: controlCenterArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !root.showNetworkIcon && !root.showBluetoothIcon && !root.showAudioIcon
|
||||
|
||||
@@ -17,6 +17,8 @@ Rectangle {
|
||||
property var parentScreen: null
|
||||
property real barThickness: 48
|
||||
property real widgetThickness: 30
|
||||
property var widgetData: null
|
||||
property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
|
||||
width: isVertical ? widgetThickness : (cpuContent.implicitWidth + horizontalPadding * 2)
|
||||
@@ -66,7 +68,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.cpuUsage > 80) {
|
||||
return Theme.tempDanger;
|
||||
@@ -89,7 +91,7 @@ Rectangle {
|
||||
|
||||
return DgopService.cpuUsage.toFixed(0);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -104,7 +106,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.cpuUsage > 80) {
|
||||
return Theme.tempDanger;
|
||||
@@ -127,7 +129,7 @@ Rectangle {
|
||||
|
||||
return DgopService.cpuUsage.toFixed(0) + "%";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -136,12 +138,12 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: cpuBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "100%"
|
||||
}
|
||||
|
||||
width: Math.max(cpuBaseline.width, paintedWidth)
|
||||
width: root.minimumWidth ? Math.max(cpuBaseline.width, paintedWidth) : paintedWidth
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -17,6 +17,8 @@ Rectangle {
|
||||
property var parentScreen: null
|
||||
property real barThickness: 48
|
||||
property real widgetThickness: 30
|
||||
property var widgetData: null
|
||||
property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
|
||||
width: isVertical ? widgetThickness : (cpuTempContent.implicitWidth + horizontalPadding * 2)
|
||||
@@ -65,8 +67,8 @@ Rectangle {
|
||||
spacing: 1
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 8
|
||||
name: "device_thermostat"
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.cpuTemperature > 85) {
|
||||
return Theme.tempDanger;
|
||||
@@ -89,7 +91,7 @@ Rectangle {
|
||||
|
||||
return Math.round(DgopService.cpuTemperature).toString();
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -103,8 +105,8 @@ Rectangle {
|
||||
spacing: 3
|
||||
|
||||
DankIcon {
|
||||
name: "memory"
|
||||
size: Theme.iconSize - 8
|
||||
name: "device_thermostat"
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.cpuTemperature > 85) {
|
||||
return Theme.tempDanger;
|
||||
@@ -127,7 +129,7 @@ Rectangle {
|
||||
|
||||
return Math.round(DgopService.cpuTemperature) + "°";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -136,12 +138,12 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: tempBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "100°"
|
||||
}
|
||||
|
||||
width: Math.max(tempBaseline.width, paintedWidth)
|
||||
width: root.minimumWidth ? Math.max(tempBaseline.width, paintedWidth) : paintedWidth
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -12,6 +12,7 @@ Rectangle {
|
||||
property var widgetData: null
|
||||
property var parentScreen: null
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
property string mountPath: (widgetData && widgetData.mountPath !== undefined) ? widgetData.mountPath : "/"
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
|
||||
@@ -144,7 +145,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "storage"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (root.diskUsagePercent > 90) {
|
||||
return Theme.tempDanger
|
||||
@@ -164,7 +165,7 @@ Rectangle {
|
||||
}
|
||||
return root.diskUsagePercent.toFixed(0)
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -179,7 +180,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "storage"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (root.diskUsagePercent > 90) {
|
||||
return Theme.tempDanger
|
||||
@@ -199,7 +200,7 @@ Rectangle {
|
||||
}
|
||||
return root.selectedMount.mount
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -214,7 +215,7 @@ Rectangle {
|
||||
}
|
||||
return root.diskUsagePercent.toFixed(0) + "%"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -223,7 +224,7 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: diskBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "100%"
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ Rectangle {
|
||||
property bool compactMode: SettingsData.focusedWindowCompactMode
|
||||
property int availableWidth: 400
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 2 : Theme.spacingS
|
||||
readonly property int baseWidth: contentRow.implicitWidth + horizontalPadding * 2
|
||||
readonly property int maxNormalWidth: 456
|
||||
@@ -171,7 +172,7 @@ Rectangle {
|
||||
const desktopEntry = DesktopEntries.heuristicLookup(activeWindow.appId);
|
||||
return desktopEntry && desktopEntry.name ? desktopEntry.name : activeWindow.appId;
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -183,7 +184,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: "•"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.outlineButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !compactMode && appText.text && titleText.text
|
||||
@@ -209,7 +210,7 @@ Rectangle {
|
||||
|
||||
return title;
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -19,6 +19,7 @@ Rectangle {
|
||||
property real barThickness: 48
|
||||
property real widgetThickness: 30
|
||||
property int selectedGpuIndex: (widgetData && widgetData.selectedGpuIndex !== undefined) ? widgetData.selectedGpuIndex : 0
|
||||
property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
property real displayTemp: {
|
||||
if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) {
|
||||
@@ -134,7 +135,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "auto_awesome_mosaic"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (root.displayTemp > 80) {
|
||||
return Theme.tempDanger;
|
||||
@@ -157,7 +158,7 @@ Rectangle {
|
||||
|
||||
return Math.round(root.displayTemp).toString();
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -172,7 +173,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "auto_awesome_mosaic"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (root.displayTemp > 80) {
|
||||
return Theme.tempDanger;
|
||||
@@ -195,7 +196,7 @@ Rectangle {
|
||||
|
||||
return Math.round(root.displayTemp) + "°";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -204,12 +205,12 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: gpuTempBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "100°"
|
||||
}
|
||||
|
||||
width: Math.max(gpuTempBaseline.width, paintedWidth)
|
||||
width: root.minimumWidth ? Math.max(gpuTempBaseline.width, paintedWidth) : paintedWidth
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -33,7 +33,7 @@ Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
name: SessionService.idleInhibited ? "motion_sensor_active" : "motion_sensor_idle"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Rectangle {
|
||||
property bool isVertical: axis?.isVertical ?? false
|
||||
property var axis: null
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
property string currentLayout: ""
|
||||
property string hyprlandKeyboard: ""
|
||||
@@ -59,7 +60,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "keyboard"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
@@ -73,7 +74,7 @@ Rectangle {
|
||||
}
|
||||
return currentLayout.substring(0, 2).toUpperCase()
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -89,7 +90,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: currentLayout
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -53,22 +56,63 @@ Item {
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||
}
|
||||
|
||||
SystemLogo {
|
||||
visible: SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
width: Theme.iconSize - 3
|
||||
height: Theme.iconSize - 3
|
||||
colorOverride: SettingsData.osLogoColorOverride
|
||||
brightnessOverride: SettingsData.osLogoBrightness
|
||||
contrastOverride: SettingsData.osLogoContrast
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !SettingsData.useOSLogo
|
||||
visible: SettingsData.launcherLogoMode === "apps"
|
||||
anchors.centerIn: parent
|
||||
name: "apps"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
SystemLogo {
|
||||
visible: SettingsData.launcherLogoMode === "os"
|
||||
anchors.centerIn: parent
|
||||
width: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
height: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
colorOverride: Theme.effectiveLogoColor
|
||||
brightnessOverride: SettingsData.launcherLogoBrightness
|
||||
contrastOverride: SettingsData.launcherLogoContrast
|
||||
}
|
||||
|
||||
IconImage {
|
||||
visible: SettingsData.launcherLogoMode === "compositor"
|
||||
anchors.centerIn: parent
|
||||
width: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
height: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
source: {
|
||||
if (CompositorService.isNiri) {
|
||||
return "file://" + Theme.shellDir + "/assets/niri.svg"
|
||||
} else if (CompositorService.isHyprland) {
|
||||
return "file://" + Theme.shellDir + "/assets/hyprland.svg"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
layer.enabled: Theme.effectiveLogoColor !== ""
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1
|
||||
colorizationColor: Theme.effectiveLogoColor
|
||||
brightness: SettingsData.launcherLogoBrightness
|
||||
contrast: SettingsData.launcherLogoContrast
|
||||
}
|
||||
}
|
||||
|
||||
IconImage {
|
||||
visible: SettingsData.launcherLogoMode === "custom" && SettingsData.launcherLogoCustomPath !== ""
|
||||
anchors.centerIn: parent
|
||||
width: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
height: Theme.barIconSize(barThickness, SettingsData.launcherLogoSizeOffset)
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
source: SettingsData.launcherLogoCustomPath ? "file://" + SettingsData.launcherLogoCustomPath.replace("file://", "") : ""
|
||||
layer.enabled: Theme.effectiveLogoColor !== ""
|
||||
layer.effect: MultiEffect {
|
||||
colorization: 1
|
||||
colorizationColor: Theme.effectiveLogoColor
|
||||
brightness: SettingsData.launcherLogoBrightness
|
||||
contrast: SettingsData.launcherLogoContrast
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ Rectangle {
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: textContainer.displayText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
@@ -14,6 +14,7 @@ Rectangle {
|
||||
readonly property int baseWidth: contentRow.implicitWidth + Theme.spacingS * 2
|
||||
readonly property int maxNormalWidth: 456
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
|
||||
function formatNetworkSpeed(bytesPerSec) {
|
||||
@@ -63,7 +64,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "network_check"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
@@ -75,7 +76,7 @@ Rectangle {
|
||||
if (rate < 1024 * 1024) return (rate / 1024).toFixed(0) + "K"
|
||||
return (rate / (1024 * 1024)).toFixed(0) + "M"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.info
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -88,7 +89,7 @@ Rectangle {
|
||||
if (rate < 1024 * 1024) return (rate / 1024).toFixed(0) + "K"
|
||||
return (rate / (1024 * 1024)).toFixed(0) + "M"
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.error
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -104,7 +105,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "network_check"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -115,13 +116,13 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: "↓"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.info
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: DgopService.networkRxRate > 0 ? formatNetworkSpeed(DgopService.networkRxRate) : "0 B/s"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -131,7 +132,7 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: rxBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "88.8 MB/s"
|
||||
}
|
||||
@@ -154,13 +155,13 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
text: "↑"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.error
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: DgopService.networkTxRate > 0 ? formatNetworkSpeed(DgopService.networkTxRate) : "0 B/s"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -170,7 +171,7 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: txBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "88.8 MB/s"
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
name: "assignment"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: notepadArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Item {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: SessionData.doNotDisturb ? "notifications_off" : "notifications"
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: SessionData.doNotDisturb ? Theme.error : (notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Rectangle {
|
||||
property var popupTarget: null
|
||||
property var parentScreen: null
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 2 : Theme.spacingS
|
||||
readonly property bool hasActivePrivacy: PrivacyService.anyPrivacyActive
|
||||
readonly property int activeCount: PrivacyService.microphoneActive + PrivacyService.cameraActive + PrivacyService.screensharingActive
|
||||
@@ -198,7 +199,7 @@ Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: PrivacyService.getPrivacySummary()
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ Rectangle {
|
||||
property var parentScreen: null
|
||||
property real barThickness: 48
|
||||
property real widgetThickness: 30
|
||||
property var widgetData: null
|
||||
property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetThickness / 30))
|
||||
|
||||
width: isVertical ? widgetThickness : (ramContent.implicitWidth + horizontalPadding * 2)
|
||||
@@ -30,6 +32,7 @@ Rectangle {
|
||||
const baseColor = ramArea.containsMouse ? Theme.widgetBaseHoverColor : Theme.widgetBaseBackgroundColor;
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
DgopService.addRef(["memory"]);
|
||||
}
|
||||
@@ -66,7 +69,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "developer_board"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.memoryUsage > 90) {
|
||||
return Theme.tempDanger;
|
||||
@@ -89,7 +92,7 @@ Rectangle {
|
||||
|
||||
return DgopService.memoryUsage.toFixed(0);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -104,7 +107,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: "developer_board"
|
||||
size: Theme.iconSize - 8
|
||||
size: Theme.barIconSize(barThickness)
|
||||
color: {
|
||||
if (DgopService.memoryUsage > 90) {
|
||||
return Theme.tempDanger;
|
||||
@@ -127,7 +130,7 @@ Rectangle {
|
||||
|
||||
return DgopService.memoryUsage.toFixed(0) + "%";
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -136,12 +139,12 @@ Rectangle {
|
||||
|
||||
StyledTextMetrics {
|
||||
id: ramBaseline
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
text: "100%"
|
||||
}
|
||||
|
||||
width: Math.max(ramBaseline.width, paintedWidth)
|
||||
width: root.minimumWidth ? Math.max(ramBaseline.width, paintedWidth) : paintedWidth
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
@@ -17,6 +17,7 @@ Rectangle {
|
||||
property var hoveredItem: null
|
||||
property var topBar: null
|
||||
property real widgetThickness: 30
|
||||
property real barThickness: 48
|
||||
readonly property real horizontalPadding: SettingsData.dankBarNoBackground ? 2 : Theme.spacingS
|
||||
property Item windowRoot: (Window.window ? Window.window.contentItem : null)
|
||||
readonly property var sortedToplevels: {
|
||||
@@ -272,7 +273,7 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.runningAppsCompactMode
|
||||
text: windowTitle
|
||||
font.pixelSize: Theme.fontSizeMedium - 1
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
elide: Text.ElideRight
|
||||
@@ -463,7 +464,7 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !SettingsData.runningAppsCompactMode
|
||||
text: windowTitle
|
||||
font.pixelSize: Theme.fontSizeMedium - 1
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
elide: Text.ElideRight
|
||||
@@ -610,7 +611,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Close"
|
||||
text: qsTr("Close")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
|
||||
@@ -445,7 +445,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Back"
|
||||
text: qsTr("Back")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -43,7 +43,7 @@ Rectangle {
|
||||
if (hasUpdates) return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error;
|
||||
if (hasUpdates) return Theme.primary;
|
||||
@@ -97,7 +97,7 @@ Rectangle {
|
||||
if (hasUpdates) return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error;
|
||||
if (hasUpdates) return Theme.primary;
|
||||
@@ -127,7 +127,7 @@ Rectangle {
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: SystemUpdateService.updateCount.toString()
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
visible: hasUpdates && !isChecking
|
||||
|
||||
@@ -34,7 +34,7 @@ Rectangle {
|
||||
id: icon
|
||||
|
||||
name: VpnService.isBusy ? "sync" : (VpnService.connected ? "vpn_lock" : "vpn_key_off")
|
||||
size: Theme.iconSize - 6
|
||||
size: Theme.barIconSize(barThickness, -4)
|
||||
color: VpnService.connected ? Theme.primary : Theme.surfaceText
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: WeatherService.getWeatherIcon(WeatherService.weather.wCode)
|
||||
size: Theme.iconSize - 4
|
||||
size: Theme.barIconSize(barThickness, -6)
|
||||
color: Theme.primary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
@@ -55,7 +55,7 @@ Rectangle {
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
@@ -70,7 +70,7 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
name: WeatherService.getWeatherIcon(WeatherService.weather.wCode)
|
||||
size: Theme.iconSize - 4
|
||||
size: Theme.barIconSize(barThickness, -6)
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -84,7 +84,7 @@ Rectangle {
|
||||
|
||||
return temp + "°" + (SettingsData.useFahrenheit ? "F" : "C");
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ Rectangle {
|
||||
property var axis: null
|
||||
property string screenName: ""
|
||||
property real widgetHeight: 30
|
||||
property real barThickness: 48
|
||||
property int currentWorkspace: {
|
||||
if (CompositorService.isNiri) {
|
||||
return getNiriActiveWorkspace()
|
||||
@@ -29,6 +30,8 @@ Rectangle {
|
||||
}
|
||||
if (CompositorService.isHyprland) {
|
||||
const baseList = getHyprlandWorkspaces()
|
||||
// Filter out special:scratch_term
|
||||
const filteredList = baseList.filter(ws => ws.name !== "special:scratch_term" && ws.id !== -98)
|
||||
return SettingsData.showWorkspacePadding ? padWorkspaces(baseList) : baseList
|
||||
}
|
||||
return [1]
|
||||
@@ -415,7 +418,7 @@ Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
width: root.isVertical ? parent.width + Theme.spacingXL : parent.width
|
||||
height: root.isVerical ? parent.height : parent.height + Theme.spacingXL
|
||||
height: root.isVertical ? parent.height : parent.height + Theme.spacingXL
|
||||
hoverEnabled: !isPlaceholder
|
||||
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
enabled: !isPlaceholder
|
||||
@@ -609,7 +612,7 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
text: loadedIconData ? loadedIconData.value : "" // NULL CHECK
|
||||
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : Theme.surfaceTextMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
|
||||
}
|
||||
}
|
||||
@@ -630,8 +633,8 @@ Rectangle {
|
||||
}
|
||||
return CompositorService.isHyprland ? (modelData?.id || "") : (modelData - 1);
|
||||
}
|
||||
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: (isActive || isUrgent) ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
|
||||
font.pixelSize: Theme.barTextSize(barThickness)
|
||||
font.weight: (isActive && !isPlaceholder) ? Font.DemiBold : Font.Normal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,15 +131,15 @@ DankPopout {
|
||||
|
||||
model: {
|
||||
let tabs = [
|
||||
{ icon: "dashboard", text: "Overview" },
|
||||
{ icon: "music_note", text: "Media" }
|
||||
{ icon: "dashboard", text: qsTr("Overview") },
|
||||
{ icon: "music_note", text: qsTr("Media") }
|
||||
]
|
||||
|
||||
if (SettingsData.weatherEnabled) {
|
||||
tabs.push({ icon: "wb_sunny", text: "Weather" })
|
||||
tabs.push({ icon: "wb_sunny", text: qsTr("Weather") })
|
||||
}
|
||||
|
||||
tabs.push({ icon: "settings", text: "Settings", isAction: true })
|
||||
tabs.push({ icon: "settings", text: qsTr("Settings"), isAction: true })
|
||||
return tabs
|
||||
}
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No Active Players"
|
||||
text: qsTr("No Active Players")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -406,7 +406,7 @@ Item {
|
||||
anchors.margins: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Audio Output Devices (" + audioDevicesDropdown.availableDevices.length + ")"
|
||||
text: qsTr("Audio Output Devices (") + audioDevicesDropdown.availableDevices.length + ")"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -564,7 +564,7 @@ Item {
|
||||
anchors.margins: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Media Players (" + (allPlayers?.length || 0) + ")"
|
||||
text: qsTr("Media Players (") + (allPlayers?.length || 0) + ")"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
|
||||
@@ -53,7 +53,7 @@ Card {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No Media"
|
||||
text: qsTr("No Media")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -33,7 +33,7 @@ Card {
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Refresh"
|
||||
text: qsTr("Refresh")
|
||||
flat: true
|
||||
visible: !WeatherService.weather.loading
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -24,7 +24,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No Weather Data Available"
|
||||
text: qsTr("No Weather Data Available")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -257,7 +257,7 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Feels Like"
|
||||
text: qsTr("Feels Like")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -304,7 +304,7 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Humidity"
|
||||
text: qsTr("Humidity")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -351,7 +351,7 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Wind"
|
||||
text: qsTr("Wind")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -398,7 +398,7 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Pressure"
|
||||
text: qsTr("Pressure")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -445,7 +445,7 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Rain Chance"
|
||||
text: qsTr("Rain Chance")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -492,14 +492,14 @@ Item {
|
||||
spacing: 2
|
||||
|
||||
StyledText {
|
||||
text: "Visibility"
|
||||
text: qsTr("Visibility")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Good"
|
||||
text: qsTr("Good")
|
||||
font.pixelSize: Theme.fontSizeSmall + 1
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -522,7 +522,7 @@ Item {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
StyledText {
|
||||
text: "7-Day Forecast"
|
||||
text: qsTr("7-Day Forecast")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -78,8 +78,8 @@ Variants {
|
||||
}
|
||||
|
||||
property bool reveal: {
|
||||
if (CompositorService.isNiri && NiriService.inOverview) {
|
||||
return SettingsData.dockOpenOnOverview
|
||||
if (CompositorService.isNiri && NiriService.inOverview && SettingsData.dockOpenOnOverview) {
|
||||
return true
|
||||
}
|
||||
return (!autoHide || dockMouseArea.containsMouse || dockApps.requestDockShow || contextMenuOpen || revealSticky) && !windowIsFullscreen
|
||||
}
|
||||
@@ -99,7 +99,7 @@ Variants {
|
||||
}
|
||||
|
||||
screen: modelData
|
||||
visible: SettingsData.showDock
|
||||
visible: SettingsData.showDock || (CompositorService.isNiri && SettingsData.dockOpenOnOverview && NiriService.inOverview)
|
||||
color: "transparent"
|
||||
|
||||
|
||||
@@ -264,19 +264,21 @@ Variants {
|
||||
x: {
|
||||
if (!dock.isVertical) return 0
|
||||
if (dock.reveal) return 0
|
||||
const hideDistance = 58 + SettingsData.dockSpacing + SettingsData.dockBottomGap + 10
|
||||
if (SettingsData.dockPosition === SettingsData.Position.Right) {
|
||||
return 60
|
||||
return hideDistance
|
||||
} else {
|
||||
return -60
|
||||
return -hideDistance
|
||||
}
|
||||
}
|
||||
y: {
|
||||
if (dock.isVertical) return 0
|
||||
if (dock.reveal) return 0
|
||||
const hideDistance = 58 + SettingsData.dockSpacing + SettingsData.dockBottomGap + 10
|
||||
if (SettingsData.dockPosition === SettingsData.Position.Bottom) {
|
||||
return 60
|
||||
return hideDistance
|
||||
} else {
|
||||
return -60
|
||||
return -hideDistance
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -316,9 +316,8 @@ Item {
|
||||
console.warn("No toplevel found for grouped app")
|
||||
}
|
||||
} else {
|
||||
// For multiple windows, show context menu (hide pin option for left-click)
|
||||
if (contextMenu) {
|
||||
contextMenu.showForButton(root, appData, 65, true)
|
||||
contextMenu.showForButton(root, appData, 65, true, cachedDesktopEntry)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,8 +337,7 @@ Item {
|
||||
}
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
if (contextMenu && appData) {
|
||||
console.log("Right-clicked on app:", appData.appId, "type:", appData.type, "windowCount:", appData.windowCount || 0)
|
||||
contextMenu.showForButton(root, appData, 40, false)
|
||||
contextMenu.showForButton(root, appData, 40, false, cachedDesktopEntry)
|
||||
} else {
|
||||
console.warn("No context menu or appData available")
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
@@ -16,12 +15,14 @@ PanelWindow {
|
||||
property real dockVisibleHeight: 40
|
||||
property int margin: 10
|
||||
property bool hidePin: false
|
||||
property var desktopEntry: null
|
||||
|
||||
function showForButton(button, data, dockHeight, hidePinOption) {
|
||||
function showForButton(button, data, dockHeight, hidePinOption, entry) {
|
||||
anchorItem = button
|
||||
appData = data
|
||||
dockVisibleHeight = dockHeight || 40
|
||||
hidePin = hidePinOption || false
|
||||
desktopEntry = entry || null
|
||||
|
||||
const dockWindow = button.Window.window
|
||||
if (dockWindow) {
|
||||
@@ -134,9 +135,6 @@ PanelWindow {
|
||||
Rectangle {
|
||||
id: menuContainer
|
||||
|
||||
width: Math.min(400, Math.max(200, menuColumn.implicitWidth + Theme.spacingS * 2))
|
||||
height: Math.max(60, menuColumn.implicitHeight + Theme.spacingS * 2)
|
||||
|
||||
x: {
|
||||
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||
if (isVertical) {
|
||||
@@ -169,12 +167,23 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
width: Math.min(400, Math.max(180, menuColumn.implicitWidth + Theme.spacingS * 2))
|
||||
height: Math.max(60, menuColumn.implicitHeight + Theme.spacingS * 2)
|
||||
color: Theme.popupBackground()
|
||||
radius: Theme.cornerRadius
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||
border.width: 1
|
||||
opacity: showContextMenu ? 1 : 0
|
||||
scale: showContextMenu ? 1 : 0.85
|
||||
|
||||
opacity: root.showContextMenu ? 1 : 0
|
||||
visible: opacity > 0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
@@ -184,7 +193,7 @@ PanelWindow {
|
||||
anchors.bottomMargin: -4
|
||||
radius: parent.radius
|
||||
color: Qt.rgba(0, 0, 0, 0.15)
|
||||
z: parent.z - 1
|
||||
z: -1
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -223,7 +232,7 @@ PanelWindow {
|
||||
anchors.right: closeButton.left
|
||||
anchors.rightMargin: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: (modelData && modelData.title) ? modelData.title : "(Unnamed)"
|
||||
text: (modelData && modelData.title) ? modelData.title: qsTr("(Unnamed)")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
@@ -289,6 +298,71 @@ PanelWindow {
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: root.desktopEntry && root.desktopEntry.actions ? root.desktopEntry.actions : []
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 28
|
||||
radius: Theme.cornerRadius
|
||||
color: actionArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: 16
|
||||
height: 16
|
||||
visible: modelData.icon && modelData.icon !== ""
|
||||
|
||||
IconImage {
|
||||
anchors.fill: parent
|
||||
source: modelData.icon ? Quickshell.iconPath(modelData.icon, true) : ""
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: modelData.name || ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: actionArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (modelData) {
|
||||
SessionService.launchDesktopAction(root.desktopEntry, modelData)
|
||||
}
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: root.desktopEntry && root.desktopEntry.actions && root.desktopEntry.actions.length > 0
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: !root.hidePin
|
||||
width: parent.width
|
||||
@@ -330,14 +404,49 @@ PanelWindow {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: root.appData && root.appData.type === "window"
|
||||
visible: (root.appData && root.appData.type === "window") || (root.desktopEntry && SessionService.hasPrimeRun)
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: root.appData && root.appData.type === "window"
|
||||
visible: root.desktopEntry && SessionService.hasPrimeRun
|
||||
width: parent.width
|
||||
height: 28
|
||||
radius: Theme.cornerRadius
|
||||
color: primeRunArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : "transparent"
|
||||
|
||||
StyledText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingS
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: qsTr("Launch on dGPU")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Normal
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: primeRunArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (root.desktopEntry) {
|
||||
SessionService.launchDesktopEntry(root.desktopEntry, true)
|
||||
}
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0))
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||
@@ -377,7 +486,6 @@ PanelWindow {
|
||||
onClicked: {
|
||||
const sortedToplevels = CompositorService.sortedToplevels
|
||||
if (root.appData && root.appData.type === "window") {
|
||||
// Find and close the specific window
|
||||
for (var i = 0; i < sortedToplevels.length; i++) {
|
||||
const toplevel = sortedToplevels[i]
|
||||
const checkId = toplevel.title + "|" + (toplevel.appId || "") + "|" + i
|
||||
@@ -387,7 +495,6 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
} else if (root.appData && root.appData.type === "grouped") {
|
||||
// Close all windows for this app
|
||||
const allToplevels = ToplevelManager.toplevels.values
|
||||
for (let i = 0; i < allToplevels.length; i++) {
|
||||
const toplevel = allToplevels[i]
|
||||
@@ -401,27 +508,11 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
onClicked: {
|
||||
root.close()
|
||||
}
|
||||
onClicked: root.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Switch User"
|
||||
text: qsTr("Switch User")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -1325,7 +1325,7 @@ Item {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Cancel"
|
||||
text: qsTr("Cancel")
|
||||
color: Theme.surfaceText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ Enable the greeter with this in your NixOS config:
|
||||
```nix
|
||||
programs.dankMaterialShell.greeter = {
|
||||
enable = true;
|
||||
compositor = "niri"; # or set to hyprland
|
||||
configHome = "/home/user"; # optionally symlinks that users DMS settings to the greeters data directory
|
||||
compositor.name = "niri"; # or set to hyprland
|
||||
configHome = "/home/user"; # optionally copyies that users DMS settings (and wallpaper if set) to the greeters data directory as root before greeter starts
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ Rectangle {
|
||||
],
|
||||
"row_4": [
|
||||
{
|
||||
text: '123',
|
||||
text: "123",
|
||||
symbol: 'ABC',
|
||||
width: 1.5
|
||||
},
|
||||
|
||||
@@ -609,7 +609,7 @@ Item {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Theme.spacingXL
|
||||
text: "DEMO MODE - Click anywhere to exit"
|
||||
text: qsTr("DEMO MODE - Click anywhere to exit")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: "white"
|
||||
opacity: 0.7
|
||||
@@ -1244,7 +1244,7 @@ Item {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Cancel"
|
||||
text: qsTr("Cancel")
|
||||
color: Theme.surfaceText
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
}
|
||||
|
||||
@@ -211,6 +211,10 @@ Item {
|
||||
anchors.fill: parent
|
||||
isVisible: showSettingsMenu
|
||||
onSettingsRequested: showSettingsMenu = !showSettingsMenu
|
||||
onFindRequested: {
|
||||
showSettingsMenu = false
|
||||
textEditor.showSearch()
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
|
||||
@@ -15,6 +15,7 @@ Item {
|
||||
property bool fontsEnumerated: false
|
||||
|
||||
signal settingsRequested()
|
||||
signal findRequested()
|
||||
|
||||
function enumerateFonts() {
|
||||
var fonts = ["Default"]
|
||||
@@ -118,7 +119,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Notepad Font Settings"
|
||||
text: qsTr("Notepad Font Settings")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -135,7 +136,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
width: parent.width + Theme.spacingM
|
||||
text: "Use Monospace Font"
|
||||
text: qsTr("Use Monospace Font")
|
||||
description: "Toggle fonts"
|
||||
checked: SettingsData.notepadUseMonospace
|
||||
onToggled: checked => {
|
||||
@@ -147,7 +148,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
width: parent.width + Theme.spacingM
|
||||
text: "Show Line Numbers"
|
||||
text: qsTr("Show Line Numbers")
|
||||
description: "Display line numbers in editor"
|
||||
checked: SettingsData.notepadShowLineNumbers
|
||||
onToggled: checked => {
|
||||
@@ -155,6 +156,56 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: 60
|
||||
radius: Theme.cornerRadius
|
||||
color: "transparent"
|
||||
|
||||
StateLayer {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
width: parent.width + Theme.spacingM
|
||||
stateColor: Theme.primary
|
||||
cornerRadius: parent.radius
|
||||
onClicked: root.findRequested()
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingM
|
||||
|
||||
DankIcon {
|
||||
name: "search"
|
||||
size: Theme.iconSize - 2
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Find in Text")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: qsTr("Open search bar to find text")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: visible ? (fontDropdown.height + Theme.spacingS) : 0
|
||||
@@ -166,7 +217,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
width: parent.width + Theme.spacingM
|
||||
text: "Font Family"
|
||||
text: qsTr("Font Family")
|
||||
options: cachedFontFamilies
|
||||
currentValue: {
|
||||
if (!SettingsData.notepadFontFamily || SettingsData.notepadFontFamily === "")
|
||||
@@ -200,7 +251,7 @@ Item {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Font Size"
|
||||
text: qsTr("Font Size")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -279,7 +330,7 @@ Item {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: -Theme.spacingM
|
||||
width: parent.width + Theme.spacingM
|
||||
text: "Custom Transparency"
|
||||
text: qsTr("Custom Transparency")
|
||||
description: "Override global transparency for Notepad"
|
||||
checked: SettingsData.notepadTransparencyOverride >= 0
|
||||
onToggled: checked => {
|
||||
|
||||
@@ -103,7 +103,7 @@ Column {
|
||||
id: tabCloseButton
|
||||
width: 20
|
||||
height: 20
|
||||
radius: 10
|
||||
radius: Theme.cornerRadius
|
||||
color: closeMouseArea.containsMouse ? Theme.surfaceTextHover : Theme.withAlpha(Theme.surfaceTextHover, 0)
|
||||
visible: NotepadStorageService.tabs.length > 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
@@ -15,6 +16,11 @@ Column {
|
||||
property bool contentLoaded: false
|
||||
property string lastSavedContent: ""
|
||||
property var currentTab: NotepadStorageService.tabs.length > NotepadStorageService.currentTabIndex ? NotepadStorageService.tabs[NotepadStorageService.currentTabIndex] : null
|
||||
property bool searchVisible: false
|
||||
property string searchQuery: ""
|
||||
property var searchMatches: []
|
||||
property int currentMatchIndex: -1
|
||||
property int matchCount: 0
|
||||
|
||||
signal saveRequested()
|
||||
signal openRequested()
|
||||
@@ -83,11 +89,235 @@ Column {
|
||||
}
|
||||
}
|
||||
|
||||
function performSearch() {
|
||||
let matches = []
|
||||
currentMatchIndex = -1
|
||||
|
||||
if (!searchQuery || searchQuery.length === 0) {
|
||||
searchMatches = []
|
||||
matchCount = 0
|
||||
textArea.select(0, 0)
|
||||
return
|
||||
}
|
||||
|
||||
const text = textArea.text
|
||||
const query = searchQuery.toLowerCase()
|
||||
let index = 0
|
||||
|
||||
while (index < text.length) {
|
||||
const foundIndex = text.toLowerCase().indexOf(query, index)
|
||||
if (foundIndex === -1) break
|
||||
|
||||
matches.push({
|
||||
start: foundIndex,
|
||||
end: foundIndex + searchQuery.length
|
||||
})
|
||||
index = foundIndex + 1
|
||||
}
|
||||
|
||||
searchMatches = matches
|
||||
matchCount = matches.length
|
||||
|
||||
if (matchCount > 0) {
|
||||
currentMatchIndex = 0
|
||||
highlightCurrentMatch()
|
||||
} else {
|
||||
textArea.select(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
function highlightCurrentMatch() {
|
||||
if (currentMatchIndex >= 0 && currentMatchIndex < searchMatches.length) {
|
||||
const match = searchMatches[currentMatchIndex]
|
||||
|
||||
textArea.cursorPosition = match.start
|
||||
textArea.moveCursorSelection(match.end, TextEdit.SelectCharacters)
|
||||
|
||||
const flickable = textArea.parent
|
||||
if (flickable && flickable.contentY !== undefined) {
|
||||
const lineHeight = textArea.font.pixelSize * 1.5
|
||||
const approxLine = textArea.text.substring(0, match.start).split('\n').length
|
||||
const targetY = approxLine * lineHeight - flickable.height / 2
|
||||
flickable.contentY = Math.max(0, Math.min(targetY, flickable.contentHeight - flickable.height))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findNext() {
|
||||
if (matchCount === 0 || searchMatches.length === 0) return
|
||||
|
||||
currentMatchIndex = (currentMatchIndex + 1) % matchCount
|
||||
highlightCurrentMatch()
|
||||
}
|
||||
|
||||
function findPrevious() {
|
||||
if (matchCount === 0 || searchMatches.length === 0) return
|
||||
|
||||
currentMatchIndex = currentMatchIndex <= 0 ? matchCount - 1 : currentMatchIndex - 1
|
||||
highlightCurrentMatch()
|
||||
}
|
||||
|
||||
function showSearch() {
|
||||
searchVisible = true
|
||||
Qt.callLater(() => {
|
||||
searchField.forceActiveFocus()
|
||||
})
|
||||
}
|
||||
|
||||
function hideSearch() {
|
||||
searchVisible = false
|
||||
searchQuery = ""
|
||||
searchMatches = []
|
||||
matchCount = 0
|
||||
currentMatchIndex = -1
|
||||
textArea.select(0, 0)
|
||||
textArea.forceActiveFocus()
|
||||
}
|
||||
|
||||
spacing: Theme.spacingM
|
||||
|
||||
StyledRect {
|
||||
id: searchBar
|
||||
width: parent.width
|
||||
height: parent.height - bottomControls.height - Theme.spacingM
|
||||
height: 48
|
||||
visible: searchVisible
|
||||
opacity: searchVisible ? 1 : 0
|
||||
color: Qt.rgba(Theme.surfaceContainerHigh.r, Theme.surfaceContainerHigh.g, Theme.surfaceContainerHigh.b, 0.95)
|
||||
border.color: searchField.activeFocus ? Theme.primary : Theme.outlineMedium
|
||||
border.width: searchField.activeFocus ? 2 : 1
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
spacing: Theme.spacingS
|
||||
|
||||
// Search icon
|
||||
DankIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
name: "search"
|
||||
size: Theme.iconSize - 2
|
||||
color: searchField.activeFocus ? Theme.primary : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
// Search input field
|
||||
TextInput {
|
||||
id: searchField
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
height: 32
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Theme.surfaceText
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
selectByMouse: true
|
||||
clip: true
|
||||
|
||||
Component.onCompleted: {
|
||||
text = root.searchQuery
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
function onSearchQueryChanged() {
|
||||
if (searchField.text !== root.searchQuery) {
|
||||
searchField.text = root.searchQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onTextChanged: {
|
||||
if (root.searchQuery !== text) {
|
||||
root.searchQuery = text
|
||||
root.performSearch()
|
||||
}
|
||||
}
|
||||
Keys.onEscapePressed: event => {
|
||||
root.hideSearch()
|
||||
event.accepted = true
|
||||
}
|
||||
Keys.onReturnPressed: event => {
|
||||
if (event.modifiers & Qt.ShiftModifier) {
|
||||
root.findPrevious()
|
||||
} else {
|
||||
root.findNext()
|
||||
}
|
||||
event.accepted = true
|
||||
}
|
||||
Keys.onEnterPressed: event => {
|
||||
if (event.modifiers & Qt.ShiftModifier) {
|
||||
root.findPrevious()
|
||||
} else {
|
||||
root.findNext()
|
||||
}
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
// Placeholder text
|
||||
StyledText {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: qsTr("Find in note...")
|
||||
font: searchField.font
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
visible: searchField.text.length === 0 && !searchField.activeFocus
|
||||
Layout.leftMargin: -(searchField.width - 20) // Position over the input field
|
||||
}
|
||||
|
||||
// Match count display
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text: matchCount > 0 ? qsTr("%1/%2").arg(currentMatchIndex + 1).arg(matchCount) : searchQuery.length > 0 ? qsTr("No matches") : ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: matchCount > 0 ? Theme.primary : Theme.surfaceTextMedium
|
||||
visible: searchQuery.length > 0
|
||||
Layout.rightMargin: Theme.spacingS
|
||||
}
|
||||
|
||||
// Navigation buttons
|
||||
DankActionButton {
|
||||
id: prevButton
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconName: "keyboard_arrow_up"
|
||||
iconSize: Theme.iconSize
|
||||
iconColor: matchCount > 0 ? Theme.surfaceText : Theme.surfaceTextAlpha
|
||||
enabled: matchCount > 0
|
||||
onClicked: root.findPrevious()
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
id: nextButton
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconName: "keyboard_arrow_down"
|
||||
iconSize: Theme.iconSize
|
||||
iconColor: matchCount > 0 ? Theme.surfaceText : Theme.surfaceTextAlpha
|
||||
enabled: matchCount > 0
|
||||
onClicked: root.findNext()
|
||||
}
|
||||
|
||||
// Close button
|
||||
DankActionButton {
|
||||
id: closeSearchButton
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconName: "close"
|
||||
iconSize: Theme.iconSize - 2
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: root.hideSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: parent.height - bottomControls.height - Theme.spacingM - (searchVisible ? searchBar.height + Theme.spacingM : 0)
|
||||
color: Qt.rgba(Theme.surface.r, Theme.surface.g, Theme.surface.b, Theme.notepadTransparency)
|
||||
border.color: Theme.outlineMedium
|
||||
border.width: 1
|
||||
@@ -154,10 +384,13 @@ Column {
|
||||
TextArea.flickable: TextArea {
|
||||
id: textArea
|
||||
placeholderText: qsTr("Start typing your notes here...")
|
||||
placeholderTextColor: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5)
|
||||
font.family: SettingsData.notepadUseMonospace ? SettingsData.monoFontFamily : (SettingsData.notepadFontFamily || SettingsData.fontFamily)
|
||||
font.pixelSize: SettingsData.notepadFontSize * SettingsData.fontScale
|
||||
font.letterSpacing: 0
|
||||
color: Theme.surfaceText
|
||||
selectedTextColor: Theme.background
|
||||
selectionColor: Theme.primary
|
||||
selectByMouse: true
|
||||
selectByKeyboard: true
|
||||
wrapMode: TextArea.Wrap
|
||||
@@ -176,12 +409,18 @@ Column {
|
||||
loadCurrentTabContent()
|
||||
setTextDocumentLineHeight()
|
||||
root.updateLineModel()
|
||||
Qt.callLater(() => {
|
||||
textArea.forceActiveFocus()
|
||||
})
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: NotepadStorageService
|
||||
function onCurrentTabIndexChanged() {
|
||||
loadCurrentTabContent()
|
||||
Qt.callLater(() => {
|
||||
textArea.forceActiveFocus()
|
||||
})
|
||||
}
|
||||
function onTabsChanged() {
|
||||
if (NotepadStorageService.tabs.length > 0 && !contentLoaded) {
|
||||
@@ -229,6 +468,10 @@ Column {
|
||||
event.accepted = true
|
||||
selectAll()
|
||||
break
|
||||
case Qt.Key_F:
|
||||
event.accepted = true
|
||||
root.showSearch()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: clearText
|
||||
text: "Clear"
|
||||
text: qsTr("Clear")
|
||||
color: parent.isHovered ? Theme.primary : Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
@@ -642,7 +642,7 @@ Rectangle {
|
||||
|
||||
StyledText {
|
||||
id: clearText
|
||||
text: "Clear"
|
||||
text: qsTr("Clear")
|
||||
color: clearButton.isHovered ? Theme.primary : Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -24,7 +24,7 @@ Item {
|
||||
|
||||
StyledText {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: "Nothing to see here"
|
||||
text: qsTr("Nothing to see here")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -19,7 +19,7 @@ Item {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
StyledText {
|
||||
text: "Notifications"
|
||||
text: qsTr("Notifications")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -53,7 +53,7 @@ Item {
|
||||
StyledText {
|
||||
id: tooltipText
|
||||
|
||||
text: "Do Not Disturb"
|
||||
text: qsTr("Do Not Disturb")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -120,7 +120,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Clear All"
|
||||
text: qsTr("Clear All")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: clearArea.containsMouse ? Theme.primary : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -32,7 +32,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Del: Clear • Shift+Del: Clear All • 1-9: Actions • F10: Help • Esc: Close"
|
||||
text: qsTr("Del: Clear • Shift+Del: Clear All • 1-9: Actions • F10: Help • Esc: Close")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
width: parent.width
|
||||
|
||||
@@ -11,7 +11,7 @@ Rectangle {
|
||||
readonly property real contentHeight: contentColumn.height + Theme.spacingL * 2
|
||||
|
||||
width: parent.width
|
||||
height: expanded ? Math.min(contentHeight, 400) : 0
|
||||
height: expanded ? contentHeight : 0
|
||||
visible: expanded
|
||||
clip: true
|
||||
radius: Theme.cornerRadius
|
||||
@@ -105,7 +105,7 @@ Rectangle {
|
||||
spacing: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Notification Settings"
|
||||
text: qsTr("Notification Settings")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
@@ -128,7 +128,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Do Not Disturb"
|
||||
text: qsTr("Do Not Disturb")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -150,14 +150,14 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Notification Timeouts"
|
||||
text: qsTr("Notification Timeouts")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
text: "Low Priority"
|
||||
text: qsTr("Low Priority")
|
||||
description: "Timeout for low priority notifications"
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutLow)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
@@ -172,7 +172,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
text: "Normal Priority"
|
||||
text: qsTr("Normal Priority")
|
||||
description: "Timeout for normal priority notifications"
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutNormal)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
@@ -187,7 +187,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
text: "Critical Priority"
|
||||
text: qsTr("Critical Priority")
|
||||
description: "Timeout for critical priority notifications"
|
||||
currentValue: getTimeoutText(SettingsData.notificationTimeoutCritical)
|
||||
options: timeoutOptions.map(opt => opt.text)
|
||||
@@ -228,13 +228,13 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: "Notification Overlay"
|
||||
text: qsTr("Notification Overlay")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Display all priorities over fullscreen apps"
|
||||
text: qsTr("Display all priorities over fullscreen apps")
|
||||
font.pixelSize: Theme.fontSizeSmall - 1
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ PanelWindow {
|
||||
StyledText {
|
||||
id: clearText
|
||||
|
||||
text: "Clear"
|
||||
text: qsTr("Clear")
|
||||
color: clearButton.isHovered ? Theme.primary : Theme.surfaceVariantText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -79,6 +79,7 @@ DankOSD {
|
||||
showValue: true
|
||||
unit: "%"
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
alwaysShowValue: SettingsData.osdAlwaysShowValue
|
||||
|
||||
Component.onCompleted: {
|
||||
if (DisplayService.brightnessAvailable) {
|
||||
|
||||
@@ -94,6 +94,7 @@ DankOSD {
|
||||
unit: "%"
|
||||
thumbOutlineColor: Theme.surfaceContainer
|
||||
valueOverride: displayPercent
|
||||
alwaysShowValue: SettingsData.osdAlwaysShowValue
|
||||
|
||||
Component.onCompleted: {
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
@@ -103,7 +104,9 @@ DankOSD {
|
||||
|
||||
onSliderValueChanged: newValue => {
|
||||
if (AudioService.sink && AudioService.sink.audio) {
|
||||
AudioService.suppressOSD = true
|
||||
AudioService.sink.audio.volume = newValue / 100
|
||||
AudioService.suppressOSD = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ Rectangle {
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
||||
@@ -76,7 +76,7 @@ Column {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No items added yet"
|
||||
text: qsTr("No items added yet")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
visible: root.items.length === 0
|
||||
@@ -111,7 +111,7 @@ Column {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Remove"
|
||||
text: qsTr("Remove")
|
||||
color: Theme.errorText
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
|
||||
@@ -123,7 +123,7 @@ Column {
|
||||
id: addButton
|
||||
width: 50
|
||||
height: 36
|
||||
text: "Add"
|
||||
text: qsTr("Add")
|
||||
|
||||
onClicked: {
|
||||
let newItem = {}
|
||||
@@ -159,7 +159,7 @@ Column {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Current Items"
|
||||
text: qsTr("Current Items")
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
@@ -227,7 +227,7 @@ Column {
|
||||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: "Remove"
|
||||
text: qsTr("Remove")
|
||||
color: Theme.onError
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.weight: Font.Medium
|
||||
@@ -247,7 +247,7 @@ Column {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "No items added yet"
|
||||
text: qsTr("No items added yet")
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
visible: root.items.length === 0
|
||||
|
||||
@@ -18,9 +18,23 @@ Item {
|
||||
property Component verticalBarPill: null
|
||||
property Component popoutContent: null
|
||||
property real popoutWidth: 400
|
||||
property real popoutHeight: 400
|
||||
property real popoutHeight: 0
|
||||
property var pillClickAction: null
|
||||
|
||||
property Component controlCenterWidget: null
|
||||
property string ccWidgetIcon: ""
|
||||
property string ccWidgetPrimaryText: ""
|
||||
property string ccWidgetSecondaryText: ""
|
||||
property bool ccWidgetIsActive: false
|
||||
property bool ccWidgetIsToggle: true
|
||||
property Component ccDetailContent: null
|
||||
property real ccDetailHeight: 250
|
||||
|
||||
signal ccWidgetToggled()
|
||||
signal ccWidgetExpanded()
|
||||
|
||||
property var pluginData: ({})
|
||||
property var variants: []
|
||||
|
||||
readonly property bool isVertical: axis?.isVertical ?? false
|
||||
readonly property bool hasHorizontalPill: horizontalBarPill !== null
|
||||
@@ -51,9 +65,32 @@ Item {
|
||||
function loadPluginData() {
|
||||
if (!pluginService || !pluginId) {
|
||||
pluginData = {}
|
||||
variants = []
|
||||
return
|
||||
}
|
||||
pluginData = SettingsData.getPluginSettingsForPlugin(pluginId)
|
||||
variants = pluginService.getPluginVariants(pluginId)
|
||||
}
|
||||
|
||||
function createVariant(variantName, variantConfig) {
|
||||
if (!pluginService || !pluginId) {
|
||||
return null
|
||||
}
|
||||
return pluginService.createPluginVariant(pluginId, variantName, variantConfig)
|
||||
}
|
||||
|
||||
function removeVariant(variantId) {
|
||||
if (!pluginService || !pluginId) {
|
||||
return
|
||||
}
|
||||
pluginService.removePluginVariant(pluginId, variantId)
|
||||
}
|
||||
|
||||
function updateVariant(variantId, variantConfig) {
|
||||
if (!pluginService || !pluginId) {
|
||||
return
|
||||
}
|
||||
pluginService.updatePluginVariant(pluginId, variantId, variantConfig)
|
||||
}
|
||||
|
||||
width: isVertical ? (hasVerticalPill ? verticalPill.width : 0) : (hasHorizontalPill ? horizontalPill.width : 0)
|
||||
@@ -70,7 +107,16 @@ Item {
|
||||
barThickness: root.barThickness
|
||||
content: root.horizontalBarPill
|
||||
onClicked: {
|
||||
if (hasPopout) {
|
||||
if (pillClickAction) {
|
||||
if (pillClickAction.length === 0) {
|
||||
pillClickAction()
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0)
|
||||
const currentScreen = parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width)
|
||||
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen)
|
||||
}
|
||||
} else if (hasPopout) {
|
||||
pluginPopout.toggle()
|
||||
}
|
||||
}
|
||||
@@ -88,7 +134,16 @@ Item {
|
||||
content: root.verticalBarPill
|
||||
isVerticalOrientation: true
|
||||
onClicked: {
|
||||
if (hasPopout) {
|
||||
if (pillClickAction) {
|
||||
if (pillClickAction.length === 0) {
|
||||
pillClickAction()
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0)
|
||||
const currentScreen = parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width)
|
||||
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen)
|
||||
}
|
||||
} else if (hasPopout) {
|
||||
pluginPopout.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
51
Modules/Plugins/PluginControlCenterWrapper.qml
Normal file
51
Modules/Plugins/PluginControlCenterWrapper.qml
Normal file
@@ -0,0 +1,51 @@
|
||||
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(handleToggled)
|
||||
pluginInstance.ccWidgetExpanded.connect(handleExpanded)
|
||||
}
|
||||
}
|
||||
|
||||
function handleToggled() {
|
||||
toggled()
|
||||
}
|
||||
|
||||
function handleExpanded() {
|
||||
expanded()
|
||||
}
|
||||
|
||||
function invokeToggle() {
|
||||
if (pluginInstance) {
|
||||
pluginInstance.ccWidgetToggled()
|
||||
}
|
||||
}
|
||||
|
||||
function invokeExpand() {
|
||||
if (pluginInstance) {
|
||||
pluginInstance.ccWidgetExpanded()
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user