*BSDThis forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Alarm script. Set delay in minutes (supports fractional parts i.e. 0.25 for 15 seconds). Shows a progress bar (countdown) before either being cancelled or triggering a alarm sound (needs mpv to play the sound file, or change the code to use mplayer or whatever).
Code:
#!/bin/sh
# Rufwoof Nov 2017
# OpenBSD yad alarm script
TITLE="Alarm"
VERSION=0.1
SOUND='/home/user/bin/alarm.mp3'
ICON=/home/user/.twm/icons/clock28x34.png
# Prompt for delay in minutes before alarm
# Fractional parts of minute supported i.e. 0.0833 is 5 seconds
DELAY=$(yad --entry --text "Enter minutes..." --title="$TITLE"" $VERSION" --window-icon=$ICON \
--image=$ICON \
--button="gtk-ok:0" \
--button="gtk-close:1" \
)
ret=$?
[[ $ret -eq 1 ]] && exit 0
# Convert to seconds
DELAY=`echo "$DELAY*60"|bc -l`
# Make a proportion of 1/100ths
STEP=`echo "$DELAY/100"|bc -l`
# Show a progress/countdown meter
i=0
while [ "$i" -lt 101 ]
do
echo $i
echo "# Remaining $((100-i))% to finish the job"
sleep $STEP
i=`expr $i + 1`
done | yad --progress --center --text="Alarm Countdown progress ..." --button=gtk-cancel:1 --auto-kill --auto-close
ret=$?
[[ $ret -eq 1 ]] && exit 0
# Use mpv to play the alarm sound put it into the background recording its PID
mpv --loop=inf "$SOUND" &
PID=$!
# Show a stop alarm dialog
yad --title "$TITLE"" $VERSION" \
--button="gtk-ok:0" \
--width 300 --image=$ICON \
--window-icon=$ICON \
--text="<b>Time is over!!</b>"
# kill mpv
kill -1 $PID
yad menu launched directly via right click desktop or window title bar
I've switched from using a right click of the desktop or window title bar warping to the gkrellm clock, which when clicked brought up the yad programs menu, to just simply directly launch the yad menu, positioning it near the mouse and accounting for screen edges. It also tests to see if another menu was already open and if so closes that before presenting the new menu window.
twm icons ... not that nice so I'm not using them. The icon manager is nice however especially in being able to set colour themes for different programs. twm menu navigation with its slider (press/drag) ... again not particularly nice IMO and replacing that with a click type yad menu also has nicer fonts/look. So fundamentally twm is being used as the base window manager and for its icon manager that acts like a panel/task-list, whilst yad provides the menus (and ease of writing scripts such as alarm, diary ...etc.).
Code:
#!/bin/sh
# Kill prior running version (prevent duplicates)
ID=`xdotool search --onlyvisible --name Apps`
if [ "$ID" != "" ]; then
/tmp/PIDofChooseProgram &
fi
SCREENSIZE=`xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/'`
MAXX=`echo $SCREENSIZE | awk 'BEGIN { FS = "x" } ; { print $1 }'`
MAXY=`echo $SCREENSIZE | awk 'BEGIN { FS = "x" } ; { print $2 }'`
MAXX=`expr $MAXX - 300`
MAXY=`expr $MAXY - 475`
# Where is mouse
MOUSEX=`xdotool getmouselocation --shell | grep X= | sed s/X=//`
MOUSEY=`xdotool getmouselocation --shell | grep Y= | sed s/Y=//`
if [ "$MOUSEX" -gt "$MAXX" ]; then
MOUSEX=$MAXX
fi
if [ "$MOUSEY" -gt "$MAXY" ]; then
MOUSEY=$MAXY
fi
GEO="--geometry=300x475+${MOUSEX}+${MOUSEY}"
yad --icons \
--read-dir=/home/user/Desktop \
--sort-by-name \
--single-click \
--no-buttons \
--compact \
$GEO \
--title=Apps &
echo "kill -1 $!" >/tmp/PIDofChooseProgram
chmod +x /tmp/PIDofChooseProgram
The menu is automatically built according to whatever .desktop files are present in the Desktop directory, however I've manually sized the yad menu window in reflection of that.
Thanks for the reminder. I've been intending to have a look at vdesk (never having used it), but in truth I have little need/desire for multi-desktops as multi-full screen windows on a single desktop and ease of switching between them is just as effective IMO. I guess handy if you use multi-monitors, but again I just use the one. In my other multi-boots that support multiple desktops I've always tended to reconfigure to just have the one.
I was running under a nvidia card before adopting OpenBSD (for which I removed it to use the onboard Radeon ATI as that works better under OBSD) and that nvidia's panning option was nice ... for some fun i.e. create a virtual desktop space much larger than the actual display resolution ... and when you moused to a screen edge it moved the window around that larger space. But that is annoying when it comes to real work ... such as reaching (mousing) for the vertical scrollbar down the right hand screen edge and having the screen shift (pan) rightwards. Also tends to induce a sea-sickness type sensation when you move around looking for where you'd left a window.
f.fullzoom under OpenBSD twm doesn't work as expected. Maximises OK, but the first click to restore brings up a mouse cursor and you have to click a second time for the restore to work.
A workaround that works for me is to create a function
I've switched over to using tab like window titles i.e. defining
SqueezeTitle
Nice how when a window is maximised the space to the right of the window title tab has the desktop showing so you can left mouse press that to present the normal menu that shows when the desktop is left mouse pressed.
Added a middle mouse (scrollwheel) desktop press bringing up a twm menu that sets the volume level
So with tab window titles even if a window is full screen you can still see some desktop space to activate the sound menu (or other menus/icon manager ...etc.
The menu definition that I used for that volume menu in .twmrc is ...
#!/bin/sh
at -f /home/user/bin/alarm.sh $1
echo
echo list jobs with at -l
echo "remove job with at -r <job>"
Make both script executable (chmod +x alarm.sh)
Now when in a terminal when you run alarm 19:24 or whatever time you choose, a "at" job will run at that time that sounds the alarm.
To list current at jobs running use
at -l
You can remove a at job using
at -r <job>
i.e. the job number as shown when the job was started or when jobs are listed using the at -l command.
When the above alarm sounds/triggers it opens a xterm window that shows the mpv playing of the the sound file and Ctrl-C will close that program (stop the alarm).
Standard OpenBSD installed with just firefox-esr added on top of that provides a modest minimal desktop environment.
Use twm as the window manager
xedit for text editing
xcalc calculator
xterm as your terminal
firefox supports opening PDF files, can browse local files (use a URL of file:///), can view images, play videos, sounds, act as a radio station player ...etc. You can even edit images, create animated gifs, use a online wordprocessor or spreadsheet, maintain a diary/calendar ...etc. all via online services.
Using scripts such as the alarm I posted in the previous post you can extend the functionality without having to pull in additional third party programs.
And that's relatively quick and easy to upgrade every 6 months as and when a new release of OpenBSD occurs.
Rearranged my yad menubar, volumebar and iconmanager layout so that the volume bar is the same height as the menubar and alongside it, and the icon manager spans a much greater width of the screen and starts alongside the volume bar. Attached is a animated gif of when I right click on the desktop i.e. to the right of a maximised windows title tab, up pops the menubar, volume bar and icon manager list.
"Left" = m : all : f.exec "mixerctl outputs.master=-12"
"Right" = m : all : f.exec "mixerctl outputs.master=+12"
so that sound volume can be increased/decreased using ALT and left/right arrow
As a side note, twm comes as part of the X Windows system, so at least in concept it is the only windows manager common to all Unix like systems that run X window system.
I had been following OpenBSD current, however after a number of mismatches between the base system and packages I've reverted back to using -release, with that being updated (so -stable) using openup. Binary patches/fixes as easy as downloading openup from mtier and then running it (takes just a minute or two to run).
Inspecting /var/log/Xorg.0.log and it was apparent I wasn't using acceleration for my Radeon ATI.
Adding
Code:
Option "Accelmethod" "glamor"
to /etc/xorg.conf and rebooting had /var/log/Xorg.0.log indicating I also needed to add
Code:
machdep.allowaperture=1
to /etc/sysctrl.conf. After doing that and rebooting yet again all is running well.
glamor was causing problems with large/rapid xterm lists, such as finding all files or tar'ing ...etc. where the terminal screen would just lock-up. Changing the Accelmethod to EXA fixed that.
I've switched over to using tab like window titles i.e. defining
SqueezeTitle
Nice how when a window is maximised the space to the right of the window title tab has the desktop showing so you can left mouse press that to present the normal menu that shows when the desktop is left mouse pressed.
Chrome, 3 dot burger bar menu (top right) ... not seeing the menu remain open when clicked?
I added a F12 key that raises the focus (f.focus) into .twmrc and when you click the burger and its menu doesn't remain open, just press F12 before clicking the burger again and it (should) see the menu remain open.
"F12" = : r|w|t|f|i|m : f.focus
I don't use Firefox, but believe there is a option you can set in its configuration
In Firefox go to "about:config"
set "widget.gtk.grab-pointer" equal to "1"
Restart Firefox
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.