Switch to nix and org-agenda

This commit is contained in:
Magic_RB 2020-11-18 00:51:00 +01:00
parent 43a428360a
commit 4291670334
44 changed files with 279 additions and 71 deletions

View file

@ -7,10 +7,13 @@
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
## Enable color on ls and grep
alias ls='ls --color=auto'
## Enable color on grep
alias grep='grep --color=auto'
## Replace ls and cat with exa and bat respectively
alias ls='exa'
alias cat='bat'
## Add .local/bin to path
#export PATH="${HOME}/.local/bin:${PATH}"
@ -46,11 +49,15 @@ then
alias e="emacsclient-remote"
elif [[ ! -z "${INSIDE_EMACS}" ]]
then
alias E="SUDO_EDITOR=\"emacsclient-$(uname -m) -a emacs\" sudoedit"
alias e="emacsclient-$(uname -m)"
EMACSCLIENT="`command -v -- emacsclient >/dev/null 2>&1 && printf emacsclient || printf emacsclient-$(uname -m)`"
echo "${EMACSCLIENT}"
alias E="SUDO_EDITOR=\"${EMACSCLIENT} -a emacs\" sudoedit"
alias e="${EMACSCLIENT}"
else
alias E="SUDO_EDITOR=\"emacsclient-$(uname -m) -a emacs -t\" sudoedit"
alias e="emacsclient-$(uname -m) -t"
EMACSCLIENT="`command -v -- emacsclient >/dev/null 2>&1 && printf emacsclient || printf emacsclient-$(uname -m)`"
echo "${EMACSCLIENT}"
alias E="SUDO_EDITOR=\"${EMACSCLIENT} -a emacs -t\" sudoedit"
alias e="${EMACSCLIENT} -t"
fi

View file

@ -1,3 +1,13 @@
{ config, pkgs, ... }:
with (import <nixpkgs> {});
with lib;
let
hostname = (import <nixpkgs/nixos> {}).config.networking.hostName;
in
{
config = ''
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
@ -13,13 +23,14 @@ set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
{{ if eq .chezmoi.hostname "heater" -}}
font pango:Dejavu Sans Mono 10
{{ else if eq .chezmoi.hostname "omen" -}}
font pango:Dejavu Sans Mono 12
{{ else if eq .chezmoi.hostname "fractal" -}}
font pango:Dejavu Sans Mono 12
{{ end -}}
font pango:Dejavu Sans Mono ${
if (hostname == "heater") then
"10"
else if (hostname == "omen" || hostname == "fractal") then
"12"
else
"12"
}
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
@ -37,7 +48,6 @@ font pango:Dejavu Sans Mono 12
#exec --no-startup-id nm-applet
exec --no-startup-id xmodmap ~/.xmodmap
# Start Dunst notif thingy
exec --no-startup-id dunst
# Start picom
@ -45,16 +55,19 @@ exec --no-startup-id picom
# Start Nextcloud client
exec --no-startup-id /mnt/data3/Programs/bin/nextcloud
# Set keyboard layouts
exec --no-startup-id setxkbmap -layout us,sk -variant ,qwerty -option 'grp:lalt_lshift_toggle'
exec --no-startup-id setxkbmap -layout us,sk -variant ,qwerty -option 'grp:lalt_lshift_toggle' -option ctrl:nocaps
# Set wallpaper
{{ if eq .chezmoi.hostname "heater" -}}
exec --no-startup-id feh --bg-max /mnt/net/shares/Magic_RB/Multimedia/Wallpapers/Simon\ Stalen\ Hag/by_billboards_2560.jpg
{{ else if eq .chezmoi.hostname "omen" -}}
exec --no-startup-id feh --bg-max /home/main/stalker2_art_2.jpg
{{ else if eq .chezmoi.hostname "fractal" -}}
exec --no-startup-id feh --bg-fill /home/main/wallpaper.jpg
{{ end -}}
exec --no-startup-id feh --bg-max ${
if (hostname == "heater") then
"/mnt/net/shares/Magic_RB/Multimedia/Wallpapers/Simon\ Stalen\ Hag/by_billboards_2560.jpg"
else if (hostname == "omen") then
"/home/main/stalker2_art_2.jpg"
else if (hostname == "fractal") then
"/home/main/wallpaper.jpg"
else
"/tmp/doesnotexist.png"
}
for_window [class="^.*"] border normal 1
@ -174,17 +187,19 @@ bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
{{ if eq .chezmoi.hostname "heater" -}}
# move workspace to monitor
${if (hostname == "heater") then
''
bindsym $mod+Ctrl+1 move workspace to output HDMI-0
# move workspace to monitor
bindsym $mod+Ctrl+2 move workspace to output HDMI-1
{{else if eq .chezmoi.hostname "omen" -}}
# move workspace to monitor
''
else if (hostname == "omen") then
''
bindsym $mod+Ctrl+1 move workspace to output eDP-1
# move workspace to monitor
bindsym $mod+Ctrl+2 move workspace to output HDMI-1-0
{{end -}}
''
else
""
}
# reload the configuration file
bindsym $mod+Shift+c reload
@ -223,21 +238,25 @@ bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
{{ if eq .chezmoi.hostname "heater" -}}
font pango:Dejavu Sans Mono, FontAwesome5 10
{{ else if eq .chezmoi.hostname "omen" -}}
font pango:Dejavu Sans Mono, FontAwesome5 12
{{ else if eq .chezmoi.hostname "fractal" -}}
font pango:Dejavu Sans Mono, FontAwesome5 12
{{ end -}}
${
if (hostname == "heater") then
"font pango:Dejavu Sans Mono, FontAwesome5 10"
else if (hostname == "omen" || hostname == "fractal") then
"font pango:Dejavu Sans Mono, FontAwesome5 12"
else
""
}
position bottom
{{ if eq .chezmoi.hostname "heater" -}}
status_command /usr/bin/i3status-rs /home/main/.config/i3/status.toml
{{ else if eq .chezmoi.hostname "omen" -}}
status_command /usr/bin/i3status-rs /home/main/.config/i3/status.toml
{{ else if eq .chezmoi.hostname "fractal" -}}
status_command /home/main/.cargo/bin/i3status-rs /home/main/.config/i3/status.toml
{{ end -}}
status_command ${
if (hostname == "heater" || hostname == "omen") then
"i3status-rs" + " /home/main/.config/i3/status.toml"
else if (hostname == "fractal") then
"/home/main/.cargo/bin/i3status-rs /home/main/.config/i3/status.toml"
else
""
}
colors {
separator #666666
background #222222
@ -260,3 +279,5 @@ client.background #111111
# emacs tooltip fix
no_focus [window_role="pop-up"]
'';
}

View file

@ -1,11 +1,24 @@
theme = "modern"
{{ if eq .chezmoi.hostname "fractal" -}}
icons = "awesome"
{{ else -}}
icons = "awesome5"
{{ end -}}
{ config, pkgs, ... }:
{{ if eq .chezmoi.hostname "omen" -}}
with (import <nixpkgs> {});
with lib;
let
hostname = (import <nixpkgs/nixos> {}).config.networking.hostName;
in
{
config = ''
theme = "modern"
${
if (hostname == "fractal") then
''icons = "awesome"''
else
''icons = "awesome5"''
}
${
if (hostname == "omen") then
''
[[block]]
block = "battery"
interval = 30
@ -15,7 +28,10 @@ format = "{percentage}% {time} {power}W"
block = "networkmanager"
on_click = "nm-connection-editor"
interface_name_include = [ "wlo1", "eno1", "wg0" ]
{{ end -}}
''
else
""
}
[[block]]
block = "memory"
@ -23,21 +39,28 @@ display_type = "memory"
format_mem = "{Mup}%"
format_swap = "{SUp}%"
{{ if eq .chezmoi.hostname "omen" -}}
${
if (hostname == "omen") then
''
[[block]]
block = "nvidia_gpu"
label = "GTX 1050"
show_memory = true
show_clocks = true
interval = 1
{{else if eq .chezmoi.hostname "heater" -}}
''
else if (hostname == "heater") then
''
[[block]]
block = "nvidia_gpu"
label = "GTX 1060"
show_memory = true
show_clocks = true
interval = 1
{{ end -}}
''
else
""
}
[[block]]
block = "cpu"
@ -50,3 +73,5 @@ block = "sound"
block = "time"
interval = 60
format = "%a %d/%m %R"
'';
}

View file

122
.emacs.d/lisp/org-alert.el Normal file
View file

@ -0,0 +1,122 @@
;;; org-alert.el --- Notify org deadlines via notify-send
;; Copyright (C) 2015 Stephen Pegoraro
;; Author: Stephen Pegoraro <spegoraro@tutive.com>
;; Version: 0.1.0
;; Package-Requires: ((s "1.10.0") (dash "2.11.0") (alert "1.2"))
;; Keywords: org, org-mode, notify, notifications, calendar
;; URL: https://github.com/groksteve/org-alert
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package provides functions to display system notifications for
;; any org-mode deadlines that are due in your agenda. To perform a
;; one-shot check call (org-alert-deadlines). To enable repeated
;; checking call (org-alert-enable) and to disable call
;; (org-alert-disable). You can set the checking interval by changing
;; the org-alert-interval variable to the number of seconds you'd
;; like.
;;; Code:
(require 's)
(require 'dash)
(require 'org-agenda)
(defvar org-alert-interval 300
"Interval in seconds to recheck and display deadlines.")
(defvar org-alert-notification-title "*org*"
"Title to be sent with notify-send.")
(defvar org-alert-headline-regexp "\\(Sched.+:.+\\|Deadline:.+\\)"
"Regexp for headlines to search in agenda buffer.")
(defun org-alert--strip-prefix (headline)
"Remove the scheduled/deadline prefix from HEADLINE."
(replace-regexp-in-string ".*:\s+" "" headline))
(defun org-alert--unique-headlines (regexp agenda)
"Return unique headlines from the results of REGEXP in AGENDA."
(let ((matches (-distinct (-flatten (s-match-strings-all regexp agenda)))))
(--map (org-alert--strip-prefix it) matches)))
(defun org-alert--get-headlines ()
"Return the current org agenda as text only."
(with-temp-buffer
(let ((org-agenda-sticky nil)
(org-agenda-buffer-tmp-name (buffer-name)))
(ignore-errors (org-agenda-list 1))
(org-alert--unique-headlines org-alert-headline-regexp
(buffer-substring-no-properties (point-min) (point-max))))))
(defun org-alert--headline-complete? (headline)
"Return whether HEADLINE has been completed."
(--any? (s-starts-with? it headline) org-done-keywords-for-agenda))
(defun org-alert--filter-active (deadlines)
"Remove any completed headings from the provided DEADLINES."
(-remove 'org-alert--headline-complete? deadlines))
(defun org-alert--strip-states (deadlines)
"Remove the todo states from DEADLINES."
(--map (s-trim (s-chop-prefixes org-todo-keywords-for-agenda it)) deadlines))
(defun org-alert-check ()
"Check for active, due deadlines and initiate notifications."
(interactive)
;; avoid interrupting current command.
(unless (minibufferp)
(save-window-excursion
(save-excursion
(save-restriction
(let ((active (org-alert--filter-active (org-alert--get-headlines))))
(dolist (dl (org-alert--strip-states active))
(notifications-notify :title dl))))))
(when (get-buffer org-agenda-buffer-name)
(ignore-errors
(with-current-buffer org-agenda-buffer-name
(org-agenda-redo t))))))
(defun org-alert-enable ()
"Enable the notification timer. Cancels existing timer if running."
(interactive)
(org-alert-disable)
(run-at-time 0 org-alert-interval 'org-alert-check))
(defun org-alert-disable ()
"Cancel the running notification timer."
(interactive)
(dolist (timer timer-list)
(if (eq (elt timer 5) 'org-alert-check)
(cancel-timer timer))))
(provide 'org-alert)
;;; org-alert.el ends here

View file

@ -1,6 +1,6 @@
* EXWM
* Evil
#+NAME: evil
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package evil
:ensure t
:init

View file

@ -11,6 +11,7 @@
(magic_rb/hydra-digraph-sub/body)
(hydra-push '(magic_rb/hydra-launcher)))
"visit magic_rb/hydra-window-sub" :color teal)
("a" org-agenda :color teal)
("s" treemacs-switch-workspace)
("S" treemacs-edit-workspaces)
("t" treemacs-select-window)

View file

@ -1,4 +1,28 @@
* ORG
** Org Agenda
#+BEGIN_SRC emacs-lisp
(setq org-agenda-files '("~/org"))
(add-hook 'org-mode-hook (lambda ()
(set-fill-column 120)
(display-fill-column-indicator-mode)))
(setq org-agenda-custom-commands
'(("h" "Agenda and Home-related tasks"
((agenda "")
(tags-todo "home")
(tags "garden")))
("o" "Agenda and Office-related tasks"
((agenda "")
(tags-todo "work")
(tags "office")))
("i" "Agenda and School-related tasks"
((agenda "")
(tags-todo "school")
(tags "school")))))
(require 'org-alert)
(require 'notifications)
#+END_SRC
** ORG Linkz
Based on [[https://github.com/p-kolacz/org-linkz][org-linkz]].
Remove validation link from exported html file
@ -13,14 +37,14 @@
(setq org-capture-templates
'(
("o" "Link capture" entry
(file+headline "~/.local/share/chezmoi/org/linkz.org" "INBOX")
(file+headline "~/org/linkz.org" "INBOX")
"* %a %U"
:immediate-finish t)
))
(setq org-protocol-default-template-key "o")
#+END_SRC
Then a .desktop file is needed for firefox
Then a .desktop file is needed for Firefox/Chromium
#+NAME: org-protocol-desktop
#+BEGIN_SRC conf-desktop :tangle ~/.local/share/applications/org-protocol.desktop

View file

@ -32,4 +32,21 @@
(kbd "d") (lambda () (interactive) (delete-selection-evilterm)))
(evil-define-key 'normal vterm-mode-map
(kbd "i") (lambda () (interactive) (move-cursor-to-point) (evil-insert 1)))
(evil-define-key 'normal vterm-mode-map
(kbd "<left>") (lambda () (interactive) (vterm-send-left)))
(evil-define-key 'normal vterm-mode-map
(kbd "<right>") (lambda () (interactive) (vterm-send-right)))
(evil-define-key 'normal vterm-mode-map
(kbd "<up>") (lambda () (interactive) (vterm-send-up)))
(evil-define-key 'normal vterm-mode-map
(kbd "<down>") (lambda () (interactive) (vterm-send-down)))
(evil-define-key 'insert vterm-mode-map
(kbd "<left>") (lambda () (interactive) (vterm-send-left)))
(evil-define-key 'insert vterm-mode-map
(kbd "<right>") (lambda () (interactive) (vterm-send-right)))
(evil-define-key 'insert vterm-mode-map
(kbd "<up>") (lambda () (interactive) (vterm-send-up)))
(evil-define-key 'insert vterm-mode-map
(kbd "<down>") (lambda () (interactive) (vterm-send-down)))
#+END_SRC

View file

@ -1,9 +0,0 @@
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L