From 0bec64f668d5f133bb6cc64f1e537272398f4b19 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 4 Apr 2010 23:37:52 +0200 Subject: added colors for pipes and sockets --- ranger/colorschemes/default.py | 7 ++++++- ranger/gui/context.py | 2 +- ranger/gui/widgets/browsercolumn.py | 10 ++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index 9d07fd10..fbfaf479 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -43,9 +43,14 @@ class Default(ColorScheme): attr |= bold fg = blue elif context.executable and not \ - any((context.media, context.container)): + any((context.media, context.container, + context.fifo, context.socket)): attr |= bold fg = green + if context.socket: + fg = magenta + if context.fifo: + fg = yellow if context.link: fg = context.good and cyan or magenta if context.tag_marker and not context.selected: diff --git a/ranger/gui/context.py b/ranger/gui/context.py index d31124ca..453eb9dc 100644 --- a/ranger/gui/context.py +++ b/ranger/gui/context.py @@ -17,7 +17,7 @@ CONTEXT_KEYS = ['reset', 'error', 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console', 'in_pager', 'in_taskview', 'directory', 'file', 'hostname', - 'executable', 'media', 'link', + 'executable', 'media', 'link', 'fifo', 'socket', 'video', 'audio', 'image', 'media', 'document', 'container', 'selected', 'empty', 'main_column', 'message', 'background', 'good', 'bad', diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 44d1e579..9a7dfe9c 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -266,8 +266,14 @@ class BrowserColumn(Pager): else: this_color.append('file') - if drawn.stat is not None and drawn.stat.st_mode & stat.S_IXUSR: - this_color.append('executable') + if drawn.stat: + mode = drawn.stat.st_mode + if mode & stat.S_IXUSR: + this_color.append('executable') + if stat.S_ISFIFO(mode): + this_color.append('fifo') + if stat.S_ISSOCK(mode): + this_color.append('socket') if drawn.islink: this_color.append('link') -- cgit 1.4.1-2-gfad0