LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   NetBSD Hints (https://www.linuxquestions.org/questions/%2Absd-17/netbsd-hints-4175713894/)

jmccue 06-26-2022 10:36 AM

NetBSD Hints
 
Moved from BSD Screenshots. Just hints I have from playing with NetBSD, maybe others can add items here as time goes on.

HTH:

For suspend, did you see this netbsd.org ?

For 2 finger scrolling, try adding this to xorg.conf

Code:

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "wsmouse"
        Option      "Device" "/dev/wsmouse"
        Option      "ZAxisMapping" "4 5 6 7"
        Option      "EmulateWheel" "true"
        Option      "EmulateWheelButton" "2"
        Option      "XAxisMapping" "6 7"
        Option      "YAxisMapping" "4 5"
EndSection


jmccue 06-27-2022 09:26 AM

Just stopping this from being 'marked as zero'

rufwoof 07-01-2022 02:46 PM

Nice!

I'm getting quite used to using page up/down and arrow up/down however, on my laptop both of those are in a vertical line of keys to the far right. Or space and shift-space. Or a combination of both, left hand thumb on spacebar to scroll down, right hand index finger on page up to scroll up.

rufwoof 07-01-2022 02:56 PM

I don't really bother with suspend as I tend to vnc into a linux box for my gui desktop/programs (such as chrome, libreoffice ..etc.). So mostly just boot netbsd and fire up vncviewer to connect into that always on (server) desktop.

I find the best choice is to install tigervnc on both boxes and run x0vncserver on the server, that way for me has videos/youtubes play as well via vnc (same lan) as if played directly.

My linux server is a read only contained system, so a reboot has it back to pristine/clean again, so any virus caught whilst surfing only persist for that session, are automatically eradicated after a restart. Whilst my data files on the NetBSD laptop are secure in that the only outside communications layer is the vncviewer session, which is just basically a pixed read/write activity. No risk of ransomware or suchlike.

All of OpenBSD additional security was pretty much wasted in my usage case, unnecessary overheads. I'm very much liking NetBSD's quickness in comparison.

rufwoof 07-01-2022 06:52 PM

Another source of hints

such as .shrc tips

rufwoof 07-02-2022 03:33 AM

Small tty font
 
I find the ctrl-alt-Fn (tty) fonts too small for my liking, but do like that smaller font for the initial bootup (can see more of what messages might have been indicated). So in .shrc or .profile or wherever alongside setting my keyboard to gb

setxkbmap gb

I also set a larger font
Code:

if [ ! -z $(tty | grep tty) ]; then
  /sbin/wsconsctl -f $(tty) -dw font="Boldface 16x32"
fi

which on my 1366x768 laptop has the tty look more like a regular 80x25 display rather than squint-to-view micro-text.

jmccue 07-02-2022 07:39 AM

rufwoof -

Thank You, I have been looking for that, I had it a long time ago but lost my notes and I could not find this setting in google. I am now using it!

rufwoof 07-02-2022 08:02 AM

Quote:

Originally Posted by jmccue (Post 6365068)
rufwoof -

Thank You, I have been looking for that, I had it a long time ago but lost my notes and I could not find this setting in google. I am now using it!

There's probably a better way of doing the is tty test than my crude $(tty | grep tty) - but it does the job :)

rufwoof 07-02-2022 08:08 AM

Quote:

Originally Posted by jmccue (Post 6363655)
Moved from BSD Screenshots. Just hints I have from playing with NetBSD, maybe others can add items here as time goes on.

HTH:

For suspend, did you see this netbsd.org ?

For 2 finger scrolling, try adding this to xorg.conf

Code:

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "wsmouse"
        Option      "Device" "/dev/wsmouse"
        Option      "ZAxisMapping" "4 5 6 7"
        Option      "EmulateWheel" "true"
        Option      "EmulateWheelButton" "2"
        Option      "XAxisMapping" "6 7"
        Option      "YAxisMapping" "4 5"
EndSection


Tried that - but didn't work for my laptop touchpad.

First off I had no xorg.conf so used X -configure ... to generate one, but startx didn't work with that so I removed that /etc/xorg.conf and started X and extracted the default Screen settings being used for that (working) version (from /var/log/Xorg.1.log) and edited the xorg.conf to use those instead ... which worked OK. I then added those additional elements to the Mouse section, but touchpad behavior remains the same (no two finger scrolling). As I said before, not really a bother for me as page or arrow up/down works fine. More of a issue is that light touching of the touchpad invokes a click or mouse cursor move action which can be a bother at times when typing.

rufwoof 07-02-2022 08:28 AM

screenshots
 
1 Attachment(s)
I have just base NetBSD installed, with pkgin and tigervnc the only other things installed on top of that.

For screenshots I use xwd -root >file.xwd, or with a delayed snapshot using
sleep 10;xwd -root >file.xwd

I then scp that over to my server and use gimp to open that file and Export it as a png (and a jpg ... and pick whichever is the smaller filesize as the version to use/upload).

Others I see pipe the xwd file through 'convert' - but that requires additional packages to be installed.

Alternatively there are online converters, a quick search for example indicated https://convertio.co/xwd-png/ ... but I haven't actually tried that.

Then to upload to a post, select the post editor choice that has the additional options and simply select and then upload that file, before closing the attach files window and the image should be visible as an attachement.

rufwoof 07-02-2022 08:34 AM

battery charge/CPU temperature
 
For cli based indication of your battery charge and/or cpu temperature ...etc - just run ...

envstat

rufwoof 07-02-2022 03:18 PM

Update CPU Microcode on NetBSD
 
https://retrobsd.ddns.net/57fd9.htm

... and other tips (Click the RetroBSD Net label in the top left corner)

rufwoof 07-02-2022 07:04 PM

colorls
 
1 Attachment(s)
Install colorls (pkgin install colorls) and set your preference of colors in .Xdefaults/.Xresources, create a alias ls="colorls -G" ... so ls uses colors to distinguish different files (blue for folders, red for executables ...etc.). I've also tweaked the colors in .ctwmrc

rufwoof 07-03-2022 02:27 PM

Quote:

Originally Posted by jmccue (Post 6365068)
rufwoof -

Thank You, I have been looking for that, I had it a long time ago but lost my notes and I could not find this setting in google. I am now using it!

Editing /etc/wscons.conf to include ...

setvar ttyE0 font Boldface\\\ 16x32
setvar ttyE1 font Boldface\\\ 16x32
setvar ttyE2 font Boldface\\\ 16x32
setvar ttyE3 font Boldface\\\ 16x32

is an alternative choice. Boots with the green kernel regular text mode style, switches to white smaller graphics mode system boot font, until the wscons.conf file is parsed in late boot when the Boldface larger font kicks in. Note that the three \\\ are required for correct parsing to occur.

rufwoof 07-04-2022 09:23 AM

Low battery alert sound
 
Rather than clutter a ctwm desktop with a laptop battery indicator I knocked out this script that sounds an alert once the batter level declines to 33% and the system isn't connected to mains power

Code:

#!/bin/sh
#                                          NetBSD amd64 laptop low battery warning
# Uses audiocfg test 0 as a audible alert sound i.e. assumes your sound is working
#    References envstat to identify the current charge level and whether mains is
#                                                                connected or not
#                              For simplicity converts the likes of 92.13% to 9213
#                      Hard coded to initiate sound alerts at below 3333 i.e. 33%
#                          Hard coded to wait 10 seconds seconds, between measures
#          Save as battery.sh in your home folder and run it in background in your
#                                            .xinitrc or .xsession (if using xdm)
#                                                    i.e. /home/user/battery.sh &

sleep 30                                          # wait until X has settled down
while :;do
        CHARGING=$(envstat | grep "charging:    FALSE")        # Only test if not
        if [ ! -z "$CHARGING" ];then                            #      using mains
            LEVEL=$(envstat -d acpibat0 | grep charge: | \
                                                  awk {'print $6'} | tr -d '()%.')
            if [ $LEVEL -lt 3333 ];then
                audiocfg test 0        # we use this as a low battery alert sound
            fi
        fi
        sleep 10
done



All times are GMT -5. The time now is 02:22 PM.