You are not logged in.

#76 2013-03-26 12:32:55

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,216
Website

Re: [Openbox] Hacks and Configs Thread!

This will depend entirely on the bar - openbox doesn't have a panel of it's own, and all the ones you listed are not managed by OB.

IRRC tint2 does have options like this in its config, but it's been a long while since I used it.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#77 2013-05-12 15:57:54

dr.rock
Member
Registered: 2013-05-12
Posts: 4

Re: [Openbox] Hacks and Configs Thread!

I have a problem launching any script from Openbox menu or using key binding.

To understand where i am wrong, i created two simple scripts (python and shell) that just write some line into a file. I made scripts executable, i created files and allowed write access by anyone. But when i try to launch any of those scripts via Openbox, nothing happens. (scripts work fine when i launch them via terminal)

shell script:

#!/bin/bash
echo "AAA" >> log.txt

python script:

#! /usr/bin/python
def log(str):
    f = open("log.txt","a")
    f.write(str+"\n")
    f.close()
log("3")

I try to run using key binding:

   <keybind key="A-w">
        <action name="Execute">
        <execute>/home/igor/scripts/1.sh</execute>
      </action>
    </keybind>

or create menu item:

<item label="test">
  <action name="Execute">
     <prompt>Test</prompt>
     <execute>/home/igor/scripts/1.py</execute>
   </action>
</item>

However i noticed that if i change script name that needs to be run to some non-existing name in xml files, i get error message.

Please advise where am i wrong?

Offline

#78 2013-05-12 16:01:04

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,216
Website

Re: [Openbox] Hacks and Configs Thread!

Have you tried with a full path to log.txt in the script files?  As written, they will currently create/append to that file in the current working directory that openbox was launched from.  This would often be your home directory, but not always.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#79 2013-05-12 16:08:37

dr.rock
Member
Registered: 2013-05-12
Posts: 4

Re: [Openbox] Hacks and Configs Thread!

No i did not sad I completely missed this point. This way it works! Many thanks for prompt reply and your help!

Offline

#80 2014-01-24 05:44:30

GSF1200S
Member
Registered: 2008-12-24
Posts: 434

Re: [Openbox] Hacks and Configs Thread!

Id like to say thanks to the prior posters in this thread. Ive used Openbox for years now and never realized it could do some of the crap listed in here. Ive already grown to use the GrowTo functions extensively.

I have always liked the idea of tiling, but as I use gtk apps quite a bit, it just has never worked for me. It IS good when I can use CLI based apps on a workspace. There is an option in obconf to retain window borders when the window is undecorated, and I use this in conjunction with pytyle to imitate the actions of a tiling window manager. I also have the theme set where the active window has a different color border than the active window. This makes it easy to find which window is active when pytyle is tiling (I have pytyle set to kill window decorations), and even when Openbox is just normally used. Heres a screenie to demonstrate:

11kwd2u.jpg

For those of you who want to give tiling a try without making the full jump, heres one approach. Wingo is also a good approach, but I just cant get past not having menus.

Keep the hacks and configs coming!

Last edited by GSF1200S (2014-01-24 05:46:24)

Offline

#81 2014-03-09 16:35:56

Ventil1
Member
Registered: 2010-03-17
Posts: 123

Re: [Openbox] Hacks and Configs Thread!

Is it possible to bind mouse key to open new tab in chromium? I wanted to do that in rc.xml but with no luck.

Offline

#82 2014-03-09 22:03:38

GSF1200S
Member
Registered: 2008-12-24
Posts: 434

Re: [Openbox] Hacks and Configs Thread!

Ventil1 wrote:

Is it possible to bind mouse key to open new tab in chromium? I wanted to do that in rc.xml but with no luck.

Gonna need more information.

When do you want the mousebind to open a new tab? If its when chromium is open and the active window, its a piece of cake. If you want to open a new tab in chromium when chromium isnt open, thats a simple bash script. If you want it to open a new tab when its open and switch to the workspace its open on and activate chromium, thats a little bit more complicated. Theres a thousand different things you might possibly mean by that, so Ill wait for you to clarify tongue

