Update 2020-07-03 Some improvements, by misko_2083 http://murga-linux.com/puppy/viewtopic. ... 77#1062177
Update 2020-06-17 version 2, attached code_tray2.sh.tar.gz, see changes here
Often I need to try out code snippets, e.g. from text file, from here or anywhere else on the web.
As I wanted a convenient way to do that and also the ability to save, edit them quickly, I made this for my own use, perhaps it's useful for others too.
I know there are different ways to do similar, e.g. by using geany (but frankly I didn't explore them much)
Took some parts from 'trans_tray' and from examples in the 'YAD - tips' thread, thanks misko, mochimoppel, vovchik, stemsee and others.
Attached is: code_tray.sh.tar.gz, extract and run code_tray.sh, then just highlight a piece of code and left-click the tray icon to run it.
Depends on yad and xclip. (yad needs to be version 0.37 or higher)
(preferences, geometry settings and saved codes are stored in ~/.code_tray)
The terminal to use is set to 'xterm' by default, some puppies don't have it perhaps, then change in the settings to e.g. urxvt or e.g. lxterminal.
From Help (right-click menu):
It could be that there's a limit for the amount of lines, I tried with 1000+ lines of code and still works ok though.- Select some code (bash) (no need to copy, just select it), e.g. in browser or text file.
Then by left-clicking the icon, a terminal will appear running the code.
- From menu (right-click) there are some other options, e.g:
- Preferences, to change some default settings, e.g. texteditor, terminal, set font
- Show selected code, save to a file if you wish
(can be handy to edit it, select it, then run it by left-clicking the icon)
- View saved codes (located in ~/.code_tray/saved)
Hint: If you need to edit selected code, run 'Show selected code' from menu,
then edit it, select it and run by left-clicking the icon
Required is to have 'xclip' installed.
Any opinions, suggestions to improve are welcome!
Fred