Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-02-09 23:49:16

ndroftheline
Member
Registered: 2017-02-09
Posts: 1

Script to change keyboard shortcuts

Hey all,

I'm running XFCE on GalliumOS (based on Ubuntu 16.04) for a Dell Chromebook 13 (great machine btw). I'm using Chrome Remote Desktop to remote into a Windows machine for some work. It works well, except that alt-tab is being captured by XFCE. Chrome Remote Desktop does not have a fix for this that I've been able to find on any system. My previous system was a Mac and I don't use mac much so on that one I just got used to using a diffrent key combination for swapping windows on the native OS vs the remote OS. But in this case I have a lot fewer physical buttons to work with so can't use a different key combo for each OS.

I don't often swap between the remoted and the local system so If I could program a key combination to run a script that disabled (and reenabled) the cycle_windows_key and cycle_reverse_windows_key, I could turn the local OS' window cycling on and off easily.

I'm on the newbie side of linux so I'm sorry if there seems like a really obvious way to do this I wasn't able to find fumbling briefly around google and the XFCE forum searches.

THanks

~Micah

Offline

#2 2017-02-10 00:55:09

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Script to change keyboard shortcuts

Hello and welcome.

This was a tough one. It seems that if you just clear the contents of those two shortcuts, xfwm will default to Alt-Tab behaviour. You have to re-assign the actions to a different set of shortcuts and then empty out the original shortcuts. Throw in the mix that you have to create the missing xfconf keys along the way. Anyways, try out this toggle script. You can simply assign it to a keyboard shortcut and everytime you run it, it will toggle the Alt-Tab (cycle_windows) and Alt-Shift-Tab(cycle_reverse_windows)  functionality.

#!/bin/bash

RESULT=$(xfconf-query -c xfce4-keyboard-shortcuts -lv | grep cycle_windows_key | awk '{print $1}' | awk -F '/' '{print $4}' | head -1)

if [ $RESULT == "<Alt>Tab" ]; then

	xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Alt>Tab" -s ""
        xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Alt><Shift>Tab" -s ""
	xfconf-query -c xfce4-keyboard-shortcuts -n -p "/xfwm4/custom/<Alt>Up" -t string -s "cycle_windows_key"
	xfconf-query -c xfce4-keyboard-shortcuts -n -p "/xfwm4/custom/<Alt>Down" -t string -s "cycle_reverse_windows_key"

else

	xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Alt>Up" -s ""
        xfconf-query -c xfce4-keyboard-shortcuts -p "/xfwm4/custom/<Alt>Down" -s ""
	xfconf-query -c xfce4-keyboard-shortcuts -n -p "/xfwm4/custom/<Alt>Tab" -t string -s "cycle_windows_key"
        xfconf-query -c xfce4-keyboard-shortcuts -n -p "/xfwm4/custom/<Alt><Shift>Tab" -t string -s "cycle_reverse_windows_key"

fi

*Note: this script assumes that you don't have <Alt>Up and <Alt>Down mapped to something else. If you do, we'll need to find other holder shortcuts for the swap.


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 ---

Offline

Board footer

Powered by FluxBB