diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 4bd84159..a930f9fa 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -85,6 +85,7 @@ "reset-scaling": "Skalierung zurücksetzen" }, "control-center": { + "title": "Kontrollzentrum", "section": { "label": "Kontrollzentrum", "description": "Konfigurieren Sie die Positionierung und das Verhalten des Kontrollzentrum-Panels." @@ -92,6 +93,22 @@ "position": { "label": "Position", "description": "Wählen Sie, wo das Kontrollzentrum-Panel beim Öffnen erscheint." + }, + "quickSettingsStyle": { + "section": { + "label": "Schnelleinstellungen-Stil", + "description": "Passen Sie das Aussehen und Verhalten der Schnelleinstellungen im Kontrollzentrum an." + }, + "style": { + "label": "Schnelleinstellungen-Stil", + "description": "Wählen Sie den visuellen Stil für Schnelleinstellungs-Schalter und -Steuerungen." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Konfigurieren und verwalten Sie Kontrollzentrum-Widgets und deren Anzeigeoptionen." + } } } }, @@ -266,10 +283,13 @@ "section": { "label": "Monitor-Anzeige", "description": "Statusleiste auf bestimmten Monitoren anzeigen. Standard ist alle, wenn keine ausgewählt sind." - }, - "only-same-output": { - "label": "Nur Apps vom gleichen Bildschirm", - "description": "Zeige nur Apps vom dem Bildschirm an, wo sich das Dock befindet." + } + }, + "tray": { + "blacklist": { + "label": "Ausschlussliste", + "description": "Füge Ausschlussregeln für die Tray-Symbolleiste hinzu, unterstützt Platzhalter (*).", + "placeholder": "z.B., nm-applet, Fcitx*" } } }, @@ -561,9 +581,9 @@ "description": "Schreibt {filepath} und lädt neu", "description-missing": "Erfordert fuzzel Starter" }, - "vesktop": { - "description": "Schreibt {filepath}", - "description-missing": "Erfordert vesktop Discord-Client" + "discord": { + "description": "Schreibt {filepath} für {client}", + "description-missing": "Kein Discord-Client erkannt. Installieren Sie vesktop, webcord, armcord, equibop, lightcord oder dorion." }, "pywalfox": { "description": "Schreibt {filepath} und führt pywalfox update aus", @@ -712,6 +732,28 @@ } } }, + "control-center": { + "title": "Kontrollzentrum", + "quickSettingsStyle": { + "section": { + "label": "Schnelleinstellungen-Stil", + "description": "Passen Sie das Aussehen und Verhalten der Schnelleinstellungen im Kontrollzentrum an." + }, + "style": { + "label": "Schnelleinstellungen-Stil", + "description": "Wählen Sie den visuellen Stil für Schnelleinstellungs-Schalter und -Steuerungen." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Konfigurieren und verwalten Sie Kontrollzentrum-Widgets und deren Anzeigeoptionen." + } + }, + "quickSettings": { + "sectionName": "Schnelleinstellungen" + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -769,7 +811,11 @@ }, "file-picker": { "select-folder": "Ordner auswählen", - "select-file": "Datei auswählen" + "select-file": "Datei auswählen", + "cancel": "Abbrechen", + "search-placeholder": "Dateien und Ordner suchen...", + "select-current": "Aktuelle auswählen", + "title": "Dateiauswahl" }, "datetime-tokens": { "common": { @@ -1262,6 +1308,11 @@ "bottom_right": "Unten rechts", "bottom_center": "Unten mittig", "top_center": "Oben mittig" + }, + "quickSettingsStyle": { + "modern": "Modern", + "classic": "Klassisch", + "compact": "Kompakt" } }, "osd": { @@ -1358,7 +1409,7 @@ "calculator-error": "Fehler" }, "system": { - "uptime": "System-Laufzeit: {uptime}", + "uptime": "Laufzeit: {uptime}", "welcome-back": "Willkommen zurück,", "monitor-description": "{model} ({width}x{height})", "scaling-percentage": "{percentage}%", @@ -1394,6 +1445,78 @@ "restart": "Neu starten", "suspend": "Ruhezustand" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "Benachrichtigungen", + "disabled": "Nicht stören" + }, + "tooltip": { + "action": "Linksklick: Benachrichtigungsverlauf öffnen\nRechtsklick: Nicht stören umschalten" + } + }, + "screenRecorder": { + "label": { + "recording": "Stopp", + "stopped": "Aufnehmen" + }, + "tooltip": { + "action": "Klicken zum Starten/Stoppen der Bildschirmaufnahme" + } + }, + "powerProfile": { + "label": { + "unavailable": "Energieprofil" + }, + "tooltip": { + "action": "Klicken zum Wechseln des Energieprofils" + } + }, + "wifi": { + "label": { + "ethernet": "Ethernet", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi getrennt" + }, + "tooltip": { + "action": "Klicken zum Verwalten der Wi-Fi-Verbindungen" + } + }, + "bluetooth": { + "label": { + "enabled": "Bluetooth", + "disabled": "Bluetooth" + }, + "tooltip": { + "action": "Klicken zum Verwalten der Bluetooth-Geräte" + } + }, + "nightLight": { + "label": { + "enabled": "Nachtlicht", + "forced": "Nachtlicht", + "disabled": "Nachtlicht" + }, + "tooltip": { + "action": "Klicken zum Wechseln des Nachtlicht-Modus\nRechtsklick: Einstellungen öffnen" + } + }, + "wallpaperSelector": { + "label": "Hintergrundbild", + "tooltip": { + "action": "Linksklick: Hintergrundbildauswahl öffnen\nRechtsklick: Zufälliges Hintergrundbild setzen" + } + }, + "keepAwake": { + "label": { + "enabled": "Wach halten", + "disabled": "Wach halten" + }, + "tooltip": { + "action": "Klicken zum Umschalten des Wach-halten-Modus" + } + } + }, "toast": { "night-light": { "enabled": "Aktiviert", diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 033f7c49..c4ff50ae 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -85,6 +85,7 @@ } }, "control-center": { + "title": "Control Center", "section": { "label": "Control Center", "description": "Configure the Control Center panel positioning and behavior." @@ -92,6 +93,22 @@ "position": { "label": "Position", "description": "Choose where the Control Center panel appears when opened." + }, + "quickSettingsStyle": { + "section": { + "label": "Quick Settings Style", + "description": "Customize the appearance and behavior of quick settings in the Control Center." + }, + "style": { + "label": "Quick Settings Style", + "description": "Choose the visual style for quick settings toggles and controls." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure and manage Control Center widgets and their display options." + } } } }, @@ -267,6 +284,13 @@ "label": "Monitors display", "description": "Show bar on specific monitors. Defaults to all if none are chosen." } + }, + "tray": { + "blacklist": { + "label": "Blacklist", + "description": "Add tray exclusion rules, supports wildcards (*).", + "placeholder": "e.g., nm-applet, Fcitx*" + } } }, "dock": { @@ -561,9 +585,9 @@ "description": "Write {filepath} and reload", "description-missing": "Requires {app} to be installed" }, - "vesktop": { - "description": "Write {filepath}", - "description-missing": "Requires {app} to be installed" + "discord": { + "description": "Write {filepath} for {client}", + "description-missing": "No Discord client detected. Install vesktop, webcord, armcord, equibop, lightcord, or dorion." }, "pywalfox": { "description": "Write {filepath} and run pywalfox update", @@ -708,6 +732,28 @@ } } }, + "control-center": { + "title": "Control Center", + "quickSettingsStyle": { + "section": { + "label": "Quick Settings Style", + "description": "Customize the appearance and behavior of quick settings in the Control Center." + }, + "style": { + "label": "Quick Settings Style", + "description": "Choose the visual style for quick settings toggles and controls." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure and manage Control Center widgets and their display options." + } + }, + "quickSettings": { + "sectionName": "Quick Settings" + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -747,8 +793,12 @@ "placeholder": "Placeholder" }, "file-picker": { + "title": "File Picker", "select-folder": "Select Folder", - "select-file": "Select File" + "select-file": "Select File", + "search-placeholder": "Search files and folders...", + "select-current": "Select Current", + "cancel": "Cancel" }, "datetime-tokens": { "common": { @@ -1241,6 +1291,11 @@ "bottom_right": "Bottom right", "bottom_center": "Bottom center", "top_center": "Top center" + }, + "quickSettingsStyle": { + "modern": "Modern", + "classic": "Classic", + "compact": "Compact" } }, "osd": { @@ -1337,7 +1392,7 @@ "calculator-error": "Error" }, "system": { - "uptime": "System uptime: {uptime}", + "uptime": "Uptime: {uptime}", "welcome-back": "Welcome back,", "monitor-description": "{model} ({width}x{height})", "scaling-percentage": "{percentage}%", @@ -1362,6 +1417,78 @@ "restart": "Restart", "suspend": "Suspend" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "Notifications", + "disabled": "Do Not Disturb" + }, + "tooltip": { + "action": "Left click: Open notification history\nRight click: Toggle Do Not Disturb" + } + }, + "screenRecorder": { + "label": { + "recording": "Stop", + "stopped": "Record" + }, + "tooltip": { + "action": "Click to start/stop screen recording" + } + }, + "powerProfile": { + "label": { + "unavailable": "Power Profile" + }, + "tooltip": { + "action": "Click to cycle power profile" + } + }, + "wifi": { + "label": { + "ethernet": "Ethernet", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi Disconnected" + }, + "tooltip": { + "action": "Click to manage Wi-Fi connections" + } + }, + "bluetooth": { + "label": { + "enabled": "Bluetooth", + "disabled": "Bluetooth" + }, + "tooltip": { + "action": "Click to manage Bluetooth devices" + } + }, + "nightLight": { + "label": { + "enabled": "Night Light", + "forced": "Night Light", + "disabled": "Night Light" + }, + "tooltip": { + "action": "Click to cycle Night Light mode\nRight click: Open settings" + } + }, + "wallpaperSelector": { + "label": "Wallpaper", + "tooltip": { + "action": "Left click: Open wallpaper selector\nRight click: Set random wallpaper" + } + }, + "keepAwake": { + "label": { + "enabled": "Keep Awake", + "disabled": "Keep Awake" + }, + "tooltip": { + "action": "Click to toggle keep awake mode" + } + } + }, "toast": { "night-light": { "enabled": "Enabled", diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 949f4ef3..604303c3 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -85,6 +85,7 @@ "reset-scaling": "Restablecer la escala" }, "control-center": { + "title": "Centro de control", "section": { "label": "Centro de control", "description": "Configurar el posicionamiento y comportamiento del panel del centro de control." @@ -92,6 +93,22 @@ "position": { "label": "Posición", "description": "Elige dónde aparece el panel del centro de control cuando se abre." + }, + "quickSettingsStyle": { + "section": { + "label": "Estilo de configuración rápida", + "description": "Personaliza la apariencia y el comportamiento de las configuraciones rápidas en el centro de control." + }, + "style": { + "label": "Estilo de configuración rápida", + "description": "Elige el estilo visual para los interruptores y controles de configuración rápida." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configura y gestiona los widgets del centro de control y sus opciones de visualización." + } } } }, @@ -267,6 +284,13 @@ "label": "Visualización en monitores", "description": "Muestra la barra en monitores específicos. Por defecto, se muestra en todos si no se elige ninguno." } + }, + "tray": { + "blacklist": { + "label": "Lista negra", + "description": "Agregar reglas de exclusión de la bandeja, admite comodines (*).", + "placeholder": "ej., nm-applet, Fcitx*" + } } }, "dock": { @@ -557,9 +581,9 @@ "description": "Escribir {filepath} y recargar", "description-missing": "Requiere que {app} esté instalado" }, - "vesktop": { - "description": "Escribir {filepath}", - "description-missing": "Requiere que {app} esté instalado" + "discord": { + "description": "Escribir {filepath} para {client}", + "description-missing": "No se detectó cliente de Discord. Instala vesktop, webcord, armcord, equibop, lightcord o dorion." }, "pywalfox": { "description": "Escribir {filepath} y ejecutar pywalfox update", @@ -708,6 +732,28 @@ } } }, + "control-center": { + "title": "Centro de control", + "quickSettingsStyle": { + "section": { + "label": "Estilo de configuración rápida", + "description": "Personaliza la apariencia y el comportamiento de las configuraciones rápidas en el centro de control." + }, + "style": { + "label": "Estilo de configuración rápida", + "description": "Elige el estilo visual para los interruptores y controles de configuración rápida." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configura y gestiona los widgets del centro de control y sus opciones de visualización." + } + }, + "quickSettings": { + "sectionName": "Ajustes rápidos" + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -748,7 +794,11 @@ }, "file-picker": { "select-folder": "Seleccionar carpeta", - "select-file": "Seleccionar archivo" + "select-file": "Seleccionar archivo", + "cancel": "Cancelar", + "search-placeholder": "Buscar archivos y carpetas...", + "select-current": "Seleccionar actual", + "title": "Selector de archivos" }, "datetime-tokens": { "common": { @@ -1241,6 +1291,11 @@ "bottom_right": "Inferior derecha", "bottom_center": "Inferior central", "top_center": "Superior central" + }, + "quickSettingsStyle": { + "modern": "Moderno", + "classic": "Clásico", + "compact": "Compacto" } }, "osd": { @@ -1337,7 +1392,7 @@ "calculator-error": "Error" }, "system": { - "uptime": "Tiempo de actividad: {uptime}", + "uptime": "Actividad: {uptime}", "welcome-back": "¡Bienvenido de nuevo,", "monitor-description": "{model} ({width}x{height})", "scaling-percentage": "{percentage}%", @@ -1362,6 +1417,78 @@ "restart": "Reiniciar", "suspend": "Suspender" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "Notificaciones", + "disabled": "No molestar" + }, + "tooltip": { + "action": "Clic izquierdo: Abrir historial de notificaciones\nClic derecho: Alternar No molestar" + } + }, + "screenRecorder": { + "label": { + "recording": "Detener", + "stopped": "Grabar" + }, + "tooltip": { + "action": "Hacer clic para iniciar/detener la grabación de pantalla" + } + }, + "powerProfile": { + "label": { + "unavailable": "Perfil de energía" + }, + "tooltip": { + "action": "Hacer clic para cambiar el perfil de energía" + } + }, + "wifi": { + "label": { + "ethernet": "Ethernet", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi desconectado" + }, + "tooltip": { + "action": "Hacer clic para gestionar las conexiones Wi-Fi" + } + }, + "bluetooth": { + "label": { + "enabled": "Bluetooth", + "disabled": "Bluetooth" + }, + "tooltip": { + "action": "Hacer clic para gestionar los dispositivos Bluetooth" + } + }, + "nightLight": { + "label": { + "enabled": "Luz nocturna", + "forced": "Luz nocturna", + "disabled": "Luz nocturna" + }, + "tooltip": { + "action": "Hacer clic para alternar el modo Luz nocturna\nClic derecho: Abrir configuración" + } + }, + "wallpaperSelector": { + "label": "Fondo de pantalla", + "tooltip": { + "action": "Clic izquierdo: Abrir selector de fondo de pantalla\nClic derecho: Establecer fondo de pantalla aleatorio" + } + }, + "keepAwake": { + "label": { + "enabled": "Mantener despierto", + "disabled": "Mantener despierto" + }, + "tooltip": { + "action": "Hacer clic para alternar el modo Mantener despierto" + } + } + }, "toast": { "night-light": { "enabled": "Activada", diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index dcc4cd41..59e9504a 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -85,6 +85,7 @@ "reset-scaling": "Réinitialiser l'échelle" }, "control-center": { + "title": "Centre de contrôle", "section": { "label": "Centre de contrôle", "description": "Configurer le positionnement et le comportement du panneau du centre de contrôle." @@ -92,6 +93,22 @@ "position": { "label": "Position", "description": "Choisissez où apparaît le panneau du centre de contrôle lors de l'ouverture." + }, + "quickSettingsStyle": { + "section": { + "label": "Style des paramètres rapides", + "description": "Personnalisez l'apparence et le comportement des paramètres rapides dans le centre de contrôle." + }, + "style": { + "label": "Style des paramètres rapides", + "description": "Choisissez le style visuel pour les commutateurs et contrôles des paramètres rapides." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configurez et gérez les widgets du centre de contrôle et leurs options d'affichage." + } } } }, @@ -264,9 +281,16 @@ }, "monitors": { "section": { - "label": "Affichage sur les moniteur", + "label": "Affichage sur les moniteurs", "description": "Afficher la barre sur des moniteurs spécifiques. Par défaut, sur tous si aucun n'est choisi." } + }, + "tray": { + "blacklist": { + "label": "Liste noire", + "description": "Ajouter des règles d'exclusion pour la boîte à miniatures, prend en charge les caractères génériques (*).", + "placeholder": "ex: nm-applet, Fcitx*" + } } }, "dock": { @@ -557,9 +581,9 @@ "description": "Écrire ~/.config/fuzzel/themes/noctalia et recharger", "description-missing": "Nécessite que le lanceur fuzzel soit installé" }, - "vesktop": { - "description": "Écrire ~/.config/vesktop/themes/noctalia.theme.css", - "description-missing": "Nécessite que le client Discord vesktop soit installé" + "discord": { + "description": "Écrire {filepath} pour {client}", + "description-missing": "Aucun client Discord détecté. Installez vesktop, webcord, armcord, equibop, lightcord ou dorion." }, "pywalfox": { "description": "Écrire ~/.cache/wal/colors.json et exécuter pywalfox update", @@ -708,6 +732,28 @@ } } }, + "control-center": { + "title": "Centre de contrôle", + "quickSettingsStyle": { + "section": { + "label": "Style des paramètres rapides", + "description": "Personnalisez l'apparence et le comportement des paramètres rapides dans le centre de contrôle." + }, + "style": { + "label": "Style des paramètres rapides", + "description": "Choisissez le style visuel pour les commutateurs et contrôles des paramètres rapides." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configurez et gérez les widgets du centre de contrôle et leurs options d'affichage." + } + }, + "quickSettings": { + "sectionName": "Paramètres rapides" + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -748,7 +794,11 @@ }, "file-picker": { "select-folder": "Sélectionner un dossier", - "select-file": "Sélectionner un fichier" + "select-file": "Sélectionner un fichier", + "cancel": "Annuler", + "search-placeholder": "Rechercher des fichiers et des dossiers...", + "select-current": "Sélectionner Actuel", + "title": "Sélecteur de fichiers" }, "datetime-tokens": { "common": { @@ -1241,6 +1291,11 @@ "bottom_right": "En bas à droite", "bottom_center": "En bas au centre", "top_center": "En haut au centre" + }, + "quickSettingsStyle": { + "modern": "Moderne", + "classic": "Classique", + "compact": "Compact" } }, "osd": { @@ -1337,7 +1392,6 @@ "calculator-error": "Erreur" }, "system": { - "uptime": "Temps d'activité : {uptime}", "welcome-back": "Bon retour,", "monitor-description": "{model} ({width}x{height})", "scaling-percentage": "{percentage}%", @@ -1351,7 +1405,8 @@ "user-requested": "Demandé par l'utilisateur", "unknown": "Inconnu", "unknown-version": "Inconnue", - "unknown-layout": "Inconnue" + "unknown-layout": "Inconnue", + "uptime": "Activité : {uptime}" }, "lock-screen": { "password": "Entrez votre mot de passe...", @@ -1362,6 +1417,78 @@ "restart": "Redémarrer", "suspend": "Mettre en veille" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "Notifications", + "disabled": "Ne pas déranger" + }, + "tooltip": { + "action": "Clic gauche : Ouvrir l'historique des notifications\nClic droit : Basculer Ne pas déranger" + } + }, + "screenRecorder": { + "label": { + "recording": "Arrêter", + "stopped": "Enregistrer" + }, + "tooltip": { + "action": "Cliquer pour démarrer/arrêter l'enregistrement d'écran" + } + }, + "powerProfile": { + "label": { + "unavailable": "Profil d'alimentation" + }, + "tooltip": { + "action": "Cliquer pour changer de profil d'alimentation" + } + }, + "wifi": { + "label": { + "ethernet": "Ethernet", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi déconnecté" + }, + "tooltip": { + "action": "Cliquer pour gérer les connexions Wi-Fi" + } + }, + "bluetooth": { + "label": { + "enabled": "Bluetooth", + "disabled": "Bluetooth" + }, + "tooltip": { + "action": "Cliquer pour gérer les appareils Bluetooth" + } + }, + "nightLight": { + "label": { + "enabled": "Lumière nocturne", + "forced": "Lumière nocturne", + "disabled": "Lumière nocturne" + }, + "tooltip": { + "action": "Cliquer pour basculer le mode Lumière nocturne\nClic droit : Ouvrir les paramètres" + } + }, + "wallpaperSelector": { + "label": "Fond d'écran", + "tooltip": { + "action": "Clic gauche : Ouvrir le sélecteur de fond d'écran\nClic droit : Définir un fond d'écran aléatoire" + } + }, + "keepAwake": { + "label": { + "enabled": "Rester éveillé", + "disabled": "Rester éveillé" + }, + "tooltip": { + "action": "Cliquer pour basculer le mode Rester éveillé" + } + } + }, "toast": { "night-light": { "enabled": "Activé", diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 4843d932..5cbd6769 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -85,6 +85,7 @@ "reset-scaling": "Redefinir escala" }, "control-center": { + "title": "Centro de controle", "section": { "label": "Centro de controle", "description": "Configurar o posicionamento e comportamento do painel do centro de controle." @@ -92,6 +93,22 @@ "position": { "label": "Posição", "description": "Escolha onde o painel do centro de controle aparece quando aberto." + }, + "quickSettingsStyle": { + "section": { + "label": "Estilo de configurações rápidas", + "description": "Personalize a aparência e o comportamento das configurações rápidas no centro de controle." + }, + "style": { + "label": "Estilo de configurações rápidas", + "description": "Escolha o estilo visual para os interruptores e controles de configurações rápidas." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure e gerencie os widgets do centro de controle e suas opções de exibição." + } } } }, @@ -267,6 +284,13 @@ "label": "Exibição nos monitores", "description": "Mostra a barra em monitores específicos. O padrão é todos, se nenhum for escolhido." } + }, + "tray": { + "blacklist": { + "label": "Lista Negra", + "description": "Adicione regras de exclusão para a bandeja do sistema, suporta curingas (*).", + "placeholder": "ex: nm-applet, Fcitx*" + } } }, "dock": { @@ -523,9 +547,9 @@ "description": "Escrever {filepath} e recarregar", "description-missing": "Requer que o {app} esteja instalado" }, - "vesktop": { - "description": "Escrever {filepath}", - "description-missing": "Requer que o {app} esteja instalado" + "discord": { + "description": "Escrever {filepath} para {client}", + "description-missing": "Nenhum cliente Discord detectado. Instale vesktop, webcord, armcord, equibop, lightcord ou dorion." }, "pywalfox": { "description": "Escrever {filepath} e executar pywalfox update", @@ -674,6 +698,28 @@ } } }, + "control-center": { + "title": "Centro de controle", + "quickSettingsStyle": { + "section": { + "label": "Estilo de configurações rápidas", + "description": "Personalize a aparência e o comportamento das configurações rápidas no centro de controle." + }, + "style": { + "label": "Estilo de configurações rápidas", + "description": "Escolha o estilo visual para os interruptores e controles de configurações rápidas." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure e gerencie os widgets do centro de controle e suas opções de exibição." + } + }, + "quickSettings": { + "sectionName": "Configurações rápidas" + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -748,7 +794,11 @@ }, "file-picker": { "select-folder": "Selecionar Pasta", - "select-file": "Selecionar Arquivo" + "select-file": "Selecionar Arquivo", + "cancel": "Cancelar", + "search-placeholder": "Pesquisar arquivos e pastas...", + "select-current": "Selecionar Atual", + "title": "Seletor de Arquivos" }, "datetime-tokens": { "common": { @@ -1240,6 +1290,11 @@ "bottom_right": "Inferior direito", "bottom_center": "Centro inferior", "top_center": "Centro superior" + }, + "quickSettingsStyle": { + "modern": "Moderno", + "classic": "Clássico", + "compact": "Compacto" } }, "bar": { @@ -1337,7 +1392,7 @@ "calculator-error": "Erro" }, "system": { - "uptime": "Sistema ativo há: {uptime}", + "uptime": "Atividade: {uptime}", "welcome-back": "Bem-vindo(a) de volta, {user}!", "monitor-description": "{model} ({width}x{height})", "scaling-percentage": "{percentage}%", @@ -1362,6 +1417,78 @@ "restart": "Reiniciar", "suspend": "Suspender" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "Notificações", + "disabled": "Não perturbar" + }, + "tooltip": { + "action": "Clique esquerdo: Abrir histórico de notificações\nClique direito: Alternar Não perturbar" + } + }, + "screenRecorder": { + "label": { + "recording": "Parar", + "stopped": "Gravar" + }, + "tooltip": { + "action": "Clique para iniciar/parar a gravação da tela" + } + }, + "powerProfile": { + "label": { + "unavailable": "Perfil de energia" + }, + "tooltip": { + "action": "Clique para alternar o perfil de energia" + } + }, + "wifi": { + "label": { + "ethernet": "Ethernet", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi desconectado" + }, + "tooltip": { + "action": "Clique para gerenciar conexões Wi-Fi" + } + }, + "bluetooth": { + "label": { + "enabled": "Bluetooth", + "disabled": "Bluetooth" + }, + "tooltip": { + "action": "Clique para gerenciar dispositivos Bluetooth" + } + }, + "nightLight": { + "label": { + "enabled": "Luz noturna", + "forced": "Luz noturna", + "disabled": "Luz noturna" + }, + "tooltip": { + "action": "Clique para alternar o modo Luz noturna\nClique direito: Abrir configurações" + } + }, + "wallpaperSelector": { + "label": "Papel de parede", + "tooltip": { + "action": "Clique esquerdo: Abrir seletor de papel de parede\nClique direito: Definir papel de parede aleatório" + } + }, + "keepAwake": { + "label": { + "enabled": "Manter acordado", + "disabled": "Manter acordado" + }, + "tooltip": { + "action": "Clique para alternar o modo Manter acordado" + } + } + }, "toast": { "night-light": { "enabled": "Ativada", diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index f1317f15..b257da86 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -85,6 +85,7 @@ } }, "control-center": { + "title": "控制中心", "section": { "label": "控制中心", "description": "配置控制中心面板的定位和行为。" @@ -92,6 +93,22 @@ "position": { "label": "位置", "description": "选择控制中心面板打开时出现的位置。" + }, + "quickSettingsStyle": { + "section": { + "label": "快速设置样式", + "description": "自定义控制中心中快速设置的外观和行为。" + }, + "style": { + "label": "快速设置样式", + "description": "选择快速设置开关和控件的视觉样式。" + } + }, + "widgets": { + "section": { + "label": "小部件", + "description": "配置和管理控制中心小部件及其显示选项。" + } } } }, @@ -267,6 +284,13 @@ "label": "显示器显示", "description": "在特定显示器上显示状态栏。如果未选择,则默认为全部。" } + }, + "tray": { + "blacklist": { + "label": "黑名单", + "description": "添加托盘排除规则,支持通配符 (*)。", + "placeholder": "例如:nm-applet, Fcitx*" + } } }, "dock": { @@ -557,9 +581,9 @@ "description": "写入 {filepath} 并重新加载", "description-missing": "需要安装 {app}" }, - "vesktop": { - "description": "写入 {filepath}", - "description-missing": "需要安装 {app}" + "discord": { + "description": "为 {client} 写入 {filepath}", + "description-missing": "未检测到 Discord 客户端。请安装 vesktop、webcord、armcord、equibop、lightcord 或 dorion。" }, "pywalfox": { "description": "写入 {filepath} 并运行 pywalfox update", @@ -708,6 +732,28 @@ } } }, + "control-center": { + "title": "控制中心", + "quickSettingsStyle": { + "section": { + "label": "快速设置样式", + "description": "自定义控制中心中快速设置的外观和行为。" + }, + "style": { + "label": "快速设置样式", + "description": "选择快速设置开关和控件的视觉样式。" + } + }, + "widgets": { + "section": { + "label": "小部件", + "description": "配置和管理控制中心小部件及其显示选项。" + } + }, + "quickSettings": { + "sectionName": "快速设置" + } + }, "hooks": { "title": "钩子", "system-hooks": { @@ -748,7 +794,11 @@ }, "file-picker": { "select-folder": "选择文件夹", - "select-file": "选择文件" + "select-file": "选择文件", + "cancel": "取消", + "search-placeholder": "搜索文件和文件夹...", + "select-current": "选择当前", + "title": "文件选择器" }, "datetime-tokens": { "common": { @@ -1241,6 +1291,11 @@ "bottom_right": "右下角", "bottom_center": "底部居中", "top_center": "顶部居中" + }, + "quickSettingsStyle": { + "modern": "现代", + "classic": "经典", + "compact": "紧凑" } }, "osd": { @@ -1362,6 +1417,78 @@ "restart": "重启", "suspend": "挂起" }, + "quickSettings": { + "notifications": { + "label": { + "enabled": "通知", + "disabled": "勿扰模式" + }, + "tooltip": { + "action": "左键:打开通知历史\n右键:切换勿扰模式" + } + }, + "screenRecorder": { + "label": { + "recording": "停止", + "stopped": "录制" + }, + "tooltip": { + "action": "点击开始/停止屏幕录制" + } + }, + "powerProfile": { + "label": { + "unavailable": "电源模式" + }, + "tooltip": { + "action": "点击切换电源模式" + } + }, + "wifi": { + "label": { + "ethernet": "以太网", + "wifi": "Wi-Fi", + "disconnected": "Wi-Fi 已断开" + }, + "tooltip": { + "action": "点击管理 Wi-Fi 连接" + } + }, + "bluetooth": { + "label": { + "enabled": "蓝牙", + "disabled": "蓝牙" + }, + "tooltip": { + "action": "点击管理蓝牙设备" + } + }, + "nightLight": { + "label": { + "enabled": "夜间模式", + "forced": "夜间模式", + "disabled": "夜间模式" + }, + "tooltip": { + "action": "点击切换夜间模式\n右键:打开设置" + } + }, + "wallpaperSelector": { + "label": "壁纸", + "tooltip": { + "action": "左键:打开壁纸选择器\n右键:设置随机壁纸" + } + }, + "keepAwake": { + "label": { + "enabled": "保持唤醒", + "disabled": "保持唤醒" + }, + "tooltip": { + "action": "点击切换保持唤醒模式" + } + } + }, "toast": { "night-light": { "enabled": "已启用", diff --git a/Assets/settings-default.json b/Assets/settings-default.json index a80e2bb4..9b63d3ae 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -9,6 +9,7 @@ "floating": false, "marginVertical": 0.25, "marginHorizontal": 0.25, + "widgets": { "left": [ { @@ -36,12 +37,6 @@ { "id": "NotificationHistory" }, - { - "id": "WiFi" - }, - { - "id": "Bluetooth" - }, { "id": "Battery" }, @@ -112,7 +107,30 @@ "terminalCommand": "xterm -e" }, "controlCenter": { - "position": "close_to_bar_button" + "position": "close_to_bar_button", + "quickSettingsStyle": "compact", + "widgets": { + "quickSettings": [ + { + "id": "WiFi" + }, + { + "id": "Bluetooth" + }, + { + "id": "Notifications" + }, + { + "id": "ScreenRecorder" + }, + { + "id": "PowerProfile" + }, + { + "id": "WallpaperSelector" + } + ] + } }, "dock": { "displayMode": "always_visible", @@ -176,7 +194,13 @@ "ghostty": false, "foot": false, "fuzzel": false, - "vesktop": false, + "discord": false, + "discord_vesktop": false, + "discord_webcord": false, + "discord_armcord": false, + "discord_equibop": false, + "discord_lightcord": false, + "discord_dorion": false, "pywalfox": false, "enableUserTemplates": false }, diff --git a/Bin/i18n-json-check.sh b/Bin/dev/i18n-json-check.sh similarity index 75% rename from Bin/i18n-json-check.sh rename to Bin/dev/i18n-json-check.sh index 408677b2..a847d66c 100755 --- a/Bin/i18n-json-check.sh +++ b/Bin/dev/i18n-json-check.sh @@ -181,6 +181,40 @@ inject_translation() { fi } +# Function to remove a key from JSON file using jq +remove_json_key() { + local json_file=$1 + local key_path=$2 + + # Split key path into array + local -a path_parts + IFS='.' read -ra path_parts <<< "$key_path" + + # Build jq path array + local jq_path="[" + for i in "${!path_parts[@]}"; do + if [[ $i -gt 0 ]]; then + jq_path+="," + fi + jq_path+="\"${path_parts[$i]}\"" + done + jq_path+="]" + + # Create a temporary file + local temp_file=$(mktemp) + + # Use jq to delete the path + jq --argjson path "$jq_path" 'delpaths([$path])' "$json_file" > "$temp_file" + + if [[ $? -eq 0 ]]; then + mv "$temp_file" "$json_file" + return 0 + else + rm -f "$temp_file" + return 1 + fi +} + # Function to extract all keys from a JSON file recursively extract_keys() { local json_file=$1 @@ -207,6 +241,78 @@ extract_keys() { ' "$json_file" 2>/dev/null | sort } +# Function to extract empty keys from a JSON file recursively +extract_empty_keys() { + local json_file=$1 + + if [[ ! -f "$json_file" ]]; then + echo "Error: File $json_file not found" >&2 + return 1 + fi + + # Extract all keys with empty string or null values recursively using jq + jq -r ' + def empty_keys_recursive: + if type == "object" then + keys[] as $k | + if (.[$k] | type) == "object" then + ($k + "." + (.[$k] | empty_keys_recursive)) + elif (.[$k] == "" or .[$k] == null) then + $k + else + empty + end + else + empty + end; + empty_keys_recursive + ' "$json_file" 2>/dev/null | sort +} + +# Function to remove empty objects recursively from JSON file +remove_empty_objects() { + local json_file=$1 + + # Create a temporary file + local temp_file=$(mktemp) + + # Use jq to recursively remove empty objects + # This function walks the entire JSON tree and removes any object that contains no leaf values + jq ' + def remove_empty: + if type == "object" then + to_entries | + map( + .value |= remove_empty + ) | + map( + select( + .value != {} and + .value != [] and + .value != null and + .value != "" + ) + ) | + from_entries | + if length == 0 then empty else . end + elif type == "array" then + map(remove_empty) | + map(select(. != null and . != {} and . != [] and . != "")) + else + . + end; + remove_empty + ' "$json_file" > "$temp_file" 2>/dev/null + + if [[ $? -eq 0 ]]; then + mv "$temp_file" "$json_file" + return 0 + else + rm -f "$temp_file" + return 1 + fi +} + # Function to get language files get_language_files() { find "$FOLDER_PATH" -maxdepth 1 -name "*.json" -type f | sort @@ -223,15 +329,20 @@ generate_header() { echo "Reference file: $REFERENCE_FILE" echo "Folder: $(realpath "$FOLDER_PATH")" if $TRANSLATE_MODE; then - echo "Mode: TRANSLATION ENABLED" + echo "Mode: TRANSLATION ENABLED (translates missing keys, removes extra/empty keys and empty objects)" fi echo "" echo "Notes:" echo "- Keys are compared recursively through all nested JSON objects" echo "- Missing keys indicate incomplete translations" echo "- Extra keys might indicate deprecated keys or translation-specific additions" + echo "- Empty keys are keys with empty string (\"\") or null values" + echo "- Empty objects are nested objects containing no actual values (only other empty objects)" echo "- Translation completion percentage is calculated based on English reference" echo "- Results are sorted by descending line numbers for easier editing" + if $TRANSLATE_MODE; then + echo "- In translation mode, extra keys, empty keys, and empty objects are automatically removed" + fi echo "" echo "This report compares all language JSON files against the English reference file" echo "and identifies missing keys and extra keys in each language." @@ -427,11 +538,92 @@ compare_language() { done rm -f "$temp_extra" echo "" + + # Remove extra keys if in translate mode + if $TRANSLATE_MODE; then + print_color $BLUE "Removing extra keys from $lang_name..." >&2 + local removed_count=0 + local failed_removal_count=0 + + while IFS= read -r key; do + if [[ -n "$key" ]]; then + print_color $YELLOW " Removing: $key" >&2 + + if remove_json_key "$lang_file" "$key"; then + print_color $GREEN " ✓ Removed: $key" >&2 + removed_count=$((removed_count + 1)) + else + print_color $RED " ✗ Failed to remove: $key" >&2 + failed_removal_count=$((failed_removal_count + 1)) + fi + fi + done <<< "$extra_keys" + + echo "" + print_color $GREEN "Removal complete: $removed_count removed, $failed_removal_count failed" >&2 + echo "" + fi else echo "✅ No extra keys in $lang_name" echo "" fi + # Handle empty keys in translate mode + if $TRANSLATE_MODE; then + local empty_keys=$(extract_empty_keys "$lang_file") + local empty_count=$(count_non_empty_lines "$empty_keys") + + if [[ $empty_count -gt 0 && -n "$empty_keys" ]]; then + echo "EMPTY KEYS IN $lang_name:" + + # Display empty keys + local counter=1 + while IFS= read -r key; do + if [[ -n "$key" ]]; then + local lang_line=$(find_key_line_number "$lang_file" "$key") + printf " %3d. %s (%s:%s)\n" "$counter" "$key" "$(basename "$lang_file")" "$lang_line" + counter=$((counter + 1)) + fi + done <<< "$empty_keys" + echo "" + + print_color $BLUE "Removing empty keys from $lang_name..." >&2 + local removed_empty_count=0 + local failed_empty_removal_count=0 + + while IFS= read -r key; do + if [[ -n "$key" ]]; then + print_color $YELLOW " Removing empty key: $key" >&2 + + if remove_json_key "$lang_file" "$key"; then + print_color $GREEN " ✓ Removed: $key" >&2 + removed_empty_count=$((removed_empty_count + 1)) + else + print_color $RED " ✗ Failed to remove: $key" >&2 + failed_empty_removal_count=$((failed_empty_removal_count + 1)) + fi + fi + done <<< "$empty_keys" + + echo "" + print_color $GREEN "Empty key removal complete: $removed_empty_count removed, $failed_empty_removal_count failed" >&2 + echo "" + else + echo "✅ No empty keys in $lang_name" + echo "" + fi + + # Remove empty objects (nested objects with no actual values) + print_color $BLUE "Cleaning up empty objects in $lang_name..." >&2 + if remove_empty_objects "$lang_file"; then + print_color $GREEN "✓ Successfully removed all empty objects" >&2 + echo "" + else + print_color $RED "✗ Failed to clean up empty objects" >&2 + echo "" + fi + fi + # Clean up rm -f "$lang_keys_file" } @@ -545,7 +737,7 @@ main() { echo "Target language: $target_language" fi if $TRANSLATE_MODE; then - echo "Translation mode: ENABLED" + echo "Translation mode: ENABLED (translated missing keys, removed extra keys, removed empty keys and objects)" fi echo "Report generated: $(date '+%Y-%m-%d %H:%M:%S')" echo "" @@ -568,7 +760,9 @@ show_usage() { echo "This script compares JSON language files in '$FOLDER_PATH' against the English reference." >&2 echo "" >&2 echo "Arguments:" >&2 - echo " --translate Enable automatic translation of missing keys using Gemini API" >&2 + echo " --translate Enable automatic translation of missing keys, removal of extra keys," >&2 + echo " removal of empty keys (empty strings or null values), and removal of" >&2 + echo " empty objects (nested objects containing no actual values)" >&2 echo " --list-models List all available Gemini models and exit" >&2 echo " language_code Optional. Compare only the specified language (e.g., 'fr', 'es', 'de')" >&2 echo " If not provided, all language files will be compared" >&2 @@ -581,8 +775,8 @@ show_usage() { echo " $0 # Compare all languages" >&2 echo " $0 fr # Compare only French (fr.json)" >&2 echo " $0 --list-models # List available Gemini models" >&2 - echo " $0 --translate # Compare all and translate missing keys" >&2 - echo " $0 --translate fr # Translate missing keys for French only" >&2 + echo " $0 --translate # Compare all, translate missing, remove extra/empty keys and objects" >&2 + echo " $0 --translate fr # Translate and clean French only" >&2 echo "" >&2 echo "Requirements:" >&2 echo " - jq must be installed" >&2 @@ -595,6 +789,7 @@ show_usage() { echo " - Comparison report is printed to stdout" >&2 echo " - Progress messages are printed to stderr" >&2 echo " - Results are sorted by descending line numbers for easier editing" >&2 + echo " - In translate mode, extra keys, empty keys, and empty objects are removed" >&2 } # Handle command line arguments diff --git a/Bin/i18n-qml-check.sh b/Bin/dev/i18n-qml-check.sh similarity index 100% rename from Bin/i18n-qml-check.sh rename to Bin/dev/i18n-qml-check.sh diff --git a/Bin/notifications-test.sh b/Bin/dev/notifications-test.sh similarity index 100% rename from Bin/notifications-test.sh rename to Bin/dev/notifications-test.sh diff --git a/Bin/qmlfmt.sh b/Bin/dev/qmlfmt.sh similarity index 100% rename from Bin/qmlfmt.sh rename to Bin/dev/qmlfmt.sh diff --git a/Bin/shaders-compile.sh b/Bin/dev/shaders-compile.sh similarity index 100% rename from Bin/shaders-compile.sh rename to Bin/dev/shaders-compile.sh diff --git a/Commons/I18n.qml b/Commons/I18n.qml index 3a013c57..11180047 100644 --- a/Commons/I18n.qml +++ b/Commons/I18n.qml @@ -54,6 +54,9 @@ Singleton { var data = JSON.parse(text()) root.translations = data Logger.log("I18n", `Loaded translations for "${root.langCode}"`) + if (debug) { + Logger.log("I18n", `Available root keys: ${Object.keys(data).join(", ")}`) + } root.isLoaded = true root.translationsLoaded() @@ -279,9 +282,9 @@ Singleton { interpolations = {} if (!isLoaded) { - // if (debug) { - // Logger.warn("I18n", "Translations not loaded yet") - // } + if (debug) { + Logger.warn("I18n", "Translations not loaded yet") + } return key } @@ -291,12 +294,19 @@ Singleton { // Look-up translation in the active language var value = translations var notFound = false + if (debug) { + Logger.log("I18n", `Looking up key: "${key}"`) + } for (var i = 0; i < keys.length; i++) { if (value && typeof value === "object" && keys[i] in value) { value = value[keys[i]] + if (debug) { + Logger.log("I18n", `Found key part "${keys[i]}"`) + } } else { if (debug) { - Logger.warn("I18n", `Translation key "${key}" not found`) + Logger.warn("I18n", `Translation key "${key}" not found at part "${keys[i]}"`) + Logger.warn("I18n", `Available keys: ${Object.keys(value || {}).join(", ")}`) } notFound = true break diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 68414fc7..d8e8f4bf 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -33,6 +33,7 @@ Singleton { // Signal emitted when settings are loaded after startupcale changes signal settingsLoaded + signal settingsSaved // ----------------------------------------------------- // ----------------------------------------------------- @@ -71,11 +72,7 @@ Singleton { running: false interval: 1000 onTriggered: { - settingsFileView.writeAdapter() - // Write to fallback location if set - if (Quickshell.env("NOCTALIA_SETTINGS_FALLBACK")) { - settingsFallbackFileView.writeAdapter() - } + root.saveImmediate() } } @@ -162,10 +159,6 @@ Singleton { "id": "Tray" }, { "id": "NotificationHistory" - }, { - "id": "WiFi" - }, { - "id": "Bluetooth" }, { "id": "Battery" }, { @@ -246,6 +239,23 @@ Singleton { property JsonObject controlCenter: JsonObject { // Position: close_to_bar_button, center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center property string position: "close_to_bar_button" + property string quickSettingsStyle: "compact" // "compact", "classic", or "modern" + property JsonObject widgets + widgets: JsonObject { + property list quickSettings: [{ + "id": "WiFi" + }, { + "id": "Bluetooth" + }, { + "id": "Notifications" + }, { + "id": "ScreenRecorder" + }, { + "id": "PowerProfile" + }, { + "id": "WallpaperSelector" + }] + } } // dock @@ -328,7 +338,13 @@ Singleton { property bool ghostty: false property bool foot: false property bool fuzzel: false - property bool vesktop: false + property bool discord: false + property bool discord_vesktop: false + property bool discord_webcord: false + property bool discord_armcord: false + property bool discord_equibop: false + property bool discord_lightcord: false + property bool discord_dorion: false property bool pywalfox: false property bool enableUserTemplates: false } @@ -352,6 +368,17 @@ Singleton { } } + // ----------------------------------------------------- + // Public function to trigger immediate settings saving + function saveImmediate() { + settingsFileView.writeAdapter() + // Write to fallback location if set + if (Quickshell.env("NOCTALIA_SETTINGS_FALLBACK")) { + settingsFallbackFileView.writeAdapter() + } + root.settingsSaved() // Emit signal after saving + } + // ----------------------------------------------------- // Generate default settings at the root of the repo function generateDefaultSettings() { diff --git a/Modules/Bar/Extras/BarWidgetLoader.qml b/Modules/Bar/Extras/BarWidgetLoader.qml index 8697db5b..69b08623 100644 --- a/Modules/Bar/Extras/BarWidgetLoader.qml +++ b/Modules/Bar/Extras/BarWidgetLoader.qml @@ -77,7 +77,7 @@ Item { // Error handling onWidgetIdChanged: { if (widgetId && !BarWidgetRegistry.hasWidget(widgetId)) { - Logger.warn("BarWidgetLoader", "Widget not found in bar registry:", widgetId) + Logger.warn("BarWidgetLoader", "Widget not found in registry:", widgetId) } } } diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 91c05f1d..de10760d 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -10,6 +10,7 @@ import qs.Widgets Item { id: root + property ShellScreen screen property real scaling: 1.0 diff --git a/Modules/Bar/Widgets/Bluetooth.qml b/Modules/Bar/Widgets/Bluetooth.qml index 21fe96c7..e76fa234 100644 --- a/Modules/Bar/Widgets/Bluetooth.qml +++ b/Modules/Bar/Widgets/Bluetooth.qml @@ -10,6 +10,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 baseSize: Style.capsuleHeight diff --git a/Modules/Bar/Widgets/ControlCenter.qml b/Modules/Bar/Widgets/ControlCenter.qml index 5fbe7282..65eb3b8c 100644 --- a/Modules/Bar/Widgets/ControlCenter.qml +++ b/Modules/Bar/Widgets/ControlCenter.qml @@ -9,6 +9,7 @@ import qs.Services NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 // Widget properties passed from Bar.qml for per-instance settings diff --git a/Modules/Bar/Widgets/CustomButton.qml b/Modules/Bar/Widgets/CustomButton.qml index 3973b4cd..50310b24 100644 --- a/Modules/Bar/Widgets/CustomButton.qml +++ b/Modules/Bar/Widgets/CustomButton.qml @@ -11,8 +11,7 @@ import qs.Modules.Bar.Extras Item { id: root - // Widget properties passed from Bar.qml - property var screen + property ShellScreen screen property real scaling: 1.0 // Widget properties passed from Bar.qml for per-instance settings diff --git a/Modules/Bar/Widgets/DarkMode.qml b/Modules/Bar/Widgets/DarkMode.qml index 1333da05..b35dd236 100644 --- a/Modules/Bar/Widgets/DarkMode.qml +++ b/Modules/Bar/Widgets/DarkMode.qml @@ -6,6 +6,7 @@ import qs.Services NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 icon: "dark-mode" diff --git a/Modules/Bar/Widgets/KeepAwake.qml b/Modules/Bar/Widgets/KeepAwake.qml index 692466a4..ba09d92a 100644 --- a/Modules/Bar/Widgets/KeepAwake.qml +++ b/Modules/Bar/Widgets/KeepAwake.qml @@ -8,6 +8,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 baseSize: Style.capsuleHeight diff --git a/Modules/Bar/Widgets/NightLight.qml b/Modules/Bar/Widgets/NightLight.qml index f5ac5770..b972d37d 100644 --- a/Modules/Bar/Widgets/NightLight.qml +++ b/Modules/Bar/Widgets/NightLight.qml @@ -11,6 +11,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 compact: (Settings.data.bar.density === "compact") diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index ad9bb86b..aee73598 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -10,6 +10,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 // Widget properties passed from Bar.qml for per-instance settings diff --git a/Modules/Bar/Widgets/PowerProfile.qml b/Modules/Bar/Widgets/PowerProfile.qml index a89c4e7a..fbd2a719 100644 --- a/Modules/Bar/Widgets/PowerProfile.qml +++ b/Modules/Bar/Widgets/PowerProfile.qml @@ -9,6 +9,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 baseSize: Style.capsuleHeight diff --git a/Modules/Bar/Widgets/ScreenRecorder.qml b/Modules/Bar/Widgets/ScreenRecorder.qml index 0f2dd5fa..16b57804 100644 --- a/Modules/Bar/Widgets/ScreenRecorder.qml +++ b/Modules/Bar/Widgets/ScreenRecorder.qml @@ -7,6 +7,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 icon: "camera-video" diff --git a/Modules/Bar/Widgets/SessionMenu.qml b/Modules/Bar/Widgets/SessionMenu.qml index cb506ad3..f8f09929 100644 --- a/Modules/Bar/Widgets/SessionMenu.qml +++ b/Modules/Bar/Widgets/SessionMenu.qml @@ -8,6 +8,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 compact: (Settings.data.bar.density === "compact") diff --git a/Modules/Bar/Widgets/Spacer.qml b/Modules/Bar/Widgets/Spacer.qml index 8f1378e3..d8e4abcb 100644 --- a/Modules/Bar/Widgets/Spacer.qml +++ b/Modules/Bar/Widgets/Spacer.qml @@ -8,8 +8,7 @@ import qs.Widgets Item { id: root - // Widget properties passed from Bar.qml - property var screen + property ShellScreen screen property real scaling: 1.0 // Widget properties passed from Bar.qml for per-instance settings diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index 30a3f7b9..e24da899 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -16,10 +16,108 @@ Rectangle { property ShellScreen screen property real scaling: 1.0 + // Widget properties passed from Bar.qml for per-instance settings + property string widgetId: "" + property string section: "" + property int sectionWidgetIndex: -1 + property int sectionWidgetsCount: 0 + + property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] + property var widgetSettings: { + if (section && sectionWidgetIndex >= 0) { + var widgets = Settings.data.bar.widgets[section] + if (widgets && sectionWidgetIndex < widgets.length) { + return widgets[sectionWidgetIndex] + } + } + return {} + } + readonly property string barPosition: Settings.data.bar.position readonly property bool isVertical: barPosition === "left" || barPosition === "right" readonly property bool compact: (Settings.data.bar.density === "compact") - readonly property real itemSize: isVertical ? Math.round(width * 0.7) : Math.round(height * 0.7) + property real itemSize: Math.round(Style.capsuleHeight * 0.65 * scaling) + property list blacklist: widgetSettings.blacklist || widgetMetadata.blacklist || [] // Read from settings + property var filteredItems: [] + + function wildCardMatch(str, rule) { + if (!str || !rule) { + return false + } + Logger.log("Tray", "wildCardMatch - Input str:", str, "rule:", rule) + + // Escape all special regex characters in the rule + let escapedRule = rule.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + // Convert '*' to '.*' for wildcard matching + let pattern = escapedRule.replace(/\\\*/g, '.*') + // Add ^ and $ to match the entire string + pattern = '^' + pattern + '$' + + Logger.log("Tray", "wildCardMatch - Generated pattern:", pattern) + + try { + const regex = new RegExp(pattern, 'i') + // 'i' for case-insensitive + Logger.log("Tray", "wildCardMatch - Regex test result:", regex.test(str)) + return regex.test(str) + } catch (e) { + Logger.warn("Tray", "Invalid regex pattern for wildcard match:", rule, e.message) + return false // If regex is invalid, it won't match + } + } + + // Debounce timer for updateFilteredItems to prevent excessive calls + // when multiple events (e.g., SystemTray changes, settings saves) + // trigger it in rapid succession, reducing redundant processing. + Timer { + id: updateDebounceTimer + interval: 100 // milliseconds + running: false + repeat: false + onTriggered: _performFilteredItemsUpdate() + } + + function _performFilteredItemsUpdate() { + if (!root.blacklist || root.blacklist.length === 0) { + if (SystemTray.items && SystemTray.items.values) { + filteredItems = SystemTray.items.values + } else { + filteredItems = [] + } + return + } + + let newItems = [] + if (SystemTray.items && SystemTray.items.values) { + const trayItems = SystemTray.items.values + for (var i = 0; i < trayItems.length; i++) { + const item = trayItems[i] + if (!item) { + continue + } + + const title = item.tooltipTitle || item.name || item.id || "" + + let isBlacklisted = false + for (var j = 0; j < root.blacklist.length; j++) { + const rule = root.blacklist[j] + if (wildCardMatch(title, rule)) { + isBlacklisted = true + break + } + } + + if (!isBlacklisted) { + newItems.push(item) + } + } + } + filteredItems = newItems + } + + function updateFilteredItems() { + updateDebounceTimer.restart() + } function onLoaded() { // When the widget is fully initialized with its props set the screen for the trayMenu @@ -28,9 +126,27 @@ Rectangle { } } - visible: SystemTray.items.values.length > 0 - implicitWidth: isVertical ? Math.round(Style.capsuleHeight * scaling) : (trayFlow.implicitWidth + Style.marginS * scaling * 2) - implicitHeight: isVertical ? (trayFlow.implicitHeight + Style.marginS * scaling * 2) : Math.round(Style.capsuleHeight * scaling) + Connections { + target: SystemTray.items + function onValuesChanged() { + root.updateFilteredItems() + } + } + + Connections { + target: Settings + function onSettingsSaved() { + root.updateFilteredItems() + } + } + + Component.onCompleted: { + root.updateFilteredItems() // Initial update + } + + visible: filteredItems.length > 0 + implicitWidth: isVertical ? Math.round(Style.capsuleHeight * scaling) : (trayFlow.implicitWidth + Style.marginM * 2 * scaling) + implicitHeight: isVertical ? (trayFlow.implicitHeight + Style.marginM * 2 * scaling) : Math.round(Style.capsuleHeight * scaling) radius: Math.round(Style.radiusM * scaling) color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent @@ -44,7 +160,7 @@ Rectangle { Repeater { id: repeater - model: SystemTray.items + model: filteredItems delegate: Item { width: itemSize @@ -58,8 +174,6 @@ Rectangle { anchors.fill: parent asynchronous: true - smooth: false - mipmap: true backer.fillMode: Image.PreserveAspectFit source: { let icon = modelData?.icon || "" diff --git a/Modules/Bar/Widgets/WallpaperSelector.qml b/Modules/Bar/Widgets/WallpaperSelector.qml index 51188450..4be3e9a1 100644 --- a/Modules/Bar/Widgets/WallpaperSelector.qml +++ b/Modules/Bar/Widgets/WallpaperSelector.qml @@ -8,6 +8,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 baseSize: Style.capsuleHeight diff --git a/Modules/Bar/Widgets/WiFi.qml b/Modules/Bar/Widgets/WiFi.qml index 58a0e885..00fefab6 100644 --- a/Modules/Bar/Widgets/WiFi.qml +++ b/Modules/Bar/Widgets/WiFi.qml @@ -10,6 +10,7 @@ import qs.Widgets NIconButton { id: root + property ShellScreen screen property real scaling: 1.0 compact: (Settings.data.bar.density === "compact") diff --git a/Modules/ControlCenter/Cards/AudioCard.qml b/Modules/ControlCenter/Cards/AudioCard.qml new file mode 100644 index 00000000..efa0117a --- /dev/null +++ b/Modules/ControlCenter/Cards/AudioCard.qml @@ -0,0 +1,167 @@ +import QtQuick +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +// Audio controls card: output and input volume controls +NBox { + id: root + + property real localOutputVolume: AudioService.volume + property real localInputVolume: AudioService.inputVolume + + // Timer to debounce volume changes (similar to AudioTab) + Timer { + interval: 100 + running: true + repeat: true + onTriggered: { + if (Math.abs(localOutputVolume - AudioService.volume) >= 0.01) { + AudioService.setVolume(localOutputVolume) + } + } + } + + // Connections to update local volumes when AudioService changes + Connections { + target: AudioService.sink?.audio ? AudioService.sink?.audio : null + function onVolumeChanged() { + localOutputVolume = AudioService.volume + } + } + + Connections { + target: AudioService.source?.audio ? AudioService.source?.audio : null + function onVolumeChanged() { + localInputVolume = AudioService.inputVolume + } + } + + ColumnLayout { + anchors.fill: parent + anchors.margins: Style.marginM * scaling + spacing: Style.marginM * scaling + + // Output Volume Section + ColumnLayout { + spacing: Style.marginXXS * scaling + Layout.fillWidth: true + opacity: AudioService.sink ? 1.0 : 0.5 + enabled: AudioService.sink + + // Output Volume Header + RowLayout { + Layout.fillWidth: true + spacing: Style.marginXS * scaling + + NIconButton { + icon: AudioService.muted ? "volume-off" : "volume-high" + baseSize: Style.baseWidgetSize * 0.5 + colorFg: AudioService.muted ? Color.mError : Color.mOnSurfaceVariant + colorBg: Color.transparent + colorBgHover: Color.mTertiary + colorFgHover: Color.mOnTertiary + onClicked: { + if (AudioService.sink && AudioService.sink.audio) { + AudioService.sink.audio.muted = !AudioService.muted + } + } + } + + RowLayout { + spacing: Style.marginXXS * scaling + Layout.fillWidth: true + + NText { + text: I18n.tr("settings.audio.volumes.output-volume.label") + pointSize: Style.fontSizeXS * scaling + color: Color.mOnSurface + font.weight: Style.fontWeightMedium + } + + NText { + text: AudioService.sink ? AudioService.sink.description : "No output device" + pointSize: Style.fontSizeXS * scaling + color: Color.mOnSurfaceVariant + font.weight: Style.fontWeightMedium + elide: Text.ElideRight + Layout.fillWidth: true + } + } + } + + // Output Volume Slider + NValueSlider { + Layout.fillWidth: true + from: 0 + to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0 + value: localOutputVolume || 0 + stepSize: 0.01 + text: Math.round((AudioService.volume || 0) * 100) + "%" + textSize: Style.fontSizeXS * scaling + customHeightRatio: 0.6 + onMoved: value => localOutputVolume = value + } + } + + // Input Volume Section + ColumnLayout { + spacing: Style.marginXXS * scaling + Layout.fillWidth: true + opacity: AudioService.source ? 1.0 : 0.5 + enabled: AudioService.source + + // Input Volume Header + RowLayout { + Layout.fillWidth: true + spacing: Style.marginXS * scaling + + NIconButton { + icon: AudioService.inputMuted ? "microphone-off" : "microphone" + baseSize: Style.baseWidgetSize * 0.5 + colorFg: AudioService.inputMuted ? Color.mError : Color.mOnSurfaceVariant + colorBg: Color.transparent + colorBgHover: Color.mTertiary + colorFgHover: Color.mOnTertiary + onClicked: AudioService.setInputMuted(!AudioService.inputMuted) + } + + RowLayout { + spacing: Style.marginXXS * scaling + Layout.fillWidth: true + + NText { + text: I18n.tr("settings.audio.volumes.input-volume.label") + pointSize: Style.fontSizeXS * scaling + color: Color.mOnSurface + font.weight: Style.fontWeightMedium + } + + NText { + text: AudioService.source ? AudioService.source.description : "No input device" + pointSize: Style.fontSizeXS * scaling + color: Color.mOnSurfaceVariant + font.weight: Style.fontWeightMedium + elide: Text.ElideRight + Layout.fillWidth: true + } + } + } + + // Input Volume Slider + NValueSlider { + Layout.fillWidth: true + from: 0 + to: Settings.data.audio.volumeOverdrive ? 1.5 : 1.0 + value: AudioService.inputVolume || 0 + stepSize: 0.01 + text: Math.round((AudioService.inputVolume || 0) * 100) + "%" + textSize: Style.fontSizeXS * scaling + customHeightRatio: 0.6 + onMoved: value => AudioService.setInputVolume(value) + } + } + } +} diff --git a/Modules/ControlCenter/Cards/MediaCard.qml b/Modules/ControlCenter/Cards/MediaCard.qml index 0781b984..2b362fb0 100644 --- a/Modules/ControlCenter/Cards/MediaCard.qml +++ b/Modules/ControlCenter/Cards/MediaCard.qml @@ -84,7 +84,7 @@ NBox { anchors.fill: parent values: CavaService.values fillColor: Color.mPrimary - opacity: MediaService.trackArtUrl !== "" ? 0.4 : 0.8 + opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 } } @@ -94,7 +94,7 @@ NBox { anchors.fill: parent values: CavaService.values fillColor: Color.mPrimary - opacity: MediaService.trackArtUrl !== "" ? 0.4 : 0.8 + opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 } } @@ -104,7 +104,7 @@ NBox { anchors.fill: parent values: CavaService.values fillColor: Color.mPrimary - opacity: MediaService.trackArtUrl !== "" ? 0.4 : 0.8 + opacity: MediaService.trackArtUrl !== "" ? 0.5 : 0.8 } } } @@ -376,7 +376,7 @@ NBox { stepSize: 0 snapAlways: false enabled: MediaService.trackLength > 0 && MediaService.canSeek - heightRatio: 0.65 + heightRatio: 0.6 onMoved: { progressWrapper.localSeekRatio = value diff --git a/Modules/ControlCenter/Cards/SystemMonitorCard.qml b/Modules/ControlCenter/Cards/SystemMonitorCard.qml index 351d4c68..b0572f8a 100644 --- a/Modules/ControlCenter/Cards/SystemMonitorCard.qml +++ b/Modules/ControlCenter/Cards/SystemMonitorCard.qml @@ -9,14 +9,11 @@ import qs.Widgets NBox { id: root - GridLayout { + RowLayout { id: content anchors.fill: parent anchors.margins: Style.marginXS * scaling - columns: 2 - rows: 2 - columnSpacing: Style.marginS * scaling - rowSpacing: Style.marginS * scaling + spacing: Style.marginS * scaling NCircleStat { value: SystemStatService.cpuUsage diff --git a/Modules/ControlCenter/Cards/TopCard.qml b/Modules/ControlCenter/Cards/TopCard.qml index d68d84be..21b68eca 100644 --- a/Modules/ControlCenter/Cards/TopCard.qml +++ b/Modules/ControlCenter/Cards/TopCard.qml @@ -4,9 +4,9 @@ import QtQuick.Layouts import Quickshell import Quickshell.Io import Quickshell.Widgets -import Quickshell.Services.UPower import qs.Modules.Settings import qs.Modules.ControlCenter +import qs.Modules.ControlCenter.Extras import qs.Commons import qs.Services import qs.Widgets @@ -17,7 +17,6 @@ NBox { property string uptimeText: "--" property real spacing: Style.marginS * scaling - readonly property bool hasPP: PowerProfileService.available ColumnLayout { anchors.fill: parent @@ -32,7 +31,7 @@ NBox { NImageCircled { width: Style.baseWidgetSize * 1.25 * scaling - height: Style.baseWidgetSize * 1.25 * scaling + height: width imagePath: Settings.data.general.avatarImage fallbackIcon: "person" borderColor: Color.mPrimary @@ -53,7 +52,7 @@ NBox { text: I18n.tr("system.uptime", { "uptime": uptimeText }) - pointSize: Style.fontSizeS * scaling + pointSize: Style.fontSizeXS * scaling color: Color.mOnSurfaceVariant } } @@ -97,205 +96,33 @@ NBox { } } - RowLayout { - id: utilitiesRow - Layout.alignment: Qt.AlignVCenter - Layout.topMargin: Style.marginM * scaling - Layout.bottomMargin: Style.marginM * scaling + NDivider { Layout.fillWidth: true + Layout.topMargin: Style.marginS * scaling + Layout.bottomMargin: Style.marginS * scaling + } - // Left group - Media & Display - Rectangle { - color: Color.mSurface - radius: Style.radiusM * scaling - Layout.preferredHeight: Style.baseWidgetSize * 1.2 * scaling - Layout.preferredWidth: childrenRect.width + (Style.marginS * scaling * 2) + GridLayout { + id: grid + Layout.fillWidth: true + columns: (Settings.data.controlCenter.quickSettingsStyle === "compact") ? 4 : 3 + columnSpacing: Style.marginS * scaling + rowSpacing: Style.marginS * scaling - RowLayout { - anchors.centerIn: parent - spacing: Style.marginM * scaling - - // Screen Recorder - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - icon: "camera-video" - visible: ProgramCheckerService.gpuScreenRecorderAvailable - tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.stop-screen-recording") : I18n.tr("tooltips.start-screen-recording") - colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : Color.mSurfaceVariant - colorFg: ScreenRecorderService.isRecording ? Color.mOnPrimary : Color.mPrimary - onClicked: { - ScreenRecorderService.toggleRecording() - if (!ScreenRecorderService.isRecording) { - var panel = PanelService.getPanel("controlCenterPanel") - panel?.close() - } - } - } - - // Wallpaper - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - visible: Settings.data.wallpaper.enabled - icon: "wallpaper-selector" - tooltipText: I18n.tr("tooltips.wallpaper-selector") - onClicked: PanelService.getPanel("wallpaperPanel")?.toggle(this) - onRightClicked: WallpaperService.setRandomWallpaper() - } - - // Night Light - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - visible: ProgramCheckerService.wlsunsetAvailable - colorBg: Settings.data.nightLight.forced ? Color.mPrimary : Color.transparent - colorFg: Settings.data.nightLight.forced ? Color.mOnPrimary : Color.mPrimary - icon: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? "nightlight-forced" : "nightlight-on") : "nightlight-off" - tooltipText: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? I18n.tr("tooltips.night-light-forced") : I18n.tr("tooltips.night-light-enabled")) : I18n.tr("tooltips.night-light-disabled") - onClicked: { - if (!Settings.data.nightLight.enabled) { - Settings.data.nightLight.enabled = true - Settings.data.nightLight.forced = false - } else if (Settings.data.nightLight.enabled && !Settings.data.nightLight.forced) { - Settings.data.nightLight.forced = true - } else { - Settings.data.nightLight.enabled = false - Settings.data.nightLight.forced = false - } - } - - onRightClicked: { - var settingsPanel = PanelService.getPanel("settingsPanel") - settingsPanel.requestedTab = SettingsPanel.Tab.Display - settingsPanel.open() - } - } - } - } - - // Spacer - Item { - Layout.fillWidth: true - } - - // Center group - Network & Caffeine - Rectangle { - color: Color.mSurface - radius: Style.radiusM * scaling - Layout.preferredHeight: Style.baseWidgetSize * 1.2 * scaling - Layout.preferredWidth: childrenRect.width + (Style.marginS * scaling * 2) - - RowLayout { - anchors.centerIn: parent - spacing: Style.marginM * scaling - - // Wifi - NIconButton { - id: wifiButton - baseSize: Style.baseWidgetSize * 0.9 - tooltipText: I18n.tr("tooltips.manage-wifi") - icon: { - try { - if (NetworkService.ethernetConnected) { - return "ethernet" - } - let connected = false - let signalStrength = 0 - for (const net in NetworkService.networks) { - if (NetworkService.networks[net].connected) { - connected = true - signalStrength = NetworkService.networks[net].signal - break - } - } - return connected ? NetworkService.signalIcon(signalStrength) : "wifi-off" - } catch (error) { - Logger.error("Wi-Fi", "Error getting icon:", error) - return "signal_wifi_bad" - } - } - onClicked: PanelService.getPanel("wifiPanel")?.toggle(this) - onRightClicked: PanelService.getPanel("wifiPanel")?.toggle(this) - } - - // Bluetooth - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - tooltipText: I18n.tr("tooltips.bluetooth-devices") - icon: BluetoothService.enabled ? "bluetooth" : "bluetooth-off" - onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(this) - onRightClicked: PanelService.getPanel("bluetoothPanel")?.toggle(this) - } - - // Caffeine (Keep Awake) - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" - tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake") - colorBg: IdleInhibitorService.isInhibited ? Color.mPrimary : Color.mSurfaceVariant - colorFg: IdleInhibitorService.isInhibited ? Color.mOnPrimary : Color.mPrimary - onClicked: { - IdleInhibitorService.manualToggle() - } - } - } - } - - // Spacer - Item { - Layout.fillWidth: true - } - - // Right group - Power Profiles - Rectangle { - color: Color.mSurface - radius: Style.radiusM * scaling - Layout.preferredHeight: Style.baseWidgetSize * 1.2 * scaling - Layout.preferredWidth: childrenRect.width + (Style.marginS * scaling * 2) - - RowLayout { - anchors.centerIn: parent - spacing: Style.marginM * scaling - - // Performance - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - icon: PowerProfileService.getIcon(PowerProfile.Performance) - tooltipText: I18n.tr("tooltips.set-power-profile", { - "profile": PowerProfileService.getName(PowerProfile.Performance) - }) - enabled: hasPP - opacity: enabled ? Style.opacityFull : Style.opacityMedium - colorBg: (enabled && PowerProfileService.profile === PowerProfile.Performance) ? Color.mPrimary : Color.mSurfaceVariant - colorFg: (enabled && PowerProfileService.profile === PowerProfile.Performance) ? Color.mOnPrimary : Color.mPrimary - onClicked: PowerProfileService.setProfile(PowerProfile.Performance) - } - - // Balanced - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - icon: PowerProfileService.getIcon(PowerProfile.Balanced) - tooltipText: I18n.tr("tooltips.set-power-profile", { - "profile": PowerProfileService.getName(PowerProfile.Balanced) - }) - enabled: hasPP - opacity: enabled ? Style.opacityFull : Style.opacityMedium - colorBg: (enabled && PowerProfileService.profile === PowerProfile.Balanced) ? Color.mPrimary : Color.mSurfaceVariant - colorFg: (enabled && PowerProfileService.profile === PowerProfile.Balanced) ? Color.mOnPrimary : Color.mPrimary - onClicked: PowerProfileService.setProfile(PowerProfile.Balanced) - } - - // Eco - NIconButton { - baseSize: Style.baseWidgetSize * 0.9 - icon: PowerProfileService.getIcon(PowerProfile.PowerSaver) - tooltipText: I18n.tr("tooltips.set-power-profile", { - "profile": PowerProfileService.getName(PowerProfile.PowerSaver) - }) - enabled: hasPP - opacity: enabled ? Style.opacityFull : Style.opacityMedium - colorBg: (enabled && PowerProfileService.profile === PowerProfile.PowerSaver) ? Color.mPrimary : Color.mSurfaceVariant - colorFg: (enabled && PowerProfileService.profile === PowerProfile.PowerSaver) ? Color.mOnPrimary : Color.mPrimary - onClicked: PowerProfileService.setProfile(PowerProfile.PowerSaver) + Repeater { + model: Settings.data.controlCenter.widgets.quickSettings + delegate: ControlCenterWidgetLoader { + Layout.fillWidth: true + widgetId: (modelData.id !== undefined ? modelData.id : "") + widgetProps: { + "screen": root.modelData || null, + "scaling": ScalingService.getScreenScale(screen), + "widgetId": modelData.id, + "section": "quickSettings", + "sectionWidgetIndex": index, + "sectionWidgetsCount": Settings.data.controlCenter.widgets.quickSettings.length } + Layout.alignment: Qt.AlignVCenter } } } diff --git a/Modules/ControlCenter/Cards/WeatherCard.qml b/Modules/ControlCenter/Cards/WeatherCard.qml deleted file mode 100644 index d9e8510a..00000000 --- a/Modules/ControlCenter/Cards/WeatherCard.qml +++ /dev/null @@ -1,130 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import Quickshell -import qs.Commons -import qs.Services -import qs.Widgets - -// Weather overview card (placeholder data) -NBox { - id: root - - readonly property bool weatherReady: (LocationService.data.weather !== null) - - ColumnLayout { - id: content - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: Style.marginM * scaling - spacing: Style.marginM * scaling - clip: true - - RowLayout { - spacing: Style.marginS * scaling - NIcon { - Layout.alignment: Qt.AlignVCenter - icon: weatherReady ? LocationService.weatherSymbolFromCode(LocationService.data.weather.current_weather.weathercode) : "" - pointSize: Style.fontSizeXXXL * 1.75 * scaling - color: Color.mPrimary - } - - ColumnLayout { - spacing: Style.marginXXS * scaling - NText { - text: { - // Ensure the name is not too long if one had to specify the country - const chunks = Settings.data.location.name.split(",") - return chunks[0] - } - pointSize: Style.fontSizeL * scaling - font.weight: Style.fontWeightBold - } - - RowLayout { - NText { - visible: weatherReady - text: { - if (!weatherReady) { - return "" - } - var temp = LocationService.data.weather.current_weather.temperature - var suffix = "C" - if (Settings.data.location.useFahrenheit) { - temp = LocationService.celsiusToFahrenheit(temp) - var suffix = "F" - } - temp = Math.round(temp) - return `${temp}°${suffix}` - } - pointSize: Style.fontSizeXL * scaling - font.weight: Style.fontWeightBold - } - - NText { - text: weatherReady ? `(${LocationService.data.weather.timezone_abbreviation})` : "" - pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - visible: LocationService.data.weather - } - } - } - } - - NDivider { - visible: weatherReady - Layout.fillWidth: true - } - - RowLayout { - visible: weatherReady - Layout.fillWidth: true - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - spacing: Style.marginL * scaling - Repeater { - model: weatherReady ? LocationService.data.weather.daily.time : [] - delegate: ColumnLayout { - Layout.alignment: Qt.AlignHCenter - spacing: Style.marginS * scaling - NText { - text: { - var weatherDate = new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/")) - return Qt.locale().toString(weatherDate, "ddd") - } - color: Color.mOnSurface - Layout.alignment: Qt.AlignHCenter - } - NIcon { - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - icon: LocationService.weatherSymbolFromCode(LocationService.data.weather.daily.weathercode[index]) - pointSize: Style.fontSizeXXL * 1.6 * scaling - color: Color.mPrimary - } - NText { - Layout.alignment: Qt.AlignHCenter - text: { - var max = LocationService.data.weather.daily.temperature_2m_max[index] - var min = LocationService.data.weather.daily.temperature_2m_min[index] - if (Settings.data.location.useFahrenheit) { - max = LocationService.celsiusToFahrenheit(max) - min = LocationService.celsiusToFahrenheit(min) - } - max = Math.round(max) - min = Math.round(min) - return `${max}°/${min}°` - } - pointSize: Style.fontSizeXS * scaling - color: Color.mOnSurfaceVariant - } - } - } - } - - RowLayout { - visible: !weatherReady - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - NBusyIndicator {} - } - } -} diff --git a/Modules/ControlCenter/ControlCenterPanel.qml b/Modules/ControlCenter/ControlCenterPanel.qml index c2290cc0..2d5ba9bf 100644 --- a/Modules/ControlCenter/ControlCenterPanel.qml +++ b/Modules/ControlCenter/ControlCenterPanel.qml @@ -10,10 +10,29 @@ import qs.Widgets NPanel { id: root - preferredWidth: 480 - preferredHeight: 580 + preferredWidth: 400 + preferredHeight: topHeight + midHeight + bottomHeight + audioHeight + Math.round(Style.marginL * 5) panelKeyboardFocus: true + readonly property int topHeight: { + const columns = (Settings.data.controlCenter.quickSettingsStyle === "compact") ? 4 : 3 + const rowsCount = Math.ceil(Settings.data.controlCenter.widgets.quickSettings.length / columns) + + var buttonHeight + if (Settings.data.controlCenter.quickSettingsStyle === "classic") { + buttonHeight = Style.baseWidgetSize + } else if (Settings.data.controlCenter.quickSettingsStyle === "compact") { + buttonHeight = Style.baseWidgetSize * 0.8 // Smaller for compact + } else { + buttonHeight = 56 + } + + return (rowsCount * buttonHeight) + 120 + } + readonly property int midHeight: 220 + readonly property int bottomHeight: 80 + readonly property int audioHeight: 120 + // Positioning readonly property string controlCenterPosition: Settings.data.controlCenter.position panelAnchorHorizontalCenter: controlCenterPosition !== "close_to_bar_button" && controlCenterPosition.endsWith("_center") @@ -37,33 +56,27 @@ NPanel { // Top Card: profile + utilities TopCard { + id: topCard Layout.fillWidth: true - Layout.preferredHeight: Math.max(124 * scaling) + Layout.preferredHeight: topHeight * scaling } - // Weather - WeatherCard { + // Audio controls card + AudioCard { Layout.fillWidth: true - Layout.preferredHeight: Math.max(196 * scaling) + Layout.preferredHeight: audioHeight * scaling } - // Media + stats column - RowLayout { + // Media card + MediaCard { Layout.fillWidth: true - Layout.preferredHeight: Math.max(196 * scaling) - spacing: content.cardSpacing + Layout.preferredHeight: midHeight * scaling + } - // Media card - MediaCard { - Layout.preferredWidth: Math.max(270 * scaling) - Layout.fillHeight: true - } - - // System monitors combined in one card - SystemMonitorCard { - Layout.preferredWidth: Math.max(160 * scaling) - Layout.preferredHeight: Math.max(196 * scaling) - } + // System monitors combined in one card + SystemMonitorCard { + Layout.fillWidth: true + Layout.preferredHeight: bottomHeight * scaling } } } diff --git a/Modules/ControlCenter/Extras/ControlCenterWidgetLoader.qml b/Modules/ControlCenter/Extras/ControlCenterWidgetLoader.qml new file mode 100644 index 00000000..4e7577ee --- /dev/null +++ b/Modules/ControlCenter/Extras/ControlCenterWidgetLoader.qml @@ -0,0 +1,74 @@ +import QtQuick +import Quickshell +import qs.Services +import qs.Commons + +Item { + id: root + + property string widgetId: "" + property var widgetProps: ({}) + property string screenName: widgetProps && widgetProps.screen ? widgetProps.screen.name : "" + property string section: widgetProps && widgetProps.section || "" + property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0 + + // Don't reserve space unless the loaded widget is really visible + implicitWidth: getImplicitSize(loader.item, "implicitWidth") + implicitHeight: getImplicitSize(loader.item, "implicitHeight") + + Connections { + target: ScalingService + enabled: loader.item && (loader.item.screen !== undefined) + function onScaleChanged(aScreenName, scale) { + if (loader.item && loader.item.screen && aScreenName === screenName) { + loader.item['scaling'] = scale + } + } + } + + function getImplicitSize(item, prop) { + return (item && item.visible) ? item[prop] : 0 + } + + Loader { + id: loader + anchors.fill: parent + active: widgetId !== "" + asynchronous: false + sourceComponent: { + if (!active) { + return null + } + return ControlCenterWidgetRegistry.getWidget(widgetId) + } + + onLoaded: { + if (item && widgetProps) { + // Apply properties to loaded widget + for (var prop in widgetProps) { + if (item.hasOwnProperty(prop)) { + item[prop] = widgetProps[prop] + } + } + } + + if (item.hasOwnProperty("onLoaded")) { + item.onLoaded() + } + + //Logger.log("ControlCenterWidgetLoader", "Loaded", widgetId, "on screen", item.screen.name) + } + + Component.onDestruction: { + // Explicitly clear references + widgetProps = null + } + } + + // Error handling + onWidgetIdChanged: { + if (widgetId && !ControlCenterWidgetRegistry.hasWidget(widgetId)) { + Logger.warn("ControlCenterWidgetLoader", "Widget not found in registry:", widgetId) + } + } +} diff --git a/Modules/ControlCenter/Widgets/Bluetooth.qml b/Modules/ControlCenter/Widgets/Bluetooth.qml new file mode 100644 index 00000000..e9886a4f --- /dev/null +++ b/Modules/ControlCenter/Widgets/Bluetooth.qml @@ -0,0 +1,16 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + text: I18n.tr("quickSettings.bluetooth.label.enabled") + icon: BluetoothService.enabled ? "bluetooth" : "bluetooth-off" + tooltipText: I18n.tr("quickSettings.bluetooth.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + onClicked: PanelService.getPanel("bluetoothPanel")?.toggle(this) +} diff --git a/Modules/ControlCenter/Widgets/KeepAwake.qml b/Modules/ControlCenter/Widgets/KeepAwake.qml new file mode 100644 index 00000000..044734e4 --- /dev/null +++ b/Modules/ControlCenter/Widgets/KeepAwake.qml @@ -0,0 +1,18 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + text: I18n.tr("quickSettings.keepAwake.label.enabled") + icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" + hot: IdleInhibitorService.isInhibited + tooltipText: I18n.tr("quickSettings.keepAwake.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + + onClicked: IdleInhibitorService.manualToggle() +} diff --git a/Modules/ControlCenter/Widgets/NightLight.qml b/Modules/ControlCenter/Widgets/NightLight.qml new file mode 100644 index 00000000..19cdd669 --- /dev/null +++ b/Modules/ControlCenter/Widgets/NightLight.qml @@ -0,0 +1,35 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + enabled: ProgramCheckerService.wlsunsetAvailable + text: I18n.tr("quickSettings.nightLight.label.enabled") + icon: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? "nightlight-forced" : "nightlight-on") : "nightlight-off" + hot: !Settings.data.nightLight.enabled || Settings.data.nightLight.forced + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + tooltipText: I18n.tr("quickSettings.nightLight.tooltip.action") + + onClicked: { + if (!Settings.data.nightLight.enabled) { + Settings.data.nightLight.enabled = true + Settings.data.nightLight.forced = false + } else if (Settings.data.nightLight.enabled && !Settings.data.nightLight.forced) { + Settings.data.nightLight.forced = true + } else { + Settings.data.nightLight.enabled = false + Settings.data.nightLight.forced = false + } + } + + onRightClicked: { + var settingsPanel = PanelService.getPanel("settingsPanel") + settingsPanel.requestedTab = SettingsPanel.Tab.Display + settingsPanel.open() + } +} diff --git a/Modules/ControlCenter/Widgets/Notifications.qml b/Modules/ControlCenter/Widgets/Notifications.qml new file mode 100644 index 00000000..19c22a82 --- /dev/null +++ b/Modules/ControlCenter/Widgets/Notifications.qml @@ -0,0 +1,19 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + text: Settings.data.notifications.doNotDisturb ? I18n.tr("quickSettings.notifications.label.disabled") : I18n.tr("quickSettings.notifications.label.enabled") + icon: Settings.data.notifications.doNotDisturb ? "bell-off" : "bell" + hot: Settings.data.notifications.doNotDisturb + tooltipText: I18n.tr("quickSettings.notifications.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + + onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(this) + onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb +} diff --git a/Modules/ControlCenter/Widgets/PowerProfile.qml b/Modules/ControlCenter/Widgets/PowerProfile.qml new file mode 100644 index 00000000..1a504963 --- /dev/null +++ b/Modules/ControlCenter/Widgets/PowerProfile.qml @@ -0,0 +1,24 @@ +import QtQuick.Layouts +import Quickshell +import Quickshell.Services.UPower +import qs.Commons +import qs.Services +import qs.Widgets + +// Performance +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + readonly property bool hasPP: PowerProfileService.available + + enabled: hasPP + text: hasPP ? PowerProfileService.getName() : I18n.tr("quickSettings.powerProfile.label.unavailable") + icon: PowerProfileService.getIcon() + hot: !PowerProfileService.isDefault() + tooltipText: I18n.tr("quickSettings.powerProfile.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + + onClicked: { + PowerProfileService.cycleProfile() + } +} diff --git a/Modules/ControlCenter/Widgets/ScreenRecorder.qml b/Modules/ControlCenter/Widgets/ScreenRecorder.qml new file mode 100644 index 00000000..f9ad8786 --- /dev/null +++ b/Modules/ControlCenter/Widgets/ScreenRecorder.qml @@ -0,0 +1,29 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + enabled: ProgramCheckerService.gpuScreenRecorderAvailable + icon: "camera-video" + text: ScreenRecorderService.isRecording ? I18n.tr("quickSettings.screenRecorder.label.recording") : I18n.tr("quickSettings.screenRecorder.label.stopped") + hot: ScreenRecorderService.isRecording + tooltipText: I18n.tr("quickSettings.screenRecorder.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + + // Force hover state when recording to get hover colors + property bool originalHovered: hovered + hovered: ScreenRecorderService.isRecording || originalHovered + + onClicked: { + ScreenRecorderService.toggleRecording() + if (!ScreenRecorderService.isRecording) { + var panel = PanelService.getPanel("controlCenterPanel") + panel?.close() + } + } +} diff --git a/Modules/ControlCenter/Widgets/WallpaperSelector.qml b/Modules/ControlCenter/Widgets/WallpaperSelector.qml new file mode 100644 index 00000000..95a50af3 --- /dev/null +++ b/Modules/ControlCenter/Widgets/WallpaperSelector.qml @@ -0,0 +1,19 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + enabled: Settings.data.wallpaper.enabled + icon: "wallpaper-selector" + text: I18n.tr("quickSettings.wallpaperSelector.label") + tooltipText: I18n.tr("quickSettings.wallpaperSelector.tooltip.action") + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + + onClicked: PanelService.getPanel("wallpaperPanel")?.toggle(this) + onRightClicked: WallpaperService.setRandomWallpaper() +} diff --git a/Modules/ControlCenter/Widgets/WiFi.qml b/Modules/ControlCenter/Widgets/WiFi.qml new file mode 100644 index 00000000..7f739866 --- /dev/null +++ b/Modules/ControlCenter/Widgets/WiFi.qml @@ -0,0 +1,49 @@ +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets + +NQuickSetting { + property ShellScreen screen + property real scaling: 1.0 + + icon: { + try { + if (NetworkService.ethernetConnected) { + return "ethernet" + } + let connected = false + let signalStrength = 0 + for (const net in NetworkService.networks) { + if (NetworkService.networks[net].connected) { + connected = true + signalStrength = NetworkService.networks[net].signal + break + } + } + return connected ? NetworkService.signalIcon(signalStrength) : "wifi-off" + } catch (error) { + Logger.error("Wi-Fi", "Error getting icon:", error) + return "signal_wifi_bad" + } + } + + text: { + if (NetworkService.ethernetConnected) { + return I18n.tr("quickSettings.wifi.label.ethernet") + } + let connected = false + for (const net in NetworkService.networks) { + if (NetworkService.networks[net].connected) { + connected = true + break + } + } + return connected ? I18n.tr("quickSettings.wifi.label.wifi") : I18n.tr("quickSettings.wifi.label.disconnected") + } + + style: Settings.data.controlCenter.quickSettingsStyle || "modern" + tooltipText: I18n.tr("quickSettings.wifi.tooltip.action") + onClicked: PanelService.getPanel("wifiPanel")?.toggle(this) +} diff --git a/Modules/OSD/OSD.qml b/Modules/OSD/OSD.qml index 91c551a8..a4ec5701 100644 --- a/Modules/OSD/OSD.qml +++ b/Modules/OSD/OSD.qml @@ -25,7 +25,7 @@ Variants { active: false // Current OSD display state - property string currentOSDType: "" // "volume", "brightness", or "" + property string currentOSDType: "" // "volume", "inputVolume", "brightness", or "" // Volume properties readonly property real currentVolume: AudioService.volume @@ -33,6 +33,12 @@ Variants { property bool volumeInitialized: false property bool muteInitialized: false + // Input volume properties + readonly property real currentInputVolume: AudioService.inputVolume + readonly property bool isInputMuted: AudioService.inputMuted + property bool inputVolumeInitialized: false + property bool inputMuteInitialized: false + // Brightness properties property bool brightnessInitialized: false readonly property real currentBrightness: { @@ -49,6 +55,11 @@ Variants { return "volume-mute" } return (AudioService.volume <= Number.EPSILON) ? "volume-zero" : (AudioService.volume <= 0.5) ? "volume-low" : "volume-high" + } else if (currentOSDType === "inputVolume") { + if (AudioService.inputMuted) { + return "microphone-off" + } + return "microphone" } else if (currentOSDType === "brightness") { return currentBrightness <= 0.5 ? "brightness-low" : "brightness-high" } @@ -59,6 +70,8 @@ Variants { function getCurrentValue() { if (currentOSDType === "volume") { return isMuted ? 0 : currentVolume + } else if (currentOSDType === "inputVolume") { + return isInputMuted ? 0 : currentInputVolume } else if (currentOSDType === "brightness") { return currentBrightness } @@ -72,6 +85,11 @@ Variants { return "0%" const pct = Math.round(Math.min(1.0, currentVolume) * 100) return pct + "%" + } else if (currentOSDType === "inputVolume") { + if (isInputMuted) + return "0%" + const pct = Math.round(Math.min(1.0, currentInputVolume) * 100) + return pct + "%" } else if (currentOSDType === "brightness") { const pct = Math.round(Math.min(1.0, currentBrightness) * 100) return pct + "%" @@ -85,13 +103,17 @@ Variants { if (isMuted) return Color.mError return Color.mPrimary + } else if (currentOSDType === "inputVolume") { + if (isInputMuted) + return Color.mError + return Color.mPrimary } return Color.mPrimary } // Get icon color function getIconColor() { - if (currentOSDType === "volume" && isMuted) { + if ((currentOSDType === "volume" && isMuted) || (currentOSDType === "inputVolume" && isInputMuted)) { return Color.mError } return Color.mOnSurface @@ -467,6 +489,18 @@ Variants { showOSD("volume") } } + + function onInputVolumeChanged() { + if (inputVolumeInitialized) { + showOSD("inputVolume") + } + } + + function onInputMutedChanged() { + if (inputMuteInitialized) { + showOSD("inputVolume") + } + } } // Timer to initialize volume/mute flags after services are ready @@ -477,6 +511,8 @@ Variants { onTriggered: { volumeInitialized = true muteInitialized = true + inputVolumeInitialized = true + inputMuteInitialized = true } } diff --git a/Modules/Settings/Bar/BarWidgetSettingsDialog.qml b/Modules/Settings/Bar/BarWidgetSettingsDialog.qml index 1c2a1aaf..363a7e63 100644 --- a/Modules/Settings/Bar/BarWidgetSettingsDialog.qml +++ b/Modules/Settings/Bar/BarWidgetSettingsDialog.qml @@ -69,7 +69,7 @@ Popup { NIconButton { icon: "close" - tooltipText: "Close" + tooltipText: I18n.tr("tooltips.close") onClicked: widgetSettings.close() } } @@ -134,7 +134,8 @@ Popup { "SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml", "Volume": "WidgetSettings/VolumeSettings.qml", "Workspace": "WidgetSettings/WorkspaceSettings.qml", - "Taskbar": "WidgetSettings/TaskbarSettings.qml" + "Taskbar": "WidgetSettings/TaskbarSettings.qml", + "Tray": "WidgetSettings/TraySettings.qml" } const source = widgetSettingsMap[widgetId] diff --git a/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml b/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml index 98df4c3f..c80dd09f 100644 --- a/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml +++ b/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml @@ -21,7 +21,6 @@ ColumnLayout { var settings = Object.assign({}, widgetData || {}) settings.onlySameOutput = valueOnlySameOutput settings.onlyActiveWorkspaces = valueOnlyActiveWorkspaces - console.log(JSON.stringify(settings)) return settings } diff --git a/Modules/Settings/Bar/WidgetSettings/TraySettings.qml b/Modules/Settings/Bar/WidgetSettings/TraySettings.qml new file mode 100644 index 00000000..25d08bce --- /dev/null +++ b/Modules/Settings/Bar/WidgetSettings/TraySettings.qml @@ -0,0 +1,140 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import qs.Commons +import qs.Widgets + +ColumnLayout { + // Properties to receive data from parent + property var widgetData: ({}) // Expected by BarWidgetSettingsDialog + property var widgetMetadata: ({}) // Expected by BarWidgetSettingsDialog + + // Local state for the blacklist + property var localBlacklist: widgetData.blacklist || [] + + ListModel { + id: blacklistModel + } + + Component.onCompleted: { + // Populate the ListModel from localBlacklist + for (var i = 0; i < localBlacklist.length; i++) { + blacklistModel.append({ + "rule": localBlacklist[i] + }) + } + } + + spacing: Style.marginM * scaling + + ColumnLayout { + Layout.fillWidth: true + spacing: Style.marginS * scaling + + NLabel { + label: I18n.tr("settings.bar.tray.blacklist.label") + description: I18n.tr("settings.bar.tray.blacklist.description") + } + + RowLayout { + Layout.fillWidth: true + spacing: Style.marginS * scaling + + NTextInput { + id: newRuleInput + Layout.fillWidth: true + placeholderText: I18n.tr("settings.bar.tray.blacklist.placeholder") + } + + NIconButton { + Layout.alignment: Qt.AlignVCenter + icon: "add" + baseSize: Style.baseWidgetSize * 0.8 * scaling + onClicked: { + if (newRuleInput.text.length > 0) { + var newRule = newRuleInput.text.trim() + var exists = false + for (var i = 0; i < blacklistModel.count; i++) { + if (blacklistModel.get(i).rule === newRule) { + exists = true + break + } + } + if (!exists) { + blacklistModel.append({ + "rule": newRule + }) + newRuleInput.text = "" + } + } + } + enabled: newRuleInput.text.length > 0 + } + } + } + + // List of current blacklist items + ListView { + Layout.fillWidth: true + Layout.preferredHeight: 150 * scaling + Layout.topMargin: Style.marginL * scaling // Increased top margin + clip: true + model: blacklistModel + delegate: Item { + width: ListView.width + height: 40 * scaling + + Rectangle { + id: itemBackground + anchors.fill: parent + anchors.margins: Style.marginXS * scaling + color: Color.transparent // Make background transparent + border.color: Color.mOutline + border.width: Math.max(1, Style.borderS * scaling) + radius: Style.radiusS * scaling + visible: model.rule !== undefined && model.rule !== "" // Only visible if rule exists + } + + Row { + anchors.fill: parent + anchors.leftMargin: Style.marginS * scaling + anchors.rightMargin: Style.marginS * scaling + spacing: Style.marginS * scaling + + NText { + text: model.rule + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true + } + + NIconButton { + width: 16 * scaling + height: 16 * scaling + icon: "close" + baseSize: 8 * scaling + colorBg: Color.mSurfaceVariant + colorFg: Color.mOnSurface + colorBgHover: Color.mError + colorFgHover: Color.mOnError + onClicked: { + blacklistModel.remove(index) + } + } + } + } + } + + // This function will be called by the dialog to get the new settings + function saveSettings() { + var newBlacklist = [] + for (var i = 0; i < blacklistModel.count; i++) { + newBlacklist.push(blacklistModel.get(i).rule) + } + + // Return the updated settings for this widget instance + var settings = Object.assign({}, widgetData || {}) + settings.blacklist = newBlacklist + return settings + } +} diff --git a/Modules/Settings/Bar/BarSectionEditor.qml b/Modules/Settings/Extras/SectionEditor.qml similarity index 96% rename from Modules/Settings/Bar/BarSectionEditor.qml rename to Modules/Settings/Extras/SectionEditor.qml index a36a1b17..af5a8380 100644 --- a/Modules/Settings/Bar/BarSectionEditor.qml +++ b/Modules/Settings/Extras/SectionEditor.qml @@ -13,6 +13,10 @@ NBox { property string sectionId: "" property var widgetModel: [] property var availableWidgets: [] + property bool enableMoveBetweenSections: true + + property var widgetRegistry: null + property string settingsDialogComponent: "BarWidgetSettingsDialog.qml" readonly property real miniButtonSize: Style.baseWidgetSize * 0.65 @@ -154,7 +158,7 @@ NBox { // Store the widget index for drag operations property int widgetIndex: index readonly property int buttonsWidth: Math.round(20 * scaling) - readonly property int buttonsCount: 1 + BarWidgetRegistry.widgetHasUserSettings(modelData.id) + readonly property int buttonsCount: 1 + (root.widgetRegistry ? root.widgetRegistry.widgetHasUserSettings(modelData.id) : 0) // Visual feedback during drag opacity: flowDragArea.draggedIndex === index ? 0.5 : 1.0 @@ -197,9 +201,10 @@ NBox { onTriggered: action => root.moveWidget(root.sectionId, index, action) } - // Update the MouseArea to use the new context menu + // MouseArea for the context menu MouseArea { id: contextMouseArea + enabled: enableMoveBetweenSections anchors.fill: parent acceptedButtons: Qt.RightButton z: -1 // Below the buttons but above background @@ -209,9 +214,7 @@ NBox { // Check if click is not on the buttons area const localX = mouse.x const buttonsStartX = parent.width - (parent.buttonsCount * parent.buttonsWidth) - if (localX < buttonsStartX) { - // Use the helper function to open at mouse position contextMenu.openAtItem(widgetItem, mouse.x, mouse.y) } } @@ -236,7 +239,7 @@ NBox { Layout.preferredWidth: buttonsCount * buttonsWidth Loader { - active: BarWidgetRegistry.widgetHasUserSettings(modelData.id) + active: root.widgetRegistry && root.widgetRegistry.widgetHasUserSettings(modelData.id) sourceComponent: NIconButton { icon: "settings" tooltipText: I18n.tr("tooltips.widget-settings") @@ -247,7 +250,7 @@ NBox { colorBgHover: Qt.alpha(Color.mOnPrimary, Style.opacityLight) colorFgHover: Color.mOnPrimary onClicked: { - var component = Qt.createComponent(Qt.resolvedUrl("BarWidgetSettingsDialog.qml")) + var component = Qt.createComponent(Qt.resolvedUrl(root.settingsDialogComponent)) function instantiateAndOpen() { var dialog = component.createObject(root, { "widgetIndex": index, @@ -258,19 +261,19 @@ NBox { if (dialog) { dialog.open() } else { - Logger.error("BarSectionEditor", "Failed to create settings dialog instance") + Logger.error("WidgetSectionEditor", "Failed to create settings dialog instance") } } if (component.status === Component.Ready) { instantiateAndOpen() } else if (component.status === Component.Error) { - Logger.error("BarSectionEditor", component.errorString()) + Logger.error("WidgetSectionEditor", component.errorString()) } else { component.statusChanged.connect(function () { if (component.status === Component.Ready) { instantiateAndOpen() } else if (component.status === Component.Error) { - Logger.error("BarSectionEditor", component.errorString()) + Logger.error("WidgetSectionEditor", component.errorString()) } }) } diff --git a/Modules/Settings/SettingsPanel.qml b/Modules/Settings/SettingsPanel.qml index d13f5e9e..cb76dff4 100644 --- a/Modules/Settings/SettingsPanel.qml +++ b/Modules/Settings/SettingsPanel.qml @@ -29,6 +29,7 @@ NPanel { Audio, Bar, ColorScheme, + ControlCenter, OSD, Display, Dock, @@ -111,6 +112,10 @@ NPanel { id: notificationsTab NotificationsTab {} } + Component { + id: controlCenterTab + ControlCenterTab {} + } // Order *DOES* matter function updateTabsModel() { @@ -124,6 +129,11 @@ NPanel { "label": "settings.bar.title", "icon": "settings-bar", "source": barTab + }, { + "id": SettingsPanel.Tab.ControlCenter, + "label": "settings.control-center.title", + "icon": "settings-bar", + "source": controlCenterTab }, { "id": SettingsPanel.Tab.Dock, "label": "settings.dock.title", diff --git a/Modules/Settings/Tabs/BarTab.qml b/Modules/Settings/Tabs/BarTab.qml index 31405f5c..fff686ca 100644 --- a/Modules/Settings/Tabs/BarTab.qml +++ b/Modules/Settings/Tabs/BarTab.qml @@ -5,7 +5,7 @@ import Quickshell import qs.Commons import qs.Services import qs.Widgets -import qs.Modules.Settings.Bar +import qs.Modules.Settings.Extras ColumnLayout { id: root @@ -201,9 +201,11 @@ ColumnLayout { spacing: Style.marginM * scaling // Left Section - BarSectionEditor { + SectionEditor { sectionName: "Left" sectionId: "left" + settingsDialogComponent: Qt.resolvedUrl(Quickshell.shellDir + "/Modules/Settings/Bar/BarWidgetSettingsDialog.qml") + widgetRegistry: BarWidgetRegistry widgetModel: Settings.data.bar.widgets.left availableWidgets: availableWidgets onAddWidget: (widgetId, section) => _addWidgetToSection(widgetId, section) @@ -216,9 +218,11 @@ ColumnLayout { } // Center Section - BarSectionEditor { + SectionEditor { sectionName: "Center" sectionId: "center" + settingsDialogComponent: Qt.resolvedUrl(Quickshell.shellDir + "/Modules/Settings/Bar/BarWidgetSettingsDialog.qml") + widgetRegistry: BarWidgetRegistry widgetModel: Settings.data.bar.widgets.center availableWidgets: availableWidgets onAddWidget: (widgetId, section) => _addWidgetToSection(widgetId, section) @@ -231,9 +235,11 @@ ColumnLayout { } // Right Section - BarSectionEditor { + SectionEditor { sectionName: "Right" sectionId: "right" + settingsDialogComponent: Qt.resolvedUrl(Quickshell.shellDir + "/Modules/Settings/Bar/BarWidgetSettingsDialog.qml") + widgetRegistry: BarWidgetRegistry widgetModel: Settings.data.bar.widgets.right availableWidgets: availableWidgets onAddWidget: (widgetId, section) => _addWidgetToSection(widgetId, section) diff --git a/Modules/Settings/Tabs/ColorSchemeTab.qml b/Modules/Settings/Tabs/ColorSchemeTab.qml index d58ba683..43e05da1 100644 --- a/Modules/Settings/Tabs/ColorSchemeTab.qml +++ b/Modules/Settings/Tabs/ColorSchemeTab.qml @@ -506,22 +506,29 @@ ColumnLayout { } } - NCheckbox { - label: "Vesktop" - description: ProgramCheckerService.vesktopAvailable ? I18n.tr("settings.color-scheme.templates.programs.vesktop.description", { - "filepath": "~/.config/vesktop/themes/noctalia.theme.css" - }) : I18n.tr("settings.color-scheme.templates.programs.vesktop.description-missing", { - "app": "vesktop" - }) - checked: Settings.data.templates.vesktop - enabled: ProgramCheckerService.vesktopAvailable - opacity: ProgramCheckerService.vesktopAvailable ? 1.0 : 0.6 - onToggled: checked => { - if (ProgramCheckerService.vesktopAvailable) { - Settings.data.templates.vesktop = checked + // Show individual checkboxes for each detected Discord client + Repeater { + model: ProgramCheckerService.availableDiscordClients + delegate: NCheckbox { + label: modelData.name.charAt(0).toUpperCase() + modelData.name.slice(1) + description: I18n.tr("settings.color-scheme.templates.programs.discord.description", { + "client": modelData.name.charAt(0).toUpperCase() + modelData.name.slice(1), + "filepath": modelData.themePath + }) + checked: Settings.data.templates["discord_" + modelData.name] || false + onToggled: checked => { + Settings.data.templates["discord_" + modelData.name] = checked AppThemeService.generate() } - } + } + } + + // Show message if no Discord clients detected + NText { + visible: ProgramCheckerService.availableDiscordClients.length === 0 + text: I18n.tr("settings.color-scheme.templates.programs.discord.description-missing") + color: Color.mOnSurfaceVariant + pointSize: Style.fontSizeS * scaling } NCheckbox { diff --git a/Modules/Settings/Tabs/ControlCenterTab.qml b/Modules/Settings/Tabs/ControlCenterTab.qml new file mode 100644 index 00000000..a880334c --- /dev/null +++ b/Modules/Settings/Tabs/ControlCenterTab.qml @@ -0,0 +1,178 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell +import qs.Commons +import qs.Services +import qs.Widgets +import qs.Modules.Settings.Extras + +ColumnLayout { + id: root + spacing: Style.marginL * scaling + + // Handler for drag start - disables panel background clicks + function handleDragStart() { + var panel = PanelService.getPanel("settingsPanel") + if (panel && panel.disableBackgroundClick) { + panel.disableBackgroundClick() + } + } + + // Handler for drag end - re-enables panel background clicks + function handleDragEnd() { + var panel = PanelService.getPanel("settingsPanel") + if (panel && panel.enableBackgroundClick) { + panel.enableBackgroundClick() + } + } + + // Quick Settings Style Section + ColumnLayout { + spacing: Style.marginL * scaling + Layout.fillWidth: true + + NHeader { + label: I18n.tr("settings.control-center.quickSettingsStyle.section.label") + description: I18n.tr("settings.control-center.quickSettingsStyle.section.description") + } + + NComboBox { + id: quickSettingsStyle + label: I18n.tr("settings.control-center.quickSettingsStyle.style.label") + description: I18n.tr("settings.control-center.quickSettingsStyle.style.description") + Layout.fillWidth: true + model: [{ + "key": "compact", + "name": I18n.tr("options.control-center.quickSettingsStyle.compact") + }, { + "key": "classic", + "name": I18n.tr("options.control-center.quickSettingsStyle.classic") + }, { + "key": "modern", + "name": I18n.tr("options.control-center.quickSettingsStyle.modern") + }] + currentKey: Settings.data.controlCenter.quickSettingsStyle || "compact" + onSelected: function (key) { + Settings.data.controlCenter.quickSettingsStyle = key + } + } + } + + NDivider { + Layout.fillWidth: true + Layout.topMargin: Style.marginXL * scaling + Layout.bottomMargin: Style.marginXL * scaling + } + + // Widgets Management Section + ColumnLayout { + spacing: Style.marginXXS * scaling + Layout.fillWidth: true + + NHeader { + label: I18n.tr("settings.control-center.widgets.section.label") + description: I18n.tr("settings.control-center.widgets.section.description") + } + + // Bar Sections + ColumnLayout { + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: Style.marginM * scaling + spacing: Style.marginM * scaling + + // Quick Settings + SectionEditor { + sectionName: I18n.tr("settings.control-center.quickSettings.sectionName") + sectionId: "quickSettings" + settingsDialogComponent: "" + widgetRegistry: ControlCenterWidgetRegistry + widgetModel: Settings.data.controlCenter.widgets["quickSettings"] + availableWidgets: availableWidgets + enableMoveBetweenSections: false + onAddWidget: (widgetId, section) => _addWidgetToSection(widgetId, section) + onRemoveWidget: (section, index) => _removeWidgetFromSection(section, index) + onReorderWidget: (section, fromIndex, toIndex) => _reorderWidgetInSection(section, fromIndex, toIndex) + onUpdateWidgetSettings: (section, index, settings) => _updateWidgetSettingsInSection(section, index, settings) + onDragPotentialStarted: root.handleDragStart() + onDragPotentialEnded: root.handleDragEnd() + } + } + } + + NDivider { + Layout.fillWidth: true + Layout.topMargin: Style.marginXL * scaling + Layout.bottomMargin: Style.marginXL * scaling + } + + // --------------------------------- + // Signal functions + // --------------------------------- + function _addWidgetToSection(widgetId, section) { + var newWidget = { + "id": widgetId + } + if (ControlCenterWidgetRegistry.widgetHasUserSettings(widgetId)) { + var metadata = ControlCenterWidgetRegistry.widgetMetadata[widgetId] + if (metadata) { + Object.keys(metadata).forEach(function (key) { + if (key !== "allowUserSettings") { + newWidget[key] = metadata[key] + } + }) + } + } + Settings.data.controlCenter.widgets[section].push(newWidget) + } + + function _removeWidgetFromSection(section, index) { + if (index >= 0 && index < Settings.data.controlCenter.widgets[section].length) { + var newArray = Settings.data.controlCenter.widgets[section].slice() + var removedWidgets = newArray.splice(index, 1) + Settings.data.controlCenter.widgets[section] = newArray + + // Check that we still have a control center + if (removedWidgets[0].id === "ControlCenter" && BarService.lookupWidget("ControlCenter") === undefined) { + ToastService.showWarning(I18n.tr("toast.missing-control-center.label"), I18n.tr("toast.missing-control-center.description"), 12000) + } + } + } + + function _reorderWidgetInSection(section, fromIndex, toIndex) { + if (fromIndex >= 0 && fromIndex < Settings.data.controlCenter.widgets[section].length && toIndex >= 0 && toIndex < Settings.data.controlCenter.widgets[section].length) { + + // Create a new array to avoid modifying the original + var newArray = Settings.data.controlCenter.widgets[section].slice() + var item = newArray[fromIndex] + newArray.splice(fromIndex, 1) + newArray.splice(toIndex, 0, item) + + Settings.data.controlCenter.widgets[section] = newArray + //Logger.log("BarTab", "Widget reordered. New array:", JSON.stringify(newArray)) + } + } + + function _updateWidgetSettingsInSection(section, index, settings) { + // Update the widget settings in the Settings data + Settings.data.controlCenter.widgets[section][index] = settings + //Logger.log("BarTab", `Updated widget settings for ${settings.id} in ${section} section`) + } + + // Base list model for all combo boxes + ListModel { + id: availableWidgets + } + + Component.onCompleted: { + // Fill out availableWidgets ListModel + availableWidgets.clear() + ControlCenterWidgetRegistry.getAvailableWidgets().forEach(entry => { + availableWidgets.append({ + "key": entry, + "name": entry + }) + }) + } +} diff --git a/Services/BarWidgetRegistry.qml b/Services/BarWidgetRegistry.qml index cddb544a..efb85537 100644 --- a/Services/BarWidgetRegistry.qml +++ b/Services/BarWidgetRegistry.qml @@ -116,6 +116,10 @@ Singleton { "onlySameOutput": true, "onlyActiveWorkspaces": true }, + "Tray": { + "allowUserSettings": true, + "blacklist": [] + }, "Workspace": { "allowUserSettings": true, "labelMode": "index", diff --git a/Services/ColorSchemeService.qml b/Services/ColorSchemeService.qml index a211b4af..19d5fc05 100644 --- a/Services/ColorSchemeService.qml +++ b/Services/ColorSchemeService.qml @@ -161,7 +161,8 @@ Singleton { // Check if any Matugen templates are enabled function hasEnabledMatugenTemplates() { - return Settings.data.templates.gtk || Settings.data.templates.qt || Settings.data.templates.kitty || Settings.data.templates.ghostty || Settings.data.templates.foot || Settings.data.templates.fuzzel || Settings.data.templates.vesktop || Settings.data.templates.pywalfox + return Settings.data.templates.gtk || Settings.data.templates.qt || Settings.data.templates.kitty || Settings.data.templates.ghostty || Settings.data.templates.foot || Settings.data.templates.fuzzel || Settings.data.templates.discord || Settings.data.templates.discord_vesktop || Settings.data.templates.discord_webcord + || Settings.data.templates.discord_armcord || Settings.data.templates.discord_equibop || Settings.data.templates.discord_lightcord || Settings.data.templates.discord_dorion || Settings.data.templates.pywalfox } // Writer to colors.json using a JsonAdapter for safety diff --git a/Services/ControlCenterWidgetRegistry.qml b/Services/ControlCenterWidgetRegistry.qml new file mode 100644 index 00000000..ce2fcbf1 --- /dev/null +++ b/Services/ControlCenterWidgetRegistry.qml @@ -0,0 +1,75 @@ +pragma Singleton + +import QtQuick +import Quickshell +import qs.Commons +import qs.Modules.ControlCenter.Widgets + +Singleton { + id: root + + // Widget registry object mapping widget names to components + property var widgets: ({ + "Bluetooth": bluetoothComponent, + "Notifications": notificationsComponent, + "KeepAwake": keepAwakeComponent, + "NightLight": nightLightComponent, + "PowerProfile": powerProfileComponent, + "ScreenRecorder": screenRecorderComponent, + "WiFi": wiFiComponent, + "WallpaperSelector": wallpaperSelectorComponent + }) + + property var widgetMetadata: ({}) + + // Component definitions - these are loaded once at startup + property Component bluetoothComponent: Component { + Bluetooth {} + } + property Component notificationsComponent: Component { + Notifications {} + } + property Component keepAwakeComponent: Component { + KeepAwake {} + } + property Component nightLightComponent: Component { + NightLight {} + } + property Component powerProfileComponent: Component { + PowerProfile {} + } + property Component screenRecorderComponent: Component { + ScreenRecorder {} + } + property Component wiFiComponent: Component { + WiFi {} + } + property Component wallpaperSelectorComponent: Component { + WallpaperSelector {} + } + + function init() { + Logger.log("ControlCenterWidgetRegistry", "Service started") + } + + // ------------------------------ + // Helper function to get widget component by name + function getWidget(id) { + return widgets[id] || null + } + + // Helper function to check if widget exists + function hasWidget(id) { + return id in widgets + } + + // Get list of available widget id + function getAvailableWidgets() { + return Object.keys(widgets) + } + + // Helper function to check if widget has user settings + function widgetHasUserSettings(id) { + return (widgetMetadata[id] !== undefined) && (widgetMetadata[id].allowUserSettings === true) + } +} diff --git a/Services/IPCService.qml b/Services/IPCService.qml index 711d44dd..70999aa1 100644 --- a/Services/IPCService.qml +++ b/Services/IPCService.qml @@ -112,10 +112,14 @@ Item { function muteOutput() { AudioService.setOutputMuted(!AudioService.muted) } + function increaseInput() { + AudioService.increaseInputVolume() + } + function decreaseInput() { + AudioService.decreaseInputVolume() + } function muteInput() { - if (AudioService.source?.ready && AudioService.source?.audio) { - AudioService.source.audio.muted = !AudioService.source.audio.muted - } + AudioService.setInputMuted(!AudioService.inputMuted) } } diff --git a/Services/MatugenTemplates.qml b/Services/MatugenTemplates.qml index 0eedbe32..3bd5072c 100644 --- a/Services/MatugenTemplates.qml +++ b/Services/MatugenTemplates.qml @@ -69,72 +69,134 @@ Singleton { }) } + // Applications configuration + readonly property var applications: [{ + "name": "gtk", + "templates": [{ + "version": "gtk3", + "output": "~/.config/gtk-3.0/gtk.css" + }, { + "version": "gtk4", + "output": "~/.config/gtk-4.0/gtk.css" + }], + "input": "gtk.css", + "postHook": "gsettings set org.gnome.desktop.interface color-scheme prefer-{mode}" + }, { + "name": "qt", + "templates": [{ + "version": "qt5", + "output": "~/.config/qt5ct/colors/noctalia.conf" + }, { + "version": "qt6", + "output": "~/.config/qt6ct/colors/noctalia.conf" + }], + "input": "qtct.conf" + },{ + "name": "kcolorscheme", + "templates":[{ + "version": "kcolorscheme", + "output": "~/.local/share/color-schemes/noctalia.colors" + }], + "input":"kcolorscheme.colors" + },{ + "name": "fuzzel", + "templates": [{ + "version": "fuzzel", + "output": "~/.config/fuzzel/themes/noctalia" + }], + "input": "fuzzel.conf", + "postHook": AppThemeService.colorsApplyScript + " fuzzel" + }, { + "name": "pywalfox", + "templates": [{ + "version": "pywalfox", + "output": "~/.cache/wal/colors.json" + }], + "input": "pywalfox.json", + "postHook": AppThemeService.colorsApplyScript + " pywalfox" + }, { + "name": "discord_vesktop", + "templates": [{ + "version": "discord_vesktop", + "output": "~/.config/vesktop/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }, { + "name": "discord_webcord", + "templates": [{ + "version": "discord_webcord", + "output": "~/.config/webcord/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }, { + "name": "discord_armcord", + "templates": [{ + "version": "discord_armcord", + "output": "~/.config/armcord/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }, { + "name": "discord_equibop", + "templates": [{ + "version": "discord_equibop", + "output": "~/.config/equibop/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }, { + "name": "discord_lightcord", + "templates": [{ + "version": "discord_lightcord", + "output": "~/.config/lightcord/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }, { + "name": "discord_dorion", + "templates": [{ + "version": "discord_dorion", + "output": "~/.config/dorion/themes/noctalia.theme.css" + }], + "input": "vesktop.css" + }] + // -------------------------------- function addApplicationTemplates(lines, mode) { - var applications = [{ - "name": "gtk", - "templates": [{ - "version": "gtk3", - "output": "~/.config/gtk-3.0/gtk.css" - }, { - "version": "gtk4", - "output": "~/.config/gtk-4.0/gtk.css" - }], - "input": "gtk.css", - "postHook": "gsettings set org.gnome.desktop.interface color-scheme prefer-" + mode - }, { - "name": "qt", - "templates": [{ - "version": "qt5", - "output": "~/.config/qt5ct/colors/noctalia.conf" - }, { - "version": "qt6", - "output": "~/.config/qt6ct/colors/noctalia.conf" - }], - "input": "qtct.conf" - },{ - "name": "kcolorscheme", - "templates":[{ - "version": "kcolorscheme", - "output": "~/.local/share/color-schemes/noctalia.colors" - }], - "input":"kcolorscheme.colors" - },{ - "name": "fuzzel", - "templates": [{ - "version": "fuzzel", - "output": "~/.config/fuzzel/themes/noctalia" - }], - "input": "fuzzel.conf", - "postHook": AppThemeService.colorsApplyScript + " fuzzel" - }, { - "name": "pywalfox", - "templates": [{ - "version": "pywalfox", - "output": "~/.cache/wal/colors.json" - }], - "input": "pywalfox.json", - "postHook": AppThemeService.colorsApplyScript + " pywalfox" - }, { - "name": "vesktop", - "templates": [{ - "version": "vesktop", - "output": "~/.config/vesktop/themes/noctalia.theme.css" - }], - "input": "vesktop.css" - }] - applications.forEach(function (app) { - if (Settings.data.templates[app.name]) { + // Check if app has a condition and if it's met + var shouldInclude = true + if (app.condition !== undefined) { + shouldInclude = app.condition + } + + if (Settings.data.templates[app.name] && shouldInclude) { app.templates.forEach(function (template) { lines.push("\n[templates." + template.version + "]") lines.push('input_path = "' + Quickshell.shellDir + '/Assets/MatugenTemplates/' + app.input + '"') lines.push('output_path = "' + template.output + '"') if (app.postHook) { - lines.push('post_hook = "' + app.postHook + '"') + var postHook = app.postHook.replace("{mode}", mode) + lines.push('post_hook = "' + postHook + '"') } }) } }) } + + // Extract Discord clients from applications array + readonly property var discordClients: { + var clients = [] + for (var i = 0; i < applications.length; i++) { + var app = applications[i] + if (app.name && app.name.startsWith("discord_")) { + var clientName = app.name.replace("discord_", "") + var themePath = app.templates[0].output + var configPath = themePath.replace("/themes/noctalia.theme.css", "") + clients.push({ + "name": clientName, + "configPath": configPath, + "themePath": themePath + }) + } + } + return clients + } } diff --git a/Services/MediaService.qml b/Services/MediaService.qml index d67b1bbe..006285c9 100644 --- a/Services/MediaService.qml +++ b/Services/MediaService.qml @@ -61,7 +61,8 @@ Singleton { if (title1) { for (var j = 0; j < genericPlayers.length; j++) { - if (matchedGenericIndices[j]) continue + if (matchedGenericIndices[j]) + continue let genericPlayer = genericPlayers[j] let title2 = String(genericPlayer.trackTitle || "").trim() @@ -71,27 +72,29 @@ Singleton { let scoreSpecific = (specificPlayer.trackArtUrl ? 1 : 0) let scoreGeneric = (genericPlayer.trackArtUrl ? 1 : 0) - if(scoreSpecific > scoreGeneric){ dataPlayer = specificPlayer } + if (scoreSpecific > scoreGeneric) { + dataPlayer = specificPlayer + } let virtualPlayer = { - identity: identityPlayer.identity, - desktopEntry: identityPlayer.desktopEntry, - trackTitle: dataPlayer.trackTitle, - trackArtist: dataPlayer.trackArtist, - trackAlbum: dataPlayer.trackAlbum, - trackArtUrl: dataPlayer.trackArtUrl, - length: dataPlayer.length || 0, - position: dataPlayer.position || 0, - playbackState: dataPlayer.playbackState, - isPlaying: dataPlayer.isPlaying || false, - canPlay: dataPlayer.canPlay || false, - canPause: dataPlayer.canPause || false, - canGoNext: dataPlayer.canGoNext || false, - canGoPrevious: dataPlayer.canGoPrevious || false, - canSeek: dataPlayer.canSeek || false, - canControl: dataPlayer.canControl || false, - _stateSource: dataPlayer, - _controlTarget: identityPlayer + "identity": identityPlayer.identity, + "desktopEntry": identityPlayer.desktopEntry, + "trackTitle": dataPlayer.trackTitle, + "trackArtist": dataPlayer.trackArtist, + "trackAlbum": dataPlayer.trackAlbum, + "trackArtUrl": dataPlayer.trackArtUrl, + "length": dataPlayer.length || 0, + "position": dataPlayer.position || 0, + "playbackState": dataPlayer.playbackState, + "isPlaying": dataPlayer.isPlaying || false, + "canPlay": dataPlayer.canPlay || false, + "canPause": dataPlayer.canPause || false, + "canGoNext": dataPlayer.canGoNext || false, + "canGoPrevious": dataPlayer.canGoPrevious || false, + "canSeek": dataPlayer.canSeek || false, + "canControl": dataPlayer.canControl || false, + "_stateSource": dataPlayer, + "_controlTarget": identityPlayer } finalPlayers.push(virtualPlayer) matchedGenericIndices[j] = true @@ -126,7 +129,7 @@ Singleton { function findActivePlayer() { let availablePlayers = getAvailablePlayers() if (availablePlayers.length === 0) { - Logger.log("Media", "No active player found") + //Logger.log("Media", "No active player found") return null } diff --git a/Services/PowerProfileService.qml b/Services/PowerProfileService.qml index 98acfb71..9a43217e 100644 --- a/Services/PowerProfileService.qml +++ b/Services/PowerProfileService.qml @@ -71,6 +71,12 @@ Singleton { setProfile(PowerProfile.Balanced) } + function isDefault() { + if (!available) + return true + return (profile === PowerProfile.Balanced) + } + Connections { target: powerProfiles function onProfileChanged() { diff --git a/Services/ProgramCheckerService.qml b/Services/ProgramCheckerService.qml index a7d5f436..268274e3 100644 --- a/Services/ProgramCheckerService.qml +++ b/Services/ProgramCheckerService.qml @@ -16,13 +16,67 @@ Singleton { property bool ghosttyAvailable: false property bool footAvailable: false property bool fuzzelAvailable: false - property bool vesktopAvailable: false property bool gpuScreenRecorderAvailable: false property bool wlsunsetAvailable: false + // Discord client auto-detection + property var availableDiscordClients: [] + // Signal emitted when all checks are complete signal checksCompleted + // Function to detect Discord client by checking config directories + function detectDiscordClient() { + // Build list of client names from MatugenTemplates + var clientNames = [] + for (var i = 0; i < MatugenTemplates.discordClients.length; i++) { + clientNames.push(MatugenTemplates.discordClients[i].name) + } + + // Use a Process to check directory existence for all clients + discordDetector.command = ["sh", "-c", "available_clients=\"\"; " + "for client in " + clientNames.join(" ") + "; do " + " if [ -d \"$HOME/.config/$client\" ]; then " + " available_clients=\"$available_clients $client\"; " + " fi; " + "done; " + "echo \"$available_clients\""] + discordDetector.running = true + } + + // Process to detect Discord client directories + Process { + id: discordDetector + running: false + + onExited: function (exitCode) { + availableDiscordClients = [] + + if (exitCode === 0) { + var detectedClients = stdout.text.trim().split(/\s+/).filter(function (client) { + return client.length > 0 + }) + + if (detectedClients.length > 0) { + // Build list of available clients + for (var i = 0; i < detectedClients.length; i++) { + var clientName = detectedClients[i] + for (var j = 0; j < MatugenTemplates.discordClients.length; j++) { + var client = MatugenTemplates.discordClients[j] + if (client.name === clientName) { + availableDiscordClients.push(client) + break + } + } + } + + Logger.log("ProgramChecker", "Detected Discord clients:", detectedClients.join(", ")) + } + } + + if (availableDiscordClients.length === 0) { + Logger.log("ProgramChecker", "No Discord clients detected") + } + } + + stdout: StdioCollector {} + stderr: StdioCollector {} + } + // Programs to check - maps property names to commands readonly property var programsToCheck: ({ "matugenAvailable": ["which", "matugen"], @@ -31,7 +85,6 @@ Singleton { "ghosttyAvailable": ["which", "ghostty"], "footAvailable": ["which", "foot"], "fuzzelAvailable": ["which", "fuzzel"], - "vesktopAvailable": ["which", "vesktop"], "gpuScreenRecorderAvailable": ["sh", "-c", "command -v gpu-screen-recorder >/dev/null 2>&1 || (command -v flatpak >/dev/null 2>&1 && flatpak list --app | grep -q 'com.dec05eba.gpu_screen_recorder')"], "wlsunsetAvailable": ["which", "wlsunset"] }) @@ -59,6 +112,8 @@ Singleton { // Check next program or emit completion signal if (root.completedChecks >= root.totalChecks) { + // Run Discord client detection after all checks are complete + root.detectDiscordClient() root.checksCompleted() } else { root.checkNextProgram() @@ -113,6 +168,21 @@ Singleton { checker.running = true } + // Manual function to test Discord detection (for debugging) + function testDiscordDetection() { + Logger.log("ProgramChecker", "Testing Discord detection...") + Logger.log("ProgramChecker", "HOME:", Quickshell.env("HOME")) + + // Test each client directory + for (var i = 0; i < MatugenTemplates.discordClients.length; i++) { + var client = MatugenTemplates.discordClients[i] + var configDir = client.configPath.replace("~", Quickshell.env("HOME")) + Logger.log("ProgramChecker", "Checking:", configDir) + } + + detectDiscordClient() + } + // Initialize checks when service is created Component.onCompleted: { checkAllPrograms() diff --git a/Widgets/NButton.qml b/Widgets/NButton.qml index 6ce1c75b..3d1b05a3 100644 --- a/Widgets/NButton.qml +++ b/Widgets/NButton.qml @@ -19,6 +19,7 @@ Rectangle { property int fontWeight: Style.fontWeightBold property real iconSize: Style.fontSizeL * scaling property bool outlined: false + property int horizontalAlignment: Qt.AlignHCenter // Signals signal clicked @@ -27,7 +28,6 @@ Rectangle { // Internal properties property bool hovered: false - property bool pressed: false // Dimensions implicitWidth: contentRow.implicitWidth + (Style.marginL * 2 * scaling) @@ -47,7 +47,7 @@ Rectangle { border.color: { if (!enabled) return Color.mOutline - if (pressed || hovered) + if (hovered) return backgroundColor return outlined ? backgroundColor : Color.transparent } @@ -71,7 +71,10 @@ Rectangle { // Content RowLayout { id: contentRow - anchors.centerIn: parent + anchors.verticalCenter: parent.verticalCenter + anchors.left: root.horizontalAlignment === Qt.AlignLeft ? parent.left : undefined + anchors.horizontalCenter: root.horizontalAlignment === Qt.AlignHCenter ? parent.horizontalCenter : undefined + anchors.leftMargin: root.horizontalAlignment === Qt.AlignLeft ? Style.marginL * scaling : 0 spacing: Style.marginXS * scaling // Icon (optional) @@ -84,8 +87,8 @@ Rectangle { if (!root.enabled) return Color.mOnSurfaceVariant if (root.outlined) { - if (root.pressed || root.hovered) - return root.backgroundColor + if (root.hovered) + return root.textColor return root.backgroundColor } return root.textColor diff --git a/Widgets/NCircleStat.qml b/Widgets/NCircleStat.qml index 53177d07..f6d4332d 100644 --- a/Widgets/NCircleStat.qml +++ b/Widgets/NCircleStat.qml @@ -61,17 +61,31 @@ Rectangle { ctx.reset() ctx.lineWidth = 6 * scaling * contentScale - // Track uses surfaceVariant for stronger contrast + // Track uses surface for stronger contrast ctx.strokeStyle = Color.mSurface ctx.beginPath() ctx.arc(cx, cy, r, start, endBg) ctx.stroke() - // Value arc + // Value arc with gradient starting at 25% const ratio = Math.max(0, Math.min(1, root.value / 100)) const end = start + (endBg - start) * ratio - ctx.strokeStyle = Color.mPrimary + // Calculate gradient start point (25% into the arc) + const gradientStartRatio = 0.25 + const gradientStart = start + (endBg - start) * gradientStartRatio + + // Create linear gradient + const startX = cx + r * Math.cos(gradientStart) + const startY = cy + r * Math.sin(gradientStart) + const endX = cx + r * Math.cos(endBg) + const endY = cy + r * Math.sin(endBg) + + const gradient = ctx.createLinearGradient(startX, startY, endX, endY) + gradient.addColorStop(0, Color.mPrimary) + gradient.addColorStop(1, Color.mOnSurface) + + ctx.strokeStyle = gradient ctx.beginPath() ctx.arc(cx, cy, r, start, end) ctx.stroke() @@ -84,32 +98,22 @@ Rectangle { anchors.centerIn: parent anchors.verticalCenterOffset: -4 * scaling * contentScale text: `${root.value}${root.suffix}` - pointSize: Style.fontSizeM * scaling * contentScale + pointSize: Style.fontSizeM * scaling * contentScale * 0.9 font.weight: Style.fontWeightBold color: Color.mOnSurface horizontalAlignment: Text.AlignHCenter } - // Tiny circular badge for the icon, positioned inside below the percentage - Rectangle { - id: iconBadge - width: iconText.implicitWidth + Style.marginXXS * scaling - height: width - radius: width / 2 - color: Color.mPrimary + NIcon { + id: iconText anchors.horizontalCenter: parent.horizontalCenter anchors.top: valueLabel.bottom anchors.topMargin: 8 * scaling * contentScale - - NIcon { - id: iconText - anchors.centerIn: parent - icon: root.icon - color: Color.mOnPrimary - pointSize: Style.fontSizeS * scaling - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } + icon: root.icon + color: Color.mPrimary + pointSize: Style.fontSizeM * scaling + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter } } } diff --git a/Widgets/NFilePicker.qml b/Widgets/NFilePicker.qml index 2eed6c9a..4013c59c 100644 --- a/Widgets/NFilePicker.qml +++ b/Widgets/NFilePicker.qml @@ -13,7 +13,7 @@ Popup { id: root // Properties - property string title: "File Picker" + property string title: I18n.tr("widget.file-picker.title") property string initialPath: Quickshell.env("HOME") || "/home" property string selectionMode: "files" // "files" or "folders" property var nameFilters: ["*"] @@ -203,7 +203,7 @@ Popup { // "Select Current" button only visible in folder selection mode NButton { - text: "Select Current" + text: I18n.tr("widgets.file-picker.select-current") icon: "filepicker-folder-current" visible: root.selectionMode === "folders" onClicked: { @@ -214,7 +214,7 @@ Popup { NIconButton { icon: "filepicker-refresh" - tooltipText: "Refresh" + tooltipText: I18n.tr("tooltips.refresh") onClicked: { // Force a proper refresh by resetting the folder const currentFolder = folderModel.folder @@ -225,7 +225,7 @@ Popup { } NIconButton { icon: "filepicker-close" - tooltipText: "Close" + tooltipText: I18n.tr("tooltips.close") onClicked: { root.cancelled() root.close() @@ -256,7 +256,7 @@ Popup { NIconButton { icon: "filepicker-arrow-up" - tooltipText: "Up" + tooltipText: I18n.tr("tooltips.up") baseSize: Style.baseWidgetSize * 0.8 enabled: folderModel.folder.toString() !== "file:///" onClicked: { @@ -268,7 +268,7 @@ Popup { NIconButton { icon: "filepicker-home" - tooltipText: "Home" + tooltipText: I18n.tr("tooltips.home") baseSize: Style.baseWidgetSize * 0.8 onClicked: { const homePath = Quickshell.env("HOME") || "/home" @@ -361,7 +361,7 @@ Popup { } NTextInput { id: searchInput - placeholderText: "Search files and folders..." + placeholderText: I18n.tr("widget.file-picker.search-placeholder") Layout.fillWidth: true text: filePickerPanel.searchText onTextChanged: { @@ -378,7 +378,7 @@ Popup { } NIconButton { icon: "filepicker-x" - tooltipText: "Clear" + tooltipText: I18n.tr("tooltips.clear") baseSize: Style.baseWidgetSize * 0.6 visible: filePickerPanel.searchText.length > 0 onClicked: { @@ -814,7 +814,7 @@ Popup { } NButton { - text: "Cancel" + text: I18n.tr("widgets.file-picker.cancel") outlined: true onClicked: { root.cancelled() diff --git a/Widgets/NQuickSetting.qml b/Widgets/NQuickSetting.qml new file mode 100644 index 00000000..7b559019 --- /dev/null +++ b/Widgets/NQuickSetting.qml @@ -0,0 +1,326 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Effects +import qs.Commons +import qs.Services + +Rectangle { + id: root + + // Public properties + property string text: "" + property string icon: "" + property string tooltipText: "" + property bool enabled: true + property bool hot: false + property string style: "modern" // "modern", "classic", or "compact" + + // Styling properties + property real fontSize: (style === "classic") ? Style.fontSizeXS * scaling : Style.fontSizeS * scaling + property int fontWeight: Style.fontWeightMedium + property real iconSize: Style.fontSizeL * scaling + property real cornerRadius: Style.radiusM * scaling + + // Internal properties + property bool hovered: false + property bool pressed: false + + // Colors - Style-dependent colors + property color backgroundColor: { + if (pressed) { + return Color.mTertiary + } + if (hot) { + return Color.mPrimary + } + if (style === "classic") + return Color.mSurfaceVariant + if (style === "compact") + return Color.mSurface + return Color.mSurface + } + property color textColor: { + if (pressed) { + return Color.mOnTertiary + } + if (hot) { + return Color.mOnPrimary + } + return Color.mOnSurface + } + property color iconColor: { + if (pressed) { + return Color.mOnTertiary + } + if (hot) { + return Color.mOnPrimary + } + if (style !== "compact") + return Color.mPrimary + return Color.mOnSurface + } + property color borderColor: Color.mOutline + property color hoverColor: Color.mTertiary + property color hoverTextColor: Color.mOnTertiary + property color hoverIconColor: Color.mOnTertiary + + // Signals + signal clicked + signal rightClicked + signal middleClicked + + // Dimensions - Style-dependent sizing + implicitWidth: { + if (style === "classic") { + return Style.baseWidgetSize * scaling + } + if (style === "compact") { + return Style.baseWidgetSize * 0.8 * scaling + } + return Math.max(120 * scaling, contentRow.implicitWidth + (Style.marginL * scaling)) + } + implicitHeight: { + if (style === "classic") { + return Style.baseWidgetSize * scaling + } + if (style === "compact") { + return Style.baseWidgetSize * 0.8 * scaling + } + return Math.max(48 * scaling, contentRow.implicitHeight + (Style.marginL * scaling)) + } + + // Appearance - Style-dependent styling + radius: { + if (style === "classic") + return width * 0.5 + if (style === "compact") + return Style.radiusS * scaling // Smaller radius for compact + return cornerRadius + } + color: { + if (!enabled) + return Qt.lighter(Color.mSurface, 1.1) + if (hovered) + return hoverColor + return backgroundColor + } + + border.width: { + if (style === "classic") + return Math.max(1, Style.borderS * scaling) + if (style === "compact") + return 0 + return 0 + } + border.color: { + if (style === "classic") + return borderColor + return "transparent" + } + + opacity: enabled ? (style === "classic" ? Style.opacityFull : 1.0) : (style === "classic" ? Style.opacityMedium : 0.6) + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: style === "classic" ? Easing.InOutQuad : Easing.OutCubic + } + } + + Behavior on border.color { + ColorAnimation { + duration: Style.animationFast + easing.type: style === "classic" ? Easing.InOutQuad : Easing.OutCubic + } + } + + Behavior on scale { + NumberAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + + // Modern style - icon above text + ColumnLayout { + id: contentRow + anchors.centerIn: parent + spacing: Style.marginXXS * scaling + visible: root.style !== "classic" && root.style !== "compact" + + // Icon + NIcon { + Layout.alignment: Qt.AlignHCenter + visible: root.icon !== "" + icon: root.icon + pointSize: root.iconSize + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverIconColor + return root.iconColor + } + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + + // Modern - Text content + NText { + Layout.alignment: Qt.AlignHCenter + visible: root.text !== "" + text: root.text + pointSize: root.fontSize + font.weight: root.fontWeight + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverTextColor + return root.textColor + } + elide: Text.ElideRight + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + } + + // Compact style - icon only, small square button + NIcon { + id: compactIcon + anchors.centerIn: parent + visible: root.style === "compact" && root.icon !== "" + icon: root.icon + pointSize: Style.fontSizeM * scaling // Smaller icon for compact + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverIconColor + return root.iconColor + } + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + + // Classic style - EXACTLY like NIconButton (icon + text) + RowLayout { + anchors.centerIn: parent + visible: root.style === "classic" + spacing: Style.marginXS * scaling + + NIcon { + visible: root.icon !== "" + icon: root.icon + pointSize: Style.fontSizeM * scaling + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverIconColor + return root.iconColor + } + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + + // Classic - Text content + NText { + visible: root.text !== "" + text: root.text + pointSize: root.fontSize + font.weight: root.fontWeight + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverTextColor + return root.textColor + } + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + } + + MouseArea { + id: mouseArea + anchors.fill: parent + enabled: root.enabled + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor + + onEntered: { + root.hovered = true + if (tooltipText) { + TooltipService.show(Screen, root, root.tooltipText) + } + } + + onExited: { + root.hovered = false + if (tooltipText) { + TooltipService.hide() + } + } + + onPressed: mouse => { + root.pressed = true + root.scale = 0.92 + if (tooltipText) { + TooltipService.hide() + } + } + + onReleased: mouse => { + root.scale = 1.0 + root.pressed = false + + // Only trigger actions if released while hovering + if (root.hovered) { + if (mouse.button === Qt.LeftButton) { + root.clicked() + } else if (mouse.button === Qt.RightButton) { + root.rightClicked() + } else if (mouse.button === Qt.MiddleButton) { + root.middleClicked() + } + } + } + + onCanceled: { + root.hovered = false + root.pressed = false + root.scale = 1.0 + if (tooltipText) { + TooltipService.hide() + } + } + } +} diff --git a/Widgets/NValueSlider.qml b/Widgets/NValueSlider.qml index 32d8ed76..3eb6538b 100644 --- a/Widgets/NValueSlider.qml +++ b/Widgets/NValueSlider.qml @@ -16,12 +16,16 @@ RowLayout { property bool snapAlways: true property real heightRatio: 0.7 property string text: "" + property real textSize: Style.fontSizeM * scaling + property real customHeight: -1 + property real customHeightRatio: -1 // Signals signal moved(real value) signal pressedChanged(bool pressed, real value) spacing: Style.marginL * scaling + implicitHeight: root.customHeight > 0 ? root.customHeight : slider.implicitHeight NSlider { id: slider @@ -32,7 +36,7 @@ RowLayout { stepSize: root.stepSize cutoutColor: root.cutoutColor snapAlways: root.snapAlways - heightRatio: root.heightRatio + heightRatio: root.customHeightRatio > 0 ? root.customHeightRatio : root.heightRatio onMoved: root.moved(value) onPressedChanged: root.pressedChanged(pressed, value) } @@ -40,6 +44,7 @@ RowLayout { NText { visible: root.text !== "" text: root.text + pointSize: root.textSize family: Settings.data.ui.fontFixed Layout.alignment: Qt.AlignVCenter Layout.preferredWidth: 45 * scaling