[Bug 1854092] Re: pbcopy & pbpaste for Linux
Another idea for pbcopy & pbpaste use, simple snippet processor that works in every application that works with clipboard. Could be useful if you have to fill forms with similar values again and again... ``` # MAIN #pbcopy $OUT" echo -n "$OUT" | pbcopy # write to clipboard fi done ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
Ubuntu 20.04 doesn't have pbcopy & pbcopy commands, issue is still ignored... -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
A year ago I published in this bug report a script to copy data from clipboard to standard output. This is updated version, only small modifications to improve compatibility with dash shell. ``` #!/bin/sh # print data from clipboard to stdout, again and again... MODE="xclip" #MODE="xsel" # doesn't work well, clipboard is not cleaned and the same text is printed again and again :-( pbcopy () { if [ "$MODE" = "xclip" ]; then xclip -selection clip -i else xsel --clipboard --input fi } pbpaste () { if [ "$MODE" = "xclip" ]; then xclip -selection clip -o else xsel --clipboard --output fi } # MAIN pbcopy https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
I am not strong in PowerShell. Previous script sends data from clipboard ONLY to console, it doesn't send them to STDOUT and such script cannot be used to pipe data to other commands. This is version of script that really sends data from clipbaord to the stdout: ``` # scb is alias for Set-Clipboard # gcb is alias for Get-Clipboard # sleep is alias for Start-Sleep # copy data from clipboard to stdout Set-Clipboard # clear clipboard while ($true) { $TXT = Get-Clipboard # read clipboard if ($TXT) { Write-Output "$TXT" Set-Clipboard # clear clipboard } else { Start-Sleep -Milliseconds 100 # sleep 100ms } } ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
PowerShell version of the script that waits for data in clipboard and send them to STDOUT ``` # scb is alias for Set-Clipboard # gcb is alias for Get-Clipboard # sleep is alias for Start-Sleep # copy data from clipboard to stdout # MAIN Set-Clipboard # clear clipboard while ($true) { $TXT = Get-Clipboard | Out-String # read clipboard if ($TXT) { Write-Host "$TXT" -NoNewLine Set-Clipboard # clear clipboard } else { Start-Sleep -Milliseconds 100 # sleep 100ms } } ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
** Description changed: This is not a bug report but request for enhancement. Ubuntu 18.04 doesn't have pbcopy & pbpaste commands. Mac users can use two commands, pbcopy and pbpaste, to work with clipbopard in their scripts. No such "easy to use" solution is available at Linux! Could be pbcopy and pbpaste commands implemented at Linux? That will make migration of Mac user to Linux World easier... ;-) There are several articles how to implement pbcopy and pbpaste at Linux, most of them use "alias", something like this: ``` # mimic osx pbcopy/pbpaste alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" ``` or ``` alias pbcopy='xsel --clipboard --input' alias pbpaste='xsel --clipboard --output' ``` I think that alias commands cannot be used in shell script, right? Is it possible to implement pbcopy and pbpaste in the way to be usable in scripts too? These commands could be included in "xclip" package. BTW, pbcopy and pbpaste are binary executable files at OS X. NOTE: Even archaic OS like Windows has CLI commands to work with clipboard data. DOS has command CLIP.EXE that writes data to clipboard and this command can be even used from scripts in WSL (Windows Subsystem for Linux). DOS has no command to read data from clipboard. PowerShell has full support for clipboard, it can read and write clipboard data - with commands Get-Clipboard and Set-Clipboard. + with commands Get-Clipboard and Set-Clipboard (aliases can be used, gcb + and scb). -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
** Description changed: This is not a bug report but request for enhancement. Ubuntu 18.04 doesn't have pbcopy & pbpaste commands. Mac users can use two commands, pbcopy and pbpaste, to work with clipbopard in their scripts. No such "easy to use" solution is available at Linux! Could be pbcopy and pbpaste commands implemented at Linux? That will make migration of Mac user to Linux World easier... ;-) There are several articles how to implement pbcopy and pbpaste at Linux, most of them use "alias", something like this: ``` # mimic osx pbcopy/pbpaste alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" ``` or ``` alias pbcopy='xsel --clipboard --input' alias pbpaste='xsel --clipboard --output' ``` I think that alias commands cannot be used in shell script, right? Is it possible to implement pbcopy and pbpaste in the way to be usable in scripts too? These commands could be included in "xclip" package. BTW, pbcopy and pbpaste are binary executable files at OS X. + + NOTE: Even archaic OS like Windows has CLI commands to work with + clipboard data. DOS has command CLIP.EXE that writes data to clipboard + and this command can be even used from scripts in WSL (Windows Subsystem + for Linux). DOS has no command to read data from clipboard. PowerShell + has full support for clipboard, it can read and write clipboard data + with commands Get-Clipboard and Set-Clipboard. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
PowerShell scripts can read/write clipboard data too: ``` PS C:\Users\user> echo "Test 1234" | Set-Clipboard PS C:\Users\user> Get-Clipboard Test 1234 PS C:\Users\user> Set-Clipboard "Hello World!" PS C:\Users\user> Get-Clipboard Hello World! ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
Users of WSL (Windows Subsystem for Linux) can send data to clipboard in this way: ``` user@WIN10: $ ls -l | clip.exe ``` ``` user@WIN10: $ file $(which clip.exe) /mnt/c/Windows/System32/clip.exe: PE32+ executable (console) x86-64, for MS Windows ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
Do you know that even Windows have CLI command "clip" to send command input to clipboard? Try it: ``` C:\> DIR | CLIP ``` ``` C:\> CLIP < README.TXT ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
Modified version of previous demo. Clipbard is cleaned in different way.. The same result, xsel version doesn't work ``` # MAIN pbcopy https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
I tried to write a simple script to collect data with "copy", script waits in the loop for data in clipboad and prints that text to stdout and clears clipboard. Simple and powerful! It works well with xclip but doesn't work with xsel, like some data are not cleaned and are put to the stdout again and again. This could be a bug in xsel. Maybe that I just miss something... ``` #!/bin/bash # print data from clipboard to stdout, again and again... MODE="xclip" #MODE="xsel" # doesn't work well, clipboard is not cleaned and the same text is printed again and again :-( function pbcopy() { if [ "$MODE" == "xclip" ]; then xclip -selection clip -i else xsel --clipboard --input fi } function pbpaste() { if [ "$MODE" == "xclip" ]; then xclip -selection clip -o else xsel --clipboard --output fi } # MAIN echo -n "" | pbcopy # clear clipboard while :; do TXT="$(pbpaste)" if [ -n "$TXT" ]; then echo "$TXT" echo -n "" | pbcopy # clear clipboard else sleep 0.1 # sleep 100ms fi done ``` -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
This request for against xsel package was created by a mistake. I opened similar request for xclip package https://bugs.launchpad.net/ubuntu/+source/xclip/+bug/1854113 ** Description changed: This is not a bug report but request for enhancement. Ubuntu 18.04 doesn't have pbcopy & pbpaste commands. Mac users can use two commands, pbcopy and pbpaste, to work with clipbopard in their scripts. No such "easy to use" solution is available at Linux! Could be pbcopy and pbpaste commands implemented at Linux? That will make migration of Mac user to Linux World easier... ;-) There are several articles how to implement pbcopy and pbpaste at Linux, most of them use "alias", something like this: ``` # mimic osx pbcopy/pbpaste alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" ``` + or + ``` + alias pbcopy='xsel --clipboard --input' + alias pbpaste='xsel --clipboard --output' + ``` - I think that alias commands cannot be used in shell script, right? Is it - possible to implement pbcopy and pbpaste in the way to be usable in - scripts too? These commands could be included in "xclip" package. + + I think that alias commands cannot be used in shell script, right? Is it possible to implement pbcopy and pbpaste in the way to be usable in scripts too? These commands could be included in "xclip" package. ** Description changed: This is not a bug report but request for enhancement. Ubuntu 18.04 doesn't have pbcopy & pbpaste commands. Mac users can use two commands, pbcopy and pbpaste, to work with clipbopard in their scripts. No such "easy to use" solution is available at Linux! Could be pbcopy and pbpaste commands implemented at Linux? That will make migration of Mac user to Linux World easier... ;-) There are several articles how to implement pbcopy and pbpaste at Linux, most of them use "alias", something like this: ``` # mimic osx pbcopy/pbpaste alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" ``` or ``` alias pbcopy='xsel --clipboard --input' alias pbpaste='xsel --clipboard --output' ``` + I think that alias commands cannot be used in shell script, right? Is it + possible to implement pbcopy and pbpaste in the way to be usable in + scripts too? These commands could be included in "xclip" package. - I think that alias commands cannot be used in shell script, right? Is it possible to implement pbcopy and pbpaste in the way to be usable in scripts too? These commands could be included in "xclip" package. + BTW, pbcopy and pbpaste are binary executable files at OS X. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1854092] Re: pbcopy & pbpaste for Linux
** Description changed: This is not a bug report but request for enhancement. Ubuntu 18.04 doesn't have pbcopy & pbpaste commands. - Mac users can use two commands, pbcopy and pbpaste to work with + Mac users can use two commands, pbcopy and pbpaste, to work with clipbopard in their scripts. No such "easy to use" solution is available at Linux! Could be pbcopy and pbpaste commands implemented at Linux? That will make migration of Mac user to Linux World easier... ;-) There are several articles how to implement pbcopy and pbpaste at Linux, most of them use "alias", something like this: ``` # mimic osx pbcopy/pbpaste alias pbcopy="xclip -selection clipboard -i" alias pbpaste="xclip -selection clipboard -o" ``` I think that alias commands cannot be used in shell script, right? Is it possible to implement pbcopy and pbpaste in the way to be usable in scripts too? These commands could be included in "xclip" package. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1854092 Title: pbcopy & pbpaste for Linux To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xsel/+bug/1854092/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs