Browse Source

Merge branch 'dev' into gentoo

add $XDG_STATE_HOME and adapt scripts

nvim: introducing new colorscheme !
        -> add config file, utils
system: add light theme
system: change colorscheme, system-wide!
        -> add relevant scripts and config
gentoo
David JULIEN 8 months ago
parent
commit
c159408d5e
Signed by: swytch
GPG Key ID: 4B388E8BD9D47382
  1. 39
      .config/X11/xcolors_dark
  2. 39
      .config/X11/xcolors_light
  3. 1
      .config/X11/xprofile
  4. 40
      .config/X11/xresources
  5. 13
      .config/nvim/lua/colorscheme.lua
  6. 16
      .config/nvim/lua/lsp/init.lua
  7. 3
      .config/nvim/lua/maps.lua
  8. 2
      .config/nvim/lua/plugins.lua
  9. 6
      .config/nvim/lua/statusline.lua
  10. 18
      .config/nvim/lua/utils.lua
  11. 6
      .config/sxhkd/sxhkdrc
  12. 3
      .gitmodules
  13. 7
      .local/bin/setbg
  14. 7
      .local/bin/statusbar/sb-battery
  15. 50
      .local/bin/switch-colors
  16. 2
      .local/share/colorschemes
  17. 1
      .local/src/astronomy.nvim
  18. 1
      .zshenv

39
.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

39
.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

1
.config/X11/xprofile

@ -14,6 +14,7 @@ sbacklight set 3 &
setbg &
dwmblocks &
xrdb "$XDG_CONFIG_HOME/X11/xresources"
xrdb -merge "$XDG_STATE_HOME/xcolors"
xautolock -locker slock -time 5 -corners 000- &
setxkbmap 'fr(oss)'

40
.config/X11/xresources

@ -2,46 +2,12 @@
*.font: Fira Code:size=12
*.symbols: Font Awesome 5 Free: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: Fira Code:size=12
st.symbols: Font Awesome 5 Free:size=12
st.termname: st-256color
st.borderpx: 5
/* dwm config */
dwm.borderpx: 2
dwm.gappx: 15

13
.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,
}

16
.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"
}
)

3
.config/nvim/lua/maps.lua

@ -23,3 +23,6 @@ utils.map("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>")
utils.map("n", "<leader>tf", "<cmd>Telescope find_files<CR>")
utils.map("n", "<leader>tb", "<cmd>Telescope file_browser<CR>")
utils.map("n", "<leader>tl", "<cmd>Telescope live_grep<CR>")
-- colorscheme
utils.map("n", "<C-s>", "<cmd>lua require(\"astronomy\").toggle_variant()<CR>")

2
.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
}

6
.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#"
)
}
)

18
.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

6
.config/sxhkd/sxhkdrc

@ -32,6 +32,12 @@ super + shift + d
super + shift + o
dmenuopen
super + c
switch-colors
super + shift + c
switch-colors -s
# Others
super + Return
$TERMINAL

3
.gitmodules vendored

@ -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

7
.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"

7
.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 - <b>NOW!</b>" ;;

50
.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

2
.local/share/colorschemes

@ -0,0 +1,2 @@
"blackhole" dark
"pulsar" light

1
.local/src/astronomy.nvim

@ -0,0 +1 @@
Subproject commit c329ff44d3aef42e8347563bf7ae119b5a2a2d70

1
.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"

Loading…
Cancel
Save