Compare commits

..

No commits in common. "54651e2fe9b5225bf8586cd9530b3869aa27caf6" and "d352e4d49b46a02d94b27f7ae815ec9cd0cce23c" have entirely different histories.

4 changed files with 9 additions and 16 deletions

View File

@ -732,16 +732,9 @@ runMountSudoMaybe' useSudo cmd args environ =
-- runSudoMount rootpass cmd args stdin = runSudoMount' rootpass cmd args stdin [] -- runSudoMount rootpass cmd args stdin = runSudoMount' rootpass cmd args stdin []
runSudoMount' :: MonadIO m => T.Text -> T.Text -> [T.Text] -> [(T.Text, T.Text)] -> m MountResult runSudoMount' :: MonadIO m => T.Text -> T.Text -> [T.Text] -> [(T.Text, T.Text)] -> m MountResult
runSudoMount' rootpass cmd args environ = do runSudoMount' rootpass cmd args environ = runMount "sudo" args' rootpass
-- This needs Default timestamp_type=global in sudoers to have any effect
-- since these are all separate shells
isCached <- isJust <$> readCmdSuccess "sudo" ["-n", "true"] ""
if isCached then run else do
cacheSuccess <- isJust <$> readCmdSuccess "sudo" ["-S", "true"] rootpass
if cacheSuccess then run else return $ MountError "Could not cache password"
where where
run = runMount "sudo" args' "" args' = ["-S"] ++ environ' ++ [cmd] ++ args
args' = ["-n"] ++ environ' ++ [cmd] ++ args
environ' = fmap (\(k, v) -> T.concat [k, "=", v]) environ environ' = fmap (\(k, v) -> T.concat [k, "=", v]) environ
eitherToMountResult :: Either (Int, T.Text, T.Text) T.Text -> MountResult eitherToMountResult :: Either (Int, T.Text, T.Text) T.Text -> MountResult

View File

@ -47,7 +47,7 @@ let CIFSData =
, default = , default =
{ cifsSudo = False { cifsSudo = False
, cifsPassword = None PasswordConfig , cifsPassword = None PasswordConfig
, cifsOpts = Some CIFSOpts::{=} , cifsOpts = CIFSOpts::{=}
} }
} }

View File

@ -69,8 +69,8 @@ hotkeyMsg hs = ["-mesg", T.intercalate " | " $ fmap hotkeyMsg1 hs]
hotkeyArgs :: [Hotkey c] -> [T.Text] hotkeyArgs :: [Hotkey c] -> [T.Text]
hotkeyArgs hks = hotkeyArgs hks =
hotkeyMsg hks (hotkeyMsg hks)
++ concatMap (uncurry hotkeyBinding) (take 19 $ zip [1 ..] hks) ++ (concatMap (uncurry hotkeyBinding) $ take 19 $ zip [1 ..] hks)
data RofiMenu c = RofiMenu data RofiMenu c = RofiMenu
{ groups :: ![RofiGroup c] { groups :: ![RofiGroup c]
@ -129,7 +129,7 @@ selectAction rm = do
-- keybindings are labeled 1-19 and thus need to be explicitly -- keybindings are labeled 1-19 and thus need to be explicitly
-- indexed, and the program itself tells the world which key was -- indexed, and the program itself tells the world which key was
-- pressed via return code (any possible integer) -- pressed via return code (any possible integer)
(V.fromList (hotkeys rm) V.!? (n - 10)) ((V.fromList $ hotkeys rm) V.!? (n - 10))
runRofi :: (MonadIO m, HasRofiConf c) => c -> RofiMenu c -> m () runRofi :: (MonadIO m, HasRofiConf c) => c -> RofiMenu c -> m ()
runRofi c = runRIO c . selectAction runRofi c = runRIO c . selectAction
@ -171,7 +171,7 @@ readCmdEither'
-> m (Either (Int, T.Text, T.Text) T.Text) -> m (Either (Int, T.Text, T.Text) T.Text)
readCmdEither' cmd args input environ = readCmdEither' cmd args input environ =
resultToEither resultToEither
<$> liftIO (readCreateProcessWithExitCode p (T.unpack input)) <$> (liftIO $ readCreateProcessWithExitCode p (T.unpack input))
where where
e = case environ of e = case environ of
[] -> Nothing [] -> Nothing

View File

@ -16,8 +16,8 @@ notify icon summary body =
liftIO $ liftIO $
void $ void $
spawnProcess "notify-send" $ spawnProcess "notify-send" $
maybe args ((\b -> args ++ [b]) . T.unpack) maybe args (\b -> args ++ [b]) $
body fmap T.unpack body
where where
args = ["-i", show icon, T.unpack summary] args = ["-i", show icon, T.unpack summary]