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

This commit is contained in:
Ivan Malison 2016-10-25 11:46:09 -07:00
commit 16a4f6c3aa
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
8 changed files with 4864 additions and 4289 deletions

View File

@ -1,10 +1,33 @@
# -*- mode: org; -*- # -*- mode: org; -*-
I suggest you read this document at [[http://ivanmalison.github.io/dotfiles/]] or,
of course, in emacs, as the internal links that follow are unlikely to work
anywhere else (including, for example, at https://github.com/IvanMalison/dotfiles).
* About * About
This is my emacs configuration in literate form. It aspires to be like the This is my emacs configuration in literate form. It aspires to be
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]], like the incredibly well commented literate configurations of [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua]] and
but I haven't quite gotten around to polishing it to the point that those two [[http://doc.rix.si/cce/cce.html][Ryan Rix]], but I haven't quite gotten around to polishing it to the point that
have. Still, there are definitely a few sections of which I am quite proud, and that those two have. Still, there are definitely a few sections of which I am quite
others may find to be useful. proud, and that others may find to be useful.
** Highlights
These sections are the ones that have the most potential to be interesting to
others:
*** [[Functions][My functions section]]
...has a bunch of generally useful functions:
+ [[downloadfile][Download a file into a buffer]] (curl straight into a file)
+ [[editscript][Edit a script on $PATH]]
+ [[namedbuild][Named Build of Builder Macros]] and [[composemacros][A Compose Supporting Macros]]
*** Configuration of My Own Packages
- [[term-projectile][term-projectile]] and [[term-manager][term-manager]]
- [[org-projectile][org-projectile]]
- [[multi-line][multi-line]]
- [[github-search][github-search]]
- [[flimenu][flimenu]]
*** [[programminglanguages][Programming Language Configurations]]
My programming language major mode configurations can all be found [[programminglanguages][here]].
*** [[org][org-mode]]
My [[org][org-mode]] configuration is pretty comprehensive, but not super well commented.
* HTML Headers
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/> #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/> #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
@ -362,8 +385,8 @@ This is disabled for now until I figure out what to do with emit.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package request) (use-package request)
#+END_SRC #+END_SRC
** Macros ** Named Build
*** Named Build <<namedbuild>>
imalison:named-build provides a way to invoke a macro in such a way imalison:named-build provides a way to invoke a macro in such a way
that the lambda that it produces is given a name. that the lambda that it produces is given a name.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -394,7 +417,7 @@ new macro name and the -fn suffix.
`(imalison:named-builder-builder `(imalison:named-builder-builder
,name ,(intern (concat (symbol-name name) "-fn")))) ,name ,(intern (concat (symbol-name name) "-fn"))))
#+END_SRC #+END_SRC
*** Emacs Version Predicate ** Emacs Version Predicate
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:emacs-version-predicate-fn (major-version minor-version) (defmacro imalison:emacs-version-predicate-fn (major-version minor-version)
`(lambda () `(lambda ()
@ -407,8 +430,9 @@ new macro name and the -fn suffix.
(imalison:named-builder imalison:emacs-version-predicate) (imalison:named-builder imalison:emacs-version-predicate)
#+END_SRC #+END_SRC
*** Compose Functions ** Compose Functions
**** A version supporting macros *** A version supporting macros
<<composemacros>>
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:help-function-arglist (fn) (defun imalison:help-function-arglist (fn)
(let ((result (help-function-arglist fn))) (let ((result (help-function-arglist fn)))
@ -450,7 +474,7 @@ new macro name and the -fn suffix.
(imalison:named-builder imalison:compose) (imalison:named-builder imalison:compose)
(imalison:named-builder imalison:compose-macro) (imalison:named-builder imalison:compose-macro)
#+END_SRC #+END_SRC
**** Arbitrary arguments at every step *** Arbitrary arguments at every step
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:make-list (thing) (defun imalison:make-list (thing)
(if (listp thing) (if (listp thing)
@ -469,7 +493,7 @@ new macro name and the -fn suffix.
`(apply ,(car funcs) `(apply ,(car funcs)
(imalison:make-list (imalison:compose-with-apply-helper ,(cdr funcs)))))) (imalison:make-list (imalison:compose-with-apply-helper ,(cdr funcs))))))
#+END_SRC #+END_SRC
**** Simpler unary version *** Simpler unary version
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:compose-unary (&rest funcs) (defmacro imalison:compose-unary (&rest funcs)
"Build a new function with NAME that is the composition of FUNCS." "Build a new function with NAME that is the composition of FUNCS."
@ -482,16 +506,16 @@ new macro name and the -fn suffix.
'arg 'arg
`(funcall ,(car funcs) (imalison:compose-helper-unary ,(cdr funcs))))) `(funcall ,(car funcs) (imalison:compose-helper-unary ,(cdr funcs)))))
#+END_SRC #+END_SRC
*** Make Interactive ** Make Interactive
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:make-interactive-fn (function) (defmacro imalison:make-interactive-fn (function)
`(lambda (&rest args) `(lambda (&rest args)
(interactive) (interactive)
(apply ,function args))) (apply ,function args)))
(imalison:named-builder imalison:make-interactive) (imalison:named-builder imalison:make-interactive)
#+END_SRC #+END_SRC
*** Advice Add Around Builder ** Advice Add Around Builder
For composing functions with an apply so that they can be used with For composing functions with an apply so that they can be used with
the ~:around~ keyword of advice-add. the ~:around~ keyword of advice-add.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -501,11 +525,11 @@ the ~:around~ keyword of advice-add.
(imalison:named-builder imalison:advice-add-around-builder) (imalison:named-builder imalison:advice-add-around-builder)
#+END_SRC #+END_SRC
**** Kill New *** Kill New
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(imalison:advice-add-around-builder imalison:kill-new-around kill-new) (imalison:advice-add-around-builder imalison:kill-new-around kill-new)
#+END_SRC #+END_SRC
*** Let Around ** Let Around
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:let-around-fn (orig-func &rest forms) (defmacro imalison:let-around-fn (orig-func &rest forms)
(let* ((orig-interactive-form (interactive-form orig-func)) (let* ((orig-interactive-form (interactive-form orig-func))
@ -520,18 +544,18 @@ the ~:around~ keyword of advice-add.
(imalison:named-builder imalison:let-around) (imalison:named-builder imalison:let-around)
#+END_SRC #+END_SRC
*** Let Around Advice ** Let Around Advice
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:let-advise-around-fn (&rest forms) (defmacro imalison:let-advise-around-fn (&rest forms)
`(lambda (orig-func &rest args) `(lambda (orig-func &rest args)
(let ,forms (let ,forms
(apply orig-func args)))) (apply orig-func args))))
(imalison:named-builder imalison:let-advise-around) (imalison:named-builder imalison:let-advise-around)
#+END_SRC #+END_SRC
*** Compose Around Builder ** Compose Around Builder
For composing functions with an apply so that they can be used with the ~:around~ keyword of advice-add. For composing functions with an apply so that they can be used with the ~:around~ keyword of advice-add.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; TODO/XXX: Isn't this just apply? why doesn't apply work here ;; TODO/XXX: Isn't this just apply? why doesn't apply work here
(defun imalison:around-identity (fn &rest args) (defun imalison:around-identity (fn &rest args)
(apply fn args)) (apply fn args))
@ -540,8 +564,8 @@ the ~:around~ keyword of advice-add.
`(imalison:compose-fn ,@functions imalison:around-identity)) `(imalison:compose-fn ,@functions imalison:around-identity))
(imalison:named-builder imalison:compose-around-builder) (imalison:named-builder imalison:compose-around-builder)
#+END_SRC #+END_SRC
*** Measure Time ** Measure Time
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro imalison:measure-time (&rest body) (defmacro imalison:measure-time (&rest body)
"Measure and return the running time of the code block." "Measure and return the running time of the code block."
@ -732,6 +756,7 @@ A macro for composing functions together to build an interactive command to copy
(perform-replace "\\n" "\n" nil nil delimited nil nil beg end nil))))) (perform-replace "\\n" "\n" nil nil delimited nil nil beg end nil)))))
#+END_SRC #+END_SRC
** Download a File Into a Buffer ** Download a File Into a Buffer
<<downloadfile>>
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:download-to-buffer (uri) (defun imalison:download-to-buffer (uri)
(interactive (list (read-string "Enter uri: "))) (interactive (list (read-string "Enter uri: ")))
@ -755,6 +780,9 @@ A macro for composing functions together to build an interactive command to copy
(intern (mapconcat 'imalison:maybe-symbol-name args ""))) (intern (mapconcat 'imalison:maybe-symbol-name args "")))
#+END_SRC #+END_SRC
** Edit a script on PATH ** Edit a script on PATH
<<editscript>> Note that you'll need to make sure that emacs properly inherits
the path variable for this work. Check out my [[exec-path-from-shell]] config for
details.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun imalison:get-executables-at-path (filepath) (defun imalison:get-executables-at-path (filepath)
(when (and (file-exists-p filepath) (f-directory? filepath)) (when (and (file-exists-p filepath) (f-directory? filepath))
@ -797,6 +825,47 @@ A macro for composing functions together to build an interactive command to copy
(when (executable-find "copyq") (when (executable-find "copyq")
(run-with-idle-timer 10 nil 'imalison:copyq-sync)) (run-with-idle-timer 10 nil 'imalison:copyq-sync))
#+END_SRC #+END_SRC
** helm-zsh-history
This was stolen from https://github.com/jwiegley/dot-emacs
#+BEGIN_SRC emacs-lisp
(defvar helm-c-source-zsh-history
'((name . "Zsh History")
(candidates . helm-c-zsh-history-set-candidates)
(action . (("Execute Command" . helm-c-zsh-history-action)))
(volatile)
(requires-pattern . 3)
(delayed)))
(defun helm-c-zsh-history-set-candidates (&optional request-prefix)
(let ((pattern (replace-regexp-in-string
" " ".*"
(or (and request-prefix
(concat request-prefix
" " helm-pattern))
helm-pattern))))
(with-current-buffer (find-file-noselect "~/.zsh_history" t t)
(auto-revert-mode -1)
(goto-char (point-max))
(loop for pos = (re-search-backward pattern nil t)
while pos
collect (replace-regexp-in-string
"\\`:.+?;" ""
(buffer-substring (line-beginning-position)
(line-end-position)))))))
(defun helm-c-zsh-history-action (candidate)
(imalison:named-compile candidate))
(defun helm-command-from-zsh ()
(interactive)
(require 'helm)
(helm-other-buffer 'helm-c-source-zsh-history "*helm zsh history*"))
#+END_SRC
*** Use projectile as default directory
#+BEGIN_SRC emacs-lisp
(imalison:let-around imalison:projectile-helm-command-from-zsh helm-command-from-zsh
(default-directory (projectile-project-root)))
#+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.
@ -999,6 +1068,20 @@ Set the default fill-column
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq-default fill-column 80) (setq-default fill-column 80)
#+END_SRC #+END_SRC
** Show Trailing Whitespace
Trailing whitespace is really messy and annoying, which makes this a must-have
in my opinion. It's kind of crazy how often you will encounter serious codebases
with random whitespace ALL over the place.
#+BEGIN_SRC emacs-lisp
(setq-default show-trailing-whitespace t)
#+END_SRC
*** Disable
Unfortunately, this setting can get annoying in a lot of modes, which is why I
use this hook to disable it in those modes
#+BEGIN_SRC emacs-lisp
(defun imalison:disable-show-trailing-whitespace ()
(setq show-trailing-whitespace nil))
#+END_SRC
** Encoding ** Encoding
UTF-8 everywhere UTF-8 everywhere
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1226,6 +1309,10 @@ proced is an top like utility that runs inside of emacs. The following sets auto
:config :config
(beacon-mode 1)) (beacon-mode 1))
#+END_SRC #+END_SRC
** iregister
#+BEGIN_SRC emacs-lisp
(use-package iregister)
#+END_SRC
** discover-my-major ** discover-my-major
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package discover-my-major) (use-package discover-my-major)
@ -1302,7 +1389,7 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
:config :config
(progn (progn
(defhydra imalison:hydra-font-resize (defhydra imalison:hydra-font-resize
nil nil
"Resize Font" "Resize Font"
("-" imalison:font-size-decr "Decrease") ("-" imalison:font-size-decr "Decrease")
("d" imalison:font-size-decr "Decrease") ("d" imalison:font-size-decr "Decrease")
@ -1331,7 +1418,7 @@ https://github.com/alpaker/Fill-Column-Indicator/issues/21 for more details
(imalison:named-compile "glide up")) (imalison:named-compile "glide up"))
(defhydra imalison:compile nil "Compile" (defhydra imalison:compile nil "Compile"
("s" helm-command-from-zsh "Select a command from shell history") ("s" imalison:projectile-helm-command-from-zsh "Select a command from shell history")
("c" imalison:named-compile "Enter Custom Command") ("c" imalison:named-compile "Enter Custom Command")
("t" imalison:make-test "Test") ("t" imalison:make-test "Test")
("u" imalison:glide-up "Update Dependencies")))) ("u" imalison:glide-up "Update Dependencies"))))
@ -1599,42 +1686,6 @@ I use helm for almost all emacs completion
(use-package jump-char (use-package jump-char
:bind (("C-;" . jump-char-forward))) :bind (("C-;" . jump-char-forward)))
#+END_SRC #+END_SRC
*** helm-zsh-history
This was stolen from https://github.com/jwiegley/dot-emacs
#+BEGIN_SRC emacs-lisp
(defvar helm-c-source-zsh-history
'((name . "Zsh History")
(candidates . helm-c-zsh-history-set-candidates)
(action . (("Execute Command" . helm-c-zsh-history-action)))
(volatile)
(requires-pattern . 3)
(delayed)))
(defun helm-c-zsh-history-set-candidates (&optional request-prefix)
(let ((pattern (replace-regexp-in-string
" " ".*"
(or (and request-prefix
(concat request-prefix
" " helm-pattern))
helm-pattern))))
(with-current-buffer (find-file-noselect "~/.zsh_history" t t)
(auto-revert-mode -1)
(goto-char (point-max))
(loop for pos = (re-search-backward pattern nil t)
while pos
collect (replace-regexp-in-string
"\\`:.+?;" ""
(buffer-substring (line-beginning-position)
(line-end-position)))))))
(defun helm-c-zsh-history-action (candidate)
(imalison:named-compile candidate))
(defun helm-command-from-zsh ()
(interactive)
(require 'helm)
(helm-other-buffer 'helm-c-source-zsh-history "*helm zsh history*"))
#+END_SRC
** flimenu ** flimenu
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(imalison:use-package flimenu (imalison:use-package flimenu
@ -1810,6 +1861,7 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab
(add-to-list 'org-show-context-detail '(magit-goto . lineage)) (add-to-list 'org-show-context-detail '(magit-goto . lineage))
(advice-add 'magit-diff-visit-file :after 'imalison:after-magit-visit-file) (advice-add 'magit-diff-visit-file :after 'imalison:after-magit-visit-file)
(add-hook 'magit-popup-mode-hook 'imalison:disable-show-trailing-whitespace)
(use-package magit-filenotify (use-package magit-filenotify
;; Seems like OSX does not support filenotify. ;; Seems like OSX does not support filenotify.
:disabled t :disabled t
@ -1945,6 +1997,7 @@ modeline and with excessive http requests to github.
#+END_SRC #+END_SRC
* Major Modes * Major Modes
** Programming ** Programming
<<programminglanguages>>
*** python *** python
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package python (use-package python
@ -2593,7 +2646,8 @@ Intero seems to be causing hangs, so it has been disabled
(defvar-setq org-mobile-directory "~/Dropbox/Apps/MobileOrg") (defvar-setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
(setq org-goto-interface 'outline-path-completion (setq org-goto-interface 'outline-path-completion
org-goto-max-level 10) org-goto-max-level 10
org-export-headline-levels 5)
(add-hook 'org-mode-hook 'imalison:disable-linum-mode) (add-hook 'org-mode-hook 'imalison:disable-linum-mode)
(add-hook 'org-mode-hook (lambda () (setq org-todo-key-trigger t))) (add-hook 'org-mode-hook (lambda () (setq org-todo-key-trigger t)))
(add-hook 'org-agenda-mode-hook 'imalison:disable-linum-mode) (add-hook 'org-agenda-mode-hook 'imalison:disable-linum-mode)
@ -3007,6 +3061,56 @@ background of code to whatever theme I'm using's background"
(add-hook 'org-export-before-processing-hook 'imalison:org-inline-css-hook))) (add-hook 'org-export-before-processing-hook 'imalison:org-inline-css-hook)))
#+END_SRC #+END_SRC
**** Use my own default naming scheme for org-headings
First we define a function that will generate a sanitized version of the heading
as its link target.
#+BEGIN_SRC emacs-lisp
(defun imalison:org-get-raw-value (item)
(when (listp item)
(let* ((property-list (cadr item)))
(when property-list (plist-get property-list :raw-value)))))
(defun imalison:sanitize-name (name)
(replace-regexp-in-string "[^[:alpha:]]" "" (s-downcase name)))
(defun imalison:generate-name (datum cache)
(let ((raw-value (imalison:org-get-raw-value datum)))
(if raw-value
(imalison:sanitize-name raw-value)
;; This is the default implementation from org
(let ((type (org-element-type datum)))
(format "org%s%d"
(if type
(replace-regexp-in-string "-" "" (symbol-name type))
"secondarystring")
(incf (gethash type cache 0)))))))
#+END_SRC
This function replaces the default naming scheme with a call to
~imalison:generate-name~, and uses a slightly different uniquify approach.
#+BEGIN_SRC emacs-lisp
(defun org-export-get-reference (datum info)
"Return a unique reference for DATUM, as a string.
DATUM is either an element or an object. INFO is the current
export state, as a plist. Returned reference consists of
alphanumeric characters only."
(let ((type (org-element-type datum))
(cache (or (plist-get info :internal-references)
(let ((h (make-hash-table :test #'eq)))
(plist-put info :internal-references h)
h)))
(reverse-cache (or (plist-get info :taken-internal-references)
(let ((h (make-hash-table :test 'equal)))
(plist-put info :taken-internal-references h)
h))))
(or (gethash datum cache)
(let* ((name (imalison:generate-name datum cache))
(number (+ 1 (gethash name reverse-cache -1)))
(new-name (format "%s%s" name (if (< 0 number) number ""))))
(puthash name number reverse-cache)
(puthash datum new-name cache)
new-name))))
#+END_SRC
**** org-projectile **** org-projectile
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(imalison:use-package org-projectile (imalison:use-package org-projectile
@ -3240,6 +3344,7 @@ emr (emacs refactor) provides support for refactoring in many programming langua
(progn (progn
(define-key term-raw-map (kbd "C-h") help-map) (define-key term-raw-map (kbd "C-h") help-map)
(add-hook 'term-mode-hook 'imalison:disable-linum-mode) (add-hook 'term-mode-hook 'imalison:disable-linum-mode)
(add-hook 'term-mode-hook 'imalison:disable-show-trailing-whitespace)
(setq term-buffer-maximum-size 0))) (setq term-buffer-maximum-size 0)))
#+END_SRC #+END_SRC
** term-manager ** term-manager
@ -3343,6 +3448,10 @@ crux-reopen-as-root-mode makes it so that any file owned by root will automatica
(progn (progn
(crux-reopen-as-root-mode))) (crux-reopen-as-root-mode)))
#+END_SRC #+END_SRC
** kde-connect
#+BEGIN_SRC emacs-lisp
(use-package kdeconnect)
#+END_SRC
* Chat * Chat
** erc ** erc
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -4117,6 +4226,15 @@ Ensure all themes that I use are installed:
;; 'spaceline-gh-notifier and 'imalison:muni disabled for now ;; 'spaceline-gh-notifier and 'imalison:muni disabled for now
(spaceline-spacemacs-theme))) (spaceline-spacemacs-theme)))
#+END_SRC #+END_SRC
** page-break-lines
#+BEGIN_SRC emacs-lisp
(use-package page-break-lines
:defer 1
:diminish (page-break-lines-mode)
:config
(progn
(global-page-break-lines-mode +1)))
#+END_SRC
** helm-themes ** helm-themes
helm-themes provides an easy way to switch between emacs-themes. helm-themes provides an easy way to switch between emacs-themes.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp

View File

@ -1,6 +1,6 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# name: env-bang # name: env-bang
# key: ! # key: env
# -- # --
#!/usr/bin/env $1 #!/usr/bin/env $1

View File

@ -135,5 +135,7 @@ function _path_helper {
} }
function _haskell_setup { function _haskell_setup {
add_to_path "$HOME/.cabal/bin" # We put cabal after local/bin because we want stack installs to take
# precedence.
add_to_path "$HOME/.cabal/bin" --after --target "$HOME/.local/bin"
} }

View File

@ -2,6 +2,6 @@ xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" }; xkb_types { include "complete" };
xkb_compat { include "complete" }; xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)+imalison(rwin_as_hyper)+capslock(ctrl_modifier)" }; xkb_symbols { include "pc+us+inet(evdev)+imalison(rwin_as_hyper)+imalison(home_as_hyper)+capslock(ctrl_modifier)" };
xkb_geometry { include "pc(pc105)" }; xkb_geometry { include "pc(pc105)" };
}; };

View File

@ -3,3 +3,9 @@ xkb_symbols "rwin_as_hyper" {
replace key <RWIN> { [ Hyper_L ] }; replace key <RWIN> { [ Hyper_L ] };
modifier_map Mod3 { <RWIN>, Hyper_L, Hyper_R }; modifier_map Mod3 { <RWIN>, Hyper_L, Hyper_R };
}; };
partial modifier_keys
xkb_symbols "home_as_hyper" {
replace key <HOME> { [ Hyper_L ] };
modifier_map Mod3 { <HOME>, Hyper_L, Hyper_R };
};

View File

@ -1,9 +1,21 @@
{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}
import Control.Monad
import Data.Aeson
import qualified Data.ByteString.Lazy as B
import Data.List
import qualified Data.Map as M
import Data.Maybe
import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.ExtraTypes.XF86
import System.Directory
import System.FilePath.Posix
import System.Taffybar.Hooks.PagerHints (pagerHints) import System.Taffybar.Hooks.PagerHints (pagerHints)
import Text.Printf
import XMonad hiding ( (|||) ) import XMonad hiding ( (|||) )
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS
import qualified XMonad.Actions.DynamicWorkspaceOrder as DWO
import XMonad.Actions.WindowBringer import XMonad.Actions.WindowBringer
import XMonad.Actions.WindowGo
import XMonad.Actions.WorkspaceNames import XMonad.Actions.WorkspaceNames
import XMonad.Config () import XMonad.Config ()
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
@ -11,6 +23,7 @@ import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive import XMonad.Hooks.FadeInactive
import XMonad.Layout.BoringWindows import XMonad.Layout.BoringWindows
import XMonad.Layout.LayoutCombinators import XMonad.Layout.LayoutCombinators
import XMonad.Layout.LayoutModifier
import XMonad.Layout.Minimize import XMonad.Layout.Minimize
import XMonad.Layout.MultiColumns import XMonad.Layout.MultiColumns
import XMonad.Layout.MultiToggle import XMonad.Layout.MultiToggle
@ -19,8 +32,31 @@ import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Util.CustomKeys import XMonad.Util.CustomKeys
import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.NamedWindows (getName) import XMonad.Util.NamedWindows (getName)
getClass :: Window -> X String
getClass w = do
classHint <- withDisplay $ \d -> io $ getClassHint d w
return $ resClass classHint
myDecorateName ws w = do
name <- show <$> getName w
classTitle <- getClass w
workspaceToName <- getWorkspaceNames
return $ printf "%-20s%-40s %+30s" classTitle (take 40 name) "in " ++ workspaceToName (W.tag ws)
myWindowBringerConfig = WindowBringerConfig { menuCommand = "rofi"
, menuArgs = ["-dmenu", "-i"]
, windowTitler = myDecorateName
}
getClassRemap :: IO (M.Map String String)
getClassRemap = do
home <- getHomeDirectory
text <- B.readFile (home </> ".lib/class_remap.json")
return $ fromMaybe M.empty (decode text)
main = xmonad $ ewmh $ pagerHints def main = xmonad $ ewmh $ pagerHints def
{ modMask = mod4Mask { modMask = mod4Mask
, terminal = "urxvt" , terminal = "urxvt"
@ -34,42 +70,78 @@ main = xmonad $ ewmh $ pagerHints def
myLogHook = fadeInactiveLogHook 0.9 myLogHook = fadeInactiveLogHook 0.9
automaticallySetWorkspaceNames = do setWorkspaceNameToFocusedWindow workspace = do
namedWindows <- mapM getClass $ W.integrate' $ W.stack workspace
renamedWindows <- remapNames namedWindows
WorkspaceNames namesMap <- XS.get
let newName = intercalate "|" renamedWindows
currentName = M.findWithDefault "" (W.tag workspace) namesMap
when (currentName /= newName) $ setWorkspaceName (W.tag workspace) newName
remapNames namedWindows = do
remap <- io getClassRemap
return $ map (\original -> M.findWithDefault original original remap) namedWindows
setWorkspaceNames = do
ws <- gets windowset ws <- gets windowset
mapM_ setWorkspaceNameToFocusedWindow (W.workspaces ws) mapM_ setWorkspaceNameToFocusedWindow (W.workspaces ws)
where setWorkspaceNameToFocusedWindow workspace = do
namedWindows <- mapM getName $ take 2 $ W.integrate' $ W.stack workspace data WorkspaceNamesHook a = WorkspaceNamesHook deriving (Show, Read)
setWorkspaceName (W.tag workspace) (concatMap show namedWindows)
instance LayoutModifier WorkspaceNamesHook Window where
hook _ = setWorkspaceNames
workspaceNamesHook = ModifiedLayout WorkspaceNamesHook
shiftThenView i = W.greedyView i . W.shift i shiftThenView i = W.greedyView i . W.shift i
layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full ||| Tall 1 (3/100) (1/2) layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full ||| Tall 1 (3/100) (1/2)
myLayoutHook = avoidStruts . smartSpacing 10 . noBorders . minimize myLayoutHook = avoidStruts . smartSpacing 10 . noBorders . minimize .
. boringWindows . mkToggle (MIRROR ?? EOT) $ layouts boringWindows . mkToggle (MIRROR ?? EOT) . workspaceNamesHook
$ layouts
myStartup = spawn "systemctl --user start wm.target" myStartup = spawn "systemctl --user start wm.target"
-- Use greedyView to switch to the correct workspace, and then focus on the
-- appropriate window within that workspace.
greedyFocusWindow w ws = W.focusWindow w $ W.greedyView
(fromMaybe (W.currentTag ws) $ W.findTag w ws) ws
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder
(windows . shiftThenView)
addKeys conf@XConfig {modMask = modm} = addKeys conf@XConfig {modMask = modm} =
[ ((modm, xK_p), spawn "rofi -show drun") [ ((modm, xK_p), spawn "rofi -show drun")
, ((modm .|. shiftMask, xK_p), spawn "rofi -show run") , ((modm .|. shiftMask, xK_p), spawn "rofi -show run")
, ((modm, xK_g), gotoMenuArgs' "rofi" ["-dmenu"]) , ((modm, xK_g), actionMenu myWindowBringerConfig greedyFocusWindow)
, ((modm, xK_b), bringMenuConfig myWindowBringerConfig)
, ((modm .|. controlMask, xK_t), spawn , ((modm .|. controlMask, xK_t), spawn
"systemctl --user restart taffybar.service") "systemctl --user restart taffybar.service")
, ((modm, xK_b), bringMenuArgs' "rofi" ["-dmenu"])
, ((modm, xK_v), spawn "copyq paste") , ((modm, xK_v), spawn "copyq paste")
, ((modm, xK_s), swapNextScreen) , ((modm, xK_s), swapNextScreen)
, ((modm .|. controlMask, xK_space), sendMessage $ JumpToLayout "Full") , ((modm .|. controlMask, xK_space), sendMessage $ JumpToLayout "Full")
, ((modm, xK_slash), sendMessage $ Toggle MIRROR) , ((modm, xK_slash), sendMessage $ Toggle MIRROR)
, ((modm, xK_m), withFocused minimizeWindow) , ((modm, xK_m), withFocused minimizeWindow)
, ((modm .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin) , ((modm .|. shiftMask, xK_m), sendMessage RestoreNextMinimizedWin)
, ((modm, xK_backslash), toggleWS)
-- App shortcuts
, ((modalt, xK_s), raiseNextMaybe (spawn "spotify") (className =? "Spotify"))
, ((modalt, xK_e), raiseNextMaybe (spawn "emacsclient -c") (className =? "Emacs"))
, ((modalt, xK_c), raiseNextMaybe (spawn "google-chrome")
(className =? "google-chrome" <&&>
fmap (not . isInfixOf "Hangouts") title))
, ((modalt, xK_h), raiseNextMaybe (spawn "cool")
(className =? "google-chrome" <&&> fmap (isInfixOf "Hangouts") title))
-- Hyper bindings -- Hyper bindings
, ((mod3Mask, xK_e), moveTo Next EmptyWS) , ((mod3Mask, xK_1), setWorkspaceNames)
, ((mod3Mask .|. shiftMask, xK_e), shiftTo Next EmptyWS) , ((mod3Mask, xK_e), moveTo Next EmptyWS )
, ((mod3Mask .|. shiftMask, xK_e), shiftToEmptyAndView)
, ((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_h), spawn "screenshot.sh")
, ((mod3Mask, xK_c), spawn "shell_command.sh") , ((mod3Mask, xK_c), spawn "shell_command.sh")
-- playerctl -- playerctl
@ -96,6 +168,8 @@ addKeys conf@XConfig {modMask = modm} =
[ (W.greedyView, 0) [ (W.greedyView, 0)
, (W.shift, shiftMask) , (W.shift, shiftMask)
, (shiftThenView, controlMask)]] , (shiftThenView, controlMask)]]
where
modalt = modm .|. mod1Mask
-- Local Variables: -- Local Variables:
-- flycheck-ghc-args: ("-Wno-missing-signatures") -- flycheck-ghc-args: ("-Wno-missing-signatures")

8793
index.html

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ PACKAGES = [
"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", "tigervnc", "ngrep", "wireshark-gtk", "teamviewer", "mopidy-podcast", "tigervnc",
"kdegraphics-okular", "pandoc", "kdegraphics-okular", "pandoc", "kdeconnect-git",
] ]