You are not logged in.

#1 2005-08-05 06:52:15

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

dot files in your fluxbox menu

I've seen in screenshots that people have short lists of their important dot files linked to in their menu, be it fluxbox or I've seen it most in fvwm. I thought I'd chuck together a little script to make my life easier and here it is if anyone's interested. Just start this from your .xinitrc and add this somewhere to your .fluxbox/menu file:

[submenu] (dot files)
     [include] (/tmp/.dotfiles)
[end]

and the script:

#!/usr/bin/env python

import sys
import os
import time

home = os.environ.get('HOME')
dotfiles = os.listdir(home)

while 1:
    os.system('touch /tmp/.dotfiles')
    f = open('/tmp/.dotfiles', 'w')
    f.write("[begin]t(dot files)n")
    
    for file in dotfiles:
        if os.path.isdir( os.path.join(home, file) ) or file[0] != '.':
            pass
        else:
            f.write("t[exec] (%s) {scite %s/%s}n" % ( file,  home, file))
            
    f.write("[end]n")        
    f.close()
    time.sleep(5)
    os.system('rm /tmp/.dotfiles')

As is, it'll open the files in scite but it'd be easy to change to use gedit, kwrite, vim, whatever turns you on smile

Offline

#2 2005-08-05 10:48:50

jackmetal
Member
From: US
Registered: 2005-06-13
Posts: 164

Re: dot files in your fluxbox menu

Quick question:

I named the little script dot.files   ;-)

When I run it as a test

# sh./dot.files

I get the following error:

./dot.files: line 7: syntax error near unexpected token `('
./dot.files: line 7: `home = os.environ.get('HOME')'

When I try that line by itself in my shell

# home = os.environ.get('HOME')

I get the following error:

-bash: syntax error near unexpected token `('

I know I'm doing 'something' wrong here.  Any idea?

Thanks!


--

Some of the world's greatest feats were
accomplished by people not smart enough
to know they were impossible.
-- Doug Larson

Offline

#3 2005-08-05 11:01:29

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: dot files in your fluxbox menu

It's a python script, just chmod +x it, and then do ./scriptname, oorrrrr run python scriptname

iphitus

Offline

#4 2005-08-05 11:26:37

jackmetal
Member
From: US
Registered: 2005-06-13
Posts: 164

Re: dot files in your fluxbox menu

Dooooooh!

:shock:

I didn't notice that it was python...

Now it works! ;-)


--

Some of the world's greatest feats were
accomplished by people not smart enough
to know they were impossible.
-- Doug Larson

Offline

Board footer

Powered by FluxBB