Skip to content

Commit

Permalink
[Icons] Add support for directory-specific icons.
Browse files Browse the repository at this point in the history
Fixes #733
  • Loading branch information
Alexander-Miller committed Apr 8, 2023
1 parent 7c6628a commit f68a846
Show file tree
Hide file tree
Showing 27 changed files with 150 additions and 53 deletions.
2 changes: 2 additions & 0 deletions Changelog.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

* Changelog
** current master
** v3.1
- Added ~treemacs-create-workspace-from-project~ command
- Added ~treemacs-project-follow-into-home~ option
- Treemacs can now be resized with the mouse, even when it width is locked
- Added support for directory-specific icons
- Bug fixes
** v3
- Complete rewrite of the extension api
Expand Down
14 changes: 11 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ overview looks as follows:
to the treemacs workspace. ~project.el~ compatibility is built-in.
* Simple mouse interface :: Left clicks will work the same as you're used to from with graphical applications
* Session persistence :: Treemacs automatically saves and restores your workspaces.
* Dashing good looks :: Treemacs uses (optionally resizable) png images in HD 22x22 resolution for its icons (quantity
is, of course, another matter). When run in a terminal a simple fallback is used.
* Dashing good looks :: Treemacs uses (optionally resizable) png images in HD 22x22 resolution for its icons. When run
in a terminal a simple fallback is used.
* Tag view :: Treemacs can display files' tags. All file types that Emacs can generate a (semantic) imenu index for are
supported.
* Visual feedback :: When it would otherwise be difficult to see the message in the minibuffer success/failure is
Expand Down Expand Up @@ -742,7 +742,6 @@ for its name or declaring icon directories:
(treemacs-define-custom-icon treemacs-custom-html-icon "html" "htm")
#+END_SRC


*Important*: There is a restriction that all icons must must be exactly 2 characters long. That's including the space
that will separate an icon from the filename.

Expand All @@ -752,6 +751,15 @@ If you want to create an icon based on an image you can use ~treemacs-define-cus
(treemacs-define-custom-image-icon "/path/to/icon.png" "htm" "html")
#+END_SRC

For icons of directories two icon variants are needed: one for an open and one for a closed directory state. These can
be indicated with a simple ~"-open"~ and ~"-closed"~ suffix. For example the following lines will add special icons for
directories named "scripts":

#+BEGIN_SRC emacs-lisp
(treemacs-define-custom-icon "X " "scripts-closed")
(treemacs-define-custom-icon "Y " "scripts-open")
#+END_SRC

**** Icons according to ~auto-mode-alist~
For some file extensions, like ".cc" or ".hh", it is not immediately obvious which major mode will open these files, and
thus which icon they should be assigned. Treemacs offers the option that automate this decision based on
Expand Down
1 change: 1 addition & 0 deletions icons/default/vsc/dir-binary-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-binary-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-docs-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-docs-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-git-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-git-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-github-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-github-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-images-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-images-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-private-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-private-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-public-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/default/vsc/dir-public-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f68a846

Please sign in to comment.