View Single Post
Old 06-02-2023, 05:59 PM   #54
elinkser
Addict
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 242
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
XI. ADD SOME APPS

XI. ADD SOME APPS


Add dbus to get onboard keyboard working:

# apk add dbus

* Edit: actually, "apk add dbus-x11" and onboard runs reliably from chroot session startup, even without the "dbus-run-session" prefix.
# apk add dbus-x11
I believe you can check status with:
# echo $(dbus-launch)

If you want onboard as the default keyboard:

nano -l /uxorg-chroot.sh:
25 #DISPLAY=:0 sudo -u myuser svkbd-mobile-intl -g 1400x320+20+700 &
...
26 DISPLAY=:0 sudo -u myuser onboard -l Small -x 20 -y 720 --size 1400x340 &

# nano -l /usr/share/applications/onboard.desktop
139 Exec=onboard -l Small -x 20 -y 720 --size 1400x340 &

(You can invoke this keyboard from the launcher bar, but you kill it from the lower left corner menu button on the onboard keyboard, after pressing the "12?" key in the "Small" layout)
While we're in the menu layout, the "cross" key at the right lets you hide the onboard keyboard.
Also you can move the keyboard by holding and dragging the "4-directions" key.

While we're in Onboard Preferences:

From General -> Desktop Integration, select "Show floating icon...", deselect "Show tooltips..."

From Layout -> Core layouts, select "Small"

From Keyboard -> Key Behaviour, deselect "Upper case on right-click"



Add word processor abiword with its epub plugin:

# apk add abiword-plugin-epub

First run abiword to set preferences:

# abiword

When you're presented with these gigantic dialog windows that are too big for the display, you click on the right-click launcher bar button, then the dialog window's titlebar, select "resize", then drag from anywhere on the window closest to the corner you want to drag from.

First resize and drag window.

From menu, select View -> Web Layout.

From View -> Toolbars, deselect toolbars.

From View -> Zoom, select Page Width.

From Edit -> Preferences, deselect Spell Checking and Smart Quotes.

From Format -> Font, select Monospace Bold 16 (maximize window if necessary).

# abiword Kipling_Rudyard-Just_So_Stories.epub

After a couple of moments (OK more than a minute) the epub appeared in abiword, with cover illustration.
The svkbd is better than the onboard keyboard for this with its PageUp/PageDown key layout that actually stays on screen after each keypress.
CORRECTION: from the 12? layout, you just have to tap the Fn key twice to get the PgUp/PgDn layout to persist.
Likewise, you can get the caps layout to persist by double tapping the Caps key.


Now add a more lightweight epub reader and image viewer:

# apk add epy
# apk add feh

Navigate with k/j for Up/Down, h/l (or Left/Right) for PgUp/PgDn, c to change color, o to view images with the feh image viewer, and q to quit:

# epy Kipling_\ Rudyard\ -\ Just\ So\ Stories.epub

Add mouse support (supposedly to go forward or back by tapping right or left sides of page, but in practice, our two-finger swipes for PgUp/PgDn are more reliable anyway):
# nano -l .config/epy/configuration.json
6 "PageScrollAnimation": false,
7 "MouseSupport": true,

From the project page, we can see some nicer color settings:
https://github.com/wustho/epy

I got nice epaper-like results with the following:
"DarkColorFG": 231,
"DarkColorBG": 232,

This ereader app is responsive and pleasant to look at with the right color setting (see above).
It can even be invoked with "epy -r" to see the last read ebook, or e.g. "epy 5" to select the fifth ebook on the list.
If you invoke it with "epy kipling" it supposedly grabs an ebook that has the word "kipling" in it.


Add a spreadsheet program:

# apk add gnumeric

Invoke it with scaling:

# GDK_DPI_SCALE=1.5 gnumeric

Go in the View->Toolbars menu to deselect the toolbars.

Tap the right-click button from the launcher, then click on the title bar of the gnumeric app to resize its window.

Now add a more lightweight calculator:

# apk add mate-calc

