From cbf8c1cd3d383761d0b230f2f14ad54cbcfcfca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Thu, 3 Aug 2023 07:10:12 +0200 Subject: [PATCH] vi-like input, theme toggle, Makefile and update README --- .gitignore | 2 ++ Makefile | 45 ++++++++++++++++++++++++++++ README.md | 40 ++++--------------------- check_dependencies.sh | 58 ++++++++++-------------------------- lupan-clock/Makefile | 6 ++++ shell/.haskeline | 1 + shell/.inputrc | 5 ++++ shell/.profile | 4 +-- xsession/bin/lupan-set-theme | 15 ++++++---- 9 files changed, 92 insertions(+), 84 deletions(-) create mode 100644 Makefile create mode 100644 shell/.haskeline create mode 100644 shell/.inputrc diff --git a/.gitignore b/.gitignore index 661c828..98dfacf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ lupan-clock/lupan-clock lupan-wm/target *~ __pycache__ +/dwm +/st diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d8bbe81 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +all: + @echo "run: make clone build install" + +clone: ~/.local/share/zap dwm st + +build: build-dwm build-st build-lupan-clock + +install: install-dwm install-st install-lupan-clock install-other + +~/.local/share/zap: + mkdir -p ~/.local/share + cd ~/.local/share && \ + git clone https://github.com/zap-zsh/zap.git --branch=release-v1 + +dwm: + git clone https://git.suckless.org/dwm + cp -i patches/dwm/config.h dwm/ + +build-dwm: + make -C dwm + +install-dwm: + make -C dwm install PREFIX="${HOME}/.local" + +st: + git clone https://git.suckless.org/st + cd st && \ + git remote add lupan.pl https://gitea.lupan.pl/lupan/st.git && \ + git fetch lupan.pl && \ + git checkout -b patched --track lupan.pl/patched + +build-st: + make -C st + +install-st: + make -C st install PREFIX="${HOME}/.local" + +build-lupan-clock: + make -C lupan-clock + +install-lupan-clock: + make -C lupan-clock install PREFIX="${HOME}/.local" + +install-other: + stow -Rv shell tmux xsession nvim diff --git a/README.md b/README.md index aaf5109..9caaaeb 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,6 @@ Lupan's config files ==================== -Screenshots ------------ - -Short answer: [screenshots here](https://lupan.pl/lupan-themes/). - -My configuration allows to switch between my 6 themes using a shell -script bound to a key stroke (`super + F6` for switching themes in a -cycle and `super + shift + F6` for selecting one with `dmenu`). The -theme is applied to *bspwm*, *Polybar*, *Alacritty*, *Emacs*, and -*Gtk3* (with support for reloading themes in active *Gtk3* -applications, but I currently use only two *Gtk3* themes: one dark and -one light). - -You can see the screenshots of my whole workspace with each of the -themes applied on the page describing [my Emacs -themes](https://lupan.pl/lupan-themes/). For the Emacs theme -reloading I use simple helper Emacs function `my-select-theme` -available from [Toggle between dark and light themes with a -key](https://lupan.pl/dotemacs/#toggle-between-dark-and-light-themes-with-a-key) -section of my Emacs config (also available in corresponding [GitHub -repo](https://github.com/lukpank/.emacs.d). - - Installation ------------ @@ -34,21 +11,16 @@ that you have required programs in your `PATH` with $ sh check_dependencies.sh ``` -For [qtile](http://www.qtile.org/) configuration run +Install font `ttf-firacode-nerd` (https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FiraCode.zip). + +Install `st`, `dwm`, `lupan-clock`, and config files with ``` -$ stow -v alacritty xsession qtile music shell tmux +$ make clone build install ``` -For [bspwm](https://github.com/baskerville/bspwm) configuration run +Change to `zsh` as your login shell with ``` -$ stow -v alacritty xsession bspwm music shell tmux -``` - -but if you want [i3](https://i3wm.org/) config (left as a fallback) -instead of *qtile* or *bspwm* then *also* run - -``` -$ stow -v i3 +$ chsh -s /usr/bin/zsh ``` diff --git a/check_dependencies.sh b/check_dependencies.sh index 6b9eb9c..0252844 100644 --- a/check_dependencies.sh +++ b/check_dependencies.sh @@ -1,63 +1,37 @@ #!/bin/sh -echo '# qtile:' +echo '# required:' for CMD in \ - alacritty \ - qtile \ - emacsclient \ + zsh \ + git \ + cc \ + make \ setxkbmap \ slock \ systemctl \ xmodmap \ xrandr \ xrdb \ + xset \ xsetroot \ + hsetroot \ xsettingsd \ - rofi; do - which "$CMD" -done - -echo -e '\n# bspwm:' -for CMD in \ - alacritty \ - bspc \ - bspwm \ + sed \ + pkill \ dmenu \ dmenu_run \ - emacsclient \ - pkill \ - polybar \ - polybar-msg \ - sed \ - setxkbmap \ - slock \ - sxhkd \ - systemctl \ - xargs \ - xdo \ - xmodmap \ - xrandr \ - xrdb \ - xsetroot \ - xsettingsd \ - xtitle \ - xss-lock; do + xss-lock \ + exa \ + fzf \ + ; do which "$CMD" done -echo -e '\n# bspwm (optional):' +echo -e '\n# optional:' for CMD in \ - firefox \ - mpc \ - mpd \ - pamixer \ sx \ - thunderbird \ + picom \ + compton \ xbacklight; do which "$CMD" done - -echo -e '\n# shell:' -for CMD in emacsclient zsh; do - which "$CMD" -done diff --git a/lupan-clock/Makefile b/lupan-clock/Makefile index 73c40be..b5494eb 100644 --- a/lupan-clock/Makefile +++ b/lupan-clock/Makefile @@ -1,2 +1,8 @@ +PREFIX = /usr/local + lupan-clock: lupan-clock.c ${CC} -o $@ $< -lX11 -Wall + +install: + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f lupan-clock ${DESTDIR}${PREFIX}/bin diff --git a/shell/.haskeline b/shell/.haskeline new file mode 100644 index 0000000..bf0b6cd --- /dev/null +++ b/shell/.haskeline @@ -0,0 +1 @@ +editMode: Vi diff --git a/shell/.inputrc b/shell/.inputrc new file mode 100644 index 0000000..95731ea --- /dev/null +++ b/shell/.inputrc @@ -0,0 +1,5 @@ +set editing-mode vi +set show-mode-in-prompt on +set vi-ins-mode-string \1\e[6 q\2 +set vi-cmd-mode-string \1\e[2 q\2 + diff --git a/shell/.profile b/shell/.profile index a795521..e7e9f09 100644 --- a/shell/.profile +++ b/shell/.profile @@ -8,8 +8,8 @@ # for ssh logins, install and configure the libpam-umask package. #umask 022 -export EDITOR=emacsclient -export VISUAL=emacsclient +export EDITOR=nvim +export VISUAL=nvim # if running bash if [ -n "$BASH_VERSION" ]; then diff --git a/xsession/bin/lupan-set-theme b/xsession/bin/lupan-set-theme index 39d55ac..68f689e 100755 --- a/xsession/bin/lupan-set-theme +++ b/xsession/bin/lupan-set-theme @@ -2,23 +2,26 @@ THEME="$1" +if [ "$THEME" = "toggle" ] && grep Materia-dark ~/.config/xsettingsd/xsettingsd.conf > /dev/null; then + THEME=light +else + THEME=dark +fi + if [ "$THEME" = dark ]; then BGCOLOR=#4a4a4a GTK_THEME=Materia-dark elif [ "$THEME" = light ]; then - BGCOLOR=#dde1e3 - GTK_THEME=Materia-light -elif [ "$THEME" = faff ]; then - BGCOLOR=#4a4a4a + BGCOLOR=#cacaca GTK_THEME=Materia-light else - echo "error: unknown theme: should be either dark, light or faff" >&2 + echo "error: unknown theme: should be either dark, light or toggle" >&2 exit 1 fi # Background color if [ ! -x ~/.fehbg ]; then - xsetroot -solid "$BGCOLOR" + hsetroot -solid "$BGCOLOR" fi # Alacritty