Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions services/ClipboardWatcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ fi
onExited: function(exitCode) {
if (!watcher.wanted) return
watcher.message("warning", "clipboard watcher exited (" + exitCode + "); restarting")
// 127 is wl-paste missing (wl-clipboard not installed): retry once a
// minute rather than spawning a process every 2 s for nothing.
restartTimer.interval = exitCode === 127 ? 60000 : 2000
restartTimer.restart()
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/content-ready.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function contentReady(window) {
function shownOn(scale, devicePixelRatio) {
const screen = { name: "HDMI-A-1", width: 2400, height: 1350 }
return {
usingHyprland: true,
shown: true,
screen,
targetMonitor: { name: screen.name, scale },
Expand All @@ -42,3 +43,13 @@ test("content stays hidden until the surface has the output's size", () => {
assert.equal(contentReady({ ...shownOn(0.8, 1), width: 1920 }), false)
assert.equal(contentReady({ ...shownOn(1, 1), shown: false }), false)
})

// Under another compositor (labwc, sway, …) there is no Hyprland monitor to
// wait for: the surface having the output's size is enough.
test("content is revealed without Hyprland once the surface has the output's size", () => {
const screen = { name: "DSI-1", width: 375, height: 667 }
const window = { usingHyprland: false, shown: true, screen, targetMonitor: null, width: 375, height: 667, devicePixelRatio: 2 }
assert.equal(contentReady(window), true)
assert.equal(contentReady({ ...window, height: 600 }), false)
assert.equal(contentReady({ ...window, shown: false }), false)
})
30 changes: 22 additions & 8 deletions ui/LauncherWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ PanelWindow {
visible: window.mapped
screen: window.pinnedScreen
property var pinnedScreen: null
// Under another compositor (labwc, sway, …) there is no Hyprland: no
// focused monitor, no monitor scale to wait for, no submaps.
readonly property bool usingHyprland: !!Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
function focusedScreen() {
var monitor = Hyprland.focusedMonitor
var monitor = window.usingHyprland ? Hyprland.focusedMonitor : null
var screens = Quickshell.screens
for (var i = 0; i < screens.length; i++) {
if (monitor && screens[i].name === monitor.name) return screens[i]
Expand Down Expand Up @@ -164,7 +167,14 @@ PanelWindow {
: "Search for apps and commands…"

readonly property int cardWidth: Math.min(px(750), width - Style.gapsOut * 2)
readonly property int fullHeight: Math.min(px(475), height - Style.gapsOut * 2)
// On a narrow screen (a phone or a small portrait display) the card sits at
// the top, just under the bar, leaving the lower half free for an
// on-screen keyboard, instead of a quarter of the way down.
readonly property bool narrow: width < px(500)
readonly property int narrowTop: Style.bar.sizeHorizontal + Style.gapsOut
readonly property int fullHeight: window.narrow
? Math.min(px(475), height - window.narrowTop - Style.gapsOut)
: Math.min(px(475), height - Style.gapsOut * 2)
readonly property int headerHeight: px(66)
readonly property int footerHeight: px(42)

Expand Down Expand Up @@ -209,17 +219,20 @@ PanelWindow {
// mapping at scale 1, which showed stretched and soft, with scale-dependent
// sizes jumping as the real scale landed.
readonly property var targetMonitor: {
if (!window.usingHyprland) return null
var monitors = Hyprland.monitors.values
for (var i = 0; i < monitors.length; i++) {
if (window.screen && monitors[i].name === window.screen.name) return monitors[i]
}
return null
}
readonly property bool contentReady: window.shown && !!window.screen && !!window.targetMonitor
readonly property bool contentReady: window.shown && !!window.screen
&& (!window.usingHyprland || !!window.targetMonitor)
&& window.width === window.screen.width && window.height === window.screen.height
// Qt keeps devicePixelRatio at 1 on an output scaled below 1 (0.8 here), so
// the plain comparison never held there and the card stayed invisible.
&& Math.round(window.devicePixelRatio * 120) === Math.round(Math.max(1, window.targetMonitor.scale) * 120)
&& (!window.usingHyprland
|| Math.round(window.devicePixelRatio * 120) === Math.round(Math.max(1, window.targetMonitor.scale) * 120))
property bool contentRevealed: false
onContentReadyChanged: {
window.contentRevealed = false
Expand All @@ -228,7 +241,7 @@ PanelWindow {
if (window.contentReady) Qt.callLater(function() { if (window.contentReady) window.contentRevealed = true })
}
// Live monitor scaling emits no Hyprland event, so refresh the cached scale.
onDevicePixelRatioChanged: if (window.shown) Hyprland.refreshMonitors()
onDevicePixelRatioChanged: if (window.shown && window.usingHyprland) Hyprland.refreshMonitors()
// Also what keeps the mapped surface blank while hidden: contentReady needs shown.
Binding {
target: window.contentItem
Expand All @@ -237,10 +250,10 @@ PanelWindow {
}

// A reload or disable while shown would otherwise leave Hyprland in the submap.
Component.onDestruction: if (window.shown) Hyprland.dispatch('hl.dsp.submap("reset")')
Component.onDestruction: if (window.shown && window.usingHyprland) Hyprland.dispatch('hl.dsp.submap("reset")')
onShownChanged: {
// The "omacast" submap (omacast.lua) lets Super+J/K past Hyprland's binds.
Hyprland.dispatch('hl.dsp.submap("' + (window.shown ? "omacast" : "reset") + '")')
if (window.usingHyprland) Hyprland.dispatch('hl.dsp.submap("' + (window.shown ? "omacast" : "reset") + '")')
if (window.shown) {
var target = window.focusedScreen()
// An output that goes away (lid, suspend, dock) takes the layer surface
Expand Down Expand Up @@ -888,7 +901,8 @@ PanelWindow {
height: window.compact ? window.headerHeight + card.borderTop + card.borderBottom : window.fullHeight
radius: Style.cornerRadius
anchors.horizontalCenter: parent.horizontalCenter
y: Math.max(Style.gapsOut, Math.min(Math.round(window.height / 4), window.height - window.fullHeight - Style.gapsOut))
y: window.narrow ? window.narrowTop
: Math.max(Style.gapsOut, Math.min(Math.round(window.height / 4), window.height - window.fullHeight - Style.gapsOut))
color: window.cardBackground
borderSpec: window.borderSpec
clip: true
Expand Down
Loading