diff --git a/.indicator-chars b/.indicator-chars new file mode 100644 index 0000000..2ae389e --- /dev/null +++ b/.indicator-chars @@ -0,0 +1,11 @@ +[accents⊕punctuation⊕quotes]´`¨ˆ¸!¡‼¿…'‘’“”‹›«» +[accents→acdegi]áÁàÀâÂåÅäÄãêæÆçÇðÐéÉèÈêÊëËğĞíÍìÌîÎïÏıİ +[accents→nosuyz]ñÑóÓòÒôÔöÖõÕœŒšŠşŞþÞúÚùÙûÛüÜýÝÿŸžŽ +[arrows⊕shapes]←→↑↓↔↕↨↗↘↳↵⇐⇒⇔⇤⇥⇦⇧⇨⇩►◄▲▼△▽░▒▓█▌▐■▄▀▬ +[emoticons➊]☻☺☹😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙 +[emoticons➋]😚😛😜😝😞😟😠😡😢😣😥😦😧😨😩😪😫😭😮😯😰😱😲😳😴😵😶😷 +[lines]—─¯¦|│∟⌐¬┌┬┐├┼┤└┴┘┤Γ╡╢╖╕╣║╗╝╜╛╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪ +[marks⊕science]©℗®℠™¤¢$£¥₧€℅№†‡§¶℃℉°µøØƒΩßαΔδεΘπΣτΦφΨΩ℮∂∆∏∑∩≡⌠⌡⊕⊖⊗⊘⊙ +[math⊕numbers]÷×±≠<≤≥>√~≈≃‰‱∞ⁿº#0⅛¼⅜½⅝¾⅞¹²³➊➋➌➍➎➏➐➑➒➓①②③④⑤⑥⑦⑧⑨⑩ +[symbols①]✓✔☑✗✘✕✖☓☒☐•●○❍◯◎☉▢❏❑□◘◙◆◇✦★☆✮✯✰☞☜☝☟☚☛✂✄☎✆✉✍ +[symbols②]✎✏✐✑✒⌨☮☯♡❤✽✾✿❀❁❃❇❈❅❄❆☼☀☁☂☃☄♂♀♪♫♩♬♭♮♯♥♠♣♦·⚓� diff --git a/.indicator-chars.old b/.indicator-chars.old new file mode 100644 index 0000000..f9387f2 --- /dev/null +++ b/.indicator-chars.old @@ -0,0 +1,21 @@ +[accents+punctuation]´`¨ˆ¸!¡‼¿… +[arrows]←→↑↓↔↕↨↗↘↳↵⇐⇒⇔⇤⇥⇦⇧⇨⇩ +[emoticons1]☻☺☹😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙😚 +[emoticons2]😛😜😝😞😟😠😡😢😣😥😦😧😨😩😪😫😭😮😯😰😱😲😳😴😵😶😷 +[lines-single]—─¯¦|│∟⌐¬┌┬┐├┼┤└┴┘┤Γ +[lines-double]╡╢╖╕╣║╗╝╜╛╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪ +[marks]©℗®℠™¤¢$£¥₧€℅№†‡§¶ +[math]÷×±≠<≤≥>√~≈≃‰‱∞ⁿº#0⅛¼⅜½⅝¾⅞¹²³ +[numbering]➊➋➌➍➎➏➐➑➒➓①②③④⑤⑥⑦⑧⑨⑩ +[quotes]'‘’“”‹›«» +[science]℃℉°µøØƒΩßαΔδεΘπΣτΦφΨΩ℮∂∆∏∑∩≡⌠⌡⊕⊖⊗⊘⊙ +[shapes]►◄▲▼△▽░▒▓█▌▐■▄▀▬ +[symbols1]✓✔☑✗✘✕✖☓☒☐•●○❍◯◎☉▢❏❑□◘◙◆◇✦★☆✮✯✰ +[symbols2]☞☜☝☟☚☛✂✄☎✆✉✍✎✏✐✑✒⌨☮☯♡❤✽✾✿❀❁❃❇❈❅❄❆ +[symbols3]☼☀☁☂☃☄♂♀♪♫♩♬♭♮♯♥♠♣♦·⚓� +[↓accented letters ↓] +[a]áÁàÀâÂåÅäÄãÃªæÆ +[c+d+e]çÇðÐéÉèÈêÊëË +[g+i+n]ğĞíÍìÌîÎïÏıİñÑ +[o+s]óÓòÒôÔöÖõÕœŒšŠşŞþÞ +[u+y+z]úÚùÙûÛüÜýÝÿŸžŽ diff --git a/README.md b/README.md new file mode 100644 index 0000000..d44262f --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +indicator-chars +=============== + +_Forked from_: https://github.com/tobyS/indicator-chars + +_Original Author_: **Tobias Schlitt** + +App indicator to provide a menu with special characters for simple copying them to clipboard (similar to original characters applet). + +![screenshot](indicator-chars-screenshot.png) + +Install +------- + +- Checkout source files ( especially the DEB package ;-) + + - If not using the DEB package, make sure you have already installed dependencies: `bash` (>= 2.0), `coreutils` (>= 7.0), `diffutils` (>= 3.0), `libc6` (>= 2.0), `python` (>=2.7), `python-appindicator`, `python-gtk2`, `zenity` + +- Create/Edit `~/.indicator-chars` file if the one here isn't good enough for you + + - Each row corresponds to a set of chars + + - Optional submenu title prefix: `[title]` (trailing spaces stripped) + + - Optional descriptions after chars: `(description)` (leading & + trailing spaces stripped) + + - Spaces (apart from above) also count as chars + + - Make sure to use **UTF-8** encoding + +Changelog +----------- + +1.8: Work-in-progress - changed icons to svg, ... +1.7: Breeze-style icons added, menu made more compact, and restart command moved from Python to Shell script + +1.6: Indicator icon made writable by all to eliminate "sudoers" + +1.5: Merged all scripts as functions in one shell script, minor fixes & enhancements + +1.4: Changed icons + +1.3: Changed icons, added "copy to clipboard on click" feature from: https://github.com/Cyrille37/indicator-chars + +1.2: Another menu item added to edit user config file with zenity, etc. + +1.1: Issue of root password requirement to change icon resolved, etc. + +1.0: Original code forked: sample user config file added, icon made available also for dark themes, menu item added to change icon, DEB file added, etc. diff --git a/README.rst b/README.rst deleted file mode 100644 index bd44bb8..0000000 --- a/README.rst +++ /dev/null @@ -1,42 +0,0 @@ -=============== -indicator-chars -=============== - -:Author: Tobias Schlitt - -App indicator to provide a menu with (potentially funny UTF-8) characters for -simple copying them to clipboard (similar to original characters applet). - -Create a file .indicator-chars in your home directory with lines of -characters to be selectable. - -------- -Install -------- - -- Checkout source code - -- Create ~/.indicator-chars - - - Each row corresponds to a set of chars - - - Optional submenu title prefix: "[title]" (trailing spaces stripped) - - - Optional descriptions after chars: "(description)" (leading & - trailing spaces stripped) - - - Spaces (apart from above) also count as chars - - - Make sure to use UTF-8 encoding - -- Put indicator-chars.py into auto start - ------------ -Open issues ------------ - -- If anyone could design a nice, unity style indicator icon? - -- Maybe there is a way to use multiple click buttons in menu items? - - - No standard Gtk way does not work. diff --git a/breeze-dark-theme-icon.svg b/breeze-dark-theme-icon.svg new file mode 100644 index 0000000..e88e7f5 --- /dev/null +++ b/breeze-dark-theme-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/breeze-light-theme-icon.svg b/breeze-light-theme-icon.svg new file mode 100644 index 0000000..b902cd8 --- /dev/null +++ b/breeze-light-theme-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/color-theme-icon.svg b/color-theme-icon.svg new file mode 100644 index 0000000..8153bf7 --- /dev/null +++ b/color-theme-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/dark-theme-icon.svg b/dark-theme-icon.svg new file mode 100644 index 0000000..e8e4a45 --- /dev/null +++ b/dark-theme-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/indicator-chars-icon.svg b/indicator-chars-icon.svg new file mode 100644 index 0000000..8153bf7 --- /dev/null +++ b/indicator-chars-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/indicator-chars-screenshot.png b/indicator-chars-screenshot.png new file mode 100644 index 0000000..0a89603 Binary files /dev/null and b/indicator-chars-screenshot.png differ diff --git a/indicator-chars.desktop b/indicator-chars.desktop new file mode 100755 index 0000000..affa583 --- /dev/null +++ b/indicator-chars.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Indicator Chars +Comment=Paste special characters with Middle Click +Exec=indicator-chars.py +Icon=preferences-desktop-keyboard-shortcuts +Hidden=false +NoDisplay=false +Type=Application +Categories=GNOME;GTK;Utility; +X-GNOME-Autostart-enabled=true + diff --git a/indicator-chars.py b/indicator-chars.py index 913437b..99c87a7 100755 --- a/indicator-chars.py +++ b/indicator-chars.py @@ -6,16 +6,16 @@ # # Copyright (c) 2011, Tobias Schlitt # All rights reserved. -# +# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: -# +# # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. Redistributions # in binary form must reproduce the above copyright notice, this list of # conditions and the following disclaimer in the documentation and/or # other materials provided with the distribution. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -39,7 +39,7 @@ import appindicator APP_NAME = 'indicator-chars' -APP_VERSION = '0.2' +APP_VERSION = '1.7' class IndicatorChars: CHARS_PATH = os.path.join(os.getenv('HOME'), '.indicator-chars') @@ -50,9 +50,9 @@ class IndicatorChars: def __init__(self): self.ind = appindicator.Indicator( - "Chars", os.path.join(self.SCRIPT_DIR, 'light16x16.png'), + "Chars", os.path.join(self.SCRIPT_DIR, 'indicator-chars-icon.svg'), appindicator.CATEGORY_APPLICATION_STATUS) - self.ind.set_status(appindicator.STATUS_ACTIVE) + self.ind.set_status(appindicator.STATUS_ACTIVE) self.update_menu() @@ -65,7 +65,7 @@ def on_chars_changed(self, filemonitor, file, other_file, event_type): if event_type == gio.FILE_MONITOR_EVENT_CHANGES_DONE_HINT: print 'Characters changed, updating menu...' self.update_menu() - + def update_menu(self, widget = None, data = None): try: charDef = open(self.CHARS_PATH).readlines() @@ -74,7 +74,7 @@ def update_menu(self, widget = None, data = None): # Create menu menu = gtk.Menu() - + for charLine in charDef: charLine = unicode(charLine) charLine = charLine.strip() @@ -104,6 +104,13 @@ def update_menu(self, widget = None, data = None): parentItem.set_submenu(subMenu) menu.append(parentItem) + menu.append(gtk.SeparatorMenuItem()) + EditMenu_item = self.create_menu_item('Edit menu...') + EditMenu_item.connect("activate", self.EditMenu) + menu.append(EditMenu_item) + ChangeIcon_item = self.create_menu_item('Change icon...') + ChangeIcon_item.connect("activate", self.ChangeIcon) + menu.append(ChangeIcon_item) menu.append(gtk.SeparatorMenuItem()) quit_item = self.create_menu_item('Quit') quit_item.connect("activate", self.on_quit) @@ -116,22 +123,29 @@ def update_menu(self, widget = None, data = None): def on_char_click(self, widget, char): cb = gtk.Clipboard(selection="PRIMARY") cb.set_text(char) + cb = gtk.Clipboard(selection="CLIPBOARD") + cb.set_text(char) + + def EditMenu(self, dude): + os.system("/usr/share/indicator-chars/indicator-chars.sh edit_menu") + + def ChangeIcon(self, dude): + os.system("/usr/share/indicator-chars/indicator-chars.sh change_icon") def on_quit(self, widget): gtk.main_quit() - if __name__ == "__main__": # Catch CTRL-C signal.signal(signal.SIGINT, lambda signal, frame: gtk.main_quit()) # Run the indicator i = IndicatorChars() - - # Monitor bookmarks changes + + # Monitor bookmarks changes file = gio.File(i.CHARS_PATH) monitor = file.monitor_file() - monitor.connect("changed", i.on_chars_changed) - + monitor.connect("changed", i.on_chars_changed) + # Main gtk loop gtk.main() diff --git a/indicator-chars.sh b/indicator-chars.sh new file mode 100755 index 0000000..5eab618 --- /dev/null +++ b/indicator-chars.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +edit_menu() +{ +FILE=/home/$USER/.indicator-chars +TMP=$(mktemp) +zenity --text-info --editable --title="Edit menu" --filename=$FILE --width 550 --height 550 > $TMP +if [ "$?" = 0 ] +then +DIFF=$(diff -q --from-file "$FILE" "$TMP"; echo $?) + if [ "$DIFF" != 0 ] + then + mv $FILE "$FILE"~ + mv $TMP "$FILE" + notify-send "Updated menu" -i gtk-dialog-info -t 3000 -u normal + fi +fi +exit 0 +} + +restart_indicator() +{ +pkill -f "/usr/bin/python /usr/local/bin/indicator-chars.py" +indicator-chars.py +} + +change_icon() +{ +menu_icon() +{ +im="zenity --list --radiolist --title=\"Change Icon\" --text=\"Select icon to use:\" --width 270 --height 230" +im=$im" --column=\"☑\" --column \"Options\" --column \"Description\" " +im=$im"FALSE \"Breeze-dark\" \"Icon for light panels\" " +im=$im"FALSE \"Breeze-light\" \"Icon for dark panels\" " +im=$im"FALSE \"Color\" \"Icon for all panels\" " +im=$im"FALSE \"Dark\" \"Icon for light panels\" " +im=$im"FALSE \"Light\" \"Icon for dark panels\" " +} +option_icon() +{ +choice=`echo $im | sh -` +if echo $choice | grep "Breeze-dark" > /dev/null +then + cp -f "/usr/share/indicator-chars/breeze-light-theme-icon.svg" "/usr/share/indicator-chars/indicator-chars-icon.svg" + restart_indicator +fi +if echo $choice | grep "Breeze-light" > /dev/null +then + cp -f "/usr/share/indicator-chars/breeze-dark-theme-icon.svg" "/usr/share/indicator-chars/indicator-chars-icon.svg" + restart_indicator +fi +if echo $choice | grep "Color" > /dev/null +then + cp -f "/usr/share/indicator-chars/color-theme-icon.svg" "/usr/share/indicator-chars/indicator-chars-icon.svg" + restart_indicator +fi +if echo $choice | grep "Dark" > /dev/null +then + cp -f "/usr/share/indicator-chars/light-theme-icon.svg" "/usr/share/indicator-chars/indicator-chars-icon.svg" + restart_indicator +fi +if echo $choice | grep "Light" > /dev/null +then + cp -f "/usr/share/indicator-chars/dark-theme-icon.svg" "/usr/share/indicator-chars/indicator-chars-icon.svg" + restart_indicator +fi +} +menu_icon +option_icon +} + +######################################################################## + +if [ $# -eq 0 ] +then + echo "You should specify a function as parameter; e.g. change_icon" + exit 1 +else + for func do + [ "$(type -t -- "$func")" = function ] && "$func" + done +fi + +exit 0 diff --git a/indicator-chars_1.7.deb b/indicator-chars_1.7.deb new file mode 100644 index 0000000..7792f8e Binary files /dev/null and b/indicator-chars_1.7.deb differ diff --git a/light-theme-icon.svg b/light-theme-icon.svg new file mode 100644 index 0000000..526cfce --- /dev/null +++ b/light-theme-icon.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + à + + diff --git a/light16x16.png b/light16x16.png deleted file mode 100644 index d18eae5..0000000 Binary files a/light16x16.png and /dev/null differ diff --git a/light16x16.svg b/light16x16.svg deleted file mode 100644 index 59a2a60..0000000 --- a/light16x16.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..f7e56b6 --- /dev/null +++ b/setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +pkill -f "/usr/bin/python /usr/local/bin/indicator-chars.py" +sudo rm -Rf "/usr/local/indicator-chars" "/usr/share/indicator-chars" + +sudo mkdir -p "/usr/share/indicator-chars" + +sudo cp "./indicator-chars.py" "/usr/share/indicator-chars/" +sudo chown root:root "/usr/share/indicator-chars/indicator-chars.py" +sudo chmod 755 "/usr/share/indicator-chars/indicator-chars.py" +sudo ln -sf "/usr/share/indicator-chars/indicator-chars.py" "/usr/local/bin/indicator-chars.py" + +sudo cp "./indicator-chars.sh" "/usr/share/indicator-chars/" +sudo chown root:root "/usr/share/indicator-chars/indicator-chars.sh" +sudo chmod a+x "/usr/share/indicator-chars/indicator-chars.sh" + +sudo cp "./breeze-dark-theme-icon.svg" "/usr/share/indicator-chars/" +sudo cp "./breeze-light-theme-icon.svg" "/usr/share/indicator-chars/" +sudo cp "./color-theme-icon.svg" "/usr/share/indicator-chars/" +sudo cp "./dark-theme-icon.svg" "/usr/share/indicator-chars/" +sudo cp "./light-theme-icon.svg" "/usr/share/indicator-chars/" +sudo cp "./indicator-chars-icon.svg" "/usr/share/indicator-chars/" +sudo chmod a+rw "/usr/share/indicator-chars/indicator-chars-icon.svg" + +sudo cp -f "./indicator-chars.desktop" "/usr/share/applications/" +sudo cp -f "./indicator-chars.desktop" "/etc/xdg/autostart/" +sudo chmod a+x "/etc/xdg/autostart/indicator-chars.desktop" + +cp "./.indicator-chars" "/home/$USER/.indicator-chars"