OESF Portables Forum

Model Specific Forums => Gemini PDA => Gemini PDA - Linux => Topic started by: jakfish on April 17, 2021, 02:25:29 pm

Title: Gemian Tips/Workarounds
Post by: jakfish on April 17, 2021, 02:25:29 pm
My Gemini had been living in a drawer and Covid downtime made me haul it out and do a Gemian-only install. All my thanks to the wonders of Adam Boardman and his fine veteran collaborators, and another shout-out to geminifrench, whose excellent tutorial got me up and running. Below are some tweaks and workarounds that have helped make my install work very well:



CONKY:

Necessary files: conky-all, calcurse. I run two conkys: one to display the current calendar, the other to use calcurse to show the next two weeks of my google calendar events. If your *.ics calendar is non-google, local, etc, then this command is fine for extracting events:

Code: [Select]
calcurse -i /home/gemini/yourcalendar.ics
In conky, this command displays the next 14 days of your *.ics events (-r14 can be modified to the number of days needed):

Code: [Select]
calcurse -a -r14
Stretch’s conky is buggy, so if not properly situated, your calendar print-out will be jumbled or misaligned. Use a monospace font. Disproportionate TTFs (i.e. Arial, Deja Sans, etc) often won’t display calendar rows correctly. The font problems are why it’s best to run the calendar separately and experiment with inserting spaces before the actual calendar command:

CALENDAR EDIT #1: installing gcal and using gcal in place of cal (eg: $alignc${font Hack:style=Bold:size=13}${exec gcal} appears to alleviate formatting issues and exact positioning of the calendar on the desktop no longer seems necessary]

.conkyrc1:

Code: [Select]

conky.config = {
    alignment = 'middle_middle',
    background = false,
    border_width = 1,
    double_buffer = true,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans:style=bold:size=14',
    gap_x = -150,
    gap_y = -300,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'override',
    own_window_hints = 'undecorated, below,sticky,skip_taskbar,skip_pager',
    own_window_colour = '000000',
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false
}

conky.text = [[


$alignc${font Hack:style=Bold:size=13}${exec cal}

]]

.conkyrc2:

Code: [Select]

conky.config = {
    alignment = 'top_right',
    background = false,
    border_width = 1,
    double_buffer = true,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans:style=bold:size=14',
    gap_x = 5,
    gap_y = 5,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'override',
    own_window_hints = 'undecorated, below,sticky,skip_taskbar,skip_pager',
    own_window_colour = '000000',
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false
}

conky.text = [[

$alignc${time %B %-d, %-I:%M%P}

${execi 3600 calcurse -a -r14}

]]

The “override” command will keep conky visible when clicking the desktop, but “show desktop” will make conky disappear. My workaround is to make ALT+4 a shortcut to “minimize window” and use that rather than “show desktop”

To run conkys that will display the current month and your google events, this script will restart conkys, clear out your calcurse appts (or you’ll have double appts), download your public calendar to /home/gemini/basic.ics (basic.ics must already exist in your directory), and start both conkys. The sleep commands give time for the desktop to load at boot:

Code: [Select]
#!/bin/sh
sleep 7
killall conky
sleep .5
rm ~/.calcurse/apts
sleep .5
wget --no-check-certificate -nH -rK https://www.google.com/calendar/ical/YOUR_PUBLIC_GOOGLE_CALENDAR_WEB_ADDRESS/basic.ics -O /home/gemini/basic.ics
sleep 5
calcurse -i /home/gemini/basic.ics
sleep 1
conky -q -c /home/gemini/.conkyrc1 &
conky -q -c /home/gemini/.conkyrc2

CALENDAR EDIT #2:  Now that I've had a chance to explore the great home-brewed Gemian PIM apps, I now see that gka-calendar-qt uses the ical format. So if you modify the wget to send a web ics calendar to gka-calendar-qt's default directory, your entire calendar is at your disposal:

Code: [Select]
wget --no-check-certificate -nH -rK https://www.google.com/calendar/ical/YOUR_PUBLIC_GOOGLE_CALENDAR_WEB_ADDRESS/basic.ics -O /home/gemini/.local/share/evolution/calendar/system/calendar.ics
WIFI:

For some reason, my gemian boots with wifi off and bluetooth on. In sessions/autostart, I reverse this:

Code: [Select]
    connmanctl enable wifi
    connmanctl disable bluetooth

To toggle wifi, I found this great script, and my apologies for being unable to cite its author:

Code: [Select]
    #!/bin/sh
    if connmanctl state | grep online
    then
        connmanctl disable wifi
    else
        connmanctl enable wifi
    fi
exit 0

The toggle script can be keystroked in Preferences/LXQT settings/Shortcut Keys

[Does anyone know how to modify this script to toggle bluetooth?]

USING VLC WITH KEYBOARD:

Regardless of the media player, I found that none of them would respond to the media/volume keys unless the media player was the active window. After installing wmctrl and xdotool, a script can bring up a minimized VLC, send a command such as “pause” or “next song,” then re-minimize VLC (I have not yet made these send-commands work with SMPlayer, but VLC uses about the same amount of CPU)

