LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 11-22-2017, 04:43 AM   #1
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Rep: Reputation: Disabled
twm maximise (maximize)


If in your .twmrc you assign a maximise button on the twm window title along with a f.fullzoom function call, then whilst the window will maximise using a single click it takes two clicks to restore. The reason looks to be due to f.fullzoom waits for the next click after maximisation to focus the next window (documented feature, not a bug). A workaround to get to the more usual single click to maximise and another single click to restore back down again is to instead create a function, something like ...

Code:
Function "fullscreen" { f.fullzoom f.focus f.nop }
and associate that to the maximize title button

Code:
RightTitleButton "maximize.xbm" = f.function "fullscreen"
 
Old 11-22-2017, 05:02 AM   #2
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
twm history

As twm celebrated its 30th Birthday recently (November 2017), rather than this thread just becoming a search engine single reference, I intend to add to various twm tips/tricks and make it a more comprehensive reference point, specifically for OpenBSD.

twm was started in 1987 by Tom LaStrange, it has been the standard window manager for the X Window System since X11 Consortium adopted it in 1989.

The default configuration isn't pretty and only relatively functional. Configuring your own ~/.twmrc is preferable IMO however there is relatively little around in the way of examples. So with that I'll add examples here over time in order to hopefully create a single reference point. Others are more than welcome to pipe in with their own contributions.
 
Old 11-22-2017, 05:16 AM   #3
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Wallpaper

The base OpenBSD system and the twm that incorporates doesn't include a root window (desktop) background image setting tools other than for bitmap files (monochrome). You have to add something like feh or xv or whatever to be able to set a .png or .jpg ...etc image file as the wallpaper.

You can however use something like xpaint to create a .xbm (bitmap) image file from another image. Much of the detail will be lost due to just the two (black or white) pixel colour limit, however along with setting the colour mapping of those two colours and perhaps xclock you can make the desktop look a little more respectable.

For instance I loaded a wire frame type OpenBSD puffy fish image into xpaint, edited it to include some text, scaled it to be the same size as my screen resolution and then saved that as a .xbm, that I load in my .xsession file (I use xenodm, if you use startx then that uses .xinitrc instead of .xsession).

Code:
xsetroot -bitmap /home/user/.twm/bitmaps/wp.xbm -bg green -fg "#000024" &
xclock -digital -strftime "%a %d %b" -fn "-b&h-lucida-medium-r-*-*-34-*-*-*-*-*-*-*" -geometry -60+275 -padding 0 -fg "#00B6FF" -bg "#000024" -hd "#92FF92" -hl SteelBlue4 &
xclock -geometry 207x209-57+29 -padding 0 -fg SteelBlue4 -bg "#000024" -bd "#000024" -hd blue -hl "#007DFD" &
So instead of a single colour wallpaper, or a black and white image, I now have a green coloured wire-frame puffy fish image with some text below that, on top of a dark blue background together with a blueish analogue clock in the top right and a digital clock below that that just shows the current date in a more pale-blue type colour.

Wire-frame images work well when limited to bitmaps images. A nice one IMO is to create/find a skull bitmap image and add xeyes to that. Align/size the eyes to coincide with the skull's eye sockets and its a bit of fun to have that skull watching your mouse movements

Of course installing feh or xv (pkg_add feh) and using that to load a .png image (or whatever) would be the more usual option, however if you wanted to keep additional programs installed to a minimum then the above could suffice.
Attached Thumbnails
Click image for larger version

Name:	wp.png
Views:	60
Size:	31.0 KB
ID:	26366  

Last edited by rufwoof; 11-22-2017 at 05:22 AM.
 
Old 11-22-2017, 05:37 AM   #4
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Icon Manager

I like to use colours in twm, so for instance I have firefox menu entry along with its icon manager (like panel/tray) and window title/borders all coloured to a firefox orange/red type colour, and similarly LibreOffice writer menu/icon manager/title and window borders all a blue colour ...etc.

I have the first button in each window title (far left of title, before the window name/text) set to show the icon manager. That way from any full screen window a click of that button shows the icon manager and hence all other windows that can be switched to. So for instance whilst typing this posting, clicking that top left button reveals a drop down type list of all other windows that can be switched to and I can click on any of those to switch to that window.

I have my desktop set so that a right mouse press presents the twm main menu. I also have it set so that a right press of the title bar also shows that menu, so in a full screened window I don't have to find desktop space to click, and can just press the windows title instead.

Being able to perform actions within a full screened window that otherwise required visibility of some desktop space is a great enhancement IMO. Makes for easier switching between windows so there's less need to use multiple desktops or having to move windows out of the way.
Attached Thumbnails
Click image for larger version

Name:	dd.png
Views:	114
Size:	149.8 KB
ID:	26367   Click image for larger version

