packages feed

greenclip 4.0.0 → 4.1.0

raw patch · 3 files changed

+15/−34 lines, 3 filesdep −base16-bytestringdep −cryptohash-md5

Dependencies removed: base16-bytestring, cryptohash-md5

Files

README.md view
@@ -16,7 +16,7 @@  **Features:**   + Integrated with [rofi](https://github.com/DaveDavenport/rofi)-  + Permanently set some selections to added at the end (set `static_history = []` in the config file)+  + Permanently set some selections to added at the end (set `static_history_file = your/file/with/static/entries` in the config file)   + Merge X Primary selection with clipboard selection (set `use_primary_selection_as_input = true` in the config file)   + Blacklist some applications (see `I want to blacklist some applications !` in the FAQ section)   + Copy small images (you can disable it in the config)@@ -25,7 +25,7 @@  - It's a static binary so drop it anywhere in your $PATH env -```wget https://github.com/erebe/greenclip/releases/download/v4.2/greenclip```+```wget https://github.com/erebe/greenclip/releases/download/4.1/greenclip```   - Alternatively if you are using Archlinux you can install the package from AUR@@ -46,6 +46,7 @@   use_primary_selection_as_input = false   blacklisted_applications = []   enable_image_support = true+  # path without ending / will generate mktemp directory at the prefix location   image_cache_directory = "/tmp/greenclip"   static_history = [  '''¯\_(ツ)_/¯''',@@ -59,7 +60,7 @@ 1. Spawn the daemon ``` greenclip daemon ``` 2. When ever you need to get your selections history ``` rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}' ``` 3. The entry that you have selected will be in your clipboard now-4. Configuration file can be found in ```.config/greenclip.toml```+4. Configuration file can be found in ```.config/greenclip.cfg```  ## Migrating from 2.x version to 3.x one @@ -127,9 +128,9 @@  A. You can also use greenclip with [dmenu](http://tools.suckless.org/dmenu) or [fzf](https://github.com/junegunn/fzf). Example usage: -   `greenclip print | grep . | dmenu -i -l 10 -p clipboard | xargs -r -d'\n' -I '{}' greenclip print '{}'`+   `greenclip print | sed '/^$/d' | dmenu -i -l 10 -p clipboard | xargs -r -d'\n' -I '{}' greenclip print '{}'` -   `greenclip print | grep . | fzf -e | xargs -r -d'\n' -I '{}' greenclip print '{}'`+   `greenclip print | sed '/^$/d' | fzf -e | xargs -r -d'\n' -I '{}' greenclip print '{}'`  ---------- 
greenclip.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           greenclip-version:        4.0.0+version:        4.1.0 synopsis:       Simple clipboard manager to be integrated with rofi description:    Simple clipboard manager to be integrated with rofi - Please see README.md category:       Linux Desktop@@ -40,8 +40,6 @@     , directory     , wordexp     , tomland-    , base16-bytestring-    , cryptohash-md5     , X11 >= 1.6   other-modules:       Clipboard
src/Main.hs view
@@ -14,14 +14,10 @@ import           Protolude.Conv        (toS)  import           Control.Monad.Catch   (MonadCatch, catchAll)-import qualified Crypto.Hash.MD5       as H import           Data.Binary           (decodeFile, encode) import qualified Data.ByteString       as B-import qualified Data.ByteString.Base16 as BB-import qualified Data.ByteString.Char8 as BC import           Data.List             (dropWhileEnd) import qualified Data.Text             as T-import qualified Data.Text.Encoding    as TE import           Data.Vector           (Vector) import qualified Data.Vector           as V import           Lens.Micro@@ -32,7 +28,7 @@ import           System.IO             (hClose, hGetContents) import           System.Timeout        (timeout) import           System.Wordexp.Simple (wordexp)---import           System.Posix.Temp     (mkdtemp)+import           System.Posix.Temp     (mkdtemp)  import Toml (TomlCodec, (.=)) import qualified Toml@@ -40,7 +36,7 @@ import qualified Clipboard             as Clip  -data Command = DAEMON | PRINT | COPY Text | CLEAR | PRUNE FilePath | HELP deriving (Show, Read)+data Command = DAEMON | PRINT | COPY Text | CLEAR | HELP deriving (Show, Read)  data Config = Config   { maxHistoryLength           :: Int@@ -96,17 +92,6 @@     writeH storePath = B.writeFile storePath . toS . encode . V.toList  -pruneHistory :: (MonadIO m, MonadReader Config m) => FilePath -> m ()-pruneHistory path = do-  targets <- liftIO $ BC.lines <$> readFile path-  history <- getHistory-  storeHistory $ V.filter (go targets) history-  where-    go ts (Clip.Selection _ (Clip.UTF8 x)) = hashText x `notElem` ts-    go _  _                                = False-    hashText = BB.encode . H.hash . TE.encodeUtf8-- appendToHistory :: (MonadIO m, MonadReader Config m) => Clip.Selection -> ClipHistory -> m (ClipHistory, ClipHistory) appendToHistory sel history' = do   trimSelection <- view $ to trimSpaceFromSelection@@ -286,11 +271,11 @@        -- if it ends with / we don't create a temp directory   -- user is responsible for it-  -- cfg <- if (lastDef ' ' (toS $ imageCachePath cfg) /= '/')-  --    then do-  --      dirPath <- mkdtemp $ (toS $ imageCachePath cfg)-  --      return $ cfg { imageCachePath = toS dirPath }-  --    else return cfg+  cfg <- if (lastDef ' ' (toS $ imageCachePath cfg) /= '/') +      then do+        dirPath <- mkdtemp $ (toS $ imageCachePath cfg)+        return $ cfg { imageCachePath = toS dirPath }+      else return cfg         return cfg @@ -304,7 +289,6 @@ parseArgs :: [Text] -> Command parseArgs ("daemon":_)   = DAEMON parseArgs ["clear"]      = CLEAR-parseArgs ["prune", p]   = PRUNE $ T.unpack p parseArgs ["print"]      = PRINT parseArgs ["print", sel] = COPY sel parseArgs _              = HELP@@ -316,15 +300,13 @@     DAEMON   -> runReaderT runDaemon cfg     PRINT    -> runReaderT printHistoryForRofi cfg     CLEAR    -> runReaderT (storeHistory mempty) cfg-    PRUNE p  -> runReaderT (pruneHistory p) cfg     -- Should rename COPY into ADVERTISE but as greenclip is already used I don't want to break configs     -- of other people     COPY sel -> runReaderT (advertiseSelection sel) cfg-    HELP     -> putText $ "greenclip v4.2 -- Recyle your clipboard selections\n\n" <>+    HELP     -> putText $ "greenclip v4.1 -- Recyle your clipboard selections\n\n" <>                           "Available commands\n" <>                           "daemon: Spawn the daemon that will listen to selections\n" <>                           "print:  Display all selections history\n" <>-                          "prune FILE: Remove selections in list of md5 hashes in FILE\n" <>                           "clear:  Clear history\n" <>                           "help:   Display this message\n"