Tag Archives: awesome

FreeBSD: script to manage processor speed

I have posted about this before <broken link>.

This time, it’s not one script, but many.

  • cpuctl is the script to be used when you want to switch the processor frequency. It goes anywhere you feel comfortable, I put it in ~/bin/.
  • cpucontrol is a wrapper script to sysctl. It’s required, since a common user is not allowed to change sysctl values. So, this script is run at startup with root permissions and works in the background. It reads from a file and issues the sysctl command. You control who can change the frequency by setting the aforementioned file’s permissions.
  • rc.d-cpucontrol is the rc.d file. It’s required to run cpucontrol on startup.
  • awesome-cpu is a widget for the awesome window manager. I use that. If you don’t, just delete it.

You can get all the files packed. SERVER DIED

Check the files, they have modifiable values. To install, issue something like:

cp cpuctl ~/bin/cpuctl
sudo cp cpucontrol /usr/local/bin/cpucontrol
sudo cp rc.d-cpucontrol /usr/local/etc/rc.d/cpucontrol
sudo echo 'cpucontrol_enable="YES"' >> /etc/rc.conf

awesome: launch custom commands from menu

The menu in the awesome wiki is a good one, yet it has some drawbacks:

1) It’s written in bash. Not all systems have bash. Not all systems have bash in /bin/bash.
2) The menu is stored inside the script itself, which makes it hard to edit.

My solution: write a menu file with choices:

% pwd
/usr/home/cy/.config/awesome
% cat menu
firefox
thunderbird
transmission
linuxdcpp
sunbird
eclipse

Add a command to .awesomerc, like this one:

key
{
modkey = {"Mod4"} key = "F2" command = "spawn"
arg = "cat /usr/home/cy/.config/awesome/menu | awesome-menu -e 'sh ~/bin/awesome-exec ' 'Execute:' &"
}

Finally, write ~/bin/awesome-exec (or elsewhere, if you fancy):

#!/bin/sh

case $1 in
        sunbird)
                exec linux-sunbird & ;;
        *)
                exec $1 & ;;
esac

As you can see, this solution is a lot more simple than the one in the awesome Wiki. Also, you can edit the menu easily, like this:

echo mutt >> ~/.config/awesome/menu // add
cat ~/.config/awesome/menu | grep -v mutt > ~/.config/awesome/menu //remove

I’m saying “easily”, because you can add these commands as an alias.

MPC aliases for tcsh

mpc commands are quite lengthy, so here’s what I put in my .cshrc:

# mpc/mpd control
alias mpca 'mpc search \!* | mpc add -' # search and add tracks
alias mpcc mpc clear
alias mpcl mpc playlist
alias mpcs mpc stop
alias mpcp mpc play

I also added some shortcuts to use the WIN+FXX keys in awesome:

# MPC control through WIN+FXX keys.
key { modkey = {"Mod4"} key = "F7" command = "spawn" arg = "mixer vol -5:-5" }
key { modkey = {"Mod4"} key = "F8" command = "spawn" arg = "mixer vol +5:+5" }
key { modkey = {"Mod4"} key = "F9" command = "spawn" arg = "mpc toggle" }
key { modkey = {"Mod4"} key = "F10" command = "spawn" arg = "mpc stop" }
key { modkey = {"Mod4"} key = "F11" command = "spawn" arg = "mpc prev" }
key { modkey = {"Mod4"} key = "F12" command = "spawn" arg = "mpc next" }

Default Firefox UI font too big (using awesome)

As said here, to change the default font of GTK+ applications, edit .gtkrc-2.0 in your home directory and add

gtk-font-name="sans-serif 8"

This was somehow automatically tweaked in Xfce. Some of the options are tweaked by setting values in ~/.config/xfce4/Xft.xrdb, but that’s not it: these values set the same stuff as Xorg’s /usr/local/etc/fonts/local.conf (or default.conf).

Anyway, I think it’s better to use the “native” configuration files and not some differently-formatted override. It’s always a drag when you define some values in one place and then find out they take no effect, because they’re being overriden elsewhere.

Besides, the original configuration files will (by definition) always support all available options, whereas window-manager-specific configuration might not.

Another reason why awesome is more awesome for me than Gnome or even Xfce.

It’s awesome!

I think I’ll be using awesome from now on. It might take some time moving all my settings from Xfce; but probably not, considering how fast I’ve found the settings I had in Gnome “pretty much irrelevant”.

One of the issues was flipping back to good old XTerm. This thread on Ubuntu forums was helpful.

Oh, and I had to add

/usr/local/bin/xrdb /home/cy/.Xresources &

to ~/.xinitrc. Note the & in the end, otherwise you’ll get some errors from Xorg, which isn’t able to start up for obvious reasons then.