You are not logged in.

#1 2013-02-27 08:46:14

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Show your keybinds in a pipe menu....

In an effort to give more a more cleaner look was thinking about creating a keyboard shortcut pipe menu. This would mean we would no longer need two conky configs and a script to switch between them.

Something like:

#!/bin/bash
binds_file="/home/mrgreen/bin/binds.txt"

echo "<openbox_pipe_menu>"
while IFS= read -r line
do
  echo "<item label=\"${line}\"\>"
done <"$binds_file"
echo "</openbox_pipe_menu>"

binds.txt

Alt+F3 Dmenu
Super+space Main Menu
Super+t Terminal
Super+f File Manager
Super+e Editor
Super+w Web Browser
Super+q Force Quit
Super+g Character Map
Super+r Read the DOC
Tiling Shortcuts
Super+a Toggle Maximize
Super+h Toggle Horizontal
Super+v Toggle Vertical
Super+c Move to Center
Super+Arrow Move
Alt+Super+Arrow Resize

Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#2 2013-02-28 04:59:45

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

¿would be too much work extracting keybinds from rc.xml?
So if you add some new keybinds, also will be reflected into pipemenu

will try to make some script...
do you prefer perl, python or simply bash+gnu tools?


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#3 2013-03-01 01:32:35

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

I prefer bash. Think it would be quite difficult to do easily ... installed most would load obkey (maybe I should add it back into iso?)


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#4 2013-03-01 06:12:42

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

I was trying some bash reading line by line... but I found a big wall:
what about non-standard tabulated rc.xml files?

Mine is properly tabulated, but could be the case some people just throws tags
without looking at proper tabs or new lines, like this:
<keyboard><keybind key="C-A-Left"><action name="DesktopLeft"><wrap>no</wrap></action></keybind>

I think best approach will be parsing xml tags.
I think it could be done. Will try


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#5 2013-03-01 06:17:12

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

It might be more trouble than its worth, going to add obmenu and obkey back in for next release. We have always had a basic set of shortcuts in conky onscreen but I think its getting a little old now. Would more like a bar type conky top of screen (remove some of the stuff we now have in Archbey2).

Stripped tabs from menu.xml to make it easier for me to edit (slaps wrist!) ...


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#6 2013-03-02 03:08:28

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Added basic key list to openbox menu and disabled conky (for now)


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#7 2013-03-06 17:29:17

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

Hey MrGreen... try this pipemenu and give me some feedback
It will create some temporary files into /tmp.
It's not that elegant, but does the job.

Uses awk and sed

#!/bin/bash
# Pipemenu for keyboards shortcuts
# Description: Read keyboard shortcuts from rc.xml and makes a pipemenu for openbox
# Script version 0.4
# Author: Diego "dragonauta" Rucci (dragonauta.x [at] gmail.com)

RCFILE=$HOME/.config/openbox/rc.xml
awk '/<keyboard/{close("/tmp/file"f);f++}{print $0 > "/tmp/file"f}' $RCFILE | awk '/<\/keyboard/{close("/tmp/test"f);f++}{print $0 > "/tmp/test"f}' /tmp/file1 
sed -e 's/^[ \t]*//' /tmp/test > /tmp/rc.kbd

echo "<openbox_pipe_menu>"
while read line           
do           
  if [[ $line == \<keybind* ]]; then
    KEYBIND=`echo $line | awk '{print $2}' | cut -f2 -d'"'`
  else
    if [[ $line == \<action* ]]; then
      ACTION=`echo $line | awk '{print $2}' | cut -f2 -d'"'`
      if [[ $ACTION != Exec* ]]; then
        echo "<item label=\"$KEYBIND => $ACTION\"></item>"
      fi
    else
      if [[ $line == \<comm* ]]; then
        EXECOMMAND=`echo $line | awk -F'>' '{print $2}' | awk -F'<' '{print $1}'`
        echo "<item label=\"$KEYBIND => $EXECOMMAND\"></item>"
      fi
    fi
  fi
done </tmp/rc.kbd
echo "</openbox_pipe_menu>" 

I told you it can be done... not much work but was hard to figure it out.

Last edited by dragonauta (2013-03-06 17:30:52)


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#8 2013-03-06 23:55:20

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Wow got so many keybinds that I had forgotten... made a couple of changes nothing major will let you know what they are shortly. Going to add to menu.xml pipe script for testing.

