You are not logged in.
Thanks damo, worked a treat.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
urxvt doesn't support the --command syntax. Support of -e is defined as a requirement for all terminal emulators providing x-terminal-emulator so that's the safe one to use.
A point: -e "command arguments" doesn't work. Everything after the -e is considered to be a command line (ie a command plus some arguments) and must not be enclosed in quotes, at least by the time it reaches urxvt.
Also, as Damo has pointed out, shell syntax is not supported - only a one-word command followed by some arguments that are accepted by that command. This applies to menu.xml and rc.xml as well as -e lines for urxvt. If you want to include some simple shell syntax in your command, then call the shell as your command, and send it the script (using -c) as its arguments. For example, this works in my menu.xml:
<command>urxvt -e bash -c "sudo service apache2 restart && { echo OK; sleep 2;} || { echo 'ERROR (press a key to close)'; read;}"</command>
shell functions and aliases are limited to the shell, and don't work in executed shell scripts. You might be able to source the alias in the command (NB untested) (Tested, doesn't work)
You can definitely source some file containing functions in a script, to make those functions available. Aliases don't work though - they're meant for interactive use only.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
Thanks John for the detailed explanation.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
Back on this as I have worked out how to use pipemenus and I want to now use the recent places pipemenu.
I have the script placed in /usr/bin and this is the error I get:
Invalid output from pipe-menu "usr/bin/bl-recent-files-pipemenu -rl15"
I'm not sure what I am missing to make this work, any guidance would be appreciated.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
Have you run it in a terminal? The error may be more specific.
BTW, I always test pipemenus in a terminal first
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Here is my error:
lua5.2: /usr/share/lua/5.2/posix/init.lua:29: module 'posix.ctype' not found:
no field package.preload['posix.ctype']
no file '/usr/share/lua/5.2/posix/ctype.lua'
no file '/usr/share/lua/5.2/posix/ctype/init.lua'
no file '/usr/lib/lua/5.2/posix/ctype.lua'
no file '/usr/lib/lua/5.2/posix/ctype/init.lua'
no file './posix/ctype.lua'
no file '/usr/lib/lua/5.2/posix/ctype.so'
no file '/usr/lib/lua/5.2/loadall.so'
no file './posix/ctype.so'
no file '/usr/lib/lua/5.2/posix.so'
no file '/usr/lib/lua/5.2/loadall.so'
no file './posix.so'
stack traceback:
[C]: in function 'require'
/usr/share/lua/5.2/posix/init.lua:29: in main chunk
[C]: in function 'require'
/usr/bin/bl-recent-files-pipemenu:19: in main chunk
[C]: in ?
I'm guessing I need posix?
I really need to remember to run these pipemenus in terminal to check.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
SO I created a new folder in /usr/share/lua/5.2/ and copied the posix folder from 5.3.
When I run the script I get:
lua5.2: version mismatch: app. needs 503, Lua core provides 502
stack traceback:
[C]: in ?
[C]: in function 'require'
/usr/share/lua/5.2/posix/init.lua:29: in main chunk
[C]: in function 'require'
/usr/bin/bl-recent-files-pipemenu:19: in main chunk
[C]: in ?
Not sure where to go from here.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
The pipemenu is requiring lua 5.2 to run. The first line is
#!/usr/bin/env lua5.2
Try changing it to whichever version your system is using.
You can also remove/comment the first line and run the script with whichever is the lua version in your $ENV
lua /path/to/bl-recent-files-pipemenu
[ I suggest moving this thread to Help & Support (Other)? ]
Last edited by damo (2017-01-25 21:03:28)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Thank you damo.
Replacing the 5.1 with 5.3 and adding lua to the command worked.
Can the mods please move this thread to the other help and support thread?
I take that back, Still nothing
lua5.3: /usr/share/lua/5.3/posix/init.lua:32: posix namespace clash: unistd.getopt
stack traceback:
[C]: in function 'assert'
/usr/share/lua/5.3/posix/init.lua:32: in main chunk
[C]: in function 'require'
/usr/bin/bl-recent-files-pipemenu:19: in main chunk
[C]: in ?
Last edited by Döbbie03 (2017-01-25 21:41:42)
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
Either change the shebang line to 5.3 and run the script on its own
or
Remove/comment it and run it as a command arg for lua.
$ lua --help
lua: unrecognized option '--help'
usage: lua [options] [script [args]]
Available options are:
-e stat execute string 'stat'
-i enter interactive mode after executing 'script'
-l name require library 'name'
-v show version information
-E ignore environment variables
-- stop handling options
- stop handling options and execute stdin
Run "lua -v", and make sure the script shebang line matches it.
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Googled "lua posix namespace clash: unistd.getopt" and got:
https://github.com/luaposix/luaposix/bl … er/NEWS.md
See the getopt part of "Incompatible changes" - I suspect that the pipemenu needs editing for lua 5.3, or compile luaposix with compatible libraries.
You might be able to run "lua -l" and specify the 5.2 lib. NB I'm not the best person to talk to about this stuff! 8o
Last edited by damo (2017-01-25 22:05:12)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
Man this is so far ahead of where I am. Thanks so far damo. You have been a great help.
I'm going to come back to this.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
I finally have it. I found the pipemenus that #!++ use. Worked a freaking treat.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline
^ Note that the cbpp recent-files pipemenu is a direct copy of @johnraff's bash script for Crunchbang:
#!/bin/sh
# cb-recent-files-pipemenu - a script to parse .recently-used.xbel
# and generate openbox pipe menu
# Copyright (C) 2010 John Crawley
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# version 2012/07/01-cb
# Usage: add
# <menu id="recent" label="Recent Files" execute="/path/to/cb-recent-files-pipemenu" />
# to your .config/openbox/menu.xml, or use with cb-places-pipemenu (see comments there)
maximum_entries=15 # max. number of entries in menu
#######################################################################
# look for recently-used.xbel
if [ $XDG_DATA_HOME ] && [ -r "${XDG_DATA_HOME}/recently-used.xbel" ]
then
file_path="${XDG_DATA_HOME}/recently-used.xbel"
elif [ -r "${HOME}/.local/share/recently-used.xbel" ]
then
file_path="${HOME}/.local/share/recently-used.xbel"
elif [ -r "${HOME}/.recently-used.xbel" ]
then
file_path="${HOME}/.recently-used.xbel"
else
echo "$0: cannot find a readable recently-used.xbel file" >&2
echo '<openbox_pipe_menu>
<separator label="No recently-used.xbel file found." />
</openbox_pipe_menu>'
exit 1
fi
# if argument is --clear, empty .recently-used.xbel
[ "$1" = '--clear' ] && {
cat <<':EOF' > "${file_path}"
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
</xbel>
:EOF
exit
}
maximum_entries=$((maximum_entries+2))
pre=' <item label="'
mid='">
<action name="Execute"><command>'
post='</command></action>
</item>'
files=$( tac "${file_path}" | awk -v MAX="$maximum_entries" -v PR="$pre" -v MI="$mid" -v PO="$post" 'BEGIN {
RS="</bookmark>";
FS="<info>";
}
(NR == MAX) {exit}
!/<bookmark/ {next}
!/href=[\"'\'']file:\/\// {next}
# $1 is the command, $2 the file path
{
sub(/^.*exec=\"\&apos\;/,"",$1)
sub(/\&apos\;.*$/,"",$1)
sub(/ *%./,"",$1)
sub(/^.*file:\/\//,"",$2)
sub(/[\"'\''].*$/,"",$2)
gsub(/%22/,"\\"",$2)
gsub(/%3C/,"\\<",$2)
gsub(/%3E/,"\\>",$2)
name=$2
sub(/^.*\//,"",name)
gsub(/_/,"__",name)
gsub(/\'/,"\\'\\"\\'\\"\\'",$2)
print (PR name MI $1 " '"'"'" $2 "'"'"'" PO)
}' )
# use perl to decode urlencoded characters
files=$(perl -MURI::Escape -e 'print uri_unescape($ARGV[0]);' "$files")
output='<openbox_pipe_menu>
'"$files"'
<separator />
<item label="Clear Recent Files">
<action name="Execute">
<command>
''"$0"'' --clear
</command>
</action>
</item>
</openbox_pipe_menu>
'
printf '%s' "$output" # printf because echo sometimes eats backslashes
If it does the job for you - great I can't recall why @nobody developed a lua script, but I guess it is better in some way.
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
^ Note that the cbpp recent-files pipemenu is a direct copy of @johnraff's bash script for Crunchbang:
#!/bin/sh # cb-recent-files-pipemenu - a script to parse .recently-used.xbel # and generate openbox pipe menu # Copyright (C) 2010 John Crawley # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # version 2012/07/01-cb # Usage: add # <menu id="recent" label="Recent Files" execute="/path/to/cb-recent-files-pipemenu" /> # to your .config/openbox/menu.xml, or use with cb-places-pipemenu (see comments there) maximum_entries=15 # max. number of entries in menu ####################################################################### # look for recently-used.xbel if [ $XDG_DATA_HOME ] && [ -r "${XDG_DATA_HOME}/recently-used.xbel" ] then file_path="${XDG_DATA_HOME}/recently-used.xbel" elif [ -r "${HOME}/.local/share/recently-used.xbel" ] then file_path="${HOME}/.local/share/recently-used.xbel" elif [ -r "${HOME}/.recently-used.xbel" ] then file_path="${HOME}/.recently-used.xbel" else echo "$0: cannot find a readable recently-used.xbel file" >&2 echo '<openbox_pipe_menu> <separator label="No recently-used.xbel file found." /> </openbox_pipe_menu>' exit 1 fi # if argument is --clear, empty .recently-used.xbel [ "$1" = '--clear' ] && { cat <<':EOF' > "${file_path}" <?xml version="1.0" encoding="UTF-8"?> <xbel version="1.0" xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks" xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info" > </xbel> :EOF exit } maximum_entries=$((maximum_entries+2)) pre=' <item label="' mid='"> <action name="Execute"><command>' post='</command></action> </item>' files=$( tac "${file_path}" | awk -v MAX="$maximum_entries" -v PR="$pre" -v MI="$mid" -v PO="$post" 'BEGIN { RS="</bookmark>"; FS="<info>"; } (NR == MAX) {exit} !/<bookmark/ {next} !/href=[\"'\'']file:\/\// {next} # $1 is the command, $2 the file path { sub(/^.*exec=\"\&apos\;/,"",$1) sub(/\&apos\;.*$/,"",$1) sub(/ *%./,"",$1) sub(/^.*file:\/\//,"",$2) sub(/[\"'\''].*$/,"",$2) gsub(/%22/,"\\"",$2) gsub(/%3C/,"\\<",$2) gsub(/%3E/,"\\>",$2) name=$2 sub(/^.*\//,"",name) gsub(/_/,"__",name) gsub(/\'/,"\\'\\"\\'\\"\\'",$2) print (PR name MI $1 " '"'"'" $2 "'"'"'" PO) }' ) # use perl to decode urlencoded characters files=$(perl -MURI::Escape -e 'print uri_unescape($ARGV[0]);' "$files") output='<openbox_pipe_menu> '"$files"' <separator /> <item label="Clear Recent Files"> <action name="Execute"> <command> ''"$0"'' --clear </command> </action> </item> </openbox_pipe_menu> ' printf '%s' "$output" # printf because echo sometimes eats backslashes
If it does the job for you - great
I can't recall why @nobody developed a lua script, but I guess it is better in some way.
The skill knowledge of the people here astound me. The helpful attitude here is amazing too, many Linux orientated forums could learn a lesson or two.
"All we are is dust in the wind, dude"
- Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
- Wayne Campbell
Offline