clipster: enable
authorJulien Moutinho <julm+julm-nix@sourcephile.fr>
Sat, 11 Feb 2023 03:58:03 +0000 (04:58 +0100)
committerJulien Moutinho <julm+julm-nix@sourcephile.fr>
Sat, 11 Feb 2023 23:39:11 +0000 (00:39 +0100)
home-manager/profiles/bash.nix
home-manager/profiles/clipster.nix [new file with mode: 0644]
home-manager/profiles/tmux.conf
home-manager/profiles/xmonad.nix
home-manager/profiles/xmonad/xmonad.hs

index 85cb858f040e9e2aeabc82a4c129a80f26b1df6f..7497bd7fe91e3f106efd70af940e3c1f40de5a43 100644 (file)
@@ -182,6 +182,7 @@ with lib;
       show-all-if-ambiguous = mkDefault true;
       show-all-if-unmodified = mkDefault true;
       visible-stats = mkDefault false; # Append char to indicate type
+      enable-bracketed-paste = mkDefault true;
     };
   };
 }
diff --git a/home-manager/profiles/clipster.nix b/home-manager/profiles/clipster.nix
new file mode 100644 (file)
index 0000000..c843326
--- /dev/null
@@ -0,0 +1,102 @@
+{ pkgs, config, ... }:
+{
+  home.packages = [
+    pkgs.clipster
+  ];
+  systemd.user.services.clipster = {
+    Unit = {
+      Description = "clipster clipboard manager daemon";
+      After = [ "graphical-session-pre.target" ];
+      PartOf = [ "graphical-session.target" ];
+    };
+    Service = {
+      ExecStart = "${pkgs.clipster}/bin/clipster -d";
+      Restart = "always";
+    };
+    Install = { WantedBy = [ "graphical-session.target" ]; };
+  };
+  xdg.configFile."clipster/clipster.ini".text = ''
+    [clipster]
+    # Directory for clipster data/files (usually `$HOME/.local/share/clipster`)
+    #data_dir = $XDG_DATA_HOME
+
+    # Default selection (if no -p of -c given on command-line): can be PRIMARY or CLIPBOARD
+    default_selection = PRIMARY
+
+    # Comma-separated list of selections to be watched and written to history
+    active_selections = PRIMARY,CLIPBOARD
+
+    # Enable synchronising of clipboards
+    # Only clipboards listed in 'active selections' will be synchronised
+    sync_selections = yes
+
+    # full path to the clipster history file (JSON)
+    # Maximum file size is: 'history_size * max_input * 2' (defaults: 10MB)
+    #history_file = %(data_dir)s/history
+
+    # Number of items to save in the history file for each selection. 0 - don't save history.
+    history_size = 20
+
+    # Time in seconds to flush history to disk, if changed
+    # Set to 0 to only write history file on (clean) exit
+    #history_update_interval = 60
+
+    # Write history file immediately after selection changes?
+    # If yes, disables history_update_interval
+    #write_on_change = no
+
+    # Full path to the clipster socket file
+    #socket_file = %(data_dir)s/clipster_sock
+
+    # Full path to the clipster pid file
+    #pid_file = %(data_dir)s/clipster.pid
+
+    # Maximum length for new clipboard items
+    #max_input = 50000
+
+    # Number of rows of clipboard content to show in the selection widget before truncating
+    # Set to a high number to avoid truncation
+    #row_height = 3
+
+    # Allow duplicates in the clipboard (if set to no, the earlier entry will be removed)
+    duplicates = no
+
+    # smart_update tries to be clever about small changes to the selection, and only adds
+    # to the history if the number of characters added or removed is greater than it's value.
+    # for example, if set to 2: the latest clipboard entry catch, would be replaced by any of:
+    # cat, catc, catchy, catcher, but not ca or catchers.
+    # Defaults to 1, as some applications update the clipboard by continually adding new
+    # items with a single character added or removed each time.
+    # Set to 0 to disable.
+    #smart_update = 1
+
+    # Extract uris from the selection text and add them to the default clipboard
+    #extract_uris = yes
+
+    # Extract emails from the selection text and add them to the default clipboard
+    #extract_emails = yes
+
+    # Extract patterns (as specified in patterns file: clipster_dir/patterns) and add them to the default clipboard
+    #extract_patterns = no
+    #patterns_file = %(conf_dir)s/patterns
+
+    # Ignore selections matching certain patterns (as specified in patterns file: clipster_dir/ignore_patterns)
+    #ignore_patterns = no
+    #ignore_patterns_file = %(conf_dir)s/ignore_patterns
+
+    # Extracted patterns are added to the history before the selection, and the clipbaord buffer is left unchanged.
+    # Enabling this option adds the pattern as the last item int he history, and updates the clipboard buffer with the pattern.
+    # NOTE: Multiple patterns will be applied sequentially: last one will be used for selection.
+    # This option also applies to email and uri patterns (which are processed before additional patterns).
+    #pattern_as_selection = no
+
+    # Comma-separated list of WM_CLASS properties for apps where clipboard changes should be ignored.
+    # Used to ignore clipboard changes from sensitive apps, e.g. password managers.
+    #blacklist_classes =
+
+    # Comma-separated list of WM_CLASS properties for apps where clipboard changes should NOT be ignored.
+    # Used to only monitor clipboard changes from whitelisted apps, all other apps will be ignored!
+    #whitelist_classes =
+  '';
+}
+
index af7297afe33ae6087d4e31b86cc5bc6bdd897bc7..ce0f8d72cbea2f85a41f3bacf7a66f0cc7bbbef9 100644 (file)
@@ -55,7 +55,7 @@ bind-key a send-prefix
 bind Escape copy-mode
 unbind [
 unbind v
-bind v paste-buffer
+bind v paste-buffer -p
 #bind -t vi-copy 'v' begin-selection
 #bind -t vi-copy 'y' copy-selection
 #bind -t vi-copy 'Space' halfpage-down
@@ -70,7 +70,7 @@ set -ga terminal-override ',rxvt-uni*:XT:Ms=\E]52;%p1%s;%p2%s\007'
 
 # ICCCM clipboard
 bind Y run "tmux save-buffer - | xclip -i -sel clipboard"
-bind P run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer
+bind P run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer -p"
 #bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
 #bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
 
index 55ae67eb3d7dda6e5f768c2412ee55dae8b562b5..bc51f3dca4e4641c9e2af7bf1f24183b3976df3e 100644 (file)
@@ -1,5 +1,8 @@
 { pkgs, config, ... }:
 {
+  imports = [
+    ./clipster.nix
+  ];
   home.file.".xmonad/xmobar.hs".source = xmonad/xmobar.hs;
   xsession = {
     enable = true;
@@ -8,7 +11,6 @@
       xset dpms 380 640 1200
       ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black -fg black -bg white -cursor_name left_ptr
       ${pkgs.rxvt-unicode}/bin/urxvtd -f -o
-      ${pkgs.copyq}/bin/copyq &
       ${pkgs.pasystray}/bin/pasystray &
     '';
     windowManager.xmonad = {
@@ -23,7 +25,6 @@
   };
   home.packages = [
     pkgs.acpilight
-    pkgs.copyq
     pkgs.ffmpegthumbnailer
     pkgs.gmrun
     pkgs.light
index 6f772bf8fea7d82192dc2c767596005c9b3141cb..6f53fb3421f650b39453133a1e9312a056f165c7 100644 (file)
@@ -83,6 +83,9 @@ myKeys
   , ((modMask, xK_Escape), kill)
   , ((modMask, xK_q), kill)
 
+  -- Clipboard
+  , ((modMask, xK_c), spawn "clipster --select --primary")
+
   -- Temporarily maximize a window
   , ((modMask, xK_f), sendMessage $ XMonad.Layout.MultiToggle.Toggle FULL)
   -- , ((modMask, xK_f), withFocused (sendMessage . maximizeRestore))