You are not logged in.

#1 2013-01-12 13:00:26

kekules_dream
Member
Registered: 2009-05-19
Posts: 96

urxvt pointer shape

Is it possible to change the shape of the pointer in urxvt to a block, like in the console?  googling this just gives me tons of information about the cursor.  I'm interested in changing the pointer from the I-beam to a block.  Thanks.

Offline

#2 2013-01-12 13:14:14

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: urxvt pointer shape

The block cursor is actually the default shape in urxvt, did you override it in your .Xdefaults with something like the line below?

URxvt.cursorUnderline:1

ᶘ ᵒᴥᵒᶅ

Offline

#3 2013-01-12 13:18:36

kekules_dream
Member
Registered: 2009-05-19
Posts: 96

Re: urxvt pointer shape

No but I am talking about the pointer not the cursor.  My cursor is the default block.  I want to change the pointer to the block shape too, like in the console (with gpm enabled).  The reason is I almost never get that I beam in the exact right place when I am trying to select text.  Too much coffee maybe.

Last edited by kekules_dream (2013-01-12 13:26:47)

Offline

#4 2013-01-12 14:40:43

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 3,522
Website

Re: urxvt pointer shape

It's looks like there's some AUR packages that have what we want (as usual wink). Try any of these that have "left_ptr" in the name. https://aur.archlinux.org/packages/?O=0 … _Search=Go

EDIT:

kekules_dream wrote:

My cursor is the default block.  I want to change the pointer to the block shape too, like in the console (with gpm enabled).

Ohhhhhhh... Never mind. hmm

Last edited by drcouzelis (2013-01-12 16:05:16)

Offline

#5 2013-01-12 15:29:09

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,195
Website

Re: urxvt pointer shape

A block mouse cursor would take a little more doing as there is no predefined block cursor in Xlib.  One would have to create bitmap data with a size based on the font currently used, then create a cursor out of the bitmap data.  But changing to another predefined Xlib cursor such as one of the ones at the link below would be pretty simple:
http://www.tronche.com/gui/x/xlib/appendix/b/

To do so you can compile and use the following:

#include <X11/Xlib.h>

int main(int argc,const char **argv) {
	if (argc != 2) return -1;
	Display *dpy=XOpenDisplay(0x0);
	Window win, root, child = RootWindow(dpy,DefaultScreen(dpy));
	int i;
	while (child) XQueryPointer(dpy,(win=child),&root,&child,&i,&i,&i,&i,&i);
	XDefineCursor(dpy,win,XCreateFontCursor(dpy,atoi(argv[1])));
	XFlush(dpy);
	return 0;
}

Save this as setcursor.c then compile with `gcc -o setcursor setcursor.c -lX11`.  Then as long as setcursor is in your $PATH you can use

setcursor 64

for example to set the mouse cursor for the window the mouse is currently in to number 64 from that linked page.

Last edited by Trilby (2013-01-12 16:36:16)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#6 2013-01-12 16:23:12

kekules_dream
Member
Registered: 2009-05-19
Posts: 96

Re: urxvt pointer shape

I'm having trouble getting that to compile.  I think it may be a problem in the translation from the webpage.  Does that end with

.c<space>-<pipe>X11

if so, I am getting:

$ gcc -o setcursor setcursor.c -|X11
zsh: command not found: X11
gcc: error: -E or -x required when input is from standard input

I just realized that is a letter ell and not a pipe.  It compiled and I moved into my path but:

$ setcursor 64
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  38 (X_QueryPointer)
  Resource id in failed request:  0x400700
  Serial number of failed request:  7
  Current serial number in output stream:  7

Last edited by kekules_dream (2013-01-12 16:29:13)

Offline

#7 2013-01-12 16:33:57

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,195
Website

Re: urxvt pointer shape

I did make a change to the code in an edit, make sure what you have matches what is up there.  It runs fine here - but I just threw it together, it doesn't have any sort of error checking.  But it also doesn't do anything that should be able to give an error as long as X is running.

Last edited by Trilby (2013-01-12 16:37:25)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#8 2013-01-12 17:27:30

kekules_dream
Member
Registered: 2009-05-19
Posts: 96

Re: urxvt pointer shape

Ok yes that did make a difference.  I was able to change the curser while in urxvt to some of the various X11 cursors using that command.  Sometimes it took twice to make it stick but it worked. 

What I was wondering was could it be made like gpm in the console.  If you move the mouse around in the console with gpm enabled, then you see a single character is selected based on the position of the mouse.  You can the select an portion of the text with absolute control over the beginning and end.  There may be better ways to express that but if you use gpm you know what I mean.  Really its not that big of a deal, I was mainly just wondering if there was something I could put in my ~/.Xdefaults that could accomplish that for urxvt.  Thanks again for all your help.

Offline

#9 2013-01-12 22:41:22

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,195
Website

Re: urxvt pointer shape

Any of  that would take modifications to the urxvt code - you can check out those AUR versions, I'm not familiar with such a thing.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

Board footer

Powered by FluxBB