diff options
Diffstat (limited to '.config/emacs/modules/bd--utility.el')
-rw-r--r-- | .config/emacs/modules/bd--utility.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/.config/emacs/modules/bd--utility.el b/.config/emacs/modules/bd--utility.el index cdc2c7e..2733e80 100644 --- a/.config/emacs/modules/bd--utility.el +++ b/.config/emacs/modules/bd--utility.el @@ -2,8 +2,12 @@ ;;; Commentary: ;;; Code: +(require 'project) +(require 'xdg) + + (defun bd/set-frame-alpha (value) - "Sets the transparency of the frame background. 0=transparent/100=opaque." + "Set the transparency of the frame background to VALUE. 0=transparent/100=opaque." (interactive "nTransparency Value (30 - 100 opaque): ") (setq value (max 30 (min value 100))) (set-frame-parameter (selected-frame) 'alpha `(,value . ,value)) @@ -22,9 +26,9 @@ ARG can be one of the following: (cond ((file-regular-p arg) (copy-file arg wall t)) ((file-directory-p arg) - (let* ((images (f-files arg (lambda (f) (string-match-p "\\.jpeg\\'" f)))) - (rfile (nth (random (length images)) images))) - (and rfile (copy-file rfile wall t)))))) + (let* ((images (directory-files arg (lambda (f) (string-match-p "\\.jpeg\\'" f)))) + (rfile (nth (random (length images)) images))) + (and rfile (copy-file rfile wall t)))))) (start-process "set wallpaper" nil "feh" "--bg-fill" wall) (message "Set wallpaper."))) @@ -51,7 +55,7 @@ ARG can be one of the following: (start-process "sound toggle" nil "pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle")) (defun bd/set-volume (value) - "Sets the volume to VALUE." + "Set the volume to VALUE." (start-process "set volume" nil "pactl" "set-sink-volume" "@DEFAULT_SINK@" value)) (defun bd/decrement-volume () @@ -65,7 +69,7 @@ ARG can be one of the following: (bd/set-volume "+4%")) (defun bd/set-brightness (value) - "Sets the brightness to VALUE." + "Set the brightness to VALUE." (start-process "set brightness" nil "brightnessctl" "set" value)) (defun bd/decrement-brightness () @@ -79,9 +83,9 @@ ARG can be one of the following: (bd/set-brightness "5%+")) (defun bd/get-directory-dwim () - "Returns the directory you always wanted." + "Return the directory you always wanted." (or (when (project-current) - (project-root (project-current))) ;; git + (project-root (project-current))) ;; git (locate-dominating-file "." "Makefile") ;; make (locate-dominating-file "." "manifest.scm") ;; guix default-directory)) @@ -121,7 +125,7 @@ ARG can be one of the following: (not (or (bd/buffer-exwm-p buf) (bd/buffer-text-p buf) (bd/buffer-prog-p buf) - (bd/buffer-scratch-p buf) + (bd/buffer-scratch-p buf) (bd/buffer-dired-p buf) (bd/buffer-irc-p buf)))) |