|
|
08-10-2011
, 03:57 PM
|
|
Posts: 120 |
Thanked: 91 times |
Joined on Sep 2010
@ Russia
|
#2
|
1. Daemon to launch with a shortcut key that copies the text to clipboard, applies the transformation and pastes it back in the current box. Requires a way to emulate keystrokes (Ctrl+A, Ctrl+C, do stuff, Ctrl+V))
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import gtk
clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()
# transform
clipboard.set_text(text)
clipboard.store()
if key == 'c':
os.system("su user -c 'run-standalone.sh /path/to/transform/script'")
| The Following User Says Thank You to ForeverYoung For This Useful Post: | ||
|
|
08-11-2011
, 06:54 AM
|
|
|
Community Council |
Posts: 2,278 |
Thanked: 4,144 times |
Joined on Jan 2010
|
#3
|
|
|
08-11-2011
, 07:14 AM
|
|
|
Community Council |
Posts: 2,278 |
Thanked: 4,144 times |
Joined on Jan 2010
|
#4
|
|
|
08-11-2011
, 10:24 AM
|
|
|
Community Council |
Posts: 2,278 |
Thanked: 4,144 times |
Joined on Jan 2010
|
#5
|
|
|
08-15-2011
, 02:00 PM
|
|
Posts: 2,799 |
Thanked: 4,437 times |
Joined on Nov 2007
|
#6
|
|
|
08-16-2011
, 06:14 AM
|
|
|
Community Council |
Posts: 2,278 |
Thanked: 4,144 times |
Joined on Jan 2010
|
#7
|
| The Following User Says Thank You to qwazix For This Useful Post: | ||
|
|
08-16-2011
, 08:09 PM
|
|
|
Community Council |
Posts: 2,278 |
Thanked: 4,144 times |
Joined on Jan 2010
|
#8
|
|
|
08-17-2011
, 04:37 AM
|
|
Posts: 2,799 |
Thanked: 4,437 times |
Joined on Nov 2007
|
#9
|
![]() |
| Thread Tools | Search this Thread |
|
This is a mode that was used in older nokia phones (all symbian phones and dumbphones) and some other brands' phones in order to enable users to send messages in Greek without unicode support.
But let's start over and explain it a little better.
Having those as facts I am thinking what can be done to resolve this issue and I have come down with some ideas. I want your feedback about those thoughts and any other idea may come to mind.
HowTo:
Known bug: sometimes you will see a sequence of letters beeing typed at the end of your message, if this happens press ctrl and keep it pressed until the text appears again transformed.
#!/usr/bin/python # -*- coding: utf-8 -*- import pygtk import os from string import maketrans pygtk.require('2.0') import gtk def translate_uni(to_translate, translate_to=u'_'): not_letters_or_digits = u'!"#%\'()*+,-./:;<=>?@[\]^_`{|}~' if isinstance(to_translate, unicode): translate_table = dict((ord(char), unicode(translate_to)) for char in not_letters_or_digits) else: assert isinstance(to_translate, str) translate_table = string.maketrans(not_letters_or_digits, translate_to *len(not_letters_or_digits)) return to_translate.translate(translate_table) os.system("xdotool key ctrl+a") os.system("xdotool key ctrl+c") clipboard = gtk.clipboard_get() text = clipboard.wait_for_text() text = text.upper(); text = text.replace("α","A"); text = text.replace("ά","A"); text = text.replace("β","B"); text = text.replace("γ","Γ"); text = text.replace("δ","Δ"); text = text.replace("ε","E"); text = text.replace("έ","E"); text = text.replace("ζ","Z"); text = text.replace("η","H"); text = text.replace("ή","H"); text = text.replace("θ","Θ"); text = text.replace("ι","I"); text = text.replace("ί","I"); text = text.replace("ϊ","I"); text = text.replace("ΐ","I"); text = text.replace("κ","K"); text = text.replace("λ","Λ"); text = text.replace("μ","M"); text = text.replace("ν","N"); text = text.replace("ξ","Ξ"); text = text.replace("ο","O"); text = text.replace("ό","O"); text = text.replace("π","Π"); text = text.replace("ρ","P"); text = text.replace("σ","Σ"); text = text.replace("ς","Σ"); text = text.replace("τ","T"); text = text.replace("υ","Y"); text = text.replace("ύ","Y"); text = text.replace("φ","Φ"); text = text.replace("χ","X"); text = text.replace("ψ","Ψ"); text = text.replace("ω","Ω"); text = text.replace("ώ","Ω"); text = text.replace("Α","A"); text = text.replace("Β","B"); text = text.replace("Ε","E"); text = text.replace("Ζ","Z"); text = text.replace("Η","H"); text = text.replace("Ι","I"); text = text.replace("Κ","K"); text = text.replace("Μ","M"); text = text.replace("Ν","N"); text = text.replace("Ο","O"); text = text.replace("Ρ","P"); text = text.replace("Τ","T"); text = text.replace("Υ","Y"); text = text.replace("Χ","X"); #greek = "ΒΕΖΗΙΚΜΝΟΡΤΥΧ".encode('ISO 8859-7') #common = "ABEZHIKMNOPTYX".encode('ISO 8859-7') #text = text.translate(transtab) clipboard.set_text(text) clipboard.store() os.system("xdotool key ctrl+v")Related thread http://groups.google.com/group/xdoto...d36fd1da9b7c14
EDIT2: Now you can find it in extras-devel. Hopefully it will ask to replace shortcutd configuration
EDIT3: Now it modifies the shortcutd configuration upon install and backs up the old. Still you have to restart shortcutd manually
Last edited by qwazix; 08-16-2011 at 07:44 PM.