Scripts by xaos52

Submitted scripts and programs
Forum rules
Your own work only.
User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Scripts by xaos52

Unread post by xaos52 » Thu Sep 19, 2013 8:56 am

New script in my repo: 'raiss' bash_scripts
For loading rss feeds into your browser from the command line.
Thanks to user 'procyan on the Arch forum
And a small contribution by yours truly (jds1307 is my moniker on arch)
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 2:31 pm

Added first 'quick & dirty' version of console_colors to github.

"Database" layout and data are in a separate file: console-color-themes
The script itself loads the color themes from the data file : put it in the same dir as the script or modify the script.

Some working functionality:
- load the database
- print list of themes
- apply a theme

The rest will be added in future versions.

Remarks, suggestions, criticism are welcome :)
Connected. Take this REPL, brother, and may it serve you well.

User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

Re: Scripts by xaos52

Unread post by DebianJoe » Tue Nov 05, 2013 2:46 pm

Would it be within reason to break the huge plaintext themes database file into individual files? One of the primary aims of the project was to avoid having to edit a monolithic file just to add a theme.
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Scripts by xaos52

Unread post by machinebacon » Tue Nov 05, 2013 2:48 pm

Thanks Doctor, it does what it says on the tin. Two questions:
1) can you make it read from more than one -color-theme file?
2) I get a list of available themes when run without options, but some have a "key:" label before the theme name. Does it mean anything?

Code: Select all

...
...
key: autumn
key: flower
key: vintage
afog
astro
...
...
..gnutella..

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 3:07 pm

1) you mean more than one in the same session or specify the one you want to use with an option?
2) the key: ... lines were for debugging only.
the list will be extended to include author and full_name of the theme.
3) adding themes will be easiest with palleter integrated into the script.
4) adding a theme will also be possible by providing a text file in the same format as the database file ( 3 lines per theme that you want to add ), or a format that is easily transformed to that format.
Last edited by xaos52 on Tue Nov 05, 2013 3:13 pm, edited 1 time in total.
Connected. Take this REPL, brother, and may it serve you well.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Scripts by xaos52

Unread post by machinebacon » Tue Nov 05, 2013 3:12 pm

Originally we planned (or would be happy) to have all the themes in separated files, so that it is easier to maintain in the future - users could drop their color schemes into the themes directory, they would partly come from the paletter script, partly from contributions. Adding themes to one large file is more complicated than adding smaller files to a designated directory.
..gnutella..

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 3:25 pm

^ Can be done.
Loading the database would then consist of scanning the themes directory and loading all files into one associated array. in memory.

Do you have a list of possible formats the user would supply?

Entry via palleter will be no problem, as I know the format palleter delivers. All I need there is the key, author and full_name.

How about me always asking interactively for key, author and full_name, and the user supplying one color per line, with the prefixes P0...PF.. that would be unequivocal.
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 3:32 pm

Or a fixed layout:
line 1 = key
line 2 = author
line 3 = full name
following lines are color definition lines - including the prefixes.

Then a theme can be created without user interaction.

Lines 1 to 3 must be double quoted when containing spaces.<--- scrap that
Comment lines allowed before and after the definition lines, not in the definitions themselves <-- scrap that too.

the key can be the file name, so scrap line1 as well. --> one theme per file.
Connected. Take this REPL, brother, and may it serve you well.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Scripts by xaos52

Unread post by machinebacon » Tue Nov 05, 2013 3:53 pm

Right now there's no fixed format for the key/author/full name header, the paletter only outputs the colors, and the other scripts use 'hardcoded' key/name values; so we are flexible.

I wonder if the 'author' field is important or not. Actually it doesn't bring much, as it is repeated in the 'full name' field. And even a full name field is redundant, who really cares about the author's name? I don't.

But don't take my word for written in stone :)

-----
Note to self: paletter would ask for a key and full name and add it to the .theme file.
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Scripts by xaos52

Unread post by rhowaldt » Tue Nov 05, 2013 4:20 pm

some thoughts:
- themefiles in a 'themes' directory would be the simplest way to have this implemented. wanna add a new theme? just drop a themefile in the directory, run the script and it will be available for switching.
- creation of themefiles could be done either through Paletter (if you want a theme based on a picture), through an interactive part of the script (as suggested by xaos) or by hand (just write your own theme-file)
- i think when it comes to FOSS-related shit it is somewhat important to mention the author of a theme, simply to do some attribution, ie. as a way to say 'thank you' or something

hope this is useful :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Scripts by xaos52

Unread post by machinebacon » Tue Nov 05, 2013 4:36 pm

^ Who made FlatStudio? Or Numix? ;) But yeah, I don't really care about "author" bullshit, exactly because it is the FOSS world. As long as it is easy to implement...

It would be super-sexy if writing the .theme file is easy as pasting the 16 color code blocks into a txt file, especially because it could easily generate an Xresources snippet, too.
..gnutella..

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 5:25 pm

Pushed v002 of the script and ilight as an example of the expected layout.
This one scans the themes dir for files containing a single theme definition and uses the fileame as key.

Will simplify to just color codes as suggested by mb in the next version.
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 5:44 pm

Q: should I descend into subdirectories of the themes dir?
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Tue Nov 05, 2013 6:00 pm

pushed version .003
Connected. Take this REPL, brother, and may it serve you well.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Scripts by xaos52

Unread post by rhowaldt » Wed Nov 06, 2013 12:29 am

@Jules: hmm, okay, you got a point.
@Xaos: i'd say: no descending into subdirs. what's the use? only complicates stuff more... (imo)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Wed Nov 06, 2013 12:37 pm

Pushed v0.004
See commit message for details.
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Wed Nov 06, 2013 3:23 pm

Pushed version 0.005
See commit message for details.
Connected. Take this REPL, brother, and may it serve you well.

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Wed Nov 06, 2013 5:20 pm

Pushed version 0.006
See commit message for details.
Connected. Take this REPL, brother, and may it serve you well.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Scripts by xaos52

Unread post by machinebacon » Thu Nov 07, 2013 7:47 am

Sir,
I get a ./console-colors.sh: line 212: columns: command not found

bash --version
GNU bash, version 4.2.45(1)-release
bsdmainutils:
Installed: 9.0.5


Shouldn't it be "column"? Or is the problem elsewhere?

I commented the pipe out for testing - the script is superb, really. Now if it makes us an .Xresources file (or open an Xresources file from an existing theme in ./console_colors), I open a bottle of beer for us. A Belgian one.
..gnutella..

User avatar
xaos52
The Good Doctor
Posts: 190
Joined: Thu Aug 15, 2013 11:59 am
Location: Eernegem, Belgium

Re: Scripts by xaos52

Unread post by xaos52 » Thu Nov 07, 2013 11:57 am

^ /usr/bin/columns comes with the package 'autogen' in Debian.

Well, it is not finished yet.
Go buy that beer and put it somewhere cold.

And I dont like it when you call me "sir", my son.
Connected. Take this REPL, brother, and may it serve you well.

Post Reply