SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#26 2015-03-16 14:42:13

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

johnraff wrote:

Getting there!  cool

Yes, a menu with all the files, Japanese nicely decoded in the labels, and runs nice and fast - about the same as the hacky present script. Good job!

Few things left to do:
1) Get the newest files at the top of the list, not the bottom.
2) An option to limit the number of entries, eg the 15 newest entries only.
3) Need to convert '_' to '__' in Openbox menu "label" attributes. The first underbar is taken to indicate an underline for a keyboard shortcut. http://openbox.org/wiki/Help:Menus#Spec … _shortcuts

I have not yet checked behaviour with filenames containing nasty characters, or when there are multiple entries for different apps to open the same file.

All implemented; you can git-pull the changes or go here https://raw.githubusercontent.com/2ion/ … pemenu.lua. The _ shortcut does only apply if [[ label =~ ^_ ]] so I only act on that.

If the menu list is empty, an action-less label saying so is added.

The script shouldn't choke on an empty xbel file anymore. I will however fail if the file doesn't exist at all, so we truncate the file instead of removing it.

Synopsis
Usage: bl-recent-files-pipemenu.lua [-h|--help] [-f|--file XBEL] [-l|--limit NUM] [-o|--open-cmd CMD] [-r|--reverse]
Where: -h, --help       Show this message and exit.
       -f, --file       XBEL. Path to a 'recently-used.xbel' file.
                        Omit in order to attempt to auto-detect the path.
       -l, --limit      NUM. Include up to NUM items in the menu.
       -o, --open-cmd   CMD. Open files using CMD. By default, files will be
                        opened in the application they were being used with.
       -r, --reverse    Put the most-recently used items at the top of the menu.

Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

Help fund CrunchBang, donate to the project!

#27 2015-03-16 17:27:44

tknomanzr
#! Die Hard
From: Heavener, OK
Registered: 2014-12-09
Posts: 777

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

Install should probably touch recently-used.xbel, so you can be reasonably sure it exists. I know I have to create it for all of my net installs at any rate.

Offline

#28 2015-03-16 19:25:49

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

tknomanzr wrote:

Install should probably touch recently-used.xbel, so you can be reasonably sure it exists. I know I have to create it for all of my net installs at any rate.

Sorry, I meant it would fail if an user-specified xbel file wasn't found. I changed this now since the auto-detection wouldn't complain either if the file didn't exist; that was inconsistent behaviour.

What you get now is just an empty menu whatever the reason that we couldn't read the file.

It is thus not necessary to touch anything anymore.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#29 2015-03-17 01:06:27

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

Getting better...

-r puts the newest file at the top, but unfortunately -l 15 limits the list to the fifteen oldest entries (ie the top of the xbel file), with the newest of those at the top of the list. There still needs to be a way to get a certain number of entries from the bottom of the xbel file.

The first instance of _ needs to be doubled wherever it occurs in the "label", not just at the front. Openbox will assume it's a  flag for an underline.

PS escaping for odd characters in filenames (including linebreaks) tested OK.   cool

Last edited by johnraff (2015-03-17 01:15:52)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#30 2015-03-17 01:26:03

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

Another topic that needs to be considered - what to do if two different apps have recently opened the same file? Choose the more recent timestamp? Make two separate entries in the menu so the user can choose?

An example, the same (strangely named) file was opened by geany and mousepad, giving this bookmark in recently-used.xbel:

  <bookmark href="file:///home/john/text/oddnames/%22fish%20&amp;%20chips%22%20%3Cwhat&apos;s%20that%3F%3E" added="2015-03-17T01:08:04Z" modified="2015-03-17T01:16:51Z" visited="2015-03-17T01:08:04Z">
    <desc>Charset: UTF-8</desc>
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:groups>
          <bookmark:group>geany</bookmark:group>
          <bookmark:group>Mousepad</bookmark:group>
        </bookmark:groups>
        <bookmark:applications>
          <bookmark:application name="geany" exec="&apos;geany %u&apos;" modified="2015-03-17T01:08:04Z" count="1"/>
          <bookmark:application name="Mousepad" exec="&apos;mousepad %u&apos;" modified="2015-03-17T01:16:51Z" count="2"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>

The current lua menu chose the geany entry.

Last edited by johnraff (2015-03-17 01:26:31)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#31 2015-03-17 11:44:37

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

^ I believe the bugs you named are now fixed.

As for your second point: yes it is true that the program chooses arbitrarily the first application (due to the fact that my sample didn't include such a structure).

bookmark:get_elements_with_name("bookmark:application")[1]:get_attribs()

It would be no problem to use both entries, or the latest (the postpended one seems to be the latest). Personally, I would be in favour of using the second entry/latest entry then and dropping the other.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#32 2015-03-18 04:02:35

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

twoion wrote:

^ I believe the bugs you named are now fixed.

Yes! Now a nice menu of 15 items, with the newest at the top, comes up in about the same time as the old version. Excellent.
25px_Imperial_Seal_of_Japan.png

The underbar doubling needs to be done for every occurence I think. Now the second one is being swallowed.

As for your second point: yes it is true that the program chooses arbitrarily the first application (due to the fact that my sample didn't include such a structure).

bookmark:get_elements_with_name("bookmark:application")[1]:get_attribs()

It would be no problem to use both entries, or the latest (the postpended one seems to be the latest). Personally, I would be in favour of using the second entry/latest entry then and dropping the other.

Me too. That seems like the best default option.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#33 2015-03-18 10:06:57

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

johnraff wrote:

The underbar doubling needs to be done for every occurence I think. Now the second one is being swallowed.

What a pain.

Me too. That seems like the best default option.

I'll do it this way then.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#34 2015-03-18 10:18:21

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

twoion wrote:
johnraff wrote:

The underbar doubling needs to be done for every occurence I think. Now the second one is being swallowed.

What a pain.

Me too. That seems like the best default option.

I'll do it this way then.

OK, done. I've moved the Lua file over the shell script, now it's here: https://github.com/2ion/bunsen-pipemenu … s-pipemenu.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#35 2015-03-19 01:09:24

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

Great stuff!!
Thank you very much.

Now it's OK to pull the file into bunsenlabs I guess?
(I'll keep a copy of the original renamed bl-recent-files-pipemenu.sh)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#36 2015-03-19 11:19:27

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

johnraff wrote:

Great stuff!!
Thank you very much.

Now it's OK to pull the file into bunsenlabs I guess?
(I'll keep a copy of the original renamed bl-recent-files-pipemenu.sh)

An extra copy? You can just retrieve the file from Git history.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#37 2015-03-19 11:21:22

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

I am going to merge the branches ; it seems there is a merge conflict to resolve.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#38 2015-03-19 11:33:20

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

johnraff wrote:

Great stuff!!
Thank you very much.

Now it's OK to pull the file into bunsenlabs I guess?
(I'll keep a copy of the original renamed bl-recent-files-pipemenu.sh)

I have created  a tag at that point in history: https://github.com/BunsenLabs/bunsen-pi … menu-merge. The file will always be available there.


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

#39 2015-03-20 00:51:22

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

Cool. I didn't know git had that functionality.

Don't some repos get incredibly bloated out with history?


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
#! forum moderator    BunsenLabs

Offline

#40 2015-03-20 01:03:06

twoion
Moderator
Registered: 2012-05-11
Posts: 1,648

Re: [MERGED][bunsen-pipemenus] big rewrite of bl-recent-files-pipemenu

johnraff wrote:

Cool. I didn't know git had that functionality.

Don't some repos get incredibly bloated out with history?

git keeps all the pieces for you.

Well it's a directory cache built to never lose any history and keep every single change attributable. git-blame is showcases git's nature. All what git-tag does is to give a name to a random commit on a certain branch. You could go back to that commit by just knowing its hash like e68125af609595849b0f3447b9b2c44e67dccd7c but obviously it's easier to create an alias for that.

Git uses compression and even for thousands of commits to large projects the repo size remains manageable. If the repo grows too big you can drop history (git-rebase) or when cloning just make a shallow copy (git clone --depth 1 for example). Putting binary blobs into git is obviously not very efficient since they cannot be compressed as well as text/source code, but if you insist to manage big files (like some 14G BluRay rips) in git you can resort to git-annex https://git-annex.branchable.com/.

You're right in that it's different from svn, hg and so on since these are delta storage systems (they store a history of file diffs). Git keeps whole copies of files and doesn't store diffs (=blobs). Here's more on blobs: https://schacon.github.io/gitbook/1_the … model.html.

Last edited by twoion (2015-03-20 01:03:22)


Tannhäuser ~ {www,pkg,ddl}.bunsenlabs.org/{gitlog,repoidx}

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo