Files
noctalia-shell/Modules/Bar/Widgets/WallpaperSelector.qml
T
Florian Boulay 107ea5698a Add screen argument to IPC wallpaper random
* Add argument to specify on which screen to apply a random wallpaper
* if `all` is provided, the old behavior is kept: a random wallpaper is
applied to all screen.
2026-02-05 13:22:08 +01:00

62 lines
1.5 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import qs.Commons
import qs.Modules.Bar.Extras
import qs.Services.UI
import qs.Widgets
NIconButton {
id: root
property ShellScreen screen
enabled: Settings.data.wallpaper.enabled
baseSize: Style.getCapsuleHeightForScreen(screen?.name)
applyUiScale: false
customRadius: Style.radiusL
icon: "wallpaper-selector"
tooltipText: I18n.tr("tooltips.wallpaper-selector")
tooltipDirection: BarService.getTooltipDirection(screen?.name)
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBorder: "transparent"
colorBorderHover: "transparent"
border.color: Style.capsuleBorderColor
border.width: Style.capsuleBorderWidth
NPopupContextMenu {
id: contextMenu
model: [
{
"label": I18n.tr("actions.random-wallpaper"),
"action": "random-wallpaper",
"icon": "dice"
},
]
onTriggered: action => {
contextMenu.close();
PanelService.closeContextMenu(screen);
if (action === "random-wallpaper") {
WallpaperService.setRandomWallpaper(null);
}
}
}
onClicked: {
var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen);
if (Settings.data.wallpaper.panelPosition === "follow_bar") {
wallpaperPanel?.toggle(this);
} else {
wallpaperPanel?.toggle();
}
}
onRightClicked: {
PanelService.showContextMenu(contextMenu, root, screen);
}
}