Wiki: How to edit qml and configuration files with TinyEdit

asked 2014-07-20 14:05:59 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2015-03-02 18:49:06 +0200

Manatus gravatar image

Edits to the Jolla configuration files require a text editor such as nano or vim, but they have their own problems for inexperienced users. For small edits TinyEdit by ovekaaven is sufficient. As a bonus it supports copy/paste from Jolla GUI while terminal based editors do not.

TinyEdit can be found in JollaStore.

Devel-su requires devel mode enabled.


Running TinyEdit from the command line

To edit qml or configuration files from the command line do

devel-su
export XDG_RUNTIME_DIR=/run/user/100000
harbour-tinyedit /path/to/file/filename.qml

Pay attention to privileges; you cannot save the files that require root access unless you use devel-su. The files under /home/nemo/ and its subdirectories do not usually require devel-su, but the rest do.

Be extra careful with line endings (EOL). Long lines get wrapped to next line, but they will still be correct unless you remove the invisible end-of-line-character.


How to change TinyEdit font size

By default TinyEdit font is too big to handle long lines comfortably. You can change the font size in the EditPage.qml of TinyEdit.

Run

devel-su
harbour-tinyedit /usr/share/harbour-tinyedit/qml/pages/EditPage.qml

and change this part

    TextArea {
        id: area
        width: page.width
        selectionMode: TextEdit.SelectCharacters
        focus: true
        background: null
        onTextChanged: unsavedChanges = true
    }

to look like this:

    TextArea {
        id: area
        width: page.width
        selectionMode: TextEdit.SelectCharacters
        focus: true
        background: null
        onTextChanged: unsavedChanges = true
        font.pixelSize: Theme.fontSizeExtraSmall
    }

In short just add the line font.pixelSize: Theme.fontSizeExtraSmall. Then save the changes and close TinyEdit.

You can find more font size options here.

edit retag flag offensive close delete

Comments

"they have their own problems for inexperienced users"

Well, inexperienced users don't have to go editing QML files.

Sthocs ( 2014-07-21 11:24:04 +0200 )edit
3

Inexperienced in "art of vim" does not mean inexperienced in computer technology or inexperienced with paradigms of different user interfaces.

Many very experienced windows users are equally inexperienced with linux. Jolla might be their first linux device. Still they understand the fundamentals of Sailfish environment very well and are versed in script languages similar to QML.

Just minor edits to such as font size edit for TinyEdit in this article, or the agenda-view trick, give a lot of value for the regular Jolla users too, and not just tinkerers.

Article like this gives them some idea how to do those little edits without messing up the file without notice. And not like in Vim, where pressing d and arrow down in command mode deletes two lines starting from the cursor. This happens unnoticed all too easily if you deleted bunch of lines in command mode by hammering dd.

Manatus ( 2014-07-21 12:14:41 +0200 )edit

Thanks for this tip, it really makes things easier! It's a pain to use nano in Fingerterm, and having never used vim I don't want to go through the learning. (Still, I have perfectly good reasons to edit qml files. :) )

ssahla ( 2014-07-24 23:21:28 +0200 )edit

I tried to edit a file and get this:

error: XDG_RUNTIME_DIR not set in the environment.

Should this still work from terminal in Vaarainjärvi?

Vesa ( 2015-03-02 14:10:35 +0200 )edit

You are correct, it does not work out of the box anymore. XDG_RUNTIME_DIR environmental variable has to be set manually first with export XDG_RUNTIME_DIR=/run/user/100000. Then it works.

Manatus ( 2015-03-02 18:46:30 +0200 )edit