DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
Default BareGUI for OpenBSD

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. This iteration produces a fast, lightweight stacking desktop with a resting memory footprint around 170mb. When a user adds an applications that has a freedesktop compliant *.desktop entry, it will automatically be added to the menu.

These instructions have been updated for version 6.6. Major changes include the deletion of M:tier update instructions as the project now provides updated packages with the command

Code:
# pkg_add -u
The shebang for all scripts was changed #!/bin/ksh -> #!/bin/sh for portability. The Adwaita icon theme dropped the icons for /usr/local/share/desktop/directories/AudioVideo.directory, /usr/local/share/icons/Adwaita/32x32/status/weather-overcast.png and /usr/local/share/icons/Adwaita/32x32/devices/wireless-network.png. The equivalent /usr/local/share/icons/gnome icons were substituted.

The basic layout is similar to Mac OS/X interface. A bottom, one-click launcher for commonly used applications. A full menu is accessed by right-clicking on a blank area of the desktop or hitting the "Menu" key.

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.jpg
Views: 183
Size:  20.9 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:  extra_apps.jpg
Views: 161
Size:  25.2 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=904&d=1571406675
BareGUI.tar.gz

If you find this to be time saving and useful, consider supporting the OpenBSD project.

OpenBSD Donations

Last edited by shep; 18th October 2019 at 04:38 PM.
Reply With Quote
  #2   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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 in case 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; 2 Weeks Ago at 01:25 PM.
Reply With Quote
  #3   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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/sh
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/sh
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; 18th October 2019 at 04:31 PM.
Reply With Quote
  #4   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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 productivity/gsimplecal which was just ported to OpenBSD. The project continues to use x11/yad to generate a calendar largely because BareGUI tries to avoid redundant applications. Yad is utilized for additional scripts.

The ~/scripts/calendar.sh script positions the calendar under the panel clock 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/sh

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; 2 Weeks Ago at 01:27 PM.
Reply With Quote
  #5   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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 Mozilla builds for www/mozilla-firefox, www/firefox-esr and mail/mozilla-thunderbird. These updates are now provided by the main project. Previously, only firefox-esr made it through the 6/12month support cycles without dependency issues. At this time www/chromium or its privacy enhanced fork, www/iridium are not backported. 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 been dropped. Libreoffice is recommended.

Last edited by shep; 2 Weeks Ago at 01:29 PM.
Reply With Quote
  #6   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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/sh
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/sh
# 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/sh

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

# The script is configured for the Northwest.
# 
# You can browse "https://radar.weather.gov/Conus/Loop/" for your area

curl  https://radar.weather.gov/Conus/Loop/pacnorthwest_loop.gif | \
 animate -immutable -loop 0 -title "NorthWest Radar Loop"
This script can be adapted 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/sh

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/gnome/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; 2 Weeks Ago at 01:37 PM.
Reply With Quote
  #7   (View Single Post)  
Old 18th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
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
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)
#echo ${IFCONFIG}

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

cat <<END
--------------------------------------
    Current WiFi Connection
--------------------------------------

NWID    \t:  $NWID
CHAN    \t:  $CHAN
BSSID   \t:  $BSSID
S/N     \t:  $SN
IP      \t:  $IP
END
else
cat <<END
--------------------------------------
Currently Connection as
tested by
nc google.com 443 is Down
--------------------------------------
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/gnome/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/gnome/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: 140
Size:  18.1 KB

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

audio/mpd Setup

The setup is described in this thread:
Music Player Daemon (MPD OpenBSD Howto

In ~/.config/openbox/autostart uncomment
Code:
# Start local instance of mpd
#(sleep 2.0 && mpd ~/.config/mpd/mpd.conf) &
In audio/gimmix set the MPD_HOST to
~/.config/mpd/socket.

Last edited by shep; 3 Weeks Ago at 08:12 PM.
Reply With Quote
  #9   (View Single Post)  
Old 28th October 2019
shep shep is offline
Real Name: Scott
Arp Constable
 
Join Date: May 2008
Location: Dry and Dusty
Posts: 1,306
Default

sysutils/xorriso-tcktl

This details the setup of a CD/DVD/Blueray user interface based on libisoburn.

sysutils/xorriso-tcltk does not include a wrapper application that is needed to run the interface. It is provided by tk8.5. The needed packages are
Code:
# pkg_add libisoburn xorriso-tcltk tcl tk
Choose version 8.5 for tcl/tk. sysutils/xorriso can co-exist with xorriso-tcltk for those who wish to burn from the command line.

Add your user to the operator group and add group rw permission for /dev/rcd0*.
The interface also provides for copying from one drive to another, so if you have several drives, adjust your permission to include group rw for both drives.

For a freedesktop compliant menu entry, create ~/.local/share/applications/xorriso.desktop with the following content
Code:
[Desktop Entry]
Encoding=UTF-8
Name=Xorriso
GenericName=Disk Burner
Comment=Optical Disk GUI
X-GNOME-FullName=Openbox Menu
Exec=xorriso-tcltk
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=drive-removable-media
Categories=Utility;
MimeType=
StartupNotify=true
Name:  xorriso.png
Views: 70
Size:  73.1 KB

Last edited by shep; 2 Weeks Ago at 06:24 PM. Reason: added sharper screenshot
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


All times are GMT. The time now is 09:38 PM.


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