Record my desktop with ffmpeg
It seems that desktop recording is quite the pest. Not that I’ve tried much, but I also haven’t really found a “go-to” piece of software for X11 that just does it. So the last time I wanted to record my screen, I decided to have a go with just plain command-line tools.
It turns out that this is also ridiculously easy.
ffmpeg -f x11grab -s 500x300 -r 25 -i :0.0 foo.mp4
The -s option tells ffmpeg the pixel size of the region you want to grab; -r is the frame rate, -i is your X screen, and the video is written to foo.mp4.
If you don’t want to start the screen capture in the top-left, just use something like
-i :0.0+100,200 to specify where to start and the resolution to capture.
The ffmpeg website has more info.
Posted Tuesday, February 19, 2019
Find and replace in geany
The other day I wanted to do a find-and-replace in geany using a regex in the find. I wanted to turn something like this
Field name: value
Field name: value plus some more
Since geany supports regex searching, I decided it was time to find out how to do regex replacements too. The way it works, is that you put parentheses around each match that you want to be able to use in the replacement string, and then reference these replacements using backslash-number. So the find string becomes
^Field name: (.*)
and the replacement string becomes
Field name: plus some more
That was too easy.
Posted Monday, February 18, 2019
Getting Void Linux to work right
My experiment with Void Linux started very well. There was the usual round of installing all the packages I needed to make the computer useful, and then there was the business of getting nonfunctional stuff to work. Being that Void doesn’t modify packages, this was also an educational experience.
The trackpad on this computer was tracking too slowly for my liking. I don’t know if it was due to Arch/Void differences, or just changes in xorg, but it really doesn’t matter.
I didn’t want to fix this with an X configuration file, primarily because it doesn’t live in my home directory and is thus vulnerable to disappearing with an OS install.
I discovered xinput, which allows you to query and set various input-related settings in a running X server.
To get a list of input devices:
To see the available properties of a device (use the device name reported above):
xinput list-props <device name>
To set a property:
xinput set-prop "ETPS/2 Elantech Touchpad" 287 1
where “ETPS/2 Elantech Touchpad” is the device name, 287 is the number of the property to set, and 1 is the value I want there.
I run this in .xinitrc before starting xfce4.
X display settings
I discovered the wonders of xrandr some time ago, but it’s worth documenting. With a laptop, you (or at least I) frequently end up connecting to a variety of different screens. These are often TVs that just don’t correctly report their capabilities in the EDID (which is the way a monitor tells a computer its name, the resolutions it supports, etc).
To fix this, you can sometimes supply an EDID file to the kernel at boot, or edit the xorg configuration, or just use xrandr on a running X server.
To create a new mode, and assign it to a particular output use this:
xrandr --newmode "1920x1080 60Hz" 148.500MHz 1920 2008 2052 2200 1080 1084 1089 1125 +HSync +VSync xrandr --addmode DP-1 "1920x1080 60Hz"
You can get the output names by running xrandr with no arguments. To get modelines, use the
cvt programs. The new mode will now be available in your favourite monitor-configuring tool, be that xrandr or your DE’s settings program.
I run this in .xinitrc before starting xfce4.
Getting xfce4’s restart and shutdown buttons to work
This one turned out to be easy. You simply run
startxfce4 with the
--with-ck-launch option. I had tried this previously with no result, probably because some required package wasn’t installed. I assume this was ConsoleKit, or maybe PolicyKit, and it would have been brought in as a dependency for something else.
For some reason, there are no suspend or hibernate buttons. I don’t know if they’re compiled out in Void, or not being shown because those functions aren’t available. I strongly suspect, due to what I’ve read, that these two rely on systemd to work.
Intel HDA sound is always a pest. My sound used to work in Arch, but that may have been due to some tweaking that got blown away when the root partition was reformatted. My problem was that sound would go to the headphones when they weren’t plugged in but when they were plugged in, sound would go to the speakers.
I finally stumbled upon the awesome tool
hdajackretask, which is a part of
alsa-tools. The snd-hda-intel module can be reconfigured on the fly by writing values to the correct section of
/sys. You just fiddle around in hdajackrestask until things seem to work right, then grab the shell script it creates from
I tweaked the script to stop it trying to write logging information to /tmp, and called it from
/etc/rc.local in order to apply the sound changes at boot – oh the joy of having rc.local again!
Automounting of USB drives
I’ve been using devmon and udevil for years. With systemd there’s some bodgy-looking method for running devmon when a user logs in. Without systemd you just put it in your .bashrc or equivalent shell startup script. I’m using fish, so what I’ve ended up with is:
pidof -x devmon > /dev/null 2>/dev/null if test $status -ne 0 echo "Starting devmon" devmon -g & end
This typically starts devmon when I log in, and logging out should kill it.
Posted Tuesday, January 22, 2019
Entering the Void
Or, my experiment with Void Linux.
With a 32-bit computer and ArchLinux now 64-bit only, it’s time to try something that will run on the old CPU. I picked Void Linux because it’s very basic (like Arch), and doesn’t have systemd. I’m not a great fan of systemd, in part because of the usual complaints, but moreso because it is another milestone on the road to ruining everything that was good about Linux (ie, user control over the system – most distros seem to have this big blob (or set of big blobs) in the middle that are hard to figure out and not very modular).
The void installer was very good. So good, in fact, that there’s nothing to report. It just got the job done.
The next step was to configure /etc/crypttab to unlock my encrypted /home partition. That was also simplicity itself.
Void Linux is very Arch-like in many ways. The main thing to do was to get extra packages to have a working system. Are there any issues?
I had a little trouble with NetworkManager. First, it required dbus, no surprise there, but I had to tell it to run myself (hooray!). Second, there was some kind of issue with filesystem permissions to delete connections, but that resolved itself with either a reboot or adding myself to an appropriate group (no idea which one that was, though).
XFCE4 still doesn’t show a proper logout menu. The restart and shutdown icons are greyed, and the suspend-to-RAM and hibernate buttons don’t show at all. This is a typical problem with learning a new distro. I’ll solve that later.
So far that seems to be it.
Posted Thursday, January 17, 2019
It is possible (at least on my systems) to remove gvfs. Why do this? Well it doesn’t do anything useful for me, and it does leave processes lying around after logout. One time it even held open files on a USB drive, which is a real pest when you want to remove it.
Getting rid of gvfs turned out to be really easy. Nothing I use depends on it, although there are some optional dependencies. Nothing I’ve been used to has stopped working, either.
Now if I can get rid of those other non-dying processes…
Posted Monday, December 5, 2016