Re: [dwm] xgamma notify

2009-03-06 Thread stanio
* Alan Busby thebu...@thebusby.com [2009-03-06 00:09]:
 urxvt seems to ignore xgamma. So although it's a great idea, it isn't much
 help if you only have some terminals open.

xgamma works with urxvt here.

-- 
 cheers
 stanio_



Re: [dwm] xgamma notify

2009-03-06 Thread markus schnalke
[2009-03-06 07:04] Samuel Baldwin shardz4...@gmail.com
 2009/3/6 pancake panc...@youterm.com:
  I have been playing a bit with xgamma and I think it can be useful as a
  graphical
  notification for important alerts like low battery or so.
 
  The usage is quite simple. and we can 'flash' the screen in red for a
  fraction of a second with:
 
 What happens if you're not looking at the screen?

I modified `slock' some time ago to display a fullscreen red window
that closes on any button press. I use it to notify about low battery.

The code is attached.

Example usage:

$ ./redscr
 a red windows appears 

$ ./redscr 336699
 a baby blue window appears 



meillo
/* © 2006-2007 Anselm R. Garbe garbeam at gmail dot com
 * See LICENSE file for license details. */
/* #define _XOPEN_SOURCE 500 */
#define VERSION 0.8

#include stdarg.h
#include stdlib.h
#include stdio.h
#include string.h
#include unistd.h
#include X11/Xlib.h


int main(int argc, char* argv[]) {
	char curs[] = {0, 0, 0, 0, 0, 0, 0, 0};
	int screen;
	unsigned int len;
	char screencolor[8] = #66;
	Cursor invisible;
	Display *dpy;
	Pixmap pmap;
	Window root, w;
	XColor black, dummy;
	XEvent ev;
	XSetWindowAttributes wa;

/* 	printf(argc: %d\n, argc); */

	if (argc  2) {
		/* invalid option */
		fprintf(stderr, usage: redscr [--version]\n
		   redscr color (color has to be 6 hex chars)\n);
		exit(EXIT_FAILURE);
	}

	if ((argc == 2)  (strcmp(--version, argv[1]) == 0)) {
		/* version information */
		fprintf(stderr, redscr-%s, (c) 2006-2007 Anselm R. Garbe, 2007 markus schnalke\n, VERSION);
		exit(EXIT_SUCCESS);
	}

	if ((argc == 2)) {
		/* set color */
/* 		printf(arg: %s, argv[1]); */
		screencolor[0] = '#';
		screencolor[1] = '\0';
		strcat(screencolor, argv[1]);
/* 		printf(color is: %s, screencolor); */
	}

	if(!(dpy = XOpenDisplay(0))) {
		fprintf(stderr, redscr: cannot open display\n);
		exit(EXIT_FAILURE);
	}




	/* init */
	screen = DefaultScreen(dpy);
	root = RootWindow(dpy, screen);

	Colormap cmap = DefaultColormap(dpy, screen);
	XColor color;

	if(!XAllocNamedColor(dpy, cmap, screencolor, color, color)) {
		fprintf(stderr,error, cannot allocate color\n);
		exit(EXIT_FAILURE);
	}

	wa.override_redirect = 1;
	wa.background_pixel = color.pixel;

	w = XCreateWindow(dpy, root, 0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen),
	0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
	CWOverrideRedirect | CWBackPixel, wa);
	XAllocNamedColor(dpy, DefaultColormap(dpy, screen), black, black, dummy);
	pmap = XCreateBitmapFromData(dpy, w, curs, 8, 8);
	invisible = XCreatePixmapCursor(dpy, pmap, pmap, black, black, 0, 0);
	XDefineCursor(dpy, w, invisible);
	XMapRaised(dpy, w);

	for(len = 1000; len; len--) {
		if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) == GrabSuccess)
			break;
		usleep(1000);
	}

	/* main event loop */
	while (ev.type != KeyPress) {
		XNextEvent(dpy, ev);
		usleep(10);
	}

	XFreePixmap(dpy, pmap);
	XDestroyWindow(dpy, w);
	XCloseDisplay(dpy);
	return 0;
}


signature.asc
Description: Digital signature


Re: [dwm] xgamma notify

2009-03-06 Thread Neale Pickett

On 3/6/2009, markus schnalke mei...@marmaro.de wrote:

I modified `slock' some time ago to display a fullscreen red window
that closes on any button press. I use it to notify about low battery.

That reminds me, I used to use xrefresh for something similar.

xrefresh -solid red

If you have a fancypants graphics card it might not last long enough to
notice.



Re: [dwm] xgamma notify

2009-03-05 Thread Samuel Baldwin
2009/3/6 pancake panc...@youterm.com:
 I have been playing a bit with xgamma and I think it can be useful as a
 graphical
 notification for important alerts like low battery or so.

 The usage is quite simple. and we can 'flash' the screen in red for a
 fraction of a second with:

What happens if you're not looking at the screen?
-- 
Samuel 'Shardz' Baldwin - staticfree.info/~samuel/



Re: [dwm] xgamma notify

2009-03-05 Thread pancake

Samuel Baldwin wrote:

2009/3/6 pancake panc...@youterm.com:
  

I have been playing a bit with xgamma and I think it can be useful as a
graphical
notification for important alerts like low battery or so.

The usage is quite simple. and we can 'flash' the screen in red for a
fraction of a second with:



What happens if you're not looking at the screen?
  

The screen explodes.



Re: [dwm] xgamma notify

2009-03-05 Thread Alan Busby
urxvt seems to ignore xgamma. So although it's a great idea, it isn't much
help if you only have some terminals open.