Name:	menu-via-titlebar.png
Views:	50
Size:	161.3 KB
ID:	26368  
 
Old 11-22-2017, 05:43 AM   #5
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Off out now. When I return I'll post my .twmrc (and .Xdefaults/.xsession) ... after I've tidied them up.

Again anyone else is more than welcome to post your own twm tips/tricks (configurations).
 
Old 11-22-2017, 05:54 AM   #6
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
twm resize

... before I forget, some don't tend to use twm resize properly. The correct intent is to press the resize button (usually in the top right of a window) and move the mouse into the window, and then continue outward in the direction in which you want the window resized, i.e. in one of the N, NE, E, SE, S, SW, W, NW directions. Once the mouse is outside of the original window it can be moved back/forth to scale the window size as desired.
 
Old 11-22-2017, 06:01 AM   #7
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
References

Unlike many of the Linux versions, the OpenBSD community are much more inclined to be 'old-school' and use mail list groups and/or IRC. You can for instance install Chatzilla as a firefox plugin
 
Old 11-22-2017, 09:28 AM   #8
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
OpenBSD install preparation

I use a multi-boot desktop PC setup. Originally I installed grub4dos bootloader using PuppyLinux and have a menu.lst entry of ...

Code:
title BSD sda4
root (hd0,3)
makeactive
chainloader +1
boot
The trick to install openbsd in its own partition is to use gdisk (for GPT drives) or fdisk (for msdos drives) to create the OpenBSD disklabel before running the installer — i.e. select type a600 in gdisk or type a6 in fdisk — and then use the default option during the OpenBSD installs partitioning stage to install to that disklabel and leave the rest of the disk alone.

OpenBSD didn't work well with a nvidia graphics card for me. I ended up removing the 8600GTX Nvidia card (in a pci slot) and used the onboard Radeon ATI graphics instead. After reinstallation of OpenBSD with that hardware setup its worked fine for me ever since. Not as snappy/quick as Linux, but it does stick to the rules so is solid (for instance uses synchronous IO so if a power outage occurs its less likely to have lost/corrupt data). Some set /etc/fstab to include noatime,softdep parameters (async IO), but whilst that can be quicker it comes with greater potential data corruption risk.

If you've booted/installed from a installation CD (I opted to use the basic via HTTP type CD to install from as that automatically sets up repositories for you), then you can always boot that using the boot -s (single user mode), and after running fsck to ensure the disks are clean, run the mount -a command to mount all disk, after which you can cd /home/user or whatever in order to fix problems.

Remember ALWAYS MAKE A BACKUP before making changes ... my first attempt at installing OpenBSD to a partition ended up with it taking over the entire disk (my other boot choices were lost and had to be restored from backup).

Last edited by rufwoof; 11-22-2017 at 10:21 AM.
 
Old 11-22-2017, 09:36 AM   #9
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Packages

The packages I've installed on top of OpenBSD base are ...
Code:
$ pkg_info -mz
firefox-esr--
libreoffice--
mpv--
mtpaint--
quirks--
xfe--
$
Note that I didn't install the 'quirks' package, rather that is a system 'package' that is used for package security purposes. i.e. I only installed

Code:
pkg_add firefox-esr libreoffice mpv mtpaint xfe
I use firefox as a PDF viewer and for both mail and calendar/diary via online services. Those installed packages cover my general needs for office, file management, video, image editing and browsing type purposes.
 
Old 11-22-2017, 09:47 AM   #10
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
.twmrc .Xdefaults .xsession and /etc/xorg.conf

Attached are copies of my various configuration files such as .twmrc
Attached Files
File Type: txt .Xdefaults.txt (10.1 KB, 22 views)
File Type: txt .xsession.txt (1.5 KB, 14 views)
File Type: txt .gtkrc-2.0.txt (385 Bytes, 12 views)
File Type: txt xorg.conf.txt (2.6 KB, 13 views)
File Type: txt .twmrc.txt (10.4 KB, 39 views)

Last edited by rufwoof; 11-22-2017 at 03:33 PM.
 
Old 11-22-2017, 09:58 AM   #11
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
openbsd autologin

$ cd /etc/X11/xenodm

As su (root) edit xenodm-config to add a line ...

Code:
DisplayManager.*.autoLogin:     user
where user is the userid to be auto logged in.

Run
Code:
rcctl enable xenodm
to enable autologin (rcctl disable xenodm will disable autologin)

Unlike FreeBSD, OpenBSD pretty much comes preconfigured and ready to go It's man pages are extensive and well documented, a great source of help.
 
Old 11-23-2017, 02:32 PM   #12
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
twm + stalonetray and yad

