diff --git a/src/KMonad/Keyboard/IO/Linux/DeviceSource.hs b/src/KMonad/Keyboard/IO/Linux/DeviceSource.hs index 4c25f3b0..f4f5529b 100644 --- a/src/KMonad/Keyboard/IO/Linux/DeviceSource.hs +++ b/src/KMonad/Keyboard/IO/Linux/DeviceSource.hs @@ -132,12 +132,12 @@ lsOpen :: (HasLogFunc e) -> FilePath -- ^ The path to the device file -> RIO e DeviceFile lsOpen pr pt = do -#if MIN_VERSION_unix(2,8,0) - h <- liftIO . openFd pt ReadOnly $ -#else - h <- liftIO . openFd pt ReadOnly Nothing $ + h <- liftIO $ openFd pt + ReadOnly +#if !MIN_VERSION_unix(2,8,0) + Nothing #endif - OpenFileFlags False False False False False + defaultFileFlags hd <- liftIO $ fdToHandle h logInfo "Initiating ioctl grab" ioctl_keyboard h True `onErr` IOCtlGrabError pt diff --git a/src/KMonad/Keyboard/IO/Linux/UinputSink.hs b/src/KMonad/Keyboard/IO/Linux/UinputSink.hs index 082c9092..99e0ef91 100644 --- a/src/KMonad/Keyboard/IO/Linux/UinputSink.hs +++ b/src/KMonad/Keyboard/IO/Linux/UinputSink.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE CPP #-} {-| Module : KMonad.Keyboard.IO.Linux.UinputSink Description : Using Linux's uinput interface to emit events @@ -141,8 +142,12 @@ send_event u (Fd h) e@(LinuxKeyEvent (s', ns', typ, c, val)) = do usOpen :: HasLogFunc e => UinputCfg -> RIO e UinputSink usOpen c = do when (null $ c ^. keyboardName) $ throwM EmptyNameError - fd <- liftIO . openFd "/dev/uinput" WriteOnly Nothing $ - OpenFileFlags False False False True False + fd <- liftIO $ openFd "/dev/uinput" + WriteOnly +#if !MIN_VERSION_unix(2,8,0) + Nothing +#endif + defaultFileFlags logInfo "Registering Uinput device" acquire_uinput_keysink fd c `onErr` UinputRegistrationError (c ^. keyboardName) flip (maybe $ pure ()) (c^.postInit) $ \cmd -> do