Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-09-17 15:30:40

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

xfwm4 : apply a different theme (themrc) than default to one window?

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

#2 2014-09-17 17:29:33

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#3 2014-09-17 17:48:36

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#4 2014-09-17 17:52:36

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#5 2014-09-17 18:05:57

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#6 2014-09-17 18:07:54

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

Re: xfwm4 : apply a different theme (themrc) than default to one window?

colinkeenan wrote:

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

#7 2014-09-17 18:18:33

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#8 2014-09-17 19:51:33

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

Re: xfwm4 : apply a different theme (themrc) than default to one window?

colinkeenan wrote:

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

#9 2014-09-17 21:29:03

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#10 2014-09-18 06:23:32

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#11 2014-09-18 12:52:25

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

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

#12 2014-09-18 13:25:03

colinkeenan
Member
Registered: 2014-09-17
Posts: 11

Re: xfwm4 : apply a different theme (themrc) than default to one window?

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

Board footer

Powered by FluxBB