Setting twm to show no icons, only using the iconmgr, and instead of twm menus that require press and hold/drag type mouse actions, a alternative is to install stalonetray and yad and have a single desktop icon that is used to access/launch your programs that can be popped up on top of full screened (or above) windows with a simple mouse click or two.

For instance in .xsession (assuming using xenodm, .xinitrc if using startx) adding

stalonetray &
/home/user/bin/trayapps &

where trayapps is a yad script ...
Code:
#!/bin/sh
yad --notification \
--no-middle \
--text="" \
--image=applications-office \
--separator="\\n" \
--menu="FILES!pcmanfm!system-file-manager
Firefox!firefox-esr!/home/user/.twm/icons/mini-firefox-esr.png
Text Edit!geany!accessories-text-editor
xterm!xterm -T "XTERM"!utilities-terminal" \
--command='/home/user/bin/choosefile' &
and where choosefile contains
Code:
#!/bin/sh
# Names should reflect the exact filenames in YAD directory
CHOICE=`yad --geometry="400x560+970+10" --title="Program Selector" --image="gtk-yes" \
           --text="Programs" --list --print-column="2" --radiolist \
           --column="Select" --column="Program" \
           FALSE colour-select \
           FALSE diary \
           FALSE lbc \
           FALSE "libre DRAW" \
           FALSE "libre SPREADSHEET" \
           FALSE "libre WRITER" \
           FALSE mtpaint \
           TRUE sound-level \
           FALSE sound-level2 \
           FALSE weather \
           FALSE xcalc \
           FALSE xedit | awk 'BEGIN { FS = "|" } ; { print $1 }'`
if [ ! -z "$CHOICE" ]; then
	exec "/home/user/bin/YAD/$CHOICE"
fi
Along with the buttons in .twmrc set to something like ...
Code:
Button2 = 			  : root 		: f.menu "defops"
Button3 = 			  : root 		: f.warpto "stalonetray"

Button1 = 			m : window|icon 	: f.function "move-or-lower"
Button2 = 			m : window|icon 	: f.iconify
Button3 = 			m : window|icon 	: f.function "move-or-raise"

Button1 = 			  : title 		: f.function "move-or-raise"
Button2 = 			  : title 		: f.menu "defops"
Button3 = 			  : title 		: f.warpto "stalonetray"
and .stalonetrayrc containing
Code:
transparent false
dockapp_mode none
geometry 1x1+997+100
max_geometry 12x1
background "#000000"
kludges force_icons_size
grow_gravity W
icon_gravity W
icon_size 48
sticky true
#window_strut none
window_type dock
window_layer bottom
no_shrink true
skip_taskbar true
scrollbars horizontal
scrollbars_highlight SteelBlue1
... and on bootup you'll have just a single desktop icon that is contained within a scrollable stalonetray (bars that pop up either side of the icon that you can scrollwheel to scroll if there are more than one icon in the tray).

When just one icon is in the tray then with the above settings right mouse clicking on the desktop, or in a windows title bar and the stalonetray icon will be revealed. Another right click and the favourites menu will be shown (files, firefox, text editor, xterm in the above). Left clicking the icon and another list type menu of programs is shown. A neat feature is that the mouse warps to the tray on a right click action, so you soon get used to positioning the mouse on the desktop or on a window title bar and just tapping the right mouse twice for your favourites, or right and then a left mouse clicks to pop up the list of programs.
Attached Thumbnails
Click image for larger version

Name:	dt.jpg
Views:	27
Size:	82.3 KB
ID:	26383   Click image for larger version

Name:	rl.jpg
Views:	35
Size:	114.1 KB
ID:	26384   Click image for larger version

Name:	rr.jpg
Views:	23
Size:	89.0 KB
ID:	26385   Click image for larger version

Name:	rr2.png
Views:	25
Size:	128.6 KB
ID:	26386   Click image for larger version

Name:	busy.jpg
Views:	37
Size:	160.1 KB
ID:	26387  


Last edited by rufwoof; 11-23-2017 at 03:24 PM.
 
Old 11-23-2017, 02:51 PM   #13
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
... more yad

Pop up a colour chooser
Code:
#!/bin/sh
yad --geometry 810x272+557+489 --color --init-color=red &
Pops up a calendar, select a day and opens the text editor (geany in my case) to save a filename with that date (diary)
Code:
#!/bin/sh
cd /home/user/Documents/diary
CHOOSEFILE=`yad --geometry 397x310+778+435 --title="Diary" --calendar --date-format="%b_%d_%Y"`
if [ ! -z "$CHOOSEFILE" ]; then
	geany $CHOOSEFILE &