Scale the window:
# GDK_DPI_SCALE=1.5 mate-calc


Install a webkit-based browser from the armhf repository:

Remember this faint glimmer of success in installing an armhf-architecture luakit browser package?

Well we never had as good a result with our attempts to install a native armv7 webkit-based browser, so let's try again with our armhf candidates, luakit and midori.

$ wget https://dl-cdn.alpinelinux.org/alpin...t-2.3.3-r0.apk

Copy the above file to the /mnt/onboard/shared/ folder on the Kobo.

# df -h
Filesystem Size Used Available Use% Mounted on
/dev/loop0 2.0G 828.7M 1.1G 43% /

# apk add luajit
# apk add libsoup
# apk add webkit2gtk
# apk add lua5.1
# apk add ldoc
# apk add mesa-dri-gallium

# cd /home/myuser/
# cp /shared/luakit-2.3.3-r0.apk .
# tar zxvf luakit-2.3.3-r0.apk
# cp usr/bin/luakit /usr/bin/
# cp -r usr/lib/luakit/ /usr/lib/
# cp -r usr/share/luakit/ /usr/share/
# cp usr/share/applications/luakit.desktop /usr/share/applications/
# cp usr/share/pixmaps/luakit.* /usr/share/pixmaps/
# cp -r etc/xdg/luakit/ /etc/xdg/

EDIT /etc/xdg/luakit/theme.lua
Code:
-- Default settings
theme.font = "32px monospace"
theme.fg = "#fff"
theme.bg = "#000"
---
-- Follow mode hints
theme.hint_font = "32px monospace, courier, sans-serif"
First run luakit to set preferences:

# luakit

Enter ":settings", and let status bar go to 100% (can enter "r" to reload settings page).

Enter ESC and SPACE or SHIFT-SPACE to scroll, or "/" to search, then "zoom", and ENTER.

Set webview.zoom_level to "200" or whatever zoom level you want.

Enter ESC then hit SPACE repeatedly until you get to window.new_window_size
Set it to "1420x600"

Enter ESC and ":q" to save settings.

# luakit www.mobileread.com

Check the following site out for how to block adds and run noscript.

From https://trisquel.info/es/forum/confi...luakit-browser :
The 30 most useful keyboard shortcuts on luakit:
1. j - scroll page down a line
2. k - scroll page up a line
3. h - scroll page left
4. l - scroll page to the right
5. space - scroll down a full page
6. shift-space - scroll up a full page
7. gg - go to top of page
8. shift-g - go to bottom of page
9. [number]% - go to some percent of the page. Example - 50% - go to the halfway point of the page. 100% - go to the bottom of the page. 0% go to the top.
10. zi - zoom in
11. zo - zoom out
12. zz - reset zoom to default. If you put a number first, such as "150zz", then you will zoom that percent
13. shift-y - copy the current page's URL to the clipboard
14. shift-o - edit the current page's URL and go to the edited URL
15. o - open a URL
16. t - open a URL in a new page (t-Enter will open a new blank tab)
17. shift-t - open a URL based on the current page's URL in a new tab
18. shift-h - go back in browser history. "4-Shift-h" would go back 4 places in browser history
19. shift-l - go forward a spot in browser history. "4-Shift-l" would go forward 4 spots
20. shift-j - go to the next tab
21. shift-k - go to the previous tab
22. d - close the current tab
23. gh - open the home page
24. gy - duplicate th current tab
25. r - reload the page (shift-r - disregard the cache and reload the current page)
26. ctrl-c - stop loading the current tab
27. zq - quit without saving the session
28. zz - quit and save the session
29. shift-b - add a bookmark for the current page
30. gb - open the bookmarks manager

Don't forget Space and BackSpace to PageDown and PageUp.

Adblock (EasyList) and noscript made a HUGE difference in performance.
Now this browser is as usable as netsurf (on certain pages) but more fully featured.
The two-fingered scrolling doesn't seem to work (it actually seems to zoom the page, but only one direction!), but I run it unmaximized, using PageUp/PageDown keys from the svkbd keyboard.
Actually, ONE-fingered scrolling kind of works (for maximized window browsing) when it wants to.


