feat: add polybar config

This commit is contained in:
max_richter 2021-10-27 20:37:42 +02:00
parent 5ad9266f34
commit 3042da1a97
12 changed files with 353 additions and 125 deletions

View File

@ -4,6 +4,8 @@
- [ZSH](https://www.zsh.org/) + [oh-my-zsh](https://ohmyz.sh/) + [p10k](https://github.com/romkatv/powerlevel10k) - [ZSH](https://www.zsh.org/) + [oh-my-zsh](https://ohmyz.sh/) + [p10k](https://github.com/romkatv/powerlevel10k)
- [asdf version manager](https://asdf-vm.com/#/) - [asdf version manager](https://asdf-vm.com/#/)
- [pre-configured](./configs/init.lua) [neovim](https://neovim.io/) - [pre-configured](./configs/init.lua) [neovim](https://neovim.io/)
- [tmux](https://github.com/tmux/tmux)
- [i3](https://i3wm.org)
- 1 line installation - 1 line installation
## Installation ## Installation

78
configs/.Xresources Normal file
View File

@ -0,0 +1,78 @@
Xft.autohint: 0
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
URxvt.font: xft:FiraMono Nerd Font:size=11:antialias=true
URxvt.boldFont: xft:FiraMono Nerd Font:bold:size=11:antialias=true
URxvt.italicFont: xft:FiraMono Nerd Font:italic:size=11:antialias=true
URxvt.letterSpace: -1
URxvt.lineSpace: 0
URxvt.geometry: 92x24
URxvt.internalBorder: 10
URxvt.externalBorder: 0
URxvt.cursorBlink: true
URxvt.cursorUnderline: false
URxvt.saveline: 2048
URxvt.scrollBar: false
URxvt.scrollBar_right: false
URxvt.urgentOnBell: true
URxvt.depth: 24
URxvt.imLocale: en_US.utf8
URxvt.perl-ext-common: default,matcher,font-size
URxvt.font-size.step: 2
! Resize Text
URxvt.keysym.C-Up: font-size:increase
URxvt.keysym.C-Down: font-size:decrease
! Enable Copy/Paste
Rxvt.iso14755: false
URxvt.iso14755_52: false
URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
! margins
*.gap: 6
! special
*.foreground: #c0c5ce
*.background: #2b303b
*.cursorColor: #c0c5ce
! black
*.color0: #2b303b
*.color8: #65737e
! red
*.color1: #bf616a
*.color9: #bf616a
! green
*.color2: #a3be8c
*.color10: #a3be8c
! yellow
*.color3: #ebcb8b
*.color11: #ebcb8b
! blue
*.color4: #8fa1b3
*.color12: #8fa1b3
! magenta
*.color5: #b48ead
*.color13: #b48ead
! cyan
*.color6: #96b5b4
*.color14: #96b5b4
! white
*.color7: #c0c5ce
*.color15: #eff1f5

View File

@ -80,11 +80,11 @@
# Red prompt symbol if the last command failed. # Red prompt symbol if the last command failed.
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
# Default prompt symbol. # Default prompt symbol.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='' typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
# Prompt symbol in command vi mode. # Prompt symbol in command vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='' typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='>'
# Prompt symbol in visual vi mode is the same as in command mode. # Prompt symbol in visual vi mode is the same as in command mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='' typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='>'
# Prompt symbol in overwrite vi mode is the same as in command mode. # Prompt symbol in overwrite vi mode is the same as in command mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false

View File

@ -104,8 +104,8 @@ bindsym $mod+a focus parent
# Define names for default workspaces for which we configure key bindings later on. # Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places. # We use variables to avoid repeating the names in multiple places.
set $ws1 "1:  Terminal" set $ws1 "1: Terminal"
set $ws2 "2:  FireFox" set $ws2 "2: Browser"
set $ws3 "3" set $ws3 "3"
set $ws4 "4" set $ws4 "4"
set $ws5 "5" set $ws5 "5"
@ -171,31 +171,20 @@ mode "resize" {
bindsym $mod+r mode "default" bindsym $mod+r mode "default"
} }
for_window [class="^.*"] border pixel 2
set_from_resource $gap i3wm.gap 7
set $bg-color #2f343f set $bg-color #2f343f
set $inactive-bg-color #2f343f set $inactive-bg-color #2f343f
set $text-color #f3f4f5 set $text-color #f3f4f5
set $inactive-text-color #676E7D set $inactive-text-color #676E7D
set $urgent-bg-color #E53935 set $urgent-bg-color #E53935
gaps inner $gap
gaps outer 0
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# bar
bar {
status_command i3status
strip_workspace_numbers yes
colors {
background $bg-color
separator #757575
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $text-color
}
}
#bindsym $mod+d exec rofi -show run -lines 3 -hide-scrollbar 1 -opacity "50" -width 30 -theme Arc-Dark -font "System San Francisco Display 10" #bindsym $mod+d exec rofi -show run -lines 3 -hide-scrollbar 1 -opacity "50" -width 30 -theme Arc-Dark -font "System San Francisco Display 10"
bindsym $mod+d exec dmenu_run bindsym $mod+d exec dmenu_run
@ -204,15 +193,21 @@ bindsym $mod+Tab exec rofi -show window -lines 5 -opacity "50" -width 30 -theme
# Always set the keymap to de # Always set the keymap to de
exec_always "setxkbmap de" exec_always "setxkbmap de"
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
# Bind window+l to lock the screen # Bind window+l to lock the screen
bindsym $mod+e exec nautilus bindsym $mod+e exec nautilus
exec_always feh --bg-scale /home/users/user/.customize/wallpapers/fakurian-design.jpg bindsym $mod+c exec gnome-control-center
exec_always feh --bg-scale /home/users/user/customize/wallpapers/fakurian-design.jpg
exec_always systembus-notify
exec_always earlyoom -n
exec --no-startup-id "compton -b -c"
# window colors # window colors
# border background text indicator # border background text indicator
client.focused $bg-color $bg-color $text-color #00ff00 client.focused $bg-color $bg-color $text-color #e8e8e8
client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #e8e8e8
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #ffff00
client.urgent $urgent-bg-color $urgent-bg-color $text-color #00ff00 client.urgent $urgent-bg-color $urgent-bg-color $text-color #ffff00

View File

@ -10,31 +10,39 @@ require ("plugins")
if u.has_plugin("cmp") then if u.has_plugin("cmp") then
-- Global options -- Global options
o.number = true o.number = true -- show line number
o.tabstop = 2 o.tabstop = 2
o.shiftwidth = 2 -- Indents will have a width of 4 o.shiftwidth = 2 -- Indents will have a width of 4
o.softtabstop = 2 -- Sets the number of columns for a TAB o.softtabstop = 2 -- Sets the number of columns for a TAB
o.expandtab = false -- Dont expand TABs to spaces o.expandtab = false -- Dont expand TABs to spaces
o.autoindent = true o.autoindent = true
cmd [[set mouse=a]] o.showmatch = true -- show matching brackets
o.swapfile = false
g.hidden = true --unload buffers when hidden
g.filetype = true -- execute autocommands based on filetype
cmd [[set mouse=a]] -- enable mouse interaction
cmd [[set undofile]] cmd [[set undofile]]
cmd [[set fcs=eob:\ ]] cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
cmd [[set noshowmode]] --to get rid of thing like --INSERT-- cmd [[set noshowmode]] --to get rid of thing like --INSERT--
cmd [[set noshowcmd]] --to get rid of display of last command cmd [[set noshowcmd]] --to get rid of display of last command
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
cmd [[set noruler]] cmd [[set noruler]]
-- Apply Theme -- Enable Theming / Syntax
o.syntax = "enable" o.syntax = "enable"
o.termguicolors = true o.termguicolors = true
--g.NERDTreeShowHidden = true cmd("colorscheme material")
--g.NERDTreeAutoDeleteBuffer = true g.material_terminal_italics = 1
--g.NERDTreeMinimalUI = true g.material_theme_style = "darker"
--g.NERDTreeDirArrows = true -- Remove background color
-- g.NERDTreeCustomOpenArgs = {file = {where = "t"}} require("transparent").setup({enable = true})
cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none")
g.nvim_tree_root_folder_modifier = ":~:." -- Configure nvim-tree
g.nvim_tree_special_files = {} g.nvim_tree_special_files = {}
g.nvim_tree_icons = { g.nvim_tree_icons = {
default = "", default = "",
@ -49,8 +57,8 @@ if u.has_plugin("cmp") then
ignored = "" ignored = ""
}, },
folder = { folder = {
arrow_open = "", arrow_open = " ",
arrow_closed = "", arrow_closed = " ",
default = "", default = "",
open = "", open = "",
empty = "", empty = "",
@ -66,18 +74,31 @@ if u.has_plugin("cmp") then
} }
} }
g.hidden = true require("nvim-tree").setup {
g.filetype = true auto_open = 1,
g.material_terminal_italics = 1 gitignore = 1,
g.material_theme_style = "darker" group_empty = 1,
hijack_cursor = 1,
update_focused_file = {
enable = false,
},
diagnostics = {
enable = true
},
view = {
auto_resize = true,
hide_root_folder = true,
winopts = {
signcolumn = "no"
}
}
}
require('nvim-tree.view').View.winopts.signcolumn = 'no'
-- Configure Wiki
g.wiki_root = "~/Notes" g.wiki_root = "~/Notes"
g.wiki_filetypes = {"md"} g.wiki_filetypes = {"md"}
g.wiki_link_extension = ".md" g.wiki_link_extension = ".md"
cmd("colorscheme material")
-- Remove background color
require("transparent").setup({enable = true})
cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none")
-- KeyBindings -- KeyBindings
g.mapleader = " " g.mapleader = " "
@ -97,58 +118,12 @@ if u.has_plugin("cmp") then
require'nvim-autopairs'.setup() require'nvim-autopairs'.setup()
-- Treesitter config -- Treesitter config
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() require "treesitter-conf"
parser_configs.http = {
install_info = {
url = "https://github.com/NTBBloodbath/tree-sitter-http",
files = {"src/parser.c"},
branch = "main"
}
}
require "nvim-treesitter.configs".setup {
ensure_installed = {
"bash",
"yaml",
"http",
"svelte",
"css",
"svelte",
"typescript",
"javascript",
"go",
"lua",
"yaml"
},
highlight = {enable = true}
}
-- Toggleterm / Lazygit setup -- Toggleterm / Lazygit setup
require "lazy-git" require "lazy-git"
require("nvim-tree").setup {
auto_open = 1,
gitignore = 1,
group_empty = 1,
diagnostics = {
enable = true
},
view = {
hide_root_folder = true,
winopts = {
signcolumn = "no"
}
}
}
-- Autocommands
--[[ u.create_augroup(]]
--[[{]]
--[[{"StdinReadPre", "*", "let s:std_in=1"},]]
--[[{"VimEnter", "*", "if argc() == 0 && !exists('s:std_in') | NERDTree | endif"},]]
--[[{"BufEnter", "*", 'if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif'},]]
--[[{"BufWinEnter", "*", "if getcmdwintype() == '' | silent NERDTreeMirror | endif"}]]
--[[},]]
--[["Nerdtree"]]
--[[)]]
-- Setup rest.vim -- Setup rest.vim
require("rest-nvim").setup( require("rest-nvim").setup(
{ {
@ -167,11 +142,11 @@ if u.has_plugin("cmp") then
) )
-- Autocompletion Setup -- Autocompletion Setup
o.completeopt = "menuone,noselect" o.completeopt = "menuone,noselect,noinsert"
require "autocomplete" require "autocomplete"
-- LSP Config -- LSP Config
require "lspinstall".setup() require "lspinstaller-conf"
require "lsp-utils" require "lsp-utils"
else else

View File

@ -4,16 +4,30 @@ local g = vim.g
local options = {noremap = true} local options = {noremap = true}
local remap = {noremap = false} local remap = {noremap = false}
map("n", "<Space>", "<Nop>", remap) --map("n", "<Space>", "<Nop>", remap)
map("n", " ", "<Nop>", remap) --map("n", " ", "<Nop>", remap)
g.mapleader = " " g.mapleader = " "
map("n", "<C-p>", ":Telescope find_files<CR>", options) map("n", "<C-p>", ":Telescope find_files<CR>", options)
--map("n", "<C-f>", ":Telescope grep_string<CR>", options) --map("n", "<C-f>", ":Telescope grep_string<CR>", options)
map("n", "<C-S-f>", ":Telescope live_grep<CR>", options) map("n", "<C-f>", ":Telescope live_grep<CR>", options)
map("n", "<Leader>c", ":CodeActionMenu<CR>", remap) map("n", "<Leader>c", ":CodeActionMenu<CR>", remap)
-- LSP Functionality
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", options)
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", options)
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", options)
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
map("n", "<Leader><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options)
map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options)
-- Navigate Buffers -- Navigate Buffers
map("n", "<C-h>", "<C-w>h", options) map("n", "<C-h>", "<C-w>h", options)
map("n", "<C-j>", "<C-w>j", options) map("n", "<C-j>", "<C-w>j", options)
@ -21,7 +35,7 @@ map("n", "<C-k>", "<C-w>k", options)
map("n", "<C-l>", "<C-w>l", options) map("n", "<C-l>", "<C-w>l", options)
-- Find file in NvimTree -- Find file in NvimTree
map("n", "<C-f>", ":NvimTreeFindFile<CR><c-w>", options) map("n", "<Leader>f", ":NvimTreeFindFile<CR><c-w>", options)
-- I aint no weak boy -- I aint no weak boy
map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", options) map("n", "<Left>", ":echo 'No Left for you'<CR><i><dw>", options)

View File

@ -15,16 +15,6 @@ local function on_attach(client)
-- Mappings. -- Mappings.
local opts = {noremap = true, silent = true} local opts = {noremap = true, silent = true}
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "<Leader><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then

View File

@ -0,0 +1,14 @@
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
end)

View File

@ -16,6 +16,7 @@ return require("packer").startup(function()
use "kyazdani42/nvim-web-devicons" use "kyazdani42/nvim-web-devicons"
use "kyazdani42/nvim-tree.lua" use "kyazdani42/nvim-tree.lua"
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
use "mhinz/vim-startify"
-- Code Navigation -- Code Navigation
use "dense-analysis/ale" use "dense-analysis/ale"
@ -32,7 +33,7 @@ return require("packer").startup(function()
-- Syntax / Autocomplete -- Syntax / Autocomplete
use "preservim/nerdcommenter" use "preservim/nerdcommenter"
use "neovim/nvim-lspconfig" use "neovim/nvim-lspconfig"
use "kabouzeid/nvim-lspinstall" use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim" use "nvim-lua/lsp-status.nvim"
use "hrsh7th/nvim-cmp" use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-nvim-lsp"

View File

@ -0,0 +1,26 @@
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
parser_configs.http = {
install_info = {
url = "https://github.com/NTBBloodbath/tree-sitter-http",
files = {"src/parser.c"},
branch = "main"
}
}
require "nvim-treesitter.configs".setup {
ensure_installed = {
"bash",
"yaml",
"http",
"svelte",
"css",
"svelte",
"typescript",
"javascript",
"go",
"lua",
"yaml"
},
highlight = {enable = true}
}

13
configs/polybar-launch.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# Terminate already running bar instances
killall -q i3bar
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.conig/polybar/config
polybar base &
echo "Polybar launched..."

120
configs/polybar.conf Normal file
View File

@ -0,0 +1,120 @@
;--------------------------------------------
; settings ;
;--------------------------------------------
[settings]
screenchange-reload = true
;--------------------------------------------
; colors ;
;--------------------------------------------
[colors]
bar_bg = ${xrdb:color0}
bar_fg = ${xrdb:color7}
border_col = ${xrdb:color0}
modules_bg = ${xrdb:color7}
modules_fg = ${xrdb:color0}
mod_bg = ${xrdb:color7}
modules_prefix_bg = ${xrdb:color7}
modules_prefix_fg = ${xrdb:color0}
urgent_bg = ${xrdb:color1}
focused_bg = ${xrdb:color10}
essid_p_bg = ${xrdb:color6}
down_p_bg = #5e606c
cpu_p_bg = ${xrdb:color5}
ram_p_bg = ${xrdb:color11}
vol_p_bg = #637b81
bright_p_bg = #c29f6f
battery_p_bg = ${xrdb:color9}
time_p_bg = ${xrdb:color10}
;--------------------------------------------
; bars ;
;--------------------------------------------
[bar/base]
dpi = 192
width = 100%
height = 32
offset-x = 0
offset-y = 0
bottom = false
background = ${xrdb:background}
foreground = ${xrdb:color7}
border-bottom-size = 0
border-top-size = ${xrdb:gap}
border-left-size = ${xrdb:gap}
border-right-size = ${xrdb:gap}
border-bottom-color = #000f0f0f
border-top-color = #000f0f0f
border-left-color = #000f0f0f
border-right-color = #000f0f0f
spacing = 0
padding-left = 0
padding-right = 2
module-margin-left = 0
font-N = <fontconfig pattern>;<vertical offset>
font-0 = FiraMono Nerd:size=4;2
font-1 = Font Awesome 5 Free Regular:pixelsize=14;-1
font-2 = Font Awesome 5 Brands:pixelsize=4;2
fixed-center = true
modules-left = i3
modules-center = date
modules-right = cpu ram
;--------------------------------------------
; modules ;
;--------------------------------------------
[module/date]
type = internal/date
interval = 1.0
time = "%I:%M %p"
label = "%time%"
format = <label>
format-padding = 0
label-padding = 4
[module/i3]
type = internal/i3
; Only show workspaces defined on the same output as the bar
pin-workspaces = true
; This will split the workspace name on ':'
strip-wsnumbers = true
index-sort = true
enable-scroll = false
label-separator = |
label-separator-padding = 2
[module/ram]
type = internal/memory
format = <label>
label = " MEM: %mb_free% | %percentage_free%%"
[module/cpu]
type = internal/cpu
format = <label>
label = CPU %percentage%%