Tag Archives: keyboard

Easy Lockscreen MacOS

Whilst MacOS is a pretty polished experience, there’s some really simple things that are stupidly hard sometimes such as getting the keybindings to work right for real keyboards or in this case, getting the screen to be lockable without sleeping the computer.

No matter what configuration I set in power management, the only MacOS keyboard combination that does anything for me (Command + Option + Eject/Power/F12) will not only put up the lock screen, but also immediately sleeps the computer, much to the dismay of any background network connections or audio.

One of the issues with MacOS is that for any issue there are several dubious software vendors offering you an app that “fixes” the issue with quality ranging from some excellent utilities all the way to outright dodgy Android/Windows-style crapware addons.

None of these look particularly good. Who the hell wants Android-style swipe unlock on a Mac??

None of these look particularly good. Who the hell wants Android-style swipe unlock on a Mac??

Naturally I’m not keen for some crappy third party app to do something as key as locking my workstation so went looking for the underlying way the screen gets locked. From my trawling I found that the following command executed as a normal user will trigger a sleep of the display, but not the whole machine:

pmset displaysleepnow

Turns out getting MacOS to execute some line of shell is disturbingly easy by using the Automator tool (Available in Applications -> Utilities) and creating a new Service.

Screen Shot 2015-05-26 at 23.47.59

Then add the Run Shell Script action from the Library of actions like below:

Screen Shot 2015-05-26 at 23.47.00

Save it with a logical name like “Lock Screen”. It gets saved into ~/Library/Services/ so in theory should be possible to easily copy it to other machines.

Once saved, your new service will become available to you in System Preferences -> Keyboard -> Shortcuts and will offer you the ability to set a keyboard shortcut.

Screen Shot 2015-05-26 at 23.50.37

And magic, it works. Command + Shift + L is a lot easier in my books than hot corners or clicking stupid menu items. Sadly you don’t have full flexibility of any key, but you should be able to get something that works for you.

 

For reference, here are my other settings windows. First the power management (Energy Saver) settings. I select “Prevent computer from sleeping automatically” to avoid any surprises when sleeping.

Screen Shot 2015-05-27 at 00.14.29

And secondly, your Security & Privacy settings should require a password after sleep/screen saver:

Screen Shot 2015-05-27 at 00.12.07

 

Tested on MacOS 10.10 Yosemite with pretty much a stock OS installation on an iMac 5k – I wouldn’t expect any variation by hardware, but YMMV (Your Mileage May Vary).

Jethro does Mac: Terminals

With a change in job, I recently shifted from my primary work computer being a Lenovo X1 Carbon running GNU/Linux to using an Apple Macbook Pro Retina 15″ running MacOS.

It’s not the first time that I’ve used MacOS as my primary workstation, but I’ve spent the vast majority of my IT life working in a purely GNU/Linux environment so it was interesting having to try and setup my usual working habits and flow with this new platform.

I’m going to do a few blog posts addressing my thoughts and issues with this platform and how I’ve found it compared to my GNU/Linux laptops. I’m going to look at both hardware and software and note down a few fixes and tricks that I’ve learnt along the way.

 

Part 4: Terminals and adventures with keybindings

I’ve already written about the physical issues with the Macbook keyboard, but there’s another issue with this input device – keybindings.

As mentioned previously, the Macbook lacks various useful keys, such as home and end, instead, you need to use a key combination such as Apple + Left/Right to achieve the same result. However for some inexplicable reason, Apple decided that the Terminal should have it’s own special behaviour, so it does not obey the same keybindings. In any other MacOS program, using these key combinations will achieve the desired results. But with Terminal, it results in random junk appearing in the terminal – or nothing at all.

For an engineer like myself this is the single most frustrating issue I’ve had with MacOS to date – having the Terminal essentially broken out of the box on their own hardware is quite frankly unacceptable and I suspect a reflection on how Apple cares far more about consumer users than power users.

Whilst Apple’s Terminal offers the ability to configure keybindings, it has two major problems that make it unusable:

  1. Whilst there is an entry for keys called “Home” and “End”, these entries seem to map to actual physical Home/End keys, but not the key combinations of Apple + Home/End, which appear as-is to the OS. So any configuration done for the Home/End won’t help.
  2. Instead we need to configure a key combination with a modifier of Apple key. But MacOS Terminal doesn’t allow the Apple key to be used as a modifier.
MacOS stock terminal keybinding configuration.

MacOS stock terminal keybinding configuration – no Apple key option here!

The result is, there’s no way to properly fix the MacOS Terminal and in my view, it’s essentially useless. Whilst if I was using an external keyboard with a physical home/end key it wouldn’t be too much of a problem since I can set a keybinding, there are times I do actually want to be able to use the laptop keyboard effectively!

I ended up fixing it by installing the popular iTerm2 third party terminal application- in many ways it’s similar to the stock terminal, but it offers various additional configuration options.

iTerm2 and MacOS Terminal alongside each other.

iTerm2 and MacOS Terminal alongside each other, configured to use same colour scheme and fonts.

For me the only thing that I really care about is the fact that it adds the ability to setup keybindings with the Apple + Home/End key options.

