diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-11 10:28:38 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-11 10:28:38 +0400 |
| commit | de0ad857112384dbba0198bbd4481b2fd61204e3 (patch) | |
| tree | d121d8955c358e17a9a9acd50d4c4bc2150c60e3 /src/utils/mod.rs | |
| parent | f091e64b129b09a73d04d7fc757f9930709b6bf8 (diff) | |
| download | niri-de0ad857112384dbba0198bbd4481b2fd61204e3.tar.gz niri-de0ad857112384dbba0198bbd4481b2fd61204e3.tar.bz2 niri-de0ad857112384dbba0198bbd4481b2fd61204e3.zip | |
Set cursor for niri-initiated interactive resize
Diffstat (limited to 'src/utils/mod.rs')
| -rw-r--r-- | src/utils/mod.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index e22bd979..f523d960 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -11,6 +11,7 @@ use bitflags::bitflags; use directories::UserDirs; use git_version::git_version; use niri_config::Config; +use smithay::input::pointer::CursorIcon; use smithay::output::Output; use smithay::reexports::rustix::time::{clock_gettime, ClockId}; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; @@ -49,6 +50,22 @@ impl From<xdg_toplevel::ResizeEdge> for ResizeEdge { } } +impl ResizeEdge { + pub fn cursor_icon(self) -> CursorIcon { + match self { + Self::LEFT => CursorIcon::WResize, + Self::RIGHT => CursorIcon::EResize, + Self::TOP => CursorIcon::NResize, + Self::BOTTOM => CursorIcon::SResize, + Self::TOP_LEFT => CursorIcon::NwResize, + Self::TOP_RIGHT => CursorIcon::NeResize, + Self::BOTTOM_RIGHT => CursorIcon::SeResize, + Self::BOTTOM_LEFT => CursorIcon::SwResize, + _ => CursorIcon::Default, + } + } +} + pub fn version() -> String { format!( "{} ({})", |
