1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

displays: add niri-specific layout options to configurator

This commit is contained in:
bbedward
2025-12-16 12:23:34 -05:00
parent f6b09751e9
commit ff506548d3
9 changed files with 1028 additions and 303 deletions

View File

@@ -14,34 +14,63 @@ Distribution-aware installer with TUI for deploying DMS and compositor configura
## System Integration
**Wayland Protocols**
- `wlr-gamma-control-unstable-v1` - Night mode and gamma control
- `wlr-screencopy-unstable-v1` - Screen capture for color picker
- `wlr-layer-shell-unstable-v1` - Overlay surfaces for color picker
- `wp-viewporter` - Fractional scaling support
- `dwl-ipc-unstable-v2` - dwl/MangoWC workspace integration
- `ext-workspace-v1` - Workspace protocol support
- `wlr-output-management-unstable-v1` - Display configuration
### Wayland Protocols (Client)
**DBus Interfaces**
- NetworkManager/iwd - Network management
- logind - Session control and inhibit locks
- accountsservice - User account information
- CUPS - Printer management
- Custom IPC via unix socket (JSON API)
All Wayland protocols are consumed as a client - connecting to the compositor.
**Hardware Control**
- DDC/CI protocol - External monitor brightness control (like `ddcutil`)
- Backlight control - Internal display brightness via `login1` or sysfs
- LED control - Keyboard/device LED management
- evdev input monitoring - Keyboard state tracking (caps lock, etc.)
| Protocol | Purpose |
| ----------------------------------------- | ----------------------------------------------------------- |
| `wlr-gamma-control-unstable-v1` | Night mode color temperature control |
| `wlr-screencopy-unstable-v1` | Screen capture for color picker/screenshot |
| `wlr-layer-shell-unstable-v1` | Overlay surfaces for color picker UI/screenshot |
| `wlr-output-management-unstable-v1` | Display configuration |
| `wlr-output-power-management-unstable-v1` | DPMS on/off CLI |
| `wp-viewporter` | Fractional scaling support (color picker/screenshot UIs) |
| `keyboard-shortcuts-inhibit-unstable-v1` | Inhibit compositor shortcuts during color picker/screenshot |
| `ext-data-control-v1` | Clipboard history and persistence |
| `ext-workspace-v1` | Workspace integration |
| `dwl-ipc-unstable-v2` | dwl/MangoWC IPC for tags, outputs, etc. |
### DBus Interfaces
**Client (consuming external services):**
| Interface | Purpose |
| -------------------------------- | --------------------------------------------- |
| `org.bluez` | Bluetooth management with pairing agent |
| `org.freedesktop.NetworkManager` | Network management |
| `net.connman.iwd` | iwd Wi-Fi backend |
| `org.freedesktop.network1` | systemd-networkd integration |
| `org.freedesktop.login1` | Session control, sleep inhibitors, brightness |
| `org.freedesktop.Accounts` | User account information |
| `org.freedesktop.portal.Desktop` | Desktop appearance settings (color scheme) |
| CUPS via IPP + D-Bus | Printer management with job notifications |
**Server (implementing interfaces):**
| Interface | Purpose |
| ----------------------------- | -------------------------------------- |
| `org.freedesktop.ScreenSaver` | Screensaver inhibit for video playback |
Custom IPC via unix socket (JSON API) for shell communication.
### Hardware Control
| Subsystem | Method | Purpose |
| --------- | ------------------- | ---------------------------------- |
| DDC/CI | I2C direct | External monitor brightness |
| Backlight | logind or sysfs | Internal display brightness |
| evdev | `/dev/input/event*` | Keyboard state (caps lock LED) |
| udev | netlink monitor | Backlight device updates (for OSD) |
### Plugin System
**Plugin System**
- Plugin registry integration
- Plugin lifecycle management
- Settings persistence
## CLI Commands
- `dms run [-d]` - Start shell (optionally as daemon)
- `dms restart` / `dms kill` - Manage running processes
- `dms ipc <command>` - Send IPC commands (toggle launcher, notifications, etc.)
@@ -70,6 +99,7 @@ The on-screen preview displays the selected format. JSON output includes hex, RG
Requires Go 1.24+
**Development build:**
```bash
make # Build dms CLI
make dankinstall # Build installer
@@ -77,6 +107,7 @@ make test # Run tests
```
**Distribution build:**
```bash
make dist # Build without update/greeter features
```
@@ -84,6 +115,7 @@ make dist # Build without update/greeter features
Produces `bin/dms-linux-amd64` and `bin/dms-linux-arm64`
**Installation:**
```bash
sudo make install # Install to /usr/local/bin/dms
```
@@ -91,6 +123,7 @@ sudo make install # Install to /usr/local/bin/dms
## Development
**Setup pre-commit hooks:**
```bash
git config core.hooksPath .githooks
```
@@ -98,6 +131,7 @@ git config core.hooksPath .githooks
This runs gofmt, golangci-lint, tests, and builds before each commit when `core/` files are staged.
**Regenerating Wayland Protocol Bindings:**
```bash
go install github.com/rajveermalviya/go-wayland/cmd/go-wayland-scanner@latest
go-wayland-scanner -i internal/proto/xml/wlr-gamma-control-unstable-v1.xml \
@@ -105,6 +139,7 @@ go-wayland-scanner -i internal/proto/xml/wlr-gamma-control-unstable-v1.xml \
```
**Module Structure:**
- `cmd/` - Binary entrypoints (dms, dankinstall)
- `internal/distros/` - Distribution-specific installation logic
- `internal/proto/` - Wayland protocol bindings