iTerm2

The killer feature – the ability to set key combinations with the Apple key!

Setting the above and then creating an ~/.input.rc file (as per these instructions) resolved the keybinding issues for me, and made iTerm2 consistent with all the MacOS applications.

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
set completion-ignore-case On

The key combinations work correct in the local shell, Vim and also via SSH connections to other systems. Perfect! I just wish I didn’t have to do this in the first place…

 

See other posts in this series via the jethro does mac tag as I explore using MacOS after years of GNU/Linux only.

Jethro does Mac: The Apple Input Devices

With a change in job, I recently shifted from my primary work computer being a Lenovo X1 Carbon running GNU/Linux to using an Apple Macbook Pro Retina 15″ running MacOS.

It’s not the first time that I’ve used MacOS as my primary workstation, but I’ve spent the vast majority of my IT life working in a purely GNU/Linux environment so it was interesting having to try and setup my usual working habits and flow with this new platform.

I’m going to do a few blog posts addressing my thoughts and issues with this platform and how I’ve found it compared to my GNU/Linux laptops. I’m going to look at both hardware and software and note down a few fixes and tricks that I’ve learnt along the way.

 

Part 3: The Apple Input Devices

I’ll freely admit that I’m a complete and total keyboard snob and I’ve been spoilt with quality desktop keyboards (Das Keyboard, IBM Model M) and the best possible laptop keyboard on the market – the classic IBM/Lenovo Thinkpad keyboard (pre-chiclet style).

Keeping this snobbery and bias in mind, I’m bitterly disappointed by the quality of the Apple keyboard. It’s a surprising slip-up by a company that prides itself on perfection and brilliant hardware design, I fear that the keyboard is just an unfortunate casualty of that design-focused mentality.

I have two main issues with this keyboard. Firstly, the shallowness and feeling of the keys, and secondly the layout and key selection.

The shallowness is the biggest issue with the keyboard. Laptops certainly aren’t known for their key travel distance, but there have been a few exceptions to the rule – IBM/Lenovo’s Thinkpad series is widely recognised as featuring one of the better keyboards in the market with decent sized keys, good layout and enough key depth to get a reasonable amount of travel when typing. (Side note: talking about the classic Thinkpad keyboards here… I’m undecided about their new chiclet style keyboards on recent models…)

On the Macbook, the key depth and travel distance is very short, there’s almost no movement when pressing keys and I lose the ability to effectively bounce between the different keys. I personally find that repeatedly doing the small motions needed to type on this keyboard for 4 hours or more causes me physical discomfort in my hands and I fear that if I were to use the Macbook keyboard as my primary computer, I would be looking at long term RSI problems.

Having said that, to be fair to Apple I probably couldn’t handle more than 6-8 hours a day on my Thinkpad keyboard – whilst it’s better than the Apple one, it’s still fundamentally a laptop keyboard with all the limitations it suffers. Realistically, for the amount of time I spend on a computer (12+ hours a day), I require an external keyboard whether it’s plugged into a Macbook, a Thinkpad or some other abomination of typing quality.

The other issue I have with Apple’s keyboard is that despite the large size of the laptop (mine is a 15.6″ unit), they’ve compromised the keyboard layout and removed various useful keys – the ones that I miss the most are home, end, insert, delete, page up and page down, all of which require the use of key combinations to be achieved on the Macbook.

The Thinkpad line has always done pretty well at including these keys, even if they have a VERY annoying habit of moving around their positions with different hardware generations, and their presence on the keyboard is very appreciated when doing terminal work – which for me, is a fast part of my day. It’s a shame that Apple couldn’t have used a bit more of the surface space on the laptop to add some of these keys in.

Overall, if I examine the Macbook keyboard as something I’m only going to use when out of the home/work office, then it’s an acceptable keyboard. I’ve certainly used far worse laptop keyboards and it sure beats tapping away on a tablet touchscreen or using something like the Microsoft Surface foldout keyboards.

And of course both the Thinkpad and the Macbook pale in comparison to a proper external keyboard – as long as I have a decent home/work office external keyboard it’s not too much of a deal breaker, but I’d certainly weigh in the keyboard as a negative if I was considering a machine for a role as a travelling consultant, where I could be spending weeks at a client site with unknown facilities and maybe needing to rely on the laptop itself.

 

Despite the insistence of some people that the keyboard is the only thing a computer needs, you’ll probably also want to use some kind of cursor moving thing if you want to effectively make use of the MacOS GUI.

The Macbook ships with a large touchpad centered in the middle of the laptop beneath the keyboard. This is a pretty conventional design, although Apple has certainly been pushing the limits on getting the largest possible sized touchpad on a laptop – a trend that other vendors appear to have been following in recent years.

Personally I hold a controversial opinion where I vastly prefer Trackpoint-style pointers on laptops over touchpads. I’m sure that a case could be made to accuse me of Thinkpad fanboyism, but I’ve used and enjoyed Trackpoints on Toshiba, HP and Lenovo computers in the past with great success.

The fundamental reason I prefer the Trackpoint, is that whilst it takes longer to get used to and feels weird at first, once it’s mastered, it’s possible to rapidly jump between typing and cursor moving with minimal effort.

Generally my fingers are resting on keys right next to the Trackpoint, or sometimes even I rest my finger on the Trackpoint itself whilst waiting, so it’s easy to jump between typing and cursoring. Plus on the Thinkpad design, my thumb rests just above the 3-button mouse, which is fantastically convenient.

http://xkcd.com/243/

http://xkcd.com/243/

Whilst the Macbook’s large touchpad is by far the best touchpad I’ve ever used, it still has the fundamental flaw of the layout forcing me to make a large movement to go between the keyboard and the touchpad each time.

This is technically a Macbook air, but the keyboard and touchpad is the same across the entire product line.

This is technically a Macbook air in the picture, but the keyboard and touchpad is the same across the entire product line…. this laptop was closer to my camera. :-)

It also has the issue of then sitting right in the way of my palm, so it took me a while to get used to not hitting the touchpad with my palm whilst typing. I’ve gotten better at this, although it still happens from time to time and does prevent me from resting my palm in my preferred natural position.

Admittedly I am nitpicking. To their credit, Apple has done a far better job of touchpads than most other vendors I’ve ever used. Generally laptop touchpads are too small (you can see how tiny the one on my Thinkpad is – I just disabled it entirely in favour of the Trackpoint) and even vendors who are busy cloning Apple’s design haven’t always gotten the same feel of sturdiness that Apple’s touchpad offers.

The gesture integration with MacOS is also excellent – I’ve found that I’m often using the three-finger swipe to switch between workspaces and the two-finger scrolling is very easy to use when doing web browsing, nicer and more natural feeling than using the cursor keys or a scroll wheel even.

 

Overall it’s a decent enough machine and beats most other laptop vendors in the market. I’d personally still go for the Thinkpad if all things other than keyboard were identical, simply due to how much I type and code, but the Macbook keyboard and touchpad is an acceptable second place for me and a good option for most general users.

See other posts in this series via the jethro does mac tag as I explore using MacOS after years of GNU/Linux only.

Das Keyboard Ultimate Silent

With the recent move to Sydney, I’ve had to leave my beloved IBM Model M keyboards back in New Zealand – sadly they’re a bit heavy and large to effectively pack into my luggage without sacrificing some much needed clothes.

Even if I was to bring them over here to Australia with me, the Model M’s are too loud for me to use in a shared office environment – my Model M was previously banned from my last employers office after they could hear it through two walls and down a phone at the other end….

Instead I’ve brought a Das Keyboard Ultimate Silent. I’ve been a fan of the Das Keyboard idea for a while – just like the IBM Model M they’re traditional clicky mechanical keyboards, but have modern features such as USB, lighter bodies and (love them or hate them) Windows keys that are useful for both Windows and MacOS users.

Das Keyboards come in both labelled (Professional) and unlabelled (Ultimate) revisions, and the option of either standard loud clicky keys or the “silent” model – considering I’m working in a shared office space, I elected to go for the silent edition.

Mmmmm sleek black sexiness.

Mmmmm sleek black sexiness.

I’ve been using the Ultimate Silent for about two months now, general impressions are:

  • It’s an excellent keyboard that’s well worth the $150 AUD price tag. I’ve had heaps of comments from co-workers on how great it feels to type on, command line power geeks can’t be wrong. ;-)
  • The keys still have the tactile feedback of a mechanical clicky keyboard. Whilst the responsive spring-back is a little more subdued than on the Model Ms, it still delivers a very nice feel.
  • The blank keys are AWESOME. People who try to use my computer are always really put off at first, however if you’re a touch typist it won’t take long to get used to it.
  • It’s not exactly silent -“quieter” is a more accurate term, I certainly have the loudest keyboard in the office, but it’s nowhere near as loud as an actual Model M is. The sound is more a subdued tap as the keys hit the bottom of the keyboard when typing, rather than the audible click of a traditional clicky keyboard.
  • My colleagues are a pretty good bunch of people since they haven’t murdered me for loudly typing and stretching the “silent” label to the limits. ;-)
  • I have occasional issues with finding a particular symbol key (things like ^ or &), but I can touch type almost any of the 104 keys on it without an issue.

Personally I’ll keep using the IBM Model Ms as my personal keyboard, they’re great quality keyboards and I love the fact I can keep using something designed in 1980s (mine were manufactured in 1994) on my computer for possible the rest of my life, but I’d be very content with using a Das Keyboard personally as well as professionally if I didn’t already have the Model M.

It always amazes me how often geeks will spend huge money on their computers and then neglect the keyboard or buy something that features lots of flashy lights and special keys, but ignore the most important requirement of good typing ergonomics and performance.

I haven’t tried the clicky version of the Das Keyboard myself so I can’t really compare it – I expect you’d find that the clicky version has a even nicer feedback (like the Model M) but the silent is the better investment if you work near anyone else.

I brought mine from AusPCMarket who have local stock and it arrived in a couple of working days without an issue, otherwise buy direct from Das Keyboards.