flak rss random

xterm full reverse

Depending on whether it is day or night, I prefer a light screen or a dark screen. I would like switching between these two modes of operation to be quick and easy. Easy in this case means I am willing to run a command, but not ctrl-click on 21 different xterms.

more...

Posted 13 Dec 2018 21:14 by tedu Updated: 13 Dec 2018 21:31
Tagged: c programming x11

time scrolling

The hovertext for Friday’s xkcd Borrow Your Laptop asks for scrolling mapped to undo and redo. How hard can it be? There’s more than one way to do this, but the other ways are boring. What if we’re using a program that doesn’t allow rebinding keys or buttons?

more...

Posted 05 Mar 2017 07:51 by tedu Updated: 05 Mar 2017 07:51
Tagged: c programming x11

xautobacklight

Some newer laptops adjust the screen brightness according to ambient light in the room. This is fairly annoying in most cases, because what I really care about is the relative brightness of the screen contents. White web pages are too bright in a dark room. Fortunately, there’s a tool, Lumen, which can adjust the backlight based on actual brightness. Unfortunately, it’s for somebody else’s computer.

more...

Posted 09 Aug 2016 17:33 by tedu Updated: 09 Sep 2016 21:03
Tagged: openbsd project x11

sct - set color temperature

The recent fuss about f.lux on iPhone made me take another look at desktop solutions for shifting the screen’s color temperature. f.lux is only available as a linux binary, but there’s a program called redshift that may work.

more...

Posted 16 Nov 2015 16:34 by tedu Updated: 13 Dec 2018 21:09
Tagged: openbsd programming project software x11

stdwinjector

Copying another idea from Old New Thing and porting to unix. This time it’s Piping to notepad. Instead of starting a new notepad process, let’s feed stdin to any existing window.

more...

Posted 16 Sep 2014 15:48 by tedu Updated: 16 Sep 2014 22:53
Tagged: c programming x11

logging the foreground process in X11

Inspired by a similar New Old Thing post, Logging the foreground process as it changes, I thought I’d try my hand at a similar tool for X11. (No doubt such a thing already exists, didn’t look.) I’m not interested in the process that’s running on the CPU, which is closer to top’s job, but the name of the window I’m looking at.

The basic structure is pretty similar to the Windows sample program. We ask the X11 server for focus change events and print them out. We also have to ask for window creation events so we can track new windows as they show up. Here’s the source: windowwatcher.c

A few other things to note. I spend most of my time in an xterm, so just knowing I switched between three different xterms doesn’t tell me much. Fortunately, it’s pretty easy to give each xterm a title that changes to reflect the current directory or file being edited. OpenBSD’s sample .kshrc file (/etc/ksh.kshrc) sets up aliases for common commands like cd and ssh that reset the xterm title. vim can do the same by adding set title to .vimrc, and then you’ll want to create an alias that resets the title after exiting vim.

Exercises: Add timestamps. Add a timeout and poll the current window title, so that title changes without focus changes (editing a new file) are detected.

Posted 13 Dec 2013 06:32 by tedu Updated: 10 Oct 2014 00:35
Tagged: c programming x11