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 /user-dirs.locale
/vlc/ /vlc/
/xfce4/ /xfce4/
/Popcorn-Time/

View File

@ -19,7 +19,7 @@
</match> </match>
<match target="pattern"> <match target="pattern">
<test qual="any" name="family"><string>roboto mono</string></test> <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> </match>
<dir>~/.fonts</dir> <dir>~/.fonts</dir>
</fontconfig> </fontconfig>

View File

@ -6,15 +6,14 @@ gtk-fallback-icon-theme=gnome
gtk-icon-theme-name=Numix gtk-icon-theme-name=Numix
gtk-font-name=Roboto 11 gtk-font-name=Roboto 11
gtk-cursor-theme-name=Paper gtk-cursor-theme-name=Paper
gtk-cursor-theme-size=24 gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0 gtk-button-images=1
gtk-menu-images=0 gtk-menu-images=1
gtk-enable-event-sounds=1 gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=0 gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1 gtk-xft-antialias=1
gtk-xft-hinting=1 gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb 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> #+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
* About * About
This README is a literate version of my emacs configuration, but it This is my emacs configuration in literate form. It aspires to be like the
also serves as the README for my dotfiles. 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 * Early
The configurations in this section need to occur early in emacs startup for some reason or another. The configurations in this section need to occur early in emacs startup for some reason or another.
** Lexical Binding ** Lexical Binding
@ -131,15 +136,16 @@ Sets environment variables by starting a shell.
(exec-path-from-shell-initialize))))) (exec-path-from-shell-initialize)))))
#+END_SRC #+END_SRC
** Non-Forking Shell Command To String ** 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]]. This was originally inspired by [[https://github.com/bbatsov/projectile/issues/1044][this issue]].
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; We use `eshell-search-path' for this hack
(require 'eshell)
(defun imalison:call-process-to-string (program &rest args) (defun imalison:call-process-to-string (program &rest args)
(with-temp-buffer (with-temp-buffer
(apply 'call-process program nil (current-buffer) nil args) (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) (defun imalison:get-call-process-args-from-shell-command (command)
(cl-destructuring-bind (cl-destructuring-bind
(the-command . args) (split-string command " ") (the-command . args) (split-string command " ")
(let ((binary-path (eshell-search-path the-command))) (let ((binary-path (executable-find the-command)))
(when binary-path (when binary-path
(cons binary-path args))))) (cons binary-path args)))))
@ -539,7 +545,6 @@ the ~:around~ keyword of advice-add.
(imalison:named-builder imalison:compose-around-builder) (imalison:named-builder imalison:compose-around-builder)
#+END_SRC #+END_SRC
*** Do When
*** Measure Time *** Measure Time
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:measure-time (&rest body) (defmacro imalison:measure-time (&rest body)
@ -601,29 +606,38 @@ the ~:around~ keyword of advice-add.
** Font Size ** 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. 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 #+BEGIN_SRC emacs-lisp
(setq imalison:default-font-size-pt (defvar imalison:default-font-size-pt
(cond ((eq system-type 'darwin) 120) (cond ((eq system-type 'darwin) 120)
((eq system-type 'gnu/linux) 105))) ((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") (interactive "p")
(let ((current-height (imalison:set-font-size (+ (imalison:current-font-size) arg)))
(plist-get (custom-face-attributes-get 'default nil) :height)))
(set-face-attribute 'default nil :height
(+ current-height arg))))
(defun imalison:font-size-incr () (defun imalison:font-size-incr ()
(interactive) (interactive)
(imalison:set-font-size +10)) (imalison:modify-font-size +10))
(defun imalison:font-size-decr () (defun imalison:font-size-decr ()
(interactive) (interactive)
(imalison:set-font-size -10)) (imalison:modify-font-size -10))
(defun imalison:font-size-reset () (defun imalison:font-size-reset ()
(interactive) (interactive)
(set-face-attribute 'default nil (imalison:set-font-size imalison:default-font-size-pt))
:height imalison:default-font-size-pt))
#+END_SRC #+END_SRC
** Message Result Builder ** 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. 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 () (defun imalison:edit-script ()
(interactive) (interactive)
(find-file (eshell-search-path (find-file (executable-find
(ido-completing-read "Select a script to edit: " (ido-completing-read "Select a script to edit: "
(imalison:get-executables-on-path))))) (imalison:get-executables-on-path)))))
#+END_SRC #+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) (message "Setting lexical-binding to: %s" new-binding)
(setq lexical-binding new-binding))) (setq lexical-binding new-binding)))
#+END_SRC #+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 ** Other
The stuff in this section is pretty crusty. I don't think its used anywhere, but 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. 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 nil
"Resize Font" "Resize Font"
("-" imalison:font-size-decr "Decrease") ("-" imalison:font-size-decr "Decrease")
("=" imalison:font-size-incr "Increase")
("d" imalison:font-size-decr "Decrease") ("d" imalison:font-size-decr "Decrease")
("=" imalison:font-size-incr "Increase")
("+" imalison:font-size-incr "Increase")
("i" 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") ("f" set-frame-font "Set Frame Font")
("0" imalison:font-size-reset "Reset to default size")) ("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 *** magithub
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magithub (use-package magithub
:if (eshell-search-path "hub") :if (executable-find "hub")
:after magit :after magit
:disabled t) :disabled t)
#+END_SRC #+END_SRC
@ -2499,6 +2532,16 @@ Intero seems to be causing hangs, so it has been disabled
("M-," . pop-tag-mark))) ("M-," . pop-tag-mark)))
(add-hook 'c-mode-common-hook 'imalison:cc-mode-hook))) (add-hook 'c-mode-common-hook 'imalison:cc-mode-hook)))
#+END_SRC #+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 ** Data/Config/Protocol
*** thrift *** thrift
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -3138,16 +3181,6 @@ Intero seems to be causing hangs, so it has been disabled
(use-package jq-mode (use-package jq-mode
:mode "\\.jq\\'") :mode "\\.jq\\'")
#+END_SRC #+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 * Programming
** realgud ** realgud
realgud provides debugging support with many external debuggers in emacs 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 (use-package crux
:demand t :demand t
:bind (("C-c C-s" . crux-sudo-edit) :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 :config
(progn (progn
(crux-reopen-as-root-mode))) (crux-reopen-as-root-mode)))
@ -3690,7 +3724,15 @@ Not really sure what this is
** gmail-message-mode ** 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. 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 #+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 #+END_SRC
** alert ** alert
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -3996,6 +4038,11 @@ Ensure all themes that I use are installed:
(ensure-packages-installed packages-appearance) (ensure-packages-installed packages-appearance)
#+END_SRC #+END_SRC
** all-the-icons
#+BEGIN_SRC emacs-lisp
(use-package all-the-icons
:demand t)
#+END_SRC
** spaceline ** spaceline
*** Disable sRGB colorspace to make powerline separators work *** Disable sRGB colorspace to make powerline separators work
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -4005,6 +4052,7 @@ Ensure all themes that I use are installed:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package spaceline-config (use-package spaceline-config
:ensure spaceline :ensure spaceline
:commands spaceline-compile
:preface :preface
(progn (progn
(defun spaceline-gh-notifier-disable-default-notifier-modeline (&rest args) (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 powerline-default-separator (random-choice '(butt slant wave)))
(setq spaceline-workspace-numbers-unicode t (setq spaceline-workspace-numbers-unicode t
spaceline-window-numbers-unicode t) spaceline-window-numbers-unicode t)
(if (display-graphic-p) (if (display-graphic-p)
(setq-default powerline-default-separator 'wave) (setq-default powerline-default-separator 'wave)
(setq-default powerline-default-separator 'utf-8)) (setq-default powerline-default-separator 'utf-8))
(spaceline-define-segment imalison:muni (spaceline-define-segment imalison:muni
"Display the number of minutes until the next muni train comes" "Display the number of minutes until the next muni train comes"
(format "🚇%s" (imalison:get-cached-muni-time)) (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) (format "✉%s" github-notifier-unread-count)
:when (> github-notifier-unread-count 0)) :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-helm-mode)
;; 'spaceline-gh-notifier and 'imalison:muni disabled for now ;; 'spaceline-gh-notifier and 'imalison:muni disabled for now
(spaceline-spacemacs-theme))) (spaceline-spacemacs-theme)))
@ -4151,10 +4208,12 @@ load-theme hook (See the heading below).
(set-face-attribute (set-face-attribute
'default nil :height imalison:default-font-size-pt)) 'default nil :height imalison:default-font-size-pt))
(progn (progn
(load-theme 'source-code-pro t) (load-theme 'source-code-pro t)
(message "not setting font"))) (message "not setting font")))
(load-theme imalison:dark-theme t) (setq powerline-default-separator (if (display-graphic-p) 'wave 'utf-8))
(imalison:remove-fringe-and-hl-line-mode)) (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. ;; This is needed because you can't set the font or theme at daemon start-up.
;; (when (display-graphic-p) (imalison:appearance)) ;; (when (display-graphic-p) (imalison:appearance))

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) } 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 .|. shiftMask, xK_e), shiftTo Next EmptyWS)
, ((mod3Mask, xK_v), spawn "copyq_rofi.sh") , ((mod3Mask, xK_v), spawn "copyq_rofi.sh")
, ((mod3Mask, xK_p), spawn "system_password.sh") , ((mod3Mask, xK_p), spawn "system_password.sh")
, ((mod3Mask, xK_s), spawn "screenshot.sh")
, ((mod3Mask, xK_c), spawn "shell_command.sh")
-- playerctl -- playerctl
, ((mod3Mask, xK_f), spawn "playerctl play-pause") , ((mod3Mask, xK_f), spawn "playerctl play-pause")

View File

@ -1,3 +1,7 @@
Gtk/KeyThemeName "Emacs" Gtk/KeyThemeName "Emacs"
Xft/DPI 98304 Xft/DPI 98304
Net/ThemeName "Paper" 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", "festival-freebsoft-utils", "hsetroot", "imwheel", "remmina", "racket",
"xorg-utils", "playerctl", "pasystray", "dunst", "otf-fira-code", "xorg-utils", "playerctl", "pasystray", "dunst", "otf-fira-code",
"ttf-mac-fonts", "otf-hermit", "ttf-font-awesome", "ttf-monaco", "tcpdump", "ttf-mac-fonts", "otf-hermit", "ttf-font-awesome", "ttf-monaco", "tcpdump",
"ngrep", "wireshark-gtk", "teamviewer", "mopidy-podcast", "ngrep", "wireshark-gtk", "teamviewer", "mopidy-podcast", "tigervnc",
"kdegraphics-okular", "kdegraphics-okular", "pandoc",
] ]
SERVICES = [ 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 'offline-imap'
brew 'openssl' brew 'openssl'
brew 'ossp-uuid' brew 'ossp-uuid'
brew 'pandoc'
brew 'pango' brew 'pango'
brew 'pcre' brew 'pcre'
brew 'pixman' brew 'pixman'

View File

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