Remember that Openbox is standards compliant, so xdotool and wmctrl can do wonders with it. Combine those with conditional statements in the rc.xml and you can do alot. Combine all the above with bash scripts called from the conditionals and you can "tweak" stuff approaching the level of many tilers.

I wrote a bash addon to Opensnap which allows windows to be resized when unsnapped that works almost perfect (have to double click instead of drag when snapped to the side), and did it with those 3 tools. I am a novice with bash at best.

Offline

#83 2014-03-10 07:02:39

Ventil1
Member
Registered: 2010-03-17
Posts: 123

Re: [Openbox] Hacks and Configs Thread!

GSF1200S wrote:

When do you want the mousebind to open a new tab? If its when chromium is open and the active window, its a piece of cake.

This. I want to make "button 13" on my mouse to open new tab when chromium is opened and active window. Basically I want to achieve the same thing as CTRL+T does.

Offline

#84 2014-03-10 21:32:53

GSF1200S
Member
Registered: 2008-12-24
Posts: 434

Re: [Openbox] Hacks and Configs Thread!

Ventil1 wrote:
GSF1200S wrote:

When do you want the mousebind to open a new tab? If its when chromium is open and the active window, its a piece of cake.

This. I want to make "button 13" on my mouse to open new tab when chromium is opened and active window. Basically I want to achieve the same thing as CTRL+T does.

The only catch is I dont know what button 13 is identified as. To find out, install xorg-xev with pacman:

pacman -S xorg-xev

Then, run xev from the terminal. A little window should pop up with a black box near the middle of some whitespace. Navigate your mouse into that black box, then look at the terminal as you press button 13 on your mouse. Using the "back button" on my mouse I get this:

ButtonRelease event, serial 48, synthetic NO, window 0x3000001,
    root 0x9b, subw 0x3000002, time 8588037, (16,38), root:(242,125),
    state 0x0, button 8, same_screen YES

LeaveNotify event, serial 48, synthetic NO, window 0x3000001,
    root 0x9b, subw 0x0, time 8588035, (16,38), root:(242,125),
    mode NotifyUngrab, detail NotifyInferior, same_screen YES,
    focus YES, state 0

Notice the part that says "button 8". This is the button name Openbox will need in its rc.xml. Go down to the mousebinds section of the rc.xml and add this:

<context name="Frame">
      <mousebind action="Click" button="button 8">
        <action name="Execute">
           <command>sh /home/gsf1200s/Scripts/chromium.sh</command>
        </action>
      </mousebind>
    </context>

Change the button="button 8" to whatever button xev spits out to you. Change the path to the script im going to give you below.

Finally, the following script requires xdotool and wmctrl. Get those by installing with pacman:

pacman -S xdotool wmctrl

Heres the script; be sure to read the comments in case youd like to change it a bit. Its really very very simple:

#!/bin/bash
activewindowid=$(xprop -root _NET_ACTIVE_WINDOW | cut -c43-49)
#If you dont need the button to do anything else besides open a new tab for chromium, or you
#dont want to install wmctrl, you can remove the if-else-fi section and just use this next command.
#Keep in mind that mouse button is otherwise useless, where with the if-else-fi section you can set
#the else statement to make the button do something when Chromium isnt active... Also note this 
#one liner will cause Ctrl+t to be "pressed" any time the button is pressed regardless of active 
#window, while the if-else-fi approach will only invoke ctrl+t when Chromium is active.
#xdotool key --window=@1 ctrl+t
if wmctrl -l | grep $activewindowid | grep Chromium; then
	xdotool key ctrl+t
else
	echo "test"
	#Enter some stuff youd want the button to do if Chromium isnt the active window, or dont..
fi
# The "algorithm here is kind of weak, but I think it works for your purposes. Technically, if you
#had another document open with Chromium in the name and that was the active window, pressing the
#button would cause control + t to be executed as well. I cant see this being likely however...
#Also, if you decide to remove/comment-out the if-else-fi section, you can remove the activewindowid
#variable at the top as well

Make sure the script is executable with whatever permissions you want..

