mirror of
https://github.com/purhan/dotfiles.git
synced 2025-12-26 14:24:58 +08:00
ditch vim for neovim
This commit is contained in:
parent
01fec1ec27
commit
eeda2f9509
56 changed files with 2444 additions and 408 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2020 purhan
|
||||
Copyright (c) 2021 purhan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
1
src/.bash_profile
Symbolic link
1
src/.bash_profile
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
.profile
|
||||
|
|
@ -102,8 +102,13 @@ alias more=less
|
|||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
alias nv='nvim'
|
||||
|
||||
# switch between shells
|
||||
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
||||
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@ local beautiful = require('beautiful')
|
|||
-- Thanks to jo148 on github for making rofi dpi aware!
|
||||
local with_dpi = require('beautiful').xresources.apply_dpi
|
||||
local get_dpi = require('beautiful').xresources.get_dpi
|
||||
local rofi_command = 'env /usr/bin/rofi -dpi ' .. get_dpi() .. ' -width ' .. with_dpi(100) ..
|
||||
' -show drun -display-drun -theme ' .. filesystem.get_configuration_dir() ..
|
||||
'/configuration/rofi.rasi -icon-theme ' .. beautiful.icon_theme ..
|
||||
' -run-command "/bin/bash -c -i \'shopt -s expand_aliases; {cmd}\'"'
|
||||
local rofi_command = 'env /usr/bin/rofi -show drun -display-drun -run-command "/bin/bash -c -i \'shopt -s expand_aliases; {cmd}\'"'
|
||||
|
||||
return {
|
||||
-- List of apps to start by default on some actions
|
||||
|
|
@ -15,7 +12,7 @@ return {
|
|||
terminal = 'kitty',
|
||||
rofi = rofi_command,
|
||||
lock = 'i3lock-fancy',
|
||||
quake = 'kitty',
|
||||
splash = 'kitty -T SplashTerminal -o background_opacity=0.95',
|
||||
power_command = '~/.config/awesome/configuration/utils/rofi-power',
|
||||
screenshot = '~/.config/awesome/configuration/utils/screenshot -m',
|
||||
region_screenshot = '~/.config/awesome/configuration/utils/screenshot -r',
|
||||
|
|
@ -26,13 +23,17 @@ return {
|
|||
files = 'nautilus',
|
||||
power_manager = 'gnome-power-statistics'
|
||||
},
|
||||
-- List of apps to start once on start-up
|
||||
run_on_start_up = {'~/.config/awesome/configuration/awspawn',
|
||||
'compton --config ' .. filesystem.get_configuration_dir() .. '/configuration/compton.conf',
|
||||
'nm-applet --indicator', 'ibus-daemon --xim --daemonize', 'scream-start', 'numlockx on',
|
||||
'/usr/lib/xfce-polkit/xfce-polkit & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)', -- credential manager
|
||||
'blueman-tray',
|
||||
'xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Natural Scrolling Enabled" 1',
|
||||
'xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Tapping Enabled" 1'}
|
||||
-- List of commands to start once on start-up
|
||||
run_on_start_up = {
|
||||
'~/.config/awesome/configuration/awspawn',
|
||||
'compton',
|
||||
'nm-applet --indicator',
|
||||
'nitrogen --restore',
|
||||
'ibus-daemon --xim --daemonize',
|
||||
'scream-start',
|
||||
'numlockx on',
|
||||
'/usr/lib/xfce-polkit/xfce-polkit & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)', -- credential manager
|
||||
'blueman-tray'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,13 +22,6 @@ awful.rules.rules = {{
|
|||
maximized_horizontal = false,
|
||||
maximized_vertical = false
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
instance = {"QuakeTerminal"}
|
||||
},
|
||||
properties = {
|
||||
skip_decoration = true
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
type = {'dialog'},
|
||||
|
|
|
|||
|
|
@ -17,19 +17,22 @@ awful.key({modkey}, 'h', hotkeys_popup.show_help, {
|
|||
description = 'show help',
|
||||
group = 'awesome'
|
||||
}), -- Tag browsing
|
||||
awful.key({modkey}, 'w', awful.tag.viewprev, {
|
||||
description = 'view previous',
|
||||
awful.key({modkey}, 'Left', function()
|
||||
awful.tag.viewprev()
|
||||
_G._splash_to_current_tag()
|
||||
end, {
|
||||
description = 'go to previous workspace',
|
||||
group = 'tag'
|
||||
}), awful.key({modkey}, 's', awful.tag.viewnext, {
|
||||
description = 'view next',
|
||||
}), awful.key({modkey}, 'Right', function()
|
||||
awful.tag.viewnext()
|
||||
_G._splash_to_current_tag()
|
||||
end, {
|
||||
description = 'go to next workspace',
|
||||
group = 'tag'
|
||||
}), awful.key({altkey, 'Control'}, 'Left', awful.tag.viewprev, {
|
||||
description = 'view previous',
|
||||
group = 'tag'
|
||||
}), awful.key({altkey, 'Control'}, 'Right', awful.tag.viewnext, {
|
||||
description = 'view next',
|
||||
group = 'tag'
|
||||
}), awful.key({modkey}, 'Escape', awful.tag.history.restore, {
|
||||
}), awful.key({modkey}, 'Escape', function()
|
||||
awful.tag.history.restore()
|
||||
_G._splash_to_current_tag()
|
||||
end, {
|
||||
description = 'go back',
|
||||
group = 'tag'
|
||||
}), -- Default client focus
|
||||
|
|
@ -48,27 +51,13 @@ end, {
|
|||
end, {
|
||||
description = 'show rofi menu',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey}, 'd', function()
|
||||
local flag = false
|
||||
for _, c in ipairs(mouse.screen.selected_tag:clients()) do
|
||||
if c.minimized == true then
|
||||
flag = true
|
||||
end
|
||||
c.minimized = true
|
||||
end
|
||||
for _, c in ipairs(mouse.screen.selected_tag:clients()) do
|
||||
if flag == true then
|
||||
c.minimized = false
|
||||
end
|
||||
end
|
||||
}), awful.key({modkey}, 'u', function()
|
||||
awful.client.urgent.jumpto()
|
||||
_G._splash_to_current_tag()
|
||||
end, {
|
||||
description = 'minimize all clients',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey}, 'u', awful.client.urgent.jumpto, {
|
||||
description = 'jump to urgent client',
|
||||
group = 'client'
|
||||
}), awful.key({altkey}, 'Tab', function()
|
||||
-- awful.client.focus.history.previous()
|
||||
awful.client.focus.byidx(1)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:raise()
|
||||
|
|
@ -76,8 +65,19 @@ end, {
|
|||
end, {
|
||||
description = 'switch to next window',
|
||||
group = 'client'
|
||||
}), awful.key({modkey}, 'm', function()
|
||||
focus = not _G.client.focus
|
||||
if not focus then
|
||||
_G.client.focus.minimized = true
|
||||
else
|
||||
for _, c in ipairs(mouse.screen.selected_tag:clients()) do
|
||||
c.minimized = false
|
||||
end
|
||||
end
|
||||
end, {
|
||||
description = 'minimize window in focus / unminimize all',
|
||||
group = 'client'
|
||||
}), awful.key({altkey, 'Shift'}, 'Tab', function()
|
||||
-- awful.client.focus.history.previous()
|
||||
awful.client.focus.byidx(-1)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:raise()
|
||||
|
|
@ -115,7 +115,7 @@ end, {
|
|||
end, {
|
||||
description = 'open a browser',
|
||||
group = 'launcher'
|
||||
}), awful.key({modkey}, 't', function()
|
||||
}), awful.key({modkey}, 'Return', function()
|
||||
awful.util.spawn_with_shell(apps.default.terminal)
|
||||
end, {
|
||||
description = 'open a terminal',
|
||||
|
|
@ -139,7 +139,7 @@ end, {
|
|||
end, {
|
||||
description = 'toggle gaps',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey, 'Shift'}, 'p', function()
|
||||
}), awful.key({modkey}, 'p', function()
|
||||
awful.util.spawn_with_shell(apps.default.power_command)
|
||||
end, {
|
||||
description = 'end session menu',
|
||||
|
|
@ -244,10 +244,15 @@ end, {
|
|||
end, {
|
||||
description = 'restore minimized',
|
||||
group = 'client'
|
||||
}), awful.key({altkey, 'Control'}, 'k', function()
|
||||
_G.toggle_quake()
|
||||
}), awful.key({modkey}, 'k', function()
|
||||
_G.toggle_splash()
|
||||
end, {
|
||||
description = 'dropdown application',
|
||||
description = 'toggle splash terminal',
|
||||
group = 'launcher'
|
||||
}), awful.key({modkey}, 'j', function()
|
||||
_G.toggle_splash_height()
|
||||
end, {
|
||||
description = 'toggle splash terminal height',
|
||||
group = 'launcher'
|
||||
}), awful.key({}, 'XF86MonBrightnessUp', function()
|
||||
awful.spawn('xbacklight -inc 10')
|
||||
|
|
@ -345,6 +350,7 @@ for i = 1, 9 do
|
|||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
_G._splash_to_current_tag()
|
||||
end
|
||||
end, descr_view), -- Toggle tag display.
|
||||
awful.key({modkey, 'Control'}, '#' .. i + 9, function()
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ element selected.normal {
|
|||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
padding: 16px;
|
||||
border: 0 0 0 5px solid;
|
||||
border: 0 0 0 0 solid;
|
||||
border-color: @active-background;
|
||||
}
|
||||
|
||||
|
|
@ -145,4 +145,4 @@ element alternate.urgent {
|
|||
element alternate.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
37
src/.config/awesome/configuration/tags.lua
Normal file
37
src/.config/awesome/configuration/tags.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local awful = require('awful')
|
||||
local beautiful = require('beautiful')
|
||||
local gears = require('gears')
|
||||
local apps = require('configuration.apps')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
local tags = {
|
||||
{text = 'web', type = 'web', defaultApp = apps.default.browser, screen = 1},
|
||||
{text = 'dev', type = 'dev', defaultApp = apps.default.editor, screen = 1},
|
||||
{
|
||||
text = 'term',
|
||||
type = 'term',
|
||||
defaultApp = apps.default.terminal,
|
||||
screen = 1
|
||||
},
|
||||
{text = 'file', type = 'file', defaultApp = apps.default.files, screen = 1},
|
||||
{text = 'chat', type = 'chat', defaultApp = apps.default.social, screen = 1},
|
||||
{text = 'misc', type = 'misc', defaultApp = apps.default.rofi, screen = 1}
|
||||
}
|
||||
|
||||
awful.layout.layouts = {
|
||||
awful.layout.suit.tile, awful.layout.suit.max, awful.layout.suit.floating
|
||||
}
|
||||
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
for i, tag in pairs(tags) do
|
||||
awful.tag.add(tag.text, {
|
||||
icon = tag.icon,
|
||||
icon_only = false,
|
||||
layout = awful.layout.suit.tile,
|
||||
gap = beautiful.gaps,
|
||||
screen = s,
|
||||
defaultApp = tag.defaultApp,
|
||||
selected = i == 1
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
|
@ -6,15 +6,11 @@
|
|||
# Only add applications/scripts without parameters here
|
||||
# (if you want to apply parameters then use a script file!)
|
||||
|
||||
# List of applications to run
|
||||
# the script $HOME/.config/awesomestart
|
||||
# is intended to be a copy of this file
|
||||
# to allow out of tree autostart programs
|
||||
APPS=(
|
||||
# keepassxc
|
||||
# kdeconnect-indicator
|
||||
radeon-profile
|
||||
$HOME/.config/awesomestart
|
||||
$HOME/.config/utils/awesomestart
|
||||
)
|
||||
# Some applications start child applications that need to be killed on reload
|
||||
KILL=(
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
# 2016 Oliver Kraitschy - http://okraits.de
|
||||
|
||||
OPTIONS="Power-off\nExit\nReboot\nSuspend\nHibernate"
|
||||
OPTIONS="Poweroff\nExit\nReboot\nSuspend\nHibernate"
|
||||
|
||||
config_path=$(dirname "$0")
|
||||
|
||||
LAUNCHER="rofi -dmenu -show-icons -icon-theme papirus -theme $config_path/../rofi.rasi"
|
||||
LAUNCHER="rofi -dmenu -i"
|
||||
USE_LOCKER="false"
|
||||
LOCKER="i3lock-fancy"
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ case $option in
|
|||
Reboot)
|
||||
systemctl reboot
|
||||
;;
|
||||
Power-off)
|
||||
Poweroff)
|
||||
systemctl poweroff
|
||||
;;
|
||||
Suspend)
|
||||
|
|
|
|||
37
src/.config/awesome/layout/bottom-bar.lua
Normal file
37
src/.config/awesome/layout/bottom-bar.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local beautiful = require('beautiful')
|
||||
local wibox = require('wibox')
|
||||
local TaskList = require('widget.task-list')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
local BottomBar = function(s, offset)
|
||||
|
||||
-- BOTTOM BAR
|
||||
-- =======
|
||||
local panel_height = dpi(16)
|
||||
local panel = wibox({
|
||||
ontop = false,
|
||||
screen = s,
|
||||
height = panel_height,
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.height - panel_height,
|
||||
stretch = false,
|
||||
bg = beautiful.primary.hue_100,
|
||||
fg = beautiful.fg_normal,
|
||||
})
|
||||
|
||||
panel:struts({
|
||||
bottom = panel.height
|
||||
})
|
||||
|
||||
panel:setup{
|
||||
layout = wibox.layout.align.horizontal,
|
||||
nil,
|
||||
TaskList(s),
|
||||
nil,
|
||||
}
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
return BottomBar
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
local awful = require('awful')
|
||||
local top_bar = require('layout.top-bar')
|
||||
local bottom_bar = require('layout.bottom-bar')
|
||||
|
||||
local key_grabber
|
||||
|
||||
|
|
@ -7,8 +8,10 @@ local key_grabber
|
|||
awful.screen.connect_for_each_screen(function(s)
|
||||
if s.index == 1 then
|
||||
s.top_bar = top_bar(s, true)
|
||||
s.bottom_bar = bottom_bar(s, true)
|
||||
else
|
||||
s.top_bar = top_bar(s, false)
|
||||
s.bottom_bar = bottom_bar(s, false)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
@ -18,6 +21,7 @@ function updateBarsVisibility()
|
|||
if s.selected_tag then
|
||||
local fullscreen = s.selected_tag.fullscreenMode
|
||||
s.top_bar.visible = not fullscreen
|
||||
s.bottom_bar.visible = not fullscreen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,86 +2,167 @@ local awful = require('awful')
|
|||
local beautiful = require('beautiful')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local mat_icon_button = require('widget.material.icon-button')
|
||||
local separators = require('widget.material.separator')
|
||||
local markup = require('widget.material.markup')
|
||||
local wibox = require('wibox')
|
||||
local TagList = require('widget.tag-list')
|
||||
local TaskList = require('widget.task-list')
|
||||
local gears = require('gears')
|
||||
local icons = require('theme.icons')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local table = awful.util.table or gears.table
|
||||
|
||||
local separator = wibox.widget {
|
||||
orientation = 'vertical',
|
||||
forced_width = dpi(2),
|
||||
opacity = 0.5,
|
||||
widget = wibox.widget.separator
|
||||
}
|
||||
-- Separators
|
||||
local arrow = separators.arrow_left
|
||||
local function create_arrow(mywidget, bgcolor, fgcolor)
|
||||
return (wibox.container.background(
|
||||
wibox.widget {
|
||||
arrow(fgcolor, bgcolor),
|
||||
mywidget,
|
||||
arrow(bgcolor, fgcolor),
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
bgcolor
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
-- Create Icons
|
||||
local function create_icon(label, icon_color)
|
||||
return (wibox.widget {
|
||||
wibox.widget{
|
||||
text = label,
|
||||
font = beautiful.icon_font,
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
fg = icon_color,
|
||||
widget = wibox.container.background
|
||||
})
|
||||
end
|
||||
|
||||
local TopBar = function(s, offset)
|
||||
|
||||
-- LAYOUT BOX
|
||||
-- ==========
|
||||
local LayoutBox = require('widget.layoutbox')
|
||||
local function update_txt_layoutbox(s)
|
||||
-- Writes a string representation of the current layout in a textbox widget
|
||||
local txt_l = beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))] or ""
|
||||
s.layoutbox:set_text(txt_l)
|
||||
end
|
||||
|
||||
-- BATTERY
|
||||
-- =======
|
||||
local battery_widget = require('widget.battery')
|
||||
s.layoutbox = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
|
||||
s.layoutbox.font = beautiful.icon_font
|
||||
awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
|
||||
awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
|
||||
s.layoutbox:buttons(table.join(
|
||||
awful.button({}, 1, function() awful.layout.inc(1) end),
|
||||
awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
|
||||
awful.button({}, 3, function() awful.layout.inc(-1) end),
|
||||
awful.button({}, 4, function() awful.layout.inc(1) end),
|
||||
awful.button({}, 5, function() awful.layout.inc(-1) end)))
|
||||
|
||||
-- SYSTEM TRAY
|
||||
-- ===========
|
||||
local systray = wibox.widget.systray()
|
||||
systray:set_horizontal(true)
|
||||
|
||||
-- TASK LIST
|
||||
-- =========
|
||||
local task_list = wibox.widget {
|
||||
nil,
|
||||
wibox.container.margin(TaskList(s), dpi(2), dpi(2), dpi(3), dpi(3)),
|
||||
nil,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
-- SYSTEM DETAILS
|
||||
-- ==============
|
||||
local volume_widget = require('widget.volume.volume-percentage')
|
||||
local date_widget = require('widget.date')
|
||||
local volume_widget = require('widget.volume')
|
||||
local battery_widget = require('widget.battery')
|
||||
local clock_widget = require('widget.clock')
|
||||
local mem_widget = require('widget.memory')
|
||||
local cpu_widget = require('widget.cpu')
|
||||
local temprature_widget = require('widget.temprature')
|
||||
local storage_widget = require('widget.storage')
|
||||
local net = require('widget.net')
|
||||
local net_sent = net({
|
||||
settings = function()
|
||||
widget:set_markup(markup.font(beautiful.font, net_now.sent))
|
||||
end
|
||||
})
|
||||
local net_recieved = net({
|
||||
settings = function()
|
||||
widget:set_markup(markup.font(beautiful.font, net_now.received))
|
||||
end
|
||||
})
|
||||
local system_details = wibox.widget {
|
||||
wibox.widget {
|
||||
wibox.container.background(systray, beautiful.primary.hue_800),
|
||||
wibox.container.background(battery_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(mem_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(cpu_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(volume_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(date_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(clock_widget, beautiful.primary.hue_800),
|
||||
-- Systray
|
||||
systray,
|
||||
create_arrow(nil, beautiful.primary.hue_200, beautiful.primary.hue_100),
|
||||
-- Internet Speed
|
||||
wibox.widget{
|
||||
create_icon('', beautiful.accent.hue_200),
|
||||
net_sent.widget,
|
||||
create_icon('', beautiful.accent.hue_300),
|
||||
net_recieved.widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
-- Battery
|
||||
create_arrow (battery_widget, beautiful.primary.hue_200, beautiful.primary.hue_100),
|
||||
-- Memory
|
||||
create_icon('', beautiful.accent.hue_500),
|
||||
mem_widget,
|
||||
-- CPU
|
||||
create_arrow(wibox.widget{
|
||||
create_icon('', beautiful.accent.hue_600),
|
||||
cpu_widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}, beautiful.primary.hue_200, beautiful.primary.hue_100),
|
||||
-- Temprature
|
||||
wibox.widget{
|
||||
create_icon('﨎', beautiful.accent.hue_400),
|
||||
temprature_widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
-- Volume
|
||||
create_arrow(volume_widget, beautiful.primary.hue_200, beautiful.primary.hue_100),
|
||||
-- Storage
|
||||
wibox.widget{
|
||||
create_icon('', beautiful.accent.hue_200),
|
||||
storage_widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
wibox.widget{
|
||||
-- Calendar / Clock
|
||||
create_arrow(wibox.widget{
|
||||
create_icon('', beautiful.accent.hue_400),
|
||||
clock_widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}, beautiful.primary.hue_200, beautiful.primary.hue_100),
|
||||
-- Layout
|
||||
wibox.widget {
|
||||
arrow(beautiful.primary.hue_100, beautiful.accent.hue_200),
|
||||
wibox.widget{
|
||||
wibox.container.margin(s.layoutbox, dpi(4), dpi(4), dpi(0), dpi(0)),
|
||||
fg = beautiful.primary.hue_100,
|
||||
bg = beautiful.accent.hue_200,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
},
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
bg = beautiful.primary.hue_900,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local calendar = require('widget.calendar')
|
||||
calendar:attach(date_widget)
|
||||
}
|
||||
|
||||
-- TOP BAR
|
||||
-- =======
|
||||
local panel = wibox({
|
||||
ontop = false,
|
||||
screen = s,
|
||||
height = dpi(24),
|
||||
height = dpi(20),
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.y,
|
||||
stretch = false,
|
||||
bg = beautiful.primary.hue_900,
|
||||
fg = beautiful.fg_normal
|
||||
bg = beautiful.primary.hue_100,
|
||||
fg = beautiful.fg_normal,
|
||||
})
|
||||
|
||||
panel:struts({
|
||||
|
|
@ -90,14 +171,9 @@ local TopBar = function(s, offset)
|
|||
|
||||
panel:setup{
|
||||
layout = wibox.layout.align.horizontal,
|
||||
spacing = dpi(0),
|
||||
TagList(s),
|
||||
task_list,
|
||||
wibox.widget {
|
||||
wibox.container.margin(system_details, dpi(2), dpi(2), dpi(3), dpi(3)),
|
||||
LayoutBox(s),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
nil,
|
||||
system_details,
|
||||
}
|
||||
|
||||
return panel
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local awful = require('awful')
|
||||
local app = require('configuration.apps').default.quake
|
||||
local app = require('configuration.apps').default.splash
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local beautiful = require('beautiful')
|
||||
local screen = awful.screen.focused()
|
||||
|
|
@ -7,42 +7,56 @@ local screen = awful.screen.focused()
|
|||
-- Theme
|
||||
beautiful.init(require('theme'))
|
||||
|
||||
local quake_id = 'notnil'
|
||||
local quake_client
|
||||
local splash_id = 'notnil'
|
||||
local splash_client
|
||||
local opened = false
|
||||
|
||||
function create_shell()
|
||||
quake_id = awful.spawn.with_shell("exec -a QuakeTerminal " .. app)
|
||||
splash_id = awful.spawn.with_shell(app)
|
||||
end
|
||||
|
||||
function open_quake()
|
||||
quake_client.hidden = false
|
||||
-- Dirty hack to prevent splash from showing up in occupied tags
|
||||
function _splash_to_current_tag()
|
||||
if splash_client then
|
||||
splash_client:move_to_tag(screen.selected_tag)
|
||||
end
|
||||
end
|
||||
|
||||
function close_quake()
|
||||
quake_client.hidden = true
|
||||
function open_splash()
|
||||
splash_client.hidden = false
|
||||
end
|
||||
|
||||
toggle_quake = function()
|
||||
function close_splash()
|
||||
splash_client.hidden = true
|
||||
end
|
||||
|
||||
toggle_splash_height = function()
|
||||
if splash_client and opened then
|
||||
splash_client.maximized_vertical = not splash_client.maximized_vertical
|
||||
end
|
||||
end
|
||||
|
||||
toggle_splash = function()
|
||||
opened = not opened
|
||||
if not quake_client then
|
||||
if not splash_client then
|
||||
create_shell()
|
||||
else
|
||||
if opened then
|
||||
open_quake()
|
||||
client.focus = quake_client
|
||||
quake_client:raise()
|
||||
open_splash()
|
||||
client.focus = splash_client
|
||||
splash_client:raise()
|
||||
else
|
||||
close_quake()
|
||||
close_splash()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_G.client.connect_signal('manage', function(c)
|
||||
if (c.pid == quake_id) then
|
||||
quake_client = c
|
||||
if (c.pid == splash_id) then
|
||||
splash_client = c
|
||||
c.x = c.screen.geometry.x
|
||||
c.height = (c.screen.geometry.height / 5) * 3
|
||||
c.y = c.screen.geometry.height - c.height - beautiful.border_width
|
||||
c.y = c.screen.geometry.height - c.height - beautiful.border_width - dpi(16)
|
||||
c.floating = true
|
||||
c.skip_taskbar = true
|
||||
c.skip_decoration = true
|
||||
|
|
@ -50,17 +64,16 @@ _G.client.connect_signal('manage', function(c)
|
|||
c.floating = true
|
||||
c.above = true
|
||||
c.sticky = true
|
||||
c.type = 'dock'
|
||||
c.type = 'splash'
|
||||
c.hidden = not opened
|
||||
c.maximized_horizontal = true
|
||||
c.border_width = beautiful.border_width
|
||||
c:move_to_tag(screen.tags[3])
|
||||
c.maximized_horizontal = true
|
||||
end
|
||||
end)
|
||||
|
||||
_G.client.connect_signal('unmanage', function(c)
|
||||
if (c.pid == quake_id) then
|
||||
if (c.pid == splash_id) then
|
||||
opened = false
|
||||
quake_client = nil
|
||||
splash_client = nil
|
||||
end
|
||||
end)
|
||||
|
|
@ -14,29 +14,13 @@ require('layout')
|
|||
require('module.notifications')
|
||||
require('module.auto-start')
|
||||
require('module.decorate-client')
|
||||
require('module.quake-terminal')
|
||||
require('module.splash-terminal')
|
||||
|
||||
-- Setup all configurations
|
||||
require('configuration.client')
|
||||
require('configuration.tags')
|
||||
_G.root.keys(require('configuration.keys.global'))
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if beautiful.wallpaper then
|
||||
if type(beautiful.wallpaper) == "string" then
|
||||
if beautiful.wallpaper:sub(1, #"#") == "#" then
|
||||
gears.wallpaper.set(beautiful.wallpaper)
|
||||
elseif beautiful.wallpaper:sub(1, #"/") == "/" then
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
||||
end
|
||||
else
|
||||
beautiful.wallpaper(s)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Signal function to execute when a new client appears.
|
||||
_G.client.connect_signal('manage', function(c)
|
||||
-- Set the windows at the slave,
|
||||
|
|
@ -52,9 +36,9 @@ _G.client.connect_signal('manage', function(c)
|
|||
end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
-- _G.client.connect_signal('mouse::enter', function(c)
|
||||
-- c:emit_signal('request::activate', 'mouse_enter', {raise = true})
|
||||
-- end)
|
||||
_G.client.connect_signal('mouse::enter', function(c)
|
||||
c:emit_signal('request::activate', 'mouse_enter', {raise = true})
|
||||
end)
|
||||
|
||||
-- Make the focused window have a glowing border
|
||||
_G.client.connect_signal('focus', function(c)
|
||||
|
|
@ -63,3 +47,4 @@ end)
|
|||
_G.client.connect_signal('unfocus', function(c)
|
||||
c.border_color = beautiful.border_normal
|
||||
end)
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,15 +1,50 @@
|
|||
return {
|
||||
-- Dracula
|
||||
dracula = {
|
||||
hue_50 = '#f8f8f2',
|
||||
hue_100 = '#f1fa8c',
|
||||
hue_200 = '#50fa7b',
|
||||
hue_300 = '#8be9fd',
|
||||
hue_400 = '#ff5555',
|
||||
hue_500 = '#6272a4',
|
||||
hue_600 = '#ff79c6',
|
||||
hue_700 = '#ffb86c',
|
||||
hue_800 = '#44475a',
|
||||
hue_900 = '#282a36'
|
||||
primary = {
|
||||
hue_100 = '#282a36',
|
||||
hue_200 = '#44475a'
|
||||
},
|
||||
accent = {
|
||||
hue_100 = '#f1fa8c',
|
||||
hue_200 = '#50fa7b',
|
||||
hue_300 = '#8be9fd',
|
||||
hue_400 = '#ff5555',
|
||||
hue_500 = '#6272a4',
|
||||
hue_600 = '#ff79c6',
|
||||
hue_700 = '#ffb86c',
|
||||
hue_800 = '#f8f8f2',
|
||||
}
|
||||
},
|
||||
gruvbox = {
|
||||
primary = {
|
||||
hue_100 = '#282828',
|
||||
hue_200 = '#3c3c3c'
|
||||
},
|
||||
accent = {
|
||||
hue_100 = '#fe8019',
|
||||
hue_200 = '#fabd2f',
|
||||
hue_300 = '#8ec07c',
|
||||
hue_400 = '#fb4934',
|
||||
hue_500 = '#d3869b',
|
||||
hue_600 = '#b8bb26',
|
||||
hue_700 = '#458588',
|
||||
hue_800 = '#fbf1c7',
|
||||
}
|
||||
},
|
||||
gruvbox_material = {
|
||||
primary = {
|
||||
hue_100 = '#212121',
|
||||
hue_200 = '#3c3c3c'
|
||||
},
|
||||
accent = {
|
||||
hue_100 = '#e1be7f',
|
||||
hue_200 = '#92c96a',
|
||||
hue_300 = '#66aeea',
|
||||
hue_400 = '#f35a5a',
|
||||
hue_500 = '#4083bc',
|
||||
hue_600 = '#c57cda',
|
||||
hue_700 = '#cd996a',
|
||||
hue_800 = '#d6d6d6',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,53 +4,54 @@ local theme_dir = filesystem.get_configuration_dir() .. '/theme'
|
|||
local gears = require('gears')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local theme = {}
|
||||
theme.icons = theme_dir .. '/icons/'
|
||||
|
||||
-- Primary Color Scheme
|
||||
theme.primary = color_schemes.dracula
|
||||
-- Color Scheme
|
||||
theme.primary = color_schemes.gruvbox.primary
|
||||
theme.accent = color_schemes.gruvbox.accent
|
||||
|
||||
local awesome_overrides = function(theme)
|
||||
theme.dir = os.getenv('HOME') .. '/.config/awesome/theme'
|
||||
|
||||
theme.icons = theme.dir .. '/icons/'
|
||||
theme.wallpaper = theme.dir .. '/wallpapers/4.png' -- Can be replaced with a color (eg: '#e0e0e0')
|
||||
theme.font = 'FiraCode Nerd Font Mono bold 9'
|
||||
theme.font = 'Robotomono nerd font bold 9' -- Glyphs don't work properly with this (#442)
|
||||
theme.icon_font = 'furamono nerd font 11' -- Fira mono patched version
|
||||
|
||||
-- Layout
|
||||
theme.layout_max = theme.icons .. 'layouts/arrow-expand-all.png'
|
||||
theme.layout_tile = theme.icons .. 'layouts/view-quilt.png'
|
||||
theme.layout_floating = theme.icons .. 'layouts/floating.png'
|
||||
-- Layout icons
|
||||
theme.layout_txt_tile = "舘"
|
||||
theme.layout_txt_max = ""
|
||||
theme.layout_txt_floating = ""
|
||||
|
||||
-- Taglist
|
||||
theme.taglist_font = theme.font
|
||||
theme.taglist_bg_empty = theme.primary.hue_900
|
||||
theme.taglist_bg_occupied = 'linear:0,0:0,' .. dpi(32) .. ':0,' .. theme.primary.hue_800 .. ':0.1,' ..
|
||||
theme.primary.hue_800 .. ':0.1,' .. theme.primary.hue_900 .. ':0.9,' ..
|
||||
theme.primary.hue_900
|
||||
theme.taglist_bg_urgent = 'linear:0,0:0,' .. dpi(48) .. ':0,' .. theme.primary.hue_700 .. ':0.07,' ..
|
||||
theme.primary.hue_700 .. ':0.07,' .. theme.primary.hue_900 .. ':1,' ..
|
||||
theme.primary.hue_900
|
||||
theme.taglist_bg_focus = theme.primary.hue_200
|
||||
theme.taglist_fg_focus = theme.primary.hue_900
|
||||
theme.taglist_bg_empty = theme.primary.hue_100
|
||||
theme.taglist_bg_occupied = 'linear:0,0:0,' .. dpi(32) .. ':0,' ..
|
||||
theme.primary.hue_200 .. ':0.1,' ..
|
||||
theme.primary.hue_200 .. ':0.1,' ..
|
||||
theme.primary.hue_100 .. ':0.9,' ..
|
||||
theme.primary.hue_100
|
||||
theme.taglist_bg_urgent = 'linear:0,0:0,' .. dpi(48) .. ':0,' ..
|
||||
theme.accent.hue_700 .. ':0.07,' ..
|
||||
theme.accent.hue_700 .. ':0.07,' ..
|
||||
theme.primary.hue_100 .. ':1,' ..
|
||||
theme.primary.hue_100
|
||||
theme.taglist_bg_focus = theme.accent.hue_200
|
||||
theme.taglist_fg_focus = theme.primary.hue_100
|
||||
|
||||
-- Tasklist
|
||||
theme.tasklist_font = theme.font
|
||||
theme.tasklist_bg_normal = theme.primary.hue_900
|
||||
theme.tasklist_bg_focus = theme.primary.hue_800
|
||||
theme.tasklist_bg_urgent = theme.primary.hue_900
|
||||
theme.tasklist_bg_normal = theme.primary.hue_200
|
||||
theme.tasklist_bg_focus = theme.primary.hue_100
|
||||
theme.tasklist_bg_urgent = theme.primary.hue_200
|
||||
|
||||
-- Icons
|
||||
theme.icon_theme = 'Papirus'
|
||||
|
||||
-- Client
|
||||
theme.gaps = dpi(4)
|
||||
theme.gaps = dpi(2)
|
||||
theme.border_width = dpi(2)
|
||||
theme.border_focus = theme.primary.hue_200
|
||||
theme.border_normal = theme.primary.hue_900
|
||||
theme.bg_normal = theme.primary.hue_900
|
||||
theme.bg_systray = theme.primary.hue_800
|
||||
theme.border_focus = theme.accent.hue_200
|
||||
theme.border_normal = theme.primary.hue_100
|
||||
theme.gap_single_client = false
|
||||
theme.bg_normal = theme.primary.hue_100
|
||||
end
|
||||
return {
|
||||
theme = theme,
|
||||
awesome_overrides = awesome_overrides
|
||||
}
|
||||
return {theme = theme, awesome_overrides = awesome_overrides}
|
||||
|
|
|
|||
|
|
@ -7,53 +7,27 @@
|
|||
-- @copyright 2017 Pavel Makhov
|
||||
-------------------------------------------------
|
||||
local awful = require('awful')
|
||||
local naughty = require('naughty')
|
||||
local watch = require('awful.widget.watch')
|
||||
local wibox = require('wibox')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local gears = require('gears')
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local apps = require('configuration.apps')
|
||||
|
||||
-- acpi sample outputs
|
||||
-- Battery 0: Discharging, 75%, 01:51:38 remaining
|
||||
-- Battery 0: Charging, 53%, 00:57:43 until charged
|
||||
|
||||
local HOME = os.getenv('HOME')
|
||||
local PATH_TO_ICONS = HOME .. '/.config/awesome/widget/battery/icons/'
|
||||
local percentage = wibox.widget.textbox()
|
||||
local battery_icon = wibox.widget.textbox()
|
||||
battery_icon.font = beautiful.icon_font
|
||||
|
||||
local widget = wibox.widget {
|
||||
{
|
||||
id = 'icon',
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = true
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
local battery_widget = wibox.widget {
|
||||
wibox.container.margin(widget, dpi(4), dpi(4), dpi(3), dpi(3)),
|
||||
wibox.container.margin(percentage, dpi(0), dpi(4), dpi(4), dpi(4)),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
-- Alternative to naughty.notify - tooltip. You can compare both and choose the preferred one
|
||||
local battery_popup = awful.tooltip({
|
||||
objects = {battery_widget},
|
||||
objects = {percentage},
|
||||
mode = 'outside',
|
||||
align = 'left',
|
||||
preferred_positions = {'right', 'left', 'top', 'bottom'}
|
||||
})
|
||||
|
||||
-- To use colors from beautiful theme put
|
||||
-- following lines in rc.lua before require("battery"):
|
||||
-- beautiful.tooltip_fg = beautiful.fg_normal
|
||||
-- beautiful.tooltip_bg = beautiful.bg_normal
|
||||
|
||||
watch('acpi -i', 1, function(_, stdout)
|
||||
local batteryIconName = 'battery'
|
||||
|
||||
watch('acpi -i', 10, function(_, stdout)
|
||||
local battery_info = {}
|
||||
local capacities = {}
|
||||
for s in stdout:gmatch('[^\r\n]+') do
|
||||
|
|
@ -86,22 +60,61 @@ watch('acpi -i', 1, function(_, stdout)
|
|||
end
|
||||
charge = charge / capacity
|
||||
|
||||
if status == 'Charging' or status == 'Full' then
|
||||
batteryIconName = batteryIconName .. '-charging'
|
||||
end
|
||||
|
||||
local roundedCharge = math.floor(charge / 10) * 10
|
||||
if (roundedCharge == 0) then
|
||||
batteryIconName = batteryIconName .. '-outline'
|
||||
elseif (roundedCharge ~= 100) then
|
||||
batteryIconName = batteryIconName .. '-' .. roundedCharge
|
||||
end
|
||||
|
||||
widget.icon:set_image(PATH_TO_ICONS .. batteryIconName .. '.svg')
|
||||
-- Update popup text
|
||||
battery_popup.text = string.gsub(stdout, '\n$', '')
|
||||
percentage.text = math.floor(charge)
|
||||
collectgarbage('collect')
|
||||
end, widget)
|
||||
|
||||
return battery_widget
|
||||
if status == 'Charging' then
|
||||
battery_icon.text = ''
|
||||
if math.floor(charge) <= 20 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 30 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 40 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 60 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 80 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 90 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 100 then
|
||||
battery_icon.text = ''
|
||||
end
|
||||
elseif status == 'Full' then
|
||||
battery_icon.text = ''
|
||||
else
|
||||
if math.floor(charge) <= 10 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 20 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 30 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 40 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 50 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 60 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 60 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 80 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 90 then
|
||||
battery_icon.text = ''
|
||||
elseif math.floor(charge) <= 100 then
|
||||
battery_icon.text = ''
|
||||
end
|
||||
end
|
||||
collectgarbage('collect')
|
||||
end)
|
||||
|
||||
return wibox.widget {
|
||||
wibox.widget{
|
||||
battery_icon,
|
||||
fg = beautiful.accent.hue_300,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
percentage,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
5
src/.config/awesome/widget/clock.lua
Normal file
5
src/.config/awesome/widget/clock.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
local wibox = require('wibox')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
local clock = wibox.widget.textclock('<span font="' .. beautiful.font .. '">%d/%m %a %H:%M</span>')
|
||||
return clock
|
||||
|
|
@ -1,20 +1,9 @@
|
|||
local wibox = require('wibox')
|
||||
local beautiful = require('beautiful')
|
||||
local icons = require('theme.icons')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local watch = require('awful.widget.watch')
|
||||
|
||||
local icon = wibox.widget {
|
||||
wibox.widget {
|
||||
image = icons.cpu,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
top = dpi(3),
|
||||
bottom = dpi(3),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local percentage = wibox.widget.textbox()
|
||||
local cpu = wibox.widget.textbox()
|
||||
local total_prev = 0
|
||||
local idle_prev = 0
|
||||
|
||||
|
|
@ -28,17 +17,12 @@ watch([[bash -c "cat /proc/stat | grep '^cpu '"]], 1, function(_, stdout)
|
|||
local diff_total = total - total_prev
|
||||
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
|
||||
|
||||
percentage.text = math.floor(diff_usage) .. '%'
|
||||
cpu.text = math.floor(diff_usage) .. '%'
|
||||
if diff_usage < 10 then cpu.text = '0' .. cpu.text end
|
||||
|
||||
total_prev = total
|
||||
idle_prev = idle
|
||||
collectgarbage('collect')
|
||||
end)
|
||||
|
||||
local cpu_widget = wibox.widget {
|
||||
icon,
|
||||
wibox.container.margin(percentage, dpi(4), dpi(4), dpi(4), dpi(4)),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
return wibox.container.margin(cpu_widget, dpi(4), dpi(4))
|
||||
return cpu
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
local wibox = require('wibox')
|
||||
|
||||
function build(widget)
|
||||
function build(widget, label)
|
||||
local container = wibox.widget {
|
||||
widget,
|
||||
-- widget,
|
||||
wibox.widget {
|
||||
text = label,
|
||||
widget = wibox.widget.textbox,
|
||||
},
|
||||
widget = wibox.container.background
|
||||
}
|
||||
local old_cursor, old_wibox
|
||||
|
|
|
|||
59
src/.config/awesome/widget/material/markup.lua
Normal file
59
src/.config/awesome/widget/material/markup.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
-- Adopted from: https://github.com/lcpz/lain
|
||||
|
||||
local format = string.format
|
||||
local setmetatable = setmetatable
|
||||
|
||||
-- Lain markup util submodule
|
||||
-- lain.util.markup
|
||||
local markup = { fg = {}, bg = {} }
|
||||
|
||||
-- Convenience tags
|
||||
function markup.bold(text) return format("<b>%s</b>", text) end
|
||||
function markup.italic(text) return format("<i>%s</i>", text) end
|
||||
function markup.strike(text) return format("<s>%s</s>", text) end
|
||||
function markup.underline(text) return format("<u>%s</u>", text) end
|
||||
function markup.monospace(text) return format("<tt>%s</tt>", text) end
|
||||
function markup.big(text) return format("<big>%s</big>", text) end
|
||||
function markup.small(text) return format("<small>%s</small>", text) end
|
||||
|
||||
-- Set the font
|
||||
function markup.font(font, text)
|
||||
return format("<span font='%s'>%s</span>", font, text)
|
||||
end
|
||||
|
||||
-- Set the foreground
|
||||
function markup.fg.color(color, text)
|
||||
return format("<span foreground='%s'>%s</span>", color, text)
|
||||
end
|
||||
|
||||
-- Set the background
|
||||
function markup.bg.color(color, text)
|
||||
return format("<span background='%s'>%s</span>", color, text)
|
||||
end
|
||||
|
||||
-- Set foreground and background
|
||||
function markup.color(fg, bg, text)
|
||||
return format("<span foreground='%s' background='%s'>%s</span>", fg, bg, text)
|
||||
end
|
||||
|
||||
-- Set font and foreground
|
||||
function markup.fontfg(font, fg, text)
|
||||
return format("<span font='%s' foreground='%s'>%s</span>", font, fg, text)
|
||||
end
|
||||
|
||||
-- Set font and background
|
||||
function markup.fontbg(font, bg, text)
|
||||
return format("<span font='%s' background='%s'>%s</span>", font, bg, text)
|
||||
end
|
||||
|
||||
-- Set font, foreground and background
|
||||
function markup.fontcolor(font, fg, bg, text)
|
||||
return format("<span font='%s' foreground='%s' background='%s'>%s</span>", font, fg, bg, text)
|
||||
end
|
||||
|
||||
-- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...)
|
||||
setmetatable(markup.fg, { __call = function(_, ...) return markup.fg.color(...) end })
|
||||
setmetatable(markup.bg, { __call = function(_, ...) return markup.bg.color(...) end })
|
||||
|
||||
-- link markup(...) calls to markup.fg.color(...)
|
||||
return setmetatable(markup, { __call = function(_, ...) return markup.fg.color(...) end })
|
||||
111
src/.config/awesome/widget/material/separator.lua
Normal file
111
src/.config/awesome/widget/material/separator.lua
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
-- Adopted from: https://github.com/lcpz/lain/
|
||||
|
||||
local wibox = require("wibox")
|
||||
local gears = require("gears")
|
||||
|
||||
-- Lain Cairo separators util submodule
|
||||
-- lain.util.separators
|
||||
local separators = { height = 0, width = 9 }
|
||||
|
||||
-- [[ Arrow
|
||||
|
||||
-- Right
|
||||
function separators.arrow_right(col1, col2)
|
||||
local widget = wibox.widget.base.make_widget()
|
||||
widget.col1 = col1
|
||||
widget.col2 = col2
|
||||
|
||||
widget.fit = function(_, _, _)
|
||||
return separators.width, separators.height
|
||||
end
|
||||
|
||||
widget.update = function(_, _)
|
||||
widget.col1 = col1
|
||||
widget.col2 = col2
|
||||
widget:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
|
||||
widget.draw = function(_, _, cr, width, height)
|
||||
if widget.col2 ~= "alpha" then
|
||||
cr:set_source_rgba(gears.color.parse_color(widget.col2))
|
||||
cr:new_path()
|
||||
cr:move_to(0, 0)
|
||||
cr:line_to(width, height/2)
|
||||
cr:line_to(width, 0)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
|
||||
cr:new_path()
|
||||
cr:move_to(0, height)
|
||||
cr:line_to(width, height/2)
|
||||
cr:line_to(width, height)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
end
|
||||
|
||||
if widget.col1 ~= "alpha" then
|
||||
cr:set_source_rgba(gears.color.parse_color(widget.col1))
|
||||
cr:new_path()
|
||||
cr:move_to(0, 0)
|
||||
cr:line_to(width, height/2)
|
||||
cr:line_to(0, height)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
end
|
||||
end
|
||||
|
||||
return widget
|
||||
end
|
||||
|
||||
-- Left
|
||||
function separators.arrow_left(col1, col2)
|
||||
local widget = wibox.widget.base.make_widget()
|
||||
widget.col1 = col1
|
||||
widget.col2 = col2
|
||||
|
||||
widget.fit = function(_, _, _)
|
||||
return separators.width, separators.height
|
||||
end
|
||||
|
||||
widget.update = function(c1, c2)
|
||||
widget.col1 = c1
|
||||
widget.col2 = c2
|
||||
widget:emit_signal("widget::redraw_needed")
|
||||
end
|
||||
|
||||
widget.draw = function(_, _, cr, width, height)
|
||||
if widget.col1 ~= "alpha" then
|
||||
cr:set_source_rgba(gears.color.parse_color(widget.col1))
|
||||
cr:new_path()
|
||||
cr:move_to(width, 0)
|
||||
cr:line_to(0, height/2)
|
||||
cr:line_to(0, 0)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
|
||||
cr:new_path()
|
||||
cr:move_to(width, height)
|
||||
cr:line_to(0, height/2)
|
||||
cr:line_to(0, height)
|
||||
cr:close_path()
|
||||
cr:fill()
|
||||
end
|
||||
|
||||
if widget.col2 ~= "alpha" then
|
||||
cr:new_path()
|
||||
cr:move_to(width, 0)
|
||||
cr:line_to(0, height/2)
|
||||
cr:line_to(width, height)
|
||||
cr:close_path()
|
||||
|
||||
cr:set_source_rgba(gears.color.parse_color(widget.col2))
|
||||
cr:fill()
|
||||
end
|
||||
end
|
||||
|
||||
return widget
|
||||
end
|
||||
|
||||
-- ]]
|
||||
|
||||
return separators
|
||||
|
|
@ -79,8 +79,8 @@ local function new(args)
|
|||
forced_height = dpi(6),
|
||||
paddings = 0,
|
||||
shape = gears.shape.rounded_rect,
|
||||
background_color = beautiful.primary.hue_900,
|
||||
color = beautiful.primary.hue_400,
|
||||
background_color = beautiful.primary.hue_100,
|
||||
color = beautiful.accent.hue_400,
|
||||
widget = wibox.widget.progressbar
|
||||
}
|
||||
|
||||
|
|
@ -88,8 +88,8 @@ local function new(args)
|
|||
forced_height = dpi(8),
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = 0,
|
||||
bar_color = beautiful.primary.hue_500,
|
||||
handle_color = beautiful.primary.hue_300,
|
||||
bar_color = beautiful.accent.hue_500,
|
||||
handle_color = beautiful.accent.hue_300,
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_border_color = '#00000012',
|
||||
handle_border_width = dpi(3),
|
||||
|
|
|
|||
21
src/.config/awesome/widget/memory.lua
Normal file
21
src/.config/awesome/widget/memory.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local wibox = require('wibox')
|
||||
local beautiful = require('beautiful')
|
||||
local watch = require('awful.widget.watch')
|
||||
|
||||
local memory = wibox.widget.textbox()
|
||||
memory.font = beautiful.font
|
||||
|
||||
function round(exact, quantum)
|
||||
local quant,frac = math.modf(exact/quantum)
|
||||
return quantum * (quant + (frac > 0.5 and 1 or 0))
|
||||
end
|
||||
|
||||
watch('bash -c "free | grep -z Mem.*Swap.*"', 1, function(_, stdout)
|
||||
local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
||||
stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
||||
|
||||
memory.text = round((used / 1048576), 0.01) .. 'GB'
|
||||
collectgarbage('collect')
|
||||
end)
|
||||
|
||||
return memory
|
||||
141
src/.config/awesome/widget/net.lua
Normal file
141
src/.config/awesome/widget/net.lua
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
local wibox = require("wibox")
|
||||
local string = string
|
||||
|
||||
local spawn = require("awful.spawn")
|
||||
local timer = require("gears.timer")
|
||||
|
||||
-- Network infos
|
||||
-- lain.widget.net
|
||||
|
||||
local function line_callback(cmd, callback)
|
||||
return spawn.with_line_callback(cmd, {
|
||||
stdout = function (line)
|
||||
callback(line)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
local timer_table = {}
|
||||
|
||||
local function newtimer(name, timeout, fun, nostart, stoppable)
|
||||
if not name or #name == 0 then return end
|
||||
name = (stoppable and name) or timeout
|
||||
if not timer_table[name] then
|
||||
timer_table[name] = timer({ timeout = timeout })
|
||||
timer_table[name]:start()
|
||||
end
|
||||
timer_table[name]:connect_signal("timeout", fun)
|
||||
if not nostart then
|
||||
timer_table[name]:emit_signal("timeout")
|
||||
end
|
||||
return stoppable and timer_table[name]
|
||||
end
|
||||
|
||||
local function first_line(path)
|
||||
local file, first = io.open(path, "rb"), nil
|
||||
if file then
|
||||
first = file:read("*l")
|
||||
file:close()
|
||||
end
|
||||
return first
|
||||
end
|
||||
|
||||
local function lines_from(path)
|
||||
local lines = {}
|
||||
for line in io.lines(path) do
|
||||
lines[#lines + 1] = line
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
local function factory(args)
|
||||
args = args or {}
|
||||
|
||||
local net = { widget = args.widget or wibox.widget.textbox(), devices = {} }
|
||||
local timeout = args.timeout or 2
|
||||
local units = args.units or 1024 -- KB
|
||||
local wifi_state = args.wifi_state or "off"
|
||||
local eth_state = args.eth_state or "off"
|
||||
local screen = args.screen or 1
|
||||
local settings = args.settings or function() end
|
||||
|
||||
-- Compatibility with old API where iface was a string corresponding to 1 interface
|
||||
net.iface = (args.iface and (type(args.iface) == "string" and {args.iface}) or
|
||||
(type(args.iface) == "table" and args.iface)) or {}
|
||||
|
||||
function net.get_devices()
|
||||
net.iface = {} -- reset at every call
|
||||
line_callback("ip link", function(line)
|
||||
net.iface[#net.iface + 1] = not string.match(line, "LOOPBACK") and string.match(line, "(%w+): <") or nil
|
||||
end)
|
||||
end
|
||||
|
||||
if #net.iface == 0 then net.get_devices() end
|
||||
|
||||
function net.update()
|
||||
-- These are the totals over all specified interfaces
|
||||
net_now = {
|
||||
devices = {},
|
||||
-- Bytes since last iteration
|
||||
sent = 0,
|
||||
received = 0
|
||||
}
|
||||
|
||||
for _, dev in ipairs(net.iface) do
|
||||
local dev_now = {}
|
||||
local dev_before = net.devices[dev] or { last_t = 0, last_r = 0 }
|
||||
local now_t = tonumber(first_line(string.format("/sys/class/net/%s/statistics/tx_bytes", dev)) or 0)
|
||||
local now_r = tonumber(first_line(string.format("/sys/class/net/%s/statistics/rx_bytes", dev)) or 0)
|
||||
|
||||
dev_now.carrier = first_line(string.format("/sys/class/net/%s/carrier", dev)) or "0"
|
||||
dev_now.state = first_line(string.format("/sys/class/net/%s/operstate", dev)) or "down"
|
||||
|
||||
dev_now.sent = (now_t - dev_before.last_t) / timeout / units
|
||||
dev_now.received = (now_r - dev_before.last_r) / timeout / units
|
||||
|
||||
net_now.sent = net_now.sent + dev_now.sent
|
||||
net_now.received = net_now.received + dev_now.received
|
||||
|
||||
dev_now.sent = string.format("%.1f", dev_now.sent)
|
||||
dev_now.received = string.format("%.1f", dev_now.received)
|
||||
|
||||
dev_now.last_t = now_t
|
||||
dev_now.last_r = now_r
|
||||
|
||||
if wifi_state == "on" and first_line(string.format("/sys/class/net/%s/uevent", dev)) == "DEVTYPE=wlan" then
|
||||
dev_now.wifi = true
|
||||
if string.match(dev_now.carrier, "1") then
|
||||
dev_now.signal = tonumber(string.match(lines_from("/proc/net/wireless")[3], "(%-%d+%.)")) or nil
|
||||
end
|
||||
else
|
||||
dev_now.wifi = false
|
||||
end
|
||||
|
||||
if eth_state == "on" and first_line(string.format("/sys/class/net/%s/uevent", dev)) ~= "DEVTYPE=wlan" then
|
||||
dev_now.ethernet = true
|
||||
else
|
||||
dev_now.ethernet = false
|
||||
end
|
||||
|
||||
net.devices[dev] = dev_now
|
||||
|
||||
net_now.carrier = dev_now.carrier
|
||||
net_now.state = dev_now.state
|
||||
net_now.devices[dev] = dev_now
|
||||
-- net_now.sent and net_now.received will be
|
||||
-- the totals across all specified devices
|
||||
end
|
||||
|
||||
net_now.sent = string.format("%.1f", net_now.sent)
|
||||
net_now.received = string.format("%.1f", net_now.received)
|
||||
|
||||
widget = net.widget
|
||||
settings()
|
||||
end
|
||||
|
||||
newtimer("network", timeout, net.update)
|
||||
|
||||
return net
|
||||
end
|
||||
|
||||
return factory
|
||||
12
src/.config/awesome/widget/storage.lua
Normal file
12
src/.config/awesome/widget/storage.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
local wibox = require('wibox')
|
||||
local watch = require('awful.widget.watch')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
local storage = wibox.widget.textbox()
|
||||
storage.font = beautiful.font
|
||||
|
||||
watch('bash -c "df -h $HOME | awk \'/[0-9]/ {print $2-$3}\'"', 30, function(_, stdout)
|
||||
storage.text = stdout
|
||||
end)
|
||||
|
||||
return storage
|
||||
|
|
@ -98,8 +98,6 @@ local function list_update(w, buttons, label, data, objects)
|
|||
end
|
||||
|
||||
bgb.shape = args.shape
|
||||
bgb.shape_border_width = args.shape_border_width
|
||||
bgb.shape_border_color = args.shape_border_color
|
||||
|
||||
w:add(bgb)
|
||||
end
|
||||
|
|
@ -109,19 +107,24 @@ local TagList = function(s)
|
|||
return awful.widget.taglist(s, awful.widget.taglist.filter.all,
|
||||
awful.util.table.join(awful.button({}, 1, function(t)
|
||||
t:view_only()
|
||||
_G._splash_to_current_tag()
|
||||
end), awful.button({modkey}, 1, function(t)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:move_to_tag(t)
|
||||
t:view_only()
|
||||
end
|
||||
end), awful.button({}, 3, awful.tag.viewtoggle), awful.button({modkey}, 3, function(t)
|
||||
_G._splash_to_current_tag()
|
||||
end), awful.button({modkey}, 3, function(t)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:toggle_tag(t)
|
||||
end
|
||||
_G._splash_to_current_tag()
|
||||
end), awful.button({}, 4, function(t)
|
||||
awful.tag.viewprev(t.screen)
|
||||
_G._splash_to_current_tag()
|
||||
end), awful.button({}, 5, function(t)
|
||||
awful.tag.viewnext(t.screen)
|
||||
_G._splash_to_current_tag()
|
||||
end)), {}, list_update, wibox.layout.fixed.horizontal())
|
||||
end
|
||||
return TagList
|
||||
|
|
@ -55,7 +55,7 @@ local function list_update(w, buttons, label, data, objects)
|
|||
bg_clickable = clickable_container()
|
||||
bgb = wibox.container.background()
|
||||
tbm = wibox.container.margin(tb, dpi(4), dpi(4), dpi(1), dpi(1))
|
||||
ibm = wibox.container.margin(ib, dpi(2), dpi(2), dpi(2), dpi(2))
|
||||
ibm = wibox.container.margin(ib, dpi(1), dpi(1), dpi(1), dpi(1))
|
||||
l = wibox.layout.fixed.horizontal()
|
||||
ll = wibox.layout.flex.horizontal()
|
||||
|
||||
|
|
@ -86,6 +86,8 @@ local function list_update(w, buttons, label, data, objects)
|
|||
-- The text might be invalid, so use pcall.
|
||||
if tasklist_mode == 'icon' then
|
||||
text = nil
|
||||
elseif tasklist_mode == 'text' then
|
||||
icon = nil
|
||||
end
|
||||
if text == nil or text == '' then
|
||||
tbm:set_margins(0)
|
||||
|
|
@ -109,6 +111,7 @@ local function list_update(w, buttons, label, data, objects)
|
|||
bgb.shape = args.shape
|
||||
bgb.shape_border_width = args.shape_border_width
|
||||
bgb.shape_border_color = args.shape_border_color
|
||||
tb.align = 'center'
|
||||
|
||||
w:add(bgb)
|
||||
end
|
||||
12
src/.config/awesome/widget/temprature.lua
Normal file
12
src/.config/awesome/widget/temprature.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
local wibox = require('wibox')
|
||||
local watch = require('awful.widget.watch')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
local temprature = wibox.widget.textbox()
|
||||
temprature.font = beautiful.font
|
||||
|
||||
watch('bash -c "sensors | awk \'/Core 0/ {print substr($3, 2) }\'"', 30, function(_, stdout)
|
||||
temprature.text = stdout
|
||||
end)
|
||||
|
||||
return temprature
|
||||
51
src/.config/awesome/widget/volume.lua
Normal file
51
src/.config/awesome/widget/volume.lua
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
local awful = require("awful")
|
||||
local wibox = require('wibox')
|
||||
local mat_list_item = require('widget.material.list-item')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local watch = require('awful.widget.watch')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
local volume_icon = wibox.widget.textbox()
|
||||
volume_icon.font = beautiful.icon_font
|
||||
local volume_widget = wibox.widget.textbox()
|
||||
volume_widget.align = 'center'
|
||||
volume_widget.valign = 'center'
|
||||
volume_widget.font = beautiful.font
|
||||
|
||||
local volume
|
||||
|
||||
function update_volume()
|
||||
awful.spawn.easy_async_with_shell("bash -c 'amixer -D pulse sget Master'", function(stdout)
|
||||
volume = string.match(stdout, '(%d?%d?%d)%%')
|
||||
awful.spawn.easy_async_with_shell("bash -c 'pacmd list-sinks | awk '/muted/ { print $2 }''", function(muted)
|
||||
volume_widget.text = volume
|
||||
muted = string.gsub(muted, "%s+", "")
|
||||
if muted == 'muted:no' and (volume > '35' or volume == '100') then
|
||||
volume_icon.text = '墳'
|
||||
elseif muted == 'muted:no' and volume <= '35' and volume > '0' then
|
||||
volume_icon.text = '奔'
|
||||
elseif muted == 'muted:yes' then
|
||||
volume_icon.text = '婢'
|
||||
volume_widget.text = 'M'
|
||||
elseif volume == '0' then
|
||||
volume_icon.text = '奄'
|
||||
end
|
||||
end)
|
||||
collectgarbage('collect')
|
||||
end)
|
||||
end
|
||||
|
||||
watch('bash -c', 3, function(_, stdout)
|
||||
update_volume()
|
||||
end)
|
||||
|
||||
return wibox.widget {
|
||||
wibox.widget{
|
||||
volume_icon,
|
||||
fg = beautiful.accent.hue_100,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
volume_widget,
|
||||
spacing = dpi(4),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
|
@ -32,26 +32,27 @@ inactive-opacity = 1.0;
|
|||
active-opacity = 1.0;
|
||||
frame-opacity = 1.0;
|
||||
inactive-opacity-override = false;
|
||||
alpha-step = 0.06;
|
||||
# inactive-dim = 0.2;
|
||||
# alpha-step = 0.06;
|
||||
# inactive-dim = 0.05;
|
||||
# inactive-dim-fixed = true;
|
||||
blur-background = true;
|
||||
blur-background-frame = true;
|
||||
blur-method = "kawase";
|
||||
blur-strength = 10;
|
||||
blur-background-fixed = true;
|
||||
blur-background-exclude = [
|
||||
"window_type = 'dock'",
|
||||
"window_type = 'desktop'",
|
||||
"class_g = 'slop'",
|
||||
"_GTK_FRAME_EXTENTS@:c"
|
||||
];
|
||||
# blur-background = true;
|
||||
# blur-background-frame = true;
|
||||
# blur-strength = 20;
|
||||
# blur-background-fixed = true;
|
||||
# blur-background-exclude = [
|
||||
# "window_type = 'dock'",
|
||||
# "window_type = 'desktop'",
|
||||
# "class_g = 'slop'",
|
||||
# "WM_NAME@:s = 'SplashTerminal'",
|
||||
# "WM_NAME@:s = 'dropdown_terminal'",
|
||||
# "_GTK_FRAME_EXTENTS@:c"
|
||||
# ];
|
||||
|
||||
# Fading
|
||||
fading = true;
|
||||
fade-delta = 4;
|
||||
fade-in-step = 0.04;
|
||||
fade-out-step = 0.04;
|
||||
fade-in-step = 0.1;
|
||||
fade-out-step = 0.1;
|
||||
no-fading-openclose = false;
|
||||
# no-fading-destroyed-argb = true;
|
||||
fade-exclude = [ ];
|
||||
|
|
@ -79,7 +80,7 @@ invert-color-include = [ ];
|
|||
# GLX backend
|
||||
vsync="opengl-swc";
|
||||
unredir-if-possible=true;
|
||||
#paint-on-overlay=true;
|
||||
# paint-on-overlay=true;
|
||||
#glx-no-stencil=true;
|
||||
glx-copy-from-front=false;
|
||||
# glx-no-stencil = true;
|
||||
|
|
@ -94,9 +95,9 @@ glx-no-rebind-pixmap = true;
|
|||
# Window type settings
|
||||
wintypes:
|
||||
{
|
||||
tooltip = {
|
||||
fade = true;
|
||||
tooltip = {
|
||||
fade = true;
|
||||
shadow = true;
|
||||
focus = true;
|
||||
focus = true;
|
||||
};
|
||||
};
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
# Alternatively copy paste below directly into kitty.conf
|
||||
|
||||
foreground #f8f8f2
|
||||
background #282a36
|
||||
background #282828
|
||||
selection_foreground #ffffff
|
||||
selection_background #44475a
|
||||
|
||||
|
|
|
|||
38
src/.config/kitty/gruvbox-material.conf
Normal file
38
src/.config/kitty/gruvbox-material.conf
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Original Project:
|
||||
# https://github.com/sainnhe/gruvbox-material/
|
||||
# Colors are different than original, just to match my taste :P
|
||||
|
||||
foreground #d6d6d6
|
||||
background #282828
|
||||
|
||||
# black
|
||||
color0 #282828
|
||||
color8 #6e6e6e
|
||||
|
||||
# red
|
||||
color1 #f35a5a
|
||||
color9 #ba524a
|
||||
|
||||
# green
|
||||
color2 #92c96a
|
||||
color10 #7b9d62
|
||||
|
||||
# yellow
|
||||
color3 #e1be7f
|
||||
color11 #cd996a
|
||||
|
||||
# blue
|
||||
color4 #66aeea
|
||||
color12 #4083bc
|
||||
|
||||
# magenta
|
||||
color5 #c57cda
|
||||
color13 #9955ac
|
||||
|
||||
# cyan
|
||||
color6 #3cb46c
|
||||
color14 #319659
|
||||
|
||||
# white
|
||||
color7 #d1d1d1
|
||||
color15 #858585
|
||||
40
src/.config/kitty/gruvbox.conf
Normal file
40
src/.config/kitty/gruvbox.conf
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# gruvbox-dark colorscheme for kitty
|
||||
# snazzy theme used as base
|
||||
|
||||
foreground #ebdbb2
|
||||
background #272727
|
||||
selection_foreground #655b53
|
||||
selection_background #ebdbb2
|
||||
url_color #d65c0d
|
||||
|
||||
# black
|
||||
color0 #272727
|
||||
color8 #928373
|
||||
|
||||
# red
|
||||
color1 #cc231c
|
||||
color9 #fb4833
|
||||
|
||||
# green
|
||||
color2 #989719
|
||||
color10 #b8ba25
|
||||
|
||||
# yellow
|
||||
color3 #d79920
|
||||
color11 #fabc2e
|
||||
|
||||
# blue
|
||||
color4 #448488
|
||||
color12 #83a597
|
||||
|
||||
# magenta
|
||||
color5 #b16185
|
||||
color13 #d3859a
|
||||
|
||||
# cyan
|
||||
color6 #689d69
|
||||
color14 #8ec07b
|
||||
|
||||
# white
|
||||
color7 #a89983
|
||||
color15 #ebdbb2
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
include dracula.conf
|
||||
include gruvbox.conf
|
||||
|
||||
background_opacity 0.95
|
||||
background_opacity 0.9
|
||||
font_family FiraCode Nerd Font Mono
|
||||
bold_font auto
|
||||
italic_font auto
|
||||
bold_italic_font auto
|
||||
window_padding_width 4
|
||||
window_padding_width 1
|
||||
font_size 12
|
||||
disable_ligatures always
|
||||
enable_audio_bell no
|
||||
|
|
|
|||
8
src/.config/nvim/.gitignore
vendored
Normal file
8
src/.config/nvim/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
.netrwhist
|
||||
spell/
|
||||
plugged/
|
||||
*.swp
|
||||
temp/
|
||||
autoload/
|
||||
session/
|
||||
|
||||
134
src/.config/nvim/coc-settings.json
Normal file
134
src/.config/nvim/coc-settings.json
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
{
|
||||
// suggestions
|
||||
// "suggest.echodocSupport": true,
|
||||
// TODO add more labels and give them cool glyphs
|
||||
"suggest.completionItemKindLabels": {
|
||||
"text": "t",
|
||||
"method": "m",
|
||||
"function": ""
|
||||
},
|
||||
"snippets.priority": 1,
|
||||
//"yank.priority": 1,
|
||||
"suggest.languageSourcePriority": 99,
|
||||
"coc.source.file.priority": 2,
|
||||
"coc.source.around.priority": 3,
|
||||
"coc.source.buffer.priority": 4,
|
||||
|
||||
// diagnostics
|
||||
"diagnostic.errorSign": " ",
|
||||
"diagnostic.warningSign": " ",
|
||||
"diagnostic.infoSign": "",
|
||||
"diagnostic.hintSign": " ",
|
||||
// "diagnostic.displayByAle": true,
|
||||
// "diagnostic.virtualText": true, // this won't work with codelens when error on same line
|
||||
|
||||
// codelens
|
||||
"codeLens.enable": true,
|
||||
"java.referencesCodeLens.enabled": true,
|
||||
"java.implementationsCodeLens.enabled": true,
|
||||
"java.completion.enabled": true,
|
||||
"java.jdt.ls.vmargs": "-javaagent:/usr/local/share/lombok/lombok.jar",
|
||||
|
||||
// list
|
||||
"list.indicator": ">",
|
||||
"list.selectedSignText": " ",
|
||||
|
||||
// autoformat
|
||||
"coc.preferences.formatOnSaveFiletypes": [
|
||||
"css",
|
||||
"markdown",
|
||||
"javascript",
|
||||
"graphql",
|
||||
"html",
|
||||
"yaml",
|
||||
"json",
|
||||
"python",
|
||||
"java"
|
||||
],
|
||||
"coc.preferences.hoverTarget": "float",
|
||||
|
||||
// python config
|
||||
"python.analysis.autoImportCompletions": true,
|
||||
"python.analysis.autoSearchPaths": true,
|
||||
"python.analysis.diagnosticMode": "openFilesOnly",
|
||||
"python.analysis.stubPath": "typings",
|
||||
"python.analysis.typeshedPaths": [],
|
||||
"python.analysis.diagnosticSeverityOverrides": {},
|
||||
"python.analysis.typeCheckingMode": "basic",
|
||||
"python.analysis.useLibraryCodeForTypes": true,
|
||||
"python.pythonPath": "python",
|
||||
"python.venvPath": "",
|
||||
"python.formatting.provider": "black",
|
||||
"python.formatting.blackPath": "black",
|
||||
"python.formatting.blackArgs": [],
|
||||
"python.formatting.autopep8Path": "autopep8",
|
||||
"python.formatting.autopep8Args": [],
|
||||
"python.formatting.yapfPath": "yapf",
|
||||
"python.formatting.yapfArgs": [],
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.flake8Enabled": false,
|
||||
"python.linting.banditEnabled": false,
|
||||
"python.linting.mypyEnabled": false,
|
||||
"python.linting.pytypeEnabled": false,
|
||||
"python.linting.prospectorEnabled": false,
|
||||
"python.linting.pydocstyleEnabled": false,
|
||||
"python.linting.pylamaEnabled": false,
|
||||
"python.linting.pylintEnabled": false,
|
||||
"pyright.disableCompletion": false,
|
||||
"pyright.disableLanguageServices": false,
|
||||
"pyright.disableOrganizeImports": false,
|
||||
|
||||
// snippets
|
||||
"snippets.ultisnips.directories": ["UltiSnips", "~/.config/nvim/snips"],
|
||||
//"snippets.userSnippetsDirectory": "~/.config/nvim/snips",
|
||||
|
||||
// emmet
|
||||
"emmet.includeLanguages": {
|
||||
"vue-html": "html",
|
||||
"javascript": "javascriptreact"
|
||||
},
|
||||
|
||||
// CSS (disable since I'm also using stylelintplus)
|
||||
"css.validate": false,
|
||||
"less.validate": false,
|
||||
"scss.validate": false,
|
||||
"wxss.validate": false,
|
||||
|
||||
// explorer
|
||||
"explorer.width": 30,
|
||||
"explorer.file.root.template": "[icon] [git] [hidden & 1][root]",
|
||||
"explorer.icon.enableNerdfont": true,
|
||||
"explorer.previewAction.onHover": false,
|
||||
"explorer.icon.enableVimDevicons": false,
|
||||
"explorer.file.showHiddenFiles": false,
|
||||
"explorer.keyMappings.global": {
|
||||
"<cr>": ["expandable?", "expand", "open"],
|
||||
"v": "open:vsplit"
|
||||
},
|
||||
|
||||
"languageserver": {
|
||||
"lua": {
|
||||
"command": "/home/chris/.luambenvs/neovim4/bin/lua-lsp",
|
||||
"filetypes": ["lua"],
|
||||
"trace.server": "verbose"
|
||||
}
|
||||
},
|
||||
|
||||
"bookmark.sign": "",
|
||||
|
||||
//coc-emoji
|
||||
"coc.source.emoji.filetypes": ["markdown"]
|
||||
|
||||
// lua
|
||||
//"lua.useSumnekoLs": true,
|
||||
//"lua.commandPath": "/home/chris/.luambenvs/neovim3/bin/lua-lsp"
|
||||
//"lua.enable": true,
|
||||
//"Lua.completion.enable": true,
|
||||
//"Lua.runtime.version": "Lua 5.1",
|
||||
//"Lua.runtime.path": ["?.lua", "?/init.lua", "?/?.lua"],
|
||||
//"lua.version": "5.1"
|
||||
//"lua.commandPath": "/home/chris/.vscode-insiders/extensions/sumneko.lua-1.0.5/server/bin/Linux/lua-language-server"
|
||||
|
||||
// TODO b:coc_suggest_disable=1 GOYO
|
||||
// TODO add to paths.vim g:coc_node_path
|
||||
}
|
||||
621
src/.config/nvim/init.vim
Normal file
621
src/.config/nvim/init.vim
Normal file
|
|
@ -0,0 +1,621 @@
|
|||
"*****************************************************************************
|
||||
"" Plugin Installation
|
||||
"*****************************************************************************
|
||||
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
|
||||
if has('win32')&&!has('win64')
|
||||
let curl_exists=expand('C:\Windows\Sysnative\curl.exe')
|
||||
else
|
||||
let curl_exists=expand('curl')
|
||||
endif
|
||||
|
||||
if !filereadable(vimplug_exists)
|
||||
if !executable(curl_exists)
|
||||
echoerr "You have to install curl or first install vim-plug yourself!"
|
||||
execute "q!"
|
||||
endif
|
||||
echo "Installing Vim-Plug..."
|
||||
echo ""
|
||||
silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . " --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
|
||||
let g:not_finish_vimplug = "yes"
|
||||
|
||||
autocmd VimEnter * PlugInstall
|
||||
endif
|
||||
|
||||
set nocompatible
|
||||
filetype on
|
||||
call plug#begin()
|
||||
" Load plugins
|
||||
" VIM enhancements
|
||||
Plug 'ciaranm/securemodelines'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'justinmk/vim-sneak'
|
||||
|
||||
" GUI enhancements
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
Plug 'andymass/vim-matchup'
|
||||
|
||||
" Fuzzy finder
|
||||
Plug 'airblade/vim-rooter'
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" Semantic language support
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
|
||||
" Syntactic language support
|
||||
Plug 'cespare/vim-toml'
|
||||
Plug 'stephpy/vim-yaml'
|
||||
Plug 'rhysd/vim-clang-format'
|
||||
Plug 'dag/vim-fish'
|
||||
Plug 'godlygeek/tabular'
|
||||
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'jistr/vim-nerdtree-tabs'
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'vim-scripts/grep.vim'
|
||||
Plug 'vim-scripts/CSApprox'
|
||||
Plug 'Raimondi/delimitMate'
|
||||
Plug 'dense-analysis/ale'
|
||||
Plug 'Yggdroot/indentLine'
|
||||
Plug 'tpope/vim-rhubarb' " required by fugitive to :Gbrowse
|
||||
Plug 'liuchengxu/vim-which-key'
|
||||
Plug 'severin-lemaignan/vim-minimap'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'morhetz/gruvbox'
|
||||
Plug 'sainnhe/gruvbox-material' " I switch when I feel like it :P
|
||||
Plug 'mg979/vim-visual-multi'
|
||||
Plug 'ntpeters/vim-better-whitespace'
|
||||
Plug 'yuttie/comfortable-motion.vim'
|
||||
|
||||
let g:make = 'gmake'
|
||||
if exists('make')
|
||||
let g:make = 'make'
|
||||
endif
|
||||
Plug 'Shougo/vimproc.vim', {'do': g:make}
|
||||
|
||||
"" Vim-Session
|
||||
Plug 'xolox/vim-misc'
|
||||
Plug 'xolox/vim-session'
|
||||
|
||||
"" Snippets
|
||||
Plug 'SirVer/ultisnips'
|
||||
Plug 'honza/vim-snippets'
|
||||
|
||||
" c
|
||||
Plug 'vim-scripts/c.vim', {'for': ['c', 'cpp']}
|
||||
Plug 'ludwig/split-manpage.vim'
|
||||
|
||||
" elm
|
||||
"" Elm Bundle
|
||||
Plug 'elmcast/elm-vim'
|
||||
|
||||
" erlang
|
||||
Plug 'jimenezrick/vimerl'
|
||||
|
||||
" go
|
||||
"" Go Lang Bundle
|
||||
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}
|
||||
|
||||
" haskell
|
||||
"" Haskell Bundle
|
||||
Plug 'eagletmt/neco-ghc'
|
||||
Plug 'dag/vim2hs'
|
||||
Plug 'pbrisbin/vim-syntax-shakespeare'
|
||||
|
||||
" html
|
||||
"" HTML Bundle
|
||||
Plug 'hail2u/vim-css3-syntax'
|
||||
Plug 'gko/vim-coloresque'
|
||||
Plug 'tpope/vim-haml'
|
||||
Plug 'mattn/emmet-vim'
|
||||
|
||||
" javascript
|
||||
"" Javascript Bundle
|
||||
Plug 'jelera/vim-javascript-syntax'
|
||||
|
||||
" python
|
||||
"" Python Bundle
|
||||
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
|
||||
|
||||
" ruby
|
||||
Plug 'tpope/vim-rails'
|
||||
Plug 'tpope/vim-rake'
|
||||
Plug 'tpope/vim-projectionist'
|
||||
Plug 'thoughtbot/vim-rspec'
|
||||
Plug 'ecomba/vim-ruby-refactoring', {'tag': 'main'}
|
||||
|
||||
" rust
|
||||
" Vim racer
|
||||
Plug 'racer-rust/vim-racer'
|
||||
|
||||
" Rust.vim
|
||||
Plug 'rust-lang/rust.vim'
|
||||
|
||||
" svelte
|
||||
Plug 'leafOfTree/vim-svelte-plugin'
|
||||
|
||||
" typescript
|
||||
Plug 'leafgarland/typescript-vim'
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
|
||||
" vuejs
|
||||
Plug 'posva/vim-vue'
|
||||
Plug 'leafOfTree/vim-vue-plugin'
|
||||
call plug#end()
|
||||
|
||||
"*****************************************************************************
|
||||
"" End of Plugin Installation
|
||||
"*****************************************************************************
|
||||
|
||||
"*****************************************************************************
|
||||
"" Basic Settings
|
||||
"*****************************************************************************
|
||||
|
||||
syntax on
|
||||
set ruler
|
||||
set autoindent
|
||||
let no_buffers_menu=1
|
||||
colorscheme gruvbox
|
||||
set bg=dark
|
||||
set mousemodel=popup
|
||||
set t_Co=256
|
||||
hi Normal ctermbg=230
|
||||
set updatetime=100
|
||||
set mouse=a
|
||||
set noswapfile
|
||||
set colorcolumn=80
|
||||
|
||||
"" Set smart line numbers
|
||||
set number relativenumber
|
||||
augroup numbertoggle
|
||||
autocmd!
|
||||
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
||||
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
||||
augroup END
|
||||
|
||||
"" Encoding
|
||||
set encoding=utf-8
|
||||
set fileencoding=utf-8
|
||||
set fileencodings=utf-8
|
||||
|
||||
"" Fix backspace indent
|
||||
set backspace=indent,eol,start
|
||||
|
||||
"" Tabs. May be overridden by autocmd rules
|
||||
set tabstop=4
|
||||
set softtabstop=0
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
|
||||
"" Map leader to <Space>
|
||||
" https://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||
let mapleader = "\<Space>"
|
||||
if executable('ag')
|
||||
set grepprg=ag\ --nogroup\ --nocolor
|
||||
endif
|
||||
if executable('rg')
|
||||
set grepprg=rg\ --no-heading\ --vimgrep
|
||||
set grepformat=%f:%l:%c:%m
|
||||
endif
|
||||
|
||||
" session management
|
||||
let g:session_directory = "~/.config/nvim/session"
|
||||
let g:session_autoload = "no"
|
||||
let g:session_autosave = "no"
|
||||
let g:session_command_aliases = 1
|
||||
|
||||
" deal with colors
|
||||
if !has('gui_running')
|
||||
set t_Co=256
|
||||
endif
|
||||
if (match($TERM, "-256color") != -1) && (match($TERM, "screen-256color") == -1)
|
||||
" screen does not (yet) support truecolor
|
||||
set termguicolors
|
||||
endif
|
||||
let base16colorspace=256
|
||||
|
||||
|
||||
" IndentLine
|
||||
let g:indentLine_enabled = 1
|
||||
let g:indentLine_concealcursor = 0
|
||||
let g:indentLine_char = '┆'
|
||||
let g:indentLine_faster = 1
|
||||
|
||||
au TermEnter * setlocal scrolloff=0
|
||||
au TermLeave * setlocal scrolloff=3
|
||||
|
||||
"" Status bar
|
||||
set laststatus=2
|
||||
|
||||
"" Use modeline overrides
|
||||
set modeline
|
||||
set modelines=10
|
||||
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
|
||||
|
||||
" remove trailing whitespaces
|
||||
command! FixWhitespace :%s/\s\+$//e
|
||||
|
||||
"" Copy/Paste/Cut to system clipboard
|
||||
if has('unnamedplus')
|
||||
set clipboard=unnamed,unnamedplus
|
||||
endif
|
||||
|
||||
" Sane splits
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
||||
" Permanent undo
|
||||
set undodir=~/.vimdid
|
||||
set undofile
|
||||
|
||||
" Decent wildmenu
|
||||
set wildmenu
|
||||
set wildmode=list:longest
|
||||
set wildignore=.hg,.svn,*~,*.png,*.jpg,*.gif,*.settings,Thumbs.db,*.min.js,*.swp,publish/*,intermediate/*,*.o,*.hi,Zend,vendor
|
||||
|
||||
"" Searching
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
"*****************************************************************************
|
||||
"" End of Base Settings
|
||||
"*****************************************************************************
|
||||
|
||||
"*****************************************************************************
|
||||
"" Plugin Settings
|
||||
"*****************************************************************************
|
||||
|
||||
" vim-airline
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline#extensions#branch#enabled = 1
|
||||
let g:airline#extensions#ale#enabled = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline_skip_empty_sections = 1
|
||||
let g:airline_theme='gruvbox'
|
||||
|
||||
"" NERDTree configuration
|
||||
let g:NERDTreeChDirMode=2
|
||||
let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
|
||||
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
let g:NERDTreeShowHidden=1
|
||||
let g:nerdtree_tabs_focus_on_files=1
|
||||
let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
|
||||
let g:NERDTreeWinSize = 30
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
|
||||
nnoremap <silent> <A-f> :NERDTreeFind<CR>
|
||||
nnoremap <silent> <C-e> :NERDTreeToggle<CR>
|
||||
|
||||
" grep.vim
|
||||
nnoremap <silent> <leader>f :Rgrep<CR>
|
||||
let Grep_Default_Options = '-IR'
|
||||
let Grep_Skip_Files = '*.log *.db'
|
||||
let Grep_Skip_Dirs = '.git node_modules'
|
||||
|
||||
" vim rooter
|
||||
let g:rooter_silent_chdir = 1
|
||||
|
||||
"*****************************************************************************
|
||||
"" End of Plugin Settings
|
||||
"*****************************************************************************
|
||||
|
||||
"*****************************************************************************
|
||||
"" Language Settings
|
||||
"*****************************************************************************
|
||||
|
||||
" PYTHON
|
||||
" vim-python
|
||||
augroup vimrc-python
|
||||
autocmd!
|
||||
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
|
||||
\ formatoptions+=croq softtabstop=4
|
||||
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||
augroup END
|
||||
" jedi-vim
|
||||
let g:jedi#popup_on_dot = 0
|
||||
let g:jedi#goto_assignments_command = "<leader>g"
|
||||
let g:jedi#goto_definitions_command = "<leader>d"
|
||||
let g:jedi#documentation_command = "K"
|
||||
let g:jedi#usages_command = "<leader>n"
|
||||
let g:jedi#rename_command = "<leader>r"
|
||||
let g:jedi#show_call_signatures = "0"
|
||||
let g:jedi#completions_command = "<C-Space>"
|
||||
let g:jedi#smart_auto_mappings = 0
|
||||
" ale
|
||||
let g:ale_linters = {}
|
||||
:call extend(g:ale_linters, {
|
||||
\'python': ['flake8'], })
|
||||
" vim-airline
|
||||
let g:airline#extensions#virtualenv#enabled = 1
|
||||
" Syntax highlight
|
||||
let python_highlight_all = 1
|
||||
|
||||
" JAVASCRIPT
|
||||
let g:javascript_enable_domhtmlcss = 1
|
||||
" vim-javascript
|
||||
augroup vimrc-javascript
|
||||
autocmd!
|
||||
autocmd FileType javascript setl tabstop=4|setl shiftwidth=4|setl expandtab softtabstop=4
|
||||
augroup END
|
||||
|
||||
" RUST
|
||||
" Vim racer
|
||||
au FileType rust nmap gd <Plug>(rust-def)
|
||||
au FileType rust nmap gs <Plug>(rust-def-split)
|
||||
au FileType rust nmap gx <Plug>(rust-def-vertical)
|
||||
au FileType rust nmap <leader>gd <Plug>(rust-doc)
|
||||
|
||||
" GOLANG
|
||||
" vim-go
|
||||
" run :GoBuild or :GoTestCompile based on the go file
|
||||
function! s:build_go_files()
|
||||
let l:file = expand('%')
|
||||
if l:file =~# '^\f\+_test\.go$'
|
||||
call go#test#Test(0, 1)
|
||||
elseif l:file =~# '^\f\+\.go$'
|
||||
call go#cmd#Build(0)
|
||||
endif
|
||||
endfunction
|
||||
let g:go_list_type = "quickfix"
|
||||
let g:go_fmt_command = "goimports"
|
||||
let g:go_fmt_fail_silently = 1
|
||||
let g:go_highlight_types = 1
|
||||
let g:go_highlight_fields = 1
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_build_constraints = 1
|
||||
let g:go_highlight_structs = 1
|
||||
let g:go_highlight_generate_tags = 1
|
||||
let g:go_highlight_space_tab_error = 0
|
||||
let g:go_highlight_array_whitespace_error = 0
|
||||
let g:go_highlight_trailing_whitespace_error = 0
|
||||
let g:go_highlight_extra_types = 1
|
||||
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
|
||||
augroup completion_preview_close
|
||||
autocmd!
|
||||
if v:version > 703 || v:version == 703 && has('patch598')
|
||||
autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif
|
||||
endif
|
||||
augroup END
|
||||
augroup go
|
||||
au!
|
||||
au Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
|
||||
au Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
|
||||
au Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
|
||||
au Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
|
||||
au FileType go nmap <Leader>dd <Plug>(go-def-vertical)
|
||||
au FileType go nmap <Leader>dv <Plug>(go-doc-vertical)
|
||||
au FileType go nmap <Leader>db <Plug>(go-doc-browser)
|
||||
au FileType go nmap <leader>r <Plug>(go-run)
|
||||
au FileType go nmap <leader>t <Plug>(go-test)
|
||||
au FileType go nmap <Leader>gt <Plug>(go-coverage-toggle)
|
||||
au FileType go nmap <Leader>i <Plug>(go-info)
|
||||
au FileType go nmap <silent> <Leader>l <Plug>(go-metalinter)
|
||||
au FileType go nmap <C-g> :GoDecls<cr>
|
||||
au FileType go nmap <leader>dr :GoDeclsDir<cr>
|
||||
au FileType go imap <C-g> <esc>:<C-u>GoDecls<cr>
|
||||
au FileType go imap <leader>dr <esc>:<C-u>GoDeclsDir<cr>
|
||||
au FileType go nmap <leader>rb :<C-u>call <SID>build_go_files()<CR>
|
||||
augroup END
|
||||
" ale
|
||||
:call extend(g:ale_linters, {
|
||||
\"go": ['golint', 'go vet'], })
|
||||
|
||||
" HTML
|
||||
" for html files, 2 spaces
|
||||
autocmd Filetype html setlocal ts=2 sw=2 expandtab
|
||||
|
||||
" C/C++
|
||||
autocmd FileType c setlocal tabstop=4 shiftwidth=4 expandtab
|
||||
autocmd FileType cpp setlocal tabstop=4 shiftwidth=4 expandtab
|
||||
|
||||
" HASKELL
|
||||
let g:haskell_conceal_wide = 1
|
||||
let g:haskell_multiline_strings = 1
|
||||
let g:necoghc_enable_detailed_browse = 1
|
||||
autocmd Filetype haskell setlocal omnifunc=necoghc#omnifunc
|
||||
|
||||
" RUBY
|
||||
let g:rubycomplete_buffer_loading = 1
|
||||
let g:rubycomplete_classes_in_global = 1
|
||||
let g:rubycomplete_rails = 1
|
||||
augroup vimrc-ruby
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby
|
||||
autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2
|
||||
augroup END
|
||||
let g:tagbar_type_ruby = {
|
||||
\ 'kinds' : [
|
||||
\ 'm:modules',
|
||||
\ 'c:classes',
|
||||
\ 'd:describes',
|
||||
\ 'C:contexts',
|
||||
\ 'f:methods',
|
||||
\ 'F:singleton methods'
|
||||
\ ]
|
||||
\ }
|
||||
" RSpec.vim mappings
|
||||
map <Leader>t :call RunCurrentSpecFile()<CR>
|
||||
map <Leader>s :call RunNearestSpec()<CR>
|
||||
map <Leader>l :call RunLastSpec()<CR>
|
||||
map <Leader>a :call RunAllSpecs()<CR>
|
||||
" For ruby refactory
|
||||
if has('nvim')
|
||||
runtime! macros/matchit.vim
|
||||
else
|
||||
packadd! matchit
|
||||
endif
|
||||
" Ruby refactory
|
||||
nnoremap <leader>rap :RAddParameter<cr>
|
||||
nnoremap <leader>rcpc :RConvertPostConditional<cr>
|
||||
nnoremap <leader>rel :RExtractLet<cr>
|
||||
vnoremap <leader>rec :RExtractConstant<cr>
|
||||
vnoremap <leader>relv :RExtractLocalVariable<cr>
|
||||
nnoremap <leader>rit :RInlineTemp<cr>
|
||||
vnoremap <leader>rrlv :RRenameLocalVariable<cr>
|
||||
vnoremap <leader>rriv :RRenameInstanceVariable<cr>
|
||||
vnoremap <leader>rem :RExtractMethod<cr>
|
||||
|
||||
" ELM
|
||||
" elm-vim
|
||||
let g:elm_setup_keybindings = 0
|
||||
let g:elm_format_autosave = 1
|
||||
|
||||
" ERLANG
|
||||
let erlang_folding = 1
|
||||
let erlang_show_errors = 1
|
||||
|
||||
" VUE
|
||||
" vim vue
|
||||
let g:vue_disable_pre_processors=1
|
||||
" vim vue plugin
|
||||
let g:vim_vue_plugin_load_full_syntax = 1
|
||||
|
||||
" SVELTE
|
||||
let g:vim_svelte_plugin_load_full_syntax = 1
|
||||
|
||||
" TYPESCRIPT
|
||||
let g:yats_host_keyword = 1
|
||||
|
||||
"*****************************************************************************
|
||||
"" End of Language Settings
|
||||
"*****************************************************************************
|
||||
|
||||
"*****************************************************************************
|
||||
"" Key Bindings / Shortcuts
|
||||
"*****************************************************************************
|
||||
|
||||
" Reload Nvim
|
||||
noremap <leader>r :so %<CR>
|
||||
|
||||
" Confirm before quitting all
|
||||
noremap <C-q> :confirm qall<CR>
|
||||
|
||||
" Switch split-windows
|
||||
nmap <silent> <A-Up> :wincmd k<CR>
|
||||
nmap <silent> <A-Down> :wincmd j<CR>
|
||||
nmap <silent> <A-Left> :wincmd h<CR>
|
||||
nmap <silent> <A-Right> :wincmd l<CR>
|
||||
nmap <silent> <A-k> :wincmd k<CR>
|
||||
nmap <silent> <A-j> :wincmd j<CR>
|
||||
nmap <silent> <A-h> :wincmd h<CR>
|
||||
nmap <silent> <A-l> :wincmd l<CR>
|
||||
|
||||
" Ctrl-z/y for undo-redo
|
||||
map <C-z> <Esc>
|
||||
map <C-y> <Esc><C-r>
|
||||
|
||||
" Open hotkeys
|
||||
map <C-p> :Files<CR>
|
||||
nmap <leader>; :Buffers<CR>
|
||||
|
||||
" Quick-save
|
||||
nmap <leader>w :w<CR>
|
||||
|
||||
" Ctrl+j/k to go to normal mode
|
||||
nnoremap <C-j> <Esc>
|
||||
inoremap <C-j> <Esc>
|
||||
vnoremap <C-j> <Esc>
|
||||
snoremap <C-j> <Esc>
|
||||
xnoremap <C-j> <Esc>
|
||||
cnoremap <C-j> <C-c>
|
||||
onoremap <C-j> <Esc>
|
||||
lnoremap <C-j> <Esc>
|
||||
tnoremap <C-j> <Esc>
|
||||
nnoremap <C-k> <Esc>
|
||||
inoremap <C-k> <Esc>
|
||||
vnoremap <C-k> <Esc>
|
||||
snoremap <C-k> <Esc>
|
||||
xnoremap <C-k> <Esc>
|
||||
cnoremap <C-k> <C-c>
|
||||
onoremap <C-k> <Esc>
|
||||
lnoremap <C-k> <Esc>
|
||||
tnoremap <C-k> <Esc>
|
||||
|
||||
" Ctrl+h to stop searching
|
||||
vnoremap <C-h> :nohlsearch<cr>
|
||||
nnoremap <C-h> :nohlsearch<cr>
|
||||
|
||||
" Jump to start and end of line using the home row keys
|
||||
map H ^
|
||||
map L $
|
||||
|
||||
" Close buffer / Exit
|
||||
noremap <leader>c :bd<CR>
|
||||
noremap <leader>z :qa<CR>
|
||||
|
||||
" ; as :
|
||||
nnoremap ; :
|
||||
|
||||
" no one is really happy until you have this shortcuts
|
||||
cnoreabbrev W! w!
|
||||
cnoreabbrev Q! q!
|
||||
cnoreabbrev Qall! qall!
|
||||
cnoreabbrev Wq wq
|
||||
cnoreabbrev Wa wa
|
||||
cnoreabbrev wQ wq
|
||||
cnoreabbrev WQ wq
|
||||
cnoreabbrev W w
|
||||
cnoreabbrev Q q
|
||||
cnoreabbrev Qall qall
|
||||
|
||||
" Left and right to switch buffers
|
||||
nnoremap <leader><left> :bp<CR>
|
||||
nnoremap <leader><right> :bn<CR>
|
||||
|
||||
" Move by line
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
" which key
|
||||
nnoremap <silent> <leader><leader> :<c-u>WhichKey '<Space>'<CR>
|
||||
|
||||
" Very magic by default
|
||||
nnoremap ? ?\v
|
||||
nnoremap / /\v
|
||||
cnoremap %s/ %sm/
|
||||
|
||||
" Search mappings: These will make it so that going to the next one in a
|
||||
" search will center on the line it's found in.
|
||||
nnoremap n nzzzv
|
||||
nnoremap N Nzzzv
|
||||
|
||||
" Open new file adjacent to current file
|
||||
nnoremap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
|
||||
|
||||
" Split Screen
|
||||
noremap <Leader>hhh :<C-u>split<CR>
|
||||
noremap <Leader>vvv :<C-u>vsplit<CR>
|
||||
|
||||
" Use <c-.> to trigger completion.
|
||||
inoremap <silent><expr> <c-.> coc#refresh()
|
||||
|
||||
" Fuzzy Finder
|
||||
nnoremap <silent> <leader>ff :FZF -m<CR>
|
||||
|
||||
noremap <leader>s :Rg<CR>
|
||||
let g:fzf_layout = { 'down': '~20%' }
|
||||
|
||||
"*****************************************************************************
|
||||
"" End of Key Bindings / Shortcuts
|
||||
"*****************************************************************************
|
||||
|
||||
"*****************************************************************************
|
||||
" External Modules
|
||||
"*****************************************************************************
|
||||
source $HOME/.config/nvim/src/coc.vim
|
||||
source $HOME/.config/nvim/src/coc-extensions.vim
|
||||
source $HOME/.config/nvim/src/fzf.vim
|
||||
|
||||
33
src/.config/nvim/src/coc-extensions.vim
Normal file
33
src/.config/nvim/src/coc-extensions.vim
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
let g:coc_global_extensions = [
|
||||
\ 'coc-snippets',
|
||||
\ 'coc-actions',
|
||||
\ 'coc-sh',
|
||||
\ 'coc-java-debug',
|
||||
\ 'coc-java',
|
||||
\ 'coc-lists',
|
||||
\ 'coc-emmet',
|
||||
\ 'coc-tasks',
|
||||
\ 'coc-pairs',
|
||||
\ 'coc-tsserver',
|
||||
\ 'coc-floaterm',
|
||||
\ 'coc-fzf-preview',
|
||||
\ 'coc-html',
|
||||
\ 'coc-css',
|
||||
\ 'coc-cssmodules',
|
||||
\ 'coc-stylelintplus',
|
||||
\ 'coc-emoji',
|
||||
\ 'coc-bookmark',
|
||||
\ 'coc-yaml',
|
||||
\ 'coc-pyright',
|
||||
\ 'coc-explorer',
|
||||
\ 'coc-svg',
|
||||
\ 'coc-prettier',
|
||||
\ 'coc-vimlsp',
|
||||
\ 'coc-xml',
|
||||
\ 'coc-yank',
|
||||
\ 'coc-json',
|
||||
\ 'coc-marketplace',
|
||||
\ ]
|
||||
" \ 'coc-tabnine',
|
||||
" \ 'coc-highlight',
|
||||
|
||||
165
src/.config/nvim/src/coc.vim
Normal file
165
src/.config/nvim/src/coc.vim
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
||||
" position. Coc only does snippet and additional edit on confirm.
|
||||
if exists('*complete_info')
|
||||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
else
|
||||
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
endif
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
elseif (coc#rpc#ready())
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
execute '!' . &keywordprg . " " . expand('<cword>')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" set keywordprg=:call\ CocActionAsync('doHover')
|
||||
" augroup VimHelp
|
||||
" autocmd!
|
||||
" autocmd Filetype vim,help setlocal keywordprg=:help
|
||||
" augroup END
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
" nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder.
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Applying codeAction to the selected region.
|
||||
" Example: `<leader>aap` for current paragraph
|
||||
" xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
" nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap keys for applying codeAction to the current line.
|
||||
" nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Apply AutoFix to problem on the current line.
|
||||
" nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Introduce function text object
|
||||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||
" Note coc#float#scroll works on neovim >= 0.4.3 or vim >= 8.2.0750
|
||||
nnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
inoremap <nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
inoremap <nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
|
||||
" NeoVim-only mapping for visual mode scroll
|
||||
" Useful on signatureHelp after jump placeholder of snippet expansion
|
||||
if has('nvim')
|
||||
vnoremap <nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\<C-f>"
|
||||
vnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\<C-b>"
|
||||
endif
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add (Neo)Vim's native statusline support.
|
||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
" provide custom statusline: lightline.vim, vim-airline.
|
||||
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Mappings using CoCList:
|
||||
" Show all diagnostics.
|
||||
" TODO add these to which key
|
||||
" nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" " Manage extensions.
|
||||
" nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" " Show commands.
|
||||
" nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" " Find symbol of current document.
|
||||
" nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" " Search workspace symbols.
|
||||
" nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" " Do default action for next item.
|
||||
" nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" " Do default action for previous item.
|
||||
" nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" " Resume latest coc list.
|
||||
" nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
" Explorer
|
||||
let g:coc_explorer_global_presets = {
|
||||
\ 'floating': {
|
||||
\ 'position': 'floating',
|
||||
\ },
|
||||
\ 'floatingLeftside': {
|
||||
\ 'position': 'floating',
|
||||
\ 'floating-position': 'left-center',
|
||||
\ 'floating-width': 30,
|
||||
\ },
|
||||
\ 'floatingRightside': {
|
||||
\ 'position': 'floating',
|
||||
\ 'floating-position': 'right-center',
|
||||
\ 'floating-width': 30,
|
||||
\ },
|
||||
\ 'simplify': {
|
||||
\ 'file.child.template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]'
|
||||
\ }
|
||||
\ }
|
||||
"nmap <silent> <space>e :CocCommand explorer<CR>
|
||||
" nnoremap <silent> <leader>e :CocCommand explorer<CR>
|
||||
" nmap <space>f :CocCommand explorer --preset floatingRightside<CR>
|
||||
autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif
|
||||
|
||||
" Snippets
|
||||
" Use <C-l> for trigger snippet expand.
|
||||
imap <C-l> <Plug>(coc-snippets-expand)
|
||||
|
||||
" Use <C-j> for select text for visual placeholder of snippet.
|
||||
vmap <C-j> <Plug>(coc-snippets-select)
|
||||
|
||||
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
|
||||
let g:coc_snippet_next = '<c-j>'
|
||||
|
||||
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
|
||||
let g:coc_snippet_prev = '<c-k>'
|
||||
|
||||
" Use <C-j> for both expand and jump (make expand higher priority.)
|
||||
imap <C-j> <Plug>(coc-snippets-expand-jump)
|
||||
78
src/.config/nvim/src/fzf.vim
Normal file
78
src/.config/nvim/src/fzf.vim
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
" This is the default extra key bindings
|
||||
let g:fzf_action = {
|
||||
\ 'ctrl-t': 'tab split',
|
||||
\ 'ctrl-x': 'split',
|
||||
\ 'ctrl-v': 'vsplit' }
|
||||
|
||||
" Enable per-command history.
|
||||
" CTRL-N and CTRL-P will be automatically bound to next-history and
|
||||
" previous-history instead of down and up. If you don't like the change,
|
||||
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
|
||||
let g:fzf_history_dir = '~/.local/share/fzf-history'
|
||||
let g:fzf_buffers_jump = 1
|
||||
|
||||
" map <C-f> :Files<CR>
|
||||
" map <leader>b :Buffers<CR>
|
||||
" nnoremap <leader>g :Rg<CR>
|
||||
" nnoremap <leader>t :Tags<CR>
|
||||
" nnoremap <leader>m :Marks<CR>
|
||||
|
||||
|
||||
let g:fzf_tags_command = 'ctags -R'
|
||||
" Border color
|
||||
let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } }
|
||||
|
||||
let $FZF_DEFAULT_OPTS = '--layout=reverse --inline-info'
|
||||
let $FZF_DEFAULT_COMMAND="rg --files --hidden --glob '!.git/**'"
|
||||
"-g '!{node_modules,.git}'
|
||||
|
||||
" Customize fzf colors to match your color scheme
|
||||
let g:fzf_colors =
|
||||
\ { 'fg': ['fg', 'Normal'],
|
||||
\ 'bg': ['bg', 'Normal'],
|
||||
\ 'hl': ['fg', 'Comment'],
|
||||
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
||||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||
\ 'hl+': ['fg', 'Statement'],
|
||||
\ 'info': ['fg', 'PreProc'],
|
||||
\ 'border': ['fg', 'Ignore'],
|
||||
\ 'prompt': ['fg', 'Conditional'],
|
||||
\ 'pointer': ['fg', 'Exception'],
|
||||
\ 'marker': ['fg', 'Keyword'],
|
||||
\ 'spinner': ['fg', 'Label'],
|
||||
\ 'header': ['fg', 'Comment'] }
|
||||
|
||||
"Get Files
|
||||
command! -bang -nargs=? -complete=dir Files
|
||||
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--inline-info']}), <bang>0)
|
||||
|
||||
|
||||
" Get text in files with Rg
|
||||
" command! -bang -nargs=* Rg
|
||||
" \ call fzf#vim#grep(
|
||||
" \ "rg --column --line-number --no-heading --color=always --smart-case --glob '!.git/**' ".shellescape(<q-args>), 1,
|
||||
|
||||
" Make Ripgrep ONLY search file contents and not filenames
|
||||
command! -bang -nargs=* Rg
|
||||
\ call fzf#vim#grep(
|
||||
\ 'rg --column --line-number --hidden --smart-case --no-heading --color=always '.shellescape(<q-args>), 1,
|
||||
\ <bang>0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%')
|
||||
\ : fzf#vim#with_preview({'options': '--delimiter : --nth 4.. -e'}, 'right:50%', '?'),
|
||||
\ <bang>0)
|
||||
|
||||
" Ripgrep advanced
|
||||
function! RipgrepFzf(query, fullscreen)
|
||||
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
|
||||
let initial_command = printf(command_fmt, shellescape(a:query))
|
||||
let reload_command = printf(command_fmt, '{q}')
|
||||
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
|
||||
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
|
||||
endfunction
|
||||
|
||||
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
|
||||
|
||||
" Git grep
|
||||
command! -bang -nargs=* GGrep
|
||||
\ call fzf#vim#grep(
|
||||
\ 'git grep --line-number '.shellescape(<q-args>), 0,
|
||||
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
|
||||
|
|
@ -1,3 +1,11 @@
|
|||
[line_break]
|
||||
disabled = true
|
||||
|
||||
[character]
|
||||
success_symbol = "[\\$>](bold green)"
|
||||
error_symbol = "[\\$>](bold red)"
|
||||
vicmd_symbol = "[\\$<](bold blue)"
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
|
|
|
|||
25
src/.profile
Normal file
25
src/.profile
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
# include personal scripts/bin
|
||||
if [ -d "$HOME/scripts/bin" ] ; then
|
||||
PATH="$HOME/scripts/bin:$PATH"
|
||||
fi
|
||||
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
100
src/.vimrc
100
src/.vimrc
|
|
@ -1,110 +1,24 @@
|
|||
"GENERAL SETTINGS
|
||||
syntax on
|
||||
set number
|
||||
set autoread
|
||||
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
|
||||
set clipboard=unnamedplus
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set expandtab
|
||||
set updatetime=250
|
||||
set updatetime=25
|
||||
set title
|
||||
set belloff=all
|
||||
|
||||
"KEYBINDINGS
|
||||
nmap <S-Up> v<Up>
|
||||
nmap <S-Down> v<Down>
|
||||
nmap <S-Left> v<Left>
|
||||
nmap <S-Right> v<Right>
|
||||
vmap <S-Up> <Up>
|
||||
vmap <S-Down> <Down>
|
||||
vmap <S-Left> <Left>
|
||||
vmap <S-Right> <Right>
|
||||
imap <S-Up> <Esc>v<Up>
|
||||
imap <S-Down> <Esc>v<Down>
|
||||
imap <S-Left> <Esc>v<Left>
|
||||
imap <S-Right> <Esc>v<Right>
|
||||
vmap <C-c> y<Esc>i
|
||||
vmap <C-x> d<Esc>i
|
||||
map <C-v> pi
|
||||
map <S-End> v$
|
||||
nmap <S-j> 10j
|
||||
nmap <S-k> 10k
|
||||
imap <C-v> <Esc>pi
|
||||
map <C-z> <Esc>u
|
||||
map <C-y> <Esc><C-r>i
|
||||
map <C-a> ggVG
|
||||
map <C-c> "+y
|
||||
imap <silent><C-s> <Esc>:w<CR>
|
||||
map <silent><C-s> <Esc>:w<CR>
|
||||
map <silent><C-w> <C-C>:bd<CR>
|
||||
map <silent><C-q> <C-C>:q!<CR>
|
||||
map <silent><C-O> <Esc>:tabnew#<CR>
|
||||
map <silent><C-R> <Esc>:source ~/.vimrc<CR>
|
||||
|
||||
|
||||
" VUNDLE PLUGINS
|
||||
set number relativenumber
|
||||
augroup numbertoggle
|
||||
autocmd!
|
||||
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
||||
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
||||
augroup END
|
||||
set nocompatible
|
||||
filetype off
|
||||
set rtp+=~/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
Plugin 'morhetz/gruvbox'
|
||||
Plugin 'dracula/vim',{'name':'dracula'}
|
||||
Plugin 'rakr/vim-one'
|
||||
Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline/vim-airline-themes'
|
||||
Plugin 'airblade/vim-gitgutter'
|
||||
Plugin 'preservim/nerdtree'
|
||||
Plugin 'dense-analysis/ale'
|
||||
Plugin 'tpope/vim-surround'
|
||||
Plugin 'jiangmiao/auto-pairs'
|
||||
Plugin 'ycm-core/YouCompleteMe'
|
||||
" Plugin 'Chiel92/vim-autoformat' -----> sudo apt-get install astyle (for cpp)
|
||||
call vundle#end()
|
||||
|
||||
|
||||
" PLUGIN PREFERENCES
|
||||
let g:airline_powerline_fonts = 1
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
let g:airline_left_sep = '»'
|
||||
let g:airline_left_sep = '▶'
|
||||
let g:airline_right_sep = '«'
|
||||
let g:airline_right_sep = '◀'
|
||||
let g:airline_symbols.linenr = '¶'
|
||||
let g:airline_symbols.branch = '⎇'
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
let g:airline_symbols.paste = '∥'
|
||||
let g:airline_symbols.whitespace = 'Ξ'
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = 'L'
|
||||
filetype plugin indent on
|
||||
let g:NERDTreeWinPos = "right"
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
nmap <C-e> :NERDTreeToggle<CR>
|
||||
let NERDTreeShowHidden=1
|
||||
|
||||
|
||||
" THEMING
|
||||
set termguicolors
|
||||
colorscheme dracula
|
||||
set background=dark
|
||||
hi Normal guibg=NONE ctermbg=NONE
|
||||
|
||||
|
||||
" CHANGE CURSOR SHAPE BASED ON MODE
|
||||
" (Only works on VTE-based terminal)
|
||||
let &t_SI = "\<Esc>[6 q"
|
||||
let &t_SR = "\<Esc>[4 q"
|
||||
let &t_EI = "\<Esc>[2 q"
|
||||
|
|
|
|||
13
src/.xprofile
Executable file
13
src/.xprofile
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Run at startup
|
||||
# This file is sourced by Xresources (GDM, LightDM, all source this)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# Make the keyboard movements faster
|
||||
xset r rate 340 50
|
||||
|
||||
# Touchpad necessities
|
||||
xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Natural Scrolling Enabled" 1
|
||||
xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Tapping Enabled" 1
|
||||
|
||||
1
src/.zprofile
Symbolic link
1
src/.zprofile
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
.profile
|
||||
26
src/.zshrc
26
src/.zshrc
|
|
@ -78,7 +78,7 @@ ex ()
|
|||
*.7z) 7z x $1 ;;
|
||||
*.deb) ar x $1 ;;
|
||||
*.tar.xz) tar xf $1 ;;
|
||||
*.tar.zst) unzstd $1 ;;
|
||||
*.tar.zst) unzstd $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
|
|
@ -87,7 +87,7 @@ ex ()
|
|||
}
|
||||
|
||||
|
||||
### ALIASES ###
|
||||
### ALIASES ###
|
||||
# =========== #
|
||||
# switch between shells
|
||||
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||
|
|
@ -95,7 +95,7 @@ alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
|||
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
alias .4='cd ../../../..'
|
||||
|
|
@ -112,15 +112,19 @@ alias mv='mv -i'
|
|||
alias rm='rm -i'
|
||||
alias np='nano -w PKGBUILD'
|
||||
alias more=less
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# Colorize ls output
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -alF --color=auto'
|
||||
alias la='ls -A --color=auto'
|
||||
alias l='ls -CF --color=auto'
|
||||
|
||||
# adding flags
|
||||
alias df='df -h' # human-readable sizes
|
||||
alias free='free -m' # show sizes in MB
|
||||
alias lynx='lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss -vikeys'
|
||||
alias vifm='./.config/vifm/scripts/vifmrun'
|
||||
|
||||
# programs
|
||||
alias nv=nvim
|
||||
|
||||
## get top process eating memory
|
||||
alias psmem='ps auxf | sort -nr -k 4'
|
||||
|
|
@ -150,12 +154,12 @@ ZSH_AUTOSUGGEST_STRATEGY=(history completion match_prev_cmd)
|
|||
# (MUST be at the end of file)
|
||||
# Install using makefile at ~/.config/zsh... Ditch package managers
|
||||
plugins () {
|
||||
source ~/.config/zsh/keybindings.zsh
|
||||
source ~/.config/zsh/keybindings.zsh
|
||||
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source ~/.config/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
source ~/.config/zsh/plugins/zsh-completions/zsh-completions.plugin.zsh # Better tab-completion
|
||||
}
|
||||
plugins || make -i -C ~/.config/zsh
|
||||
|
||||
export NVM_DIR="/home/purhan/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
|
|
|
|||
|
|
@ -15,15 +15,14 @@ apt = firefox \
|
|||
gnome-tweaks \
|
||||
htop \
|
||||
vim \
|
||||
neovim \
|
||||
awesome \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
fonts-powerline \
|
||||
npm \
|
||||
nodejs \
|
||||
kitty \
|
||||
zsh \
|
||||
fish \
|
||||
stow \
|
||||
arandr
|
||||
|
||||
|
|
@ -52,7 +51,7 @@ essentials:
|
|||
# ================================= #
|
||||
sudo apt install \
|
||||
git \
|
||||
curl \
|
||||
curl
|
||||
|
||||
others:
|
||||
### SETTING UP SHELLS ###
|
||||
|
|
|
|||
321
src/scripts/bin/launcher
Executable file
321
src/scripts/bin/launcher
Executable file
|
|
@ -0,0 +1,321 @@
|
|||
#!/usr/bin/env bash
|
||||
# terminal application launcher for sway, using fzf
|
||||
# Based on: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher
|
||||
# https://gist.github.com/Biont/40ef59652acf3673520c7a03c9f22d2a
|
||||
shopt -s nullglob globstar
|
||||
set -o pipefail
|
||||
if ! { exec 0>&3; } 1>/dev/null 2>&1; then
|
||||
exec 3>/dev/null # If file descriptor 3 is unused in parent shell, output to /dev/null
|
||||
fi
|
||||
# shellcheck disable=SC2154
|
||||
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
|
||||
IFS=$'\n\t'
|
||||
DEL=$'\34'
|
||||
|
||||
TERMINAL_COMMAND="${TERMINAL_COMMAND:="$TERM -e"}"
|
||||
GLYPH_COMMAND="${GLYPH_COMMAND- }"
|
||||
GLYPH_DESKTOP="${GLYPH_DESKTOP- }"
|
||||
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/sway-launcher-desktop"
|
||||
PROVIDERS_FILE="${PROVIDERS_FILE:=providers.conf}"
|
||||
if [[ "${PROVIDERS_FILE#/}" == "${PROVIDERS_FILE}" ]]; then
|
||||
# $PROVIDERS_FILE is a relative path, prepend $CONFIG_DIR
|
||||
PROVIDERS_FILE="${CONFIG_DIR}/${PROVIDERS_FILE}"
|
||||
fi
|
||||
|
||||
# Provider config entries are separated by the field separator \034 and have the following structure:
|
||||
# list_cmd,preview_cmd,launch_cmd
|
||||
declare -A PROVIDERS
|
||||
if [ -f "${PROVIDERS_FILE}" ]; then
|
||||
eval "$(awk -F= '
|
||||
BEGINFILE{ provider=""; }
|
||||
/^\[.*\]/{sub("^\\[", "");sub("\\]$", "");provider=$0}
|
||||
/^(launch|list|preview)_cmd/{st = index($0,"=");providers[provider][$1] = substr($0,st+1)}
|
||||
ENDFILE{
|
||||
for (key in providers){
|
||||
if(!("list_cmd" in providers[key])){continue;}
|
||||
if(!("launch_cmd" in providers[key])){continue;}
|
||||
if(!("preview_cmd" in providers[key])){continue;}
|
||||
for (entry in providers[key]){
|
||||
gsub(/[\x27,\047]/,"\x27\"\x27\"\x27", providers[key][entry])
|
||||
}
|
||||
print "PROVIDERS[\x27" key "\x27]=\x27" providers[key]["list_cmd"] "\034" providers[key]["preview_cmd"] "\034" providers[key]["launch_cmd"] "\x27\n"
|
||||
}
|
||||
}' "${PROVIDERS_FILE}")"
|
||||
if [[ ! -v HIST_FILE ]]; then
|
||||
HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-${PROVIDERS_FILE##*/}-history.txt"
|
||||
fi
|
||||
else
|
||||
PROVIDERS['desktop']="${0} list-entries${DEL}${0} describe-desktop \"{1}\"${DEL}${0} run-desktop '{1}' {2}"
|
||||
PROVIDERS['command']="${0} list-commands${DEL}${0} describe-command \"{1}\"${DEL}${TERMINAL_COMMAND} {1}"
|
||||
if [[ ! -v HIST_FILE ]]; then
|
||||
HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-history.txt"
|
||||
fi
|
||||
fi
|
||||
PROVIDERS['user']="exit${DEL}exit${DEL}{1}" # Fallback provider that simply executes the exact command if there were no matches
|
||||
|
||||
if [[ -n "${HIST_FILE}" ]]; then
|
||||
mkdir -p "${HIST_FILE%/*}" && touch "$HIST_FILE"
|
||||
readarray HIST_LINES <"$HIST_FILE"
|
||||
fi
|
||||
|
||||
function describe() {
|
||||
# shellcheck disable=SC2086
|
||||
readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${1}]}
|
||||
# shellcheck disable=SC2086
|
||||
[ -n "${PROVIDER_ARGS[1]}" ] && eval "${PROVIDER_ARGS[1]//\{1\}/${2}}"
|
||||
}
|
||||
function describe-desktop() {
|
||||
description=$(sed -ne '/^Comment=/{s/^Comment=//;p;q}' "$1")
|
||||
echo -e "\033[33m$(sed -ne '/^Name=/{s/^Name=//;p;q}' "$1")\033[0m"
|
||||
echo "${description:-No description}"
|
||||
}
|
||||
function describe-command() {
|
||||
readarray arr < <(whatis -l "$1" 2>/dev/null)
|
||||
description="${arr[0]}"
|
||||
description="${description#* - }"
|
||||
echo -e "\033[33m${1}\033[0m"
|
||||
echo "${description:-No description}"
|
||||
}
|
||||
|
||||
function provide() {
|
||||
# shellcheck disable=SC2086
|
||||
readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[$1]}
|
||||
eval "${PROVIDER_ARGS[0]}"
|
||||
}
|
||||
function list-commands() {
|
||||
IFS=: read -ra path <<<"$PATH"
|
||||
for dir in "${path[@]}"; do
|
||||
printf '%s\n' "$dir/"* |
|
||||
awk -F / -v pre="$GLYPH_COMMAND" '{print $NF "\034command\034\033[31m" pre "\033[0m" $NF;}'
|
||||
done | sort -u
|
||||
}
|
||||
function list-entries() {
|
||||
# Get locations of desktop application folders according to spec
|
||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
IFS=':' read -ra DIRS <<<"${XDG_DATA_HOME-${HOME}/.local/share}:${XDG_DATA_DIRS-/usr/local/share:/usr/share}"
|
||||
for i in "${!DIRS[@]}"; do
|
||||
if [[ ! -d "${DIRS[i]}" ]]; then
|
||||
unset -v 'DIRS[$i]'
|
||||
else
|
||||
DIRS[$i]="${DIRS[i]}/applications/**/*.desktop"
|
||||
fi
|
||||
done
|
||||
# shellcheck disable=SC2068
|
||||
entries ${DIRS[@]}
|
||||
}
|
||||
function entries() {
|
||||
# shellcheck disable=SC2068
|
||||
awk -v pre="$GLYPH_DESKTOP" -F= '
|
||||
function desktopFileID(filename){
|
||||
sub("^.*applications/", "", filename);
|
||||
sub("/", "-", filename);
|
||||
return filename
|
||||
}
|
||||
BEGINFILE{
|
||||
application=0;
|
||||
block="";
|
||||
a=0
|
||||
|
||||
id=desktopFileID(FILENAME)
|
||||
if(id in fileIds){
|
||||
nextfile;
|
||||
}else{
|
||||
fileIds[id]=0
|
||||
}
|
||||
}
|
||||
/^\[Desktop Entry\]/{block="entry"}
|
||||
/^Type=Application/{application=1}
|
||||
/^\[Desktop Action/{
|
||||
sub("^\\[Desktop Action ", "");
|
||||
sub("\\]$", "");
|
||||
block="action";
|
||||
a++;
|
||||
actions[a,"key"]=$0
|
||||
}
|
||||
/^\[X-/{
|
||||
sub("^\\[X-", "");
|
||||
sub("\\]$", "");
|
||||
block="action";
|
||||
a++;
|
||||
actions[a,"key"]=$0
|
||||
}
|
||||
/^Name=/{ (block=="action")? actions[a,"name"]=$2 : name=$2 }
|
||||
ENDFILE{
|
||||
if (application){
|
||||
print FILENAME "\034desktop\034\033[33m" pre name "\033[0m";
|
||||
if (a>0)
|
||||
for (i=1; i<=a; i++)
|
||||
print FILENAME "\034desktop\034\033[33m" pre name "\033[0m (" actions[i, "name"] ")\034" actions[i, "key"]
|
||||
}
|
||||
}' \
|
||||
$@ </dev/null
|
||||
# the empty stdin is needed in case no *.desktop files
|
||||
}
|
||||
function run-desktop() {
|
||||
CMD="$("${0}" generate-command "$@" 2>&3)"
|
||||
echo "Generated Launch command from .desktop file: ${CMD}" >&3
|
||||
bash -c "${CMD}"
|
||||
}
|
||||
function generate-command() {
|
||||
# Define the search pattern that specifies the block to search for within the .desktop file
|
||||
PATTERN="^\\\\[Desktop Entry\\\\]"
|
||||
if [[ -n $2 ]]; then
|
||||
PATTERN="^\\\\[Desktop Action ${2}\\\\]"
|
||||
fi
|
||||
echo "Searching for pattern: ${PATTERN}" >&3
|
||||
# 1. We see a line starting [Desktop, but we're already searching: deactivate search again
|
||||
# 2. We see the specified pattern: start search
|
||||
# 3. We see an Exec= line during search: remove field codes and set variable
|
||||
# 3. We see a Path= line during search: set variable
|
||||
# 4. Finally, build command line
|
||||
awk -v pattern="${PATTERN}" -v terminal_cmd="${TERMINAL_COMMAND}" -F= '
|
||||
BEGIN{a=0;exec=0;path=0}
|
||||
/^\[Desktop/{
|
||||
if(a){ a=0 }
|
||||
}
|
||||
$0 ~ pattern{ a=1 }
|
||||
/^Terminal=/{
|
||||
sub("^Terminal=", "");
|
||||
if ($0 == "true") { terminal=1 }
|
||||
}
|
||||
/^Exec=/{
|
||||
if(a && !exec){
|
||||
sub("^Exec=", "");
|
||||
gsub(" ?%[cDdFfikmNnUuv]", "");
|
||||
exec=$0;
|
||||
}
|
||||
}
|
||||
/^Path=/{
|
||||
if(a && !path){ path=$2 }
|
||||
}
|
||||
END{
|
||||
if(path){ printf "cd " path " && " }
|
||||
if (terminal){ printf terminal_cmd " " }
|
||||
print exec
|
||||
}' "$1"
|
||||
}
|
||||
|
||||
function autostart() {
|
||||
for application in $(list-autostart); do
|
||||
(exec setsid /bin/sh -c "$(run-desktop "${application}")" &>/dev/null &)
|
||||
done
|
||||
}
|
||||
|
||||
function list-autostart() {
|
||||
# Get locations of desktop application folders according to spec
|
||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
IFS=':' read -ra DIRS <<<"${XDG_CONFIG_HOME-${HOME}/.config}:${XDG_CONFIG_DIRS-/etc/xdg}"
|
||||
for i in "${!DIRS[@]}"; do
|
||||
if [[ ! -d "${DIRS[i]}" ]]; then
|
||||
unset -v 'DIRS[$i]'
|
||||
else
|
||||
DIRS[$i]="${DIRS[i]}/autostart/*.desktop"
|
||||
fi
|
||||
done
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
awk -v pre="$GLYPH_DESKTOP" -F= '
|
||||
function desktopFileID(filename){
|
||||
sub("^.*autostart/", "", filename);
|
||||
sub("/", "-", filename);
|
||||
return filename
|
||||
}
|
||||
BEGINFILE{
|
||||
application=0;
|
||||
block="";
|
||||
a=0
|
||||
|
||||
id=desktopFileID(FILENAME)
|
||||
if(id in fileIds){
|
||||
nextfile;
|
||||
}else{
|
||||
fileIds[id]=0
|
||||
}
|
||||
}
|
||||
/^\[Desktop Entry\]/{block="entry"}
|
||||
/^Type=Application/{application=1}
|
||||
/^Name=/{ iname=$2 }
|
||||
ENDFILE{
|
||||
if (application){
|
||||
print FILENAME;
|
||||
}
|
||||
}' \
|
||||
${DIRS[@]} </dev/null
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
describe | describe-desktop | describe-command | entries | list-entries | list-commands | list-autostart | generate-command | autostart | run-desktop | provide)
|
||||
"$@"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
echo "Starting launcher instance with the following providers:" "${!PROVIDERS[@]}" >&3
|
||||
|
||||
FZFPIPE=$(mktemp -u)
|
||||
mkfifo "$FZFPIPE"
|
||||
trap 'rm "$FZFPIPE"' EXIT INT
|
||||
|
||||
# Append Launcher History, removing usage count
|
||||
(printf '%s' "${HIST_LINES[@]#* }" >>"$FZFPIPE") &
|
||||
|
||||
# Iterate over providers and run their list-command
|
||||
for PROVIDER_NAME in "${!PROVIDERS[@]}"; do
|
||||
(bash -c "${0} provide ${PROVIDER_NAME}" >>"$FZFPIPE") &
|
||||
done
|
||||
|
||||
readarray -t COMMAND_STR <<<$(
|
||||
fzf --ansi +s -x -d '\034' --nth ..3 --with-nth 3 \
|
||||
--print-query \
|
||||
--preview "$0 describe {2} {1}" \
|
||||
--preview-window=up:2:noborder \
|
||||
--no-multi --cycle \
|
||||
--prompt="${GLYPH_PROMPT-# }" \
|
||||
--header='' --no-info --margin='1,2' \
|
||||
--color='16,gutter:-1' \
|
||||
<"$FZFPIPE"
|
||||
) || exit 1
|
||||
# Get the last line of the fzf output. If there were no matches, it contains the query which we'll treat as a custom command
|
||||
# If there were matches, it contains the selected item
|
||||
COMMAND_STR=$(printf '%s\n' "${COMMAND_STR[@]: -1}")
|
||||
# We still need to format the query to conform to our fallback provider.
|
||||
# We check for the presence of field separator character to determine if we're dealing with a custom command
|
||||
if [[ $COMMAND_STR != *$'\034'* ]]; then
|
||||
COMMAND_STR="${COMMAND_STR}"$'\034user\034'"${COMMAND_STR}"$'\034'
|
||||
SKIP_HIST=1 # I chose not to include custom commands in the history. If this is a bad idea, open an issue please
|
||||
fi
|
||||
|
||||
[ -z "$COMMAND_STR" ] && exit 1
|
||||
|
||||
if [[ -n "${HIST_FILE}" && ! "$SKIP_HIST" ]]; then
|
||||
# update history
|
||||
for i in "${!HIST_LINES[@]}"; do
|
||||
if [[ "${HIST_LINES[i]}" == *" $COMMAND_STR"$'\n' ]]; then
|
||||
HIST_COUNT=${HIST_LINES[i]%% *}
|
||||
HIST_LINES[$i]="$((HIST_COUNT + 1)) $COMMAND_STR"$'\n'
|
||||
match=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if ! ((match)); then
|
||||
HIST_LINES+=("1 $COMMAND_STR"$'\n')
|
||||
fi
|
||||
|
||||
printf '%s' "${HIST_LINES[@]}" | sort -nr >"$HIST_FILE"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
readarray -d $'\034' -t PARAMS <<<${COMMAND_STR}
|
||||
# shellcheck disable=SC2086
|
||||
readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${PARAMS[1]}]}
|
||||
# Substitute {1}, {2} etc with the correct values
|
||||
COMMAND=${PROVIDER_ARGS[2]//\{1\}/${PARAMS[0]}}
|
||||
COMMAND=${COMMAND//\{2\}/${PARAMS[3]}}
|
||||
COMMAND=${COMMAND%%[[:space:]]}
|
||||
|
||||
if [ -t 1 ]; then
|
||||
echo "Launching command: ${COMMAND}" >&3
|
||||
setsid /bin/sh -c "${COMMAND}" >&/dev/null </dev/null &
|
||||
sleep 0.01
|
||||
else
|
||||
echo "${COMMAND}"
|
||||
fi
|
||||
23
src/scripts/bin/weather
Executable file
23
src/scripts/bin/weather
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ $1 == "" ]]
|
||||
then
|
||||
curl "http://wttr.in?0Q"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
case $i in
|
||||
--all)
|
||||
curl "http://wttr.in"
|
||||
;;
|
||||
-a)
|
||||
curl "http://wttr.in"
|
||||
;;
|
||||
*)
|
||||
curl "http://wttr.in/$i"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue