From e953fd9a5a12799f644b4db74711e08e5d096a69 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 19 Oct 2021 23:47:05 +0200 Subject: [PATCH 01/14] [sb-music] fix: song info parsing --- .local/bin/statusbar/sb-music | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music index c9213cf..5c59b22 100755 --- a/.local/bin/statusbar/sb-music +++ b/.local/bin/statusbar/sb-music @@ -13,12 +13,12 @@ unicode() { sed "s/[‘’]/'/g;s/[“”]/\"/g"; } format() { sed "s/^volume:n\/a.*//g;/^volume:/d;s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g"; } -mpc="$(mpc --format "%albumartist% - %artist% - %title%")" -title="$(echo "$mpc" | head -n1 | cut -d'-' -f3 | unicode)" +mpc="$(mpc --format "%albumartist% ~ %artist% ~ %title%")" +title="$(echo "$mpc" | head -n1 | cut -d'~' -f3 | unicode)" [ "$(echo "$title" | wc -c)" -gt 18 ] && title="$(printf "%.15s..." "$title")" -artist="$(echo "$mpc" | head -n1 | cut -d'-' -f1 | unicode)" +artist="$(echo "$mpc" | head -n1 | cut -d'~' -f1 | unicode)" [ "Various Artists " = "$artist" ] && - artist="$(echo "$mpc" | head -n1 | cut -d'-' -f2 | unicode)" + artist="$(echo "$mpc" | head -n1 | cut -d'~' -f2 | unicode)" [ "$(echo "$artist" | wc -c)" -gt 18 ] && artist="$(printf "%.15s..." "$artist")" status="$(echo "$mpc" | tail -n2 | format)" From 6830dd412decd220e8315a0c399471633c05e970 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:46:06 +0200 Subject: [PATCH 02/14] [wget]feat: keep history in ~/.cache --- .config/aliasrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/aliasrc b/.config/aliasrc index c88f76a..908a6e8 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -20,3 +20,4 @@ alias dotfiles='/usr/bin/git --git-dir=$DOTFILES --work-tree=$HOME' alias abcde='abcde -c $XDG_CONFIG_HOME/abcde/config' alias abook='abook --config $XDG_CONFIG_HOME/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook' alias pip-upgrade="pip freeze --user | cut -d'=' -f1 | xargs -n1 pip install -U" +alias wget="wget --hsts-file=$XDG_CACHE_HOME/wget-hsts" From 08760e3f62889e8b44045fe10e00be2c459146dc Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:47:10 +0200 Subject: [PATCH 03/14] [nvim]fix: python-lsp path --- .config/nvim/lua/lsp/python.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/lsp/python.lua b/.config/nvim/lua/lsp/python.lua index 452213d..466a94a 100644 --- a/.config/nvim/lua/lsp/python.lua +++ b/.config/nvim/lua/lsp/python.lua @@ -3,4 +3,6 @@ -- License : GPLv3 -- Description : jedi (python) config file for lsp -require("lspconfig").jedi_language_server.setup{} +require("lspconfig").jedi_language_server.setup{ + cmd = { vim.fn.stdpath("data") .. "/lsp_servers/jedi_language_server/venv/bin/jedi-language-server" } +} From 9cb79d26786a2d0e9a9ddfe7ae1adfbc64e9d953 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:47:47 +0200 Subject: [PATCH 04/14] [nvim]feat: add maps for verilog --- .config/nvim/after/ftplugin/verilog.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/nvim/after/ftplugin/verilog.lua b/.config/nvim/after/ftplugin/verilog.lua index bf75582..6cd413e 100644 --- a/.config/nvim/after/ftplugin/verilog.lua +++ b/.config/nvim/after/ftplugin/verilog.lua @@ -3,8 +3,11 @@ -- License : GPLv3 -- Description : verilog fietype config +utils.map("n", "", ":CoqInterrupt") utils.map("n", "j", ":CoqNext") utils.map("n", "k", ":CoqUndo") utils.map("n", "", ":CoqToLine") +utils.map("n", "a", ":Coq About") +utils.map("n", "G", ":CoqJumpToEnd") utils.map("i", "//", "∥") From e461e3804b11c8f08a5087c464c7c1a7f84c5477 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:49:39 +0200 Subject: [PATCH 05/14] [nvim]fix: verilo maps --- .config/nvim/after/ftplugin/verilog.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/nvim/after/ftplugin/verilog.lua b/.config/nvim/after/ftplugin/verilog.lua index 6cd413e..a41731d 100644 --- a/.config/nvim/after/ftplugin/verilog.lua +++ b/.config/nvim/after/ftplugin/verilog.lua @@ -3,11 +3,11 @@ -- License : GPLv3 -- Description : verilog fietype config -utils.map("n", "", ":CoqInterrupt") -utils.map("n", "j", ":CoqNext") -utils.map("n", "k", ":CoqUndo") -utils.map("n", "", ":CoqToLine") -utils.map("n", "a", ":Coq About") -utils.map("n", "G", ":CoqJumpToEnd") +utils.map("n", "", "CoqInterrupt") +utils.map("n", "j", "CoqNext") +utils.map("n", "k", "CoqUndo") +utils.map("n", "", "CoqToLine") +utils.map("n", "a", "Coq About") +utils.map("n", "G", "CoqJumpToEnd") utils.map("i", "//", "∥") From b4e4587647d1ac7466dca63af84175907c6ccc9e Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:50:28 +0200 Subject: [PATCH 06/14] [nvim]cleanup: remove unused maps --- .config/nvim/lua/maps.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/.config/nvim/lua/maps.lua b/.config/nvim/lua/maps.lua index 2b2b562..60f45a5 100644 --- a/.config/nvim/lua/maps.lua +++ b/.config/nvim/lua/maps.lua @@ -4,8 +4,6 @@ -- Description : neovim mappings file utils.map("n", "", "") -utils.map("n", "j", "bn") -utils.map("n", "k", "bp") utils.map("n", "y", "\"+y") utils.map("n", "p", "\"+P") utils.map("n", "", "w! | !compiler %") From 114058ab243ed555d295de3d75a8e889bd6efc76 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 21 Oct 2021 23:50:50 +0200 Subject: [PATCH 07/14] [zsh]feat: more readable vcs prompt branch is redder state: white -> grey --- .config/zsh/zsh_prompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/zsh_prompt b/.config/zsh/zsh_prompt index 05c8408..e06bd9c 100644 --- a/.config/zsh/zsh_prompt +++ b/.config/zsh/zsh_prompt @@ -6,7 +6,7 @@ setopt prompt_subst zstyle ':vcs_info:git:*' check-for-changes true zstyle ':vcs_info:git:*' stagedstr '*' zstyle ':vcs_info:git:*' unstagedstr '!' -zstyle ':vcs_info:git:*' formats '(%F{208}%b%F{015}: %c/%u%F{015}) ' +zstyle ':vcs_info:git:*' formats '(%F{202}%b%F{007}: %c/%u%F{007}) ' zstyle ':vcs_info:*' enable git PROMPT="[ %{$fg[cyan]%}%n\ From aca04e5745514a4147f40cf979bfab2223df0439 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 22 Oct 2021 00:00:49 +0200 Subject: [PATCH 08/14] [nvim]feat: change colorscheme !!!BREAKING : discard Polyjuice new colorscheme will be delivered sooooooon --- .config/nvim/init.lua | 2 -- .config/nvim/lua/plugins.lua | 4 ++-- .gitmodules | 3 --- .local/src/polyjuice | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) delete mode 160000 .local/src/polyjuice diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 6036136..0666dca 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -9,5 +9,3 @@ require("settings") -- ./lua/settings.lua require("plugins") -- ./lua/plugins.lua require("maps") -- ./lua/maps.lua require("statusline") -- ./lua/statusline.lua - -require("polyjuice") -- ~/.local/src/polyjuice/lua/polyjuice.lua diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index b83dfa1..e4b9fb3 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -20,8 +20,8 @@ return require("packer").startup(function() -- colorscheme use { - "~/.local/src/polyjuice/", - requires = "tjdevries/colorbuddy.nvim" + "~/.local/src/astronomy", + config = function() require("colorscheme") end } -- tree-sitter diff --git a/.gitmodules b/.gitmodules index adcdc69..5091431 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule ".local/src/polyjuice"] - path = .local/src/polyjuice - url = git@github.com:swy7ch/polyjuice.git [submodule ".local/src/dwm"] path = .local/src/dwm url = git@github.com:swy7ch/dwm.git diff --git a/.local/src/polyjuice b/.local/src/polyjuice deleted file mode 160000 index bd4119a..0000000 --- a/.local/src/polyjuice +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd4119a8c1a57b84f9470950a514f52d81907abb From 34940150565dc728c5adf9f93240a5aa54813232 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 22 Oct 2021 00:05:09 +0200 Subject: [PATCH 09/14] feat: use XResources to define colors --- .local/src/dmenu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/src/dmenu b/.local/src/dmenu index e64ab65..0f4c5fa 160000 --- a/.local/src/dmenu +++ b/.local/src/dmenu @@ -1 +1 @@ -Subproject commit e64ab6522752e3ac48357fb6e3a9b37e6e03f575 +Subproject commit 0f4c5faed3e396832bd11586371698d06bf21b71 From f0920db8df9a1dea323ecce09be247d0acf14c2b Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 22 Oct 2021 00:05:30 +0200 Subject: [PATCH 10/14] cleanup: remove tabs, unused lines... --- .local/src/dwm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/src/dwm b/.local/src/dwm index 7199d8d..f8ad07e 160000 --- a/.local/src/dwm +++ b/.local/src/dwm @@ -1 +1 @@ -Subproject commit 7199d8d564c144bbf4d47641db72b071f39533c7 +Subproject commit f8ad07e02878adfbdab1241869630d608566c5c0 From b03369ba79f36d43edab09590a4b2874738c95c1 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 22 Oct 2021 22:40:18 +0200 Subject: [PATCH 11/14] feat: introducing astronomy.nvim new colorscheme! added as a submodule, which will be pulled right where it needs to sit updated the config to follow the changes add colorscheme.lua to configurate !!!BROKEN: this file uses script that are not yet committed --- .config/nvim/lua/colorscheme.lua | 13 +++++++++++++ .config/nvim/lua/lsp/init.lua | 16 ++++++++-------- .config/nvim/lua/maps.lua | 3 +++ .config/nvim/lua/plugins.lua | 2 +- .config/nvim/lua/statusline.lua | 6 +++--- .gitmodules | 3 +++ .local/src/astronomy.nvim | 1 + 7 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 .config/nvim/lua/colorscheme.lua create mode 160000 .local/src/astronomy.nvim diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua new file mode 100644 index 0000000..83dfddd --- /dev/null +++ b/.config/nvim/lua/colorscheme.lua @@ -0,0 +1,13 @@ +-- Author : swytch +-- Created : Friday Oct. 22, 2021 22:07:41 CET +-- License : GPLv3 +-- Description : colorscheme config file + + +local utils = require("utils") +local file = os.getenv("XDG_STATE_HOME") .. "/nvim_colorscheme" +local colorscheme = utils.lines_from(file)[0] + +require("astronomy").setup { + variant = colorscheme, +} diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index 8d12035..6632694 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -8,33 +8,33 @@ local M = {} vim.fn.sign_define( "DiagnosticSignError", { - texthl = "DiagnosticError", + texthl = "DiagnosticVirtualTextError", text = globals.sign_error, - numhl = "DiagnosticError" + numhl = "DiagnosticSignError" } ) vim.fn.sign_define( "DiagnosticSignWarn", { - texthl = "DiagnosticWarn", + texthl = "DiagnosticVirtualTextWarn", text = globals.sign_warning, - numhl = "DiagnosticWarn" + numhl = "DiagnosticSignWarn" } ) vim.fn.sign_define( "DiagnosticSignHint", { - texthl = "DiagnosticHint", + texthl = "DiagnosticVirtualTextHint", text = globals.sign_hint, - numhl = "DiagnosticHint" + numhl = "DiagnosticSignHint" } ) vim.fn.sign_define( "DiagnosticSignInfo", { - texthl = "DiagnosticInfo", + texthl = "DiagnosticVirtualTextInfo", text = globals.sign_info, - numhl = "DiagnosticInfo" + numhl = "DiagnosticSignInfo" } ) diff --git a/.config/nvim/lua/maps.lua b/.config/nvim/lua/maps.lua index 60f45a5..ee37983 100644 --- a/.config/nvim/lua/maps.lua +++ b/.config/nvim/lua/maps.lua @@ -23,3 +23,6 @@ utils.map("n", "lf", "lua vim.lsp.buf.formatting()") utils.map("n", "tf", "Telescope find_files") utils.map("n", "tb", "Telescope file_browser") utils.map("n", "tl", "Telescope live_grep") + +-- colorscheme +utils.map("n", "", "lua require(\"astronomy\").toggle_variant()") diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index e4b9fb3..6ee4b19 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -20,7 +20,7 @@ return require("packer").startup(function() -- colorscheme use { - "~/.local/src/astronomy", + "~/.local/src/astronomy.nvim", config = function() require("colorscheme") end } diff --git a/.config/nvim/lua/statusline.lua b/.config/nvim/lua/statusline.lua index 2b8bafc..647b19c 100644 --- a/.config/nvim/lua/statusline.lua +++ b/.config/nvim/lua/statusline.lua @@ -148,17 +148,17 @@ local function statusline_focused() process_diagnostics( globals.sign_error .. " ", diagnostics.errors, - "%#DiagnosticError#" + "%#DiagnosticVirtualTextError#" ), process_diagnostics( globals.sign_warning .. " ", diagnostics.warnings, - "%#DiagnosticWarn#" + "%#DiagnosticVirtualTextWarn#" ), process_diagnostics( globals.sign_info .. " ", diagnostics.info, - "%#DiagnosticInfo#" + "%#DiagnosticVirtualTextInfo#" ) } ) diff --git a/.gitmodules b/.gitmodules index 5091431..70837f4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule ".local/src/slock"] path = .local/src/slock url = git@github.com:swy7ch/slock.git +[submodule ".local/src/astronomy.nvim"] + path = .local/src/astronomy.nvim + url = git@github.com:swy7ch/astronomy.nvim diff --git a/.local/src/astronomy.nvim b/.local/src/astronomy.nvim new file mode 160000 index 0000000..c329ff4 --- /dev/null +++ b/.local/src/astronomy.nvim @@ -0,0 +1 @@ +Subproject commit c329ff44d3aef42e8347563bf7ae119b5a2a2d70 From 268c870d041fa12aebebda32809ec0bc82e0b5c7 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 23 Oct 2021 02:54:42 +0200 Subject: [PATCH 12/14] feat: add $XDG_STATE_HOME directory adapt sb-battery and setbg scripts --- .local/bin/setbg | 7 ++++--- .local/bin/statusbar/sb-battery | 7 ++++--- .zshenv | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.local/bin/setbg b/.local/bin/setbg index cd91326..b40f800 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -13,8 +13,9 @@ # if $1 is a jpg file, set it as a wallpaper # if $1 is a directory, choose a randomized image in it, set it as wallpaper -[ -f "$1" ] && cp $1 "$XDG_CONFIG_HOME/wall.jpg" && dunstify -u "low" "Wallpaper changed" +wall="$XDG_STATE_HOME/wall.jpg" +[ -f "$1" ] && cp $1 "$wall" && dunstify -u "low" "Wallpaper changed" -[ -d "$1" ] && cp "$(find "$1"/*.jpg -type f | shuf -n 1)" "$XDG_CONFIG_HOME/wall.jpg" && dunstify -u "low" "Random wallpaper chosen" +[ -d "$1" ] && cp "$(find "$1"/*.jpg -type f | shuf -n 1)" "$" && dunstify -u "low" "Random wallpaper chosen" -xwallpaper --zoom "$XDG_CONFIG_HOME/wall.jpg" +xwallpaper --zoom "$wall" diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index cd07a56..82a5f32 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -15,16 +15,17 @@ # In any case, show the remaining battery percentage # Also sends a notification if battery running low +time="$XDG_STATE_HOME/batteryupdate" notify() { \ now=$(date +%s) - if [ -e $XDG_CONFIG_HOME/batteryupdate ]; then - old=$(cat $XDG_CONFIG_HOME/batteryupdate) + if [ -e $time ]; then + old=$(cat $time) delta=$(expr $now - $old) else delta=$now fi [ 300 -gt $delta ] && return; - echo $now > $XDG_CONFIG_HOME/batteryupdate + echo $now > $time case "$capacity" in 2[0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;; *) notify-send -u "critical" "Battery is dangerously low ($capacity%)" "Please plug your computer to a power source - NOW!" ;; diff --git a/.zshenv b/.zshenv index ab9145e..ba8353c 100644 --- a/.zshenv +++ b/.zshenv @@ -4,6 +4,7 @@ export XDG_CACHE_HOME="$HOME/.cache" export XDG_CONFIG_HOME="$HOME/.config" export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" export ZDOTDIR="$HOME/.config/zsh" From ca53077a593103ce03b178e1a2f1987ecb9a5444 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 22 Oct 2021 22:34:19 +0200 Subject: [PATCH 13/14] feat: change colorscheme, system-wide nvim: create the relevant utils switch-colors: change xcolors + nvim colorscheme -> $XDG_STATE_HOME/{xcolors,nvim_colorscheme} -> $XDG_DATA_HOME/colorschemes for correspondance sxhkd: keybindings --- .config/X11/xcolors_dark | 39 +++++++++++++++++++++++++++++ .config/X11/xcolors_light | 39 +++++++++++++++++++++++++++++ .config/X11/xprofile | 2 ++ .config/X11/xresources | 40 +++--------------------------- .config/nvim/lua/utils.lua | 18 ++++++++++++++ .config/sxhkd/sxhkdrc | 6 +++++ .local/bin/switch-colors | 50 ++++++++++++++++++++++++++++++++++++++ .local/share/colorschemes | 2 ++ 8 files changed, 159 insertions(+), 37 deletions(-) create mode 100644 .config/X11/xcolors_dark create mode 100644 .config/X11/xcolors_light create mode 100755 .local/bin/switch-colors create mode 100644 .local/share/colorschemes diff --git a/.config/X11/xcolors_dark b/.config/X11/xcolors_dark new file mode 100644 index 0000000..4ef9146 --- /dev/null +++ b/.config/X11/xcolors_dark @@ -0,0 +1,39 @@ +/* name dark light */ +/* black 0 8 */ +/* red 1 9 */ +/* green 2 10 */ +/* yellow 3 11 */ +/* blue 4 12 */ +/* purple 5 13 */ +/* cyan 6 14 */ +/* white 7 15 */ + +/* theme */ +*.color0: #131616 +*.color1: #b73935 +*.color2: #427d61 +*.color3: #f7a583 +*.color4: #458588 +*.color5: #b16286 +*.color6: #7cafa3 +*.color7: #d5c4a1 +*.color8: #373737 +*.color9: #ea6962 +*.color10: #89b594 +*.color11: #ffeca3 +*.color12: #7daea3 +*.color13: #d3869b +*.color14: #ace5d7 +*.color15: #fbf1c7 +*.background: #131616 +*.selbackground: #373737 +*.foreground: #fbf1c7 +*.normforeground: #a89984 +*.selforeground: #ebdbb2 +*.cursorColor: #ebdbb2 + +/* dmenu colors */ +dmenu.background: #131616 +dmenu.foreground: #fbf1c7 +dmenu.selbackground: #427d61 +dmenu.selforeground: #fbf1c7 diff --git a/.config/X11/xcolors_light b/.config/X11/xcolors_light new file mode 100644 index 0000000..4efad90 --- /dev/null +++ b/.config/X11/xcolors_light @@ -0,0 +1,39 @@ +/* name dark light */ +/* black 0 8 */ +/* red 1 9 */ +/* green 2 10 */ +/* yellow 3 11 */ +/* blue 4 12 */ +/* purple 5 13 */ +/* cyan 6 14 */ +/* white 7 15 */ + +/* theme */ +*.color0: #1d2021 +*.color1: #9d0006 +*.color2: #427d61 +*.color3: #d65d0e +*.color4: #076678 +*.color5: #8f3f71 +*.color6: #4a8785 +*.color7: #a89984 +*.color8: #373737 +*.color9: #b73935 +*.color10: #689d6a +*.color11: #d79921 +*.color12: #458588 +*.color13: #b16286 +*.color14: #7cafa3 +*.color15: #fbf1c7 +*.background: #fbf1c7 +*.selbackground: #ebdbb2 +*.foreground: #665c64 +*.normforeground: #665c64 +*.selforeground: #1d2021 +*.cursorColor: #1d2021 + +/* dmenu colors */ +dmenu.background: #fbf1c7 +dmenu.foreground: #665c64 +dmenu.selbackground: #427d61 +dmenu.selforeground: #fbf1c7 diff --git a/.config/X11/xprofile b/.config/X11/xprofile index c1a3f83..aa17a11 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -14,6 +14,8 @@ sbacklight set 3 & setbg & dwmblocks & xrdb "$XDG_CONFIG_HOME/X11/xresources" +xrdb -merge "$XDG_STATE_HOME/xcolors" +xautolock -locker slock -time 5 -corners 000- & xinput set-prop 'Synaptics TM3072-003' 'libinput Tapping Enabled' 1 & xinput set-prop 'Synaptics TM3072-003' 'libinput Natural Scrolling Enabled' 1 & diff --git a/.config/X11/xresources b/.config/X11/xresources index 46c4727..63e2d76 100644 --- a/.config/X11/xresources +++ b/.config/X11/xresources @@ -2,46 +2,12 @@ *.font: Iosevka Fixed Slab:size=12 *.symbols: Symbols Nerd Font:size=11 -/* name dark light */ -/* black 0 8 */ -/* red 1 9 */ -/* green 2 10 */ -/* yellow 3 11 */ -/* blue 4 12 */ -/* purple 5 13 */ -/* cyan 6 14 */ -/* white 7 15 */ - -/* theme */ -*.color0: #1d2021 -*.color1: #b73935 -*.color2: #5d9179 -*.color3: #f7a583 -*.color4: #458588 -*.color5: #b16286 -*.color6: #7cafa3 -*.color7: #d5c4a1 -*.color8: #373737 -*.color9: #ea6962 -*.color10: #89b482 -*.color11: #ffeca3 -*.color12: #7daea3 -*.color13: #d3869b -*.color14: #ace5d7 -*.color15: #fbf1c7 -*.background: #1d2021 -*.selbackground: #373737 -*.foreground: #fbf1c7 -*.normforeground: #a89984 -*.selforeground: #ebdbb2 -*.cursorColor: #ebdbb2 +/* dwm config */ +dwm.borderpx: 2 +dwm.gappx: 15 /* st config */ st.font: Iosevka Fixed Slab:size=14 st.symbols: Symbols Nerd Font:size=14 st.termname: st-256color st.borderpx: 5 - -/* dwm config */ -dwm.borderpx: 2 -dwm.gappx: 15 diff --git a/.config/nvim/lua/utils.lua b/.config/nvim/lua/utils.lua index 7fbb87a..e0f2e86 100644 --- a/.config/nvim/lua/utils.lua +++ b/.config/nvim/lua/utils.lua @@ -28,6 +28,24 @@ function M.map(mode, keys, action, options) vim.api.nvim_set_keymap(mode, keys, action, options) end +-- see if a file exists +function M.file_exists(file) + local f = io.open(file, "rb") + if f then f:close() end + return f ~= nil +end + +-- get all lines from a file +-- @return table (empty if the file does not exist) +function M.lines_from(file) + if not M.file_exists(file) then return {} end + local lines = {} + for line in io.lines(file) do + lines[#lines] = line + end + return lines +end + -- Make it accessible everywhere _G.utils = M -- Export the module diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index b5dfba8..b83d6b6 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -34,6 +34,12 @@ super + F9 super + shift + o dmenuopen +super + c + switch-colors + +super + shift + c + switch-colors -s + # Others super + Return $TERMINAL diff --git a/.local/bin/switch-colors b/.local/bin/switch-colors new file mode 100755 index 0000000..98e122d --- /dev/null +++ b/.local/bin/switch-colors @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +###################################################################### +# @author : swytch +# @file : switch-colors +# @license : GPLv3 +# @created : Fridat Oct. 22, 2022 23:52:53 CEST +# +# @description : switch colorscheme system-wide +###################################################################### + + +trim() { rev | cut -d'_' -f1 | rev; } + +switch_scheme() { + current="$(ls -l $XDG_CONFIG_HOME/X11/xcolors | trim)" + [ "dark" = "$current" ] && new="light" || new="dark" + select_nvim_scheme + set_scheme "$new" "$nvim_scheme" +} + +set_scheme() { + [ "" = "$new" ] && exit 1 + xcolors="$XDG_STATE_HOME/xcolors" + [ -f "$xcolors" ] && rm "$xcolors" + ln -s "$XDG_CONFIG_HOME/X11/xcolors_$new" "$xcolors" + xrdb -merge "$xcolors" && dunstify -u "low" "$new colorscheme set" + echo "$nvim_scheme" > "$XDG_STATE_HOME/nvim_colorscheme" + xrdb -merge "$xcolors" && dunstify -u "low" "neovim" "$nvim_scheme colorscheme set" +} + +select_scheme() { + new="$(ls "$XDG_CONFIG_HOME/X11" | grep -i "xcolors_" | trim | dmenu -i -l 5 -p "colorscheme:")" +} + +select_nvim_scheme() { + nvim_scheme="$(grep -i "$new" "$XDG_DATA_HOME/colorschemes" | cut -d'"' -f2 )" +} + +if [ "-s" = "$1" -o "select" = "$1" ]; then + select_scheme && select_nvim_scheme && set_scheme "$new" "$nvim_scheme" +else + if [ ! "" = "$1" ]; then + dunstify -u "normal" "Wrong parameter. Nothing performed" && exit 1 + else + switch_scheme + fi +fi + +exit 0 diff --git a/.local/share/colorschemes b/.local/share/colorschemes new file mode 100644 index 0000000..24df18f --- /dev/null +++ b/.local/share/colorschemes @@ -0,0 +1,2 @@ +"blackhole" dark +"pulsar" light From 1b55edd15c5fa94e5149830d8371f69fb787938f Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 23 Oct 2021 04:34:08 +0200 Subject: [PATCH 14/14] [system]fix: switch-colors --- .local/bin/switch-colors | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/switch-colors b/.local/bin/switch-colors index 98e122d..7652b17 100755 --- a/.local/bin/switch-colors +++ b/.local/bin/switch-colors @@ -13,7 +13,7 @@ trim() { rev | cut -d'_' -f1 | rev; } switch_scheme() { - current="$(ls -l $XDG_CONFIG_HOME/X11/xcolors | trim)" + current="$(ls -l $XDG_STATE_HOME/xcolors | trim)" [ "dark" = "$current" ] && new="light" || new="dark" select_nvim_scheme set_scheme "$new" "$nvim_scheme"