You are not logged in.
ootput wrote:Now using Debian fulltime, with Arch still on my lappy.
Debian setup is basically the same as it was with Arch.
wallpaper please ! And .Xdefaults if you don't mind. ^^
It's Alex's dusk - it just seems unfamiliar to you because of the tint.
Xresources found in sig
Offline
xd-0 wrote:Daisuke_Aramaki
You can't post an awesome wallpaper like that and not include a link!
+1
http://g.imagehost.org/t/0179/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0811/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0426/2009-05-1 … _scrot.jpg
some nice pipe menus in openbox
So is that running Arch or Gentoo? You have a nearly identical setup on the openbox thread. Or do you just have 2 systems setup very similarly?
Offline
Offline
Offline
xd-0 wrote:Daisuke_Aramaki
You can't post an awesome wallpaper like that and not include a link!
+1
http://g.imagehost.org/t/0179/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0811/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0426/2009-05-1 … _scrot.jpg
some nice pipe menus in openbox
Could you please share your pipe menus with us?
Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."
Offline
na12 wrote:xd-0 wrote:Daisuke_Aramaki
You can't post an awesome wallpaper like that and not include a link!
+1
http://g.imagehost.org/t/0179/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0811/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0426/2009-05-1 … _scrot.jpg
some nice pipe menus in openbox
So is that running Arch or Gentoo? You have a nearly identical setup on the openbox thread. Or do you just have 2 systems setup very similarly?
Yes,I have 2 system setup very similarly,Arch and Gentoo.
na12 wrote:xd-0 wrote:Daisuke_Aramaki
You can't post an awesome wallpaper like that and not include a link!
+1
http://g.imagehost.org/t/0179/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0811/2009-05-1 … _scrot.jpg
http://g.imagehost.org/t/0426/2009-05-1 … _scrot.jpg
some nice pipe menus in openbox
Could you please share your pipe menus with us?
Sure,yweather script found here http://bbs.archlinux.org/viewtopic.php?id=43432
Places.pl
#!/usr/bin/perl
use strict;
use warnings;
use MIME::Types;
# dirlist.pl by Dave Foster <daf@minuslab.net>
# Openbox pipe menu that shows the contents of a directory, recursively.
# REQUIRES MIME::Types module. It's available in portage, albiet ~masked: dev-perl/MIME-Types
# install instructions:
# 1) Put script somewhere (~/.config/openbox/scripts/ works well). Preferably in $PATH.
# 2) Make script executable (chmod +x dirlist.pl)
# 3) Edit openbox menu file:
# a) Add <menu id="dirlist-menu" label="Dir" execute="pathto/dirlist.pl thediryouwanttosee" />
# b) Add <menu id="dirlist-menu" somewhere on your root menu or wherever you want it.
# 4) repeat as needed.
# CONFIG: set these to what you want to do with each item in $HOME/.dirlist
# Changelog (starting May 05, by Matt Fitzgibbons, sildan@inbox.com)
# 09 June 05 Version 1.4: Neil Bird rewrote my crappy limiter code (thanks)
# and added ability to read in a config file
# 03 June 05 Version 1.4.-1: Added a file limiter and "More..." submenu!
# 04 May 05 Version 1.3.1: Changed display to get rid of full path (which made for wide menus),
# fixed quoting bug to correctly compensate for spaces in file names
# Changelog -
# 10 Oct 2004 - Version 1.3 (Heading fixed, added MIME Type support, bug fix for "/")
# 9 Oct 2004 - Version 1.2 (Fixed & handling)
# Version 1.1 (Added ability to ignore files/dirs starting with .)
# Version 1.0 (Initial Release)
#
# don't touch, these must be defined before you can set your types!
#
my MIME::Types $types = MIME::Types->new;
my @mimeHandlers = ();
my @mimeRangeHandlers = ();
my @mimeDefaultHandlers = ();
# <CONFIG> - cut'n'paste this to ~/.dirlist to customize, otherwise the defaults will be used
# ###########################
# general config
# ###########################
# number of files to display per menu
my $limitsize = 20;
# action to take on directory items (top of the menu)
my $diraction = "thunar ";
# show files sizes (0 or 1)
my $dofilesize = 1;
# ignore files/dirs beginning with . (0 or 1)
my $ignoredotfiles = 0;
# the default action to take. %1 is replaced by a filename.
# if you don't want anything to happen on unregistered types, set this variable to "true".
my $defaultAction = "mousepad %1";
# the command for "run in terminal"
my $termCommand = "xterm -e";
# ###########################
# /general config
# ###########################
# ###########################
# set your mime handlers here
# ###########################
# to add an action for a specific mime type:
# add_mime_handler("MIME-TYPE", "ACTION", run in terminal (1) );
#
# In the action, a %1 indicates the filename.
# You can leave the last argument off if you don't want it to run in a terminal.
# If you want to run the file (say for application/* types), just put "%1" as the action.
#
# To cover all of a range of MIMEs, use this notation: type/*
# Example: add_mime_handler("text/*", "gedit %1");
# Specific defined MIMEs take precedence over ranged defined types.
## add_mime_handler("text/*", "mousepad %1");
## add_mime_handler("application/x-perl", "mousepad %1");
## add_mime_handler("application/*", %1);
## add_mime_handler("image/*", "rietretto %1");
## add_mime_handler("video/*", "xine %1");
## add_mime_handler("audio/*", "xfmedia %1");
# ##########################
# / set mime handlers
# ##########################
# </CONFIG>
# Custom config?
if (! -f "$ENV{HOME}/.dirlist" )
{
# Default MIME
add_mime_handler("text/*", "mousepad %1");
add_mime_handler("application/x-perl", "mousepad %1");
add_mime_handler("application/x-python", "mousepad %1");
add_mime_handler("application/*", %1);
add_mime_handler("image/*", "ristretto %1");
add_mime_handler("video/*", "xine %1");
add_mime_handler("audio/*", "xfmedia %1");
}
else
{
# User's custom config.
eval( `cat $ENV{HOME}/.dirlist` );
}
#
# begin script
#
# couple vars for more... stuff
my $limiter = 0;
my $page = 0;
# process args.
my @initargv = @ARGV; # for More...
while (defined($ARGV[0]) && defined($ARGV[1]) && $ARGV[0] =~ /^--/o)
{
my $cmd = shift @ARGV;
my $arg = shift @ARGV;
$page = $arg if $cmd eq '--page';
$limitsize = $arg if $cmd eq '--limit';
$diraction = $arg if $cmd eq '--diraction';
$dofilesize = $arg if $cmd eq '--filesize';
$ignoredotfiles = $arg if $cmd eq '--ignorehidden';
$defaultAction = $arg if $cmd eq '--defaultaction';
$termCommand = $arg if $cmd eq '--termcommand';
}
# handle directory not being passed in
if ( scalar(@ARGV) < 1 ) {
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print "<openbox_pipe_menu>\n";
print "\t<item label=\"ER: NO DIR\">\n";
print "\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t</item>\n";
print "</openbox_pipe_menu>\n";
exit;
}
# start pipe menu
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print "<openbox_pipe_menu>\n";
# set up directory
my $dir = $ARGV[0];
$dir =~ s/\$(\w+)/$ENV{$1}/;
opendir DIR, $dir;
my @files = readdir DIR;
closedir DIR;
@files = sort(@files);
my @dirs = ();
my @keepfiles = ();
# construct file name strings
my $absolute;
my $filecount = 0;
my $thispage = 0;
foreach my $file ( @files ) {
next if ( $file eq "." || $file eq ".." );
next if ( $ignoredotfiles && substr($file,0,1) eq ".");
$absolute = $dir;
$absolute = $absolute . "/" if ( substr($absolute,-1) ne "/" );
$absolute = $absolute . $file;
if ($filecount == $limitsize)
{
# Menu already full; is this the right one or a parent one?
if ($thispage == $page)
{
# This is it; finish with more to go
$limiter = 1;
last;
}
else
{
# Move on to next page
@dirs = ();
@keepfiles = ();
$filecount = 0;
$thispage++;
}
}
# Add this item
if ( -d $absolute ) {
push @dirs, $absolute;
} elsif ( -f $absolute ) {
push @keepfiles, $file;
}
$filecount++;
}
# print header
my @chunks = split /\//, $dir;
my $last = ( $dir eq "/" ) ? "/" : $chunks[$#chunks];
if (!$page) {
print "\t<item label=\"" . string_protect($last) . "\">\n";
print "\t\t<action name=\"Execute\"><execute>$diraction " . string_protect($dir) . "</execute></action>\n";
print "\t</item>\n";
}
# print the entry for the more list
if ($limiter)
{
my $nextpage = $page+1;
my $newargv = '';
# Re-create argv with new --page
for (my $arg = 0; $arg <= $#initargv; $arg++)
{
if ($initargv[$arg] eq '--page')
{
$arg++;
}
else
{
my $newarg = filename_protect($initargv[$arg]);
$newargv = $newargv . ' ' . $newarg;
}
}
print "\t<menu id=\"$dir.$nextpage\" label=\"More...\" execute=\"$0 --page $nextpage $newargv\" />\n";
}
if (!$page || $limiter) {print "\t<separator />\n";}
foreach ( @dirs ) {
script_link($_);
}
# send a list to print files
$absolute = $dir;
$absolute = $absolute . "/" if ( substr($absolute,-1) ne "/" );
files_menu($absolute,@keepfiles);
print "</openbox_pipe_menu>\n";
sub files_menu {
my $rootdir = shift;
foreach my $file ( @_ ) {
my $abs = $rootdir . $file;
#i just want the label to be the file name without the dir, so make a new label, nixing the path
my @chunks = split /\//, $file;
my $newlabel = string_protect($chunks[$#chunks]);
my @finfo = stat($abs);
my $sizeout = "";
if ($dofilesize)
{
# Is there a smarter way of doing this?
if ($finfo[7] < 2*1024)
{
$sizeout = sprintf(" (%d bytes)", $finfo[7] );
}
elsif ($finfo[7] < 2*1024*1024)
{
$sizeout = sprintf(" (%.1f Kb)", $finfo[7] / 1024);
}
elsif ($finfo[7] < 2*1024*1024*1024)
{
$sizeout = sprintf(" (%.1f Mb)", $finfo[7] / 1024 / 1024);
}
elsif ($finfo[7] < 2*1024*1024*1024*1024)
{
$sizeout = sprintf(" (%.1f Gb)", $finfo[7] / 1024 / 1024 / 1024);
}
}
my $actiontotake = get_action($abs);
print "\t<item label=\"$newlabel$sizeout\">\n";
print "\t\t<action name=\"Execute\"><execute>" . string_protect($actiontotake) . "</execute></action>\n";
print "\t</item>\n";
}
}
sub script_link {
my $name = shift;
my $sname = $name;
$sname =~ s/[^A-Za-z0-9]/_/g;
@chunks = split /\//, $name;
$last = string_protect($chunks[$#chunks]);
print "\t<menu id=\"$sname\" label=\"$last\" execute=\"$0 " . filename_protect($name) ."\" />\n";
}
# Protect XML
sub string_protect {
my $str = shift;
$str =~ s/&/&/g;
return $str;
}
# Protect filenames we can't '"' quote (as they'll be in an 'execute="blah"' clause)
sub filename_protect {
my $str = shift;
$str =~ s/\"/\\\"/go;
$str =~ s/\'/\\\'/go;
$str =~ s/\$/\\\$/go;
$str =~ s/ /\\ /go;
$str =~ s/&/\\&/go;
return $str;
}
#
# funcs for mime type stuff!
#
sub add_mime_handler {
my $mtype = shift;
my $action = shift;
my $interm = ( scalar(@_)>0 ) ? shift : 0;
# disgusting... check for the *, add appropriately.
if ( $mtype =~ /(\w+)\/\*$/ ) {
push @mimeDefaultHandlers, { "mime-type"=>$1, "action"=>$action, "interm"=>$interm };
} else {
push @mimeHandlers, { "mime-type"=>$mtype, "action"=>$action, "interm"=>$interm };
}
}
sub get_action {
my $file = shift;
my $retdefault = $defaultAction;
$retdefault =~ s/%1/\"$file\"/;
my MIME::Type $mime = $types->mimeTypeOf($file);
return "$retdefault" if ( !defined $mime );
# find mime type in our handler array first
foreach my $handler ( @mimeHandlers ) {
if ( $handler->{"mime-type"} eq "$mime" ) {
# replace %1
my $action = $handler->{"action"};
if (defined($action))
{
$action =~ s/%1/\"$file\"/;
return ( $handler->{"interm"} == 1 ) ? "$termCommand $action" : $action;
}
}
}
# if we get here, we didn't find it, so search to see if it matches the first
(my $major,my $minor) = split /\//, "$mime";
foreach my $handler ( @mimeDefaultHandlers ) {
if ( $handler->{"mime-type"} eq $major ) {
# replace %1
my $action = $handler->{"action"};
if (defined($action))
{
$action =~ s/%1/\"$file\"/;
return ( $handler->{"interm"} == 1 ) ? "$termCommand $action" : $action;
}
}
}
# okay if we get here, just get out of here
return $retdefault;
}
wallpaper.py
#!/usr/bin/env python
import os
import re
import string
import sys
from os.path import isdir
# --------------------------------------------------------------------------- #
# wallmenu.py #
# version 0.3.0 #
# --------------------------------------------------------------------------- #
# This script creates an openbox pipe menu to choose a wallpaper.
# You can configure what types of files are allowed, where to search for
# wallpapers, and what program to use to set the wallpaper.
# This script will also update a configuration file
# (~/.config/openbox/wallmenurc) that stores the last set wallpaper.
# This means that you can add a line to your .xinitrc file to load the
# last set wallpaper on start-up.
# You can configure this script with the variables below.
# This script will recursively go through directories from the one you
# specify, searching for image files.
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# Using the config file #
# --------------------------------------------------------------------------- #
# To use the config file that stores the filename of the last set wallpaper,
# you can add a line to your .xinitrc file to load it on start-up. If you
# use Esetroot you can use this example, if not just replace the program
# command with your chosen program:
#
# Esetroot `cat ~/.config/openbox/wallmenurc`
#
# If you want to use this script with feh to set your wallpaper, you don't
# need the script to update a config file. feh automatically inserts the full
# command string used to set the wallpaper into ~/.fehbg. In order to set the
# wallpaper back at the next startof openbox, just add the following to
# ~/.xinitrc:
#
# eval `cat ~/.fehbg`
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# User configuration #
# --------------------------------------------------------------------------- #
# types of files accepted (list, seperated by a |)
filetypes = "jpg|png|gif"
# directory where wallpapers are stored (must be long: no ~ symbol allowed)
directory = "/path/to/your/wallpapers"
# program to set wallpaper
program = "feh --bg-scale"
# store wallpaper name in a config file?
config = "no"
# --------------------------------------------------------------------------- #
def genmenu(start, directory):
# get a directory list
dirlist = os.listdir(directory)
for d in dirlist:
# set di to overall directory
di = directory + "/" + d
# if we get a dir, generate a menu
if isdir(di):
print ""
print " <menu id=\"" + di + "\" label=\"" + d + "\" >"
genmenu(start, di)
print " </menu>"
# if we get a file, check if it is a valid type
else:
if re.search(filetypes, string.lower(di)) > 0:
# make fi variable just filename, without extension
fi = string.replace(string.replace(di, directory, ""), "/", "")
fi = fi[:string.rfind(fi, ".")]
# if so, add it to the pipe menu
print " <item label=\"" + fi + "\">"
# execute line to set wallpaper
print " <action name=\"Execute\"><execute>" + program + " \"" + di + "\"</execute></action>"
# if we want to update config file, do so
if config == "yes":
print " <action name=\"Execute\"><execute>~/.config/openbox/wallmenu.py " + di + "</execute></action>"
print " </item>"
def main(argv):
# if we've been passed an argument update the config file with the arg
if len(argv) == 1:
os.system("echo " + argv[0] + " > ~/.config/openbox/wallmenurc")
else:
# start menu
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
print "<openbox_pipe_menu>"
# set the original start directory
start = directory
# generate menu
genmenu(start, directory)
# end menu
print "</openbox_pipe_menu>"
# run the main() function
if __name__ == "__main__":
main(sys.argv[1:])
Processes.pl
#!/usr/bin/perl -w
#
# procinfo.pl script from waimea ( http://www.waimea.org/ ) ported to output
# pekwm syntax by Claes Nasten ( http://pekdon.net/ )
#
# REPORTED to openbox3 pipe menu syntax by Dave Foster (daf@minuslab.net)
# some functions with no path to execute were removed, otherwise, no
# logic was changed in this script at all.
# install instructions:
# 1) Put script somewhere (~/.config/openbox/scripts/ works well)
# 2) Make script executable (chmod +x procinfo.pl)
# 3) Edit openbox menu file:
# a) Add <menu id="proc-menu" label="Processes" execute="pathto/procinfo.pl" />
# b) Add <menu id="proc-menu" somewhere on your root menu or wherever you want it.
use POSIX;
my $script_location = $0;
my $offset = 0;
my $proc_dir = "/proc";
my $pid = 0;
my $host = "";
my $user = "";
$user = $ENV{USER};
chomp(my $hostname = qx(hostname));
my $forcepid = 0;
my $file = 0;
my $list_length = 20;
get_opt();
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print "<openbox_pipe_menu>\n";
if ($forcepid) {
if ($hostname eq $host && $pid) {
pid_info();
} else {
print "Name = \"process info\"\n";
print "Entry = \"process info for this window could not be retrived\" { }\n";
}
} else {
if ($pid) {
pid_info();
} else {
list_proc();
}
}
print "</openbox_pipe_menu>\n";
sub list_proc {
# my $cmdline = 0;
my $proc_name = 0;
my $i = $offset;
my $owner = "";
my $printed = 0;
my @output;
opendir(DIR, $proc_dir) || die "can't opendir $proc_dir: $!";
@proc_list = grep { (/^[^\.].*/ || /^\.\..*/) && /^\d+$/} readdir(DIR);
closedir DIR;
# print "$_\n" foreach @proc_list;
while (($pid = $proc_list[$i]) && $printed <= $list_length) {
open(FILE, "$proc_dir\/$pid\/status") || die "can't opendir $proc_dir: $!";
($proc_name = (split(':', <FILE>))[1]) =~ s/^\s*(.*)\n/$1/;
# if ($user eq
while ($_ = <FILE>) {
if (/^Uid\:\s*(\d+)\s+/) {
$owner = getpwuid $1;
}
}
close FILE;
if (($user && ($user eq 'all' || $user eq 'ALL')) ||
($owner && $user && ($owner eq $user))) {
if ($printed < $list_length) {
# push @output, "Submenu = \"$pid - $proc_name\" { Entry { Actions = \"Dynamic $script_location -pid $proc_list[$i]\" } }\n";
push @output, "<menu id=\"menu-proc-$pid\" label=\"$pid - $proc_name\" execute=\"$script_location -pid $proc_list[$i]\" />\n";
}
else {
$i--;
}
$printed++;
}
$i++;
}
if ($proc_list[$i]) {
$_ = $i;
print "Submenu = \"more...\" { Entry { Actions = \"Dynamic $script_location -offset $_ -user $user\" } }\n";
}
print @output;
}
sub pid_info {
my $name = "";
my @procinfo;
my $cmdline = "";
my $priority = "";
my $msize = "";
my $mlck = "";
my $mrss = "";
my $mdata = "";
my $mstk = "";
my $mexe = "";
my $mlib = "";
my $pid_err = 0;
open(FILE, "$proc_dir\/$pid\/stat") || pid_err();
$_ = <FILE>;
@procinfo = split(/ /,$_);
close FILE;
$procinfo[1] =~ m/^\((.*)\)/;
$name = $1;
$priority = $procinfo[18];
open(FILE, "$proc_dir\/$pid\/status") || die "can't opendir $proc_dir: $!";
while ($_ = <FILE>) {
if ($_ =~ m/^State.*\((\w*)\)$/) {
$state = $1;
$state =~ s/\(/\\\(/;
$state =~ s/\)/\\\)/;
$state =~ s/\t/ /;
$state =~ s/\s+/ /;
}
if ($_ =~ m/^VmSize/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$msize = $1;
}
if ($_ =~ m/^VmLck/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mlck = $1;
}
if ($_ =~ m/^VmRSS/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mrss = $1;
}
if ($_ =~ m/^VmData/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mdata = $1;
}
if ($_ =~ m/^VmStk/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mstk = $1;
}
if ($_ =~ m/^VmExe/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mexe = $1;
}
if ($_ =~ m/^VmLib/) {
$_ =~ m/.*:\t*\s*(.*)$/;
$mlib = $1;
}
}
if (open(FILE, "$proc_dir\/$pid\/cmdline")) {
$_ = <FILE>;
while ($_ =~ m/\0/) {
$_ =~ s/\0/\\\" \\\"/;
}
$_ =~ m/(.*).{3}$/;
$cmdline = "\\\"$1";
close FILE;
}
print "\t<menu id=\"menu-proc-$pid-state\" label=\"state ($state)\">\n";
print "\t\t<item label=\"stop\">\n";
print "\t\t\t<action name=\"Execute\"><execute>kill -SIGSTOP $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"continue\">\n";
print "\t\t\t<action name=\"Execute\"><execute>kill -SIGCONT $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t</menu\n>";
print "\t<menu id=\"menu-proc-$pid-memory\" label=\"memory ($msize)\">\n";
print "\t\t<item label=\"size: $msize\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"lck: $mlck\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"rss: $msize\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"data: $mdata\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"stk: $mstk\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"exe: $mexe\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"lib: $mlib\">\n";
print "\t\t\t<action name=\"Execute\"><execute>true</execute></action>\n";
print "\t\t</item>\n";
print "\t</menu>\n";
print "\t<menu id=\"menu-proc-$pid-priority\" label=\"priority ($priority)\">\n";
print "\t\t<item label=\"increase by 1\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice +1 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"0 (base)\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice 0 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"5\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice 5 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"10\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice 10 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"15\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice 15 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"20 (idle)\">\n";
print "\t\t\t<action name=\"Execute\"><execute>renice 20 $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t</menu>\n";
print "\t<menu id=\"menu-proc-$pid-signal\" label=\"send signal\">\n";
print "\t\t<item label=\"sighup\">\n";
print "\t\t\t<action name=\"Execute\"><execute>kill -HUP $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"sigint\">\n";
print "\t\t\t<action name=\"Execute\"><execute>kill -INT $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t\t<item label=\"sigkill\">\n";
print "\t\t\t<action name=\"Execute\"><execute>kill -KILL $pid</execute></action>\n";
print "\t\t</item>\n";
print "\t</menu>\n";
if ($cmdline ne "") {
print "\t<item label=\"restart\">\n";
print "\t\t<action name=\"Execute\"><execute>kill $pid && $cmdline</execute></action>\n";
print "\t</item>\n";
print "\t<item label=\"spawn new\">\n";
print "\t\t<action name=\"Execute\"><execute>$cmdline</execute></action>\n";
print "\t</item>\n";
}
}
sub get_opt {
my $i = 0;
while ($ARGV[$i+1] && ($_ = $ARGV[$i])) {
if (/\-offset/) {
$offset = $ARGV[$i+1];
}
if (/\-pid/) {
$pid = $ARGV[$i+1];
}
if (/\-proc_dir/) {
$proc_dir = $ARGV[$i+1];
}
if (/\-user/) {
$user = $ARGV[$i+1];
}
if (/\-host/) {
$host = $ARGV[$i+1];
}
$i++;
}
$i = 0;
while ($_ = $ARGV[$i]) {
$i++;
if (/\-host/) {
$forcepid = 1;
}
}
}
sub pid_err {
print "<item label=\"??? ($pid)\">\n";
print "<action name=\"Execute\"><execute>true</execute></action>\n";
print "</item>\n";
exit;
}
Feed.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
#-------------------------------------------------------------------------------
feeder.py - version 6
by Vlad George
#-------------------------------------------------------------------------------
Description:
This script pipes rss and podcast feeds into the openbox menu
Usage:
First you need the python-feedparser module (archlinux [extra]/ ubuntu).
Place this script under ~/.config/openbox/scripts, edit the variables under "User set variables"
according to your likings (your list of rss_urls, browser and media-player to open links,
number of displayed rss-entries, enable/disable caching of feeds, maximum age of feeds),
make it executable, then add following to your ~/.config/openbox/menu.xml:
"<menu id="feeder-menu" label="rss-feeds" execute="~/.config/openbox/scripts/feeder.py" />...
<menu id="root-menu" label="Openbox3">...<menu id="feeder-menu" />...</menu>"
and reconfigure openbox.
Changelog:
01.07.2007: 1st version
03.07.2007: works now (changed "~")....
05.07.2007: added cache
07.10.2007: added name of rss and sorted output
03.2008: added podcast support
06.2008: uses python's internal python-feedparser module
#-------------------------------------------------------------------------------
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 2
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
http://www.fsf.org/
"""
#-------------------------------------------------------------------------------
# User set variables
#-------------------------------------------------------------------------------
## your rss feeds:
rss_urls = [
#('name to be shown', 'url of rss'),
('Arch Packages', 'http://www.archlinux.org/feeds/packages/'),
#('', ''),
#('', ''),
#('', ''),
]
## browser and audio/video-player to use:
# open_with = "gnome-open"
open_with = "firefox"
play_with = "sonata"
## how many entries should be shown:
rss_feeds_count = 20
## use cache (1 enabled, 0 disabled)
cache = 1
### if cache enabled:
## how old should cache files get - in minutes; set to 0 for manual refresh:
## you can also use >> feeder.py --update << to only update the cache file (useful as cronjob)
age = 120
## temporary directory for cache file (default=/tmp/); leave it as it is.
cache_dir = "/tmp"
#-------------------------------------------------------------------------------
# Script
#-------------------------------------------------------------------------------
# {{{ ## fold marker start
def gettingTitles(url_list):
# get feeds for each url:
rss_dict = {}
for i in xrange(len(url_list)):
rss = feedparser.parse(url_list[i][1])
rss_entry = []
try:
append = rss_entry.append
if rss.entries[i].has_key('link') == False:
[append((rss.entries[num].title, None, rss.entries[num].enclosures[0].href)) for num in xrange(rss_feeds_count)]
elif rss.entries[i].has_key('enclosures') == False:
[append((rss.entries[num].title, rss.entries[num].link, None)) for num in xrange(rss_feeds_count)]
else:
[append((rss.entries[num].title, rss.entries[num].link, rss.entries[num].enclosures[0].href)) for num in xrange(rss_feeds_count)]
except IndexError:
pass
try:
if url_list[i][0] == '':
rss_dict[(rss.feed.title, url_list[i][1])] = rss_entry[0:int(rss_feeds_count)]
else:
rss_dict[(url_list[i][0], url_list[i][1])] = rss_entry[0:int(rss_feeds_count)]
except:
pass
# rss_dict-items: { ..., ([i][0]:> rss-url, [i][1]:> rss-name):[..., ([i][j][0]:> entry-title, [i][j][1]:> entry-link, [i][j][2]:> entry-podcast_link), ...], ... }
return rss_dict
def generateXml(dict_url_entry, outfile):
# sort dict items according display name
sorted_list = dict_url_entry.items()
sorted_list.sort()
# [ ..., (([i][0][0] -> rss-name, [i][0][1] -> rss-url), [..., ([i][1][j][0] -> entry-title, [i][1][j][1] -> entry-link, [i][1][j][2]:> entry-podcast_link), ...]), ... ]
root = ET.Element("openbox_pipe_menu")
for i in xrange(len(sorted_list)):
menu = ET.SubElement(root,"menu", attrib = {"id" : sorted_list[i][0][1], "label" : unicode(sorted_list[i][0][0])})
for j in xrange(len(sorted_list[i][1])):
try:
if sorted_list[i][1][j][2] == None:
item = ET.SubElement(menu, "item", attrib = {"label" : unicode(sorted_list[i][1][j][0])})
action = ET.SubElement(item, "action", attrib = {"name" : "Execute"})
command = ET.SubElement(action, "command")
tmp = str(sorted_list[i][1][j][1]).replace('~','%7E')
command.text = "%s %s" % (open_with, tmp)
elif sorted_list[i][1][j][1] == None:
podcast_menu = ET.SubElement(menu, "menu", attrib = {"id" : str(int(random.random()*10000000)) + "-menu", "label" : unicode(sorted_list[i][1][j][0])})
podcast_play = ET.SubElement(podcast_menu, "item", attrib = {"label" : " play podcast"})
podcast_play_action = ET.SubElement(podcast_play, "action", attrib = {"name": "Execute"})
podcast_play_execute = ET.SubElement(podcast_play_action, "command")
tmp = str(sorted_list[i][1][j][2]).replace('~','%7E')
podcast_play_execute.text = "%s %s" % (play_with, tmp)
else:
podcast_menu = ET.SubElement(menu, "menu", attrib = {"id" : str(int(random.random()*10000000)) + "-menu", "label" : unicode(sorted_list[i][1][j][0])})
podcast_open = ET.SubElement(podcast_menu, "item", attrib = {"label" : " open "})
podcast_open_action = ET.SubElement(podcast_open, "action", attrib = {"name": "Execute"})
podcast_open_execute = ET.SubElement(podcast_open_action, "command")
tmp1 = str(sorted_list[i][1][j][1]).replace('~','%7E')
podcast_open_execute.text = "%s %s" % (open_with, tmp1)
podcast_play = ET.SubElement(podcast_menu, "item", attrib = {"label" : " play podcast"})
podcast_play_action = ET.SubElement(podcast_play, "action", attrib = {"name": "Execute"})
podcast_play_execute = ET.SubElement(podcast_play_action, "command")
tmp2 = str(sorted_list[i][1][j][2]).replace('~','%7E')
podcast_play_execute.text = "%s %s" % (play_with, tmp2)
except IndexError:
pass
if cache == 1:
separator = ET.SubElement(root,"separator")
refresh = ET.SubElement(root,"item", attrib = {"label":"Reload Cache"})
action2 = ET.SubElement(refresh,"action",attrib = {"name":"Execute"})
command2 = ET.SubElement(action2,"command")
command2.text = "%s %s" % (sys.argv[0], "--update")
tree = ET.ElementTree(root)
tree.write(outfile)
def ageCheck(age_in_min, file_to_check):
age_in_sec = int(age_in_min)*60
file_age = int(time())-int(os.path.getmtime(file_to_check))
if age_in_min == 0:
return 1
elif os.path.isfile(file_to_check) and file_age < age_in_sec:
return 1
else:
return 0
def printXml(xml_entry):
temp_file = file(xml_entry,'r')
a = temp_file.read()
temp_file.close()
print a
#-------------------------------------------------------------------------------
# Main
#-------------------------------------------------------------------------------
import os.path, sys, feedparser
import xml.etree.ElementTree as ET
import random
from time import time
#-------------------------#
if __name__ == "__main__" :
#-------------------------#
if cache == 1:
cache_file = cache_dir + "/." + str(os.path.split(sys.argv[0])[1]) + "-" + str(os.getuid()) + ".cache"
if ('--update' in sys.argv[1:]):
generateXml(gettingTitles(rss_urls), cache_file)
elif os.path.isfile(cache_file) and ageCheck(age, cache_file):
print '<?xml version="1.0" encoding="UTF-8"?>'
printXml(cache_file)
else:
generateXml(gettingTitles(rss_urls), cache_file)
print '<?xml version="1.0" encoding="UTF-8"?>'
printXml(cache_file)
else:
print '<?xml version="1.0" encoding="UTF-8"?>'
generateXml(gettingTitles(rss_urls), sys.stdout)
# }}} ## fold marker end
# vim: set ft=python ts=4 sw=4 foldmethod=marker :
Last edited by na12 (2009-05-19 07:26:31)
Offline
this is awesome!
Offline
YtseJammin wrote:this is awesome!
Thanks
Offline
soupcan wrote:na12 wrote:Is there some way you could get me your wallpapers-all of those in that style? I really like the ones in nitrogen.
Those wallpapers are REALLY nice. Here's my new screenshot
WM: IceWM (Latest icewm-cvs) with a very modified breathe theme
GTK Theme: Murrine-Sky
Icons: HighContrast-SVG
Fonts: Liberation Sans, HeldustryFTVBasicBlack and nu
Offline
Found me the best looking GTK theme : Aurora!
http://omploader.org/tMXA5Zw
Bebop FTW. if you need high quality Bebop episodes, let me know.
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
Agent69 wrote:Messing around with Evilwm and Thunar on Arch, just to see how they would look together. Wallpaper from Mandolux.
You need some serious GTK love there.
Ya I do, although playing with GTK has to be one of my least favorite things in the world to do. I'll probably fix it once I get Firefox installed.
Offline
Wra!th wrote:Found me the best looking GTK theme : Aurora!
http://omploader.org/tMXA5ZwBebop FTW. if you need high quality Bebop episodes, let me know.
I'd like to take you up on that offer, if you don't mind.
Offline
Offline
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
Fluxbox+Lunar Linux. Pilsner gtk theme this time.
Really nice, once again!!!
How many times per month do you change your config?
archlinux on Macbook Pro 10,1
Offline
Daisuke_Aramaki wrote:Fluxbox+Lunar Linux. Pilsner gtk theme this time.
Really nice, once again!!!
How many times per month do you change your config?
Thanks. i change the fluxbox setup mostly once every two days. Ideal stress buster for me, at least until my girlfriend comes back from Japan next Friday.
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
froli wrote:Daisuke_Aramaki wrote:Fluxbox+Lunar Linux. Pilsner gtk theme this time.
Really nice, once again!!!
How many times per month do you change your config?
Thanks. i change the fluxbox setup mostly once every two days. Ideal stress buster for me, at least until my girlfriend comes back from Japan next Friday.
Well, I tought I was a bit maniac by changing my config every month...
Fortunately, It's not your WM that you change every two days
archlinux on Macbook Pro 10,1
Offline
Daisuke_Aramaki wrote:froli wrote:Really nice, once again!!!
How many times per month do you change your config?
Thanks. i change the fluxbox setup mostly once every two days. Ideal stress buster for me, at least until my girlfriend comes back from Japan next Friday.
Well, I tought I was a bit maniac by changing my config every month...
Fortunately, It's not your WM that you change every two days
i alternate between evilwm, dwm and fluxbox, thats about it. nothing else is installed on all my machines.
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
Fluxbox+Lunar Linux. Pilsner gtk theme this time.
please tell me what font you use in the menu
Offline
Daisuke_Aramaki wrote:Fluxbox+Lunar Linux. Pilsner gtk theme this time.
please tell me what font you use in the menu
HeldustryFTV Basic Demi
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
ri wrote:Daisuke_Aramaki wrote:Fluxbox+Lunar Linux. Pilsner gtk theme this time.
please tell me what font you use in the menu
HeldustryFTV Basic Demi
where can i find it? have searched a bit but without any luck
edit: nevermind found it...
Last edited by ri (2009-05-19 19:00:50)
Offline
froli wrote:Daisuke_Aramaki wrote:Thanks. i change the fluxbox setup mostly once every two days. Ideal stress buster for me, at least until my girlfriend comes back from Japan next Friday.
Well, I tought I was a bit maniac by changing my config every month...
Fortunately, It's not your WM that you change every two days
i alternate between evilwm, dwm and fluxbox, thats about it. nothing else is installed on all my machines.
So if you had to pick, which would be your only window manager? I've pretty much settled on Evilwm myself.
Offline