You are not logged in.
I'm writing a bash script application. Part of the functionality is to show a transparent window that can be resized. However, most modern themes have window borders that are so thin that they are hard to notice when the interior is transparent, and almost impossible to grab with the mouse. I don't want to change the user's entire theme just to display a window that is easy to resize while they are using my bash script.
Is it possible, from a bash script, to tell xfwm4 to use a different theme than the default, just for one window?
I would like it to work with all the latest versions of xfwm4 on any reasonably complete installation of any recent version of Xfce. I'm personally using version 4.11.2 for Xfce 4.10 on Arch Linux.
Offline
To tide your users over until you get the answer, hitting Alt-space to bring up the window's menu, then hitting r (for resize) works, and they can then use their arrow keys to do the actual resizing - no grabbing of borders (thin or otherwise) with a mouse are required.
Regards,
MDM
Offline
Thanks, MDM. I also just checked my Window Manager > Keyboard Settings and see that Alt-F8 will let me resize a window using the mouse without clicking. But, almost nobody reads or remembers stuff like this (I sure don't). I'm guessing Alt-F8 isn't even standard across different versions of Xfce. I will include instructions about Alt-space r and Alt-F8 and how to lookup the xfwm4 keybindings, but suspect almost anybody using the script will just struggle with grabbing the thin, almost invisible border on the transparent window.
Offline
I just thought of another related question. Is there a way to get the keybinding for window-resize while in a bash script? I'll google for that and report back here if I find anything useful. I'm thinking of putting that key-binding in the title of the transparent window. So, on my desktop, the window would be titled "Alt-F8 to Resize".
Offline
I didn't find an answer from google about keybinding, and so have posted the question at unix.stackexchange.com: http://unix.stackexchange.com/questions … ize-window
Last edited by colinkeenan (2014-09-17 18:06:52)
Offline
Is there a way to get the keybinding for window-resize while in a bash script?
Install xdotool and:
xdotool key Alt+F8
Edit: Or look at https://forum.xfce.org/viewtopic.php?id=9083 for information on how to bind it to Alt + Right button mouse click.
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
Thanks ToZ. I am already using xdotool in my script, so that is something I could do, but what if the user has remapped Alt+F8 to something else? I wasn't actually asking how I could *trigger* window-resize from the script, but how to find out *which key strokes* the user could press to trigger a window-resize. I want a way to read the current keybinding for "Window resize" from xfwm4 (or really from any window manager) while in the bash script.
Thanks also for the link to that thread. It is useful. I agree with the original poster who would like to see a button added in the title bar for resizing. It'll never happen though.
Last edited by colinkeenan (2014-09-17 18:22:02)
Offline
I wasn't actually asking how I could *trigger* window-resize from the script, but how to find out *which key strokes* the user could press to trigger a window-resize.
You can use xfconf-query to show both the default and custom mappings:
xfconf-query -c xfce4-keyboard-shortcuts -lv | grep resize_window_key
...my results:
/xfwm4/custom/<Alt>F8 resize_window_key
/xfwm4/default/<Alt>F8 resize_window_key
...then if you need, you can grep for custom to see if a custom one has been set.
Thanks also for the link to that thread. It is useful. I agree with the original poster who would like to see a button added in the title bar for resizing. It'll never happen though.
You never know. The first step would be to create a feature request in the Bug Tracker.
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
OK - I've created 2 feature requests: https://bugzilla.xfce.org/show_bug.cgi?id=11170, and https://bugzilla.xfce.org/show_bug.cgi?id=11171, and I will give your instructions for finding the keybinding a try. Thanks.
Last edited by colinkeenan (2014-09-17 21:30:00)
Offline
Since the window that I want to put the Resize information in is written in python, I ended up using python regex matching to extract the keybinding information from that command you gave me. Here's the relevant bash commands:
all_keys=`xfconf-query -c xfce4-keyboard-shortcuts -lv`
python2 /usr/share/silentcast/transparent_window.py \""$all_keys"\" & transparentPID=$!
And here's the relevant python commands:
import os,sys,re
...
self.set_title(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
The regex that extracts the keybinding is
(?<=custom\/)<.+>\w*(?=.+resize_window_key)
I know that bash can do some string manipulation using regex, but I wasn't able to make it work in bash. I was able to directly extract the information using this regex in python though.
I am curious though, how would it be done in bash?
Last edited by colinkeenan (2014-09-18 06:27:49)
Offline
Here's a convoluted way of getting it:
xfconf-query -c xfce4-keyboard-shortcuts -lv | grep resize_window_key | grep custom | cut -d' ' -f1 | sed -e 's/.*\///g'
I'm certain there is another/better way.
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
Thanks - I expected 3 or 4 external processes. I think you're right that there's a better way, but not by much. The problem is that bash doesn't seem to handle the (?<= and (?=. regex that lets you find what's between some patterns. Still, it seems like people get a lot out of sed alone, so I was also expecting some sort of complicated call to just sed.
Offline
[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 587.77 KiB (Peak: 604.61 KiB) ]