DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 15th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default Bare Graphical DE for OpenBSD 6.5

This grew from a previous SimpleDesktop thread that built a lightweight Desktop Environment (DE) in OpenBSD. The older project relied on manually edited configuration scripts and menus. With the inclusion of x11/jgmenu (accepted for 6.5 but currently missing in openports.se), users can now configure their DE with Graphic User Interfaces (GUI) without the usual bloat. The GUI configuration tools are x11/obconf, tint2conf and x11/lxappearance. The resting memory footprint is around 170mb.

Other changes include replacing x11/wbar with a second instance of x11/tint2. An additional benefit with tint2 is that xcompmgr transparency allows for any wallpaper the user wants. Base applications, xterm and xcalc, have been provided *.desktop entries in ~/.local/share/applications and utilize icons from the Adwaita icon theme.

Even though the ability to customize the DE has been simplified, users still need to be familiar with the OpenBSD FAQ, man pages, package management and text editing. A Base OpenBSD install provides vi, mg, ed and xedit. editors/leafpad is from the LXDE project, is available in ports and is a good fit for newbies who want a simple gtk based editor.

The project has 2 levels. The first level provides just the base install + bare desktop. The experienced open source user then adds their favorite applications.

Name:  baregui_screen.jpg
Views: 487
Size:  34.0 KB

The next, optional level is a list of commonly used packages that have freedesktop compliant menu entries and are well supported in OpenBSD. The project essentially chooses web browsers, email clients and office suites using criteria described later. After adding the additional packages, the DE is functionally the same as the older SimpleDesktop project. NCurses applications can be given *.desktop menu entries - mail/abook, productivity/calcurse and audio/ncmpc have examples in following posts.

Name:  added_apps_screenshot.jpg
Views: 465
Size:  36.9 KB

To get started, click the link to download. Extract the following tarball and the README should take you the rest of the way. If you are working from a new OpenBSD install, without a browser, this base ftp command should download:

Code:
ftp -o BareGUI.tar.gz http://www.daemonforums.org//attachment.php?attachmentid=860&d=1556117116
BareGUI.tar.gz

Last edited by shep; 24th May 2019 at 02:38 PM.
Reply With Quote
  #2   (View Single Post)  
Old 15th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Adding Freedesktop compliant *.desktop entries

OpenBSD has some useful base applications that do not have menu entries. I have provided ~/.local/share/applications/*.desktop entries for xterm and xcalc along with an expanded ~/.Xdefaults. The ~/.Xdefaults file sets background color, foreground color, font, scrollbar for xterm. A classic Ti80 calculator look for xcalc is included. You can look at the examples and reference this Arch Linux wiki in order to generate additional *.desktop entries:

Desktop Entries - ArchWiki

The Arch wiki also details how to avoid duplicate desktop entries from when there are duplicates in /usr/local/share/applications and ~/.local/share/applications. Just append
Code:
NoDisplay=true
to the entry you want to hide.

Another source of *desktop entries is Debian. Debian has a policy of adding *.desktop files that are not provided upstream. Here is a link to Debian xterm.desktop file

Debian xterm sources

Last edited by shep; 13th June 2019 at 06:04 PM.
Reply With Quote
  #3   (View Single Post)  
Old 15th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Scripting and adding *.desktop entries for ncurses apps
Ncurses applications are lightweight, responsive applications that run in a terminal. One issue is that the terminal may need to be resized to fully display the application. I do this by running a shell script that sets the xterm size and then executes the Ncurses application. The shell script is then executed by the *.desktop entry. When setting the geometry initially, you can mouse drag the corner of the xterm, running the ncurses app, and adjust. The changes in the geometry are displayed in a pop-up as long as the mouse button remains depressed. Note the geometry when it looks good and enter it after the xterm -g flag.

Calcurse
~/scripts/calcurse_start.sh
Code:
#!/bin/ksh
xterm -g 65x30 +sb -T "Calcurse Calendar" -e calcurse
with the following:
~/.local/share/applications/calcurse.desktop
Code:
[Desktop Entry]
Name=Calcurse
GenericName=Calendar
Comment=Calendar
Exec=/home/YOUR_USER/scripts/calcurse_start.sh
Terminal=false
Type=Application
Encoding=UTF-8
Icon=x-office-calendar
Categories=Office;Calendar;
NcMPC
~/scripts/ncmpc_start.sh
Code:
#!/bin/ksh
xterm -g 110x22 +sb -T "NcMpc Music" -e ncmpc -f ~/.config/ncmpc/ncmpcrc
~/.local/share/applications/ncmpc.desktop
Code:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=NcMPC
GenericName=MPD
Comment=MPD Frontend
Exec=/home/YOUR_USER/scripts/ncmpc_start.sh
Icon=audio-x-generic
Categories=AudioVideo;Audio;
Terminal=false

Last edited by shep; 24th May 2019 at 02:40 PM.
Reply With Quote
  #4   (View Single Post)  
Old 15th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

x11/yad Tricks - scripting tint2/clock/calendars and abook sub-menu entries.

Tint2 does not provide a popup calendar but does have the capability to launch one. Most of the Linux based Openbox/tint2 distributions use gsimplecal which is not yet ported to OpenBSD. If anyone wants a simple port submission to learn with, gsimplecal should be a good candidate.

I utilized the calendar function in x11/yad. The script positions the calendar under the clock and can be reviewed in ~/scripts/calendar.sh. The code to run the calendar script is in the clock section of ~/.config/tint2/tint2rc.

Sylpheed comes with a functional address book but if you use mutt/neomutt/alpine, mail/abook is good for contact management. One challenge was that I like separate address books. It made bulk emails easier although I still have to manually copy/paste the recipients to Bcc:.

Here is the yad script that itemizes my abook addressbooks:
~/scripts/yad_abook.sh
Code:
#!/bin/ksh

GTK_THEME=Adwaita:dark \
yad --form --width=256 --text="Choose an Addressbook:" --title="Abook" \
--field="AirPark":fbtn 'xterm +sb -g 72x26 -T "Airpark AddressBook" -e abook --datafile /home/YOUR_USER/.abook/airparkaddress' \
--field="BlockWatch":fbtn 'xterm +sb -g 72x44 -T "Block AddressBook" -e abook --datafile /home/YOUR_USER/.abook/blockaddress' \
--field="Business":fbtn 'xterm +sb -g 72x44 -T "Business AddressBook" -e abook --datafile /home/YOUR_USER/.abook/bizaddress' \
--field="Family":fbtn 'xterm +sb -g 72x20 -T "Family AddressBook" -e abook --datafile /home/YOUR_USER/.abook/familyaddress' \
--field="Friends":fbtn 'xterm +sb -g 72x22 -T "Friends AddressBook" -e abook --datafile /home/YOUR_USER/.abook/friendsaddress' \
--window-icon=contact-new --button=gtk-cancel:6
and the desktop entry:
~/.local/share/applications/abook.desktop
Code:
[Desktop Entry]
Name=Abook
GenericName=Contacts
Comment=Manage Contacts
Exec=/home/YOUR_USER/scripts/yad_abook.sh
Icon=x-office-address-book
Terminal=false
Type=Application
StartupNotify=false
Categories=Office;ContactManagement;

Last edited by shep; 5th May 2019 at 08:02 PM.
Reply With Quote
  #5   (View Single Post)  
Old 15th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Basis for package recommendations in OpenBSD 6.5

Web Browsers
In OpenBSD, the major browsers can be categorized by security updates and privilege separation. Landry Bueil provides a Mozilla build site for www/mozilla-firefox, www/firefox-esr and mail/mozilla-thunderbird. Previously, only firefox-esr and thunderbird made it through the 6/12month support cycles without dependency issues. No buildbot exists for www/chromium or its privacy enhanced fork, www/iridium. Iridium and Chromium are reported to provide better privilege separation. Firefox-esr and/or Iridium are recommended.

Email Clients
Email clients fall into 3 categories. In the first category, inline html, OpenBSD has mail/evolution and mail/mozilla-thunderbird. Evolution pulls many Gnome3 dependencies leaving Thunderbird. Html emails are generally frowned upon as click prompts can be disguised to run scripts or take you to a spoofed website. It is reported that this is how the GRU gained access to the DNC's email server. Evolution and Thunderbird have an option to display emails as text.

The second category has text based email clients with GUI's. mail/sylpheed, mail/claws-mail and mail/trojita are available. Claws-mail, forked from Sylpheed, provides plugins but the html plugins were discontinued in OpenBSD due to security problems. Trojita is Qt5 based, has had no recent upstream commits, only supports imap and was buggy for me. I recommend Sylpheed in this category.

The last group are keyboard driven, text clients like mail/mutt, mutts' feature enhanced fork: mail/neomutt and mail/alpine. If you have to frequently work through large numbers of emails, setting up and learning the keystokes for mutt/neomutt is worthwhile. OpenBSD also comes with a simple MUA, mail, that can be used with opensmptd.

Office
The most popular office suite is editors/libreoffice. It is an active, widely utilized suite that has good compatibility with MSOffice. It is large and resource heavy but is well implemented in OpenBSD. Lighter office utilities are editors/abiword, math/gnumeric. productivity/siag and editors/calligra. Calligra is Qt5 based, Abiword is currently broken and Siag has no longer actively developed.

Last edited by shep; 24th April 2019 at 11:04 PM.
Reply With Quote
  #6   (View Single Post)  
Old 16th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Adding authentication keys and PKG_PATH's for M:tier and Mozilla builds

The M:tier instructions are here. Note that the *.pub keys are specific for the OpenBSD release and there are presently no updates for 6.5.

The Mozilla buildbot pub key is here and is installed in the same /etc/signify directory as the M:tier key. Mozilla updates have shown up at M:tier but usually several days after they are published at the Mozilla buildbot. If you wish to get the Mozilla update earlier, install the *.pub key and run
Code:
PKG_PATH=https://packages.rhaalovely.net/6.5/amd64/ && export PKG_PATH && pkg_add -u firefox-esr

Last edited by shep; 16th April 2019 at 09:58 PM.
Reply With Quote
  #7   (View Single Post)  
Old 16th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Time and Weather

NTP, x11/yad, graphics/ImageMagick and net/curl based Weather scripts. Note: In OpenBSD, it is possible to use the base ftp command to pull the *.txt files from https:// sites. I used curl so the same scripts will run in Debian as #!/bin/bash scripts. If you are an OpenBSD purist, you can easily modify the scripts to use the base ftp command.

The base distribution utilizes openntpd to synch the computer clock on startup. man ntpd.

My father was a USN trained pilot/navigator who compulsively sync'd his watch to the National Institute of Standards and closely monitored the weather. These weather scripts are helpful in scheduling outdoor activities and IMHO are better than the Gnome/XFCE4/KDE weather applications for US users. They do not constantly poll saving CPU cycles and bandwidth. The data is from US sources rather than interpolated data from Scandinavia.

The following scripts will pull METAR (MEteorological Terminal Area Report) and METAF (MEteorological Terminal Area Forecast) from a nearby U.S. airport. These are free aviation weather products which are updated hourly.
~/scripts/weather.sh
Code:
#!/bin/ksh
xterm -g 75x17-1+39 -T "Yakima, WA Weather" -hold -e \
curl -sk https://tgftp.nws.noaa.gov/data/observations/metar/decoded/KYKM.TXT
~/scripts/terminal_forecast.sh
Code:
#!/bin/ksh
# This is a simple script that downloads current weather conditions and zone
# forecast from the National Weather Service to /tmp and displays them.
# 
# To change the forecast zone, replace wa/waz027 with another forecast zone.
# See <http://weather.noaa.gov/pub/data/forecasts/zone/> for a list.
#
xterm -g 75x50-1+39 -T "Yakima, WA Forecast" -hold -e \
curl -sk https://tgftp.nws.noaa.gov/data/forecasts/zone/wa/waz027.txt
This script pulls an animated *gif of a nearby weather radar station and displays it in ImageMagick
~/scripts/weather_radar.sh
Code:
#!/bin/ksh

# This is a simple script that downloads a composite radar image for the NW from
# Weather Wunderground

# The script is configured for the Northwest.
# 
# Animated gifs available at https://www.wunderground.com/weather-radar/united-states/

curl https://icons.wxug.com/data/weather-maps/radar/united-states/redmond-oregon-region-current-radar-animation.gif | \
 animate -immutable -loop 0 -title "NorthWest Radar Loop"
You can adapt this script to pull any Weather Wunderground animated gif, NOAA satellite gif's and weather.gov radar 'loop' images you can find on the internet.

I use a yad --form to group all my weather products
~/scripts/yad_weather.sh
Code:
#!/bin/ksh

GTK_THEME=Adwaita:dark \
yad --form --width=256 --text="Weather Menu:" --title="Weather" \
--field="KYKM Current":fbtn 'sh /home/YOUR_USER/scripts/weather.sh' \
--field="KYKM Forecast":fbtn 'sh /home/YOUR_USER/scripts/weather_forecast.sh' \
--field="KYKM TAF":fbtn 'sh /home/YOUR_USER/scripts/terminal_forecast.sh' \
--field="PDT Radar":fbtn 'sh /home/YOUR_USER/scripts/pdt_radar.sh' \
--field="NW Satellite":fbtn 'sh /home/YOUR_USER/scripts/noaa_nw_radar.sh' \
--field="NW Composite Radar":fbtn 'sh /home/YOUR_USER/scripts/weather_radar.sh' \
--field="CONUS Radar":fbtn 'sh /home/YOUR_USER/scripts/conus_radar.sh' \
--window-icon=weather-overcast --button=gtk-cancel:6
and call the yad_weather.sh script with a tint2 button
~/.config/tint2/tint2rc
Code:
#-------------------------------------
# Button 1
button = new
button_icon = /usr/local/share/icons/Adwaita/32x32/status/weather-overcast.png
button_text = 
button_tooltip = "Yakima, WA Weather"
button_lclick_command = ~/scripts/yad_weather.sh
button_rclick_command = ~/scripts/yad_weather.sh
button_mclick_command = 
button_uwheel_command = 
button_dwheel_command = 
button_font_color = #000000 100
button_padding = 6 3
button_background_id = 0
button_centered = 0
button_max_icon_size = 32

#-------------------------------------
This code is in the provided ~/.config/tint2/tint2rc and can be enabled by editing
Code:
#-------------------------------------
# Panel
panel_items = TSC
panel_size = 100% 38
to

Code:
#-------------------------------------
# Panel
panel_items = TSPC
panel_size = 100% 38

Last edited by shep; 5th May 2019 at 08:03 PM.
Reply With Quote
  #8   (View Single Post)  
Old 16th April 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Tint2 executor to display current wifi connection data.

This project tries to use OpenBSD tools whenever possible and recently the project has implemented a feature which can connect to multiple networks provided they are listed in your /etc/hostname.if file. The following script lets the user know, with a single click, which of the possible networks is being used.

OpenBSD gains Wi-Fi "auto-join".

The script is still a little rough. One issue is that ifconfig line that is parsed for connection data can lead off with "nwid" or "ieee80211". The script currently uses "grep ieee80211". If you do not use the join command your can either replace ieee80211 with nwid in the script or add "join" to your /etc/hostname.if. Some spacing issues in the yad output lead to the addition of non-printable \t "tab".
obsd_wifi_tint2.sh
Code:
#!/bin/sh
# STDERR (descriptor 2) text to STDOUT (descriptor 1)
TEST="$(nc -dzw1 8.8.8.8 443 2>&1)"
if echo $TEST | grep '^Connect' >/dev/null ; then

# IFS; Inter Field Separator (see man ksh)
# to preserve newlines,save and set IFS to space only   
OLD_IFS="${IFS}"
IFS=" "

# capture 'ifconfig' output once and reuse ....
IFCONFIG=$(ifconfig)

NWID="$(echo ${IFCONFIG} | awk '/nwid/{print $3}')" 
CHAN="$(echo ${IFCONFIG} | awk '/nwid/{print $5}')"
BSSID="$(echo ${IFCONFIG} | awk '/nwid/{print $7}')"
SN="$(echo ${IFCONFIG} | awk '/nwid/{print $8}')"
IP="$(echo ${IFCONFIG} | awk '/inet/{print $2}' | tail -n1)"

cat <<END
--------------------------------------------------------------
\tCurrent WiFi Connection
--------------------------------------------------------------

\tNWID  :  $NWID
\tCHAN  :  $CHAN
\tBSSID :  $BSSID
\tS/N\t :  $SN
\tIP\t  :  $IP
END
else
cat <<END
--------------------------------------------------------------
\tCurrently No Connection
\tto google.com port 443
--------------------------------------------------------------
END
fi
yad_wifi.sh
Code:
#!/bin/sh
yad --geometry=-0+38 --text="$(sh /home/jsh/scripts/obsd_wifi_tint2.sh 2>&1)" \
--undecorated --button=gtk-close:6
I added this as a second "button" in my tint2 panel configuration (P).
Code:
#-------------------------------------
# Panel
panel_items = TSPPC
panel_size = 100% 38
-----
 #-------------------------------------
# Button 1
button = new
button_icon = /usr/local/share/icons/Adwaita/32x32/status/weather-overcast.png
button_tooltip = "Yakima, WA Weather"
button_padding = 6 3 0
button_max_icon_size = 24
button_lclick_command = sh ~/scripts/yad_weather.sh
button_mclick_command =
button_rclick_command = sh ~/scripts/yad_weather.sh
# Button 2
button = new
button_icon = /usr/local/share/icons/Adwaita/32x32/devices/network-wireless.png
button_tooltip = "Wireless Connection"
button_padding = 6 3 0
button_max_icon_size = 24
button_lclick_command = sh ~/scripts/yad_wifi.sh
button_mclick_command =
button_rclick_command = sh ~/scripts/yad_wifi.sh
For those using Gnome, KDE4 or XFCE4, you can either make a obsd_wifi.desktop file ,described above, or use yad --notification to produce a sytemtray entry
yad Notification Options
yad Notification

This is the output positioned under the wireless icon in the tint2 panel
Name:  wifi.jpg
Views: 341
Size:  18.1 KB

Last edited by shep; 8th June 2019 at 06:41 PM. Reason: Incorportated @Head_on_a_Stick suggestions
Reply With Quote
  #9   (View Single Post)  
Old 29th April 2019
ripe's Avatar
ripe ripe is offline
Fdisk Soldier
 
Join Date: Feb 2013
Location: Haute-Garonne, France
Posts: 70
Default

This is great ahah!
Thank you

Last edited by ripe; 11th May 2019 at 08:18 AM.
Reply With Quote
Old 8th June 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Backing Up your configuration
Code:
tar cvzf config_bu.tar.gz .local .config scripts
Reply With Quote
Old 10th June 2019
ripe's Avatar
ripe ripe is offline
Fdisk Soldier
 
Join Date: Feb 2013
Location: Haute-Garonne, France
Posts: 70
Default

Thanks.
What about .cache?
Reply With Quote
Old 11th June 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,252
Default

Quote:
What about .cache?
I tried to consolidate most of the configuration files in ~/.config but integrating ncurses apps took some scripting
and user specific ~/.local/share/applications*.desktop files.
If your .cache contains important data you can add it

Code:
tar cvzf config_bu.tar.gz .local .config scripts .cache
Other backup files can include ~/.mozilla and .~/.vimrc

Last edited by shep; 11th June 2019 at 06:40 PM.
Reply With Quote
Old 11th June 2019
ripe's Avatar
ripe ripe is offline
Fdisk Soldier
 
Join Date: Feb 2013
Location: Haute-Garonne, France
Posts: 70
Default

Yes, thank you.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Volume Control Graphical Utility mattthumper OpenBSD Packages and Ports 21 31st July 2015 01:05 AM
Going graphical or not? tamtam FreeBSD General 35 1st November 2008 11:41 PM
Bare Minimum Site-to-Site VPN on OpenBSD ai-danno Guides 0 20th May 2008 12:45 AM


All times are GMT. The time now is 08:15 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick