Merge branch 'master' of github.com:IvanMalison/dotfiles

This commit is contained in:
Ivan Malison 2016-10-18 20:52:10 -07:00
commit 9f7f554984
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
14 changed files with 149 additions and 64 deletions

View File

@ -37,3 +37,4 @@
/user-dirs.locale
/vlc/
/xfce4/
/Popcorn-Time/

View File

@ -19,7 +19,7 @@
</match>
<match target="pattern">
<test qual="any" name="family"><string>roboto mono</string></test>
<edit name="family" mode="assign" binding="same"><string>Ubuntu</string></edit>
<edit name="family" mode="assign" binding="same"><string>Roboto</string></edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>

View File

@ -6,15 +6,14 @@ gtk-fallback-icon-theme=gnome
gtk-icon-theme-name=Numix
gtk-font-name=Roboto 11
gtk-cursor-theme-name=Paper
gtk-cursor-theme-size=24
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=0
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-modules=canberra-gtk-module

View File

@ -0,0 +1,10 @@
[Unit]
Description=mopidy
[Service]
Type=simple
ExecStart=/usr/bin/env mopidy
ExecStop=/usr/bin/pkill mopidy
[Install]
WantedBy=wm.target

View File

@ -9,8 +9,13 @@
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
* About
This README is a literate version of my emacs configuration, but it
also serves as the README for my dotfiles.
This is my emacs configuration in literate form. It aspires to be like the
incredibly well commented literate configurations of [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua]] and [[http://doc.rix.si/cce/cce.html][Ryan Rix]],
but I haven't quite gotten around to polishing it to the point where nearly
every section has commentary explaining why it is there, as those two have.
Still, there are definitely a few sections of which I am quite proud, and that
others may find to be useful.
* Early
The configurations in this section need to occur early in emacs startup for some reason or another.
** Lexical Binding
@ -131,15 +136,16 @@ Sets environment variables by starting a shell.
(exec-path-from-shell-initialize)))))
#+END_SRC
** Non-Forking Shell Command To String
Emacs' built in ~shell-command-to-string~ function has the downside that it forks a new shell process every time it is executed. This means that any shell startup cost is incurred when this function is called.
Emacs' built in ~shell-command-to-string~ function has the downside that it
forks a new shell process every time it is executed. This means that any shell
startup cost is incurred when this function is called.
The following implementation uses eshell's ~eshell-search-path~ to find the binary (which is the only reason ~shell-comand-to-string~ is typically used anyway), but it avoids incurring any shell-startup cost.
The following implementation uses eshell's ~executable-find~ to find the
binary (which is the only reason ~shell-comand-to-string~ is typically used
anyway), but it avoids incurring any shell-startup cost.
This was originally inspired by [[https://github.com/bbatsov/projectile/issues/1044][this issue]].
#+BEGIN_SRC emacs-lisp
;; We use `eshell-search-path' for this hack
(require 'eshell)
(defun imalison:call-process-to-string (program &rest args)
(with-temp-buffer
(apply 'call-process program nil (current-buffer) nil args)
@ -148,7 +154,7 @@ This was originally inspired by [[https://github.com/bbatsov/projectile/issues/1
(defun imalison:get-call-process-args-from-shell-command (command)
(cl-destructuring-bind
(the-command . args) (split-string command " ")
(let ((binary-path (eshell-search-path the-command)))
(let ((binary-path (executable-find the-command)))
(when binary-path
(cons binary-path args)))))
@ -539,7 +545,6 @@ the ~:around~ keyword of advice-add.
(imalison:named-builder imalison:compose-around-builder)
#+END_SRC
*** Do When
*** Measure Time
#+BEGIN_SRC emacs-lisp
(defmacro imalison:measure-time (&rest body)
@ -601,29 +606,38 @@ the ~:around~ keyword of advice-add.
** Font Size
This was taken from [[http://emacs.stackexchange.com/questions/7583/transiently-adjust-text-size-in-mode-line-and-minibuffer][here]] but it has diverged significantly from the original.
#+BEGIN_SRC emacs-lisp
(setq imalison:default-font-size-pt
(defvar imalison:default-font-size-pt
(cond ((eq system-type 'darwin) 120)
((eq system-type 'gnu/linux) 105)))
(cl-defun imalison:set-font-size (&optional (arg 10))
(defvar imalison:huge-font-size 280)
(defun imalison:current-font-size ()
(plist-get (custom-face-attributes-get 'default nil) :height))
(defun imalison:set-font-size (size)
(interactive (list (string-to-number (read-string "Enter a font size: "))))
(set-face-attribute 'default nil :height size))
(defun imalison:set-huge-font-size ()
(interactive)
(imalison:set-font-size imalison:huge-font-size))
(cl-defun imalison:modify-font-size (&optional (arg 10))
(interactive "p")
(let ((current-height
(plist-get (custom-face-attributes-get 'default nil) :height)))
(set-face-attribute 'default nil :height
(+ current-height arg))))
(imalison:set-font-size (+ (imalison:current-font-size) arg)))
(defun imalison:font-size-incr ()
(interactive)
(imalison:set-font-size +10))
(imalison:modify-font-size +10))
(defun imalison:font-size-decr ()
(interactive)
(imalison:set-font-size -10))
(imalison:modify-font-size -10))
(defun imalison:font-size-reset ()
(interactive)
(set-face-attribute 'default nil
:height imalison:default-font-size-pt))
(imalison:set-font-size imalison:default-font-size-pt))
#+END_SRC
** Message Result Builder
This macro is useful when writing emacs-lisp. It creates a new interactive command that shows you the result of evaluating a function, with optionally provided arguments.
@ -758,7 +772,7 @@ A macro for composing functions together to build an interactive command to copy
(defun imalison:edit-script ()
(interactive)
(find-file (eshell-search-path
(find-file (executable-find
(ido-completing-read "Select a script to edit: "
(imalison:get-executables-on-path)))))
#+END_SRC
@ -770,6 +784,23 @@ A macro for composing functions together to build an interactive command to copy
(message "Setting lexical-binding to: %s" new-binding)
(setq lexical-binding new-binding)))
#+END_SRC
** Sync kill ring with copyq
#+BEGIN_SRC emacs-lisp
(defun imalison:copyq-get (i)
(imalison:shell-command-to-string (format "copyq eval read(%s)" i)))
(defun imalison:copyq-sync ()
(interactive)
(let ((missing-items (cl-loop for i from 0 to (string-to-number
(imalison:shell-command-to-string "copyq eval size()"))
for item = (imalison:copyq-get i)
when (not (member item kill-ring))
collect item)))
(setq kill-ring (nconc kill-ring missing-items))))
(when (executable-find "copyq")
(run-with-idle-timer 10 nil 'imalison:copyq-sync))
#+END_SRC
** Other
The stuff in this section is pretty crusty. I don't think its used anywhere, but
I keep it around just in case I need it.
@ -1271,9 +1302,11 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
nil
"Resize Font"
("-" imalison:font-size-decr "Decrease")
("=" imalison:font-size-incr "Increase")
("d" imalison:font-size-decr "Decrease")
("=" imalison:font-size-incr "Increase")
("+" imalison:font-size-incr "Increase")
("i" imalison:font-size-incr "Increase")
("h" imalison:set-huge-font-size "Huge")
("f" set-frame-font "Set Frame Font")
("0" imalison:font-size-reset "Reset to default size"))
@ -1784,7 +1817,7 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
*** magithub
#+BEGIN_SRC emacs-lisp
(use-package magithub
:if (eshell-search-path "hub")
:if (executable-find "hub")
:after magit
:disabled t)
#+END_SRC
@ -2499,6 +2532,16 @@ Intero seems to be causing hangs, so it has been disabled
("M-," . pop-tag-mark)))
(add-hook 'c-mode-common-hook 'imalison:cc-mode-hook)))
#+END_SRC
*** C#
#+BEGIN_SRC emacs-lisp
(use-package csharp-mode
:mode "\\.cs\\'")
#+END_SRC
*** racket
#+BEGIN_SRC emacs-lisp
(use-package racket-mode
:mode "\\.rkt\\'")
#+END_SRC
** Data/Config/Protocol
*** thrift
#+BEGIN_SRC emacs-lisp
@ -3138,16 +3181,6 @@ Intero seems to be causing hangs, so it has been disabled
(use-package jq-mode
:mode "\\.jq\\'")
#+END_SRC
*** C#
#+BEGIN_SRC emacs-lisp
(use-package csharp-mode
:mode "\\.cs\\'")
#+END_SRC
*** racket
#+BEGIN_SRC emacs-lisp
(use-package racket-mode
:mode "\\.rkt\\'")
#+END_SRC
* Programming
** realgud
realgud provides debugging support with many external debuggers in emacs
@ -3281,7 +3314,8 @@ crux-reopen-as-root-mode makes it so that any file owned by root will automatica
(use-package crux
:demand t
:bind (("C-c C-s" . crux-sudo-edit)
("C-c C-r" . crux-eval-and-replace))
("C-c C-r" . crux-eval-and-replace)
("C-c o" . crux-open-with))
:config
(progn
(crux-reopen-as-root-mode)))
@ -3690,7 +3724,15 @@ Not really sure what this is
** gmail-message-mode
This is useful with server mode when editing gmail messages. I think that it is not currently working, or it may need to be manually enabled.
#+BEGIN_SRC emacs-lisp
(use-package gmail-message-mode)
(use-package gmail-message-mode
:demand t)
#+END_SRC
** ham-mode
#+BEGIN_SRC emacs-lisp
(use-package ham-mode
:config
(progn
(setq ham-mode-html-to-markdown-command '("pandoc" "--from" "html" "--to" "markdown" file))))
#+END_SRC
** alert
#+BEGIN_SRC emacs-lisp
@ -3996,6 +4038,11 @@ Ensure all themes that I use are installed:
(ensure-packages-installed packages-appearance)
#+END_SRC
** all-the-icons
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:demand t)
#+END_SRC
** spaceline
*** Disable sRGB colorspace to make powerline separators work
#+BEGIN_SRC emacs-lisp
@ -4005,6 +4052,7 @@ Ensure all themes that I use are installed:
#+BEGIN_SRC emacs-lisp
(use-package spaceline-config
:ensure spaceline
:commands spaceline-compile
:preface
(progn
(defun spaceline-gh-notifier-disable-default-notifier-modeline (&rest args)
@ -4019,9 +4067,11 @@ Ensure all themes that I use are installed:
(setq powerline-default-separator (random-choice '(butt slant wave)))
(setq spaceline-workspace-numbers-unicode t
spaceline-window-numbers-unicode t)
(if (display-graphic-p)
(setq-default powerline-default-separator 'wave)
(setq-default powerline-default-separator 'utf-8))
(spaceline-define-segment imalison:muni
"Display the number of minutes until the next muni train comes"
(format "🚇%s" (imalison:get-cached-muni-time))
@ -4032,7 +4082,14 @@ Ensure all themes that I use are installed:
(format "✉%s" github-notifier-unread-count)
:when (> github-notifier-unread-count 0))
(setq powerline-height 25)
(advice-add 'pl/separator-height :around
(lambda (function &rest args)
(+ (apply function args) 10)))
;; This needs to be executed after setting the font because the separators
;; need to get regenerated
(advice-add 'imalison:set-font-size :after 'spaceline-compile)
(spaceline-helm-mode)
;; 'spaceline-gh-notifier and 'imalison:muni disabled for now
(spaceline-spacemacs-theme)))
@ -4153,7 +4210,9 @@ load-theme hook (See the heading below).
(progn
(load-theme 'source-code-pro t)
(message "not setting font")))
(setq powerline-default-separator (if (display-graphic-p) 'wave 'utf-8))
(load-theme imalison:dark-theme t)
(spaceline-compile)
(imalison:remove-fringe-and-hl-line-mode))
;; This is needed because you can't set the font or theme at daemon start-up.

View File

@ -1,11 +0,0 @@
(defun imalison:copyq-get (i)
(imalison:shell-command-to-string (format "copyq eval read(%s)" i)))
(defun imalison:copyq-sync ()
(interactive)
(let ((missing-items (cl-loop for i from 0 to (string-to-int
(imalison:shell-command-to-string "copyq eval size()"))
for item = (imalison:copyq-get i)
when (not (member item kill-ring))
collect item)))
(setq kill-ring (nconc kill-ring missing-items))))

View File

@ -2,3 +2,19 @@ binding "gtk-emacs-text-entry"
{
bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) }
}
gtk-theme-name="Paper"
gtk-icon-theme-name="Paper"
gtk-font-name="Roboto 11"
gtk-cursor-theme-name="Paper"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"

3
dotfiles/lib/bin/screenshot.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
scrot "$(rofi -input /dev/null -dmenu)"

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
bash -c "$(rofi -input /dev/null -dmenu)"

View File

@ -69,6 +69,8 @@ addKeys conf@XConfig {modMask = modm} =
, ((mod3Mask .|. shiftMask, xK_e), shiftTo Next EmptyWS)
, ((mod3Mask, xK_v), spawn "copyq_rofi.sh")
, ((mod3Mask, xK_p), spawn "system_password.sh")
, ((mod3Mask, xK_s), spawn "screenshot.sh")
, ((mod3Mask, xK_c), spawn "shell_command.sh")
-- playerctl
, ((mod3Mask, xK_f), spawn "playerctl play-pause")

View File

@ -1,3 +1,7 @@
Gtk/KeyThemeName "Emacs"
Xft/DPI 98304
Net/ThemeName "Paper"
Xft/Hinting 1
Xft/RGBA "rgb"
Xft/HintStyle "hintslight"
Xft/Antialias 1

View File

@ -27,13 +27,13 @@ PACKAGES = [
"festival-freebsoft-utils", "hsetroot", "imwheel", "remmina", "racket",
"xorg-utils", "playerctl", "pasystray", "dunst", "otf-fira-code",
"ttf-mac-fonts", "otf-hermit", "ttf-font-awesome", "ttf-monaco", "tcpdump",
"ngrep", "wireshark-gtk", "teamviewer", "mopidy-podcast",
"kdegraphics-okular",
"ngrep", "wireshark-gtk", "teamviewer", "mopidy-podcast", "tigervnc",
"kdegraphics-okular", "pandoc",
]
SERVICES = [
"sshd.socket", "nvidia-persistenced.service", "NetworkManager.service", "teamviewerd.service",
"sshd.socket", "nvidia-persistenced.service", "NetworkManager.service", "teamviewerd.service", "--user vncserver@:1"
]

View File

@ -55,7 +55,6 @@ brew 'nmap'
brew 'offline-imap'
brew 'openssl'
brew 'ossp-uuid'
brew 'pandoc'
brew 'pango'
brew 'pcre'
brew 'pixman'

View File

@ -27,7 +27,7 @@ brew 'ngrep'
brew 'nmap'
brew 'node'
brew 'openssl'
brew 'pyenv'
brew 'pandoc'
brew 'pyenv'
brew 'pypy'
brew 'python'