Im sure you could prolly do this using only the rc.xml, but I default to just having Openbox execute a script. Openbox can be real picky about commands being executed (in the rc.xml), and bash with all its available tools is much more powerful. There are times where you might need some conditionals in the rc.xml though..

**EDIT** I realized something afterwards I figured I should mention. The context "Frame" means Openbox will do the mousebind anytime the mouse is over a window. Technically, if Chromium was windowed, active, but the mouse was over the desktop instead of a window, your keybind would do nothing.

<context name="Desktop">
      <mousebind action="Click" button="button 8">
        <action name="Execute">
           <command>sh /home/gsf1200s/Scripts/chromium.sh</command>
        </action>
      </mousebind>
    </context>

Adding this in addition to the keybind above would fix that problem. This is getting really picky, especially since most of us use web browsers full screen instead of windowed (I think...).

Last edited by GSF1200S (2014-03-10 22:11:44)

Offline

#85 2014-03-11 07:50:20

Ventil1
Member
Registered: 2010-03-17
Posts: 123

Re: [Openbox] Hacks and Configs Thread!

Thank you very much GSF1200S for the well documented answer. With that last Frame/Desktop setting I also solved my other problem.

Offline

#86 2014-03-12 19:54:10

GSF1200S
Member
Registered: 2008-12-24
Posts: 434

Re: [Openbox] Hacks and Configs Thread!

Ventil1 wrote:

Thank you very much GSF1200S for the well documented answer. With that last Frame/Desktop setting I also solved my other problem.

No problem smile

Offline

#87 2014-11-26 23:54:27

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Openbox] Hacks and Configs Thread!

I am using the following keybind to cycle through all open windows:

<keybind key="W-Tab">
      <action name="ShowMenu">
        <menu>client-list-combined-menu</menu>
      </action>
    </keybind>

However, I would prefer to have a solution similar to the Vimium extension on Chromium which provides me with a simple search input field. In this field I can enter the name of the tab to switch to it.

See this screenshot.

Does something similar exist do cycle through open windows?

Offline

#88 2014-11-27 03:02:10

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,216
Website

Re: [Openbox] Hacks and Configs Thread!

Openbox cannot do that itself, but you could just have the keybind call an external ewmh window switcher, perhaps this one.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#89 2014-11-27 07:45:40

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Openbox] Hacks and Configs Thread!

@Trilby

Many thanks! ewmh window switcher was the keyword that I was looking for.

I installed and ran impleswitcher but it does not show anything, nor any error when launched from the command-line.

Does the package miss any other dependency?

Aside, I found wmgo which is almost perfect except that it does not only search for open windows but binaries in $PATH.

Offline

#90 2016-01-24 03:55:12

Kes
Member
Registered: 2016-01-24
Posts: 1

Re: [Openbox] Hacks and Configs Thread!

Hi smile

*** How to Map AltGr + any key to shortcut in Openbox/Lubuntu file lubuntu-rc.xml ***

I have a highly customised lubuntu-rc.xml file; all key combinations that I can use for command shortcuts are mapped, so I need to utilise more keys so I can have more shortcuts.

I would like have AltGr keyboard shortcuts as are suggested by the following (xev utility reveals that AltGr is key 108 which is also called ISO_Level3_Shift).

<keybind key="ISO_Level3_Shift-q">
   <action name="Execute"><command>script1.sh</command></action>
</keybind>

<keybind key="ISO_Level3_Shift-j">
   <action name="Execute"><command>script2.sh</command></action>
</keybind>

In other words use AltGr in the same way the Windows key is used.

However even after inserting the above into lubuntu-rc.xml and running  sudo openbox --reconfigure I find that AltGr + q produces an @ symbol.

How do I take control of AltGr mapping for this purpose?

    ps In the same way I would also like to take advantage of the blue coloured Fn key (xev utility reveals this has keycode 151 and name XF86WakeUp) however I am also unable to take control of this key using key maps such as XF86WakeUp-q or XF86WakeUp-j

Thank you

Last edited by Kes (2016-01-24 10:49:18)

Offline

Board footer

Powered by FluxBB