For example:

Code: [Select]
    #!/bin/sh
    wmctrl -a "VLC"
    sleep .5
    xdotool key space
    sleep .5
    xdotool getactivewindow windowminimize

“space” is VLC’s own command to play/pause. Other VLC-specific commands: p=previous song; n=next song. For volume control, I simply use:

Code: [Select]
    #!/bin/sh
    wmctrl -a "VLC"

which brings up a minimized VLC, and from there, VLC’s own volume keys—control-up and control-down—will work, then (if set as your own shortcut), ALT+D will minimize VLC after volume adjustment

BROWSING:

For quick browsing, I prefer Links2. This script will start Links2 in graphics mode, and send an “s” to bring up the bookmark menu:

Code: [Select]
    #!/bin/sh
    xlinks2 &
    sleep 1.5
    xdotool key s &

UPTIME/BATTERY/WEATHER:

After installing libnotify-bin, this script will send out a bubble with your uptime, battery, and weather, and can be keystroked in Shortcuts if needed:

Code: [Select]
#!/bin/sh
notify-send " up: $(uptime | sed 's/^.\+up\ \+\([^,]*\).*/\1/g') batt: $(cat /sys/class/power_supply/battery/device/power_supply/battery/uevent | grep -m 1 'POWER_SUPPLY_CAPACITY' | cut -c23-25)%" "$(curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=20902 \ | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3 \1/p')"

United States users can simply substitute my zipcode of “20902” for their own—I have yet to figure out how to use the locCode for other countries. Please advise if you know :) Ditto about how to put the temperature into Celsius

ROOT FILEMANAGER:

I prefer a GUI for root stuff. PCMANFM is buggy and won’t permit root (at least not for me), so I install Thunar, which does allow a rooted file manager, and is lightweight in terms of additional dependencies, but unfortunately uses very small text

EDIT: See WORKING WITH SMALL-FONT APPLICATIONS for Thunar dpi workaround

KEYBOARD MAPPING:

I have remapped keys for my US keyboard, making a true quote/doublequote key in place of the pipe/backslash key (pipe/backslash are brought up by fn combinations). If anyone is interested, I can post the gemini kb, which goes in /usr/share/X11/xkb/symbols/planet_vndr  I also have this remapping in .apk, which works in both Gemini and Cosmo Android

Again, all my gratitude to those Linux folks that have been so helpful, and to Varti, who makes this forum happen.

Jake
Title: Re: Gemian Tips/Workarounds
Post by: Varti on April 19, 2021, 05:39:50 am
Great guide, thanks for posting! I'll follow it once I'll (finally) install Gemian. My Gemini has been Android-only all this time, now I'm trying to figure out if it could be possible to install Android, Gemian and SailfishOS in a triple boot environmnet, though it seems that it's only possible to install either Gemian or SFOS, and not both.

Varti
Title: Re: Gemian Tips/Workarounds
Post by: jakfish on April 19, 2021, 09:46:55 am
Hmm, unless the flashing procedure has changed over the years, I think installing all 3 OS's is doable. I recall having all 3 available in the beginning days of my Gemini (even a rooted Android).

Jake
Title: Re: Gemian Tips/Workarounds
Post by: geminifrench on April 22, 2021, 02:24:18 am

KEYBOARD MAPPING:

I have remapped keys for my US keyboard, making a true quote/doublequote key in place of the pipe/backslash key (pipe/backslash are brought up by fn combinations). If anyone is interested, I can post the gemini kb, which goes in /usr/share/X11/xkb/symbols/planet_vndr  I also have this remapping in .apk, which works in both Gemini and Cosmo Android



I have no "pipe" char on my french keyboard.
I want to use FN+"g" to use 'pipe' in place of underscore.
I have this in /usr/share/X11/xkb/symbols/planet_vndr /gemini :
"key <AC05> { [ g, G, underscore, dead_macron ] };

Do you know how to change 'underscore' by 'pipe' ? I don't know what is the name for 'pipe' that i must use in it.



EDIT :
ok, i think i found.
'bar' seem to be the answer
Title: Re: Gemian Tips/Workarounds
Post by: jakfish on April 22, 2021, 10:18:31 am
Yes, pipe vs bar is very confusing. When I googled it, the definitions can't seem to make up their mind. Glad you figured it out.

Jake
Title: Re: Gemian Tips/Workarounds
Post by: jakfish on April 22, 2021, 10:36:04 am
AUTOMOUNT SD CARD:

I tried a variety of ways to get mine to mount at boot/desktop, and for me, this turned out to be the easiest approach:

Code: [Select]
apt install udiskie
apt install at-spi2-core

Then, to find the proper dev identification of your sd card, mount it and run:

Code: [Select]
sudo blkid
My sd card is identified as /dev/mmcblk1p1, so in Sessions/Autostart, I use:

Code: [Select]
udiskie-mount /dev/mmcblk1p1
So far, it automounts at every boot, without sudo, fstab, etc.

Jake
Title: Re: Gemian Tips/Workarounds
Post by: Varti on April 25, 2021, 03:38:41 am
I have set the topic as sticky, so that's easier to find it.

Varti
Title: Re: Gemian Tips/Workarounds
Post by: jakfish on April 25, 2021, 02:21:51 pm
Much obliged, Varti.

WORKING WITH SMALL-FONT APPLICATIONS:

Unless you're only using Gemian's expertly-ported programs, you can run into applications whose text is small enough to be unreadable and can't be adjusted. I've tried Magnus, a screen magnifier, and I found it frustrating since it only magnifies part of the application's window. Luckily, Gemian/xrandr allows for a temporary change in the dpi, so you can run a small-font program in a larger dpi, then return to the default 96 dpi upon closing. wmctrl and xdotool are also necessary to these scripts.

For example, I like to use a file manager for root work, but Thunar, though light on additional dependencies, has minuscule, unadjustable text, This script changes the dpi for Thunar, making it very readable, and restores the default dpi at exit:

Code: [Select]
#!/bin/sh
xrandr --dpi 300 &
sleep .5
#I've given myself total root privileges in /etc/sudoers
sudo thunar &
sleep .5
wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz
#for some reason, --dpi 200, generates 96 dpi in Appearance/Font/Resolution (DPI)
xrandr --dpi 200

I'm a big fan of gaiksaurus, a thesaurus program that is unreadable in 96 dpi. Its window is also very small, making its scroll bar equally problematic. This script allows for easy reading and maximizes the window so that the scroll bar is flush to Gemian's right side, easier to maneuver. [gaiksaurus has an especially-small font, so 350 dpi seems necessary]

If you install xclip, you can also run the first part of the thesaurus script, which copies a highlighted word and sends it to gaiksaurus which will present the word's synonyms upon start. If nothing is copied into xclip's clipboard, then gaiksaurus simply starts, ready for word entry:

Code: [Select]
#!/bin/sh
if [ ! $1 ];then
MYWORD=`xclip -o`
else
MYWORD=$@
fi
xrandr --dpi 350 &
gaiksaurus $MYWORD &
sleep 1
wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz
sleep .5
#ALT+m is my shortcut for no window title bar
xdotool key ALT+m &
xrandr --dpi 200

If for some reason, you can't get back to the default dpi, simply log-out/log-in, and it will return. These scripts are not 100% effective--for instance, they have no effect on synaptic. Synaptic installs in Gemian, but is illegibly small, no matter how the dpi is tweaked.

SYNAPTIC EDIT: While changing the dpi doesn't help synaptic's visibility, if you open synaptic and go Settings/Preferences/Columns and Fonts/Fonts, then tick "Use custom application font" and "Use custom terminal font" and choose a much larger size, you can make synaptic persistently readable. I needed a mouse and a good magnifying glass to make this happen :)

Jake
Title: Re: Gemian Tips/Workarounds
Post by: jakfish on April 29, 2021, 02:05:36 pm
THUNAR:

I've found three problems with PCMANFM, which made me turn to Thunar as my file manager:

1) Upon reopening, PCMANFM can't remember the previous ticking of "show hidden files"
2) Its sudo feature is broken
3) PCMANFM can't remember your login/password to ftp sites

Thunar, though an xfce app, installs with a minimum amount of dependencies, plays nice with kwin_x11 window manager, and the icons of its side panel are adjustable, therefore finger-friendly. It does need a larger dpi, but the script in the previous post works admirably. For font choice/size, I stumbled on a great workaround to the /home/gemini/.gtkrc-2.0. Add the following to the end of the default .gtkrc-2.0:

Code: [Select]
style "fonttweak"
{
font_name = "Arial Black 10"
}
widget_class "*Thunar*View*" style "fonttweak"

The font can be any choice/size, and to change the font in a rooted Thunar, you can copy the .gtkrc-2.0 to /root. In /root/.gtkrc-2.0, the font pt may need readjusting as the default font size is different in rooted Thunar.

As for running root in thunar, you can add that capability in "Custom Actions." gksudo no longer works, so change that to:

Code: [Select]
sudo thunar
By default, Thunar will not run scripts (it will merely open them for editing). To override this, make certain Thunar is closed, then:

Code: [Select]
xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default --create --type bool --set true
Thunar remembers my login/password to my in-house ftp server, remembers to show hidden files, and is easily rooted.

Jake
Title: Re: Gemian Tips/Workarounds
Post by: tysiong on January 11, 2022, 12:01:31 pm
Thank you very much for the sharing.

Does anyone know how to modify this script to toggle bluetooth?

You may want to try this:
Code: [Select]
    #!/bin/sh
    if connmanctl technologies | grep -zoP "bluetooth\n  Powered = True\n"
    then
        connmanctl disable bluetooth
    else
        connmanctl enable bluetooth
    fi
exit 0

YS Tan