SSTE (Super Simple Text Editor)

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

SSTE (Super Simple Text Editor)

Post by stemsee »

I am creating SSTE - a lightweight text editor, similar to leafpad but with extra functionality. It is easy to modify as only a bash script and yad to deal with.

Attachments
sste2.png
sste2.png (473.33 KiB) Viewed 337 times
sste1.png
sste1.png (235.87 KiB) Viewed 337 times
User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

So after some careful tests and review of the purpose of sste, I decided to remove formatting functions from the right hand yad list and instead have fewer formatting functions in the form of buttons along the bottom of the swallowing yad paned gui, along with prefs, screenshot and print buttons.. The list is still there but now has two columns. Column one displays the path of the image displayed in column two. This allows searches and further functionality suitable for touchscreens. Currently double clicking on an image converts the image to a pdf and opens in evince which provides pinch to zoom, rotation, night mode, and other options. Meanwhile on the other side, the yad text-info editor, is able to save and open new files on the fly Doing so does not update the gui or backend with path of the newly opened file. So to use the formatting and print functions it is a necessary (inconvenience) that all(in the case of print) or some of the text must be pre-selected. Whether using mouse cursor or touch screen this is very easily accomplished. Now, to match the convenience of viewing an image in evince yad ---print preview allows a pinch to zoom gui for ease of viewing on a touchscreen. This print preview can also rotate the text simply by selecting in Page Layout of the print dialogue, Landscape, reverse landscape, portrait or reverse portrait - all four rotations, with pinch to zoom convenience. However going a little further I added a button for xscreenshot, which lets you select an area of the screen and creates an image file (of your visible text). Which then can be converted to pdf and opened in evince. This convenience is at the limitation of having a /root/sste directory with pdf, images and text sub-directories. So images can be converted to pdf if pdf doesn't already exist.

The ides for my use case is to be able to easily load images of guitar chords or scored music etc along with text or images of lyrics. Of course the text editor can be setup with text and background colours, and a range of font types and sizes. The separator can be used to hide either side, partially or completely. Everything happens very smoothly and with very little delay.

Currently I am working on the formatting options. When all are working I will add a banner image and button icons along with hover text for each button, before releasing a beta. But I have to say so far it is pleasant to use. Probably needs a history, and image scaling and categorisation.

xscreenshot-20241103T213115.png
xscreenshot-20241103T213115.png (444.5 KiB) Viewed 253 times
User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

@step
when using yadu --text-info --file-op, i can open a new file which clears current contents and loads contents from opened file. Then how do I programmatically reference the new file, is it a new "$1" or ... ? I want to be able to add the file path and name to a history log.

User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

I have added a preferences dialogue for selecting font, colours, image scaling max size and tray menu, saving prefs as different .set files, with custom name or, fields 1, 2 and 3, for easy selection. There are 8 fields in prefs.

xscreenshot-20241104T152820.png
xscreenshot-20241104T152820.png (55.84 KiB) Viewed 193 times

I added a couple lines of code to resize images using graphicsmagic, a fork of imagemagick but upto date and smaller. I am able to load 1000 images @1024x1280 in 4 seconds. rescaling took a bit longer.

xscreenshot-20241104T150419.png
xscreenshot-20241104T150419.png (429.22 KiB) Viewed 193 times

The list can also load text files for pre-viewing in the editor.

I will add a tray menu for more functions and options at some point.

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: SSTE (Super Simple Text Editor)

Post by step »

stemsee wrote: Mon Nov 04, 2024 1:11 am

@step
when using yadu --text-info --file-op, i can open a new file which clears current contents and loads contents from opened file. Then how do I programmatically reference the new file, is it a new "$1" or ... ? I want to be able to add the file path and name to a history log.

There isn't a way to programmatically reference the file you open in yad'd file open dialog. Also, yad closes the file handle right after loading file contents into the text view; therefore there isn't a way to inspect the system to figure out which file was opened.

User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

thanks @step