# df -h
Filesystem Size Used Available Use% Mounted on
/dev/loop0 2.0G 993.9M 919.5M 52% /


Now for the midori browser. First try installing the stock midori:

# apk add midori

# midori https://www.mobileread.com

Kind of sluggish. Looks like luakit is still #1 for now.

# apk del midori

# df -h
Filesystem Size Used Available Use% Mounted on
/dev/loop0 2.0G 1003.0M 910.4M 52% /

If you want you can install the armhf rootfs instead of armv7 (remember to install mesa-dri-gallium to get the luakit window to display consistently):
wget https://dl-cdn.alpinelinux.org/alpin...0-armhf.tar.gz
I did not find it better - midori slow and not rendering, epiphany not running.


***

How about some sharper-looking icons for our right-click and drag-and-drop launcher bar functions:

Convert /usr/share/onboard/layouts/images/right-click.svg and /usr/share/onboard/layouts/images/hover-click.svg to png format using desktop image program.

For example:
Open svg file in Gimp.
Colors->Invert to change color to white.
File->Export As->Select File Type (By Extension)
And export as PNG Image.

# cp /usr/share/onboard/layouts/images/right-click.png /usr/share/icons/

# cp /usr/share/onboard/layouts/images/hover-click.png /usr/share/icons/

# nano -l /usr/share/applications/xdodd.desktop
4 Icon=hover-click

# nano -l /usr/share/applications/xdorc.desktop
4 Icon=right-click


Add our new apps to launcher bar if needed:

# nano -l /usr/share/applications/mate-calc.desktop
236 Exec=GDK_DPI_SCALE=1.5 mate-calc
238 Icon=gcr-smart-card

# nano -l /usr/share/applications/gnumeric.desktop
235 Exec=GDK_DPI_SCALE=1.5 gnumeric %U

# nano -l /usr/share/applications/qterminal.desktop
3 Icon=lxterminal


EDIT /home/root/.config/tint2/tint2rc:
Code:
###
#-------------------------------------
# Launcher
###
launcher_icon_size = 48
###
launcher_item_app = onboard.desktop           
launcher_item_app = svkbd.desktop          
#launcher_item_app = lxterminal.desktop 
launcher_item_app = qterminal.desktop 
#launcher_item_app = com.github.maoschanz.drawing.desktop
#launcher_item_app = pcmanfm.desktop
launcher_item_app = featherpad.desktop
#launcher_item_app = mate-calc.desktop
#launcher_item_app = gnumeric.desktop
#launcher_item_app = abiword.desktop 
launcher_item_app = netsurf.desktop
launcher_item_app = luakit.desktop 
#launcher_item_app = vncviewer.desktop
#launcher_item_app = gtans.desktop
launcher_item_app = xdodd.desktop
launcher_item_app = xdorc.desktop 
###
* Abiword only seems to work properly invoked from the comnand line, not the launcher.

# nano -l /home/root/.config/lxterminal/lxterminal.conf
2 fontname=Monospace 24
(This is to have a big font for running epy ereader by "lxterminal -e epy".)

And since we have so many apps now, let's finally enable the openbox menu, accessed by right-clicking on the desktop background (i.e. by launcher bar button or 2-finger left/right swipe):

(Note: you can also run sync or sudo poweroff from pcmanfm file manager menu:
e.g.:
Tools->Run a Command in Current Folder...
Enter a command to run:
sudo poweroff)


EDIT /home/root/.config/openbox/menu.xml :
Code:
<?xml version="1.0" encoding="UTF-8"?>

<openbox_menu xmlns="http://openbox.org/3.4/menu">

