Partial support for wayland
This commit is contained in:
parent
00b83a1590
commit
acd3bb284a
3 changed files with 20 additions and 4 deletions
16
README.md
16
README.md
|
@ -10,6 +10,22 @@ Text seleciton keyboard layout switcher based on xclip / etc for X11 & wayland
|
||||||
|
|
||||||
2. install module: `pip install fleepit`
|
2. install module: `pip install fleepit`
|
||||||
|
|
||||||
|
# Limitations
|
||||||
|
|
||||||
|
## X11
|
||||||
|
|
||||||
|
Operation is performed in 3 steps:
|
||||||
|
* copy - copy selection buffer (primary clipboard)
|
||||||
|
* paste - write converted selection buffer into secondary (regular) clipboard
|
||||||
|
* send CTRL+C event
|
||||||
|
|
||||||
|
## Wayland
|
||||||
|
|
||||||
|
Operation is performed in 3 steps with limitations
|
||||||
|
* copy - reads contents of primary buffer
|
||||||
|
* paste - write converted selection into secondary (regular) clipboard
|
||||||
|
* user has to manually press CTRL+C - for the security reasons and/or in order to prevent depending on external daemon services that may expose potential keystroke injection vulnerabilities
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Sample usage for KDE:
|
Sample usage for KDE:
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Requirements: xclip, xdotool
|
# Requirements: xclip, xdotool (X11); wl-clipboard (Wayland)
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -89,7 +89,7 @@ def do_x11(args: argparse.Namespace):
|
||||||
|
|
||||||
def do_wayland(args: argparse.Namespace):
|
def do_wayland(args: argparse.Namespace):
|
||||||
# Extract selection
|
# Extract selection
|
||||||
result = subprocess.run([ 'wl-paste', '-primary' ], capture_output=True, text=True)
|
result = subprocess.run([ 'wl-paste', '--primary', '--no-newline' ], capture_output=True, text=True)
|
||||||
result.check_returncode()
|
result.check_returncode()
|
||||||
clip = result.stdout
|
clip = result.stdout
|
||||||
if clip.strip() == '':
|
if clip.strip() == '':
|
||||||
|
@ -112,7 +112,7 @@ def do_wayland(args: argparse.Namespace):
|
||||||
print(f'converted: "{ converted }"')
|
print(f'converted: "{ converted }"')
|
||||||
|
|
||||||
# Write selection
|
# Write selection
|
||||||
result = subprocess.run([ 'wl-paste', '-primary' ], text=True, input=converted)
|
result = subprocess.run([ 'wl-copy' ], text=True, input=converted)
|
||||||
result.check_returncode()
|
result.check_returncode()
|
||||||
|
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -11,7 +11,7 @@ except:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='fleepit',
|
name='fleepit',
|
||||||
version='6',
|
version='7',
|
||||||
py_modules=['fleepit'],
|
py_modules=['fleepit'],
|
||||||
description='Text seleciton keyboard layout switcher based on xclip / etc for X11 & wayland',
|
description='Text seleciton keyboard layout switcher based on xclip / etc for X11 & wayland',
|
||||||
url='https://git.pegasko.art/bitrate16/fleepit',
|
url='https://git.pegasko.art/bitrate16/fleepit',
|
||||||
|
|
Loading…
Reference in a new issue