Skip to content

Commit

Permalink
fix: Use -normal-window for Rofi on Wayland
Browse files Browse the repository at this point in the history
Rofi does not have native Wayland support and there are some issues with
capturing input when running default through XWayland. Using
`-normal-window` seems to improve the situation slightly, but might be
problematic under tiling compositor.

See: davatorium/rofi#446
  • Loading branch information
myme committed Jun 9, 2024
1 parent a0b7476 commit bc5391a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Nixon/Backend/Rofi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Nixon.Project (Project (projectDir, projectName))
import Nixon.Select (Candidate, Selection (..), SelectionType (..))
import qualified Nixon.Select as Select
import Nixon.Utils (implode_home, shell_to_list, toLines, (<<?))
import System.Environment (getEnv)
import Turtle
( ExitCode (ExitFailure, ExitSuccess),
Shell,
Expand Down Expand Up @@ -127,13 +128,17 @@ data RofiResult
-- | Launch rofi with the given options and candidates
rofi :: (MonadIO m) => RofiOpts -> Shell Candidate -> m (Selection Text)
rofi opts candidates = do
-- Add -normal-window flag when running on wayland
-- See: https://github.com/davatorium/rofi/issues/446
isWayland <- (== "wayland") <$> liftIO (getEnv "XDG_SESSION_TYPE")
let args =
"-dmenu"
: build_args
[ arg_fmt "-matching" (bool "fuzzy" "normal" . fromMaybe False) (_exact opts),
flag "-i" =<< _ignore_case opts,
flag "-markup-rows" (_markup opts),
flag "-multi-select" (_multi opts),
flag "-normal-window" isWayland,
arg "-mesg" =<< _msg opts,
arg "-p" =<< _prompt opts,
arg "-filter" =<< _query opts
Expand Down

0 comments on commit bc5391a

Please sign in to comment.