Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-08-25 23:17:00

Renfro
Member
Registered: 2022-08-25
Posts: 2

Assigning single hotkey toggle (on/off) to Desktop Zoom

I'm a linux novice currently trying out a distro that uses XFCE.

I am visually impaired and so I frequently need to zoom the desktop to be able to see smaller items and text. I do this so many times a day that I need a quick and easy single keypress to toggle this feature on an off.

The default method of holding down the Alt key with one hand while scrolling the mouse wheel up or down with the other, is too awkward for non-stop use (and it's unpredictable because it's easy to keep overshooting or undershooting the desired initial zoom level).

How can I assign a single keyboard key (of my choosing) to activate XFCE Desktop Zoom to a certain zoom level, and then use that same key to subsequently disable zoom and return back to a normal size Desktop.

I've been using a one-key toggle method for the 'Magnifier' on Windows for many years, so not only is it quick and easy, but it's also now an ingrained habit. I'd therefore like a similar method to toggle desktop zoom on XFCE.

Thanks!

Offline

#2 2022-08-26 00:37:30

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,005

Re: Assigning single hotkey toggle (on/off) to Desktop Zoom

Hello and welcome.

xfwm4 doesn't expose that setting in a way that you can programmatically manipulate it, but you might be able to use xrandr to achieve what you are looking for. Here is a script that can be used to toggle the scale or zoom of the display:

#!/bin/bash

# the scale (zoom) value (1.0 is regular, 0.x is zoomed in, 1.x is zoomed out) EDIT AS NEEDED
SCALE=0.5

# get the first active output
OUTPUT=$(xrandr | grep connected | head -1 | awk '{print $1}')

# get the current scale (transform) setting
CURRENT_SCALE=$(xrandr --verbose | grep Transform | head -1 | awk '{print $2}')

if [ $CURRENT_SCALE == "1.000000" ]; then
    xrandr --output $OUTPUT --scale $SCALE
else
    xrandr --output $OUTPUT --scale 1
fi

Save the script to your system and make it executable. It's currently programmed to double zoom the display. This is the "OUTPUT" parameter. Feel free to adjust that value. Values less than 1 zoom in and values greater than 1 zoom out.

Assign the script to a keyboard shortcut and give it a try. Pressing the shortcut once will zoom, a second time will restore the view.

Note: this does not pan the screen like the xfwm4 zoom does. xrandr does support panning, but it doesn't seem to work reliably for me when paired with the zoom function.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Online

#3 2022-08-31 18:51:58

Renfro
Member
Registered: 2022-08-25
Posts: 2

Re: Assigning single hotkey toggle (on/off) to Desktop Zoom

Thank you very much for taking the time to reply, ToZ.

Your suggestion seemed like a usable work-around, until I saw your note at the end about it not being able to pan.

Panning is an essential part of what I need, and it's that specific feature that made me start looking into the viability of switching away from Windows to Linux. All of the previous zoom utilities that I saw on Linux DE's were like a "loupe" / magnifying glass type of solution, where a fixed tiny area of the screen was magnified and you could not type or interact with anything within the magnified area (which is totally unworkable for my particular use case).

But XFCE's desktop zoom is full-screen, pannable, and it allows normal typing and interaction with icons, menus and other items while in zoomed mode, so it seemed ideal for me.

It's just unfortunate that nobody thought to implement an on/off key for this accessibility feature (or even allow for users to manually create one themselves).

Offline

#4 2022-08-31 20:10:14

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,005

Re: Assigning single hotkey toggle (on/off) to Desktop Zoom

Here is another approach, using xdotool that might work for you. Supports the native xfwm4 panning as it just automates the Alt+scroll functionality.

Zoom in command:

bash -c "xdotool keydown Alt; sleep .5s; xdotool click --repeat 5 4; sleep .5s; xdotool keyup Alt"

Zoom out command:

bash -c "xdotool keydown Alt; sleep .5s; xdotool click --repeat 5 5; sleep .5s; xdotool keyup Alt"

Assign these to shortcut keys. You can adjust the zoom steps by changing the "repeat" value in the above commands.

Last edited by ToZ (2022-08-31 20:27:14)


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Online

Board footer

Powered by FluxBB