Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[WRKAROUND]X change screen resolution with keyboard shortcut
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Vieri
Guru
Guru


Joined: 18 Dec 2005
Posts: 533

PostPosted: Thu Jun 19, 2014 9:19 am    Post subject: [WRKAROUND]X change screen resolution with keyboard shortcut Reply with quote

Hi,

I installed the latest stable xorg with the minimal use flag. I don't want to run a window manager (it is a light system). I'm starting an X application from xinitrc.
I was wondering if there was a way to change the sreen resolution on the fly with a key combination such as CTRL-ALT-+/-. It doesn't seem to work for me. I can change resolutions via xrandr comnnand line but I'd rather do it with a keyboard shortcut.

Thanks.

Vieri


Last edited by Vieri on Thu Jun 26, 2014 1:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Mon Jun 23, 2014 11:52 pm    Post subject: Reply with quote

The old X11s used to allow Ctrl-Alt-[+/-] to change resolutions on the fly.
I don't know when this got changed so that it doesn't work, it was possible that the introduction of xrandr it stopped being default. That being said, xrandr is still the best way to do this.

To revert back to the olden days I believe this is all you need:

In your xorg.conf, add the DontZoom flag in ServerFlags:

Section ServerFlags
Option "DontZoom" "false"
EndSection

I haven't tested this, xrandr is so much better IMHO...

(I'd at least install twm or fvwm... or even ratpoison... even on a really lightweight system.)
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Vieri
Guru
Guru


Joined: 18 Dec 2005
Posts: 533

PostPosted: Tue Jun 24, 2014 11:31 am    Post subject: Reply with quote

I'm running 'startx' without a manually-tweaked xorg.conf so I just created the following file:

Code:

# cat /etc/X11/xorg.conf.d/01-custom.conf

Section "ServerFlags"
Option "DontZoom" "false"
Option "DontZap" "false"
EndSection


After starting X I am still unable to switch screen resolutions with CTRL-ALT-+/-. I am also unable to kill X with CTRL-ALT-BACKSPACE.

In /var/log/Xorg.0.log I can see that the DontZoom and DontZap options are mentioned.

Then I changed my conf file to:

Code:

# cat /etc/X11/xorg.conf.d/01-custom.conf

Section "ServerFlags"
Option "DontZoom" "false"
Option "DontZap" "false"
EndSection

Section "InputClass"
        Identifier "keyboard-all"
        Driver "evdev"
        Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection


Now I am able to kill X with CTRL-ALT-BACKSPACE but of course I still can't switch screen resolutions with CTRL-ALT-+/-.

There's really not much documentation regarding this issue. Setting DontZoom or DontZap in ServerFlags doesn't seem to be enough or has no effect.
I could use the InputClass section but I'm unable to find the right XkbOptions parameters for CTRL-ALT-+/-.

xrandr is fine but being able to switch resolutions with just 2 keyboard combinations is unbeatable (no command line, no UI, just strike the keyboard).

(I don't need a window manager because I'm using fullscreen apps only)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Tue Jun 24, 2014 1:59 pm    Post subject: Reply with quote

You could use something like xbindkeys to fake it. Use xbindkeys to run xrandr

One thing I do recall with old X11 is that the server virtual desktop can be larger than the physical screen desktop. I don't know if you can emulate that with xrandr or if that mode has been obsoleted by xrandr.

Not sure...

Edit: Found something interesting, the old behavior apparently can indeed be replicated:

$ xrandr --output VGA1 --rate 60 --mode 800x600 --fb 1280x1024 --panning 1280x1024

Though after all these years I don't think I'd ever use this mode of operation if I can avoid it :o
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Vieri
Guru
Guru


Joined: 18 Dec 2005
Posts: 533

PostPosted: Wed Jun 25, 2014 7:12 am    Post subject: Reply with quote

I must be weird because I don't understand why changing screen resolutions on the fly with a simple keypress is not considered a "cool feature" worth preserving.

Whether I use xbindkeys or xrandr --fb/--panning I still have to write some kind of wrapper script to get a list of all available resolutions. The "cool" thing would be to have Xorg (or xrandr) handle all this on its own. Xorg knows the available screen resolutions so it would be logical to think that it can simply switch from one to another, maybe with a binding with xmodmap (/usr/share/X11/XKeysymDB).

Someone already posted a script-based solution with xbindkeys here: https://forums.gentoo.org/viewtopic-p-7225682.html?sid=b1723e87382bc5df5d50c5ee7dc199e7#7225682
I guess I'll try that out.

One thing's for sure though: "DontZoom" and "DontZap" are broken in Xorg.

Thanks for your help.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Wed Jun 25, 2014 7:34 am    Post subject: Reply with quote

Vieri wrote:
I must be weird because I don't understand why changing screen resolutions on the fly with a simple keypress is not considered a "cool feature" worth preserving.

Whether I use xbindkeys or xrandr --fb/--panning I still have to write some kind of wrapper script to get a list of all available resolutions. The "cool" thing would be to have Xorg (or xrandr) handle all this on its own. Xorg knows the available screen resolutions so it would be logical to think that it can simply switch from one to another, maybe with a binding with xmodmap (/usr/share/X11/XKeysymDB).

I have to agree with you on all of that, though I've no idea how you'd implement it. I used to like that feature, though I also liked being able to turn it off, depending on the machine.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7051
Location: almost Mile High in the USA

PostPosted: Fri Jun 27, 2014 6:50 pm    Post subject: Reply with quote

Vieri wrote:
I must be weird because I don't understand why changing screen resolutions on the fly with a simple keypress is not considered a "cool feature" worth preserving.

I think it's been somewhat deprecated because this can now be easily and securely done in userland instead of having to do it in the server. Before when there was no xrandr, that would be the only way to change modes - the X server had to intercept a keystroke or something. Heck, before ctrl-alt-+/- you had to change the config file and restart X...
Quote:
Someone already posted a script-based solution with xbindkeys here: https://forums.gentoo.org/viewtopic-p-7225682.html#7225682
I guess I'll try that out.

There you go, yeah I figured a script was needed as xrandr doesn't have a "next mode" mode, it looks like that script should work, and even polls xrandr for current state...

But yeah, DontZoom appears borked. I wish that ctrl-alt-backspace DontZap was retained too... (fortunately I haven't had too many recoverable window manager crashes...)
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum