()
| 221 | |
| 222 | |
| 223 | def init_wl_clipboard(): |
| 224 | PRIMARY_SELECTION = "-p" |
| 225 | |
| 226 | def copy_wl(text, primary=False): |
| 227 | text = _stringifyText(text) # Converts non-str values to str. |
| 228 | args = ["wl-copy"] |
| 229 | if primary: |
| 230 | args.append(PRIMARY_SELECTION) |
| 231 | if not text: |
| 232 | args.append("--clear") |
| 233 | subprocess.check_call(args, close_fds=True) |
| 234 | else: |
| 235 | p = subprocess.Popen(args, stdin=subprocess.PIPE, close_fds=True) |
| 236 | p.communicate(input=text.encode(ENCODING)) |
| 237 | |
| 238 | def paste_wl(primary=False): |
| 239 | args = ["wl-paste", "-n"] |
| 240 | if primary: |
| 241 | args.append(PRIMARY_SELECTION) |
| 242 | p = subprocess.Popen(args, stdout=subprocess.PIPE, close_fds=True) |
| 243 | stdout, _stderr = p.communicate() |
| 244 | return stdout.decode(ENCODING) |
| 245 | |
| 246 | return copy_wl, paste_wl |
| 247 | |
| 248 | |
| 249 | def init_klipper_clipboard(): |
no outgoing calls
no test coverage detected