flak rss random

two hackers one keyboard two ways

There’s an amazing and famous scene of two hackers sharing a keyboard on NCIS, but it gets a lot of derision on the internet. What people don’t realize is that their mockery only reveals their own lack of skill. As everyone knows, a true hacker has mastered the art of dual wielding, and a keyboard that can be dual wielded by one might also be used by two hackers in tandem.

more...

Posted 31 Oct 2023 04:13 by tedu Updated: 31 Oct 2023 04:13
Tagged: programming software x11

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: 24 Dec 2023 17:17
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: 24 Dec 2023 17:13
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: 24 Dec 2023 17:19
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: 22 May 2020 03:29
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: windowlistener.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: 24 Dec 2023 17:16
Tagged: c programming x11