On Fri, Mar 6, 2009 at 9:05 AM, pancake panc...@youterm.com wrote:

 Samuel Baldwin wrote:

 2009/3/6 pancake panc...@youterm.com:


 I have been playing a bit with xgamma and I think it can be useful as a
 graphical
 notification for important alerts like low battery or so.

 The usage is quite simple. and we can 'flash' the screen in red for a
 fraction of a second with:



 What happens if you're not looking at the screen?


 The screen explodes.




Re: [dwm] xgamma notify

2009-03-05 Thread pancake
I use xterm and it is affected by xgamma, the grey letters become darker 
for a while.


Sounds strange that urxvt isnt :?

Alan Busby wrote:
urxvt seems to ignore xgamma. So although it's a great idea, it isn't 
much help if you only have some terminals open.


On Fri, Mar 6, 2009 at 9:05 AM, pancake panc...@youterm.com 
mailto:panc...@youterm.com wrote:


Samuel Baldwin wrote:

2009/3/6 pancake panc...@youterm.com
mailto:panc...@youterm.com:
 


I have been playing a bit with xgamma and I think it can
be useful as a
graphical
notification for important alerts like low battery or so.

The usage is quite simple. and we can 'flash' the screen
in red for a
fraction of a second with:
   



What happens if you're not looking at the screen?
 


The screen explodes.







Re: [dwm] xgamma notify

2009-03-05 Thread Engin Tola

i use xterm+screen. no problem here. works like a charm.

Alan Busby thebu...@thebusby.com writes:

 urxvt seems to ignore xgamma. So although it's a great idea, it isn't much 
 help if you only have some terminals open.

 On Fri, Mar 6, 2009 at 9:05 AM, pancake 
 panc...@youterm.commailto:panc...@youterm.com wrote:
 Samuel Baldwin wrote:
 2009/3/6 pancake panc...@youterm.commailto:panc...@youterm.com:

 I have been playing a bit with xgamma and I think it can be useful as a
 graphical
 notification for important alerts like low battery or so.

 The usage is quite simple. and we can 'flash' the screen in red for a
 fraction of a second with:


 What happens if you're not looking at the screen?

 The screen explodes.



-- 
engin tola - http://cvlab.epfl.ch/~tola



Re: [dwm] xgamma notify

2009-03-05 Thread Engin Tola

nice!

pancake panc...@youterm.com writes:

 I have been playing a bit with xgamma and I think it can be useful as a
 graphical
 notification for important alerts like low battery or so.

 The usage is quite simple. and we can 'flash' the screen in red for a
 fraction of a second with:

 $ cat flash.sh
 for a in $(seq 1 $1); do
   xgamma -ggamma 0.3 -bgamma 0.3
   sleep 0.1
   xgamma -gamma 1
   sleep 2
 done

 $ sh flash.sh 10

 --pancake



-- 
engin tola - http://cvlab.epfl.ch/~tola



Re: [dwm] xgamma notify

2009-03-05 Thread Neale Pickett

xgamma just changes the gamma, which may not be noticeable on things that
are predominantly black and white.  Here are a few suggestions that will
set actual brightness:

  xbacklight =[some-value]
  xvattr -a XV_BRIGHTNESS -v [some-value]

These may not work on all systems, but will probably work on most
laptops.  See man pages for further information on these commands.




Re: [dwm] xgamma notify

2009-03-05 Thread Neale Pickett

On 3/5/2009, Neale Pickett ne...@woozle.org wrote:

  xbacklight =[some-value]
  xvattr -a XV_BRIGHTNESS -v [some-value]

While I'm thinking of it, I use xmessage to wake me up when my battery
is about to die.  It has the nice advantage that if I'm not looking at
the screen that instant, it'll be around when I come back to it.  And
also the screen doesn't explode.




Re: [dwm] xgamma notify

2009-03-05 Thread miles
Dzen2 could also be used

--Original Message--
From: Engin Tola
Sender: Engin Tola
To: dwm mail list
ReplyTo: engin.t...@epfl.ch
ReplyTo: dwm mail list
Subject: Re: [dwm] xgamma notify
Sent: Mar 5, 2009 18:31


the problem with xmessage is that it steals the focus. do you know a way
to prevent it from doing that ?

Neale Pickett ne...@woozle.org writes:

 On 3/5/2009, Neale Pickett ne...@woozle.org wrote:

  xbacklight =[some-value]
  xvattr -a XV_BRIGHTNESS -v [some-value]

 While I'm thinking of it, I use xmessage to wake me up when my battery
 is about to die.  It has the nice advantage that if I'm not looking at
 the screen that instant, it'll be around when I come back to it.  And
 also the screen doesn't explode.



-- 
engin tola - http://cvlab.epfl.ch/~tola




Sent from my BlackBerry



Re: [dwm] xgamma notify

2009-03-05 Thread Neale Pickett

On 3/5/2009, Engin Tola engin.t...@epfl.ch wrote:

the problem with xmessage is that it steals the focus. do you know a way
to prevent it from doing that ?

I haven't looked into it.  When my battery is at 5%, I want to be sure
I'm aware of it.




Re: [dwm] xgamma notify

2009-03-05 Thread Christoph Lohmann

Good morning.

pancake schrieb:
I have been playing a bit with xgamma and I think it can be useful as a 
graphical

notification for important alerts like low battery or so.

The usage is quite simple. and we can 'flash' the screen in red for a 
fraction of a second with:


Don't do that, otherwise you need to add a warning to dwm, that it
can cause epileptic seizures.

Sincerely,

Christoph