This question is related to another that I asked How do I execute a program in Xfce and make it use another xfwm4 theme other than the default one?
However, I'm now trying to get an answer that will work for any desktop - or in other words - one answer for each desktop, not just Xfce. Here, I am trying to solve the same problem as the previous question: allowing a user to grab a window border for resizing even if they are using extra thin borders and even if they don't know the hot-key used by their desktop for grabbing the window border.
I want to open a window from a bash script and have the title of the window be Resize with.... On my desktop that would be Resize with Alt+F8. I'm writing an application mostly in bash that requires the user to resize a transparent window. Many people have a theme with very thin window borders which when combined with a transparent interior becomes almost impossible to grab with a mouse. I want the user to be able to resize the window with the mouse without having to struggle with grabbing the border. I've posted this question also on the Xfce forum because I'm personally using Xfce. From there, I got a solution working for me with Xfce, but I want a general solution.
From comments below, I see there is not a general solution, so then I'd like as many solutions as are available, one for each Desktop. I already have Xfce, and would like expert users of other desktops to give answers for those desktops.
Here is a solution for Xfce, all in bash:
$ xfconf-query -c xfce4-keyboard-shortcuts -lv | grep resize_window_key | \
grep custom | cut -d' ' -f1 | sed -e 's/.*\///g'
Since I'm using python code for a transparent window from Python - how to make transparent window with gtk.Window but not with Gtk, I actually just used the xconf-query and then gave the full output of that to the python script to use regex for the match I was looking for. Here is how I actually have done it so far:
Bash code:
all_keys=`xfconf-query -c xfce4-keyboard-shortcuts -lv`
python2 /usr/share/silentcast/transparent_window.py \""$all_keys"\" & \
transparentPID=$!
Python code:
import os,sys,re
...
self.set_title("PID:" + str(os.getpid()) + " Resize with " + self.get_resize_hotkey(str(sys.argv[1])))
....
def get_resize_hotkey(self, all_hotkeys):
try:
resize_hotkey=re.search('(?<=custom\/)<.+>\w*(?=.+resize_window_key)', all_hotkeys).group()
except AttributeError:
resize_hotkey=""
return resize_hotkey
I'm looking for solutions either all in bash or part in bash and part in python that will give me the user's key-binding (if any) for grabbing the border of the active window with the mouse for resizing.
gsettings get org.gnome.desktop.wm.keybindings begin-resize
. The default value is['<Alt>F8']
. Hopefully tomorrow I can test KDE and GNOME, but I am fairly certain they will be the same. – Seth Sep 26 '14 at 04:37gsettings get org.gnome.desktop.wm.keybindings begin-resize
in Xfce, and the good news is that it also works in Xfce. The bad news is that it only reports the default. I changed it to Alt+1, but it still reported Alt+F8. – Colin Keenan Sep 26 '14 at 15:00