How to programmatically invert screen colors in Linux - linux

In Ubuntu, for example, you can use Super-M to invert the screen colors (requires desktop effects, see [1]). Other OSes have similar abilities, although I'm not really concerned with anything other than Linux.
Which API should I look into if I want to write a simple program that, when run, inverts the screen colors?
The language that I use the API from doesn't particularly matter to me. I am familiar enough with C/C++/Bash/Perl/Python that I can hack this up in whatever language has the easiest access to this API. Working on Ubuntu is required, working on other similar *nixes is not terribly important.
[1] https://help.ubuntu.com/community/KeyboardShortcuts#Desktop%20Effects%20enabled%20shortcuts

You could use xcalib to do what you want.
For example, a simple bash script to invert the screen colors would look like this:
#!/bin/bash
xcalib -invert -alter

Here are scripts and instructions for shifting colors using compton: https://github.com/vn971/linux-color-inversion

xrandr-invert-colors worked out of the box for me.
xcalib does not work for me using xorg and a tiling window manager, with an external display and gives me the following error: "Unable to get a display calibration".
Credit to Imat.

Related

How can one greate grid/tile view of selected parts of windows on xfce/linux

I have a few windows on my linux machine using the xfce4 desktop enviorment.
I wish to have a grid-like view where i can see only the part of each window im intrested in.
An example for the general vision:
see a script running without the window borders on terminal across the header
see work status of F#H client out of the advenced client view in the middle left
see only the turrents status list of qBittorrent at middle right
have another terminal at footer (again without header/borders)
My best way to describe it shortly is to generate a view from selective parts of windows.
Added a picture for illustration
Is there any way of doing such thing in a practical way? Am i missing out on a great software?
There are several tiling helpers for Xfce.
Perhaps try xpytile , which is a tiling add-on for Xfce. It offers
automatic tiling, manual tiling and can simulaneously resize side-by-side windows (like AeroSnap for MS-Windows).

Fish Shell: How can I customize the colors for the autocomplete feature?

I started using Fish (and oh-my-fish) a couple of weeks ago and one of the things that I find somewhat visually hard is the default background color of the autocomplete options (see the purple background in the image). I tried looking in the Fish page, but couldn't find anything related to that. I'd like to know how that background color can be changed.
In case you're wondering, I'm using LXTerminal in LUbuntu (a Ubuntu distro with LXDE).
it's more convenient to setup all color configuration via fish web UI, which can be done from cli:
fish_config colors, which launches the config server of fish, and there are already tons of predefined color suggestion
For more info, check out The Fish Shell
I found it, after checking these docs, and doing some trial and error with different environment variables that might be responsible for that feature.
The environment variable is fish_color_search_match
and the solution is changing the variable like:
$ set fish_color_search_match --background='333'
Where '333' is the color code. It is also possible to use predefined colors like cyan, green, blue, etc. that are available.
Also, I'm aware that maybe this belongs better in Unix&Linux StackExchange (which might have been the reason for the downvote?)
Edit: Take into account that colors will not look correctly if your terminal is not using 256 colors.
Adding to top voted answer. The command fish_config colors has been removed and you should instead use the following:
$ fish_config browse
The following also do the trick
$ fish_config
Reference: https://fishshell.com/docs/current/cmds/fish_config.html

Change font style in terminal to a specified .ttf file

I am creating a terminal game which uses a specific font to display graphics. The problem is that it is inconvenient to manually have to switch font every time the game is started and stopped. The game should run on OS X and Linux and should mainly support xterm. Is there any hack which allows this to be automated?
No, there is no generally applicable way of doing this. Sorry.
I can think of a couple specific awful hacks that you could use to change the user's font in specific environments -- for instance, if the user is using macOS and running Terminal.app, you could use Applescript to alter the font. However this trick wouldn't work even if the user were using another terminal in macOS, let alone on Linux.
If you need a specific font, you should write your game to run as a graphical desktop application, rather than in a terminal.

Screen video (screencast) recording on Linux

I was trying to record video of all the monitors or a selection, so was wondering what to use for Linux.
The thoughts that came to mind were screenshot the screen a bunch but this probably isnt the right way to go about it.
I looked at the Cairo docs but can't find anyhting. On Windows I found DirectShow and OSX I found AVFoundation.
edit:
i just came across something: XvGetVideo would this be an option?
You can check out ffscreencast with the --dry parameter which will show you the commands that would be issued. Looks nice for learning.
Did it under linux and it showed me it was using x11Grab

show vim command keys on live demo

I'm going to make a live presentation showing vim capabilities. It's essential to show the audience command keys that I press. I know I can use showcmd, but I find its output to small and to hard to notice to use it in live demo. Is there any way to make it easier to notice? It could be something similar to command keys shown in Railscasts (for instance in this video, 1:11). Do you know anything like that?
For X11, there is key mon. I'm sure there are similar tools for other systems. Otherwise, you could use some sort of virtual keyboard which also shows keypresses.
Here's a recent vimcast article about Drew Neil tackling the same issue -
Vimprint Source, Article
Relevant accompanying talk -
Video, Slides
There is also Screenkey, inspired from key-mon.

Resources