Compare commits

...

18 Commits

Author SHA1 Message Date
c785d3927c nvim: add toggleterm 2023-08-03 11:58:22 +02:00
cbf8c1cd3d vi-like input, theme toggle, Makefile and update README 2023-08-03 07:10:12 +02:00
b9f9311e8c add package nvim-surround and remove wincmd move keys 2023-08-02 22:48:02 +02:00
3d6a0c7d06 dwm: change modkey, keys, colors, font and border width 2023-08-02 22:48:02 +02:00
c4505f031d nvim: add key for ColorizerToggle 2023-08-01 11:29:03 +02:00
1e8a99ff6d change caps to control and left windows key to escape 2023-08-01 10:18:36 +02:00
5e95c6fedd tmux: use color0 and color7 2023-08-01 10:17:25 +02:00
e4ee8729de nvim: enable lsp servers: clangd, gopls, rust_analyzer, tsserver 2023-07-31 21:24:36 +02:00
fef317a18a switch color scheme to tokyonight 2023-07-31 19:21:04 +02:00
e44c73f1c7 zsh: zap based config 2023-07-31 14:10:40 +02:00
db53671f68 add dwm config 2023-07-29 12:18:08 +02:00
104fd83815 remove st theme switching using sending signal 2023-07-29 12:18:08 +02:00
39b6738c66 caps:escape, dwm before xmonad, no emacs in bg 2023-07-29 12:18:08 +02:00
ebc3249391 nvim: add nvim-colorizer and alt bindings to move to window 2023-07-29 12:18:08 +02:00
375a316ac1 use st as terminal 2023-07-29 12:18:08 +02:00
c858ebbce3 use zsh-vi-mode plugin 2023-07-29 12:18:08 +02:00
70482d0f1a switch to xterm 2023-07-26 01:18:29 +02:00
591bfb2939 add nvim config 2023-07-26 01:00:07 +02:00
19 changed files with 810 additions and 441 deletions

3
.gitignore vendored
View File

@ -1,8 +1,11 @@
bspwm/.config/bspwm/themes/theme.sh
shell/.config/zsh/plugins/zsh-autosuggestions
shell/.config/zsh/plugins/zsh-syntax-highlighting
shell/.config/zsh/plugins/zsh-vi-mode
qtile/.config/qtile/theme.txt
lupan-clock/lupan-clock
lupan-wm/target
*~
__pycache__
/dwm
/st

45
Makefile Normal file
View File

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

View File

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

View File

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

View File

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

518
nvim/.config/nvim/init.lua Normal file
View File

@ -0,0 +1,518 @@
-- Set <space> as the leader key (must be before plugins)
-- See `:help mapleader`
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Disable netrw: suggested for neovim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Install package manager (`:help lazy.nvim.txt`)
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
-- Install and configure packages
require('lazy').setup({
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
{
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
},
},
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
},
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk,
{ buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
vim.keymap.set('n', '<leader>sh', require('gitsigns').stage_hunk, { buffer = bufnr, desc = '[S]tage [H]unk' })
end,
},
},
{
"folke/tokyonight.nvim",
priority = 1000,
config = function()
vim.cmd.colorscheme 'tokyonight'
end
},
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'tokyonight',
component_separators = '|',
section_separators = '',
},
},
},
{
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc)
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
},
{
'nvim-tree/nvim-tree.lua',
dependencies = {
'nvim-tree/nvim-web-devicons'
},
opts = {
hijack_cursor = true,
view = {
width = 40,
},
},
},
'nvim-orgmode/orgmode',
'norcalli/nvim-colorizer.lua',
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
},
{
'akinsho/toggleterm.nvim',
version = "*",
opts = {
direction = "float",
open_mapping = [[<C-\>]],
}
}
-- See: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' },
}, {})
-- [[ Org mode ]]
local org = require('orgmode')
org.setup_ts_grammar()
require('nvim-treesitter.configs').setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { 'org' },
},
ensure_installed = { 'org' }, -- Or run :TSUpdate org
}
org.setup({
org_agenda_files = { '~/org/*.org' },
org_default_notes_file = '~/org/capture.org',
})
-- [[ Setting options ]]
-- See `:help vim.o`
-- Set highlight on search
vim.o.hlsearch = false
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
-- [[ Basic Keymaps ]]
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set("n", "<leader>tt", ":NvimTreeToggle<cr>", { desc = "[T]oggle Nvim [T]ree" })
vim.keymap.set("n", "<leader>ct", ":ColorizerToggle<cr>", { desc = "[C]olorizer [T]oggle" })
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
clangd = {},
gopls = {},
-- pyright = {},
rust_analyzer = {},
tsserver = {},
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
}
-- Setup neovim lua configuration
require('neodev').setup()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
}
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
vim.cmd('autocmd BufWritePre *.go :Format')
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

121
patches/dwm/config.h Normal file
View File

@ -0,0 +1,121 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "FiraCode Nerd Font Ret:size=10" };
static const char dmenufont[] = "FiraCode Nerd Font Ret:size=10";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_blue[] = "#414868";
static const char col_cyan[] = "#7dcfff";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_blue, col_cyan },
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_blue, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *suspendcmd[] = { "systemctl", "suspend", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY|ControlMask, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ControlMask|ShiftMask, XK_l, spawn, {.v = lockcmd } },
{ MODKEY|ControlMask|ShiftMask, XK_s, spawn, {.v = suspendcmd } },
{ MODKEY|ControlMask, XK_b, togglebar, {0} },
{ MODKEY|ControlMask, XK_j, focusstack, {.i = +1 } },
{ MODKEY|ControlMask, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ControlMask, XK_i, incnmaster, {.i = +1 } },
{ MODKEY|ControlMask, XK_d, incnmaster, {.i = -1 } },
{ MODKEY|ControlMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ControlMask, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_c, killclient, {0} },
{ MODKEY|ControlMask, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY|ControlMask, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|ControlMask, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static const Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View File

@ -1,231 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 91ab8ca..5bbc088 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,7 +5,7 @@
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
+static char *font = "Iosevka Slab Light:size=12:antialias=true:autohint=true";
static int borderpx = 2;
/*
@@ -95,35 +95,61 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
- /* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
-
- /* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
+ /* windi dark */
+ "#1f1f1f", /* 0: black */
+ "#ef4444", /* 1: red */
+ "#22c55e", /* 2: green */
+ "#eab308", /* 3: yellow */
+ "#3b82f6", /* 4: blue */
+ "#d946ef", /* 5: magenta */
+ "#06b6d4", /* 6: cyan */
+ "#f2f2f2", /* 7: white */
+ "#737373", /* 8: brblack */
+ "#fecaca", /* 9: brred */
+ "#bbf7d0", /* 10: brgreen */
+ "#fef08a", /* 11: bryellow */
+ "#bfdbfe", /* 12: brblue */
+ "#f5d0fe", /* 13: brmagenta*/
+ "#a5f3fc", /* 14: brcyan */
+ "#fafafa", /* 15: brwhite */
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
- "gray90", /* default foreground colour */
- "black", /* default background colour */
+ "white",
+ "black",
+ "#E7E7E7", /* default foreground colour */
+ "#2C444D",
};
+/* Terminal colors for alternate (light) palette */
+static const char *altcolorname[] = {
+ /* windi light */
+ "#1b1b1b", /* 0: black */
+ "#b91c1c", /* 1: red */
+ "#15803d", /* 2: green */
+ "#a16207", /* 3: yellow */
+ "#1d4ed8", /* 4: blue */
+ "#a21caf", /* 5: magenta*/
+ "#0e7490", /* 6: cyan */
+ "#e9ecef", /* 7: white */
+ "#404040", /* 8: brblack */
+ "#ef4444", /* 9: brred */
+ "#22c55e", /* 10: brgreen */
+ "#eab308", /* 11: bryellow */
+ "#3b82f6", /* 12: brblue */
+ "#d946ef", /* 13: brmagenta */
+ "#06b6d4", /* 14: brcyan */
+ "#f2f2f2", /* 15: brwhite */
+
+ [255] = 0,
+
+ /* more colors can be added after 255 to use with DefaultXX */
+ "#00638a",
+ "#f2f2f2",
+ "#454545", /* default foreground colour */
+ "#f2f2f2",
+};
/*
* Default colors (colorname index)
@@ -201,6 +227,7 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
};
/*
diff --git a/st.h b/st.h
index 519b9bd..c25b693 100644
--- a/st.h
+++ b/st.h
@@ -122,6 +122,7 @@ extern wchar_t *worddelimiters;
extern int allowaltscreen;
extern int allowwindowops;
extern char *termname;
+extern int usealtcolors;
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
diff --git a/x.c b/x.c
index 8a16faa..4b569df 100644
--- a/x.c
+++ b/x.c
@@ -55,6 +55,7 @@ static void clipcopy(const Arg *);
static void clippaste(const Arg *);
static void numlock(const Arg *);
static void selpaste(const Arg *);
+static void swapcolors(const Arg *);
static void zoom(const Arg *);
static void zoomabs(const Arg *);
static void zoomreset(const Arg *);
@@ -254,6 +255,8 @@ static char *opt_title = NULL;
static int oldbutton = 3; /* button event on startup: 3 = release */
+int usealtcolors = 0; /* 1 to use alternate palette */
+
void
clipcopy(const Arg *dummy)
{
@@ -292,6 +295,18 @@ numlock(const Arg *dummy)
win.mode ^= MODE_NUMLOCK;
}
+void
+swapcolors(const Arg *arg)
+{
+ int next = (arg->i == 'D') ? 0 : (arg->i == 'L') ? 1 : !usealtcolors;
+
+ if (next != usealtcolors) {
+ usealtcolors = next;
+ xloadcols();
+ redraw();
+ }
+}
+
void
zoom(const Arg *arg)
{
@@ -750,6 +765,11 @@ sixd_to_16bit(int x)
return x == 0 ? 0 : 0x3737 + 0x2828 * x;
}
+const char* getcolorname(int i)
+{
+ return (usealtcolors) ? altcolorname[i] : colorname[i];
+}
+
int
xloadcolor(int i, const char *name, Color *ncolor)
{
@@ -768,7 +788,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
return XftColorAllocValue(xw.dpy, xw.vis,
xw.cmap, &color, ncolor);
} else
- name = colorname[i];
+ name = getcolorname(i);
}
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
@@ -791,8 +811,8 @@ xloadcols(void)
for (i = 0; i < dc.collen; i++)
if (!xloadcolor(i, NULL, &dc.col[i])) {
- if (colorname[i])
- die("could not allocate color '%s'\n", colorname[i]);
+ if (getcolorname(i))
+ die("could not allocate color '%s'\n", getcolorname(i));
else
die("could not allocate color %d\n", i);
}
@@ -1184,13 +1204,13 @@ xinit(int cols, int rows)
cursor = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, cursor);
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
xmousefg.red = 0xffff;
xmousefg.green = 0xffff;
xmousefg.blue = 0xffff;
}
- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
xmousebg.red = 0x0000;
xmousebg.green = 0x0000;
xmousebg.blue = 0x0000;
@@ -2008,6 +2028,15 @@ usage(void)
" [stty_args ...]\n", argv0, argv0);
}
+void
+sig_usr_handler(int num)
+{
+ Arg a = { .i = (num == 10) ? 'D' : 'L' };
+ signal(num, sig_usr_handler);
+ swapcolors(&a);
+}
+
+
int
main(int argc, char *argv[])
{
@@ -2066,6 +2095,8 @@ run:
if (!opt_title)
opt_title = (opt_line || !opt_cmd) ? "st" : opt_cmd[0];
+ signal(SIGUSR1, sig_usr_handler);
+ signal(SIGUSR2, sig_usr_handler);
setlocale(LC_CTYPE, "");
XSetLocaleModifiers("");
cols = MAX(cols, 1);

View File

@ -1,6 +0,0 @@
Directory for plugins. Checkout here
1. zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions)
2. zsh-syntax-highlighting (https://github.com/zsh-users/zsh-syntax-highlighting)
or install then with package manager in /usr/share/zsh/plugins/ and symlink.

1
shell/.haskeline Normal file
View File

@ -0,0 +1 @@
editMode: Vi

5
shell/.inputrc Normal file
View File

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

View File

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

View File

@ -1,107 +1,32 @@
# History.
# Install zap:
# % cd ~/.local/share
# % git clone https://github.com/zap-zsh/zap.git --branch=release-v1
HISTFILE=${ZDOTDIR:-~}/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_find_no_dups
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt inc_append_history
setopt share_history
export FZF_DEFAULT_OPTS='--color=bw,hl:green,hl+:green'
zstyle ':fzf-tab:*' fzf-flags $FZF_DEFAULT_OPTS
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
plug "zap-zsh/supercharge"
plug "zap-zsh/exa"
plug "zap-zsh/vim"
autoload -Uz compinit
compinit
plug "Aloxaf/fzf-tab"
plug "zap-zsh/fzf"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-syntax-highlighting"
# Prompt.
autoload -Uz vcs_info
precmd () { vcs_info }
setopt prompt_subst
zstyle ':vcs_info:git:*' formats '%F{magenta}(%b)%r%f '
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b)%u%c%f '
zstyle ':vcs_info:git:*' actionformats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b|%a)%u%c%f '
zstyle ':vcs_info:*' nvcsformats '%F{green}%~%f%b '
zstyle ':vcs_info:*' enable git
PS1='%B%F{blue}%n@%m%f %F{green}%~%f%b ${vcs_info_msg_0_}%B%#%f%b '
PS1='%B%F{blue}%n@%m%f ${vcs_info_msg_0_}%B%#%f%b '
RPROMPT='%(?..%B%F{red}%?%f%b)'
# Completion.
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
# Options.
setopt auto_cd
setopt extended_glob
setopt glob_complete
setopt interactive_comments
setopt no_flow_control
WORDCHARS=
# Terminal title.
autoload -Uz add-zsh-hook
function xterm_title_precmd () {
print -Pn -- '\e]2;%n@%m %~\a'
}
function xterm_title_preexec () {
print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
}
if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
add-zsh-hook -Uz precmd xterm_title_precmd
add-zsh-hook -Uz preexec xterm_title_preexec
fi
# Vterm directory.
function vterm_printf () {
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
function vterm_prompt_end () {
vterm_printf "51;A$(pwd)";
}
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
add-zsh-hook -Uz chpwd vterm_prompt_end
fi
# Plugins.
source_if_exists() {
[ -e "$1" ] && source "$1"
}
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5,underline"
source_if_exists ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
if source_if_exists ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; then
ZSH_HIGHLIGHT_STYLES[comment]=fg=cyan,bold
fi
# Directory stack and ls colors.
DIRSTACKSIZE=10
setopt auto_pushd pushd_minus pushd_silent pushd_to_home pushd_ignore_dups
eval $(dircolors)
# Aliases.
alias dh='dirs -v'
alias e='emacsclient -n'
alias history='history -i'
alias ls='ls --color=tty'

View File

@ -1,5 +1,5 @@
set -g status-bg colour246
set -g status-fg colour235
set -g status-bg colour0
set -g status-fg colour7
set -g prefix C-t
bind-key C-t send-prefix

View File

@ -29,7 +29,7 @@ ifDark dark light = if isDark then dark else light
myConfig =
def
{ modMask = mod4Mask,
terminal = "alacritty",
terminal = "st",
borderWidth = 3,
focusedBorderColor = ifDark "#a0522d" "#ff7f50",
normalBorderColor = ifDark "#708090" "#bebebe",
@ -59,9 +59,9 @@ myConfig =
]
scratchpads =
[ NS "terminal" "alacritty -t terminal" (title =? "terminal") floating,
[ NS "terminal" "st -T terminal" (title =? "terminal") floating,
NS "thunar" "thunar" (className =? "Thunar") floating,
NS "top" "alacritty -t top -e top" (title =? "top") floating
NS "top" "st -T top -e top" (title =? "top") floating
]
where
floating = customFloating $ RationalRect (1 / 6) (1 / 6) (2 / 3) (2 / 3)

View File

@ -12,3 +12,44 @@ emacs.cursorBlink: false
emacs.scrollBarWidth: 20
emacs.background: #424242
emacs.foreground: #E0E0E0
XTerm.vt100.faceName: Iosevka NFM Light:size=12
! Colors from rmehri01/onenord.nvim
XTerm.vt100.foreground: #E5E9F0
XTerm.vt100.background: #2E3440
XTerm.vt100.highlightColor: #3F4758
XTerm.vt100.cursorColor: #81A1C1
! black
XTerm.vt100.color0: #3B4252
XTerm.vt100.color8: #4C566A
! red
XTerm.vt100.color1: #E06C75
XTerm.vt100.color9: #E06C75
! green
XTerm.vt100.color2: #9EC183
XTerm.vt100.color10: #9EC183
! yellow
XTerm.vt100.color3: #EBCB8B
XTerm.vt100.color11: #EBCB8B
! blue
XTerm.vt100.color4: #81A1C1
XTerm.vt100.color12: #81A1C1
! magenta
XTerm.vt100.color5: #B988B0
XTerm.vt100.color13: #B988B0
! cyan
XTerm.vt100.color6: #88C0D0
XTerm.vt100.color14: #8FBCBB
! white
XTerm.vt100.color7: #E5E9F0
XTerm.vt100.color15: #ECEFF4

View File

@ -1,5 +1,6 @@
! make right windows key and menu key a hyper key
remove mod4 = Super_R
keycode 133 = Escape NoSymbol Escape
keycode 134 = Hyper_R NoSymbol Hyper_R
keycode 135 = Hyper_R NoSymbol Hyper_R
add mod3 = Hyper_R

View File

@ -24,24 +24,26 @@ else
( echo "Missing command(s):"; which xss-lock slock 2>&1 ) | xmessage -file -
fi
# run emacs daemon if not running
emacsclient --eval nil -a '' &
xsettingsd &
xsetroot -cursor_name left_ptr
picom -b -I 1 -O 1 -i 1 -e 1 --no-fading-openclose || compton -b --no-fading-openclose
if which xmonad > /dev/null && test -f ~/.stumpwm.d/init.lisp; then
export SBCL_HOME="$(dirname $(dirname $(readlink -f $(which sbcl))))/lib/sbcl/"
exec stumpwm
if which dwm > /dev/null; then
lupan-clock &
exec dwm
fi
if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then
exec xmonad
fi
if which stumpwm > /dev/null && test -f ~/.stumpwm.d/init.lisp; then
export SBCL_HOME="$(dirname $(dirname $(readlink -f $(which sbcl))))/lib/sbcl/"
exec stumpwm
fi
if which qtile > /dev/null && test -f ~/.config/qtile/config.py; then
exec qtile start
fi
@ -65,9 +67,4 @@ if which i3 > /dev/null; then
exec i3
fi
if which dwm > /dev/null; then
lupan-clock &
exec dwm
fi
exec xterm

View File

@ -2,26 +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
SIGNAL=USR1
BGCOLOR=#4a4a4a
GTK_THEME=Materia-dark
elif [ "$THEME" = light ]; then
SIGNAL=USR2
BGCOLOR=#dde1e3
GTK_THEME=Materia-light
elif [ "$THEME" = faff ]; then
SIGNAL=USR2
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
@ -29,9 +29,6 @@ if [ -f ~/.config/alacritty/alacritty.yml ]; then
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
fi
# ST (patched)
pkill -$SIGNAL -x st
# GTK
if [ -f ~/.config/xsettingsd/xsettingsd.conf ]; then
sed -i -E "s#(Net/ThemeName) .*#\\1 \"${GTK_THEME}\"#" ~/.config/xsettingsd/xsettingsd.conf