From 22338c05784cf1cff7aac76c1538e0e9732e97c2 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Thu, 31 Dec 2020 16:02:46 +0100 Subject: [PATCH] push updates to desktop --- dots/bspwm/.link | 2 + dots/bspwm/bspwmrc | 37 ++++++ dots/bspwm/monitor_laptop.sh | 29 +++++ dots/cursor/index.theme | 1 + dots/emacs/emacs.org | 212 ++++++++++++++++++++------------- dots/gtk/settings.ini.template | 2 +- dots/home/.emacs | 14 +++ dots/home/.xprofile.template | 1 + dots/polybar/.link | 2 + dots/polybar/config | 89 ++++++++++++++ dots/polybar/launch.sh | 5 + 11 files changed, 311 insertions(+), 83 deletions(-) create mode 100644 dots/bspwm/.link create mode 100755 dots/bspwm/bspwmrc create mode 100755 dots/bspwm/monitor_laptop.sh create mode 100644 dots/polybar/.link create mode 100644 dots/polybar/config create mode 100755 dots/polybar/launch.sh diff --git a/dots/bspwm/.link b/dots/bspwm/.link new file mode 100644 index 0000000..bb09ca2 --- /dev/null +++ b/dots/bspwm/.link @@ -0,0 +1,2 @@ +TASKNAME="Configuring bspwm" +LINKTO=".config/bspwm" diff --git a/dots/bspwm/bspwmrc b/dots/bspwm/bspwmrc new file mode 100755 index 0000000..4fbde92 --- /dev/null +++ b/dots/bspwm/bspwmrc @@ -0,0 +1,37 @@ +#!/bin/sh +# don't use fish +export SXHKD_SHELL sh + +bspc config border_width 0 +bspc config window_gap 0 + +bspc config split_ratio 0.50 +bspc config borderless_monocle true +bspc config gapless_monocle true +bspc config focus_follows_pointer true +bspc config pointer_follows_focus true + +bspc rule -a Chromium desktop='II' +bspc rule -a Firefox desktop='II' +bspc rule -a Emacs desktop='I' state=tiled +bspc rule -a Evince desktop='IV' +bspc rule -a mplayer2 state=floating +bspc rule -a TelegramDesktop desktop='X' +bspc rule -a Thunderbird desktop='X' +bspc rule -a Skype desktop='X' +bspc rule -a Anki desktop='^V' +bspc rule -a zoom desktop='^VII' +bspc rule -a .obs-wrapped desktop='VIII' +bspc rule -a Zeal desktop='IX' +bspc rule -a Xournal desktop='VI' +bspc rule -a Pavucontrol state=floating + +xsetroot -cursor_name left_ptr +bspc config remove_unplugged_monitors true + +############################################################################### +# Scripts # +############################################################################### + +~/.config/bspwm/monitor_laptop.sh +~/.config/polybar/launch.sh diff --git a/dots/bspwm/monitor_laptop.sh b/dots/bspwm/monitor_laptop.sh new file mode 100755 index 0000000..e003c21 --- /dev/null +++ b/dots/bspwm/monitor_laptop.sh @@ -0,0 +1,29 @@ +############################################################################### +# External Monitor # +############################################################################### + +workspaces=(I II III V VI VIII IX X IV VII) +mon_1=(I II III V VI VIII IX X) +mon_2=(IV VII) + +bspc monitor eDP-1 -d ${workspaces[*]} + +MONITOR=$(xrandr | rg -i "\sconnected" | rg -v eDP | cut -d" " -f1) + +# move_to_monitor() { +# local -n workspaces=$1 +# for D in "${workspaces[@]}"; do +# bspc desktop $D --to-monitor $2 +# done +# } + +if [ -n "$MONITOR" ]; then + bspc monitor HDMI-2 -d IV VII + + xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x1080\ + --rotate normal --output DP-1 --off --output HDMI-2 --off\ + --output DP-2 --off --output $MONITOR --mode 1920x1080i --pos 0x0\ + --rotate normal + + # move_to_monitor $mon_1 $MONITOR +fi diff --git a/dots/cursor/index.theme b/dots/cursor/index.theme index 4eb35e7..a09e9dc 100644 --- a/dots/cursor/index.theme +++ b/dots/cursor/index.theme @@ -2,3 +2,4 @@ Name=Default Comment=Default Cursor Theme Inherits=capitaine-cursors +Size=16 diff --git a/dots/emacs/emacs.org b/dots/emacs/emacs.org index 8aa313b..ebfa70c 100644 --- a/dots/emacs/emacs.org +++ b/dots/emacs/emacs.org @@ -12,7 +12,6 @@ Allow downcase. Shortcut to edit this file. #+BEGIN_SRC emacs-lisp :tangle yes (defun find-config () - "Edit config.org" (interpactive) (find-file "~/.emacs/emacs.org")) @@ -67,21 +66,9 @@ Taken from https://github.com/Atman50/emacs-config. ** Packages *** Straight -#+begin_src emacs-lisp :tangle yes - (defvar bootstrap-version) - (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - (straight-use-package 'use-package) -#+end_src +Straight is loaded in =~/.emacs= before anything else to then load the +latest org mode which loads this file. + *** Packages Set up package sources. #+BEGIN_SRC emacs-lisp :tangle yes @@ -131,22 +118,22 @@ Prevent custom from preserving state. #+END_SRC *** General - No startup screen. - #+BEGIN_SRC emacs-lisp :tangle yes - (setq inhibit-startup-screen t) - #+END_SRC +No startup screen. +#+BEGIN_SRC emacs-lisp :tangle yes + (setq inhibit-startup-screen t) +#+END_SRC - Hide obstractions. - #+BEGIN_SRC emacs-lisp :tangle yes - (scroll-bar-mode -1) - (menu-bar-mode -1) - (tool-bar-mode -1) - #+END_SRC +Hide obstractions. +#+BEGIN_SRC emacs-lisp :tangle yes + (scroll-bar-mode -1) + (menu-bar-mode -1) + (tool-bar-mode -1) +#+END_SRC - No cursor blink. - #+BEGIN_SRC emacs-lisp :tangle yes - (blink-cursor-mode 0) - #+END_SRC +No cursor blink. +#+BEGIN_SRC emacs-lisp :tangle yes + (blink-cursor-mode 0) +#+END_SRC *** Font and Editor - Set font to ~JetBrains Mono~. @@ -156,7 +143,7 @@ Prevent custom from preserving state. '(font . "JetBrains Mono-12:weight=light:antialias=subpixel")) #+END_SRC - - Highlight current line. +- Highlight current line. #+BEGIN_SRC emacs-lisp :tangle yes (global-hl-line-mode 1) #+END_SRC @@ -702,7 +689,7 @@ Multiple major modes in one buffer. (org-clock-persistence-insinuate) #+END_SRC **** Refile - - Targets include this file and any file contributing to the agenda - up to 9 levels deep +- Targets include this file and any file contributing to the agenda - up to 9 levels deep #+BEGIN_SRC emacs-lisp :tangle yes (setq org-refile-targets (quote @@ -710,27 +697,27 @@ Multiple major modes in one buffer. (org-agenda-files :maxlevel . 9)))) #+END_SRC - - Use full outline paths for refile targets - we file directly with IDO +- Use full outline paths for refile targets - we file directly with IDO #+BEGIN_SRC emacs-lisp :tangle yes (setq org-refile-use-outline-path t) #+END_SRC - - Targets complete directly with IDO +- Targets complete directly with IDO #+BEGIN_SRC emacs-lisp :tangle yes (setq org-outline-path-complete-in-steps nil) #+END_SRC - - Allow refile to create parent tasks with confirmation +- Allow refile to create parent tasks with confirmation #+BEGIN_SRC emacs-lisp :tangle yes (setq org-refile-allow-creating-parent-nodes (quote confirm)) #+END_SRC - - Use the current window for indirect buffer display +- Use the current window for indirect buffer display #+BEGIN_SRC emacs-lisp :tangle yes (setq org-indirect-buffer-display 'current-window) #+END_SRC - - Exclude DONE state tasks from refile targets +- Exclude DONE state tasks from refile targets #+BEGIN_SRC emacs-lisp :tangle yes (defun bh/verify-refile-target () "Exclude todo keywords with a done state from refile targets." @@ -741,7 +728,7 @@ Multiple major modes in one buffer. #+END_SRC **** Agenda - - Formatting: Add path to Items +- Formatting: Add path to Items #+BEGIN_SRC emacs-lisp :tangle yes (setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t% s") @@ -753,7 +740,7 @@ Multiple major modes in one buffer. (search . " %i %-12:c"))) #+END_SRC - - Custom Agenda Commands +- Custom Agenda Commands #+BEGIN_SRC emacs-lisp :tangle yes (setq org-agenda-custom-commands '(("X" agenda @@ -820,7 +807,11 @@ Buff the agenda to use Groups. Agenda Files: #+BEGIN_SRC emacs-lisp :tangle yes - (setq org-agenda-files (list "~/Documents/org/todo.org" "~/Documents/org/calendar.org")) + (setq + org-agenda-files + (list "~/Documents/org/todo.org" + "~/Documents/org/general.org" + "/home/hiro/Documents/Projects/UNI/master/sem_1/courses.org")) #+END_SRC **** Automatically mark task as done if all subtasks are done @@ -833,7 +824,7 @@ Agenda Files: (add-hook 'org-after-todo-statistics-hook 'org-summary-todo) #+end_src **** Custom States - - states +- states #+BEGIN_SRC emacs-lisp :tangle yes (setq org-todo-keywords '((sequence "TODO" "WAITING" "NEXT" "HOLD" "|" @@ -844,7 +835,7 @@ Agenda Files: (sequence "HOMEWORK" "ACTIVE" "|" "FINISHED"))) #+END_SRC - - triggers +- triggers #+BEGIN_SRC emacs-lisp :tangle yes (setq org-todo-state-tags-triggers (quote @@ -896,12 +887,15 @@ Agenda Files: "**** %?\n%U\n") ("m" "Meeting" entry - (file org-default-notes-file) - "** %? :MEETING:\n")))) + (file+headline "~/Documents/org/general.org" "Meetings") + "** %? :MEETING:\n") + ("p" "Appointment" + entry + (file+headline "~/Documents/org/general.org" "Appointments") + "** %? :APPOINTMENT:\n")))) #+END_SRC **** Babel #+begin_src emacs-lisp :tangle yes - (add-to-list 'org-babel-load-languages '(ein . t)) (org-babel-do-load-languages 'org-babel-load-languages '((shell . t) @@ -913,7 +907,8 @@ Agenda Files: (add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append) (setq org-startup-with-inline-images t) (setq imagemagick-types-inhibit t) - (setq ein:output-area-inlined-images t) + + #+end_src Htmlize for nice org html export. @@ -928,38 +923,39 @@ And dont evaluate code again. And a hack to make ob-ipython open the source in a python buffer. #+begin_src emacs-lisp :tangle yes - (use-package jupyter - :config (org-babel-do-load-languages 'org-babel-load-languages - '((jupyter . t)))) + '((jupyter . t))) #+end_src +#+RESULTS: + Automatically tangle on save. #+begin_src emacs-lisp :tangle yes (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook 'org-babel-tangle nil 'make-it-local))) #+end_src -**** Evince for PDF +**** Evince for PDF, Xournal for xoj #+begin_src emacs-lisp :tangle yes - (eval-after-load "org" - '(setq org-file-apps - '((auto-mode . emacs) - ("\\.x?html?\\'" . "firefox %s") - ("\\.pdf\\(::[0-9]+\\)?\\'" . whatacold/org-pdf-app) - ("\\.gif\\'" . "eog \"%s\"") - ("\\.mp4\\'" . "vlc \"%s\"") - ("\\.mkv" . "vlc \"%s\"")))) + (eval-after-load "org" + '(setq org-file-apps + '((auto-mode . emacs) + ("\\.x?html?\\'" . "firefox %s") + ("\\.pdf\\(::[0-9]+\\)?\\'" . whatacold/org-pdf-app) + ("\\.gif\\'" . "eog \"%s\"") + ("\\.mp4\\'" . "vlc \"%s\"") + ("\\.mkv" . "vlc \"%s\"") + ("\\.xoj" . "xournal \"%s\"")))) - (defun whatacold/org-pdf-app (file-path link-without-schema) - "Open pdf file using pdf-tools and go to the specified page." - (let* ((page (if (not (string-match "\\.pdf::\\([0-9]+\\)\\'" - link-without-schema)) - 1 - (string-to-number (match-string 1 link-without-schema))))) - (require 'subr-x) - (start-process "evince" "evince" "evince" (concat "--page-label=" (number-to-string page)) file-path))) + (defun whatacold/org-pdf-app (file-path link-without-schema) + "Open pdf file using pdf-tools and go to the specified page." + (let* ((page (if (not (string-match "\\.pdf::\\([0-9]+\\)\\'" + link-without-schema)) + 1 + (string-to-number (match-string 1 link-without-schema))))) + (require 'subr-x) + (start-process "evince" "evince" "evince" (concat "--page-label=" (number-to-string page)) file-path))) #+end_src **** Presentations Org tree slide is a presentation tool for org mode. @@ -968,15 +964,24 @@ Org tree slide is a presentation tool for org mode. :bind (("" . 'org-tree-slide-move-next-tree) ("" . 'org-tree-slide-move-previous-tree))) #+end_src +**** LaTeX preview size +#+begin_src emacs-lisp :tangle yes + (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0)) +#+end_src +**** Instant latex preview +#+begin_src emacs-lisp :tangle yes + ;; (use-package org-fragtog + ;; :hook org-mode) +#+end_src *** Git **** Magit - - Just load magit and give it a key. +- Just load magit and give it a key. #+BEGIN_SRC emacs-lisp :tangle yes (use-package magit :bind ("C-x g" . magit-status)) #+END_SRC - - Reload files on git change. +- Reload files on git change. #+BEGIN_SRC emacs-lisp :tangle yes (use-package magit-filenotify) #+END_SRC @@ -1024,13 +1029,13 @@ Make mini-buffers and search nicer. *** LaTeX Enable electric braces for math mode: ~\( \)~ #+BEGIN_SRC emacs-lisp :tangle yes - (setq LaTeX-electric-left-right-brace t) - (defun my-auctex-init () - (turn-off-smartparens-mode) - (auto-fill-mode) - (latex-math-mode) - (turn-on-reftex) - (flyspell-mode 1)) + (setq LaTeX-electric-left-right-brace t) + (defun my-auctex-init () + (turn-off-smartparens-mode) + (auto-fill-mode) + (latex-math-mode) + (turn-on-reftex) + (flyspell-mode 1)) (add-hook 'LaTeX-mode-hook 'my-auctex-init) #+END_SRC @@ -1232,13 +1237,6 @@ Support for sphinx style docstrings. :init (setq xref-show-definitions-function #'ivy-xref-show-defs)) #+END_SRC -*** Jupyter-Notebooks -#+BEGIN_SRC emacs-lisp :tangle yes - (use-package ein - :config (setq ein:output-type-preference - '(emacs-lisp svg png jpeg html text latex javascript))) -#+END_SRC - *** Fish Fish shell script mode. #+BEGIN_SRC emacs-lisp :tangle yes @@ -1338,6 +1336,10 @@ Debugging yay! #+begin_src emacs-lisp :tangle yes (use-package nix-mode) #+end_src +*** Julia +#+begin_src emacs-lisp :tangle yes + (use-package julia-mode) +#+end_src ** Custom Scripts *** Close all Buffers #+BEGIN_SRC emacs-lisp :tangle yes @@ -1377,3 +1379,49 @@ Debugging yay! ,@args ,@',common-args))) #+END_SRC +*** Insert a new exercise into an org file +#+begin_src emacs-lisp :tangle yes + (require 'org) + (require 'org-element) + (defun insert-uebung (file org-path) + (interactive + (list (read-file-name "Select Uebung: " "~/Downloads") (org-get-outline-path t))) + (when (and + (eq (length org-path) 2) + (string= (nth 1 org-path) "Uebungen")) + (save-match-data + (let* ((subject (first (org-get-outline-path))) + (last-heading + (first (last (org-map-entries + (lambda () + (nth 4 (org-heading-components))) + nil 'tree)))) + (last-ex-number + (progn + (string-match ".*?\\([0-9]+\\)\\..*" last-heading) + (string-to-number (match-string 1 last-heading)))) + (ueb-dir (format "%s%s/uebungen/%d/" + (file-name-directory (buffer-file-name)) + subject + (1+ last-ex-number))) + (new-file (format "%s%s" ueb-dir (file-name-nondirectory file))) + (solution-file (format "%s/lsg.xoj" ueb-dir)) + (template-file (format "%s/lsg.xoj" + (file-name-directory (buffer-file-name)))) + (template-bg-file (format "%s/lsg.xoj.bg_2.png" + (file-name-directory (buffer-file-name))))) + (make-directory ueb-dir t) + (copy-file file new-file t) + (org-insert-heading-after-current) + (insert (format "TODO %d. Uebung" (1+ last-ex-number))) + (org-demote) + (forward-line) + (insert (format "- [[%s][Blatt]]\n" new-file)) + (copy-file template-file solution-file nil) + (copy-file template-bg-file ueb-dir nil) + (insert (format "- [[%s][meine loesung]]\n\n" solution-file)) + (forward-line -4) + (org-set-tags "EXERCISE") + (call-interactively 'org-deadline))))) + +#+end_src diff --git a/dots/gtk/settings.ini.template b/dots/gtk/settings.ini.template index 7bbe3e8..770fdbf 100644 --- a/dots/gtk/settings.ini.template +++ b/dots/gtk/settings.ini.template @@ -3,4 +3,4 @@ gtk-application-prefer-dark-theme = false gtk-theme-name = {{ OOMOXTHEME }} gtk-fallback-icon-theme = gnome gtk-icon-theme-name = {{ OOMOXTHEME }}-flat -gtk-font-name = Source Code Pro 8 \ No newline at end of file +gtk-font-name = Source Code Pro 8 diff --git a/dots/home/.emacs b/dots/home/.emacs index 7a8f1c2..9ac4b04 100644 --- a/dots/home/.emacs +++ b/dots/home/.emacs @@ -1 +1,15 @@ +(defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) +(straight-use-package 'use-package) +(straight-use-package 'org) (org-babel-load-file "~/.emacs.d/emacs.org") diff --git a/dots/home/.xprofile.template b/dots/home/.xprofile.template index ae51889..aa0edd7 100644 --- a/dots/home/.xprofile.template +++ b/dots/home/.xprofile.template @@ -4,3 +4,4 @@ xmodmap ~/.xmodmaprc & dunst & picom --config .picom.conf & xrdb .Xresources & +kdeconnect-indicator & diff --git a/dots/polybar/.link b/dots/polybar/.link new file mode 100644 index 0000000..ad6be2e --- /dev/null +++ b/dots/polybar/.link @@ -0,0 +1,2 @@ +TASKNAME="Configuring polybar" +LINKTO=".config/polybar" diff --git a/dots/polybar/config b/dots/polybar/config new file mode 100644 index 0000000..5903462 --- /dev/null +++ b/dots/polybar/config @@ -0,0 +1,89 @@ +[colors] +background = ${xrdb:color8:#222} +background-alt = ${xrdb:color0:#222} +foreground = ${xrdb:color7:#222} +linecolor = ${xrdb:color2:#222} +bordercolor = ${xrdb:color3:#222} +primary = #ffb52a +secondary = #e60053 +alert = #bd2c40 + +[global/wm] +margin-top = 0 +margin-bottom = 0 + +[bar/base] +enable-ipc = true +override-redirect = true +width = 100% +height = 27 +background = ${colors.background} +foreground = ${colors.foreground} +linecolor = ${colors.linecolor} +border-bottom-size = 2 +border-bottom-color = ${colors.bordercolor} + +font-0 = Fira Code:size=10;2 +font-1 = FontAwesome:size=10;2 + +[bar/ext] +inherit = bar/base + +monitor = HDMI-2 +modules-left = bspwm + +[bar/main] +inherit = bar/base +monitor = eDP-1 + +spacing = 3 +lineheight = 2 +padding-right = 1 + +module-margin-left = 1 +module-margin-right = 1 +separator = | + +modules-left = bspwm +modules-right = battery clock + +tray-position = center + +[module/bspwm] +type = internal/bspwm +format = + +pin-workspaces = true +inline-mode = true +enable-click = true +enable-scroll = true +reverse-scroll = true + +label-focused-background = ${colors.bordercolor} +ws-icon-0 = "IV;" +ws-icon-1 = "VII;7" +ws-icon-2 = "I;" +ws-icon-3 = "II;" +ws-icon-4 = "III;" +ws-icon-5 = "V;" +ws-icon-6 = "VI;6" +ws-icon-7 = "VIII;8" +ws-icon-8 = "IX;" +ws-icon-9 = "X;" + +label-focused = %icon% +label-focused-padding = 1 + +label-occupied = %icon% +label-occupied-padding = 1 + +label-empty = + +[module/clock] +type = internal/date +date = %%{T3}%Y-%m-%d %H:%M%%{T-} +interval = 5 + +[module/battery] +type = internal/battery +full-at = 98 diff --git a/dots/polybar/launch.sh b/dots/polybar/launch.sh new file mode 100755 index 0000000..419418b --- /dev/null +++ b/dots/polybar/launch.sh @@ -0,0 +1,5 @@ +#!/bin/sh +polybar-msg cmd quit +polybar main & disown +polybar ext & disown +xdo id -m -N Polybar && polybar-msg cmd hide