fi
Sound volume level adjust
Code:
#!/bin/sh
LEVEL=`yad  --geometry 269x94+1050+380 --form --title="Vol" --field="Sound Level:CB" 0\!1\!2\!3\!4\!5\!6\!7\!8\!9\!10`
if [ ! -z "$LEVEL" ]; then  # didn't CANCEL
  echo $LEVEL >/tmp/soundlevel
  LEVEL=`echo $LEVEL*25 | bc`
  # mixerctl needs integer (fails if fractional values)
  LEVEL=`printf "%.0f\n" "$LEVEL"`
  mixerctl -q outputs.master=$LEVEL &
fi
... more examples of yad here

twm's icons aren't that nice, too dated. The icon manager when set to use colours is still nice/good IMO. twm menus and the press/hold/move type motion to move through the menu isn't the best of methods IMO and certainly would be more difficult on a laptop with a touchpad. right click, right click, move a little and click the program you want type actions to launch programs both from the desktop and within full screened windows (by ensuring the first right click in on the titlebar) is a much quicker and relatively natural type way to access/launch programs. Along with the first (top left) title button on windows set to show the iconmgr ... and twm + stalonetray + yad are a great little (yet powerful) combination IMO.
 
Old 11-24-2017, 08:13 AM   #14
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Improved program launcher

Rather than using a yad --list as a program launcher, a yad icon viewer is much nicer. You can set it to single click to launch programs and have it read a folder of .desktop files that it populates its window with so adding or removing things is much easier than having to change the yad script code.
Code:
#!/bin/sh
yad --icons \
--read-dir=/home/user/bin/YAD/DesktopFiles \
--sort-by-name \
--single-click \
--button=gtk-close:0 \
--compact \
--geometry=350x600+1090+215 \
--title=Programs
--button=gtk-close:0 ensures that only a close button is displayed. I have the above script being launched by gkrellm ... a right mouse click on the desktop or on a window titlebar warps to the gkrellm clock (bringing it into view if covered) and a left click pops up the menu (where a single click on any of the choices launches the respective program).

In effect using a minimal twm menu (that requires sliding (mouse press/hold movements)) just for system functions (destroy window ...etc type options), no twm icons, and using colour coded twm iconmgr as a form of tasklist (open programs). Where the menu used more often is a gtk type style as provided by yad.

9 packages installed in total on top of base OpenBSD 6.2 (xv is being used to load a desktop wallpaper image which pcmanfm could do, so the list could be reduced down to 8)

$ pkg_info -mz
firefox-esr--
geany--
gkrellm--
libreoffice--
mpv--
mtpaint--
pcmanfm--
xv--
yad--

Seems solid and stable ... and runs really quickly.
Attached Thumbnails
Click image for larger version

Name:	ss.jpg
Views:	23
Size:	143.5 KB
ID:	26388  
 
Old 11-24-2017, 02:19 PM   #15
rufwoof
Member
 
Registered: Nov 2017
Distribution: Debian Desktop; OpenBSD Server
Posts: 64

Original Poster
Rep: Reputation: Disabled
Volume adjust

yad script to present a slider that adjusts sound volume

Code:
#!/bin/sh

# Position window somewhere central/top
SCREENSIZE=`xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/'`
X=`echo $SCREENSIZE | awk 'BEGIN { FS = "x" } ; { print $1 }'`
Y=`echo $SCREENSIZE | awk 'BEGIN { FS = "x" } ; { print $2 }'`
X=`expr $X \/ 2`
X=`expr $X - 100`
Y=`expr $Y \/ 3`

GEO="--geometry 270x110+$X+$Y"

# retrieve current volume level
VALUE=`mixerctl outputs.master | awk 'BEGIN { FS = "," } ; { print $2 }'`
# adjust 0 to 255 scaled to 0 to 100 and rounded
VALUE=`echo $VALUE/2.55 | bc`; VALUE=`printf "%.0f\n" "$VALUE"`

yad --scale --title="Volume" $GEO --value=$VALUE \
--print-partial | while read x ; do x=`echo $x*2.55 | bc`; x=`printf "%.0f\n" "$x"`;mixerctl -q outputs.master=$x ; done
Attached Thumbnails
Click image for larger version

Name:	slider.jpg
Views:	8
Size:	8.5 KB
ID:	26402  

Last edited by rufwoof; 11-25-2017 at 05:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ratpoison Maximise a Window? Gavin Harper Linux - Software 0 02-02-2011 06:38 AM
middle click the maximise button to maximise vertically in gnome? dasy2k1 Linux - Newbie 1 05-10-2009 08:58 PM
CentOS window does not maximise with VBOX decepticon Linux - Newbie 2 05-03-2009 07:53 PM
maximise and minimise Patrick-Warwick Linux - Desktop 6 01-03-2009 12:18 PM
how do I maximise a window? drewsta Linux - Newbie 1 01-19-2004 10:06 PM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration