Chad Perrin: SOB

25 January 2009

entering special characters in Xorg

Filed under: Geek,Writing — apotheon @ 11:49

In MS Windows, if you hold down the rAlt key while typing 0164 on your keyboard’s number pad, then release the rAlt key, you’ll get the ¤ character. People sometimes miss that capability on Unix-like systems (read: Linux or *BSD). There’s a solution to the problem, however: the compose key.

The keyboard section in my xorg.conf file looks something like this:

Section "InputDevice"
       Identifier  "Keyboard0"
       Driver      "kbd"
       Option      "XkbOptions"  "compose:ralt"
EndSection

That line that starts Option sets the rAlt key as my compose key. With that I can produce any of a dizzying array of digraphs and other special characters that don’t actually appear on my keyboard in just about any application in my X session. For instance, to produce that ¤ character, I would use the following key combination:

<rAlt>x o

In other words, I would hold down the Alt key to the right of my spacebar, press the x key, then release the Alt key, and finally press the o key. Thus, holding down the compose key (set to rAlt) for the first character of a combination of characters like xo produces a non-keyboard character like ¤. Similarly, I can use "A for Ä, "o for ö, ~n for ñ, oo for °, and ss for ß.

This, to me, seems like an improvement over the MS Windows way of doing it. The key combinations used are more mnemonically effective than simply trying to remember hundreds of numeric values. They’re also more “discoverable”, in that after learning a few one might begin to recognize patterns that allow one to accurately guess at combinations one doesn’t yet have memorized.

(edit: The following notes about setxkbmap and .xinitrc were added on Thursday, 7 October, 2010.)

If you are using a more recent version of X.org, it is entirely possible your system is working fine without any xorg.conf file at all. You can use the setxkbmap command to specify a compose key instead:

setxkbmap -option compose:ralt

If you use startx to start your X session, you can use the .xinitrc file in your user account’s home directory to automatically execute this every time X is started. To do so, just add that command to the file before the line that specifies which window manager to fire up. You just need to add an ampersand at the end of the line.

The following is an example of the contents of an .xinitrc file — actually, the contents of my .xinitrc file at present:

xbattbar -at 1 top &
setxkbmap -option compose:ralt &
exec ahwm

The first line gives me a nifty line across the top of my screen that tells me how the laptop’s battery is doing. The last line tells X to use a window manager called AHWM.

A complete listing of default compose key sequences can be found in a file called Compose somewhere on most Unix-like systems. On FreeBSD, it should be located in a subdirectory of:

/usr/local/lib/X11/locale/

The subdirectory corresponds to the character set used in your user environment. On my laptop, I’m using the US English UTF-8 character set; that information is stored in the LANG variable:

> printenv LANG
UTF-8

Thus, my default compose key sequences are defined in:

/usr/local/lib/X11/locale/en_US.UTF-8/Compose

Your mileage may vary.

This kind of thing is increasingly useful to me, especially since I’ve been using diereses more often when spelling out words where tonal shifts are not necessarily obvious from spelling, as in the cases of coöperation and naïve. The occasional desire for other special characters, such as ¥ or ñ, also rears its ugly head when writing speculative fiction or making a point about economics (for instance) — and not always in a context where HTML entities (e.g., &ntilde; for ñ) can be used.

That was easy: suspend works now.

Filed under: Geek — apotheon @ 01:07

Suspend/Resume now works on my ThinkPad R52 with FreeBSD

I haven’t bothered trying to get suspend/resume to work on my ThinkPad R52 for a while. It has been long enough that I don’t remember what I tried — so I don’t know if what I did to get it working this time was something I had tried before and, at the time, didn’t work. Some software on my system has been updated, and some configuration changed, since then. As such, it’s possible that the exact same thing that worked this time didn’t work before. It’s also possible that, in the midst of my experimenting and research, I just managed to miss the very easy fix for getting things working on FreeBSD.

Relevant Specs

Hardware: ThinkPad R52 Mobility Radeon X300

Software: FreeBSD 6.2-RELEASE (yes, I need to upgrade that)

xorg.conf: Driver “radeon”

loader.conf: radeon_load=”YES”

That’s it for preëxisting system specs that seem relevant and changeable. Obviously, there’s more that might have a bearing on whether this works for you, but I think it’s all stuff that falls under the control of one of the specs I already brought up (such as hardware details that are determined by the fact it’s an R52).

Relevant Config Changes

I added this to my /etc/sysctl.conf: hw.acpi.reset_video=1

I added this to my /boot/loader.conf: acpiibmload=”YES”

Any other possibly relevant settings I left at default values. The defaults involve closing the lid not changing suspend state, for instance — which is what I want, since I tend to close my lid a lot (after locking the screen) when I walk away from my laptop for a few minutes, and don’t want networking interrupted every time I do so. Another default is having hardware devices turned off when the system is suspended so that less power is used, since I only really need to suspend when I move my laptop from one network to another anyway.

After rebooting my computer once, suspend and resume seem to work flawlessly. I’ll be using suspend from time to time now, and checking to see whether any unexpected problems surface, but so far it looks good. I’m just amazed at how easy that is, and how annoyingly difficult it is to find information that very clearly lays out the importance of these two configuration file options. Maybe my discovery will help someone else.

New Attributes, (Mostly) Old Rules

Filed under: Geek,RPG — Tags: , , , — apotheon @ 01:11

This is part of my RPG series of entries here at SOB. See the inaugural entry in the series for more details.

I’ve taken issue with the way attributes are handled in D&D for a very long time — both the names of the attributes and the way game effects are based on them. I don’t like the fact that half-orcs are, on average, mentally retarded (with a -2 Intelligence); I don’t like the fact that being likable grants you more power as a sorcerer; I don’t like the fact that people essentially have to be more learned to be better at hiding in shadows; I don’t like the fact that the ability to make out details of someone approaching from a distance is based on whether you’re wise; I don’t like the fact that being attractive is essentially a prerequisite for being any good at scaring the crap out of someone.

New Attributes

For the most part, this is solved by doing nothing more drastic to the game system than changing the names of the attributes. As a result, I’m going to start using a new set of attributes in my games:

  • ST: Strength (same as always)
  • DX: Dexterity (same as always)
  • CN: Constitution (same as always)
  • SC: Scholarship (formerly Intelligence)
  • IN: Intuition (formerly Wisdom)
  • PR: Presence (formerly Charisma)

The Scholarship attribute is not native Intelligence, nor is it a character’s current level of education. Rather, it is the character’s affinity for academic knowledge and educational study.

The Intuition attribute is the cunning, common sense reasoning, awareness, and mystical connectedness of the character. There’s a nice differentiation between Intuition and the concept of wisdom that we encounter in everyday life, too, that was not well represented with the attribute known as Wisdom.

The Presence attribute is a character’s force of personality and ability to impose his or her will on others through manipulation, intimidation, cajoling, and other nonphysical and nonmagical means of influencing others’ decisions and emotions. This also helps remind people that the physical attractiveness of a character is not necessarily identical to a given attribute — a character may be both beautiful and uncharismatic, and neither necessarily has a strong relationship to the Presence attribute itself.

New Rules

You might think these changes would require a whole bunch of new rules to make things work out smoothly. I’ve listed and explained all the rules changes I think are required to make this work well.

Skill Points:

This does increase the problem of connecting the Scholarship/Intelligence attribute with one’s skill point total in OGL/d20 games (i.e., D&D and Pathfinder), however. As such, when determining skill point totals, I’ll just let a player use the higher of SC and IN to determine skill points. As such, a Cleric who would have gotten two skill points per level with an Intelligence of 10 and Wisdom of 17, instead gets five skill points per level with a Scholarship of 10 and Intuition of 17. If you’re going to use this modified list of attributes, I recommend you do the same. It helps if you remember that a character with a higher Intuition is more likely to have a greater focus on experiential and innate talent based skills, whereas a character with a higher Scholarship is more likely to have a greater focus on academic skills (book learnin’). In cases where a character has more academic skills than talent-based skills, despite having a higher Intuition than Scholarship, I’m willing to just let it go with giving the PC the benefit of the doubt on points so that I don’t penalize a player for having attributes that best suit the character concept (I tend to prefer point-buy systems over dice-rolling for attribute determination).

That’s it. No, really — after thinking about it and discussing it with my SigO, I don’t think there are any other cases of basic game rules that need to be adjusted at all to fit with this change in the attributes’ names and concepts.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License