mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-04 11:32:12 -04:00
Compare commits
5 Commits
displaycon
...
769f58caa9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
769f58caa9 | ||
|
|
e7facf740d | ||
|
|
04921eef62 | ||
|
|
8863c42879 | ||
|
|
2745116ac5 |
@@ -1,6 +1,11 @@
|
||||
This file is more of a quick reference so I know what to account for before next releases.
|
||||
|
||||
# 1.2.0
|
||||
|
||||
- Added clipboard and clipboard history integration
|
||||
- Added swipe to dismiss notification popups and from center
|
||||
- Added paste from clipboard history view - requires wtype
|
||||
- Optimize surface damage of OSD & Toast
|
||||
- Add monitor configurator (niri, Hyprland, MangoWC)
|
||||
- **BREAKING** ghostty theme changed to ~/.config/ghostty/themes/danktheme
|
||||
- requires intervention and doc update
|
||||
|
||||
@@ -265,7 +265,13 @@ func (cd *ConfigDeployer) deployGhosttyConfig() ([]DeploymentResult, error) {
|
||||
|
||||
colorResult := DeploymentResult{
|
||||
ConfigType: "Ghostty Colors",
|
||||
Path: filepath.Join(os.Getenv("HOME"), ".config", "ghostty", "config-dankcolors"),
|
||||
Path: filepath.Join(os.Getenv("HOME"), ".config", "ghostty", "themes", "dankcolors"),
|
||||
}
|
||||
|
||||
themesDir := filepath.Dir(colorResult.Path)
|
||||
if err := os.MkdirAll(themesDir, 0755); err != nil {
|
||||
mainResult.Error = fmt.Errorf("failed to create themes directory: %w", err)
|
||||
return []DeploymentResult{mainResult}, mainResult.Error
|
||||
}
|
||||
|
||||
if err := os.WriteFile(colorResult.Path, []byte(GhosttyColorConfig), 0644); err != nil {
|
||||
|
||||
@@ -468,7 +468,7 @@ func TestHyprlandConfigStructure(t *testing.T) {
|
||||
func TestGhosttyConfigStructure(t *testing.T) {
|
||||
assert.Contains(t, GhosttyConfig, "window-decoration = false")
|
||||
assert.Contains(t, GhosttyConfig, "background-opacity = 1.0")
|
||||
assert.Contains(t, GhosttyConfig, "config-file = ./config-dankcolors")
|
||||
assert.Contains(t, GhosttyConfig, "theme = dankcolors")
|
||||
}
|
||||
|
||||
func TestGhosttyColorConfigStructure(t *testing.T) {
|
||||
|
||||
@@ -48,4 +48,4 @@ keybind = shift+enter=text:\n
|
||||
gtk-single-instance = true
|
||||
|
||||
# Dank color generation
|
||||
config-file = ./config-dankcolors
|
||||
theme = dankcolors
|
||||
|
||||
@@ -918,6 +918,7 @@ Singleton {
|
||||
|
||||
function buildMatugenColorsFromTheme(darkTheme, lightTheme) {
|
||||
const colors = {};
|
||||
const isLight = SessionData !== "undefined" && SessionData.isLightMode;
|
||||
|
||||
function addColor(matugenKey, darkVal, lightVal) {
|
||||
if (!darkVal && !lightVal)
|
||||
@@ -930,7 +931,7 @@ Singleton {
|
||||
"color": String(lightVal || darkVal)
|
||||
},
|
||||
"default": {
|
||||
"color": String(darkVal || lightVal)
|
||||
"color": String((isLight && lightVal) ? lightVal : darkVal)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,26 +24,26 @@ DankModal {
|
||||
repeat: true
|
||||
running: root.shouldBeVisible
|
||||
onTriggered: {
|
||||
root.countdown--
|
||||
root.countdown--;
|
||||
if (root.countdown <= 0) {
|
||||
root.reverted()
|
||||
root.close()
|
||||
root.reverted();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
countdown = 10
|
||||
countdownTimer.start()
|
||||
countdown = 10;
|
||||
countdownTimer.start();
|
||||
}
|
||||
|
||||
onDialogClosed: {
|
||||
countdownTimer.stop()
|
||||
countdownTimer.stop();
|
||||
}
|
||||
|
||||
onBackgroundClicked: {
|
||||
root.reverted()
|
||||
root.close()
|
||||
root.reverted();
|
||||
root.close();
|
||||
}
|
||||
|
||||
content: Component {
|
||||
@@ -55,15 +55,15 @@ DankModal {
|
||||
implicitHeight: mainColumn.implicitHeight
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
root.reverted()
|
||||
root.close()
|
||||
event.accepted = true
|
||||
root.reverted();
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: event => {
|
||||
root.confirmed()
|
||||
root.close()
|
||||
event.accepted = true
|
||||
root.confirmed();
|
||||
root.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -149,8 +149,8 @@ DankModal {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.reverted()
|
||||
root.close()
|
||||
root.reverted();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,8 +178,8 @@ DankModal {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.confirmed()
|
||||
root.close()
|
||||
root.confirmed();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ DankModal {
|
||||
iconSize: Theme.iconSize - 4
|
||||
iconColor: Theme.surfaceText
|
||||
onClicked: {
|
||||
root.reverted()
|
||||
root.close()
|
||||
root.reverted();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,103 +9,110 @@ Item {
|
||||
id: root
|
||||
|
||||
function getBarComponentsFromSettings() {
|
||||
const bars = SettingsData.barConfigs || []
|
||||
const bars = SettingsData.barConfigs || [];
|
||||
return bars.map(bar => ({
|
||||
"id": "bar:" + bar.id,
|
||||
"name": bar.name || "Bar",
|
||||
"description": I18n.tr("Individual bar configuration"),
|
||||
"icon": "toolbar",
|
||||
"barId": bar.id
|
||||
}))
|
||||
"id": "bar:" + bar.id,
|
||||
"name": bar.name || "Bar",
|
||||
"description": I18n.tr("Individual bar configuration"),
|
||||
"icon": "toolbar",
|
||||
"barId": bar.id
|
||||
}));
|
||||
}
|
||||
|
||||
property var variantComponents: getVariantComponentsList()
|
||||
|
||||
function getVariantComponentsList() {
|
||||
return [...getBarComponentsFromSettings(), {
|
||||
"id": "dock",
|
||||
"name": I18n.tr("Application Dock"),
|
||||
"description": I18n.tr("Bottom dock for pinned and running applications"),
|
||||
"icon": "dock"
|
||||
}, {
|
||||
"id": "notifications",
|
||||
"name": I18n.tr("Notification Popups"),
|
||||
"description": I18n.tr("Notification toast popups"),
|
||||
"icon": "notifications"
|
||||
}, {
|
||||
"id": "wallpaper",
|
||||
"name": I18n.tr("Wallpaper"),
|
||||
"description": I18n.tr("Desktop background images"),
|
||||
"icon": "wallpaper"
|
||||
}, {
|
||||
"id": "osd",
|
||||
"name": I18n.tr("On-Screen Displays"),
|
||||
"description": I18n.tr("Volume, brightness, and other system OSDs"),
|
||||
"icon": "picture_in_picture"
|
||||
}, {
|
||||
"id": "toast",
|
||||
"name": I18n.tr("Toast Messages"),
|
||||
"description": I18n.tr("System toast notifications"),
|
||||
"icon": "campaign"
|
||||
}, {
|
||||
"id": "notepad",
|
||||
"name": I18n.tr("Notepad Slideout"),
|
||||
"description": I18n.tr("Quick note-taking slideout panel"),
|
||||
"icon": "sticky_note_2"
|
||||
}]
|
||||
return [...getBarComponentsFromSettings(),
|
||||
{
|
||||
"id": "dock",
|
||||
"name": I18n.tr("Application Dock"),
|
||||
"description": I18n.tr("Bottom dock for pinned and running applications"),
|
||||
"icon": "dock"
|
||||
},
|
||||
{
|
||||
"id": "notifications",
|
||||
"name": I18n.tr("Notification Popups"),
|
||||
"description": I18n.tr("Notification toast popups"),
|
||||
"icon": "notifications"
|
||||
},
|
||||
{
|
||||
"id": "wallpaper",
|
||||
"name": I18n.tr("Wallpaper"),
|
||||
"description": I18n.tr("Desktop background images"),
|
||||
"icon": "wallpaper"
|
||||
},
|
||||
{
|
||||
"id": "osd",
|
||||
"name": I18n.tr("On-Screen Displays"),
|
||||
"description": I18n.tr("Volume, brightness, and other system OSDs"),
|
||||
"icon": "picture_in_picture"
|
||||
},
|
||||
{
|
||||
"id": "toast",
|
||||
"name": I18n.tr("Toast Messages"),
|
||||
"description": I18n.tr("System toast notifications"),
|
||||
"icon": "campaign"
|
||||
},
|
||||
{
|
||||
"id": "notepad",
|
||||
"name": I18n.tr("Notepad Slideout"),
|
||||
"description": I18n.tr("Quick note-taking slideout panel"),
|
||||
"icon": "sticky_note_2"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onBarConfigsChanged() {
|
||||
variantComponents = getVariantComponentsList()
|
||||
variantComponents = getVariantComponentsList();
|
||||
}
|
||||
}
|
||||
|
||||
function getScreenPreferences(componentId) {
|
||||
if (componentId.startsWith("bar:")) {
|
||||
const barId = componentId.substring(4)
|
||||
const barConfig = SettingsData.getBarConfig(barId)
|
||||
return barConfig?.screenPreferences || ["all"]
|
||||
const barId = componentId.substring(4);
|
||||
const barConfig = SettingsData.getBarConfig(barId);
|
||||
return barConfig?.screenPreferences || ["all"];
|
||||
}
|
||||
return SettingsData.screenPreferences && SettingsData.screenPreferences[componentId] || ["all"]
|
||||
return SettingsData.screenPreferences && SettingsData.screenPreferences[componentId] || ["all"];
|
||||
}
|
||||
|
||||
function setScreenPreferences(componentId, screenNames) {
|
||||
if (componentId.startsWith("bar:")) {
|
||||
const barId = componentId.substring(4)
|
||||
const barId = componentId.substring(4);
|
||||
SettingsData.updateBarConfig(barId, {
|
||||
"screenPreferences": screenNames
|
||||
})
|
||||
return
|
||||
"screenPreferences": screenNames
|
||||
});
|
||||
return;
|
||||
}
|
||||
var prefs = SettingsData.screenPreferences || {}
|
||||
var newPrefs = Object.assign({}, prefs)
|
||||
newPrefs[componentId] = screenNames
|
||||
SettingsData.set("screenPreferences", newPrefs)
|
||||
var prefs = SettingsData.screenPreferences || {};
|
||||
var newPrefs = Object.assign({}, prefs);
|
||||
newPrefs[componentId] = screenNames;
|
||||
SettingsData.set("screenPreferences", newPrefs);
|
||||
}
|
||||
|
||||
function getShowOnLastDisplay(componentId) {
|
||||
if (componentId.startsWith("bar:")) {
|
||||
const barId = componentId.substring(4)
|
||||
const barConfig = SettingsData.getBarConfig(barId)
|
||||
return barConfig?.showOnLastDisplay ?? true
|
||||
const barId = componentId.substring(4);
|
||||
const barConfig = SettingsData.getBarConfig(barId);
|
||||
return barConfig?.showOnLastDisplay ?? true;
|
||||
}
|
||||
return SettingsData.showOnLastDisplay && SettingsData.showOnLastDisplay[componentId] || false
|
||||
return SettingsData.showOnLastDisplay && SettingsData.showOnLastDisplay[componentId] || false;
|
||||
}
|
||||
|
||||
function setShowOnLastDisplay(componentId, enabled) {
|
||||
if (componentId.startsWith("bar:")) {
|
||||
const barId = componentId.substring(4)
|
||||
const barId = componentId.substring(4);
|
||||
SettingsData.updateBarConfig(barId, {
|
||||
"showOnLastDisplay": enabled
|
||||
})
|
||||
return
|
||||
"showOnLastDisplay": enabled
|
||||
});
|
||||
return;
|
||||
}
|
||||
var prefs = SettingsData.showOnLastDisplay || {}
|
||||
var newPrefs = Object.assign({}, prefs)
|
||||
newPrefs[componentId] = enabled
|
||||
SettingsData.set("showOnLastDisplay", newPrefs)
|
||||
var prefs = SettingsData.showOnLastDisplay || {};
|
||||
var newPrefs = Object.assign({}, prefs);
|
||||
newPrefs[componentId] = enabled;
|
||||
SettingsData.set("showOnLastDisplay", newPrefs);
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
@@ -210,16 +217,16 @@ Item {
|
||||
model: [I18n.tr("Name"), I18n.tr("Model")]
|
||||
currentIndex: SettingsData.displayNameMode === "model" ? 1 : 0
|
||||
onSelectionChanged: (index, selected) => {
|
||||
if (!selected)
|
||||
return
|
||||
SettingsData.displayNameMode = index === 1 ? "model" : "system"
|
||||
SettingsData.saveSettings()
|
||||
}
|
||||
if (!selected)
|
||||
return;
|
||||
SettingsData.displayNameMode = index === 1 ? "model" : "system";
|
||||
SettingsData.saveSettings();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onDisplayNameModeChanged() {
|
||||
displayModeGroup.currentIndex = SettingsData.displayNameMode === "model" ? 1 : 0
|
||||
displayModeGroup.currentIndex = SettingsData.displayNameMode === "model" ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -273,9 +280,9 @@ Item {
|
||||
StyledText {
|
||||
text: {
|
||||
if (parent.currentMode) {
|
||||
return parent.currentMode.width + "×" + parent.currentMode.height + "@" + Math.round(parent.currentMode.refresh / 1000) + "Hz"
|
||||
return parent.currentMode.width + "×" + parent.currentMode.height + "@" + Math.round(parent.currentMode.refresh / 1000) + "Hz";
|
||||
}
|
||||
return modelData.width + "×" + modelData.height
|
||||
return modelData.width + "×" + modelData.height;
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
@@ -378,20 +385,20 @@ Item {
|
||||
text: I18n.tr("All displays")
|
||||
description: I18n.tr("Show on all connected displays")
|
||||
checked: {
|
||||
var prefs = root.getScreenPreferences(parent.componentId)
|
||||
return prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all")
|
||||
var prefs = root.getScreenPreferences(parent.componentId);
|
||||
return prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all");
|
||||
}
|
||||
onToggled: checked => {
|
||||
if (checked) {
|
||||
root.setScreenPreferences(parent.componentId, ["all"])
|
||||
} else {
|
||||
root.setScreenPreferences(parent.componentId, [])
|
||||
const cid = parent.componentId
|
||||
if (["dankBar", "dock", "notifications", "osd", "toast"].includes(cid) || cid.startsWith("bar:")) {
|
||||
root.setShowOnLastDisplay(cid, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checked) {
|
||||
root.setScreenPreferences(parent.componentId, ["all"]);
|
||||
} else {
|
||||
root.setScreenPreferences(parent.componentId, []);
|
||||
const cid = parent.componentId;
|
||||
if (["dankBar", "dock", "notifications", "osd", "toast"].includes(cid) || cid.startsWith("bar:")) {
|
||||
root.setShowOnLastDisplay(cid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
@@ -400,15 +407,15 @@ Item {
|
||||
description: I18n.tr("Always show when there's only one connected display")
|
||||
checked: root.getShowOnLastDisplay(parent.componentId)
|
||||
visible: {
|
||||
const prefs = root.getScreenPreferences(parent.componentId)
|
||||
const isAll = prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all")
|
||||
const cid = parent.componentId
|
||||
const isRelevantComponent = ["dankBar", "dock", "notifications", "osd", "toast", "notepad"].includes(cid) || cid.startsWith("bar:")
|
||||
return !isAll && isRelevantComponent
|
||||
const prefs = root.getScreenPreferences(parent.componentId);
|
||||
const isAll = prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all");
|
||||
const cid = parent.componentId;
|
||||
const isRelevantComponent = ["dankBar", "dock", "notifications", "osd", "toast", "notepad"].includes(cid) || cid.startsWith("bar:");
|
||||
return !isAll && isRelevantComponent;
|
||||
}
|
||||
onToggled: checked => {
|
||||
root.setShowOnLastDisplay(parent.componentId, checked)
|
||||
}
|
||||
root.setShowOnLastDisplay(parent.componentId, checked);
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -417,8 +424,8 @@ Item {
|
||||
color: Theme.outline
|
||||
opacity: 0.2
|
||||
visible: {
|
||||
var prefs = root.getScreenPreferences(parent.componentId)
|
||||
return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all")
|
||||
var prefs = root.getScreenPreferences(parent.componentId);
|
||||
return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,8 +433,8 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
visible: {
|
||||
var prefs = root.getScreenPreferences(parent.componentId)
|
||||
return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all")
|
||||
var prefs = root.getScreenPreferences(parent.componentId);
|
||||
return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all");
|
||||
}
|
||||
|
||||
Repeater {
|
||||
@@ -441,41 +448,41 @@ Item {
|
||||
text: SettingsData.getScreenDisplayName(screenData)
|
||||
description: screenData.width + "×" + screenData.height + " • " + (SettingsData.displayNameMode === "system" ? (screenData.model || "Unknown Model") : screenData.name)
|
||||
checked: {
|
||||
var prefs = root.getScreenPreferences(componentId)
|
||||
var prefs = root.getScreenPreferences(componentId);
|
||||
if (typeof prefs[0] === "string" && prefs[0] === "all")
|
||||
return false
|
||||
return SettingsData.isScreenInPreferences(screenData, prefs)
|
||||
return false;
|
||||
return SettingsData.isScreenInPreferences(screenData, prefs);
|
||||
}
|
||||
onToggled: checked => {
|
||||
var currentPrefs = root.getScreenPreferences(componentId)
|
||||
if (typeof currentPrefs[0] === "string" && currentPrefs[0] === "all") {
|
||||
currentPrefs = []
|
||||
}
|
||||
var currentPrefs = root.getScreenPreferences(componentId);
|
||||
if (typeof currentPrefs[0] === "string" && currentPrefs[0] === "all") {
|
||||
currentPrefs = [];
|
||||
}
|
||||
|
||||
const screenModelIndex = SettingsData.getScreenModelIndex(screenData)
|
||||
const screenModelIndex = SettingsData.getScreenModelIndex(screenData);
|
||||
|
||||
var newPrefs = currentPrefs.filter(pref => {
|
||||
if (typeof pref === "string")
|
||||
return false
|
||||
if (pref.modelIndex !== undefined && screenModelIndex >= 0) {
|
||||
return !(pref.model === screenData.model && pref.modelIndex === screenModelIndex)
|
||||
}
|
||||
return pref.name !== screenData.name || pref.model !== screenData.model
|
||||
})
|
||||
var newPrefs = currentPrefs.filter(pref => {
|
||||
if (typeof pref === "string")
|
||||
return false;
|
||||
if (pref.modelIndex !== undefined && screenModelIndex >= 0) {
|
||||
return !(pref.model === screenData.model && pref.modelIndex === screenModelIndex);
|
||||
}
|
||||
return pref.name !== screenData.name || pref.model !== screenData.model;
|
||||
});
|
||||
|
||||
if (checked) {
|
||||
const prefObj = {
|
||||
"name": screenData.name,
|
||||
"model": screenData.model || ""
|
||||
}
|
||||
if (screenModelIndex >= 0) {
|
||||
prefObj.modelIndex = screenModelIndex
|
||||
}
|
||||
newPrefs.push(prefObj)
|
||||
}
|
||||
if (checked) {
|
||||
const prefObj = {
|
||||
"name": screenData.name,
|
||||
"model": screenData.model || ""
|
||||
};
|
||||
if (screenModelIndex >= 0) {
|
||||
prefObj.modelIndex = screenModelIndex;
|
||||
}
|
||||
newPrefs.push(prefObj);
|
||||
}
|
||||
|
||||
root.setScreenPreferences(componentId, newPrefs)
|
||||
}
|
||||
root.setScreenPreferences(componentId, newPrefs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -10,14 +8,14 @@ Item {
|
||||
|
||||
function formatGammaTime(isoString) {
|
||||
if (!isoString)
|
||||
return ""
|
||||
return "";
|
||||
try {
|
||||
const date = new Date(isoString)
|
||||
const date = new Date(isoString);
|
||||
if (isNaN(date.getTime()))
|
||||
return ""
|
||||
return date.toLocaleTimeString(Qt.locale(), "HH:mm")
|
||||
return "";
|
||||
return date.toLocaleTimeString(Qt.locale(), "HH:mm");
|
||||
} catch (e) {
|
||||
return ""
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,17 +72,16 @@ Item {
|
||||
|
||||
width: parent.width
|
||||
text: I18n.tr("Night Mode")
|
||||
description: DisplayService.gammaControlAvailable ? I18n.tr("Apply warm color temperature to reduce eye strain. Use automation settings below to control when it activates.") : I18n.tr(
|
||||
"Gamma control not available. Requires DMS API v6+.")
|
||||
description: DisplayService.gammaControlAvailable ? I18n.tr("Apply warm color temperature to reduce eye strain. Use automation settings below to control when it activates.") : I18n.tr("Gamma control not available. Requires DMS API v6+.")
|
||||
checked: DisplayService.nightModeEnabled
|
||||
enabled: DisplayService.gammaControlAvailable
|
||||
onToggled: checked => {
|
||||
DisplayService.toggleNightMode()
|
||||
}
|
||||
DisplayService.toggleNightMode();
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onNightModeEnabledChanged() {
|
||||
nightModeToggle.checked = DisplayService.nightModeEnabled
|
||||
nightModeToggle.checked = DisplayService.nightModeEnabled;
|
||||
}
|
||||
|
||||
target: DisplayService
|
||||
@@ -104,19 +101,19 @@ Item {
|
||||
description: SessionData.nightModeAutoEnabled ? I18n.tr("Color temperature for night mode") : I18n.tr("Warm color temperature to apply")
|
||||
currentValue: SessionData.nightModeTemperature + "K"
|
||||
options: {
|
||||
var temps = []
|
||||
var temps = [];
|
||||
for (var i = 2500; i <= 6000; i += 500) {
|
||||
temps.push(i + "K")
|
||||
temps.push(i + "K");
|
||||
}
|
||||
return temps
|
||||
return temps;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
var temp = parseInt(value.replace("K", ""))
|
||||
SessionData.setNightModeTemperature(temp)
|
||||
if (SessionData.nightModeHighTemperature < temp) {
|
||||
SessionData.setNightModeHighTemperature(temp)
|
||||
}
|
||||
}
|
||||
var temp = parseInt(value.replace("K", ""));
|
||||
SessionData.setNightModeTemperature(temp);
|
||||
if (SessionData.nightModeHighTemperature < temp) {
|
||||
SessionData.setNightModeHighTemperature(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
@@ -126,19 +123,19 @@ Item {
|
||||
currentValue: SessionData.nightModeHighTemperature + "K"
|
||||
visible: SessionData.nightModeAutoEnabled
|
||||
options: {
|
||||
var temps = []
|
||||
var minTemp = SessionData.nightModeTemperature
|
||||
var temps = [];
|
||||
var minTemp = SessionData.nightModeTemperature;
|
||||
for (var i = Math.max(2500, minTemp); i <= 10000; i += 500) {
|
||||
temps.push(i + "K")
|
||||
temps.push(i + "K");
|
||||
}
|
||||
return temps
|
||||
return temps;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
var temp = parseInt(value.replace("K", ""))
|
||||
if (temp >= SessionData.nightModeTemperature) {
|
||||
SessionData.setNightModeHighTemperature(temp)
|
||||
}
|
||||
}
|
||||
var temp = parseInt(value.replace("K", ""));
|
||||
if (temp >= SessionData.nightModeTemperature) {
|
||||
SessionData.setNightModeHighTemperature(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,18 +147,18 @@ Item {
|
||||
checked: SessionData.nightModeAutoEnabled
|
||||
visible: DisplayService.gammaControlAvailable
|
||||
onToggled: checked => {
|
||||
if (checked && !DisplayService.nightModeEnabled) {
|
||||
DisplayService.toggleNightMode()
|
||||
} else if (!checked && DisplayService.nightModeEnabled) {
|
||||
DisplayService.toggleNightMode()
|
||||
}
|
||||
SessionData.setNightModeAutoEnabled(checked)
|
||||
}
|
||||
if (checked && !DisplayService.nightModeEnabled) {
|
||||
DisplayService.toggleNightMode();
|
||||
} else if (!checked && DisplayService.nightModeEnabled) {
|
||||
DisplayService.toggleNightMode();
|
||||
}
|
||||
SessionData.setNightModeAutoEnabled(checked);
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onNightModeAutoEnabledChanged() {
|
||||
automaticToggle.checked = SessionData.nightModeAutoEnabled
|
||||
automaticToggle.checked = SessionData.nightModeAutoEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +172,7 @@ Item {
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onNightModeAutoEnabledChanged() {
|
||||
automaticSettings.visible = SessionData.nightModeAutoEnabled
|
||||
automaticSettings.visible = SessionData.nightModeAutoEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,29 +185,32 @@ Item {
|
||||
width: 200
|
||||
height: 45
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
model: [{
|
||||
model: [
|
||||
{
|
||||
"text": "Time",
|
||||
"icon": "access_time"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"text": "Location",
|
||||
"icon": "place"
|
||||
}]
|
||||
}
|
||||
]
|
||||
|
||||
Component.onCompleted: {
|
||||
currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0
|
||||
Qt.callLater(updateIndicator)
|
||||
currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0;
|
||||
Qt.callLater(updateIndicator);
|
||||
}
|
||||
|
||||
onTabClicked: index => {
|
||||
DisplayService.setNightModeAutomationMode(index === 1 ? "location" : "time")
|
||||
currentIndex = index
|
||||
}
|
||||
DisplayService.setNightModeAutomationMode(index === 1 ? "location" : "time");
|
||||
currentIndex = index;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onNightModeAutoModeChanged() {
|
||||
modeTabBarNight.currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0
|
||||
Qt.callLater(modeTabBarNight.updateIndicator)
|
||||
modeTabBarNight.currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0;
|
||||
Qt.callLater(modeTabBarNight.updateIndicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,30 +267,30 @@ Item {
|
||||
dropdownWidth: 70
|
||||
currentValue: SessionData.nightModeStartHour.toString()
|
||||
options: {
|
||||
var hours = []
|
||||
var hours = [];
|
||||
for (var i = 0; i < 24; i++) {
|
||||
hours.push(i.toString())
|
||||
hours.push(i.toString());
|
||||
}
|
||||
return hours
|
||||
return hours;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
SessionData.setNightModeStartHour(parseInt(value))
|
||||
}
|
||||
SessionData.setNightModeStartHour(parseInt(value));
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
dropdownWidth: 70
|
||||
currentValue: SessionData.nightModeStartMinute.toString().padStart(2, '0')
|
||||
options: {
|
||||
var minutes = []
|
||||
var minutes = [];
|
||||
for (var i = 0; i < 60; i += 5) {
|
||||
minutes.push(i.toString().padStart(2, '0'))
|
||||
minutes.push(i.toString().padStart(2, '0'));
|
||||
}
|
||||
return minutes
|
||||
return minutes;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
SessionData.setNightModeStartMinute(parseInt(value))
|
||||
}
|
||||
SessionData.setNightModeStartMinute(parseInt(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,30 +310,30 @@ Item {
|
||||
dropdownWidth: 70
|
||||
currentValue: SessionData.nightModeEndHour.toString()
|
||||
options: {
|
||||
var hours = []
|
||||
var hours = [];
|
||||
for (var i = 0; i < 24; i++) {
|
||||
hours.push(i.toString())
|
||||
hours.push(i.toString());
|
||||
}
|
||||
return hours
|
||||
return hours;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
SessionData.setNightModeEndHour(parseInt(value))
|
||||
}
|
||||
SessionData.setNightModeEndHour(parseInt(value));
|
||||
}
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
dropdownWidth: 70
|
||||
currentValue: SessionData.nightModeEndMinute.toString().padStart(2, '0')
|
||||
options: {
|
||||
var minutes = []
|
||||
var minutes = [];
|
||||
for (var i = 0; i < 60; i += 5) {
|
||||
minutes.push(i.toString().padStart(2, '0'))
|
||||
minutes.push(i.toString().padStart(2, '0'));
|
||||
}
|
||||
return minutes
|
||||
return minutes;
|
||||
}
|
||||
onValueChanged: value => {
|
||||
SessionData.setNightModeEndMinute(parseInt(value))
|
||||
}
|
||||
SessionData.setNightModeEndMinute(parseInt(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,13 +352,13 @@ Item {
|
||||
description: I18n.tr("Automatically detect location based on IP address")
|
||||
checked: SessionData.nightModeUseIPLocation || false
|
||||
onToggled: checked => {
|
||||
SessionData.setNightModeUseIPLocation(checked)
|
||||
}
|
||||
SessionData.setNightModeUseIPLocation(checked);
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SessionData
|
||||
function onNightModeUseIPLocationChanged() {
|
||||
ipLocationToggle.checked = SessionData.nightModeUseIPLocation
|
||||
ipLocationToggle.checked = SessionData.nightModeUseIPLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,9 +393,9 @@ Item {
|
||||
text: SessionData.latitude.toString()
|
||||
placeholderText: "0.0"
|
||||
onEditingFinished: {
|
||||
const lat = parseFloat(text)
|
||||
const lat = parseFloat(text);
|
||||
if (!isNaN(lat) && lat >= -90 && lat <= 90 && lat !== SessionData.latitude) {
|
||||
SessionData.setLatitude(lat)
|
||||
SessionData.setLatitude(lat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,9 +416,9 @@ Item {
|
||||
text: SessionData.longitude.toString()
|
||||
placeholderText: "0.0"
|
||||
onEditingFinished: {
|
||||
const lon = parseFloat(text)
|
||||
const lon = parseFloat(text);
|
||||
if (!isNaN(lon) && lon >= -180 && lon <= 180 && lon !== SessionData.longitude) {
|
||||
SessionData.setLongitude(lon)
|
||||
SessionData.setLongitude(lon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,82 +272,77 @@ Singleton {
|
||||
|
||||
function generateOutputsConfig(outputsData) {
|
||||
if (!outputsData || Object.keys(outputsData).length === 0)
|
||||
return
|
||||
|
||||
let lines = ["# Auto-generated by DMS - do not edit manually", "# VRR is global: set adaptive_sync=1 in config.conf", ""]
|
||||
return;
|
||||
let lines = ["# Auto-generated by DMS - do not edit manually", "# VRR is global: set adaptive_sync=1 in config.conf", ""];
|
||||
|
||||
for (const outputName in outputsData) {
|
||||
const output = outputsData[outputName]
|
||||
const output = outputsData[outputName];
|
||||
if (!output)
|
||||
continue
|
||||
|
||||
let width = 1920
|
||||
let height = 1080
|
||||
let refreshRate = 60
|
||||
continue;
|
||||
let width = 1920;
|
||||
let height = 1080;
|
||||
let refreshRate = 60;
|
||||
if (output.modes && output.current_mode !== undefined) {
|
||||
const mode = output.modes[output.current_mode]
|
||||
const mode = output.modes[output.current_mode];
|
||||
if (mode) {
|
||||
width = mode.width || 1920
|
||||
height = mode.height || 1080
|
||||
refreshRate = Math.round((mode.refresh_rate || 60000) / 1000)
|
||||
width = mode.width || 1920;
|
||||
height = mode.height || 1080;
|
||||
refreshRate = Math.round((mode.refresh_rate || 60000) / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
const x = output.logical?.x ?? 0
|
||||
const y = output.logical?.y ?? 0
|
||||
const scale = output.logical?.scale ?? 1.0
|
||||
const transform = transformToMango(output.logical?.transform ?? "Normal")
|
||||
const x = output.logical?.x ?? 0;
|
||||
const y = output.logical?.y ?? 0;
|
||||
const scale = output.logical?.scale ?? 1.0;
|
||||
const transform = transformToMango(output.logical?.transform ?? "Normal");
|
||||
|
||||
const rule = [
|
||||
outputName,
|
||||
"0.55",
|
||||
"1",
|
||||
"tile",
|
||||
transform,
|
||||
scale,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
refreshRate
|
||||
].join(",")
|
||||
const rule = [outputName, "0.55", "1", "tile", transform, scale, x, y, width, height, refreshRate].join(",");
|
||||
|
||||
lines.push("monitorrule=" + rule)
|
||||
lines.push("monitorrule=" + rule);
|
||||
}
|
||||
|
||||
lines.push("")
|
||||
lines.push("");
|
||||
|
||||
const content = lines.join("\n")
|
||||
const content = lines.join("\n");
|
||||
|
||||
Proc.runCommand("mango-write-outputs", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && cat > "${outputsPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("DwlService: Failed to write outputs config:", output)
|
||||
return
|
||||
console.warn("DwlService: Failed to write outputs config:", output);
|
||||
return;
|
||||
}
|
||||
console.info("DwlService: Generated outputs config at", outputsPath)
|
||||
console.info("DwlService: Generated outputs config at", outputsPath);
|
||||
if (CompositorService.isDwl)
|
||||
reloadConfig()
|
||||
})
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
|
||||
function reloadConfig() {
|
||||
Proc.runCommand("mango-reload", ["mmsg", "-d", "reload_config"], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("DwlService: mmsg reload_config failed:", output)
|
||||
})
|
||||
console.warn("DwlService: mmsg reload_config failed:", output);
|
||||
});
|
||||
}
|
||||
|
||||
function transformToMango(transform) {
|
||||
switch (transform) {
|
||||
case "Normal": return 0
|
||||
case "90": return 1
|
||||
case "180": return 2
|
||||
case "270": return 3
|
||||
case "Flipped": return 4
|
||||
case "Flipped90": return 5
|
||||
case "Flipped180": return 6
|
||||
case "Flipped270": return 7
|
||||
default: return 0
|
||||
case "Normal":
|
||||
return 0;
|
||||
case "90":
|
||||
return 1;
|
||||
case "180":
|
||||
return 2;
|
||||
case "270":
|
||||
return 3;
|
||||
case "Flipped":
|
||||
return 4;
|
||||
case "Flipped90":
|
||||
return 5;
|
||||
case "Flipped180":
|
||||
return 6;
|
||||
case "Flipped270":
|
||||
return 7;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ pragma ComponentBehavior: Bound
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import qs.Common
|
||||
|
||||
Singleton {
|
||||
@@ -16,95 +15,111 @@ Singleton {
|
||||
|
||||
function getOutputIdentifier(output, outputName) {
|
||||
if (SettingsData.displayNameMode === "model" && output.make && output.model) {
|
||||
return "desc:" + output.make + " " + output.model
|
||||
return "desc:" + output.make + " " + output.model;
|
||||
}
|
||||
return outputName
|
||||
return outputName;
|
||||
}
|
||||
|
||||
function generateOutputsConfig(outputsData) {
|
||||
if (!outputsData || Object.keys(outputsData).length === 0)
|
||||
return
|
||||
|
||||
let lines = ["# Auto-generated by DMS - do not edit manually", ""]
|
||||
return;
|
||||
let lines = ["# Auto-generated by DMS - do not edit manually", ""];
|
||||
|
||||
for (const outputName in outputsData) {
|
||||
const output = outputsData[outputName]
|
||||
const output = outputsData[outputName];
|
||||
if (!output)
|
||||
continue
|
||||
|
||||
let resolution = "preferred"
|
||||
continue;
|
||||
let resolution = "preferred";
|
||||
if (output.modes && output.current_mode !== undefined) {
|
||||
const mode = output.modes[output.current_mode]
|
||||
const mode = output.modes[output.current_mode];
|
||||
if (mode)
|
||||
resolution = mode.width + "x" + mode.height + "@" + (mode.refresh_rate / 1000).toFixed(3)
|
||||
resolution = mode.width + "x" + mode.height + "@" + (mode.refresh_rate / 1000).toFixed(3);
|
||||
}
|
||||
|
||||
const x = output.logical?.x ?? 0
|
||||
const y = output.logical?.y ?? 0
|
||||
const position = x + "x" + y
|
||||
const x = output.logical?.x ?? 0;
|
||||
const y = output.logical?.y ?? 0;
|
||||
const position = x + "x" + y;
|
||||
|
||||
const scale = output.logical?.scale ?? 1.0
|
||||
const scale = output.logical?.scale ?? 1.0;
|
||||
|
||||
const identifier = getOutputIdentifier(output, outputName)
|
||||
let monitorLine = "monitor = " + identifier + ", " + resolution + ", " + position + ", " + scale
|
||||
const identifier = getOutputIdentifier(output, outputName);
|
||||
let monitorLine = "monitor = " + identifier + ", " + resolution + ", " + position + ", " + scale;
|
||||
|
||||
const transform = transformToHyprland(output.logical?.transform ?? "Normal")
|
||||
const transform = transformToHyprland(output.logical?.transform ?? "Normal");
|
||||
if (transform !== 0)
|
||||
monitorLine += ", transform, " + transform
|
||||
monitorLine += ", transform, " + transform;
|
||||
|
||||
if (output.vrr_supported && output.vrr_enabled)
|
||||
monitorLine += ", vrr, 1"
|
||||
monitorLine += ", vrr, 1";
|
||||
|
||||
lines.push(monitorLine)
|
||||
lines.push(monitorLine);
|
||||
}
|
||||
|
||||
lines.push("")
|
||||
lines.push("");
|
||||
|
||||
const content = lines.join("\n")
|
||||
const content = lines.join("\n");
|
||||
|
||||
Proc.runCommand("hypr-write-outputs", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && cat > "${outputsPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("HyprlandService: Failed to write outputs config:", output)
|
||||
return
|
||||
console.warn("HyprlandService: Failed to write outputs config:", output);
|
||||
return;
|
||||
}
|
||||
console.info("HyprlandService: Generated outputs config at", outputsPath)
|
||||
console.info("HyprlandService: Generated outputs config at", outputsPath);
|
||||
if (CompositorService.isHyprland)
|
||||
reloadConfig()
|
||||
})
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
|
||||
function reloadConfig() {
|
||||
Proc.runCommand("hyprctl-reload", ["hyprctl", "reload"], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("HyprlandService: hyprctl reload failed:", output)
|
||||
})
|
||||
console.warn("HyprlandService: hyprctl reload failed:", output);
|
||||
});
|
||||
}
|
||||
|
||||
function transformToHyprland(transform) {
|
||||
switch (transform) {
|
||||
case "Normal": return 0
|
||||
case "90": return 1
|
||||
case "180": return 2
|
||||
case "270": return 3
|
||||
case "Flipped": return 4
|
||||
case "Flipped90": return 5
|
||||
case "Flipped180": return 6
|
||||
case "Flipped270": return 7
|
||||
default: return 0
|
||||
case "Normal":
|
||||
return 0;
|
||||
case "90":
|
||||
return 1;
|
||||
case "180":
|
||||
return 2;
|
||||
case "270":
|
||||
return 3;
|
||||
case "Flipped":
|
||||
return 4;
|
||||
case "Flipped90":
|
||||
return 5;
|
||||
case "Flipped180":
|
||||
return 6;
|
||||
case "Flipped270":
|
||||
return 7;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function hyprlandToTransform(value) {
|
||||
switch (value) {
|
||||
case 0: return "Normal"
|
||||
case 1: return "90"
|
||||
case 2: return "180"
|
||||
case 3: return "270"
|
||||
case 4: return "Flipped"
|
||||
case 5: return "Flipped90"
|
||||
case 6: return "Flipped180"
|
||||
case 7: return "Flipped270"
|
||||
default: return "Normal"
|
||||
case 0:
|
||||
return "Normal";
|
||||
case 1:
|
||||
return "90";
|
||||
case 2:
|
||||
return "180";
|
||||
case 3:
|
||||
return "270";
|
||||
case 4:
|
||||
return "Flipped";
|
||||
case 5:
|
||||
return "Flipped90";
|
||||
case 6:
|
||||
return "Flipped180";
|
||||
case 7:
|
||||
return "Flipped270";
|
||||
default:
|
||||
return "Normal";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[templates.dmsghostty]
|
||||
input_path = 'SHELL_DIR/matugen/templates/ghostty.conf'
|
||||
output_path = '~/.config/ghostty/config-dankcolors'
|
||||
output_path = '~/.config/ghostty/themes/dankcolors'
|
||||
|
||||
Reference in New Issue
Block a user