I am not a big fan of macOS desktop experience. I use latest macOS daily on M1 laptop and its quite far from what I call ‘productive’ environment. Yes – all the ‘enterprise’ applications are the … but that does not make a productive desktop alone. To be honest – the version that I enjoyed the most was Mac OS X Snow Leopard … but that was about a decade ago … and I still preferred my FreeBSD desktop even way back then.
One of the nice features that macOS (or earlier Mac OS X) provided were the so called Corner Actions. They are not crucial to any workload as one can either quite fast launch the needed processes by hand or by dmenu(1) or by other means (such as keyboard shortcuts) – but yeah – its not bad to have another useful feature under your mouse … assuming that mouse make You more productive – its not counter-productive for some.
You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop β Global Page where you will find links to all episodes of the series along with table of contents for each episodeβs contents.
Python Based Solution
Upon my FreeBSD desktop/laptop/workstation journey I once found a Python based solution called cb-hotcorners from now discontinued CrunchBang Linux. It was not very usable as it used ‘polling’ type of thing – You set the ‘delay’ between checks and the Python script ACTIVELY checked if anything is needed to be done – if not it skips to next ‘wait’ cycle – if yes – it starts your configured executable. It may not sound as bad as it seams but keeping your cursor parked for about a second or so in the corner hoping for the script to do the right job is far from productive … not to mention wasted battery time and CPU cycles on that active waiting loop … just no.
While the CrunchBang is long gone there are two spiritual successors – CrunchBang++ and BunsenLabs ones. Seems I need to check them some time for other possible Openbox friendly features.
xidle(1)
Recently someone poked me on X/Twitter about xidle(1) running the suspend/resume command twice instead of just once … but after some digging I figured out that the xidle(1) also has some other features … and one of them is the Corner Actions feature.
After ‘bad’ experiences of slow and inefficient Python solution I checked how it would do the job … and it was instant match! π
For the record – the pkg(8) packages that need to be installed are listed below.
% pkg install -y xidle caja leafpad xterm skippy-xd
These two scripts below the __openbox_restart_xidle.sh and __openbox_stop_xidle.sh do all the needed job here. First one is to start needed config. Second one is to ‘stop’ all running xidle(1) instances.
% cat ~/scripts/__openbox_restart_xidle.sh #! /bin/sh xidle -area 3 -delay 0 -nw -program '/usr/local/bin/caja --no-desktop' & xidle -area 3 -delay 0 -ne -program '/usr/local/bin/skippy-xd' & xidle -area 3 -delay 0 -sw -program '/usr/local/bin/leafpad' & xidle -area 3 -delay 0 -se -program '/home/vermaden/scripts/xterm.sh' & % cat ~/scripts/__openbox_stop_xidle.sh #! /bin/sh killall -9 xidle &
Below you will find xidle(1) in action on a screencast.
Actions
I configured the following xidle(1) actions:
TOP-LEFT caja(1) file manager BOT-LEFT leafpad(1) text editor TOP-RIGHT skippy-xd(1) task switcher BOT-RIGHT xterm(1) terminal
Below are the running xidle(1) processes for that purpose.
I still did not yet got used to it and I sometimes forgot that its there – but I would definitely keep it – muscle memory would come π
Side Effect
As a side effect of getting involved with xidle(1) the person from X/Twitter created a FreeBSD BUG report – 275761 β x11/xidle: triggers twice – and it was also fixed.
Delayed Automatic Suspend
As the bug is now fixed You may also want to use xidle(1) for automatic suspend of the machine after some period of inactivity. Here is the command You would use to get that feature.
% xidle -timeout 900 -program '/usr/local/bin/doas /usr/sbin/zzz'
Summary
Feel free to comment and share other useful desktop features that make your daily work better.
UPDATE 1 – Using xdotool(1) Instead
Someone on Lobsters made me realize that the same Corner Actions can be made with xdotool(1) instead. As I already use xdotool(1) for several other tasks – that would limit the amount of needed tools to accomplish the tasks for needed features of my customized FreeBSD Desktop experience.
Here are the stop and startup scripts for xdotool(1) based solution.
% cat ~/scripts/__openbox_restart_xdotool.sh #! /bin/sh xdotool behave_screen_edge top-left exec caja --browser --no-desktop & xdotool behave_screen_edge top-right exec skippy-xd & xdotool behave_screen_edge bottom-left exec leafpad & xdotool behave_screen_edge bottom-right exec xterm.sh & % cat ~/scripts/__openbox_stop_xdotool.sh #! /bin/sh killall -9 xdotool &
It generally works the same so why bother with xidle(1) … after short test seems that xidle(1) is a lot more efficient and takes a lot less CPU time to do the same.
I have made a simple test of starting the solution – then using all four corners action and then checked CPU time (and RAM) used.
To my surprise the xdotool(1) while doing the same took slightly more RAM … but about 8 times more CPU time then xidle(1) tool. Below you will find the results after usage of both solutions.
// xidle(1) % ps aux | grep -e xidle -e xdotool -e RSS | cut -c 42- RSS TT STAT STARTED TIME COMMAND 4344 3 S 13:13 0:00.01 xidle -area 3 -delay 0 -nw -program caja --browser --no-desktop 4332 3 S 13:13 0:00.01 xidle -area 3 -delay 0 -ne -program skippy-xd 4336 3 S 13:13 0:00.01 xidle -area 3 -delay 0 -sw -program leafpad 4332 3 S 13:13 0:00.01 xidle -area 3 -delay 0 -se -program xterm.sh // xdotool(1) % ps aux | grep -e xidle -e xdotool -e RSS | cut -c 42- RSS TT STAT STARTED TIME COMMAND 5244 3 S 13:14 0:00.08 xdotool behave_screen_edge top-left exec caja --browser --no-desktop 5236 3 S 13:14 0:00.08 xdotool behave_screen_edge top-right exec skippy-xd 5244 3 S 13:14 0:00.08 xdotool behave_screen_edge bottom-left exec leafpad 5252 3 S 13:14 0:00.08 xdotool behave_screen_edge bottom-right exec xterm.sh
Does that make a huge difference? No. If you already have xdotool(1) installed then you may use it for that purpose – I just wanted to check out of curiosity.
Great Article π
– The person from X
amr
LikeLiked by 1 person
Pingback: Valuable News – 2023/12/25 | ππππππππ