about summary refs log tree commit diff stats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* applied Sanders tiny patchesAnselm R.Garbe2006-08-081-1/+1
|
* typo fixarg@10ksloc.org2006-08-071-1/+1
|
* applied Sanders man page/Makefile patcharg@10ksloc.org2006-08-071-1/+1
|
* added stripping to dwm target in Makefilearg@10ksloc.org2006-08-071-0/+1
|
* removed CONFIGarg@10ksloc.org2006-08-031-3/+2
|
* make config.h not a time dependencearg@10ksloc.org2006-08-031-1/+1
|
* removed rm config.h from cleanarg@10ksloc.org2006-08-031-1/+1
|
* added gmake compliancearg@10ksloc.org2006-08-031-2/+2
|
* applied Jukka's diffarg@10ksloc.org2006-08-031-4/+5
|
* applied Sanders Makefile patcharg@10ksloc.org2006-08-031-26/+20
|
* using SRC instead of *.carg@10ksloc.org2006-08-031-1/+1
|
* changed the files included in make distarg@10ksloc.org2006-08-031-1/+2
|
* applied Sanders doc changes, added a PHONY line and changed the output of ↵arg@10ksloc.org2006-08-031-1/+4
| | | | config.h creation somewhat
* implemented the idea presented by Sander for dwm targetarg@10ksloc.org2006-08-021-1/+4
|
* applied Sanders patchesarg@10ksloc.org2006-08-011-2/+1
|
* makefile now sets permissions for executables and man pagesarg@10ksloc.org2006-07-201-0/+6
|
* simplified MakefileAnselm R. Garbe2006-07-171-2/+2
|
* rearranged several stuffAnselm R. Garbe2006-07-151-1/+1
|
* rearrangedAnselm R. Garbe2006-07-141-1/+1
|
* draw bar on exposure ;)Anselm R. Garbe2006-07-141-1/+1
|
* prep 0.1 0.1Anselm R. Garbe2006-07-141-1/+1
|
* implemented bar for dwm (I miss status text), I plan that status text is ↵Anselm R. Garbe2006-07-141-1/+1
| | | | read from stdin in dwm
* changed default colorsAnselm R. Garbe2006-07-131-2/+2
|
* added dev.c instead of kb.cAnselm R. Garbe2006-07-131-1/+1
|
* added logo+descriptionAnselm R. Garbe2006-07-131-12/+12
|
* removed unnecessary crapAnselm R. Garbe2006-07-131-16/+10
|
* added grid mode on Mod1Mask gAnselm R. Garbe2006-07-121-1/+1
|
* added mouse-based resizalsAnselm R. Garbe2006-07-111-1/+1
|
* removed unnecessary sel stuffAnselm R. Garbe2006-07-111-8/+2
|
* added gridsel to gridwmAnselm R. Garbe2006-07-111-2/+8
|
* added key handlingAnselm R. Garbe2006-07-111-1/+1
|
* added several other stuffAnselm R. Garbe2006-07-101-2/+2
|
* renamed gridmenu.c into menu.cAnselm R. Garbe2006-07-101-1/+1
|
* several new changes, made gridmenu workingAnselm R. Garbe2006-07-101-4/+10
|
* added new stuffAnselm R. Garbe2006-07-101-6/+6
|
* added gridmenuAnselm R. Garbe2006-07-101-3/+35
|
* initial importAnselm R. Garbe2006-07-101-0/+23
an class="kc">None,) * 8 (content_loaded, force_load, is_device, is_directory, is_file, is_fifo, is_link, is_socket, accessible, exists, # "exists" currently means "link_target_exists" loaded, marked, runnable, stopped, tagged, audio, container, document, image, media, video) = (False,) * 21 mimetype_tuple = () size = 0 def __init__(self, path, preload=None, path_is_abs=False): if not path_is_abs: path = abspath(path) self.path = path self.basename = basename(path) self.basename_lower = self.basename.lower() self.extension = splitext(self.basename)[1].lstrip(extsep) or None self.dirname = dirname(path) self.preload = preload try: lastdot = self.basename.rindex('.') + 1 self.extension = self.basename[lastdot:].lower() except ValueError: self.extension = None def __repr__(self): return "<{0} {1}>".format(self.__class__.__name__, self.path) @lazy_property def shell_escaped_basename(self): return shell_escape(self.basename) @lazy_property def filetype(self): try: return spawn(["file", '-Lb', '--mime-type', self.path]) except OSError: return "" @lazy_property def basename_natural(self): return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \ enumerate(_extract_number_re.split(self.basename))] @lazy_property def basename_natural_lower(self): return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \ enumerate(_extract_number_re.split(self.basename_lower))] for attr in ('video', 'audio', 'image', 'media', 'document', 'container'): exec("%s = lazy_property(" "lambda self: self.set_mimetype() or self.%s)" % (attr, attr)) def __str__(self): """returns a string containing the absolute path""" return str(self.path) def use(self): """Used in garbage-collecting. Override in Directory""" def set_mimetype(self): """assign attributes such as self.video according to the mimetype""" basename = self.basename if self.extension == 'part': basename = basename[0:-5] self._mimetype = self.fm.mimetypes.guess_type(basename, False)[0] if self._mimetype is None: self._mimetype = '' self.video = self._mimetype.startswith('video') self.image = self._mimetype.startswith('image') self.audio = self._mimetype.startswith('audio') self.media = self.video or self.image or self.audio self.document = self._mimetype.startswith('text') self.container = self.extension in CONTAINER_EXTENSIONS keys = ('video', 'audio', 'image', 'media', 'document', 'container') self._mimetype_tuple = tuple(key for key in keys if getattr(self, key)) if self._mimetype == '': self._mimetype = None @property def mimetype(self): try: return self._mimetype except: self.set_mimetype() return self._mimetype @property def mimetype_tuple(self): try: return self._mimetype_tuple except: self.set_mimetype() return self._mimetype_tuple def mark(self, boolean): directory = self.env.get_directory(self.dirname) directory.mark_item(self) def _mark(self, boolean): """Called by directory.mark_item() and similar functions""" self.marked = bool(boolean) @lazy_property def realpath(self): if self.is_link: try: return realpath(self.path) except: return None # it is impossible to get the link destination return self.path def load(self): """ reads useful information about the filesystem-object from the filesystem and caches it for later use """ self.fm.update_preview(self.path) self.loaded = True # Get the stat object, either from preload or from [l]stat self.permissions = None new_stat = None path = self.path is_link = False if self.preload: new_stat = self.preload[1] is_link = new_stat.st_mode & 0o170000 == 0o120000 if is_link: new_stat = self.preload[0] self.preload = None self.exists = True if new_stat else False else: try: new_stat = lstat(path) is_link = new_stat.st_mode & 0o170000 == 0o120000 if is_link: new_stat = stat(path) self.exists = True except: self.exists = False # Set some attributes self.accessible = True if new_stat else False mode = new_stat.st_mode if new_stat else 0 format = mode & 0o170000 if format == 0o020000 or format == 0o060000: # stat.S_IFCHR/BLK self.is_device = True self.size = 0 self.infostring = 'dev' elif format == 0o010000: # stat.S_IFIFO self.is_fifo = True self.size = 0 self.infostring = 'fifo' elif format == 0o140000: # stat.S_IFSOCK self.is_socket = True self.size = 0 self.infostring = 'sock' elif self.is_file: if new_stat: self.size = new_stat.st_size self.infostring = ' ' + human_readable(self.size) else: self.size = 0 self.infostring = '?' elif self.is_directory: try: self.size = len(listdir(path)) # bite me except OSError: self.size = 0 self.infostring = '?' self.accessible = False else: self.infostring = ' %d' % self.size self.accessible = True self.runnable = True if is_link: self.infostring = '->' + self.infostring self.is_link = True self.stat = new_stat def get_permission_string(self): if self.permissions is not None: return self.permissions if self.is_directory: perms = ['d'] elif self.is_link: perms = ['l'] else: perms = ['-'] mode = self.stat.st_mode test = 0o0400 while test: # will run 3 times because 0o400 >> 9 = 0 for what in "rwx": if mode & test: perms.append(what) else: perms.append('-') test >>= 1 self.permissions = ''.join(perms) return self.permissions def load_if_outdated(self): """ Calls load() if the currently cached information is outdated or nonexistant. """ if not self.loaded: self.load() return True try: real_ctime = lstat(self.path).st_ctime except OSError: real_ctime = None if not self.stat or self.stat.st_ctime != real_ctime: self.load() return True return False