<menu id="apps-accessories-menu" label="Accessories">
  <item label="Svkbd">
    <action name="Execute">
      <command>svkbd-mobile-intl -g 1400x320+20+700</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
  <item label="Onboard">
    <action name="Execute">
      <command>onboard  -l Small -x 20 -y 720 --size 1400x340</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="apps-editors-menu" label="Editors">
  <item label="Featherpad">
    <action name="Execute">
      <command>featherpad --geometry 1400x620+20+60</command>
      <startupnotify>
        <enabled>yes</enabled>
        <wmclass>Featherpad</wmclass>
      </startupnotify>
    </action>
  </item>
  <item label="Abiword">
    <action name="Execute">
      <command>abiword --geometry 1400x620+20+60</command>
      <startupnotify>
        <enabled>yes</enabled>
        <wmclass>Abiword</wmclass>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="apps-term-menu" label="Terminals">
  <item label="Qterminal">
    <action name="Execute">
      <command>qterminal --geometry 1400x620+20+60</command>
    </action>
  </item>
  <item label="Lxterminal">
    <action name="Execute">
      <command>lxterminal</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
  <item label="Uxterm">
    <action name="Execute"><command>uxterm</command></action>
  </item>
  <item label="Xterm">
    <action name="Execute"><command>xterm</command></action>
  </item>
</menu>

<menu id="apps-net-menu" label="Internet">
  <item label="Netsurf">
    <action name="Execute">
      <command> netsurf --scale 150</command>
      <startupnotify>
        <enabled>yes</enabled>
        <wmclass>Netsurf</wmclass>
      </startupnotify>
    </action>
  </item>
  <item label="Luakit">
    <action name="Execute">
      <command>luakit</command>
      <startupnotify>
        <enabled>yes</enabled>
        <wmclass>Luakit</wmclass>
      </startupnotify>
    </action>
  </item>
  <item label="Vncviewer 192.168.43.52:5900">
    <action name="Execute">
      <command>vncviewer -geometry 1400x960+20+60 192.168.43.52:5900</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="apps-office-menu" label="Office">
  <item label="Calculator">
    <action name="Execute">
      <command>/bin/sh /usr/local/bin/mymate-calc.sh</command>
    </action>
  </item>
  <item label="Gnumeric">
    <action name="Execute">
      <command>/bin/sh /usr/local/bin/mygnumeric.sh</command>
    </action>
  </item>
</menu>

<menu id="apps-multimedia-menu" label="Multimedia">
  <item label="Epy">
    <action name="Execute">
      <command>lxterminal -e epy</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item> 
  <item label="Qpdfview">                                                     
    <action name="Execute">                                                   
      <command>qpdfview</command>                                             
      <startupnotify>                                                         
        <enabled>yes</enabled>                                                
      </startupnotify>                                                        
    </action>                                                                 
  </item>                                                                     
  <item label="Gtans">
    <action name="Execute">
      <command>gtans</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="apps-fileman-menu" label="File Managers">
  <item label="PCMan File Manager">
    <action name="Execute">
      <command>pcmanfm</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="apps-graphics-menu" label="Graphics">
  <item label="Drawing">
    <action name="Execute">
      <command>drawing --new-window</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
</menu>

<menu id="system-menu" label="System">
  <item label="Openbox Configuration Manager">
    <action name="Execute">
      <command>obconf</command>
      <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
  </item>
  <separator />
   <item label="Poweroff">
    <action name="Execute">
      <command>/bin/sh /usr/local/bin/mypoweroff.sh</command>
    </action>
  </item>  
</menu>

<menu id="root-menu" label="Openbox 3">
  <separator label="Applications" />
  <menu id="apps-accessories-menu"/>
  <menu id="apps-editors-menu"/>
  <menu id="apps-graphics-menu"/>
  <menu id="apps-net-menu"/>
  <menu id="apps-office-menu"/>
  <menu id="apps-multimedia-menu"/>
  <menu id="apps-term-menu"/>
  <menu id="apps-fileman-menu"/>
  <separator label="System" />
  <menu id="system-menu"/>
  <separator />
 
</menu>

Make scripts to enable menu to call mate-calc, gnumeric, and poweroff:

CREATE /usr/local/bin/mymate-calc.sh :
Code:
#!/bin/sh
env GDK_DPI_SCALE=1.5 mate-calc
CREATE /usr/local/bin/mygnumeric.sh :
Code:
#!/bin/sh
env GDK_DPI_SCALE=1.5 gnumeric
CREATE /usr/local/bin/mypoweroff.sh :
Code:
#!/bin/sh
sync && sudo poweroff


Also fix the scaling of the featherpad app:

EDIT /usr/share/applications/featherpad.desktop:
Code:
Exec=env QT_FONT_DPI=175 featherpad --geometry 780x330+5+30
CREATE /usr/local/bin/myfeatherpad.sh:
Code:
#!/bin/sh
env QT_FONT_DPI=175 featherpad --geometry 780x330+5+30
EDIT the "Editors" section of/home/root/.config/openbox/menu.xml
Code:
<menu id="apps-editors-menu" label="Editors">                          
  <item label="Featherpad">                                            
    <action name="Execute">                                            
      <command>/bin/sh /usr/local/bin/myfeatherpad.sh</command>               
      <startupnotify>                                                         
        <enabled>yes</enabled>                                                
        <wmclass>Featherpad</wmclass>                                         
      </startupnotify>                                                        
    </action>                                                                 
  </item>


MAKE SURE YOU PROPAGATE CHANGES TO THE USER ACCOUNT:

Copy configuration files to /home/myuser/:

# cp -r /home/root/.config/ /home/myuser

# chown -R myuser:myuser /home/myuser/.config


***

Mirror your phone or desktop keyboard output on the Kobo terminal screen, using the Linux "script" utility command:

-We already have hotplug USB keyboard capability in our chroot using a powered connector.

-We can use our phone or desktop keyboard to control our Kobo from a remote VNC or SSH client in an X desktop session.


But the unfortunately-named "script" utility in Linux allows you to share whatever you type in one terminal (e.g. in an SSH session from your phone to the Kobo) to be mirrored to a second terminal (a terminal running in your Kobo chroot).
Therefore, your phone keyboard input is transmitted to the Kobo screen.

The "script" program is part of the util-linux-misc package:

# apk add util-linux-misc

Run this from your Kobo to identify the terminal device:
# tty

Use the device info (e.g. "/dev/pts/1") in a command on the phone's SSH session to the Kobo to echo to that terminal:
# script -f /dev/pts/1

Now your keyboard input on your phone is mirrored to your Kobo.
You can even run vi, nano, mc, etc. this way.

(There is similar functionality in apps like screen, tmux, etc, but I didn't find they performed better for this particular purpose. Also, I found that all of them, including script, had much more lag when I tried to do the same trick in the KOReader terminal, as compared to in our Alpine chroot.)



***

How about let's change the default elinks keybindings to allow normal use of arrow keys:

Append to the end of the config file:
$ vi .elinks/elinks.conf
Code:
##################################
# Automatically saved keybindings
#

bind "main" "Ctrl-F" = "frame-next"
bind "main" "Ctrl-B" = "frame-prev"
bind "main" "," = "history-move-back"
bind "main" "." = "history-move-forward"
bind "main" "u" = "link-info"
bind "main" "Alt-l" = "lua-console"
bind "main" "Down" = "move-cursor-down"
bind "main" "Left" = "move-cursor-left"
bind "main" "Right" = "move-cursor-right"
bind "main" "Up" = "move-cursor-up"
bind "main" "Tab" = "move-link-next"
bind "main" "Shift-Tab" = "move-link-prev"
bind "main" "#" = "toggle-numbered-links"
bind "main" "Ctrl-Right" = "none"

So the new way of navigating in elinks would be:

On startup, enter '.' to see current working directory, or enter a web address.
Tab and Shift-Tab to traverse the links.
Enter to follow link or '.' and ',' to go forward and back.
Space and 'b' to page forward and back.
'[' and ']' to go left and right.
Enter to edit a text field, 'd' to download link.
'a' to add a bookmark, 's' to see them, TAB to move through options.
ESC followed by Down arrow and Left/Right arrows to see menus.
'g' to enter a new address, 'q' to quit.

Main difference being now able to move around the page with arrows keys.
Old Down/Up link travelling replaced by Tab/Shift-Tab, and old Left/Right history traversing replaced by ','/'.'.






***


Xournal is an application for notetaking, sketching, keeping a journal using a stylus:
https://xournal.sourceforge.net/


# apk add xournalpp
# apk add adwaita-icon-theme
# xournalpp

You have to enable touch drawing from the touchscreen section in preferences, or else touch will just pan the screen instead of drawing.

EDIT the "Multimedia" section of /home/root/.config/openbox/menu.xml to add an xournal item:
Code:
<menu id="apps-editors-menu" label="Editors">

  <item label="Xournal">
    <action name="Execute">
      <command>xournalpp</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>


* UPDATE : Add links graphical browser

# apk add links

Open a user terminal from the taskbar and from home folder:

$ nano .links/links.cfg
Code:
menu_font_size 36
html_user_font_size 36
html_numbered_links 1
$ links -g
(ESC and down arrow to see menu or g to open URL, s for bookmarks manager, q to quit)

Right-click on the task bar to resize for keyboard use.

EDIT .config/openbox/menu.xml :
Code:
...
<menu id="apps-net-menu" label="Internet">
  <item label="links">
    <action name="Execute">
      <command> links -g -html-numbered-links 1 -html-user-font-size 36 -menu-font-size 36</command>
      <startupnotify>
        <enabled>yes</enabled>
        <wmclass>links</wmclass>
      </startupnotify>
    </action>
  </item>
...
$ openbox --reconfigure



Bookmark this if you forget the keycodes:
https://www.mobileread.com/forums//s...5&postcount=54

***
***
***

Links Shortcuts Keys:
ESC display menu
^C quit
^P scroll up
^N scroll down
[, ] scroll left, right
up, down select link
->, enter follow link
<-, z go back
g go to url
G go to url based on current url
^R reload
= document info
* toggle displaying of image links (text mode)
d download
s bookmarks
q quit or close current window

-overwrite-instead-of-scroll 1
-html-display-images 1
-html-numbered-links 1

***
***
***

W3m Shortcuts cheatsheet
https://cheatsheetfactory.geekyhacker.com/linux/w3m
⇧r Reload
⇧h Hotkeys
⇧t Open a tab
⌃q Close a tab
⇧u Go to a url
⇧{} Switch between tabs
⌃h Show history
⇧b Exit history
⇧i View image
Esci Save image
c Show which page you are on
u View a URL of a link
Escb View bookmarks
Esca To bookmark
<> Scroll left and right
o Open options/preferences
[number Go to link number
Escl Show all links in a page in pop up form to select (with going to link)

To be able to login to sites that require cookies:
w3m -cookie
Bookmarks are stored in:
~/.w3m/bookmarks.html

***
***
***

MORE LUA KEYBINDINGS:
https://raw.githubusercontent.com/Lu...ets/luakit.txt

:=command mode
:quit
:restart
: open
:bookmarks
:download
:lua <code>
:viewsource (views the source)
:viewsource! (goes back to webpage)

ctrl z=passthrough mode - one-finger scrolls?
Esc=clear all modes, undoes last keypress command
************************************************** *
Pressing f highlights all the links on the page and assigns them a number. At bottom of page, type the corresponding number after Follow: to go to it.

j k h l scroll
Ctrl-e,y,d,u,f,b scrolling
space, backspace, shift space page scrolling
gg top of document
G bottom of document
x% go to x% of document
+=zoom in
-=zoom out
==set zoom

[num]b=load back page [num] in history
r=reload current url
R=reload current url skipping cache
s=stop page loading
gh(gH) open homepage
gd(gD) download page
;i image download

o(O)=open url in same tab
t(T)=open with new tab
w(W)=open url in new window
gt,gr=next (previous) tab [gr is not in default config]
alt+{1,..}=go to specific tab
d or ctrl w=close tab
D or ZQ=close window
< >=reorder tab
Ctrl t=new tab
u=opens the last closed tabs

B[Enter]=create bookmark of current url
gb(gB) bookmarks
************************************************** *
How to group bookmarks:
Type "B" and then after the link add a word, e.g.
:bookmark https://bbs.archlinux.org/viewtopic.php?pid=983863 Archlinux
:bookmark https://bbs.archlinux.org/viewtopic.php?id=125310 Archlinux

,ts toggle javascript
**************************************************
To disable/enable javascript, scripts, and plugins:
Add this to your rc.lua somewhere between the 'require "webview"' line (make sure it is after "binds" as well) and the "end user script loading"
require "noscript"
noscript.enable_scripts = false
noscript.enable_plugins = false
Then use:
,ts to toggle scripts such as javascript and others for the current domain.
,tp to toggle plugins such as Flash for the current domain.
,tr to remove NoScript rules for a given domain.

ga(gA) adblock
************************************************** *
Adblock for luakit:
Use https://gist.github.com/1073680 and put it in your ~/.config/luakit. Name it adblock.lua
Edit your rc.lua and include:
******
require "adblock"
******
Then create a file ~/.config/luakit/adblock.blacklist according to the comment in the adblock.lua. Here's what works for facebook for example:
facebook%.com
Here's a script which translates hosts files for adblocking into an adblock.blacklist file. Use it as an example only!
http://pae.st/4aiQ/
(courtesy Army in Arch Linux Forums)

y=yank element uri or description into primary selection (onto clipboard)
**************************************************
To use ctrl-c to copy to clipboard, go to insert mode first (press i)
You can then use ctrl-v to paste.

ZZ=Quit and save the session
ZQ=Quit and dont save the session
**************************************************
How to set luakit to save the current session every time instead of only by ZZ, even if it's closed by the window manager:
In your rc.lua, place a session.save() at the top of the window.methods.close_win function:
local close_win = window.methods.close_win
window.methods.close_win = function (w, ...)
session.save{w}
close_win(w, ...)
end
Another option offered:
Edit window.lua (should be in ~/.config/luakit, or you should copy it to there from the xdg folder).
On line 658 you'll find a function called "navigate". Add a line just before the closing "end" which is on line 671. The line should save the current session by calling w:save_session().
navigate = function (w, uri, view)
view = view or w.view
if view then
local js = string.match(uri, "^javascript.+)$")
if js then
--return view:eval_js(luakit.uri_decode(js), "(javascript-uri)")
return view:eval_js(luakit.uri_decode(js),
"(luakit::navigate)", true)
end
view.uri = uri
else
return w:new_tab(uri)
end
w:save_session() -- THIS LINE WAS ADDED
end,

************************************************** *
How to change useragent:
globals.useragent = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chromium/14.0.825.0"
If you append ?nobrowsercheck=true to the end of the gmail.com url (or any other url that rejects unknown browsers?) it will let you access it with the normal luakit user agent.

**************************************************
To bind keys to commands, you can use the following template:
~/.config/luakit/userconf.lua
modes.add_binds("normal", {
-- {"<key>",
-- "<description>",
-- function (w) w:enter_cmd("<command>") end}
{"O", "Open URL in a new tab.",
function (w) w:enter_cmd(":tabopen ") end},
...
})
For inspiration, see /usr/share/luakit/lib/binds.lua, where the default bindings are defined.
*************************************************
To use userconf.lua to remap binds,
paste the binding aliases there:
-- Binding aliases
local key, buf, but = lousy.bind.key, lousy.bind.buf, lousy.bind.but
then add binds within the brackets:
------------------ binds.lua
add_binds("normal", {
--for example
-- History
key({}, "b", function (w, m) w:back(m.count) end),
key({}, "n", function (w, m) w:forward(m.count) end),
}, true)

***


Propagate your changes to the /home/myuser/ account:

# cp -r /home/root/.config/ /home/myuser

# chown -R myuser:myuser /home/myuser/.config

***

Last edited by elinkser; 05-12-2024 at 04:45 PM. Reason: ob menu, script mirror,elinks keys,featherpad scaling,xournal,links
elinkser is offline   Reply With Quote