When opening a file first navigate to the file then right click on the file and copy location is available. This will be the most automatic way to get a file reference, if it can be scripted with xdotool, or just manually - is better than nothing.

right-click.png
right-click.png (436.75 KiB) Viewed 137 times
User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

step wrote: Mon Nov 04, 2024 2:17 pm
stemsee wrote: Mon Nov 04, 2024 1:11 am

@step
when using yadu --text-info --file-op, i can open a new file which clears current contents and loads contents from opened file. Then how do I programmatically reference the new file, is it a new "$1" or ... ? I want to be able to add the file path and name to a history log.

There isn't a way to programmatically reference the file you open in yad'd file open dialog. Also, yad closes the file handle right after loading file contents into the text view; therefore there isn't a way to inspect the system to figure out which file was opened.

After thinking about it, I realised that I can still Save the edits to the correct file, which suggests the file handle is still 'held' somewhere. If it wasn't then i would need to Save As and re-select the file!

User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

Search and Replace is regex enabled. This means less format buttons are needed. For example adding bullets in front of a line, can be searched and replaced with anything. So I added a "Bullets end of line" also. Using search and replace can quote and bracket as required.

I was having a huge headache with xsel and xdotool ctrl+v ... nothing worked as I wanted, but now modified text gets piped to editor. So formatting sequence is
1) press format button eg 'Bullets'
2) select text for modification, or click anywhere in editor (all text is selected) - to get focus (within 2 seconds)

Ctrl+z to undo (line by line), or Ctrl+Shift+z to re-do (i have a japanese keyboard).

Prefs now has 10 fields, added help and 'ADD Image Directory' checkbox.

xscreenshot-20241105T121629.png
xscreenshot-20241105T121629.png (81.23 KiB) Viewed 106 times

Last things to do are:

1) tray menu! with columns, indented formatting, portrait, landscape, other text formatting
2) hashtext (gettext)
3) translation function
4) grammar check function

That would be enough to get started with.

User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

An interesting 'discovery' ...
There are no navigation options for cycling through documents or a history for the editor .... but ! if you open a document in the editor, then open another , and another and another... and so on for however many documents you want to iterate through .... then you can use "undo" or "ctrl+y" or in my case "Ctrl+Shift+z" and there you have a bunch of documents/history/edits to cycle through. Clearly xdotool must be used to take advantage of this caching to "LOAD" a directory of texts into the undo cache....just be careful not to save anything ... in case of overwriting a file with the wrong contents.

Needs further investigation

User avatar
stemsee
Posts: 772
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 130 times

Re: SSTE (Super Simple Text Editor)

Post by stemsee »

There are four ways to load text:

1) set sste.sh as run action for .txt files in rox right-click menu, open with sste.sh by clicking on file.
2) loading text files from /root/sste/text dir (default behaviour on start up) all files will be appended in a single long
document.
3) loading text files from image directory, files added to list for select to preview in editor
4) loading text files from additional text directory, files are cached in undo/redo history, use ctrl+z or ctrl+y to navigate through them.

NaviPad is up and running in sste. Using xdotool to send key combos to focused window: this works well because the navipad uses yad option --no-focus.

xscreenshot-20241106T105028.png
xscreenshot-20241106T105028.png (7.17 KiB) Viewed 52 times

These are the default settings, and the function can read a config in /root/sste/navi-pad.conf which overrides defaults

Code: Select all

cmndone='bash -c "xdotool key ctrl+a"'
cmndtwo='bash -c "xdotool key ctrl+shift+z"'
cmndthree='bash -c "xdotool key ctrl+x"'
cmndfour='bash -c "xdotool key ctrl+o"'
cmndfive='bash -c "xdotool key ctrl+f"'
cmndsix='bash -c "xdotool key ctrl+s"'
cmndseven='bash -c "xdotool key ctrl+c"'
cmndeight='bash -c "xdotool key ctrl+z"'
cmndnine='bash -c "xdotool key ctrl+v"'
Post Reply

Return to “FatDog64”