Thanks for sharing smile


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#9 2013-03-07 01:57:18

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Could not help myself take it too the next level.

 ./pipey2 alt.xml 
<openbox_pipe_menu>
<item label="A-v virtualbox"></item>
<item label="A-F4 Close"></item>
<item label="A-F2 gmrun"></item>
<item label="A-Escape Lower"></item>
<item label="A-Escape FocusToBottom"></item>
<item label="A-Escape Unfocus"></item>
<item label="A-space ShowMenu"></item>
<item label="A-Tab NextWindow"></item>
<item label="A-S-Tab PreviousWindow"></item>
<item label="A-W-Up GrowToEdgeNorth"></item>
<item label="A-W-Right GrowToEdgeEast"></item>
<item label="A-W-Down GrowToEdgeSouth"></item>
<item label="A-W-Left GrowToEdgeWest"></item>
</openbox_pipe_menu>

On my desktop you get a massive list figure future version filter by W,A,S,X,C (X being media keys)


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#10 2013-03-07 03:58:18

pablokal
Administrator
From: Nijmegen, Holland
Registered: 2010-10-12
Posts: 3,623
Website

Re: Show your keybinds in a pipe menu....

Alt+F3 is dmenu should be added,


Getting your questions answered here at ArchBang Forums
Please! Always give hardware info, if there is a chance that 's relevant: #lspci -vnn
On Arch(bang) and Openbox: http://stillstup.blogspot.com/

Offline

#11 2013-03-07 04:00:58

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

It is already part of ArchBang iso..


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#12 2013-03-07 07:46:01

pablokal
Administrator
From: Nijmegen, Holland
Registered: 2010-10-12
Posts: 3,623
Website

Re: Show your keybinds in a pipe menu....

Ooops, sorry.


Getting your questions answered here at ArchBang Forums
Please! Always give hardware info, if there is a chance that 's relevant: #lspci -vnn
On Arch(bang) and Openbox: http://stillstup.blogspot.com/

Offline

#13 2013-03-07 08:40:16

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

I was thinking...
maybe could be better a keybind for showing quick help instead of pipemenu...
like A-h or W-h that run notify-send:

$ notify-send -i dialog-question "Keybinds" "Alt+F3\tDmenu\nSuper+space\tMain Menu\nSuper+t\tTerminal\nSuper+f\tFile Manager\nSuper+e\tEditor\n..."

Also could be integrated to an option menu


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#14 2013-03-07 09:25:58

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Could you not bind key menu to key and pipe that instead of having full root-menu...?


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#15 2013-03-07 10:06:30

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

Sorry... I'm not following you... not sure what you said as my english is not that good.

I'll try clarify myself:
make a keybind (for instance A-h) that launch a script
script is: notify-send -i dialog-question "Keybinds" "Alt+F3\tDmenu\n... etc...
pressing Alt+h will show a notification with keybinds availables.

Also, as we put notify-send into a script, can be added into menu:
<item label="Keybind Help">
<action name="Execute">
<execute>/path/to/script</execute>
</action>
</item>
and when selecting that option will launch notify-send (same if you pressed shortcut)

I was thinking at newcomers.
They launch LiveCD, start live session, press A-h (or launch help option in menu) and see a little help for some keybinds A+F3, A+F2, W+w, W+r ....


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#16 2013-03-07 10:11:26

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Yes I understand you want an on screen display approach via notify send and it is a good idea. Just need to figure which keybinds to put in script and maybe try to break it into lines! easier for me to read wink


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#17 2013-03-07 10:21:48

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

oh right... now I get it!

You can use your previous binds.txt file and use this

#!/bin/bash
TMP=""
while read line
do
  TMP="$TMP\n$line"
done < binds.txt
notify-send "Keybinds" "$TMP"

so adding/removing keybinds should be as easy as editing binds.txt

Last edited by dragonauta (2013-03-07 10:22:27)


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#18 2013-03-07 10:23:51

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Ok... I will test that, think A-h as W-h is already in use....


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#19 2013-03-08 05:47:50

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Wondered if this is better? I could not get your small script to work correctly and this version does not need another file to draw from. Hopefully Oliver will check my code at some point. Could add icon make it more pretty....

#!/bin/bash
read -d '' BINDS <<EOF
Super+t Terminal
Super+f File Manager
Super+e Editor
Super+w Web Browser
Super+q Force Quit
Super+g Character Map
Super+r Read the DOC
Super+a Toggle Maximize
Super+h Toggle Horizontal
Super+v Toggle Vertical
Super+c Move to Center
Super+space Main Menu
Super+Arrow Move
Alt+F3 Dmenu
Alt+Super+Arrow Resize"
EOF
notify-send "Keybinds" "${BINDS}"

Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#20 2013-03-08 07:20:37

dragonauta
Member
Registered: 2012-05-15
Posts: 313
Website

Re: Show your keybinds in a pipe menu....

Yeah! Better indeed.
you can add icon to notify-send using -i option

-i dialog-{question|error|warning|information}
-i /path/to/any/icon


me
"Politicians and diapers need to be changed often ... and for the same reasons."

Offline

#21 2013-03-08 07:30:18

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: Show your keybinds in a pipe menu....

Mr Green wrote:

Hopefully Oliver will check my code at some point.

I'm hardly Dennis Ritchie... I just like to get annoyed at useless uses of cat.

There is an extra " in there though (at the end of the final binding) :-)

Any reason why you separated the title out?  I.E. it could be:

#!/bin/bash
read -d '' BINDS <<EOF
Keybinds
Super+t Terminal
...
Alt+F3 Dmenu
Alt+Super+Arrow Resize
EOF
notify-send "${BINDS}"

Not saying it's wrong, just wondering

Offline

#22 2013-03-08 08:14:59

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

I missed the last " that was my bad, notify-send allows you to add a title as part of the command but I can change it. Might bind it too Super+k (k is for keyboard).

try:

notify-send -i keyboard "${BINDS}"

Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#23 2013-03-10 04:22:19

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Not having much fun getting this to work live, might try adding notification-daemon see if that helps. Know the xfce4-notifyd is on my system but would rather not use it in ArchBang...


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#24 2013-03-11 03:30:00

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Maybe this using dunst?

dunst.jpg


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#25 2013-03-11 07:22:11

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: Show your keybinds in a pipe menu....

looks good to me

Offline

#26 2013-03-11 09:39:54

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,859

Re: Show your keybinds in a pipe menu....

Might have to add a title "Hotkeys" or something else? Have coloured border green now just for extra flair!!!!


Comments, suggestions, donations please feel free to contact me mrgreen(at)archbang(dot)org Artix information https://artix-linux.github.io/migrate/

Offline

#27 2017-07-20 03:33:52

conky
Member
Registered: 2017-07-20
Posts: 4

Re: Show your keybinds in a pipe menu....

Hi there. just downloaded the archbang. openrc thing. I am an arch user but it's just too silly with most of the kids who 'run' arch tbh. Anyway, have used archbang for years but when you got a bit slowed down when systemd cam about, then those lolz peeps 'manjaro' which trying once and was so poor it was useless, tried to combine with you and ran you over, despite you having a clue and they not, was about the time I just did mainly my own customisations and kinda forgot about archbang. With that said, I am doing some lfs and I also rewrote pacman a bit to my own needs.. most of the time when you were having issues with stuff, I felt I could have helped you somewhat easily but ok.. I kinda don't wanna get mixed up with dong stuff or not and so on.

So.. it had some issues, the installer yes, but as an arch user it obviously only took a moment to fix. The X server does indeed seem to still crash in vbox, can see if I can figure it out as I don't know openRC yet [I intend(ed) to try various inits before choosing one].

But, your installer atm seems to failt to install the kernel in /boot, which would explain why he coul;dn't boot possibly .. I had to do some more installation stuff (just rebooted the live and chrooted): namely, pacman-key {--init,--populate archlinux, -r, --lsign) etc.. it then downloaded an update to linux (after uncommenting some archmirror) and voila, I could then mkinitcpio -p linux + grub-mkconfig -o /boot..... you know the story.

I think that was mainly it to get it going, now the X says in vbox, can't run or start form fraembuffer i think,, might just be some vbox drivers missing. I kinda have to say, at the time, when you ket true to the old installe rof arch, and they moved on to the current , few one liners in term; their method is hands down superior. But ok, I understand you wish to have a certain interactive installer for the novices to linux/arch/bang. Anyway, will try to fix the X and let me know if you need some patches for issues.

And I have always loved your work as has so many, I can't actually believe, I forgot about archbang this long yikes

Offline

Board footer

Powered by FluxBB