Skip to content

Commit

Permalink
Full path for all opens
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-clifton committed Aug 16, 2024
1 parent ad27978 commit de48c83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ parseItem lev = parseLevelIndicator *> P.choice
P.endOfLine
let pglob = Map.fromListWith (++) $ map (fmap (:[])) params
case lookup "href" params of
Just s -> pure $ MenuItem name ["open", s]
Just s -> pure $ MenuItem name ["/usr/bin/open", s]
_ -> case lookup "bash" params of
Just cmd -> do
pure $ MenuItem name $ cmd : (Map.findWithDefault [] "param" pglob)
Expand Down Expand Up @@ -312,15 +312,15 @@ stripControlSequences i = case Char8.uncons i of
parseBitBar :: ByteString -> Menu
parseBitBar s = case P.parseOnly parseMenu (Text.decodeUtf8 $ stripControlSequences s) of
Left _ -> Menu "Error parsing bitbar syntax"
[ MenuRaw "Show document" (writeOutput s |> exe "open" "-f")
[ MenuRaw "Show document" (writeOutput s |> exe "/usr/bin/open" "-f")
]
Right m -> m

parseJSON :: ByteString -> Menu
parseJSON s = case JSON.eitherDecodeStrict' s of
Left e -> Menu "Error parsing json" $
[MenuItem l [] | l <- Text.lines (Text.pack e)]
++ [MenuRaw "Open JSON document" (writeOutput s |> exe "open" "-f")]
++ [MenuRaw "Open JSON document" (writeOutput s |> exe "/usr/bin/open" "-f")]
Right m -> m

-- | Parse auto attempts to detect if this is meant to be a JSON object by looking
Expand Down

0 comments on commit de48c83

Please sign in to comment.