View File

@@ -1,5 +1,5 @@
pragma Singleton
pragma ComponentBehavior: Bound
pragma ComponentBehavior
import QtCore
import QtQuick
@@ -360,47 +360,48 @@ Singleton {
property string displayNameMode: "system"
property var screenPreferences: ({})
property var showOnLastDisplay: ({})
property var niriOutputSettings: ({})
property var barConfigs: [
{
id: "default",
name: "Main Bar",
enabled: true,
position: 0,
screenPreferences: ["all"],
showOnLastDisplay: true,
leftWidgets: ["launcherButton", "workspaceSwitcher", "focusedWindow"],
centerWidgets: ["music", "clock", "weather"],
rightWidgets: ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"],
spacing: 4,
innerPadding: 4,
bottomGap: 0,
transparency: 1.0,
widgetTransparency: 1.0,
squareCorners: false,
noBackground: false,
gothCornersEnabled: false,
gothCornerRadiusOverride: false,
gothCornerRadiusValue: 12,
borderEnabled: false,
borderColor: "surfaceText",
borderOpacity: 1.0,
borderThickness: 1,
widgetOutlineEnabled: false,
widgetOutlineColor: "primary",
widgetOutlineOpacity: 1.0,
widgetOutlineThickness: 1,
fontScale: 1.0,
autoHide: false,
autoHideDelay: 250,
openOnOverview: false,
visible: true,
popupGapsAuto: true,
popupGapsManual: 4,
maximizeDetection: true,
scrollEnabled: true,
scrollXBehavior: "column",
scrollYBehavior: "workspace"
"id": "default",
"name": "Main Bar",
"enabled": true,
"position": 0,
"screenPreferences": ["all"],
"showOnLastDisplay": true,
"leftWidgets": ["launcherButton", "workspaceSwitcher", "focusedWindow"],
"centerWidgets": ["music", "clock", "weather"],
"rightWidgets": ["systemTray", "clipboard", "cpuUsage", "memUsage", "notificationButton", "battery", "controlCenterButton"],
"spacing": 4,
"innerPadding": 4,
"bottomGap": 0,
"transparency": 1.0,
"widgetTransparency": 1.0,
"squareCorners": false,
"noBackground": false,
"gothCornersEnabled": false,
"gothCornerRadiusOverride": false,
"gothCornerRadiusValue": 12,
"borderEnabled": false,
"borderColor": "surfaceText",
"borderOpacity": 1.0,
"borderThickness": 1,
"widgetOutlineEnabled": false,
"widgetOutlineColor": "primary",
"widgetOutlineOpacity": 1.0,
"widgetOutlineThickness": 1,
"fontScale": 1.0,
"autoHide": false,
"autoHideDelay": 250,
"openOnOverview": false,
"visible": true,
"popupGapsAuto": true,
"popupGapsManual": 4,
"maximizeDetection": true,
"scrollEnabled": true,
"scrollXBehavior": "column",
"scrollYBehavior": "workspace"
}
]
@@ -458,7 +459,7 @@ Singleton {
const configScript = `mkdir -p ${_configDir}/gtk-3.0 ${_configDir}/gtk-4.0
for config_dir in ${_configDir}/gtk-3.0 ${_configDir}/gtk-4.0; do
for config_dir in ${_configDir}/gtk-3.0 ${_configDir}/gtk-4.0; do
settings_file="$config_dir/settings.ini"
if [ -f "$settings_file" ]; then
if grep -q "^gtk-icon-theme-name=" "$settings_file"; then
@@ -473,10 +474,10 @@ for config_dir in ${_configDir}/gtk-3.0 ${_configDir}/gtk-4.0; do
else
echo -e '[Settings]\\ngtk-icon-theme-name=${gtkThemeName}' > "$settings_file"
fi
done
done
rm -rf ~/.cache/icon-cache ~/.cache/thumbnails 2>/dev/null || true
pkill -HUP -f 'gtk' 2>/dev/null || true`;
rm -rf ~/.cache/icon-cache ~/.cache/thumbnails 2>/dev/null || true
pkill -HUP -f 'gtk' 2>/dev/null || true`;
Quickshell.execDetached(["sh", "-lc", configScript]);
}
@@ -489,7 +490,7 @@ pkill -HUP -f 'gtk' 2>/dev/null || true`;
const qtThemeNameEscaped = qtThemeName.replace(/'/g, "'\\''");
const script = `mkdir -p ${_configDir}/qt5ct ${_configDir}/qt6ct ${_configDir}/environment.d 2>/dev/null || true
update_qt_icon_theme() {
update_qt_icon_theme() {
local config_file="$1"
local theme_name="$2"
if [ -f "$config_file" ]; then
@@ -505,20 +506,20 @@ update_qt_icon_theme() {
else
printf "[Appearance]\\nicon_theme=%s\\n" "$theme_name" > "$config_file"
fi
}
update_qt_icon_theme ${_configDir}/qt5ct/qt5ct.conf '${qtThemeNameEscaped}'
update_qt_icon_theme ${_configDir}/qt6ct/qt6ct.conf '${qtThemeNameEscaped}'
rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || true`;
}
update_qt_icon_theme ${_configDir}/qt5ct/qt5ct.conf '${qtThemeNameEscaped}'
update_qt_icon_theme ${_configDir}/qt6ct/qt6ct.conf '${qtThemeNameEscaped}'
rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || true`;
Quickshell.execDetached(["sh", "-lc", script]);
}
readonly property var _hooks: ({
applyStoredTheme: applyStoredTheme,
regenSystemThemes: regenSystemThemes,
updateNiriLayout: updateNiriLayout,
applyStoredIconTheme: applyStoredIconTheme,
updateBarConfigs: updateBarConfigs
"applyStoredTheme": applyStoredTheme,
"regenSystemThemes": regenSystemThemes,
"updateNiriLayout": updateNiriLayout,
"applyStoredIconTheme": applyStoredIconTheme,
"updateBarConfigs": updateBarConfigs
})
function set(key, value) {
@@ -723,7 +724,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
let leftBar = 0;
let rightBar = 0;
for (let i = 0; i < enabledBars.length; i++) {
for (var i = 0; i < enabledBars.length; i++) {
const other = enabledBars[i];
if (other.id === barConfig.id)
continue;
@@ -793,7 +794,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
if (barConfig) {
const enabledBars = getEnabledBarConfigs();
for (let i = 0; i < enabledBars.length; i++) {
for (var i = 0; i < enabledBars.length; i++) {
const other = enabledBars[i];
if (other.id === barConfig.id)
continue;
@@ -925,7 +926,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const conflicts = [];
const enabledBars = getEnabledBarConfigs();
for (let i = 0; i < enabledBars.length; i++) {
for (var i = 0; i < enabledBars.length; i++) {
const other = enabledBars[i];
if (other.id === barId)
continue;
@@ -938,9 +939,9 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const hasAll = barScreens.includes("all") || otherScreens.includes("all");
if (hasAll) {
conflicts.push({
barId: other.id,
barName: other.name,
reason: "Same position on all screens"
"barId": other.id,
"barName": other.name,
"reason": "Same position on all screens"
});
continue;
}
@@ -948,9 +949,9 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const overlapping = barScreens.some(screen => otherScreens.includes(screen));
if (overlapping) {
conflicts.push({
barId: other.id,
barName: other.name,
reason: "Same position on overlapping screens"
"barId": other.id,
"barName": other.name,
"reason": "Same position on overlapping screens"
});
}
}
@@ -972,7 +973,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
function getScreensSortedByPosition() {
const screens = [];
for (let i = 0; i < Quickshell.screens.length; i++) {
for (var i = 0; i < Quickshell.screens.length; i++) {
screens.push(Quickshell.screens[i]);
}
screens.sort((a, b) => {
@@ -989,7 +990,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const sorted = getScreensSortedByPosition();
let modelCount = 0;
let screenIndex = -1;
for (let i = 0; i < sorted.length; i++) {
for (var i = 0; i < sorted.length; i++) {
if (sorted[i].model === screen.model) {
if (sorted[i].name === screen.name) {
screenIndex = modelCount;
@@ -1187,7 +1188,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
spacing: spacing
"spacing": spacing
});
}
if (typeof NiriService !== "undefined" && CompositorService.isNiri) {
@@ -1216,7 +1217,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
return;
}
updateBarConfig(defaultBar.id, {
position: position
"position": position
});
}
@@ -1224,7 +1225,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
leftWidgets: order
"leftWidgets": order
});
updateListModel(leftWidgetsModel, order);
}
@@ -1234,7 +1235,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
centerWidgets: order
"centerWidgets": order
});
updateListModel(centerWidgetsModel, order);
}
@@ -1244,7 +1245,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
rightWidgets: order
"rightWidgets": order
});
updateListModel(rightWidgetsModel, order);
}
@@ -1257,9 +1258,9 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
leftWidgets: defaultLeft,
centerWidgets: defaultCenter,
rightWidgets: defaultRight
"leftWidgets": defaultLeft,
"centerWidgets": defaultCenter,
"rightWidgets": defaultRight
});
}
updateListModel(leftWidgetsModel, defaultLeft);
@@ -1307,7 +1308,7 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
const defaultBar = barConfigs[0] || getBarConfig("default");
if (defaultBar) {
updateBarConfig(defaultBar.id, {
visible: !defaultBar.visible
"visible": !defaultBar.visible
});
}
}
@@ -1345,6 +1346,42 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
return settings ? JSON.parse(JSON.stringify(settings)) : {};
}
function getNiriOutputSetting(outputId, key, defaultValue) {
if (!niriOutputSettings[outputId])
return defaultValue;
return niriOutputSettings[outputId][key] !== undefined ? niriOutputSettings[outputId][key] : defaultValue;
}
function setNiriOutputSetting(outputId, key, value) {
const updated = JSON.parse(JSON.stringify(niriOutputSettings));
if (!updated[outputId])
updated[outputId] = {};
updated[outputId][key] = value;
niriOutputSettings = updated;
saveSettings();
}
function getNiriOutputSettings(outputId) {
const settings = niriOutputSettings[outputId];
return settings ? JSON.parse(JSON.stringify(settings)) : {};
}
function setNiriOutputSettings(outputId, settings) {
const updated = JSON.parse(JSON.stringify(niriOutputSettings));
updated[outputId] = settings;
niriOutputSettings = updated;
saveSettings();
}
function removeNiriOutputSettings(outputId) {
if (!niriOutputSettings[outputId])
return;
const updated = JSON.parse(JSON.stringify(niriOutputSettings));
delete updated[outputId];
niriOutputSettings = updated;
saveSettings();
}
ListModel {
id: leftWidgetsModel
}

View File

@@ -258,6 +258,7 @@ var SPEC = {
displayNameMode: { def: "system" },
screenPreferences: { def: {} },
showOnLastDisplay: { def: {} },
niriOutputSettings: { def: {} },
barConfigs: { def: [{
id: "default",

View File

@@ -32,11 +32,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: timeWeatherLoader
@@ -48,11 +47,10 @@ FocusScope {
sourceComponent: TimeWeatherTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: keybindsLoader
@@ -66,11 +64,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: topBarLoader
@@ -84,11 +81,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: workspacesLoader
@@ -100,11 +96,10 @@ FocusScope {
sourceComponent: WorkspacesTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: dockLoader
@@ -118,11 +113,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: displayConfigLoader
@@ -134,11 +128,10 @@ FocusScope {
sourceComponent: DisplayConfigTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: gammaControlLoader
@@ -150,11 +143,10 @@ FocusScope {
sourceComponent: GammaControlTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: displayWidgetsLoader
@@ -166,11 +158,10 @@ FocusScope {
sourceComponent: DisplayWidgetsTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: networkLoader
@@ -182,11 +173,10 @@ FocusScope {
sourceComponent: NetworkTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: printerLoader
@@ -198,11 +188,10 @@ FocusScope {
sourceComponent: PrinterTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: launcherLoader
@@ -214,11 +203,10 @@ FocusScope {
sourceComponent: LauncherTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: themeColorsLoader
@@ -230,11 +218,10 @@ FocusScope {
sourceComponent: ThemeColorsTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: lockScreenLoader
@@ -246,11 +233,10 @@ FocusScope {
sourceComponent: LockScreenTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: pluginsLoader
@@ -264,11 +250,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: aboutLoader
@@ -280,11 +265,10 @@ FocusScope {
sourceComponent: AboutTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: typographyMotionLoader
@@ -296,11 +280,10 @@ FocusScope {
sourceComponent: TypographyMotionTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: soundsLoader
@@ -312,11 +295,10 @@ FocusScope {
sourceComponent: SoundsTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: mediaPlayerLoader
@@ -328,11 +310,10 @@ FocusScope {
sourceComponent: MediaPlayerTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: notificationsLoader
@@ -344,11 +325,10 @@ FocusScope {
sourceComponent: NotificationsTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: osdLoader
@@ -360,11 +340,10 @@ FocusScope {
sourceComponent: OSDTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: runningAppsLoader
@@ -376,11 +355,10 @@ FocusScope {
sourceComponent: RunningAppsTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: systemUpdaterLoader
@@ -392,11 +370,10 @@ FocusScope {
sourceComponent: SystemUpdaterTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: powerSleepLoader
@@ -408,11 +385,10 @@ FocusScope {
sourceComponent: PowerSleepTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: widgetsLoader
@@ -426,11 +402,10 @@ FocusScope {
}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
Loader {
id: clipboardLoader
@@ -442,10 +417,9 @@ FocusScope {
sourceComponent: ClipboardTab {}
onActiveChanged: {
if (active && item) {
if (active && item)
Qt.callLater(() => item.forceActiveFocus());
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -32,15 +32,17 @@ StyledRect {
readonly property bool collapsed: collapsible && !expanded
readonly property bool hasHeader: root.title !== "" || root.iconName !== ""
property bool animationsEnabled: false
Component.onCompleted: Qt.callLater(() => animationsEnabled = true)
property bool userToggledCollapse: false
Behavior on height {
enabled: root.animationsEnabled
enabled: root.userToggledCollapse
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
onRunningChanged: {
if (!running)
root.userToggledCollapse = false;
}
}
}
@@ -98,6 +100,7 @@ StyledRect {
onClicked: {
if (!root.collapsible)
return;
root.userToggledCollapse = true;
root.expanded = !root.expanded;
}
}
@@ -108,14 +111,6 @@ StyledRect {
width: parent.width
spacing: Theme.spacingM
visible: !root.collapsed
opacity: root.collapsed ? 0 : 1
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
}
}
}
}
}

View File

@@ -580,7 +580,6 @@ Singleton {
const windowIndex = windows.findIndex(w => w.id === data.id);
if (windowIndex < 0)
return;
const updatedWindows = [...windows];
const updatedWindow = {};
for (let prop in updatedWindows[windowIndex]) {
@@ -1140,8 +1139,15 @@ Singleton {
for (const outputName in data) {
const output = data[outputName];
const identifier = getOutputIdentifier(output, outputName);
const niriSettings = SettingsData.getNiriOutputSettings(identifier);
kdlContent += `output "${identifier}" {\n`;
if (niriSettings.disabled) {
kdlContent += ` off\n}\n\n`;
continue;
}
if (output.current_mode !== undefined && output.modes && output.modes[output.current_mode]) {
const mode = output.modes[output.current_mode];
kdlContent += ` mode "${mode.width}x${mode.height}@${(mode.refresh_rate / 1000).toFixed(3)}"\n`;
@@ -1172,9 +1178,21 @@ Singleton {
}
if (output.vrr_enabled) {
kdlContent += ` variable-refresh-rate\n`;
const vrrOnDemand = niriSettings.vrrOnDemand ?? false;
kdlContent += vrrOnDemand ? ` variable-refresh-rate on-demand=true\n` : ` variable-refresh-rate\n`;
}
if (niriSettings.focusAtStartup) {
kdlContent += ` focus-at-startup\n`;
}
if (niriSettings.backdropColor) {
kdlContent += ` backdrop-color "${niriSettings.backdropColor}"\n`;
}
kdlContent += generateHotCornersBlock(niriSettings);
kdlContent += generateLayoutBlock(niriSettings);
kdlContent += `}\n\n`;
}
@@ -1191,6 +1209,49 @@ Singleton {
});
}
function generateHotCornersBlock(niriSettings) {
if (!niriSettings.hotCorners)
return "";
const hc = niriSettings.hotCorners;
if (hc.off)
return ` hot-corners {\n off\n }\n`;
const corners = hc.corners || [];
if (corners.length === 0)
return "";
let block = ` hot-corners {\n`;
for (const corner of corners) {
block += ` ${corner}\n`;
}
block += ` }\n`;
return block;
}
function generateLayoutBlock(niriSettings) {
if (!niriSettings.layout)
return "";
const layout = niriSettings.layout;
const hasSettings = layout.gaps !== undefined || layout.defaultColumnWidth || layout.presetColumnWidths || layout.alwaysCenterSingleColumn !== undefined;
if (!hasSettings)
return "";
let block = ` layout {\n`;
if (layout.gaps !== undefined)
block += ` gaps ${layout.gaps}\n`;
if (layout.defaultColumnWidth?.type === "proportion")
block += ` default-column-width { proportion ${layout.defaultColumnWidth.value}; }\n`;
if (layout.presetColumnWidths && layout.presetColumnWidths.length > 0) {
block += ` preset-column-widths {\n`;
for (const preset of layout.presetColumnWidths) {
if (preset.type === "proportion")
block += ` proportion ${preset.value}\n`;
}
block += ` }\n`;
}
if (layout.alwaysCenterSingleColumn !== undefined)
block += layout.alwaysCenterSingleColumn ? ` always-center-single-column\n` : ` always-center-single-column false\n`;
block += ` }\n`;
return block;
}
IpcHandler {
function screenshot(): string {
if (!CompositorService.isNiri) {

View File

@@ -16,7 +16,7 @@ Rectangle {
property int buttonHeight: 40
property int horizontalPadding: Theme.spacingL
signal clicked()
signal clicked
width: Math.max(contentRow.implicitWidth + horizontalPadding * 2, 64)
height: buttonHeight
@@ -29,9 +29,11 @@ Rectangle {
anchors.fill: parent
radius: parent.radius
color: {
if (pressed) return Theme.primaryPressed
if (hovered) return Theme.primaryHover
return "transparent"
if (pressed)
return Theme.primaryPressed;
if (hovered)
return Theme.primaryHover;
return "transparent";
}
Behavior on color {

View File

@@ -18,6 +18,7 @@ Flow {
property int buttonPadding: Theme.spacingL
property int checkIconSize: Theme.iconSizeSmall
property int textSize: Theme.fontSizeMedium
property bool userInteracted: false
signal selectionChanged(int index, bool selected)
signal animationCompleted()
@@ -27,7 +28,10 @@ Flow {
Timer {
id: animationTimer
interval: Theme.shortDuration
onTriggered: root.animationCompleted()
onTriggered: {
root.userInteracted = false;
root.animationCompleted();
}
}
function isSelected(index) {
@@ -38,6 +42,7 @@ Flow {
}
function selectItem(index) {
userInteracted = true;
if (multiSelect) {
const modelValue = model[index]
let newSelection = [...currentSelection]
@@ -93,6 +98,7 @@ Flow {
bottomRightRadius: (isLast || selected) ? Theme.cornerRadius : 4
Behavior on width {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -100,6 +106,7 @@ Flow {
}
Behavior on topLeftRadius {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -107,6 +114,7 @@ Flow {
}
Behavior on topRightRadius {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -114,6 +122,7 @@ Flow {
}
Behavior on bottomLeftRadius {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -121,6 +130,7 @@ Flow {
}
Behavior on bottomRightRadius {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -128,6 +138,7 @@ Flow {
}
Behavior on color {
enabled: root.userInteracted
ColorAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -176,6 +187,7 @@ Flow {
anchors.verticalCenter: parent.verticalCenter
Behavior on opacity {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.standardEasing
@@ -183,6 +195,7 @@ Flow {
}
Behavior on scale {
enabled: root.userInteracted
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing