├── src
├── .zprofile
├── .bash_profile
├── .config
│ ├── zsh
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── keybindings.zsh
│ ├── sublime-text-3
│ │ └── Packages
│ │ │ └── User
│ │ │ ├── Package Control.user-ca-bundle
│ │ │ ├── Terminus.sublime-settings
│ │ │ ├── SublimeAStyleFormatter.sublime-settings
│ │ │ ├── C++.sublime-settings
│ │ │ ├── Origami.sublime-settings
│ │ │ ├── cpp.sublime-snippet
│ │ │ ├── Preferences.sublime-settings
│ │ │ ├── Default (Linux).sublime-keymap
│ │ │ ├── Package Control.sublime-settings
│ │ │ ├── CP-build-no-timeout.sublime-build
│ │ │ ├── CP-build-system.sublime-build
│ │ │ ├── CP-build-system-alt.sublime-build
│ │ │ ├── Terminus
│ │ │ └── Terminus.hidden-color-scheme
│ │ │ └── template.sublime-snippet
│ ├── awesome
│ │ ├── configuration
│ │ │ ├── client
│ │ │ │ ├── init.lua
│ │ │ │ ├── buttons.lua
│ │ │ │ ├── keys.lua
│ │ │ │ └── rules.lua
│ │ │ ├── keys
│ │ │ │ ├── mod.lua
│ │ │ │ ├── init.lua
│ │ │ │ └── global.lua
│ │ │ ├── init.lua
│ │ │ ├── utils
│ │ │ │ ├── screenshot
│ │ │ │ ├── rofi-power
│ │ │ │ └── autostart
│ │ │ ├── tags.lua
│ │ │ └── apps.lua
│ │ ├── widget
│ │ │ ├── clock.lua
│ │ │ ├── storage.lua
│ │ │ ├── temprature.lua
│ │ │ ├── material
│ │ │ │ ├── icon-button.lua
│ │ │ │ ├── clickable-container.lua
│ │ │ │ ├── icon.lua
│ │ │ │ ├── markup.lua
│ │ │ │ ├── separator.lua
│ │ │ │ ├── slider.lua
│ │ │ │ └── list-item.lua
│ │ │ ├── memory.lua
│ │ │ ├── cpu.lua
│ │ │ ├── volume.lua
│ │ │ ├── battery.lua
│ │ │ ├── tag-list.lua
│ │ │ ├── task-list.lua
│ │ │ └── net.lua
│ │ ├── theme
│ │ │ ├── init.lua
│ │ │ ├── color-schemes.lua
│ │ │ └── theme.lua
│ │ ├── module
│ │ │ ├── auto-start.lua
│ │ │ ├── notifications.lua
│ │ │ ├── splash-terminal.lua
│ │ │ ├── decorate-client.lua
│ │ │ └── smart-borders.lua
│ │ ├── layout
│ │ │ ├── bottom-bar.lua
│ │ │ ├── init.lua
│ │ │ └── top-bar.lua
│ │ └── rc.lua
│ ├── nvim
│ │ ├── .gitignore
│ │ ├── src
│ │ │ ├── coc-extensions.vim
│ │ │ ├── fzf.vim
│ │ │ └── coc.vim
│ │ ├── coc-settings.json
│ │ └── init.vim
│ ├── kitty
│ │ ├── kitty.conf
│ │ ├── diff.conf
│ │ ├── gruvbox-material.conf
│ │ ├── gruvbox.conf
│ │ └── dracula.conf
│ ├── starship.toml
│ ├── compton.conf
│ └── rofi
│ │ └── config.rasi
├── scripts
│ ├── monitor_setups
│ │ ├── monitor_only
│ │ ├── laptop_left_primary_monitor_right
│ │ └── primary_laptop_left_monitor_right
│ ├── bin
│ │ ├── weather
│ │ └── launcher
│ ├── Makefile
│ └── misc
│ │ └── vampire.sh
├── .vimrc
├── .profile
├── .xprofile
├── .gitconfig
├── .bashrc
└── .zshrc
├── .gitignore
├── README.md
└── LICENSE
/src/.zprofile:
--------------------------------------------------------------------------------
1 | .profile
--------------------------------------------------------------------------------
/src/.bash_profile:
--------------------------------------------------------------------------------
1 | .profile
--------------------------------------------------------------------------------
/src/.config/zsh/.gitignore:
--------------------------------------------------------------------------------
1 | plugins
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | src/config/zsh/packages
2 | *.swp
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Package Control.user-ca-bundle:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/client/init.lua:
--------------------------------------------------------------------------------
1 | require('configuration.client.rules')
2 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Terminus.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | "theme": "3024-day"
3 | }
4 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/keys/mod.lua:
--------------------------------------------------------------------------------
1 | return {
2 | modKey = 'Mod4',
3 | altKey = 'Mod1'
4 | }
--------------------------------------------------------------------------------
/src/.config/nvim/.gitignore:
--------------------------------------------------------------------------------
1 | .netrwhist
2 | spell/
3 | plugged/
4 | *.swp
5 | temp/
6 | autoload/
7 | session/
8 |
9 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/SublimeAStyleFormatter.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | "autoformat_on_save": "true",
3 | }
4 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/init.lua:
--------------------------------------------------------------------------------
1 | return {
2 | keys = require('configuration.keys'),
3 | apps = require('configuration.apps')
4 | }
5 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/C++.sublime-settings:
--------------------------------------------------------------------------------
1 | // These settings override both User and Default settings for the C++ syntax
2 | {
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/keys/init.lua:
--------------------------------------------------------------------------------
1 | return {
2 | mod = require('configuration.keys.mod'),
3 | global = require('configuration.keys.global')
4 | }
5 |
--------------------------------------------------------------------------------
/src/scripts/monitor_setups/monitor_only:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | xrandr --output eDP1 --off --output HDMI1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off
3 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Origami.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | // Create a new pane when switching in a direction without one
3 | "create_new_pane_if_necessary": false
4 | }
5 |
--------------------------------------------------------------------------------
/src/scripts/monitor_setups/laptop_left_primary_monitor_right:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | xrandr --output eDP1 --mode 1366x768 --pos 0x0 --rotate normal --output HDMI1 --primary --mode 1920x1080 --pos 1366x0 --rotate normal --output VIRTUAL1 --off
3 |
--------------------------------------------------------------------------------
/src/scripts/monitor_setups/primary_laptop_left_monitor_right:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | xrandr --output eDP1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output HDMI1 --mode 1920x1080 --pos 1366x0 --rotate normal --output VIRTUAL1 --off
3 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/clock.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local beautiful = require('beautiful')
3 |
4 | local clock = wibox.widget.textclock('%d/%m %a %H:%M')
5 | return clock
6 |
--------------------------------------------------------------------------------
/src/.config/awesome/theme/init.lua:
--------------------------------------------------------------------------------
1 | local gtable = require('gears.table')
2 | local theme = require('theme.theme')
3 |
4 | local final_theme = {}
5 | gtable.crush(final_theme, theme.theme)
6 | gtable.crush(final_theme, theme.theme)
7 | theme.awesome_overrides(final_theme)
8 | theme.awesome_overrides(final_theme)
9 |
10 | return final_theme
11 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/cpp.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
4 | using namespace std;
5 |
6 | int main() {
7 |
8 |
9 | return 0;
10 | }
11 | ]]>
12 |
13 | cpp
14 |
15 |
--------------------------------------------------------------------------------
/src/.config/kitty/kitty.conf:
--------------------------------------------------------------------------------
1 | include gruvbox-material.conf
2 |
3 | background_opacity 0.9
4 | font_family FiraCode Nerd Font Mono
5 | bold_font auto
6 | italic_font auto
7 | bold_italic_font auto
8 | window_padding_width 1
9 | font_size 12
10 | disable_ligatures always
11 | enable_audio_bell no
12 |
--------------------------------------------------------------------------------
/src/scripts/bin/weather:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if [[ $1 == "" ]]
4 | then
5 | curl "http://wttr.in?0Q"
6 | exit 0
7 | fi
8 |
9 | for i in "$@"
10 | do
11 | case $i in
12 | --all)
13 | curl "http://wttr.in"
14 | ;;
15 | -a)
16 | curl "http://wttr.in"
17 | ;;
18 | *)
19 | curl "http://wttr.in/$i"
20 | ;;
21 | esac
22 | done
23 |
24 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/storage.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local watch = require('awful.widget.watch')
3 | local beautiful = require('beautiful')
4 |
5 | local storage = wibox.widget.textbox()
6 | storage.font = beautiful.font
7 |
8 | watch('bash -c "df -h $HOME | awk \'/[0-9]/ {print $2-$3}\'"', 30, function(_, stdout)
9 | storage.text = stdout
10 | end)
11 |
12 | return storage
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to ~/
2 | Welcome, these are my personal configuration dotfiles for pretty much everything I use on my system.
3 |
4 | 
5 |
6 | # Setup Instructions
7 |
8 | Please head over to the [old](https://github.com/Purhan/dotfiles/tree/old) branch for setup
9 | instructions.
10 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/temprature.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local watch = require('awful.widget.watch')
3 | local beautiful = require('beautiful')
4 |
5 | local temprature = wibox.widget.textbox()
6 | temprature.font = beautiful.font
7 |
8 | watch('bash -c "sensors | awk \'/Core 0/ {print substr($3, 2) }\'"', 30, function(_, stdout)
9 | temprature.text = stdout
10 | end)
11 |
12 | return temprature
13 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/icon-button.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local gears = require('gears')
3 | local clickable_container = require('widget.material.clickable-container')
4 | local dpi = require('beautiful').xresources.apply_dpi
5 |
6 | function build(imagebox, args)
7 | return wibox.widget {
8 | imagebox,
9 | shape = gears.shape.circle,
10 | widget = clickable_container
11 | }
12 | end
13 |
14 | return build
15 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/utils/screenshot:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | if [ $1 == "--delayed" ]; then
3 | spectacle -b -n ${@:2} -o /tmp/screenshot.png ; xclip -selection clipboard -target image/png -i /tmp/screenshot.png ; paplay /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
4 | else
5 | spectacle -b -n $@ -o /tmp/screenshot.png ; xclip -selection clipboard -target image/png -i /tmp/screenshot.png ; paplay /usr/share/sounds/freedesktop/stereo/camera-shutter.oga
6 | fi
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Preferences.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | "color_scheme": "Packages/Color Scheme - Eazy Light/Eazy Light.tmTheme",
3 | "file_exclude_patterns":
4 | [
5 | "*.o"
6 | ],
7 | "font_face": "Consolas Regular",
8 | "font_size": 10,
9 | "ignored_packages":
10 | [
11 | "Vintage"
12 | ],
13 | "line_padding_bottom": 1,
14 | "line_padding_top": 1,
15 | "theme": "Adaptive.sublime-theme",
16 | "translate_tabs_to_spaces": true,
17 | "word_wrap": "true"
18 | }
19 |
--------------------------------------------------------------------------------
/src/.vimrc:
--------------------------------------------------------------------------------
1 | "GENERAL SETTINGS
2 | syntax on
3 | set autoread
4 | set clipboard=unnamedplus
5 | set tabstop=4
6 | set shiftwidth=4
7 | set softtabstop=4
8 | set expandtab
9 | set updatetime=25
10 | set title
11 | set belloff=all
12 | set number relativenumber
13 | augroup numbertoggle
14 | autocmd!
15 | autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
16 | autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
17 | augroup END
18 | set nocompatible
19 | filetype off
20 |
21 |
--------------------------------------------------------------------------------
/src/.config/zsh/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: all
2 | all: autosuggestions syntax-highlighting tab-completions z-jump
3 |
4 | autosuggestions:
5 | git clone https://github.com/zsh-users/zsh-autosuggestions ~/.config/zsh/plugins/zsh-autosuggestions
6 |
7 | syntax-highlighting:
8 | git clone https://github.com/zdharma/fast-syntax-highlighting ~/.config/zsh/plugins/fast-syntax-highlighting
9 |
10 | tab-completions:
11 | git clone https://github.com/zsh-users/zsh-completions ~/.config/zsh/plugins/zsh-completions
12 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/client/buttons.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 |
3 | local modkey = require('configuration.keys.mod').modKey
4 |
5 | return awful.util.table.join(awful.button({}, 1, function(c)
6 | _G.client.focus = c
7 | c:raise()
8 | end), awful.button({modkey}, 1, awful.mouse.client.move), awful.button({modkey}, 3, awful.mouse.client.resize),
9 | awful.button({modkey}, 4, function()
10 | awful.layout.inc(1)
11 | end), awful.button({modkey}, 5, function()
12 | awful.layout.inc(-1)
13 | end))
14 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap:
--------------------------------------------------------------------------------
1 | [
2 | { "keys": ["ctrl+e"], "command": "toggle_side_bar" },
3 | {
4 | "keys": ["ctrl+b"],
5 | "command": "chain",
6 | "args": {
7 | "commands": [
8 | ["focus_group",{"group":0}],
9 | ["terminus_close_all"],
10 | ["build"],
11 | ["focus_group",{"group":0}],
12 | ]
13 | }
14 | },
15 | { "keys": ["ctrl+t"],
16 | "command": "terminus_open",
17 | "args" : {
18 | "cwd": "${file_path:${folder}}"
19 | }
20 | },
21 | ]
22 |
--------------------------------------------------------------------------------
/src/.config/kitty/diff.conf:
--------------------------------------------------------------------------------
1 | foreground #f8f8f2
2 | background #282a36
3 | title_fg #f8f8f2
4 | title_bg #282a36
5 | margin_bg #6272a4
6 | margin_fg #44475a
7 | removed_bg #ff5555
8 | highlight_removed_bg #ff5555
9 | removed_margin_bg #ff5555
10 | added_bg #50fa7b
11 | highlight_added_bg #50fa7b
12 | added_margin_bg #50fa7b
13 | filler_bg #44475a
14 | hunk_margin_bg #44475a
15 | hunk_bg #bd93f9
16 | search_bg #8be9fd
17 | search_fg #282a36
18 | select_bg #f1fa8c
19 | select_fg #282a36
20 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Package Control.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | "bootstrapped": true,
3 | "in_process_packages":
4 | [
5 | ],
6 | "installed_packages":
7 | [
8 | "1337 Color Scheme",
9 | "BracketGuard",
10 | "BracketHighlighter",
11 | "Chain of Command",
12 | "Color Scheme - Eazy Light",
13 | "Dracula Color Scheme",
14 | "molokai",
15 | "Monokai - Spacegray",
16 | "Monokai Gray",
17 | "Monokai++",
18 | "Notepad++ Color Scheme",
19 | "Origami",
20 | "Package Control",
21 | "SublimeAStyleFormatter",
22 | "SublimeLinter",
23 | "SublimeLinter-clang",
24 | "SublimeLinter-gcc",
25 | "Terminus"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/src/.profile:
--------------------------------------------------------------------------------
1 | # if running bash
2 | if [ -n "$BASH_VERSION" ]; then
3 | # include .bashrc if it exists
4 | if [ -f "$HOME/.bashrc" ]; then
5 | . "$HOME/.bashrc"
6 | fi
7 | fi
8 |
9 | # set PATH so it includes user's private bin if it exists
10 | if [ -d "$HOME/bin" ] ; then
11 | PATH="$HOME/bin:$PATH"
12 | fi
13 |
14 | # set PATH so it includes user's private bin if it exists
15 | if [ -d "$HOME/.local/bin" ] ; then
16 | PATH="$HOME/.local/bin:$PATH"
17 | fi
18 |
19 | # include personal scripts/bin
20 | if [ -d "$HOME/scripts/bin" ] ; then
21 | PATH="$HOME/scripts/bin:$PATH"
22 | PATH="$HOME/scripts/monitor_setups:$PATH"
23 | fi
24 |
25 | source "$HOME/.cargo/env"
26 |
27 |
--------------------------------------------------------------------------------
/src/.xprofile:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Run at startup
4 | # This file is sourced by Xresources (GDM, LightDM, all source this)
5 | # ------------------------------------------------------------------
6 |
7 | # Make the keyboard movements faster
8 | xset r rate 340 50
9 |
10 | # Touchpad necessities
11 | xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Natural Scrolling Enabled" 1
12 | xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Tapping Enabled" 1
13 |
14 | # Turn off laptop screen when monitor connected
15 | hdmi_connected=$(xrandr | grep ' connected' | grep 'HDMI' | wc -l)
16 | if [ "$hdmi_connected" -eq 1 ]; then
17 | eval "~/scripts/monitor_setups/laptop_left_primary_monitor_right"
18 | fi
19 |
20 |
--------------------------------------------------------------------------------
/src/.gitconfig:
--------------------------------------------------------------------------------
1 | [user]
2 | email = purhan01@gmail.com
3 | name = purhan
4 | [color]
5 | ui = true
6 | [color "diff-highlight"]
7 | oldHighlight = red bold 52
8 | newNormal = green bold
9 | newHighlight = green bold 22
10 | oldNormal = red bold
11 | [color "diff"]
12 | meta = 11 bold
13 | frag = magenta bold
14 | commit = yellow bold
15 | old = red bold
16 | new = green bold
17 | whitespace = red reverse
18 | [diff-so-fancy]
19 | changeHunkIndicators = false
20 | stripLeadingSymbols = false
21 | markEmptyLines = false
22 | rulerWidth =
23 | useUnicodeRuler = false
24 | ; install gh-cli and login with `gh auth login`
25 | [credential "https://github.com"]
26 | helper = !gh auth git-credential
27 |
28 |
--------------------------------------------------------------------------------
/src/.config/kitty/gruvbox-material.conf:
--------------------------------------------------------------------------------
1 | # Original Project:
2 | # https://github.com/sainnhe/gruvbox-material/
3 | # Colors are different than original, just to match my taste :P
4 |
5 | foreground #d6d6d6
6 | background #282827
7 |
8 | # black
9 | color0 #282828
10 | color8 #6e6e6e
11 |
12 | # red
13 | color1 #f35a5a
14 | color9 #ba524a
15 |
16 | # green
17 | color2 #92c96a
18 | color10 #7b9d62
19 |
20 | # yellow
21 | color3 #e1be7f
22 | color11 #cd996a
23 |
24 | # blue
25 | color4 #66aeea
26 | color12 #4083bc
27 |
28 | # magenta
29 | color5 #c57cda
30 | color13 #9955ac
31 |
32 | # cyan
33 | color6 #3cb46c
34 | color14 #319659
35 |
36 | # white
37 | color7 #d1d1d1
38 | color15 #858585
39 |
--------------------------------------------------------------------------------
/src/.config/awesome/module/auto-start.lua:
--------------------------------------------------------------------------------
1 | -- MODULE AUTO-START
2 | -- Run all the apps listed in configuration/apps.lua as run_on_start_up only once when awesome start
3 |
4 | local awful = require('awful')
5 | local apps = require('configuration.apps')
6 |
7 | local function run_once(cmd)
8 | local findme = cmd
9 | local firstspace = cmd:find(' ')
10 | if firstspace then
11 | findme = cmd:sub(0, firstspace - 1)
12 | end
13 | awful.spawn.with_shell(string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd))
14 | --This broke compton ===> awful.spawn.single_instance(string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd))
15 | end
16 |
17 | for _, app in ipairs(apps.run_on_start_up) do
18 | run_once(app)
19 | end
20 |
--------------------------------------------------------------------------------
/src/.config/kitty/gruvbox.conf:
--------------------------------------------------------------------------------
1 | # gruvbox-dark colorscheme for kitty
2 | # snazzy theme used as base
3 |
4 | foreground #ebdbb2
5 | background #272727
6 | selection_foreground #655b53
7 | selection_background #ebdbb2
8 | url_color #d65c0d
9 |
10 | # black
11 | color0 #272727
12 | color8 #928373
13 |
14 | # red
15 | color1 #cc231c
16 | color9 #fb4833
17 |
18 | # green
19 | color2 #989719
20 | color10 #b8ba25
21 |
22 | # yellow
23 | color3 #d79920
24 | color11 #fabc2e
25 |
26 | # blue
27 | color4 #448488
28 | color12 #83a597
29 |
30 | # magenta
31 | color5 #b16185
32 | color13 #d3859a
33 |
34 | # cyan
35 | color6 #689d69
36 | color14 #8ec07b
37 |
38 | # white
39 | color7 #a89983
40 | color15 #ebdbb2
41 |
--------------------------------------------------------------------------------
/src/.config/nvim/src/coc-extensions.vim:
--------------------------------------------------------------------------------
1 | let g:coc_global_extensions = [
2 | \ 'coc-snippets',
3 | \ 'coc-actions',
4 | \ 'coc-sh',
5 | \ 'coc-java-debug',
6 | \ 'coc-java',
7 | \ 'coc-lists',
8 | \ 'coc-emmet',
9 | \ 'coc-tasks',
10 | \ 'coc-pairs',
11 | \ 'coc-tsserver',
12 | \ 'coc-floaterm',
13 | \ 'coc-fzf-preview',
14 | \ 'coc-html',
15 | \ 'coc-css',
16 | \ 'coc-cssmodules',
17 | \ 'coc-stylelintplus',
18 | \ 'coc-emoji',
19 | \ 'coc-bookmark',
20 | \ 'coc-yaml',
21 | \ 'coc-pyright',
22 | \ 'coc-explorer',
23 | \ 'coc-svg',
24 | \ 'coc-prettier',
25 | \ 'coc-vimlsp',
26 | \ 'coc-xml',
27 | \ 'coc-yank',
28 | \ 'coc-json',
29 | \ 'coc-marketplace',
30 | \ ]
31 | " \ 'coc-tabnine',
32 | " \ 'coc-highlight',
33 |
34 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/memory.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local beautiful = require('beautiful')
3 | local watch = require('awful.widget.watch')
4 |
5 | local memory = wibox.widget.textbox()
6 | memory.font = beautiful.font
7 |
8 | function round(exact, quantum)
9 | local quant,frac = math.modf(exact/quantum)
10 | return quantum * (quant + (frac > 0.5 and 1 or 0))
11 | end
12 |
13 | watch('bash -c "free | grep -z Mem.*Swap.*"', 1, function(_, stdout)
14 | local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
15 | stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
16 |
17 | memory.text = round((used / 1048576), 0.01) .. 'GB'
18 | collectgarbage('collect')
19 | end)
20 |
21 | return memory
22 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/CP-build-no-timeout.sublime-build:
--------------------------------------------------------------------------------
1 | {
2 | "target": "terminus_open",
3 | "cancel": "terminus_cancel_build",
4 | "title": "Terminal",
5 | "auto_close": false,
6 | "timeit": true,
7 |
8 | "post_window_hooks": [["carry_file_to_pane", { "direction": "right" }]],
9 |
10 | "focus": false,
11 | "cmd": [
12 | "bash",
13 | "-c",
14 | "g++ -std=c++17 -Wall -Wextra -Wshadow -fsanitize=undefined '${file}' -o '${file_path}/compiled'.o && tput setaf 2 && TIMEFORMAT='\nExecution Time: %R' && time '${file_path}/compiled.o' && unset TIMEFORMAT"
15 | ],
16 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
17 | "working_dir": "${file_path}",
18 | "selector": "source.c, source.c++",
19 | "variants": [
20 | {
21 | "name": "Run"
22 | }
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/utils/rofi-power:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # rofi-power
4 | # Use rofi to call systemctl for shutdown, reboot, etc
5 |
6 | # 2016 Oliver Kraitschy - http://okraits.de
7 |
8 | OPTIONS="Poweroff\nExit\nReboot\nSuspend\nHibernate"
9 |
10 | config_path=$(dirname "$0")
11 |
12 | LAUNCHER="rofi -dmenu -i"
13 | USE_LOCKER="false"
14 | LOCKER="i3lock-fancy"
15 |
16 | option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'`
17 | case $option in
18 | Exit)
19 | kill -9 -1
20 | ;;
21 | Reboot)
22 | systemctl reboot
23 | ;;
24 | Poweroff)
25 | systemctl poweroff
26 | ;;
27 | Suspend)
28 | $($USE_LOCKER) && "$LOCKER"; systemctl suspend
29 | ;;
30 | Hibernate)
31 | $($USE_LOCKER) && "$LOCKER"; systemctl hibernate
32 | ;;
33 | *)
34 | ;;
35 | esac
36 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/CP-build-system.sublime-build:
--------------------------------------------------------------------------------
1 | {
2 | "target": "terminus_open",
3 | "cancel": "terminus_cancel_build",
4 | "title": "Terminal",
5 | "auto_close": false,
6 | "timeit": true,
7 |
8 | "post_window_hooks": [["carry_file_to_pane", { "direction": "right" }]],
9 |
10 | "focus": false,
11 | "cmd": [
12 | "bash",
13 | "-c",
14 | "g++ -std=c++17 -Wall -Wextra -Wshadow -fsanitize=undefined '${file}' -o '${file_path}/compiled'.o && tput setaf 2 && TIMEFORMAT='\nExecution Time: %R' && time timeout 5s '${file_path}/compiled.o' < input.txt && unset TIMEFORMAT"
15 | ],
16 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
17 | "working_dir": "${file_path}",
18 | "selector": "source.c, source.c++",
19 | "variants": [
20 | {
21 | "name": "Run"
22 | }
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/CP-build-system-alt.sublime-build:
--------------------------------------------------------------------------------
1 | {
2 | "target": "terminus_open",
3 | "cancel": "terminus_cancel_build",
4 | "title": "Terminal",
5 | "auto_close": false,
6 | "timeit": true,
7 |
8 | "post_window_hooks": [["carry_file_to_pane", { "direction": "down" }]],
9 |
10 | "focus": false,
11 | "cmd": [
12 | "bash",
13 | "-c",
14 | "g++ -std=c++17 -Wall -Wextra -Wshadow -fsanitize=undefined '${file}' -o '${file_path}/compiled'.o && tput setaf 2 && TIMEFORMAT='\nExecution Time: %R' && time timeout 5s '${file_path}/compiled.o' < input.txt && unset TIMEFORMAT"
15 | ],
16 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
17 | "working_dir": "${file_path}",
18 | "selector": "source.c, source.c++",
19 | "variants": [
20 | {
21 | "name": "Run"
22 | }
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/Terminus/Terminus.hidden-color-scheme:
--------------------------------------------------------------------------------
1 | {
2 | "globals": {
3 | "background": "#f7f7f7"
4 | },
5 | "variables": {
6 | "white": "#a5a2a2",
7 | "blue": "#01a0e4",
8 | "light_brown": "#4a4543",
9 | "light_red": "#e8bbd0",
10 | "magenta": "#a16a94",
11 | "light_white": "#f7f7f8",
12 | "green": "#01a252",
13 | "light_magenta": "#d6d5d4",
14 | "background": "#f7f7f8",
15 | "light_black": "#5c5855",
16 | "foreground": "#4a4543",
17 | "red": "#db2d20",
18 | "light_green": "#3a3432",
19 | "cyan": "#b5e4f4",
20 | "black": "#090300",
21 | "brown": "#fded02",
22 | "light_cyan": "#cdab53",
23 | "caret": "#4a4543",
24 | "light_blue": "#807d7c"
25 | },
26 | "name": "Terminus"
27 | }
--------------------------------------------------------------------------------
/src/.config/awesome/layout/bottom-bar.lua:
--------------------------------------------------------------------------------
1 | local beautiful = require('beautiful')
2 | local wibox = require('wibox')
3 | local TaskList = require('widget.task-list')
4 | local dpi = require('beautiful').xresources.apply_dpi
5 |
6 | local BottomBar = function(s, offset)
7 |
8 | -- BOTTOM BAR
9 | -- =======
10 | local panel_height = dpi(16)
11 | local panel = wibox({
12 | ontop = false,
13 | screen = s,
14 | height = panel_height,
15 | width = s.geometry.width,
16 | x = s.geometry.x,
17 | y = s.geometry.height - panel_height,
18 | stretch = false,
19 | bg = "00000000",
20 | fg = beautiful.fg_normal,
21 | })
22 |
23 | panel:struts({
24 | bottom = panel.height
25 | })
26 |
27 | panel:setup{
28 | layout = wibox.layout.align.horizontal,
29 | nil,
30 | TaskList(s),
31 | nil,
32 | }
33 |
34 | return panel
35 | end
36 |
37 | return BottomBar
38 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/client/keys.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | require('awful.autofocus')
3 | local modkey = require('configuration.keys.mod').modKey
4 | local altkey = require('configuration.keys.mod').altKey
5 |
6 | local clientKeys = awful.util.table.join(awful.key({modkey}, 'f', function(c)
7 | c.fullscreen = not c.fullscreen
8 | c:raise()
9 | end, {
10 | description = 'toggle fullscreen',
11 | group = 'client'
12 | }), awful.key({modkey, 'Shift'}, 'q', function(c)
13 | c:kill()
14 | end, {
15 | description = 'close',
16 | group = 'client'
17 | }) , awful.key({modkey, 'Shift'}, 'f', function(c)
18 | c.sticky = not c.sticky
19 | c.ontop = not c.ontop
20 | c:raise()
21 | end, {
22 | description = 'convert to sticky window',
23 | group = 'client'
24 | }), awful.key({modkey, 'Shift'}, 'c', function(c)
25 | c:kill()
26 | end, {
27 | description = 'close',
28 | group = 'client'
29 | }))
30 |
31 | return clientKeys
32 |
--------------------------------------------------------------------------------
/src/.config/kitty/dracula.conf:
--------------------------------------------------------------------------------
1 | foreground #f8f8f2
2 | background #282a36
3 | selection_foreground #ffffff
4 | selection_background #44475a
5 |
6 | url_color #8be9fd
7 |
8 | # black
9 | color0 #21222c
10 | color8 #6272a4
11 |
12 | # red
13 | color1 #ff5555
14 | color9 #ff6e6e
15 |
16 | # green
17 | color2 #50fa7b
18 | color10 #69ff94
19 |
20 | # yellow
21 | color3 #f1fa8c
22 | color11 #ffffa5
23 |
24 | # blue
25 | color4 #bd93f9
26 | color12 #d6acff
27 |
28 | # magenta
29 | color5 #ff79c6
30 | color13 #ff92df
31 |
32 | # cyan
33 | color6 #8be9fd
34 | color14 #a4ffff
35 |
36 | # white
37 | color7 #f8f8f2
38 | color15 #ffffff
39 |
40 | # Cursor colors
41 | cursor #f8f8f2
42 | cursor_text_color background
43 |
44 | # Tab bar colors
45 | active_tab_foreground #282a36
46 | active_tab_background #f8f8f2
47 | inactive_tab_foreground #282a36
48 | inactive_tab_background #6272a4
49 |
50 | # Marks
51 | mark1_foreground #282a36
52 | mark1_background #ff5555
53 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/cpu.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 | local beautiful = require('beautiful')
3 | local dpi = require('beautiful').xresources.apply_dpi
4 | local watch = require('awful.widget.watch')
5 |
6 | local cpu = wibox.widget.textbox()
7 | local total_prev = 0
8 | local idle_prev = 0
9 |
10 | watch([[bash -c "cat /proc/stat | grep '^cpu '"]], 1, function(_, stdout)
11 | local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
12 | stdout:match('(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s')
13 |
14 | local total = user + nice + system + idle + iowait + irq + softirq + steal
15 |
16 | local diff_idle = idle - idle_prev
17 | local diff_total = total - total_prev
18 | local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
19 |
20 | cpu.text = math.floor(diff_usage) .. '%'
21 | if diff_usage < 10 then cpu.text = '0' .. cpu.text end
22 |
23 | total_prev = total
24 | idle_prev = idle
25 | collectgarbage('collect')
26 | end)
27 |
28 | return cpu
29 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/tags.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local beautiful = require('beautiful')
3 | local gears = require('gears')
4 | local apps = require('configuration.apps')
5 | local dpi = require('beautiful').xresources.apply_dpi
6 |
7 | local tags = {{
8 | text = 'web',
9 | screen = 1
10 | }, {
11 | text = 'dev',
12 | screen = 1
13 | }, {
14 | text = 'term',
15 | screen = 1
16 | }, {
17 | text = 'file',
18 | screen = 1
19 | }, {
20 | text = 'chat',
21 | screen = 1
22 | }, {
23 | text = 'misc',
24 | screen = 1
25 | }}
26 |
27 | awful.layout.layouts = {awful.layout.suit.tile, awful.layout.suit.max, awful.layout.suit.floating}
28 |
29 | awful.screen.connect_for_each_screen(function(s)
30 | for i, tag in pairs(tags) do
31 | awful.tag.add(tag.text, {
32 | icon = tag.icon,
33 | icon_only = false,
34 | layout = awful.layout.suit.tile,
35 | gap = beautiful.gaps,
36 | screen = s,
37 | defaultApp = tag.defaultApp,
38 | selected = i == 1
39 | })
40 | end
41 | end)
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 purhan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/utils/autostart:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | ## This configuration file is meant for applications that
3 | # still run in the background when a reload is triggered
4 | # for awesome, this script just kills the running instance
5 | # and starts a new one.
6 | # Only add applications/scripts without parameters here
7 | # (if you want to apply parameters then use a script file!)
8 |
9 | APPS=(
10 | # keepassxc
11 | # kdeconnect-indicator
12 | radeon-profile
13 | $HOME/.config/utils/awesomestart
14 | )
15 | # Some applications start child applications that need to be killed on reload
16 | KILL=(
17 | synergyc
18 | nextcloud
19 | )
20 | # Some applications need to be started without GUI
21 | SILENT=(
22 | gnome-clocks
23 | )
24 |
25 | # First kill lingering apps
26 | for app in "${APPS[@]}"
27 | do
28 | kill -9 $(pidof $app)
29 | done
30 | for app in "${KILL[@]}"
31 | do
32 | kill -9 $(pidof $app)
33 | done
34 |
35 | # Start new instances
36 | for app in "${APPS[@]}"
37 | do
38 | env $app ${@:2} &
39 | done
40 |
41 | # Run silent apps
42 | Xvfb :99 &
43 | for silentapp in "${SILENT[@]}"
44 | do
45 | DISPLAY=:99 $silentapp &
46 | done
47 |
--------------------------------------------------------------------------------
/src/.config/starship.toml:
--------------------------------------------------------------------------------
1 | [line_break]
2 | disabled = true
3 |
4 | [character]
5 | success_symbol = "[\\$>](bold green)"
6 | error_symbol = "[\\$>](bold red)"
7 | vicmd_symbol = "[\\$<](bold blue)"
8 |
9 | [aws]
10 | symbol = " "
11 |
12 | [battery]
13 | full_symbol = ""
14 | charging_symbol = ""
15 | discharging_symbol = ""
16 |
17 | [conda]
18 | symbol = " "
19 |
20 | [dart]
21 | symbol = " "
22 |
23 | [directory]
24 | read_only = " "
25 |
26 | [docker]
27 | symbol = " "
28 |
29 | [elixir]
30 | symbol = " "
31 |
32 | [elm]
33 | symbol = " "
34 |
35 | [git_branch]
36 | symbol = " "
37 |
38 | [golang]
39 | symbol = " "
40 |
41 | [haskell]
42 | symbol = " "
43 |
44 | [hg_branch]
45 | symbol = " "
46 |
47 | [java]
48 | symbol = " "
49 |
50 | [julia]
51 | symbol = " "
52 |
53 | [memory_usage]
54 | symbol = " "
55 |
56 | [nim]
57 | symbol = " "
58 |
59 | [nix_shell]
60 | symbol = " "
61 |
62 | [nodejs]
63 | symbol = " "
64 |
65 | [package]
66 | symbol = " "
67 |
68 | [perl]
69 | symbol = " "
70 |
71 | [php]
72 | symbol = " "
73 |
74 | [python]
75 | symbol = " "
76 |
77 | [ruby]
78 | symbol = " "
79 |
80 | [rust]
81 | symbol = " "
82 |
83 | [swift]
84 | symbol = "ﯣ "
85 |
86 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/clickable-container.lua:
--------------------------------------------------------------------------------
1 | local wibox = require('wibox')
2 |
3 | function build(widget, label)
4 | local container = wibox.widget {
5 | -- widget,
6 | wibox.widget {
7 | text = label,
8 | widget = wibox.widget.textbox,
9 | },
10 | widget = wibox.container.background
11 | }
12 | local old_cursor, old_wibox
13 |
14 | container:connect_signal('mouse::enter', function()
15 | container.bg = '#ffffff11'
16 | -- Hm, no idea how to get the wibox from this signal's arguments...
17 | local w = _G.mouse.current_wibox
18 | if w then
19 | old_cursor, old_wibox = w.cursor, w
20 | w.cursor = 'hand1'
21 | end
22 | end)
23 |
24 | container:connect_signal('mouse::leave', function()
25 | container.bg = '#ffffff00'
26 | if old_wibox then
27 | old_wibox.cursor = old_cursor
28 | old_wibox = nil
29 | end
30 | end)
31 |
32 | container:connect_signal('button::press', function()
33 | container.bg = '#ffffff22'
34 | end)
35 |
36 | container:connect_signal('button::release', function()
37 | container.bg = '#ffffff11'
38 | end)
39 |
40 | return container
41 | end
42 |
43 | return build
44 |
--------------------------------------------------------------------------------
/src/scripts/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: all
2 | all: debian
3 |
4 | .PHONY: debian
5 | debian: essentials others apt snap snap-classic
6 |
7 | # Packages to be installed using apt
8 | apt = firefox \
9 | chromium-browser \
10 | compton \
11 | rofi \
12 | vlc \
13 | peek \
14 | obs-studio \
15 | gnome-tweaks \
16 | htop \
17 | vim \
18 | neovim \
19 | awesome \
20 | i3lock-fancy \
21 | python3-pip \
22 | python3-venv \
23 | npm \
24 | nodejs \
25 | kitty \
26 | zsh \
27 | stow \
28 | arandr \
29 | xdotool \
30 | polkit-gnome-authentication-agent-1 \
31 | gh
32 |
33 | # Packages to be installed as snaps
34 | snap = discord
35 |
36 | # Some snaps require confinement
37 | snap-classic = sublime-text \
38 | code \
39 | postman
40 |
41 |
42 | apt:
43 | sudo apt-get install $(apt)
44 |
45 | snap:
46 | sudo snap install $(snap)
47 |
48 | snap-classic:
49 | for package in $(snap-classic) ; do \
50 | sudo snap install $$package --classic ; \
51 | done
52 |
53 | essentials:
54 | ### INSTALLING ESSENTIAL PACKAGES ###
55 | # ================================= #
56 | sudo apt install \
57 | git \
58 | curl
59 |
60 | others:
61 | ### SETTING UP SHELLS ###
62 | # Install starship shell prompt
63 | curl -fsSL https://starship.rs/install.sh | bash
64 |
65 | # Install zsh plugins
66 | make -i -C ~/.config/zsh
67 |
68 | ### SETTING UP AWESOME ###
69 | # ====================== #
70 | make -i -C ~/.config/requirements/awesome
71 |
--------------------------------------------------------------------------------
/src/.config/awesome/theme/color-schemes.lua:
--------------------------------------------------------------------------------
1 | return {
2 | dracula = {
3 | primary = {
4 | hue_100 = '#282a36',
5 | hue_200 = '#44475a'
6 | },
7 | accent = {
8 | hue_100 = '#f1fa8c',
9 | hue_200 = '#50fa7b',
10 | hue_300 = '#8be9fd',
11 | hue_400 = '#ff5555',
12 | hue_500 = '#6272a4',
13 | hue_600 = '#ff79c6',
14 | hue_700 = '#ffb86c',
15 | hue_800 = '#f8f8f2',
16 | }
17 | },
18 | gruvbox = {
19 | primary = {
20 | hue_100 = '#282828',
21 | hue_200 = '#3c3c3c'
22 | },
23 | accent = {
24 | hue_100 = '#fe8019',
25 | hue_200 = '#fabd2f',
26 | hue_300 = '#8ec07c',
27 | hue_400 = '#fb4934',
28 | hue_500 = '#d3869b',
29 | hue_600 = '#b8bb26',
30 | hue_700 = '#458588',
31 | hue_800 = '#fbf1c7',
32 | }
33 | },
34 | gruvbox_material = {
35 | primary = {
36 | hue_100 = '#212121',
37 | hue_200 = '#3c3c3c'
38 | },
39 | accent = {
40 | hue_100 = '#e1be7f',
41 | hue_200 = '#92c96a',
42 | hue_300 = '#66aeea',
43 | hue_400 = '#f35a5a',
44 | hue_500 = '#4083bc',
45 | hue_600 = '#c57cda',
46 | hue_700 = '#cd996a',
47 | hue_800 = '#d6d6d6',
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/.config/awesome/layout/init.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local top_bar = require('layout.top-bar')
3 | local bottom_bar = require('layout.bottom-bar')
4 | local beautiful = require('beautiful')
5 |
6 | -- Create a wibox for each screen and add it
7 | awful.screen.connect_for_each_screen(function(s)
8 | if s.index == 1 then
9 | s.top_bar = top_bar(s, true)
10 | if not beautiful.title_bar then
11 | s.bottom_bar = bottom_bar(s, true)
12 | end
13 | else
14 | s.top_bar = top_bar(s, false)
15 | if not beautiful.title_bar then
16 | s.bottom_bar = bottom_bar(s, false)
17 | end
18 | end
19 | end)
20 |
21 | -- Hide bars when app go fullscreen
22 | function updateBarsVisibility()
23 | for s in screen do
24 | if s.selected_tag then
25 | local fullscreen = s.selected_tag.fullscreenMode
26 | s.top_bar.visible = not fullscreen
27 | if not beautiful.title_bar then
28 | s.bottom_bar.visible = not fullscreen
29 | end
30 | end
31 | end
32 | end
33 |
34 | _G.tag.connect_signal('property::selected', function(t)
35 | updateBarsVisibility()
36 | end)
37 |
38 | _G.client.connect_signal('property::fullscreen', function(c)
39 | c.screen.selected_tag.fullscreenMode = c.fullscreen
40 | updateBarsVisibility()
41 | end)
42 |
43 | _G.client.connect_signal('unmanage', function(c)
44 | if c.fullscreen then
45 | c.screen.selected_tag.fullscreenMode = false
46 | updateBarsVisibility()
47 | end
48 | end)
49 |
--------------------------------------------------------------------------------
/src/.config/awesome/module/notifications.lua:
--------------------------------------------------------------------------------
1 | local naughty = require('naughty')
2 | local beautiful = require('beautiful')
3 | local gears = require('gears')
4 | local dpi = require('beautiful').xresources.apply_dpi
5 |
6 | -- Naughty presets
7 | naughty.config.padding = 8
8 | naughty.config.spacing = 8
9 |
10 | naughty.config.defaults.timeout = 5
11 | naughty.config.defaults.screen = 1
12 | naughty.config.defaults.position = 'top_right'
13 | naughty.config.defaults.margin = dpi(16)
14 | naughty.config.defaults.ontop = true
15 | naughty.config.defaults.font = beautiful.font
16 | naughty.config.defaults.icon = nil
17 | naughty.config.defaults.icon_size = dpi(32)
18 | naughty.config.defaults.shape = gears.shape.rectangle
19 | naughty.config.defaults.border_width = dpi(0)
20 | naughty.config.defaults.hover_timeout = nil
21 |
22 | -- Error handling
23 | if _G.awesome.startup_errors then
24 | naughty.notify({
25 | preset = naughty.config.presets.critical,
26 | title = 'Oops, there were errors during startup!',
27 | text = _G.awesome.startup_errors
28 | })
29 | end
30 |
31 | do
32 | local in_error = false
33 | _G.awesome.connect_signal('debug::error', function(err)
34 | if in_error then
35 | return
36 | end
37 | in_error = true
38 |
39 | naughty.notify({
40 | preset = naughty.config.presets.critical,
41 | title = 'Oops, an error happened!',
42 | text = tostring(err)
43 | })
44 | in_error = false
45 | end)
46 | end
47 |
48 | function log_this(title, txt)
49 | naughty.notify({
50 | title = 'log: ' .. title,
51 | text = txt
52 | })
53 | end
54 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/apps.lua:
--------------------------------------------------------------------------------
1 | local filesystem = require('gears.filesystem')
2 | local beautiful = require('beautiful')
3 |
4 | -- Thanks to jo148 on github for making rofi dpi aware!
5 | local with_dpi = require('beautiful').xresources.apply_dpi
6 | local get_dpi = require('beautiful').xresources.get_dpi
7 | local rofi_command = 'env /usr/bin/rofi -show drun -display-drun -run-command "/bin/bash -c -i \'shopt -s expand_aliases; {cmd}\'"'
8 |
9 | return {
10 | -- List of apps to start by default on some actions
11 | default = {
12 | terminal = 'kitty',
13 | rofi = rofi_command,
14 | lock = 'i3lock-fancy',
15 | splash = 'kitty -T SplashTerminal -o background_opacity=0.95',
16 | power_command = '~/.config/awesome/configuration/utils/rofi-power',
17 | screenshot = '~/.config/awesome/configuration/utils/screenshot -m',
18 | region_screenshot = '~/.config/awesome/configuration/utils/screenshot -r',
19 | delayed_screenshot = '~/.config/awesome/configuration/utils/screenshot --delayed -r',
20 | browser = 'env firefox',
21 | editor = 'kitty',
22 | social = 'env discord',
23 | files = 'thunar',
24 | power_manager = 'gnome-power-statistics'
25 | },
26 | -- List of commands to start once on start-up
27 | run_on_start_up = {
28 | '~/.config/awesome/configuration/awspawn',
29 | 'compton',
30 | 'nm-applet --indicator',
31 | 'nitrogen --restore',
32 | 'ibus-daemon --xim --daemonize',
33 | 'scream-start',
34 | 'numlockx on',
35 | '/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)', -- credential manager
36 | 'blueman-tray'
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/src/.config/sublime-text-3/Packages/User/template.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | /* NAMESPACES */
7 | using namespace std; // (┛ಠ_ಠ)┛ "Bad" Practice
8 |
9 | /* ALIASES */
10 | typedef long long lli;
11 | typedef long double ld;
12 | typedef unsigned uns;
13 |
14 | typedef pair pi;
15 | typedef pair pl;
16 | typedef pair pd;
17 |
18 | typedef vector vi;
19 | typedef vector vd;
20 | typedef vector vl;
21 | typedef vector vpi;
22 | typedef vector vpl;
23 |
24 | /* DEFINITIONS */
25 | #define mp make_pair
26 | #define pb push_back
27 | #define F first
28 | #define S second
29 | #define lb lower_bound
30 | #define ub upper_bound
31 |
32 | #define fo(i, a, b) for(auto i=a; i<(b); i++)
33 | #define forev(i, b, a) for(auto i = (b)-1; i >= a; i--)
34 | #define all(x) x.begin(), x.end()
35 | #define sortall(x) sort(all(x))
36 | #define sz(x) (int)x.size()
37 | #define enl "\n"
38 | #define deb(x) cout << #x << ": " << x << enl;
39 |
40 | /* CONSTANTS */
41 | // const ld PI = 4 * atan((ld)1);
42 | // const int MOD = 1000000007;
43 | // const lli INF = 1e18;
44 | // const int MX = INT_MAX - 1;
45 |
46 | /* UTILITIES */
47 | template bool _odd(T a) {return a & 1;}
48 | template bool _even(T a) {return !(a & 1);}
49 |
50 | /*======================= ROBERT'S GOT A QUICK HAND =======================*/
51 |
52 | void solve() {
53 |
54 | }
55 |
56 | int main() {
57 | ios_base::sync_with_stdio(0); cin.tie(0);
58 | // int testcase; cin >> testcase; for (int i = 1; i <= testcase; ++i)
59 | solve();
60 | return 0;
61 | }
62 | ]]>
63 |
64 | template
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/volume.lua:
--------------------------------------------------------------------------------
1 | local awful = require("awful")
2 | local wibox = require('wibox')
3 | local mat_list_item = require('widget.material.list-item')
4 | local dpi = require('beautiful').xresources.apply_dpi
5 | local watch = require('awful.widget.watch')
6 | local beautiful = require('beautiful')
7 |
8 | local volume_icon = wibox.widget.textbox()
9 | volume_icon.font = beautiful.icon_font
10 | local volume_widget = wibox.widget.textbox()
11 | volume_widget.align = 'center'
12 | volume_widget.valign = 'center'
13 | volume_widget.font = beautiful.font
14 |
15 | local volume
16 |
17 | function update_volume()
18 | awful.spawn.easy_async_with_shell("bash -c 'amixer -D pulse sget Master'", function(stdout)
19 | volume = string.match(stdout, '(%d?%d?%d)%%')
20 | awful.spawn.easy_async_with_shell("bash -c 'pacmd list-sinks | awk '/muted/ { print $2 }''", function(muted)
21 | volume_widget.text = volume
22 | muted = string.gsub(muted, "%s+", "")
23 | if muted == 'muted:no' and (volume > '35' or volume == '100') then
24 | volume_icon.text = '墳'
25 | elseif muted == 'muted:no' and volume <= '35' and volume > '0' then
26 | volume_icon.text = '奔'
27 | elseif muted == 'muted:yes' then
28 | volume_icon.text = '婢'
29 | volume_widget.text = 'M'
30 | elseif volume == '0' then
31 | volume_icon.text = '奄'
32 | end
33 | end)
34 | collectgarbage('collect')
35 | end)
36 | end
37 |
38 | watch('bash -c', 3, function(_, stdout)
39 | update_volume()
40 | end)
41 |
42 | return wibox.widget {
43 | wibox.widget{
44 | volume_icon,
45 | fg = beautiful.accent.hue_100,
46 | widget = wibox.container.background
47 | },
48 | volume_widget,
49 | spacing = dpi(4),
50 | layout = wibox.layout.fixed.horizontal
51 | }
52 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/icon.lua:
--------------------------------------------------------------------------------
1 | -- Default widget requirements
2 | local base = require('wibox.widget.base')
3 | local gtable = require('gears.table')
4 | local setmetatable = setmetatable
5 |
6 | -- Commons requirements
7 | local wibox = require('wibox')
8 |
9 | -- Local declarations
10 |
11 | local mat_list_item = {mt = {}}
12 |
13 | function mat_list_item:layout(_, width, height)
14 | local layout = {}
15 |
16 | -- Add divider if present
17 | if self._private.icon then
18 | table.insert(
19 | layout,
20 | base.place_widget_at(
21 | self._private.imagebox,
22 | width / 2 - self._private.size / 2,
23 | height / 2 - self._private.size / 2,
24 | self._private.size,
25 | self._private.size
26 | )
27 | )
28 | end
29 | return layout
30 | end
31 |
32 | function mat_list_item:fit(_, width, height)
33 | local min = math.min(width, height)
34 | return min, min
35 | end
36 |
37 | function mat_list_item:set_icon(icon)
38 | self._private.icon = icon
39 | self._private.imagebox.image = icon
40 | end
41 |
42 | function mat_list_item:get_icon()
43 | return self._private.icon
44 | end
45 |
46 | function mat_list_item:set_size(size)
47 | self._private.size = size
48 | self:emit_signal('widget::layout_changed')
49 | end
50 |
51 | function mat_list_item:get_size()
52 | return self._private.size
53 | end
54 |
55 | local function new(icon, size)
56 | local ret =
57 | base.make_widget(
58 | nil,
59 | nil,
60 | {
61 | enable_properties = true
62 | }
63 | )
64 |
65 | gtable.crush(ret, mat_list_item, true)
66 | ret._private.icon = icon
67 | ret._private.imagebox = wibox.widget.imagebox(icon)
68 | ret._private.size = size
69 | return ret
70 | end
71 |
72 | function mat_list_item.mt:__call(...)
73 | return new(...)
74 | end
75 |
76 | --@DOC_widget_COMMON@
77 |
78 | --@DOC_object_COMMON@
79 |
80 | return setmetatable(mat_list_item, mat_list_item.mt)
81 |
--------------------------------------------------------------------------------
/src/scripts/misc/vampire.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | shell=$(basename $SHELL)
4 | kernel="$(uname -r | cut -d '-' -f1)"
5 | wmname="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")"
6 |
7 |
8 | # __.......__
9 | # .-:::::::::::::-.
10 | # .:::''':::::::''':::.
11 | # .:::' ':::' ':::.
12 | # .'\ ::' ':' ':: /'.
13 | # : \ :: :: / :
14 | # : \': ___ ___ :'/ :
15 | # : /\ ( •)\ /( •) /\ :
16 | # : / .\ ‾‾ | | ‾‾ /. \ :
17 | # : \ ( (_) ) / :
18 | # : '_( )_' :
19 | # '. \ < _____ > / .'
20 | # '. \ \ / / .'
21 | # '._ '-._ _.-' _.'
22 | # .''-.__ .''-._.-''. __.-''.
23 | # .' '. .' '.
24 | # .' '-. .-' '.
25 |
26 | a=$'[1;34m' # PURPLE
27 | r=$'[1;31m' # RED
28 | w=$'[1;39m' # WHITE
29 | g=$'[1;35m' # MAGENTA
30 | t=$'[01;49;32m' # GREEN
31 | m=$'[m' # NORMAL
32 | tput clear
33 | cat << EOF
34 | $a __.......__
35 | .-:::::::::::::-.
36 | .:::''':::::::''':::.
37 | .:::' ':::' ':::.$m
38 | $g.'\ $a::'$m $a':'$m $a'::$g /'.$m
39 | $g: \ $a::$m $a::$g / :$m
40 | $g: \'$a:$m ___ ___ $a:$g'/ :
41 | :$w /\ ( •)\ /$w( •)$w /\ $g:
42 | :$w / .\ ‾‾ | | ‾‾ /. \ $g:
43 | :$w \ ( (_) ) / $g:
44 | :$w '_( )_' $g:
45 | '.$w \ < _____ > / $g.'
46 | '.$w \ $r\ /$g $w/ $g.'
47 | '._$w '-._ _.-' $g _.'
48 | $t .''-.__$w .''-._.-''.$t __.-''.
49 | .' '. .' '.
50 | .' '-. .-' '. $m
51 | EOF
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/client/rules.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local gears = require('gears')
3 | local client_keys = require('configuration.client.keys')
4 | local client_buttons = require('configuration.client.buttons')
5 |
6 | -- Rules
7 | awful.rules.rules = {{
8 | rule = {},
9 | properties = {
10 | focus = awful.client.focus.filter,
11 | raise = true,
12 | keys = client_keys,
13 | buttons = client_buttons,
14 | screen = awful.screen.preferred,
15 | placement = awful.placement.no_offscreen,
16 | floating = false,
17 | maximized = false,
18 | above = false,
19 | below = false,
20 | ontop = false,
21 | sticky = false,
22 | maximized_horizontal = false,
23 | maximized_vertical = false
24 | }
25 | }, {
26 | rule_any = {
27 | type = {'dialog'},
28 | class = {'Wicd-client.py', 'calendar.google.com'}
29 | },
30 | properties = {
31 | placement = awful.placement.centered,
32 | ontop = true,
33 | floating = true,
34 | drawBackdrop = true,
35 | shape = function()
36 | return function(cr, w, h)
37 | gears.shape.rounded_rect(cr, w, h, 8)
38 | end
39 | end,
40 | skip_decoration = true
41 | }
42 | }, {
43 | rule_any = {
44 | type = {'modal'}
45 | },
46 | properties = {
47 | titlebars_enabled = true,
48 | floating = true,
49 | above = true,
50 | skip_decoration = true,
51 | placement = awful.placement.centered
52 | }
53 | }, {
54 | rule_any = {
55 | type = {'utility'}
56 | },
57 | properties = {
58 | titlebars_enabled = false,
59 | floating = true,
60 | skip_decoration = true,
61 | placement = awful.placement.centered
62 | }
63 | }, {
64 | rule_any = {
65 | type = {'splash'},
66 | name = {'Discord Updater'}
67 | },
68 | properties = {
69 | floating = true,
70 | above = true,
71 | skip_decoration = true,
72 | placement = awful.placement.centered
73 | }
74 | }}
75 |
--------------------------------------------------------------------------------
/src/.config/awesome/module/splash-terminal.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local app = require('configuration.apps').default.splash
3 | local dpi = require('beautiful').xresources.apply_dpi
4 | local beautiful = require('beautiful')
5 | local screen = awful.screen.focused()
6 |
7 | -- Theme
8 | beautiful.init(require('theme'))
9 |
10 | local splash_id = 'notnil'
11 | local splash_client
12 | local opened = false
13 |
14 | function create_shell()
15 | splash_id = awful.spawn.with_shell(app)
16 | end
17 |
18 | -- Dirty hack to prevent splash from showing up in occupied tags
19 | function _splash_to_current_tag()
20 | if splash_client then
21 | splash_client:move_to_tag(screen.selected_tag)
22 | end
23 | end
24 |
25 | function open_splash()
26 | splash_client.hidden = false
27 | end
28 |
29 | function close_splash()
30 | splash_client.hidden = true
31 | end
32 |
33 | toggle_splash_height = function()
34 | if splash_client and opened then
35 | splash_client.maximized_vertical = not splash_client.maximized_vertical
36 | end
37 | end
38 |
39 | toggle_splash = function()
40 | opened = not opened
41 | if not splash_client then
42 | create_shell()
43 | else
44 | if opened then
45 | open_splash()
46 | client.focus = splash_client
47 | splash_client:raise()
48 | else
49 | close_splash()
50 | end
51 | end
52 | end
53 |
54 | _G.client.connect_signal('manage', function(c)
55 | if (c.pid == splash_id) then
56 | splash_client = c
57 | c.x = c.screen.geometry.x
58 | c.height = (c.screen.geometry.height / 5) * 3
59 | c.y = c.screen.geometry.height - c.height - beautiful.border_width - dpi(16)
60 | c.floating = true
61 | c.skip_decoration = true
62 | c.ontop = true
63 | c.floating = true
64 | c.above = true
65 | c.sticky = true
66 | c.type = 'splash'
67 | c.hidden = not opened
68 | c.border_width = beautiful.border_width
69 | c.maximized_horizontal = true
70 | end
71 | end)
72 |
73 | _G.client.connect_signal('unmanage', function(c)
74 | if (c.pid == splash_id) then
75 | opened = false
76 | splash_client = nil
77 | end
78 | end)
79 |
--------------------------------------------------------------------------------
/src/.config/awesome/theme/theme.lua:
--------------------------------------------------------------------------------
1 | local filesystem = require('gears.filesystem')
2 | local color_schemes = require('theme.color-schemes')
3 | local theme_dir = filesystem.get_configuration_dir() .. '/theme'
4 | local gears = require('gears')
5 | local dpi = require('beautiful').xresources.apply_dpi
6 | local theme = {}
7 |
8 | -- Color Scheme
9 | theme.primary = color_schemes.gruvbox_material.primary
10 | theme.accent = color_schemes.gruvbox_material.accent
11 |
12 | local awesome_overrides = function(theme)
13 | theme.dir = os.getenv('HOME') .. '/.config/awesome/theme'
14 |
15 | theme.icons = theme.dir .. '/icons/'
16 | theme.font = 'Robotomono nerd font bold 9' -- Glyphs don't work properly with this (#442)
17 | theme.icon_font = 'furamono nerd font 11' -- Fira mono patched version
18 |
19 | -- Layout icons
20 | theme.layout_txt_tile = "舘"
21 | theme.layout_txt_max = ""
22 | theme.layout_txt_floating = ""
23 |
24 | -- Taglist
25 | theme.taglist_font = theme.font
26 | theme.taglist_bg_empty = theme.primary.hue_100
27 | theme.taglist_bg_occupied = theme.primary.hue_200
28 | theme.taglist_bg_urgent = 'linear:0,0:0,' .. dpi(48) .. ':0,' ..
29 | theme.accent.hue_700 .. ':0.07,' ..
30 | theme.accent.hue_700 .. ':0.07,' ..
31 | theme.primary.hue_100 .. ':1,' ..
32 | theme.primary.hue_100
33 | theme.taglist_bg_focus = theme.accent.hue_200
34 | theme.taglist_fg_focus = theme.primary.hue_100
35 |
36 | -- Tasklist
37 | theme.tasklist_font = theme.font
38 | theme.tasklist_bg_normal = theme.primary.hue_100
39 | theme.tasklist_bg_focus = theme.primary.hue_200
40 | theme.tasklist_bg_urgent = theme.primary.hue_200
41 |
42 | -- Icons
43 | theme.icon_theme = 'Papirus'
44 |
45 | -- Client
46 | theme.gaps = dpi(2)
47 | theme.border_width = dpi(2)
48 | theme.border_focus = theme.accent.hue_200
49 | theme.border_normal = theme.primary.hue_100
50 | theme.gap_single_client = false
51 | theme.bg_normal = theme.primary.hue_100
52 | theme.cursor_warp = true
53 | theme.title_bar = false
54 | end
55 | return {theme = theme, awesome_overrides = awesome_overrides}
56 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/markup.lua:
--------------------------------------------------------------------------------
1 | -- Adopted from: https://github.com/lcpz/lain
2 |
3 | local format = string.format
4 | local setmetatable = setmetatable
5 |
6 | -- Lain markup util submodule
7 | -- lain.util.markup
8 | local markup = { fg = {}, bg = {} }
9 |
10 | -- Convenience tags
11 | function markup.bold(text) return format("%s", text) end
12 | function markup.italic(text) return format("%s", text) end
13 | function markup.strike(text) return format("%s", text) end
14 | function markup.underline(text) return format("%s", text) end
15 | function markup.monospace(text) return format("%s", text) end
16 | function markup.big(text) return format("%s", text) end
17 | function markup.small(text) return format("%s", text) end
18 |
19 | -- Set the font
20 | function markup.font(font, text)
21 | return format("%s", font, text)
22 | end
23 |
24 | -- Set the foreground
25 | function markup.fg.color(color, text)
26 | return format("%s", color, text)
27 | end
28 |
29 | -- Set the background
30 | function markup.bg.color(color, text)
31 | return format("%s", color, text)
32 | end
33 |
34 | -- Set foreground and background
35 | function markup.color(fg, bg, text)
36 | return format("%s", fg, bg, text)
37 | end
38 |
39 | -- Set font and foreground
40 | function markup.fontfg(font, fg, text)
41 | return format("%s", font, fg, text)
42 | end
43 |
44 | -- Set font and background
45 | function markup.fontbg(font, bg, text)
46 | return format("%s", font, bg, text)
47 | end
48 |
49 | -- Set font, foreground and background
50 | function markup.fontcolor(font, fg, bg, text)
51 | return format("%s", font, fg, bg, text)
52 | end
53 |
54 | -- link markup.{fg,bg}(...) calls to markup.{fg,bg}.color(...)
55 | setmetatable(markup.fg, { __call = function(_, ...) return markup.fg.color(...) end })
56 | setmetatable(markup.bg, { __call = function(_, ...) return markup.bg.color(...) end })
57 |
58 | -- link markup(...) calls to markup.fg.color(...)
59 | return setmetatable(markup, { __call = function(_, ...) return markup.fg.color(...) end })
--------------------------------------------------------------------------------
/src/.config/compton.conf:
--------------------------------------------------------------------------------
1 | # corner-radius = 8.0;
2 | # round-borders = 1;
3 |
4 | # Shadow
5 | shadow = true;
6 | no-dnd-shadow = false;
7 | no-dock-shadow = false;
8 | shadow-radius = 15.0;
9 | shadow-offset-x = -11;
10 | shadow-offset-y = -4.5;
11 | shadow-opacity = 0.16;
12 | # shadow-red = 0.0;
13 | # shadow-green = 0.0;
14 | # shadow-blue = 0.0;
15 | shadow-exclude = [
16 | "name = 'Notification'",
17 | "class_g = 'Conky'",
18 | "class_g = 'slop'",
19 | "class_g = 'Rofi'",
20 | "class_g ?= 'Notify-osd'",
21 | "class_g = 'Cairo-clock'",
22 | "_GTK_FRAME_EXTENTS@:c"
23 | ];
24 | #"window_type = 'splash'"
25 | # shadow-exclude = "n:e:Notification";
26 | # shadow-exclude-reg = "x10+0+0";
27 | # xinerama-shadow-crop = true;
28 |
29 | # Opacity
30 | menu-opacity = 1.0;
31 | inactive-opacity = 1.0;
32 | active-opacity = 1.0;
33 | frame-opacity = 1.0;
34 | inactive-opacity-override = false;
35 | # alpha-step = 0.06;
36 | # inactive-dim = 0.05;
37 | # inactive-dim-fixed = true;
38 | # blur-background = true;
39 | # blur-background-frame = true;
40 | # blur-strength = 20;
41 | # blur-background-fixed = true;
42 | # blur-background-exclude = [
43 | # "window_type = 'dock'",
44 | # "window_type = 'desktop'",
45 | # "class_g = 'slop'",
46 | # "WM_NAME@:s = 'SplashTerminal'",
47 | # "WM_NAME@:s = 'dropdown_terminal'",
48 | # "_GTK_FRAME_EXTENTS@:c"
49 | # ];
50 |
51 | # Fading
52 | fading = true;
53 | fade-delta = 4;
54 | fade-in-step = 0.1;
55 | fade-out-step = 0.1;
56 | no-fading-openclose = false;
57 | # no-fading-destroyed-argb = true;
58 | fade-exclude = [ ];
59 |
60 | # Other
61 | backend = "glx";
62 | mark-wmwin-focused = true;
63 | mark-ovredir-focused = true;
64 | # use-ewmh-active-win = true;
65 | detect-rounded-corners = true;
66 | detect-client-opacity = true;
67 | #refresh-rate = 0;
68 | #vsync = "none";
69 | dbe = false;
70 | # sw-opti = true;
71 | #unredir-if-possible = true;
72 | # unredir-if-possible-delay = 5000;
73 | # unredir-if-possible-exclude = [ ];
74 | focus-exclude = [ "class_g = 'Cairo-clock'" ];
75 | detect-transient = true;
76 | detect-client-leader = true;
77 | invert-color-include = [ ];
78 | # resize-damage = 1;
79 |
80 | # GLX backend
81 | vsync="opengl-swc";
82 | unredir-if-possible=true;
83 | # paint-on-overlay=true;
84 | #glx-no-stencil=true;
85 | glx-copy-from-front=false;
86 | # glx-no-stencil = true;
87 | # glx-copy-from-front = false;
88 | # glx-use-copysubbuffermesa = true;
89 | glx-no-rebind-pixmap = true;
90 | #glx-swap-method = "exchange";
91 | #glx-use-gpushader4 = true;
92 | # xrender-sync = true;
93 | # xrender-sync-fence = true;
94 |
95 | # Window type settings
96 | wintypes:
97 | {
98 | tooltip = {
99 | fade = true;
100 | shadow = true;
101 | focus = true;
102 | };
103 | };
104 |
--------------------------------------------------------------------------------
/src/.config/awesome/module/decorate-client.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local gears = require('gears')
3 | local beautiful = require('beautiful')
4 | local dpi = require('beautiful').xresources.apply_dpi
5 |
6 | local function renderClient(client, mode)
7 | if client.skip_decoration or (client.rendering_mode == mode) then
8 | return
9 | end
10 |
11 | client.rendering_mode = mode
12 | client.floating = false
13 | client.maximized = false
14 | client.above = false
15 | client.below = false
16 | client.ontop = false
17 | client.sticky = false
18 | client.maximized_horizontal = false
19 | client.maximized_vertical = false
20 |
21 | client.border_width = beautiful.border_width
22 | client.shape = function(cr, w, h)
23 | gears.shape.rectangle(cr, w, h)
24 | end
25 | end
26 |
27 | local changesOnScreenCalled = false
28 |
29 | local function changesOnScreen(currentScreen)
30 | local tagIsMax = currentScreen.selected_tag ~= nil and currentScreen.selected_tag.layout == awful.layout.suit.max
31 | local clientsToManage = {}
32 |
33 | for _, client in pairs(currentScreen.clients) do
34 | if not client.skip_decoration and not client.hidden then
35 | table.insert(clientsToManage, client)
36 | end
37 | end
38 |
39 | if (tagIsMax or #clientsToManage == 1) then
40 | currentScreen.client_mode = 'maximized'
41 | else
42 | currentScreen.client_mode = 'tiled'
43 | end
44 |
45 | for _, client in pairs(clientsToManage) do
46 | renderClient(client, currentScreen.client_mode)
47 | end
48 | changesOnScreenCalled = false
49 | end
50 |
51 | function clientCallback(client)
52 | if not changesOnScreenCalled then
53 | if not client.skip_decoration and client.screen then
54 | changesOnScreenCalled = true
55 | local screen = client.screen
56 | gears.timer.delayed_call(function()
57 | changesOnScreen(screen)
58 | end)
59 | end
60 | end
61 | end
62 |
63 | function tagCallback(tag)
64 | if not changesOnScreenCalled then
65 | if tag.screen then
66 | changesOnScreenCalled = true
67 | local screen = tag.screen
68 | gears.timer.delayed_call(function()
69 | changesOnScreen(screen)
70 | end)
71 | end
72 | end
73 | end
74 |
75 | _G.client.connect_signal('manage', clientCallback)
76 |
77 | _G.client.connect_signal('unmanage', clientCallback)
78 |
79 | _G.client.connect_signal('property::hidden', clientCallback)
80 |
81 | _G.client.connect_signal('property::minimized', clientCallback)
82 |
83 | _G.client.connect_signal('property::fullscreen', function(c)
84 | if c.fullscreen then
85 | renderClient(c, 'maximized')
86 | else
87 | clientCallback(c)
88 | end
89 | end)
90 |
91 | _G.tag.connect_signal('property::selected', tagCallback)
92 |
93 | _G.tag.connect_signal('property::layout', tagCallback)
94 |
--------------------------------------------------------------------------------
/src/.config/awesome/rc.lua:
--------------------------------------------------------------------------------
1 | require('awful.autofocus')
2 | local gears = require('gears')
3 | local awful = require('awful')
4 | local naughty = require('naughty')
5 | local dpi = require('beautiful').xresources.apply_dpi
6 | local beautiful = require('beautiful')
7 |
8 | -- Theme
9 | beautiful.init(require('theme'))
10 |
11 | -- Layout
12 | require('layout')
13 |
14 | -- Init all modules
15 | require('module.notifications')
16 | require('module.auto-start')
17 | require('module.decorate-client')
18 | require('module.splash-terminal')
19 |
20 | -- Setup all configurations
21 | require('configuration.client')
22 | require('configuration.tags')
23 | _G.root.keys(require('configuration.keys.global'))
24 |
25 | -- Signal function to execute when a new client appears.
26 | _G.client.connect_signal('manage', function(c)
27 | -- Set the windows at the slave,
28 | -- i.e. put it at the end of others instead of setting it master.
29 | if not _G.awesome.startup then
30 | awful.client.setslave(c)
31 | end
32 |
33 | if _G.awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
34 | -- Prevent clients from being unreachable after screen count changes.
35 | awful.placement.no_offscreen(c)
36 | end
37 | end)
38 |
39 | -- Move cursor to focused window
40 | function Move_mouse_onto_focused_client()
41 | local c = _G.client.focus
42 | gears.timer({
43 | timeout = 0.1,
44 | autostart = true,
45 | single_shot = true,
46 | callback = function()
47 | if _G.mouse.object_under_pointer() ~= c then
48 | local geometry = c:geometry()
49 | local x = geometry.x + geometry.width / 2
50 | local y = geometry.y + geometry.height / 2
51 | _G.mouse.coords({
52 | x = x,
53 | y = y
54 | }, true)
55 | end
56 | end
57 | })
58 | end
59 |
60 | if beautiful.cursor_warp then
61 | _G.client.connect_signal("focus", Move_mouse_onto_focused_client)
62 | _G.client.connect_signal("swapped", Move_mouse_onto_focused_client)
63 | end
64 |
65 | -- Enable sloppy focus, so that focus follows mouse.
66 | _G.client.connect_signal('mouse::enter', function(c)
67 | c:emit_signal('request::activate', 'mouse_enter', {
68 | raise = true
69 | })
70 | end)
71 |
72 | -- Make the focused window have a glowing border
73 | _G.client.connect_signal('focus', function(c)
74 | c.border_color = beautiful.border_focus
75 | end)
76 | _G.client.connect_signal('unfocus', function(c)
77 | c.border_color = beautiful.border_normal
78 | end)
79 |
80 | if beautiful.title_bar then
81 | -- Enable smart borders (https://github.com/intrntbrn/smart_borders)
82 | require('module.smart-borders') {
83 | show_button_tooltips = true,
84 | border_width = dpi(16),
85 | rounded_corner = dpi(0),
86 | positions = {"bottom"},
87 | button_positions = {"bottom"},
88 | button_size = dpi(40),
89 | color_focus = beautiful.primary.hue_200,
90 | color_normal = beautiful.primary.hue_100
91 | }
92 | end
93 |
--------------------------------------------------------------------------------
/src/.config/rofi/config.rasi:
--------------------------------------------------------------------------------
1 | configuration {
2 | show-icons: true;
3 | disable-history: false;
4 | fullscreen: false;
5 | hide-scrollbar: true;
6 | sidebar-mode: false;
7 | }
8 |
9 | * {
10 | al: #00000000;
11 | bg: #000000cc;
12 | se: #FFFFFF0d;
13 | fg: #FFFFFFcc;
14 | ac: #FFFFFFcc;
15 | pt: #000000cc;
16 | }
17 |
18 | window {
19 | transparency: "real";
20 | background-color: @bg;
21 | text-color: @fg;
22 | border: 0px;
23 | border-color: @ac;
24 | width: 30%;
25 | height: 100%;
26 | location: west;
27 | x-offset: 0;
28 | y-offset: 0;
29 | font: "Ubuntu Bold 11";
30 | }
31 |
32 | entry {
33 | background-color: @al;
34 | text-color: @fg;
35 | placeholder-color: @bg;
36 | expand: true;
37 | horizontal-align: 0;
38 | blink: true;
39 | font: "Ubuntu Bold 18";
40 | }
41 |
42 | inputbar {
43 | children: [ entry ];
44 | background-color: @bg;
45 | text-color: @fg;
46 | expand: false;
47 | border: 0% 0% 0% 0%;
48 | border-radius: 0px;
49 | border-color: @ac;
50 | margin: 0% 0% 0% 0%;
51 | padding: 1.5%;
52 | }
53 |
54 | listview {
55 | padding: 1%;
56 | background-color: @al;
57 | columns: 1;
58 | lines: 5;
59 | spacing: 0%;
60 | cycle: false;
61 | dynamic: true;
62 | layout: vertical;
63 | }
64 |
65 | mainbox {
66 | background-color: @al;
67 | border: 0% 0% 0% 0%;
68 | border-radius: 0% 0% 0% 0%;
69 | border-color: @ac;
70 | children: [ inputbar, listview ];
71 | spacing: 0%;
72 | padding: 0%;
73 | }
74 |
75 | element {
76 | background-color: @al;
77 | text-color: @fg;
78 | orientation: vertical;
79 | border-radius: 0%;
80 | padding: 2% 0% 2% 1%;
81 | }
82 |
83 | element-icon {
84 | size: 64px;
85 | border: 0px;
86 | }
87 |
88 | element-text {
89 | expand: true;
90 | horizontal-align: 0.5;
91 | vertical-align: 0.5;
92 | margin: 0.5% 0.5% 0.5% 0.5%;
93 | }
94 |
95 | element selected {
96 | background-color: @se;
97 | text-color: @fg;
98 | border-color: @fg;
99 | border: 0 0 0 5px solid;
100 | padding: 15px;
101 | }
102 |
--------------------------------------------------------------------------------
/src/.config/nvim/src/fzf.vim:
--------------------------------------------------------------------------------
1 | " This is the default extra key bindings
2 | let g:fzf_action = {
3 | \ 'ctrl-t': 'tab split',
4 | \ 'ctrl-x': 'split',
5 | \ 'ctrl-v': 'vsplit' }
6 |
7 | " Enable per-command history.
8 | " CTRL-N and CTRL-P will be automatically bound to next-history and
9 | " previous-history instead of down and up. If you don't like the change,
10 | " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
11 | let g:fzf_history_dir = '~/.local/share/fzf-history'
12 | let g:fzf_buffers_jump = 1
13 |
14 | " map :Files
15 | " map b :Buffers
16 | " nnoremap g :Rg
17 | " nnoremap t :Tags
18 | " nnoremap m :Marks
19 |
20 |
21 | let g:fzf_tags_command = 'ctags -R'
22 | " Border color
23 | let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } }
24 |
25 | let $FZF_DEFAULT_OPTS = '--layout=reverse --inline-info'
26 | let $FZF_DEFAULT_COMMAND="rg --files --hidden --glob '!.git/**'"
27 | "-g '!{node_modules,.git}'
28 |
29 | " Customize fzf colors to match your color scheme
30 | let g:fzf_colors =
31 | \ { 'fg': ['fg', 'Normal'],
32 | \ 'bg': ['bg', 'Normal'],
33 | \ 'hl': ['fg', 'Comment'],
34 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
35 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
36 | \ 'hl+': ['fg', 'Statement'],
37 | \ 'info': ['fg', 'PreProc'],
38 | \ 'border': ['fg', 'Ignore'],
39 | \ 'prompt': ['fg', 'Conditional'],
40 | \ 'pointer': ['fg', 'Exception'],
41 | \ 'marker': ['fg', 'Keyword'],
42 | \ 'spinner': ['fg', 'Label'],
43 | \ 'header': ['fg', 'Comment'] }
44 |
45 | "Get Files
46 | command! -bang -nargs=? -complete=dir Files
47 | \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--inline-info']}), 0)
48 |
49 |
50 | " Get text in files with Rg
51 | " command! -bang -nargs=* Rg
52 | " \ call fzf#vim#grep(
53 | " \ "rg --column --line-number --no-heading --color=always --smart-case --glob '!.git/**' ".shellescape(), 1,
54 |
55 | " Make Ripgrep ONLY search file contents and not filenames
56 | command! -bang -nargs=* Rg
57 | \ call fzf#vim#grep(
58 | \ 'rg --column --line-number --hidden --smart-case --no-heading --color=always '.shellescape(), 1,
59 | \ 0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%')
60 | \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4.. -e'}, 'right:50%', '?'),
61 | \ 0)
62 |
63 | " Ripgrep advanced
64 | function! RipgrepFzf(query, fullscreen)
65 | let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
66 | let initial_command = printf(command_fmt, shellescape(a:query))
67 | let reload_command = printf(command_fmt, '{q}')
68 | let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
69 | call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
70 | endfunction
71 |
72 | command! -nargs=* -bang RG call RipgrepFzf(, 0)
73 |
74 | " Git grep
75 | command! -bang -nargs=* GGrep
76 | \ call fzf#vim#grep(
77 | \ 'git grep --line-number '.shellescape(), 0,
78 | \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0)
79 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/separator.lua:
--------------------------------------------------------------------------------
1 | -- Adopted from: https://github.com/lcpz/lain/
2 |
3 | local wibox = require("wibox")
4 | local gears = require("gears")
5 |
6 | -- Lain Cairo separators util submodule
7 | -- lain.util.separators
8 | local separators = { height = 0, width = 9 }
9 |
10 | -- [[ Arrow
11 |
12 | -- Right
13 | function separators.arrow_right(col1, col2)
14 | local widget = wibox.widget.base.make_widget()
15 | widget.col1 = col1
16 | widget.col2 = col2
17 |
18 | widget.fit = function(_, _, _)
19 | return separators.width, separators.height
20 | end
21 |
22 | widget.update = function(_, _)
23 | widget.col1 = col1
24 | widget.col2 = col2
25 | widget:emit_signal("widget::redraw_needed")
26 | end
27 |
28 | widget.draw = function(_, _, cr, width, height)
29 | if widget.col2 ~= "alpha" then
30 | cr:set_source_rgba(gears.color.parse_color(widget.col2))
31 | cr:new_path()
32 | cr:move_to(0, 0)
33 | cr:line_to(width, height/2)
34 | cr:line_to(width, 0)
35 | cr:close_path()
36 | cr:fill()
37 |
38 | cr:new_path()
39 | cr:move_to(0, height)
40 | cr:line_to(width, height/2)
41 | cr:line_to(width, height)
42 | cr:close_path()
43 | cr:fill()
44 | end
45 |
46 | if widget.col1 ~= "alpha" then
47 | cr:set_source_rgba(gears.color.parse_color(widget.col1))
48 | cr:new_path()
49 | cr:move_to(0, 0)
50 | cr:line_to(width, height/2)
51 | cr:line_to(0, height)
52 | cr:close_path()
53 | cr:fill()
54 | end
55 | end
56 |
57 | return widget
58 | end
59 |
60 | -- Left
61 | function separators.arrow_left(col1, col2)
62 | local widget = wibox.widget.base.make_widget()
63 | widget.col1 = col1
64 | widget.col2 = col2
65 |
66 | widget.fit = function(_, _, _)
67 | return separators.width, separators.height
68 | end
69 |
70 | widget.update = function(c1, c2)
71 | widget.col1 = c1
72 | widget.col2 = c2
73 | widget:emit_signal("widget::redraw_needed")
74 | end
75 |
76 | widget.draw = function(_, _, cr, width, height)
77 | if widget.col1 ~= "alpha" then
78 | cr:set_source_rgba(gears.color.parse_color(widget.col1))
79 | cr:new_path()
80 | cr:move_to(width, 0)
81 | cr:line_to(0, height/2)
82 | cr:line_to(0, 0)
83 | cr:close_path()
84 | cr:fill()
85 |
86 | cr:new_path()
87 | cr:move_to(width, height)
88 | cr:line_to(0, height/2)
89 | cr:line_to(0, height)
90 | cr:close_path()
91 | cr:fill()
92 | end
93 |
94 | if widget.col2 ~= "alpha" then
95 | cr:new_path()
96 | cr:move_to(width, 0)
97 | cr:line_to(0, height/2)
98 | cr:line_to(width, height)
99 | cr:close_path()
100 |
101 | cr:set_source_rgba(gears.color.parse_color(widget.col2))
102 | cr:fill()
103 | end
104 | end
105 |
106 | return widget
107 | end
108 |
109 | -- ]]
110 |
111 | return separators
112 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/slider.lua:
--------------------------------------------------------------------------------
1 | -- Default widget requirements
2 | local base = require('wibox.widget.base')
3 | local gtable = require('gears.table')
4 | local setmetatable = setmetatable
5 | local dpi = require('beautiful').xresources.apply_dpi
6 |
7 | -- Commons requirements
8 | local wibox = require('wibox')
9 | local gears = require('gears')
10 | local beautiful = require('beautiful')
11 | local mat_colors = require('theme.mat-colors')
12 | -- Local declarations
13 |
14 | local mat_slider = {
15 | mt = {}
16 | }
17 |
18 | local properties = {
19 | read_only = false
20 | }
21 |
22 | function mat_slider:set_value(value)
23 | if self._private.value ~= value then
24 | self._private.value = value
25 | self._private.progress_bar:set_value(self._private.value)
26 | self._private.slider:set_value(self._private.value)
27 | self:emit_signal('property::value')
28 | -- self:emit_signal('widget::layout_changed')
29 | end
30 | end
31 |
32 | function mat_slider:get_value(value)
33 | return self._private.value
34 | end
35 |
36 | function mat_slider:set_read_only(value)
37 | if self._private.read_only ~= value then
38 | self._private.read_only = value
39 | self:emit_signal('property::read_only')
40 | self:emit_signal('widget::layout_changed')
41 | end
42 | end
43 |
44 | function mat_slider:get_read_only(value)
45 | return self._private.read_only
46 | end
47 |
48 | function mat_slider:layout(_, width, height)
49 | local layout = {}
50 | table.insert(layout, base.place_widget_at(self._private.progress_bar, 0, dpi(21), width, height - dpi(42)))
51 | if (not self._private.read_only) then
52 | table.insert(layout, base.place_widget_at(self._private.slider, 0, dpi(6), width, height - dpi(12)))
53 | end
54 | return layout
55 | end
56 |
57 | function mat_slider:draw(_, cr, width, height)
58 | if (self._private.read_only) then
59 | self._private.slider.forced_height = 0
60 | end
61 | end
62 |
63 | function mat_slider:fit(_, width, height)
64 | return width, height
65 | end
66 |
67 | local function new(args)
68 | local ret = base.make_widget(nil, nil, {
69 | enable_properties = true
70 | })
71 |
72 | gtable.crush(ret._private, args or {})
73 |
74 | gtable.crush(ret, mat_slider, true)
75 |
76 | ret._private.progress_bar = wibox.widget {
77 | max_value = 100,
78 | value = 25,
79 | forced_height = dpi(6),
80 | paddings = 0,
81 | shape = gears.shape.rounded_rect,
82 | background_color = beautiful.primary.hue_100,
83 | color = beautiful.accent.hue_400,
84 | widget = wibox.widget.progressbar
85 | }
86 |
87 | ret._private.slider = wibox.widget {
88 | forced_height = dpi(8),
89 | bar_shape = gears.shape.rounded_rect,
90 | bar_height = 0,
91 | bar_color = beautiful.accent.hue_500,
92 | handle_color = beautiful.accent.hue_300,
93 | handle_shape = gears.shape.circle,
94 | handle_border_color = '#00000012',
95 | handle_border_width = dpi(3),
96 | value = 25,
97 | widget = wibox.widget.slider
98 | }
99 |
100 | ret._private.slider:connect_signal('property::value', function()
101 | ret:set_value(ret._private.slider.value)
102 | end)
103 |
104 | ret._private.read_only = false
105 |
106 | return ret
107 | end
108 |
109 | function mat_slider.mt:__call(...)
110 | return new(...)
111 | end
112 |
113 | -- @DOC_widget_COMMON@
114 |
115 | -- @DOC_object_COMMON@
116 |
117 | return setmetatable(mat_slider, mat_slider.mt)
118 |
--------------------------------------------------------------------------------
/src/.bashrc:
--------------------------------------------------------------------------------
1 | # Check Interactive
2 | [[ $- != *i* ]] && return
3 |
4 | colors() {
5 | local fgc bgc vals seq0
6 |
7 | printf "Color escapes are %s\n" '\e[${value};...;${value}m'
8 | printf "Values 30..37 are \e[33mforeground colors\e[m\n"
9 | printf "Values 40..47 are \e[43mbackground colors\e[m\n"
10 | printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
11 |
12 | # foreground colors
13 | for fgc in {30..37}; do
14 | # background colors
15 | for bgc in {40..47}; do
16 | fgc=${fgc#37} # white
17 | bgc=${bgc#40} # black
18 |
19 | vals="${fgc:+$fgc;}${bgc}"
20 | vals=${vals%%;}
21 |
22 | seq0="${vals:+\e[${vals}m}"
23 | printf " %-9s" "${seq0:-(default)}"
24 | printf " ${seq0}TEXT\e[m"
25 | printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
26 | done
27 | echo; echo
28 | done
29 | }
30 | [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
31 | use_color=true
32 |
33 | # Fallback Prompt
34 | # ===============
35 | # Set colorful PS1 only on colorful terminals.
36 | # dircolors --print-database uses its own built-in database
37 | # instead of using /etc/DIR_COLORS. Try to use the external file
38 | # first to take advantage of user additions. Use internal bash
39 | # globbing instead of external grep binary.
40 | safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
41 | match_lhs=""
42 | [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
43 | [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \
46 | && match_lhs=$(dircolors --print-database)
47 | [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
48 |
49 | if ${use_color} ; then
50 | # Enable colors for ls, etc. Prefer ~/.dir_colors
51 | if type -P dircolors >/dev/null ; then
52 | if [[ -f ~/.dir_colors ]] ; then
53 | eval $(dircolors -b ~/.dir_colors)
54 | elif [[ -f /etc/DIR_COLORS ]] ; then
55 | eval $(dircolors -b /etc/DIR_COLORS)
56 | fi
57 | fi
58 |
59 | if [[ ${EUID} == 0 ]] ; then
60 | PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
61 | else
62 | PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
63 | fi
64 |
65 | alias ls='ls --color=auto'
66 | alias grep='grep --colour=auto'
67 | alias egrep='egrep --colour=auto'
68 | alias fgrep='fgrep --colour=auto'
69 | else
70 | if [[ ${EUID} == 0 ]] ; then
71 | # show root@ when we don't have colors
72 | PS1='\u@\h \W \$ '
73 | else
74 | PS1='\u@\h \w \$ '
75 | fi
76 | fi
77 | unset use_color safe_term match_lhs sh
78 | xhost +local:root > /dev/null 2>&1
79 | complete -cf sudo
80 |
81 | # Starship bash prompt
82 | # ====================
83 | # Install using -> curl -fsSL https://starship.rs/install.sh | bash
84 | # To use as prompt -> eval "$(starship init bash)"
85 | eval "$(starship init bash 2>/dev/null)"
86 |
87 | # Set shell options
88 | # =================
89 | shopt -s checkwinsize
90 | shopt -s expand_aliases
91 | shopt -s histappend # Enable history appending instead of overwriting.
92 |
93 | # SUSPEND CTRL + S
94 | stty -ixon
95 |
96 | # Other Aliases
97 | alias cp="cp -i" # confirm before overwriting something
98 | alias df='df -h' # human-readable sizes
99 | alias free='free -m' # show sizes in MB
100 | alias np='nano -w PKGBUILD'
101 | alias more=less
102 | alias ll='ls -alF'
103 | alias la='ls -A'
104 | alias l='ls -CF'
105 | alias nv='nvim'
106 |
107 | # switch between shells
108 | alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
109 | alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
110 | alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
111 | source "$HOME/.cargo/env"
112 |
113 | [ -f ~/.fzf.bash ] && source ~/.fzf.bash
114 |
115 |
--------------------------------------------------------------------------------
/src/.config/zsh/keybindings.zsh:
--------------------------------------------------------------------------------
1 | # Keybindings adapted from :https://github.com/ohmyzsh/ohmyzsh/
2 | # All credit goes to the creators of oh-my-zsh
3 |
4 | # Make sure that the terminal is in application mode when zle is active, since
5 | # only then values from $terminfo are valid
6 | if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
7 | function zle-line-init() {
8 | echoti smkx
9 | }
10 | function zle-line-finish() {
11 | echoti rmkx
12 | }
13 | zle -N zle-line-init
14 | zle -N zle-line-finish
15 | fi
16 |
17 | # [PageUp] - Up a line of history
18 | if [[ -n "${terminfo[kpp]}" ]]; then
19 | bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
20 | bindkey -M viins "${terminfo[kpp]}" up-line-or-history
21 | bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
22 | fi
23 | # [PageDown] - Down a line of history
24 | if [[ -n "${terminfo[knp]}" ]]; then
25 | bindkey -M emacs "${terminfo[knp]}" down-line-or-history
26 | bindkey -M viins "${terminfo[knp]}" down-line-or-history
27 | bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
28 | fi
29 |
30 | # Start typing + [Up-Arrow] - fuzzy find history forward
31 | if [[ -n "${terminfo[kcuu1]}" ]]; then
32 | autoload -U up-line-or-beginning-search
33 | zle -N up-line-or-beginning-search
34 |
35 | bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
36 | bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
37 | bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
38 | fi
39 | # Start typing + [Down-Arrow] - fuzzy find history backward
40 | if [[ -n "${terminfo[kcud1]}" ]]; then
41 | autoload -U down-line-or-beginning-search
42 | zle -N down-line-or-beginning-search
43 |
44 | bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
45 | bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
46 | bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
47 | fi
48 |
49 | # [Home] - Go to beginning of line
50 | if [[ -n "${terminfo[khome]}" ]]; then
51 | bindkey -M emacs "${terminfo[khome]}" beginning-of-line
52 | bindkey -M viins "${terminfo[khome]}" beginning-of-line
53 | bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
54 | fi
55 | # [End] - Go to end of line
56 | if [[ -n "${terminfo[kend]}" ]]; then
57 | bindkey -M emacs "${terminfo[kend]}" end-of-line
58 | bindkey -M viins "${terminfo[kend]}" end-of-line
59 | bindkey -M vicmd "${terminfo[kend]}" end-of-line
60 | fi
61 |
62 | # [Shift-Tab] - move through the completion menu backwards
63 | if [[ -n "${terminfo[kcbt]}" ]]; then
64 | bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
65 | bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
66 | bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
67 | fi
68 |
69 | # [Backspace] - delete backward
70 | bindkey -M emacs '^?' backward-delete-char
71 | bindkey -M viins '^?' backward-delete-char
72 | bindkey -M vicmd '^?' backward-delete-char
73 | # [Delete] - delete forward
74 | if [[ -n "${terminfo[kdch1]}" ]]; then
75 | bindkey -M emacs "${terminfo[kdch1]}" delete-char
76 | bindkey -M viins "${terminfo[kdch1]}" delete-char
77 | bindkey -M vicmd "${terminfo[kdch1]}" delete-char
78 | else
79 | bindkey -M emacs "^[[3~" delete-char
80 | bindkey -M viins "^[[3~" delete-char
81 | bindkey -M vicmd "^[[3~" delete-char
82 |
83 | bindkey -M emacs "^[3;5~" delete-char
84 | bindkey -M viins "^[3;5~" delete-char
85 | bindkey -M vicmd "^[3;5~" delete-char
86 | fi
87 |
88 | # [Ctrl-Delete] - delete whole forward-word
89 | bindkey -M emacs '^[[3;5~' kill-word
90 | bindkey -M viins '^[[3;5~' kill-word
91 | bindkey -M vicmd '^[[3;5~' kill-word
92 |
93 | # [Ctrl-RightArrow] - move forward one word
94 | bindkey -M emacs '^[[1;5C' forward-word
95 | bindkey -M viins '^[[1;5C' forward-word
96 | bindkey -M vicmd '^[[1;5C' forward-word
97 | # [Ctrl-LeftArrow] - move backward one word
98 | bindkey -M emacs '^[[1;5D' backward-word
99 | bindkey -M viins '^[[1;5D' backward-word
100 | bindkey -M vicmd '^[[1;5D' backward-word
101 |
102 | # Edit the current command line in $EDITOR
103 | autoload -U edit-command-line
104 | zle -N edit-command-line
105 | bindkey '\C-x\C-e' edit-command-line
106 |
107 | # file rename magick
108 | bindkey "^[m" copy-prev-shell-word
--------------------------------------------------------------------------------
/src/.config/awesome/widget/battery.lua:
--------------------------------------------------------------------------------
1 | -------------------------------------------------
2 | -- Battery Widget for Awesome Window Manager
3 | -- Shows the battery status using the ACPI tool
4 | -- More details could be found here:
5 | -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/battery-widget
6 | -- @author Pavel Makhov
7 | -- @copyright 2017 Pavel Makhov
8 | -------------------------------------------------
9 | local awful = require('awful')
10 | local watch = require('awful.widget.watch')
11 | local wibox = require('wibox')
12 | local beautiful = require('beautiful')
13 | local dpi = require('beautiful').xresources.apply_dpi
14 |
15 | -- acpi sample outputs
16 | -- Battery 0: Discharging, 75%, 01:51:38 remaining
17 | -- Battery 0: Charging, 53%, 00:57:43 until charged
18 |
19 | local percentage = wibox.widget.textbox()
20 | local battery_icon = wibox.widget.textbox()
21 | battery_icon.font = beautiful.icon_font
22 |
23 | local battery_popup = awful.tooltip({
24 | objects = {percentage},
25 | mode = 'outside',
26 | align = 'left',
27 | preferred_positions = {'right', 'left', 'top', 'bottom'}
28 | })
29 |
30 | watch('acpi -i', 10, function(_, stdout)
31 | local battery_info = {}
32 | local capacities = {}
33 | for s in stdout:gmatch('[^\r\n]+') do
34 | local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?.*')
35 | if status ~= nil then
36 | table.insert(battery_info, {
37 | status = status,
38 | charge = tonumber(charge_str)
39 | })
40 | else
41 | local cap_str = string.match(s, '.+:.+last full capacity (%d+)')
42 | table.insert(capacities, tonumber(cap_str))
43 | end
44 | end
45 |
46 | local capacity = 0
47 | for _, cap in ipairs(capacities) do
48 | capacity = capacity + cap
49 | end
50 |
51 | local charge = 0
52 | local status
53 | for i, batt in ipairs(battery_info) do
54 | if batt.charge >= charge then
55 | status = batt.status -- use most charged battery status
56 | -- this is arbitrary, and maybe another metric should be used
57 | end
58 |
59 | charge = charge + batt.charge * capacities[i]
60 | end
61 | charge = charge / capacity
62 |
63 | battery_popup.text = string.gsub(stdout, '\n$', '')
64 | percentage.text = math.floor(charge)
65 |
66 | if status == 'Charging' then
67 | battery_icon.text = ''
68 | if math.floor(charge) <= 20 then
69 | battery_icon.text = ''
70 | elseif math.floor(charge) <= 30 then
71 | battery_icon.text = ''
72 | elseif math.floor(charge) <= 40 then
73 | battery_icon.text = ''
74 | elseif math.floor(charge) <= 60 then
75 | battery_icon.text = ''
76 | elseif math.floor(charge) <= 80 then
77 | battery_icon.text = ''
78 | elseif math.floor(charge) <= 90 then
79 | battery_icon.text = ''
80 | elseif math.floor(charge) <= 100 then
81 | battery_icon.text = ''
82 | end
83 | elseif status == 'Full' then
84 | battery_icon.text = ''
85 | else
86 | if math.floor(charge) <= 10 then
87 | battery_icon.text = ''
88 | elseif math.floor(charge) <= 20 then
89 | battery_icon.text = ''
90 | elseif math.floor(charge) <= 30 then
91 | battery_icon.text = ''
92 | elseif math.floor(charge) <= 40 then
93 | battery_icon.text = ''
94 | elseif math.floor(charge) <= 50 then
95 | battery_icon.text = ''
96 | elseif math.floor(charge) <= 60 then
97 | battery_icon.text = ''
98 | elseif math.floor(charge) <= 60 then
99 | battery_icon.text = ''
100 | elseif math.floor(charge) <= 80 then
101 | battery_icon.text = ''
102 | elseif math.floor(charge) <= 90 then
103 | battery_icon.text = ''
104 | elseif math.floor(charge) <= 100 then
105 | battery_icon.text = ''
106 | end
107 | end
108 | collectgarbage('collect')
109 | end)
110 |
111 | return wibox.widget {
112 | wibox.widget{
113 | battery_icon,
114 | fg = beautiful.accent.hue_300,
115 | widget = wibox.container.background
116 | },
117 | percentage,
118 | spacing = dpi(4),
119 | layout = wibox.layout.fixed.horizontal
120 | }
121 |
--------------------------------------------------------------------------------
/src/.config/nvim/coc-settings.json:
--------------------------------------------------------------------------------
1 | {
2 | // suggestions
3 | // "suggest.echodocSupport": true,
4 | // TODO add more labels and give them cool glyphs
5 | "suggest.completionItemKindLabels": {
6 | "text": "t",
7 | "method": "m",
8 | "function": ""
9 | },
10 | "snippets.priority": 1,
11 | //"yank.priority": 1,
12 | "suggest.languageSourcePriority": 99,
13 | "coc.source.file.priority": 2,
14 | "coc.source.around.priority": 3,
15 | "coc.source.buffer.priority": 4,
16 |
17 | // diagnostics
18 | "diagnostic.errorSign": " ",
19 | "diagnostic.warningSign": " ",
20 | "diagnostic.infoSign": "",
21 | "diagnostic.hintSign": " ",
22 | // "diagnostic.displayByAle": true,
23 | // "diagnostic.virtualText": true, // this won't work with codelens when error on same line
24 |
25 | // codelens
26 | "codeLens.enable": true,
27 | "java.referencesCodeLens.enabled": true,
28 | "java.implementationsCodeLens.enabled": true,
29 | "java.completion.enabled": true,
30 | "java.jdt.ls.vmargs": "-javaagent:/usr/local/share/lombok/lombok.jar",
31 |
32 | // list
33 | "list.indicator": ">",
34 | "list.selectedSignText": " ",
35 |
36 | // autoformat
37 | "coc.preferences.formatOnSaveFiletypes": [
38 | "css",
39 | "markdown",
40 | "javascript",
41 | "graphql",
42 | "html",
43 | "yaml",
44 | "json",
45 | "python",
46 | "java"
47 | ],
48 | "coc.preferences.hoverTarget": "float",
49 |
50 | // python config
51 | "python.analysis.autoImportCompletions": true,
52 | "python.analysis.autoSearchPaths": true,
53 | "python.analysis.diagnosticMode": "openFilesOnly",
54 | "python.analysis.stubPath": "typings",
55 | "python.analysis.typeshedPaths": [],
56 | "python.analysis.diagnosticSeverityOverrides": {},
57 | "python.analysis.typeCheckingMode": "basic",
58 | "python.analysis.useLibraryCodeForTypes": true,
59 | "python.pythonPath": "python",
60 | "python.venvPath": "",
61 | "python.formatting.provider": "black",
62 | "python.formatting.blackPath": "black",
63 | "python.formatting.blackArgs": [],
64 | "python.formatting.autopep8Path": "autopep8",
65 | "python.formatting.autopep8Args": [],
66 | "python.formatting.yapfPath": "yapf",
67 | "python.formatting.yapfArgs": [],
68 | "python.linting.enabled": true,
69 | "python.linting.flake8Enabled": false,
70 | "python.linting.banditEnabled": false,
71 | "python.linting.mypyEnabled": false,
72 | "python.linting.pytypeEnabled": false,
73 | "python.linting.prospectorEnabled": false,
74 | "python.linting.pydocstyleEnabled": false,
75 | "python.linting.pylamaEnabled": false,
76 | "python.linting.pylintEnabled": false,
77 | "pyright.disableCompletion": false,
78 | "pyright.disableLanguageServices": false,
79 | "pyright.disableOrganizeImports": false,
80 |
81 | // snippets
82 | "snippets.ultisnips.directories": ["UltiSnips", "~/.config/nvim/snips"],
83 | //"snippets.userSnippetsDirectory": "~/.config/nvim/snips",
84 |
85 | // emmet
86 | "emmet.includeLanguages": {
87 | "vue-html": "html",
88 | "javascript": "javascriptreact"
89 | },
90 |
91 | // CSS (disable since I'm also using stylelintplus)
92 | "css.validate": false,
93 | "less.validate": false,
94 | "scss.validate": false,
95 | "wxss.validate": false,
96 |
97 | // explorer
98 | "explorer.width": 30,
99 | "explorer.file.root.template": "[icon] [git] [hidden & 1][root]",
100 | "explorer.icon.enableNerdfont": true,
101 | "explorer.previewAction.onHover": false,
102 | "explorer.icon.enableVimDevicons": false,
103 | "explorer.file.showHiddenFiles": false,
104 | "explorer.keyMappings.global": {
105 | "": ["expandable?", "expand", "open"],
106 | "v": "open:vsplit"
107 | },
108 |
109 | "languageserver": {
110 | "lua": {
111 | "command": "/home/chris/.luambenvs/neovim4/bin/lua-lsp",
112 | "filetypes": ["lua"],
113 | "trace.server": "verbose"
114 | }
115 | },
116 |
117 | "bookmark.sign": "",
118 |
119 | //coc-emoji
120 | "coc.source.emoji.filetypes": ["markdown"]
121 |
122 | // lua
123 | //"lua.useSumnekoLs": true,
124 | //"lua.commandPath": "/home/chris/.luambenvs/neovim3/bin/lua-lsp"
125 | //"lua.enable": true,
126 | //"Lua.completion.enable": true,
127 | //"Lua.runtime.version": "Lua 5.1",
128 | //"Lua.runtime.path": ["?.lua", "?/init.lua", "?/?.lua"],
129 | //"lua.version": "5.1"
130 | //"lua.commandPath": "/home/chris/.vscode-insiders/extensions/sumneko.lua-1.0.5/server/bin/Linux/lua-language-server"
131 |
132 | // TODO b:coc_suggest_disable=1 GOYO
133 | // TODO add to paths.vim g:coc_node_path
134 | }
135 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/tag-list.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local wibox = require('wibox')
3 | local dpi = require('beautiful').xresources.apply_dpi
4 | local capi = {
5 | button = _G.button
6 | }
7 | local clickable_container = require('widget.material.clickable-container')
8 | local modkey = require('configuration.keys.mod').modKey
9 | --- Common method to create buttons.
10 | -- @tab buttons
11 | -- @param object
12 | -- @treturn table
13 | local function create_buttons(buttons, object)
14 | if buttons then
15 | local btns = {}
16 | for _, b in ipairs(buttons) do
17 | -- Create a proxy button object: it will receive the real
18 | -- press and release events, and will propagate them to the
19 | -- button object the user provided, but with the object as
20 | -- argument.
21 | local btn = capi.button {
22 | modifiers = b.modifiers,
23 | button = b.button
24 | }
25 | btn:connect_signal('press', function()
26 | b:emit_signal('press', object)
27 | end)
28 | btn:connect_signal('release', function()
29 | b:emit_signal('release', object)
30 | end)
31 | btns[#btns + 1] = btn
32 | end
33 |
34 | return btns
35 | end
36 | end
37 |
38 | local function list_update(w, buttons, label, data, objects)
39 | -- update the widgets, creating them if needed
40 | w:reset()
41 | for i, o in ipairs(objects) do
42 | local cache = data[o]
43 | local ib, tb, bgb, tbm, ibm, l, bg_clickable
44 | if cache then
45 | ib = cache.ib
46 | tb = cache.tb
47 | bgb = cache.bgb
48 | tbm = cache.tbm
49 | ibm = cache.ibm
50 | else
51 | ib = wibox.widget.imagebox()
52 | tb = wibox.widget.textbox()
53 | bgb = wibox.container.background()
54 | tbm = wibox.container.margin(tb, dpi(6), dpi(6), dpi(4), dpi(4))
55 | ibm = wibox.container.margin(ib, dpi(8), dpi(8), dpi(9), dpi(9))
56 | l = wibox.layout.fixed.horizontal()
57 | bg_clickable = clickable_container()
58 |
59 | -- All of this is added in a fixed widget
60 | l:fill_space(true)
61 | -- l:add(ibm)
62 | l:add(tbm)
63 | bg_clickable:set_widget(l)
64 |
65 | -- And all of this gets a background
66 | bgb:set_widget(bg_clickable)
67 |
68 | bgb:buttons(create_buttons(buttons, o))
69 |
70 | data[o] = {
71 | ib = ib,
72 | tb = tb,
73 | bgb = bgb,
74 | tbm = tbm,
75 | ibm = ibm
76 | }
77 | end
78 |
79 | local text, bg, bg_image, icon, args = label(o, tb)
80 | args = args or {}
81 |
82 | if text == nil or text == '' then
83 | tbm:set_margins(0)
84 | else
85 | if not tb:set_markup_silently(text) then
86 | tb:set_markup('<Invalid text>')
87 | end
88 | end
89 | bgb:set_bg(bg)
90 | if type(bg_image) == 'function' then
91 | bg_image = bg_image(tb, o, nil, objects, i)
92 | end
93 | bgb:set_bgimage(bg_image)
94 | if icon then
95 | ib.image = icon
96 | else
97 | ibm:set_margins(0)
98 | end
99 |
100 | bgb.shape = args.shape
101 |
102 | w:add(bgb)
103 | end
104 | end
105 |
106 | local TagList = function(s)
107 | return awful.widget.taglist(s, awful.widget.taglist.filter.all,
108 | awful.util.table.join(awful.button({}, 1, function(t)
109 | t:view_only()
110 | _G._splash_to_current_tag()
111 | end), awful.button({modkey}, 1, function(t)
112 | if _G.client.focus then
113 | _G.client.focus:move_to_tag(t)
114 | t:view_only()
115 | end
116 | _G._splash_to_current_tag()
117 | end), awful.button({modkey}, 3, function(t)
118 | if _G.client.focus then
119 | _G.client.focus:toggle_tag(t)
120 | end
121 | _G._splash_to_current_tag()
122 | end), awful.button({}, 4, function(t)
123 | awful.tag.viewprev(t.screen)
124 | _G._splash_to_current_tag()
125 | end), awful.button({}, 5, function(t)
126 | awful.tag.viewnext(t.screen)
127 | _G._splash_to_current_tag()
128 | end)), {}, list_update, wibox.layout.fixed.horizontal())
129 | end
130 | return TagList
131 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/task-list.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local wibox = require('wibox')
3 | local dpi = require('beautiful').xresources.apply_dpi
4 | local capi = {
5 | button = _G.button
6 | }
7 | local gears = require('gears')
8 | local clickable_container = require('widget.material.clickable-container')
9 | local tasklist_mode = 'text'
10 | local beautiful = require('beautiful')
11 | --- Common method to create buttons.
12 | -- @tab buttons
13 | -- @param object
14 | -- @treturn table
15 | local function create_buttons(buttons, object)
16 | if buttons then
17 | local btns = {}
18 | for _, b in ipairs(buttons) do
19 | -- Create a proxy button object: it will receive the real
20 | -- press and release events, and will propagate them to the
21 | -- button object the user provided, but with the object as
22 | -- argument.
23 | local btn = capi.button {
24 | modifiers = b.modifiers,
25 | button = b.button
26 | }
27 | btn:connect_signal('press', function()
28 | b:emit_signal('press', object)
29 | end)
30 | btn:connect_signal('release', function()
31 | b:emit_signal('release', object)
32 | end)
33 | btns[#btns + 1] = btn
34 | end
35 |
36 | return btns
37 | end
38 | end
39 |
40 | local function list_update(w, buttons, label, data, objects)
41 | -- update the widgets, creating them if needed
42 | w:reset()
43 | for i, o in ipairs(objects) do
44 | local cache = data[o]
45 | local ib, tb, bgb, tbm, ibm, l, ll, bg_clickable
46 | if cache then
47 | ib = cache.ib
48 | tb = cache.tb
49 | bgb = cache.bgb
50 | tbm = cache.tbm
51 | ibm = cache.ibm
52 | else
53 | ib = wibox.widget.imagebox()
54 | tb = wibox.widget.textbox()
55 | bg_clickable = clickable_container()
56 | bgb = wibox.container.background()
57 | tbm = wibox.container.margin(tb, dpi(4), dpi(4), dpi(1), dpi(1))
58 | ibm = wibox.container.margin(ib, dpi(1), dpi(1), dpi(1), dpi(1))
59 | l = wibox.layout.fixed.horizontal()
60 | ll = wibox.layout.flex.horizontal()
61 |
62 | -- All of this is added in a fixed widget
63 | l:fill_space(true)
64 | l:add(ibm)
65 | l:add(tbm)
66 | ll:add(l)
67 |
68 | bg_clickable:set_widget(ll)
69 | -- And all of this gets a background
70 | bgb:set_widget(bg_clickable)
71 |
72 | l:buttons(create_buttons(buttons, o))
73 |
74 | data[o] = {
75 | ib = ib,
76 | tb = tb,
77 | bgb = bgb,
78 | tbm = tbm,
79 | ibm = ibm
80 | }
81 | end
82 |
83 | local text, bg, bg_image, icon, args = label(o, tb)
84 | args = args or {}
85 |
86 | -- The text might be invalid, so use pcall.
87 | if tasklist_mode == 'icon' then
88 | text = nil
89 | elseif tasklist_mode == 'text' then
90 | icon = nil
91 | end
92 | if text == nil or text == '' then
93 | tbm:set_margins(0)
94 | else
95 | if not tb:set_markup_silently(text) then
96 | tb:set_markup('<Invalid text>')
97 | end
98 | end
99 | bgb:set_bg(bg)
100 | if type(bg_image) == 'function' then
101 | bg_image = bg_image(tb, o, nil, objects, i)
102 | end
103 | bgb:set_bgimage(bg_image)
104 | if icon then
105 | ib.image = icon
106 | ib.resize = true
107 | else
108 | ibm:set_margins(0)
109 | end
110 |
111 | bgb.shape = args.shape
112 | bgb.shape_border_width = args.shape_border_width
113 | bgb.shape_border_color = args.shape_border_color
114 | tb.align = 'center'
115 |
116 | w:add(bgb)
117 | end
118 | end
119 |
120 | local tasklist_buttons = awful.util.table.join(awful.button({}, 1, function(c)
121 | if c == _G.client.focus then
122 | c.minimized = true
123 | else
124 | -- Without this, the following
125 | -- :isvisible() makes no sense
126 | c.minimized = false
127 | if not c:isvisible() and c.first_tag then
128 | c.first_tag:view_only()
129 | end
130 | -- This will also un-minimize
131 | -- the client, if needed
132 | _G.client.focus = c
133 | c:raise()
134 | end
135 | end), awful.button({}, 4, function()
136 | awful.client.focus.byidx(1)
137 | end), awful.button({}, 5, function()
138 | awful.client.focus.byidx(-1)
139 | end), awful.button({}, 2, function(c)
140 | c.kill(c)
141 | end))
142 |
143 | local TaskList = function(s)
144 | return awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons, nil, list_update)
145 | end
146 |
147 | return TaskList
148 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/net.lua:
--------------------------------------------------------------------------------
1 | local wibox = require("wibox")
2 | local string = string
3 |
4 | local spawn = require("awful.spawn")
5 | local timer = require("gears.timer")
6 |
7 | -- Network infos
8 | -- lain.widget.net
9 |
10 | local function line_callback(cmd, callback)
11 | return spawn.with_line_callback(cmd, {
12 | stdout = function (line)
13 | callback(line)
14 | end,
15 | })
16 | end
17 |
18 | local timer_table = {}
19 |
20 | local function newtimer(name, timeout, fun, nostart, stoppable)
21 | if not name or #name == 0 then return end
22 | name = (stoppable and name) or timeout
23 | if not timer_table[name] then
24 | timer_table[name] = timer({ timeout = timeout })
25 | timer_table[name]:start()
26 | end
27 | timer_table[name]:connect_signal("timeout", fun)
28 | if not nostart then
29 | timer_table[name]:emit_signal("timeout")
30 | end
31 | return stoppable and timer_table[name]
32 | end
33 |
34 | local function first_line(path)
35 | local file, first = io.open(path, "rb"), nil
36 | if file then
37 | first = file:read("*l")
38 | file:close()
39 | end
40 | return first
41 | end
42 |
43 | local function lines_from(path)
44 | local lines = {}
45 | for line in io.lines(path) do
46 | lines[#lines + 1] = line
47 | end
48 | return lines
49 | end
50 |
51 | local function factory(args)
52 | args = args or {}
53 |
54 | local net = { widget = args.widget or wibox.widget.textbox(), devices = {} }
55 | local timeout = args.timeout or 2
56 | local units = args.units or 1024 -- KB
57 | local wifi_state = args.wifi_state or "off"
58 | local eth_state = args.eth_state or "off"
59 | local screen = args.screen or 1
60 | local settings = args.settings or function() end
61 |
62 | -- Compatibility with old API where iface was a string corresponding to 1 interface
63 | net.iface = (args.iface and (type(args.iface) == "string" and {args.iface}) or
64 | (type(args.iface) == "table" and args.iface)) or {}
65 |
66 | function net.get_devices()
67 | net.iface = {} -- reset at every call
68 | line_callback("ip link", function(line)
69 | net.iface[#net.iface + 1] = not string.match(line, "LOOPBACK") and string.match(line, "(%w+): <") or nil
70 | end)
71 | end
72 |
73 | if #net.iface == 0 then net.get_devices() end
74 |
75 | function net.update()
76 | -- These are the totals over all specified interfaces
77 | net_now = {
78 | devices = {},
79 | -- Bytes since last iteration
80 | sent = 0,
81 | received = 0
82 | }
83 |
84 | for _, dev in ipairs(net.iface) do
85 | local dev_now = {}
86 | local dev_before = net.devices[dev] or { last_t = 0, last_r = 0 }
87 | local now_t = tonumber(first_line(string.format("/sys/class/net/%s/statistics/tx_bytes", dev)) or 0)
88 | local now_r = tonumber(first_line(string.format("/sys/class/net/%s/statistics/rx_bytes", dev)) or 0)
89 |
90 | dev_now.carrier = first_line(string.format("/sys/class/net/%s/carrier", dev)) or "0"
91 | dev_now.state = first_line(string.format("/sys/class/net/%s/operstate", dev)) or "down"
92 |
93 | dev_now.sent = (now_t - dev_before.last_t) / timeout / units
94 | dev_now.received = (now_r - dev_before.last_r) / timeout / units
95 |
96 | net_now.sent = net_now.sent + dev_now.sent
97 | net_now.received = net_now.received + dev_now.received
98 |
99 | dev_now.sent = string.format("%.1f", dev_now.sent)
100 | dev_now.received = string.format("%.1f", dev_now.received)
101 |
102 | dev_now.last_t = now_t
103 | dev_now.last_r = now_r
104 |
105 | if wifi_state == "on" and first_line(string.format("/sys/class/net/%s/uevent", dev)) == "DEVTYPE=wlan" then
106 | dev_now.wifi = true
107 | if string.match(dev_now.carrier, "1") then
108 | dev_now.signal = tonumber(string.match(lines_from("/proc/net/wireless")[3], "(%-%d+%.)")) or nil
109 | end
110 | else
111 | dev_now.wifi = false
112 | end
113 |
114 | if eth_state == "on" and first_line(string.format("/sys/class/net/%s/uevent", dev)) ~= "DEVTYPE=wlan" then
115 | dev_now.ethernet = true
116 | else
117 | dev_now.ethernet = false
118 | end
119 |
120 | net.devices[dev] = dev_now
121 |
122 | net_now.carrier = dev_now.carrier
123 | net_now.state = dev_now.state
124 | net_now.devices[dev] = dev_now
125 | -- net_now.sent and net_now.received will be
126 | -- the totals across all specified devices
127 | end
128 |
129 | net_now.sent = string.format("%.1f", net_now.sent)
130 | net_now.received = string.format("%.1f", net_now.received)
131 |
132 | widget = net.widget
133 | settings()
134 | end
135 |
136 | newtimer("network", timeout, net.update)
137 |
138 | return net
139 | end
140 |
141 | return factory
--------------------------------------------------------------------------------
/src/.zshrc:
--------------------------------------------------------------------------------
1 | # If not running interactively, don't do anything
2 | [[ $- != *i* ]] && return
3 |
4 | # Enable colors and change prompt:
5 | autoload -U colors && colors # Load colors
6 | setopt autocd # Automatically cd into typed directory.
7 | stty stop undef # Disable ctrl-s to freeze terminal.
8 | setopt interactive_comments
9 |
10 | # Basic auto/tab complete:
11 | autoload -U compinit
12 | zstyle ':completion:*' menu select '' 'm:{a-zA-Z}={A-Za-z}'
13 | zmodload zsh/complist
14 | compinit
15 | _comp_options+=(globdots) # Include hidden files.
16 |
17 | # History in cache directory:
18 | HISTSIZE=1000000
19 | SAVEHIST=1000000
20 | HISTFILE=~/.cache/.zsh_history
21 |
22 | ### EXPORTS
23 | export TERM="xterm-256color" # getting proper colors
24 | export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
25 |
26 | ### SET VI MODE ###
27 | bindkey -v
28 | bindkey -v "^?" backward-delete-char # Backspace interferes with vi mode
29 | export KEYTIMEOUT=1
30 |
31 | # Use Beam cursor in Insert mode
32 | function zle-keymap-select {
33 | if [[ ${KEYMAP} == vicmd ]] ||
34 | [[ $1 = 'block' ]]; then
35 | echo -ne '\e[1 q'
36 | elif [[ ${KEYMAP} == main ]] ||
37 | [[ ${KEYMAP} == viins ]] ||
38 | [[ ${KEYMAP} = '' ]] ||
39 | [[ $1 = 'beam' ]]; then
40 | echo -ne '\e[5 q'
41 | fi
42 | }
43 | zle -N zle-keymap-select
44 | zle-line-init() {
45 | zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
46 | echo -ne "\e[5 q"
47 | }
48 | zle -N zle-line-init
49 | echo -ne '\e[5 q' # Use beam shape cursor on startup.
50 | preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
51 |
52 |
53 | ### PATH
54 | if [ -d "$HOME/.bin" ] ;
55 | then PATH="$HOME/.bin:$PATH"
56 | fi
57 |
58 | if [ -d "$HOME/.local/bin" ] ;
59 | then PATH="$HOME/.local/bin:$PATH"
60 | fi
61 |
62 | ### ARCHIVE EXTRACTION
63 | # usage: ex
64 | ex ()
65 | {
66 | if [ -f $1 ] ; then
67 | case $1 in
68 | *.tar.bz2) tar xjf $1 ;;
69 | *.tar.gz) tar xzf $1 ;;
70 | *.bz2) bunzip2 $1 ;;
71 | *.rar) unrar x $1 ;;
72 | *.gz) gunzip $1 ;;
73 | *.tar) tar xf $1 ;;
74 | *.tbz2) tar xjf $1 ;;
75 | *.tgz) tar xzf $1 ;;
76 | *.zip) unzip $1 ;;
77 | *.Z) uncompress $1;;
78 | *.7z) 7z x $1 ;;
79 | *.deb) ar x $1 ;;
80 | *.tar.xz) tar xf $1 ;;
81 | *.tar.zst) unzstd $1 ;;
82 | *) echo "'$1' cannot be extracted via ex()" ;;
83 | esac
84 | else
85 | echo "'$1' is not a valid file"
86 | fi
87 | }
88 |
89 |
90 | ### ALIASES ###
91 | # =========== #
92 | # switch between shells
93 | alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
94 | alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
95 | alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
96 |
97 | # navigation
98 | alias ..='cd ..'
99 | alias ...='cd ../..'
100 | alias .3='cd ../../..'
101 | alias .4='cd ../../../..'
102 | alias .5='cd ../../../../..'
103 |
104 | # Colorize grep output (good for log files)
105 | alias grep='grep --color=auto'
106 | alias egrep='egrep --color=auto'
107 | alias fgrep='fgrep --color=auto'
108 |
109 | # confirm before overwriting something
110 | alias cp="cp -i"
111 | alias mv='mv -i'
112 | alias rm='rm -i'
113 | alias np='nano -w PKGBUILD'
114 | alias more=less
115 |
116 | # Colorize ls output
117 | alias ls='ls --color=auto'
118 | alias ll='ls -alF --color=auto'
119 | alias la='ls -A --color=auto'
120 | alias l='ls -CF --color=auto'
121 |
122 | # adding flags
123 | alias df='df -h' # human-readable sizes
124 | alias free='free -m' # show sizes in MB
125 |
126 | # programs
127 | alias nv=nvim
128 |
129 | ## get top process eating memory
130 | alias psmem='ps auxf | sort -nr -k 4'
131 | alias psmem10='ps auxf | sort -nr -k 4 | head -10'
132 |
133 | ## get top process eating cpu ##
134 | alias pscpu='ps auxf | sort -nr -k 3'
135 | alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
136 |
137 | ### Fallback Prompt ###
138 | PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
139 |
140 | ### Starship Prompt ###
141 | # =================== #
142 | # Install using -> curl -fsSL https://starship.rs/install.sh | bash
143 | eval "$(starship init zsh 2>/dev/null)"
144 |
145 | ### PLUGIN CONFIGURATIONS ###
146 | # ========================= #
147 | # (Applicable for plugins installed in the section below)
148 | ### zsh-autosuggestions
149 | ZSH_AUTOSUGGEST_USE_ASYNC=true
150 | ZSH_AUTOSUGGEST_STRATEGY=(history completion match_prev_cmd)
151 |
152 | ### PLUGINS/KEYBINDINGS ###
153 | # ======================= #
154 | # (MUST be at the end of file)
155 | # Install using makefile at ~/.config/zsh... Ditch package managers
156 | plugins () {
157 | source ~/.config/zsh/keybindings.zsh
158 | source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
159 | source ~/.config/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
160 | source ~/.config/zsh/plugins/zsh-completions/zsh-completions.plugin.zsh # Better tab-completion
161 | }
162 | plugins || make -i -C ~/.config/zsh
163 |
164 | [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
165 |
166 |
--------------------------------------------------------------------------------
/src/.config/awesome/widget/material/list-item.lua:
--------------------------------------------------------------------------------
1 | -- Default widget requirements
2 | local base = require('wibox.widget.base')
3 | local gtable = require('gears.table')
4 | local setmetatable = setmetatable
5 | local dpi = require('beautiful').xresources.apply_dpi
6 |
7 | -- Commons requirements
8 | local wibox = require('wibox')
9 | local clickable_container = require('widget.material.clickable-container')
10 | -- Local declarations
11 |
12 | local mat_list_item = {
13 | mt = {}
14 | }
15 |
16 | function mat_list_item:build_separator()
17 | self._private.separator = wibox.widget {
18 | orientation = 'horizontal',
19 | forced_height = 1,
20 | opacity = 0.08,
21 | widget = wibox.widget.separator
22 | }
23 | self:emit_signal('widget::layout_changed')
24 | end
25 |
26 | function mat_list_item:build_clickable_container()
27 | self._private.clickable_container = wibox.widget {
28 | wibox.widget {
29 | widget = wibox.widget.textbox
30 | },
31 | widget = clickable_container
32 | }
33 | self:emit_signal('widget::layout_changed')
34 | end
35 |
36 | function mat_list_item:layout(_, width, height)
37 | local content_width = width - dpi(32)
38 | local content_x = dpi(dpi(16))
39 | local layout = {}
40 |
41 | -- Add divider if present
42 | if self._private.divider then
43 | table.insert(layout, base.place_widget_at(self._private.separator, 0, 0, width, 1))
44 | end
45 |
46 | -- Add clickable_container if clickable
47 | if self._private.clickable then
48 | table.insert(layout, base.place_widget_at(self._private.clickable_container, 0, 0, width, height))
49 | end
50 |
51 | if self._private.prefix then
52 | content_x = content_x + dpi(54)
53 | content_width = content_width - dpi(54)
54 | table.insert(layout, base.place_widget_at(self._private.prefix, dpi(16), 0, dpi(48), height))
55 | end
56 |
57 | if self._private.suffix then
58 | content_width = content_width - dpi(54)
59 | table.insert(layout, base.place_widget_at(self._private.suffix, width - dpi(40), dpi(12), width, height))
60 | end
61 | table.insert(layout, base.place_widget_at(self._private.content, content_x, 0, content_width, height))
62 | return layout
63 | end
64 |
65 | function mat_list_item:fit(_, width)
66 | return width, dpi(48)
67 | end
68 |
69 | ---- Properties ----
70 |
71 | -- Property clickable
72 | function mat_list_item:set_clickable(value)
73 | if self._private.clickable ~= value then
74 | self._private.clickable = value
75 | self:emit_signal('property::clickable')
76 | self:emit_signal('widget::layout_changed')
77 |
78 | if self._private.clickable and not self._private.clickable_container then
79 | self:build_clickable_container()
80 | end
81 | end
82 | end
83 |
84 | function mat_list_item:get_clickable()
85 | return self._private.clickable
86 | end
87 |
88 | -- Property divider
89 |
90 | function mat_list_item:set_divider(value)
91 | if self._private.divider ~= value then
92 | self._private.divider = value
93 | self:emit_signal('property::divider')
94 | self:emit_signal('widget::layout_changed')
95 |
96 | if self._private.divider and not self._private.separator then
97 | self:build_separator()
98 | end
99 | end
100 | end
101 |
102 | function mat_list_item:get_divider()
103 | return self._private.divider
104 | end
105 |
106 | function mat_list_item:set_prefix(widget)
107 | if widget then
108 | base.check_widget(widget)
109 | end
110 | self._private.prefix = widget
111 | self:emit_signal('widget::layout_changed')
112 | end
113 |
114 | function mat_list_item:get_prefix()
115 | return self._private.prefix
116 | end
117 |
118 | function mat_list_item:set_suffix(widget)
119 | if widget then
120 | base.check_widget(widget)
121 | end
122 | self._private.suffix = widget
123 | self:emit_signal('widget::layout_changed')
124 | end
125 |
126 | function mat_list_item:get_suffix()
127 | return self._private.suffix
128 | end
129 |
130 | --- The widget who will be the content.
131 | -- @property content
132 | -- @tparam widget widget The widget
133 |
134 | function mat_list_item:set_content(widget)
135 | if widget then
136 | base.check_widget(widget)
137 | end
138 | self._private.content = widget
139 | self:emit_signal('widget::layout_changed')
140 | end
141 |
142 | function mat_list_item:get_content()
143 | return self._private.content
144 | end
145 |
146 | -- Get the number of children element
147 | -- @treturn table The children
148 | function mat_list_item:get_children()
149 | return {self._private.widget}
150 | end
151 |
152 | -- Replace the layout children
153 | -- This layout only accept one children, all others will be ignored
154 | -- @tparam table children A table composed of valid widgets
155 | function mat_list_item:set_children(children)
156 | if not children[2] then
157 | self:set_content(children[1])
158 | else
159 | self:set_prefix(children[1])
160 | self:set_content(children[2])
161 | end
162 | if children[3] then
163 | self:set_suffix(children[3])
164 | end
165 | end
166 |
167 | local function new(widget)
168 | local ret = base.make_widget(nil, nil, {
169 | enable_properties = true
170 | })
171 |
172 | gtable.crush(ret, mat_list_item, true)
173 |
174 | ret._private.content = widget
175 | return ret
176 | end
177 |
178 | function mat_list_item.mt:__call(...)
179 | return new(...)
180 | end
181 |
182 | -- @DOC_widget_COMMON@
183 |
184 | -- @DOC_object_COMMON@
185 |
186 | return setmetatable(mat_list_item, mat_list_item.mt)
187 |
--------------------------------------------------------------------------------
/src/.config/nvim/src/coc.vim:
--------------------------------------------------------------------------------
1 | " Use tab for trigger completion with characters ahead and navigate.
2 | inoremap
3 | \ pumvisible() ? "\" :
4 | \ check_back_space() ? "\" :
5 | \ coc#refresh()
6 | inoremap pumvisible() ? "\" : "\"
7 |
8 | function! s:check_back_space() abort
9 | let col = col('.') - 1
10 | return !col || getline('.')[col - 1] =~# '\s'
11 | endfunction
12 |
13 | " Use to trigger completion.
14 | inoremap coc#refresh()
15 |
16 | " Use to confirm completion, `u` means break undo chain at current
17 | " position. Coc only does snippet and additional edit on confirm.
18 | if exists('*complete_info')
19 | inoremap complete_info()["selected"] != "-1" ? "\" : "\u\"
20 | else
21 | imap pumvisible() ? "\" : "\u\"
22 | endif
23 |
24 | " GoTo code navigation.
25 | nmap gd (coc-definition)
26 | nmap gy (coc-type-definition)
27 | nmap gi (coc-implementation)
28 | nmap gr (coc-references)
29 |
30 | " Use K to show documentation in preview window.
31 | nnoremap K :call show_documentation()
32 |
33 | function! s:show_documentation()
34 | if (index(['vim','help'], &filetype) >= 0)
35 | execute 'h '.expand('')
36 | elseif (coc#rpc#ready())
37 | call CocActionAsync('doHover')
38 | else
39 | execute '!' . &keywordprg . " " . expand('')
40 | endif
41 | endfunction
42 |
43 | " set keywordprg=:call\ CocActionAsync('doHover')
44 | " augroup VimHelp
45 | " autocmd!
46 | " autocmd Filetype vim,help setlocal keywordprg=:help
47 | " augroup END
48 |
49 | " Highlight the symbol and its references when holding the cursor.
50 | autocmd CursorHold * silent call CocActionAsync('highlight')
51 |
52 | " Symbol renaming.
53 | " nmap rn (coc-rename)
54 |
55 | augroup mygroup
56 | autocmd!
57 | " Setup formatexpr specified filetype(s).
58 | autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
59 | " Update signature help on jump placeholder.
60 | autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
61 | augroup end
62 |
63 | " Applying codeAction to the selected region.
64 | " Example: `aap` for current paragraph
65 | " xmap a (coc-codeaction-selected)
66 | " nmap a (coc-codeaction-selected)
67 |
68 | " Remap keys for applying codeAction to the current line.
69 | " nmap ac (coc-codeaction)
70 | " Apply AutoFix to problem on the current line.
71 | " nmap qf (coc-fix-current)
72 |
73 | " Introduce function text object
74 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
75 | xmap if (coc-funcobj-i)
76 | xmap af (coc-funcobj-a)
77 | omap if (coc-funcobj-i)
78 | omap af (coc-funcobj-a)
79 |
80 | " Remap and for scroll float windows/popups.
81 | " Note coc#float#scroll works on neovim >= 0.4.3 or vim >= 8.2.0750
82 | nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\"
83 | nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\"
84 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\"
85 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\"
86 |
87 | " NeoVim-only mapping for visual mode scroll
88 | " Useful on signatureHelp after jump placeholder of snippet expansion
89 | if has('nvim')
90 | vnoremap coc#float#has_scroll() ? coc#float#nvim_scroll(1, 1) : "\"
91 | vnoremap coc#float#has_scroll() ? coc#float#nvim_scroll(0, 1) : "\"
92 | endif
93 |
94 | " Add `:Format` command to format current buffer.
95 | command! -nargs=0 Format :call CocAction('format')
96 |
97 | " Add `:Fold` command to fold current buffer.
98 | command! -nargs=? Fold :call CocAction('fold', )
99 |
100 | " Add `:OR` command for organize imports of the current buffer.
101 | command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
102 |
103 | " Add (Neo)Vim's native statusline support.
104 | " NOTE: Please see `:h coc-status` for integrations with external plugins that
105 | " provide custom statusline: lightline.vim, vim-airline.
106 | " set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
107 |
108 | " Mappings using CoCList:
109 | " Show all diagnostics.
110 | " TODO add these to which key
111 | " nnoremap a :CocList diagnostics
112 | " " Manage extensions.
113 | " nnoremap e :CocList extensions
114 | " " Show commands.
115 | " nnoremap c :CocList commands
116 | " " Find symbol of current document.
117 | " nnoremap o :CocList outline
118 | " " Search workspace symbols.
119 | " nnoremap s :CocList -I symbols
120 | " " Do default action for next item.
121 | " nnoremap j :CocNext
122 | " " Do default action for previous item.
123 | " nnoremap k :CocPrev
124 | " " Resume latest coc list.
125 | " nnoremap p :CocListResume
126 |
127 | " Explorer
128 | let g:coc_explorer_global_presets = {
129 | \ 'floating': {
130 | \ 'position': 'floating',
131 | \ },
132 | \ 'floatingLeftside': {
133 | \ 'position': 'floating',
134 | \ 'floating-position': 'left-center',
135 | \ 'floating-width': 30,
136 | \ },
137 | \ 'floatingRightside': {
138 | \ 'position': 'floating',
139 | \ 'floating-position': 'right-center',
140 | \ 'floating-width': 30,
141 | \ },
142 | \ 'simplify': {
143 | \ 'file.child.template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]'
144 | \ }
145 | \ }
146 | "nmap e :CocCommand explorer
147 | " nnoremap e :CocCommand explorer
148 | " nmap f :CocCommand explorer --preset floatingRightside
149 | autocmd BufEnter * if (winnr("$") == 1 && &filetype == 'coc-explorer') | q | endif
150 |
151 | " Snippets
152 | " Use for trigger snippet expand.
153 | imap (coc-snippets-expand)
154 |
155 | " Use for select text for visual placeholder of snippet.
156 | vmap (coc-snippets-select)
157 |
158 | " Use for jump to next placeholder, it's default of coc.nvim
159 | let g:coc_snippet_next = ''
160 |
161 | " Use for jump to previous placeholder, it's default of coc.nvim
162 | let g:coc_snippet_prev = ''
163 |
164 | " Use for both expand and jump (make expand higher priority.)
165 | imap (coc-snippets-expand-jump)
166 |
--------------------------------------------------------------------------------
/src/.config/awesome/layout/top-bar.lua:
--------------------------------------------------------------------------------
1 | local awful = require('awful')
2 | local beautiful = require('beautiful')
3 | local clickable_container = require('widget.material.clickable-container')
4 | local mat_icon_button = require('widget.material.icon-button')
5 | local separators = require('widget.material.separator')
6 | local markup = require('widget.material.markup')
7 | local wibox = require('wibox')
8 | local TagList = require('widget.tag-list')
9 | local gears = require('gears')
10 | local dpi = require('beautiful').xresources.apply_dpi
11 | local table = awful.util.table or gears.table
12 |
13 | -- Separators
14 | local arrow = separators.arrow_left
15 | local function create_arrow(mywidget, bgcolor, fgcolor)
16 | return (wibox.container.background(
17 | wibox.widget {
18 | arrow(fgcolor, bgcolor),
19 | mywidget,
20 | arrow(bgcolor, fgcolor),
21 | spacing = dpi(4),
22 | layout = wibox.layout.fixed.horizontal
23 | },
24 | bgcolor
25 | )
26 | )
27 | end
28 |
29 | -- Create Icons
30 | local function create_icon(label, icon_color)
31 | return (wibox.widget {
32 | wibox.widget{
33 | text = label,
34 | font = beautiful.icon_font,
35 | widget = wibox.widget.textbox
36 | },
37 | fg = icon_color,
38 | widget = wibox.container.background
39 | })
40 | end
41 |
42 | local TopBar = function(s, offset)
43 |
44 | -- LAYOUT BOX
45 | -- ==========
46 | local function update_txt_layoutbox(s)
47 | -- Writes a string representation of the current layout in a textbox widget
48 | local txt_l = beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))] or ""
49 | s.layoutbox:set_text(txt_l)
50 | end
51 |
52 | s.layoutbox = wibox.widget.textbox(beautiful["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
53 | s.layoutbox.font = beautiful.icon_font
54 | awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
55 | awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
56 | s.layoutbox:buttons(table.join(
57 | awful.button({}, 1, function() awful.layout.inc(1) end),
58 | awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
59 | awful.button({}, 3, function() awful.layout.inc(-1) end),
60 | awful.button({}, 4, function() awful.layout.inc(1) end),
61 | awful.button({}, 5, function() awful.layout.inc(-1) end)))
62 |
63 | -- SYSTEM TRAY
64 | -- ===========
65 | local systray = wibox.widget.systray()
66 | systray:set_horizontal(true)
67 |
68 | -- SYSTEM DETAILS
69 | -- ==============
70 | local volume_widget = require('widget.volume')
71 | local battery_widget = require('widget.battery')
72 | local clock_widget = require('widget.clock')
73 | local mem_widget = require('widget.memory')
74 | local cpu_widget = require('widget.cpu')
75 | local temprature_widget = require('widget.temprature')
76 | local storage_widget = require('widget.storage')
77 | local net = require('widget.net')
78 | local net_sent = net({
79 | settings = function()
80 | widget:set_markup(markup.font(beautiful.font, net_now.sent))
81 | end
82 | })
83 | local net_recieved = net({
84 | settings = function()
85 | widget:set_markup(markup.font(beautiful.font, net_now.received))
86 | end
87 | })
88 | local system_details = wibox.widget {
89 | -- Systray
90 | systray,
91 | create_arrow(nil, beautiful.primary.hue_200, beautiful.primary.hue_100),
92 | -- Internet Speed
93 | wibox.widget{
94 | create_icon('', beautiful.accent.hue_200),
95 | net_recieved.widget,
96 | create_icon('', beautiful.accent.hue_300),
97 | net_sent.widget,
98 | spacing = dpi(4),
99 | layout = wibox.layout.fixed.horizontal
100 | },
101 | -- Battery
102 | create_arrow (battery_widget, beautiful.primary.hue_200, beautiful.primary.hue_100),
103 | -- Memory
104 | create_icon('', beautiful.accent.hue_500),
105 | mem_widget,
106 | -- CPU
107 | create_arrow(wibox.widget{
108 | create_icon('', beautiful.accent.hue_600),
109 | cpu_widget,
110 | spacing = dpi(4),
111 | layout = wibox.layout.fixed.horizontal
112 | }, beautiful.primary.hue_200, beautiful.primary.hue_100),
113 | -- Temprature
114 | wibox.widget{
115 | create_icon('﨎', beautiful.accent.hue_400),
116 | temprature_widget,
117 | spacing = dpi(4),
118 | layout = wibox.layout.fixed.horizontal
119 | },
120 | -- Volume
121 | create_arrow(volume_widget, beautiful.primary.hue_200, beautiful.primary.hue_100),
122 | -- Storage
123 | wibox.widget{
124 | create_icon('', beautiful.accent.hue_200),
125 | storage_widget,
126 | spacing = dpi(4),
127 | layout = wibox.layout.fixed.horizontal
128 | },
129 | wibox.widget{
130 | -- Calendar / Clock
131 | create_arrow(wibox.widget{
132 | create_icon('', beautiful.accent.hue_400),
133 | clock_widget,
134 | spacing = dpi(4),
135 | layout = wibox.layout.fixed.horizontal
136 | }, beautiful.primary.hue_200, beautiful.primary.hue_100),
137 | -- Layout
138 | wibox.widget {
139 | arrow(beautiful.primary.hue_100, beautiful.accent.hue_200),
140 | wibox.widget{
141 | wibox.container.margin(s.layoutbox, dpi(4), dpi(4), dpi(0), dpi(0)),
142 | fg = beautiful.primary.hue_100,
143 | bg = beautiful.accent.hue_200,
144 | widget = wibox.container.background
145 | },
146 | layout = wibox.layout.fixed.horizontal
147 | },
148 | layout = wibox.layout.fixed.horizontal,
149 | },
150 | spacing = dpi(4),
151 | layout = wibox.layout.fixed.horizontal
152 | }
153 |
154 | -- TOP BAR
155 | -- =======
156 | local panel = wibox({
157 | ontop = false,
158 | screen = s,
159 | height = dpi(20),
160 | width = s.geometry.width,
161 | x = s.geometry.x,
162 | y = s.geometry.y,
163 | stretch = false,
164 | bg = beautiful.primary.hue_100,
165 | fg = beautiful.fg_normal,
166 | })
167 |
168 | panel:struts({
169 | top = panel.height - panel.y
170 | })
171 |
172 | panel:setup{
173 | layout = wibox.layout.align.horizontal,
174 | TagList(s),
175 | nil,
176 | system_details,
177 | }
178 |
179 | return panel
180 | end
181 |
182 | return TopBar
183 |
--------------------------------------------------------------------------------
/src/.config/awesome/configuration/keys/global.lua:
--------------------------------------------------------------------------------
1 | require('awful.autofocus')
2 | local awful = require('awful')
3 | local hotkeys_popup = require('awful.hotkeys_popup').widget
4 | local modkey = require('configuration.keys.mod').modKey
5 | local altkey = require('configuration.keys.mod').altKey
6 | local apps = require('configuration.apps')
7 |
8 | -- Key bindings
9 | local globalKeys = awful.util.table.join( -- Hotkeys
10 | awful.key({modkey}, 'h', hotkeys_popup.show_help, {
11 | description = 'show help',
12 | group = 'awesome'
13 | }), awful.key({modkey}, 'F1', hotkeys_popup.show_help, {
14 | description = 'show help',
15 | group = 'awesome'
16 | }), -- Tag browsing
17 | awful.key({modkey}, 'Left', function()
18 | awful.tag.viewprev()
19 | _G._splash_to_current_tag()
20 | end, {
21 | description = 'go to previous workspace',
22 | group = 'tag'
23 | }), awful.key({modkey}, 'Right', function()
24 | awful.tag.viewnext()
25 | _G._splash_to_current_tag()
26 | end, {
27 | description = 'go to next workspace',
28 | group = 'tag'
29 | }), awful.key({modkey}, 'Escape', function()
30 | awful.tag.history.restore()
31 | _G._splash_to_current_tag()
32 | end, {
33 | description = 'go back',
34 | group = 'tag'
35 | }), -- Default client focus
36 | awful.key({modkey}, 'd', function()
37 | awful.client.focus.byidx(1)
38 | end, {
39 | description = 'focus next by index',
40 | group = 'client'
41 | }), awful.key({modkey}, 'a', function()
42 | awful.client.focus.byidx(-1)
43 | end, {
44 | description = 'focus previous by index',
45 | group = 'client'
46 | }), awful.key({modkey}, 'r', function()
47 | _G.awesome.spawn(apps.default.rofi)
48 | end, {
49 | description = 'show rofi menu',
50 | group = 'awesome'
51 | }), awful.key({modkey}, 'u', function()
52 | awful.client.urgent.jumpto()
53 | _G._splash_to_current_tag()
54 | end, {
55 | description = 'jump to urgent client',
56 | group = 'client'
57 | }), awful.key({altkey}, 'Tab', function()
58 | awful.client.focus.byidx(1)
59 | if _G.client.focus then
60 | _G.client.focus:raise()
61 | end
62 | end, {
63 | description = 'switch to next window',
64 | group = 'client'
65 | }), awful.key({altkey, 'Shift'}, 'Tab', function()
66 | awful.client.focus.byidx(-1)
67 | if _G.client.focus then
68 | _G.client.focus:raise()
69 | end
70 | end, {
71 | description = 'switch to previous window',
72 | group = 'client'
73 | }), awful.key({modkey}, 'l', function()
74 | awful.spawn(apps.default.lock)
75 | end, {
76 | description = 'lock the screen',
77 | group = 'awesome'
78 | }), awful.key({'Control', 'Shift'}, 'Print', function()
79 | awful.util.spawn_with_shell(apps.default.delayed_screenshot)
80 | end, {
81 | description = 'mark an area and screenshot it (clipboard)',
82 | group = 'screenshots (clipboard)'
83 | }), awful.key({altkey}, 'Print', function()
84 | awful.util.spawn_with_shell(apps.default.screenshot)
85 | end, {
86 | description = 'take a screenshot of your active monitor and copy it to clipboard',
87 | group = 'screenshots (clipboard)'
88 | }), awful.key({'Control'}, 'Print', function()
89 | awful.util.spawn_with_shell(apps.default.region_screenshot)
90 | end, {
91 | description = 'mark an area and screenshot it to your clipboard',
92 | group = 'screenshots (clipboard)'
93 | }), awful.key({modkey}, 'Return', function()
94 | awful.util.spawn_with_shell(apps.default.terminal)
95 | end, {
96 | description = 'open a terminal',
97 | group = 'launcher'
98 | }), awful.key({modkey, 'Control'}, 'r', _G.awesome.restart, {
99 | description = 'reload awesome',
100 | group = 'awesome'
101 | }), awful.key({modkey, 'Control'}, 'q', _G.awesome.quit, {
102 | description = 'quit awesome',
103 | group = 'awesome'
104 | }), awful.key({modkey}, 'p', function()
105 | awful.util.spawn_with_shell(apps.default.power_command)
106 | end, {
107 | description = 'end session menu',
108 | group = 'awesome'
109 | }), awful.key({altkey, 'Shift'}, 'Right', function()
110 | awful.tag.incmwfact(0.05)
111 | end, {
112 | description = 'increase master width factor',
113 | group = 'layout'
114 | }), awful.key({altkey, 'Shift'}, 'Left', function()
115 | awful.tag.incmwfact(-0.05)
116 | end, {
117 | description = 'decrease master width factor',
118 | group = 'layout'
119 | }), awful.key({altkey, 'Shift'}, 'Down', function()
120 | awful.client.incwfact(0.05)
121 | end, {
122 | description = 'decrease master height factor',
123 | group = 'layout'
124 | }), awful.key({altkey, 'Shift'}, 'Up', function()
125 | awful.client.incwfact(-0.05)
126 | end, {
127 | description = 'increase master height factor',
128 | group = 'layout'
129 | }), awful.key({modkey, 'Shift'}, 'Left', function()
130 | awful.tag.incnmaster(1, nil, true)
131 | end, {
132 | description = 'increase the number of master clients',
133 | group = 'layout'
134 | }), awful.key({modkey, 'Shift'}, 'Right', function()
135 | awful.tag.incnmaster(-1, nil, true)
136 | end, {
137 | description = 'decrease the number of master clients',
138 | group = 'layout'
139 | }), awful.key({modkey, 'Control'}, 'Left', function()
140 | awful.tag.incncol(1, nil, true)
141 | end, {
142 | description = 'increase the number of columns',
143 | group = 'layout'
144 | }), awful.key({modkey, 'Control'}, 'Right', function()
145 | awful.tag.incncol(-1, nil, true)
146 | end, {
147 | description = 'decrease the number of columns',
148 | group = 'layout'
149 | }), awful.key({modkey}, 'space', function()
150 | awful.layout.inc(1)
151 | end, {
152 | description = 'select next layout',
153 | group = 'layout'
154 | }), awful.key({modkey, 'Shift'}, 'space', function()
155 | awful.layout.inc(-1)
156 | end, {
157 | description = 'select previous layout',
158 | group = 'layout'
159 | }), awful.key({altkey, 'Shift'}, 'l', function()
160 | awful.tag.incmwfact(0.05)
161 | end, {
162 | description = 'increase master width factor',
163 | group = 'layout'
164 | }), awful.key({altkey, 'Shift'}, 'h', function()
165 | awful.tag.incmwfact(-0.05)
166 | end, {
167 | description = 'decrease master width factor',
168 | group = 'layout'
169 | }), awful.key({altkey, 'Shift'}, 'j', function()
170 | awful.client.incwfact(0.05)
171 | end, {
172 | description = 'decrease master height factor',
173 | group = 'layout'
174 | }), awful.key({altkey, 'Shift'}, 'k', function()
175 | awful.client.incwfact(-0.05)
176 | end, {
177 | description = 'increase master height factor',
178 | group = 'layout'
179 | }), awful.key({modkey, 'Shift'}, 'h', function()
180 | awful.tag.incnmaster(1, nil, true)
181 | end, {
182 | description = 'increase the number of master clients',
183 | group = 'layout'
184 | }), awful.key({modkey, 'Shift'}, 'l', function()
185 | awful.tag.incnmaster(-1, nil, true)
186 | end, {
187 | description = 'decrease the number of master clients',
188 | group = 'layout'
189 | }), awful.key({modkey, 'Control'}, 'h', function()
190 | awful.tag.incncol(1, nil, true)
191 | end, {
192 | description = 'increase the number of columns',
193 | group = 'layout'
194 | }), awful.key({modkey, 'Control'}, 'l', function()
195 | awful.tag.incncol(-1, nil, true)
196 | end, {
197 | description = 'decrease the number of columns',
198 | group = 'layout'
199 | }), awful.key({modkey}, 'k', function()
200 | _G.toggle_splash()
201 | end, {
202 | description = 'toggle splash terminal',
203 | group = 'launcher'
204 | }), awful.key({}, 'XF86MonBrightnessUp', function()
205 | awful.spawn('xbacklight -inc 10')
206 | end, {
207 | description = '+10%',
208 | group = 'hotkeys'
209 | }), awful.key({}, 'XF86MonBrightnessDown', function()
210 | awful.spawn('xbacklight -dec 10')
211 | end, {
212 | description = '-10%',
213 | group = 'hotkeys'
214 | }), -- ALSA volume control
215 | awful.key({altkey}, 'k', function()
216 | awful.spawn.easy_async('amixer -D pulse sset Master 5%+', function()
217 | _G.update_volume()
218 | end)
219 | end, {
220 | description = 'volume up',
221 | group = 'hotkeys'
222 | }), awful.key({}, 'XF86AudioRaiseVolume', function()
223 | awful.spawn.easy_async('amixer -D pulse sset Master 5%+', function()
224 | _G.update_volume()
225 | end)
226 | end, {
227 | description = 'volume up',
228 | group = 'hotkeys'
229 | }), awful.key({}, 'XF86AudioLowerVolume', function()
230 | awful.spawn.easy_async('amixer -D pulse sset Master 5%-', function()
231 | _G.update_volume()
232 | end)
233 | end, {
234 | description = 'volume down',
235 | group = 'hotkeys'
236 | }), awful.key({altkey}, 'j', function()
237 | awful.spawn.easy_async('amixer -D pulse sset Master 5%-', function()
238 | _G.update_volume()
239 | end)
240 | end, {
241 | description = 'volume down',
242 | group = 'hotkeys'
243 | }), awful.key({altkey}, 'm', function()
244 | awful.spawn('amixer -D pulse set Master 1+ toggle')
245 | _G.update_volume()
246 | end, {
247 | description = 'toggle mute',
248 | group = 'hotkeys'
249 | }), awful.key({}, 'XF86AudioMute', function()
250 | awful.spawn('amixer -D pulse set Master 1+ toggle')
251 | _G.update_volume()
252 | end, {
253 | description = 'toggle mute',
254 | group = 'hotkeys'
255 | }), awful.key({modkey}, 'o', awful.client.movetoscreen, {
256 | description = 'move window to next screen',
257 | group = 'client'
258 | }))
259 |
260 | -- Bind all key numbers to tags.
261 | -- Be careful: we use keycodes to make it works on any keyboard layout.
262 | -- This should map on the top row of your keyboard, usually 1 to 9.
263 | for i = 1, 9 do
264 | -- Hack to only show tags 1 and 9 in the shortcut window (mod+s)
265 | local descr_view, descr_toggle, descr_move, descr_toggle_focus
266 | if i == 1 or i == 9 then
267 | descr_view = {
268 | description = 'view tag #',
269 | group = 'tag'
270 | }
271 | descr_toggle = {
272 | description = 'toggle tag #',
273 | group = 'tag'
274 | }
275 | descr_move = {
276 | description = 'move focused client to tag #',
277 | group = 'tag'
278 | }
279 | descr_toggle_focus = {
280 | description = 'toggle focused client on tag #',
281 | group = 'tag'
282 | }
283 | end
284 | globalKeys = awful.util.table.join(globalKeys, -- View tag only.
285 | awful.key({modkey}, '#' .. i + 9, function()
286 | local screen = awful.screen.focused()
287 | local tag = screen.tags[i]
288 | if tag then
289 | tag:view_only()
290 | _G._splash_to_current_tag()
291 | end
292 | end, descr_view), -- Toggle tag display.
293 | awful.key({modkey, 'Control'}, '#' .. i + 9, function()
294 | local screen = awful.screen.focused()
295 | local tag = screen.tags[i]
296 | if tag then
297 | awful.tag.viewtoggle(tag)
298 | end
299 | end, descr_toggle), -- Move client to tag.
300 | awful.key({modkey, 'Shift'}, '#' .. i + 9, function()
301 | if _G.client.focus then
302 | local tag = _G.client.focus.screen.tags[i]
303 | if tag then
304 | _G.client.focus:move_to_tag(tag)
305 | end
306 | end
307 | end, descr_move), -- Toggle tag on focused client.
308 | awful.key({modkey, 'Control', 'Shift'}, '#' .. i + 9, function()
309 | if _G.client.focus then
310 | local tag = _G.client.focus.screen.tags[i]
311 | if tag then
312 | _G.client.focus:toggle_tag(tag)
313 | end
314 | end
315 | end, descr_toggle_focus))
316 | end
317 |
318 | return globalKeys
319 |
--------------------------------------------------------------------------------
/src/scripts/bin/launcher:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # terminal application launcher for sway, using fzf
3 | # Based on: https://gitlab.com/FlyingWombat/my-scripts/blob/master/sway-launcher
4 | # https://gist.github.com/Biont/40ef59652acf3673520c7a03c9f22d2a
5 | shopt -s nullglob globstar
6 | set -o pipefail
7 | if ! { exec 0>&3; } 1>/dev/null 2>&1; then
8 | exec 3>/dev/null # If file descriptor 3 is unused in parent shell, output to /dev/null
9 | fi
10 | # shellcheck disable=SC2154
11 | trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
12 | IFS=$'\n\t'
13 | DEL=$'\34'
14 |
15 | TERMINAL_COMMAND="${TERMINAL_COMMAND:="$TERM -e"}"
16 | GLYPH_COMMAND="${GLYPH_COMMAND- }"
17 | GLYPH_DESKTOP="${GLYPH_DESKTOP- }"
18 | CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/sway-launcher-desktop"
19 | PROVIDERS_FILE="${PROVIDERS_FILE:=providers.conf}"
20 | if [[ "${PROVIDERS_FILE#/}" == "${PROVIDERS_FILE}" ]]; then
21 | # $PROVIDERS_FILE is a relative path, prepend $CONFIG_DIR
22 | PROVIDERS_FILE="${CONFIG_DIR}/${PROVIDERS_FILE}"
23 | fi
24 |
25 | # Provider config entries are separated by the field separator \034 and have the following structure:
26 | # list_cmd,preview_cmd,launch_cmd
27 | declare -A PROVIDERS
28 | if [ -f "${PROVIDERS_FILE}" ]; then
29 | eval "$(awk -F= '
30 | BEGINFILE{ provider=""; }
31 | /^\[.*\]/{sub("^\\[", "");sub("\\]$", "");provider=$0}
32 | /^(launch|list|preview)_cmd/{st = index($0,"=");providers[provider][$1] = substr($0,st+1)}
33 | ENDFILE{
34 | for (key in providers){
35 | if(!("list_cmd" in providers[key])){continue;}
36 | if(!("launch_cmd" in providers[key])){continue;}
37 | if(!("preview_cmd" in providers[key])){continue;}
38 | for (entry in providers[key]){
39 | gsub(/[\x27,\047]/,"\x27\"\x27\"\x27", providers[key][entry])
40 | }
41 | print "PROVIDERS[\x27" key "\x27]=\x27" providers[key]["list_cmd"] "\034" providers[key]["preview_cmd"] "\034" providers[key]["launch_cmd"] "\x27\n"
42 | }
43 | }' "${PROVIDERS_FILE}")"
44 | if [[ ! -v HIST_FILE ]]; then
45 | HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-${PROVIDERS_FILE##*/}-history.txt"
46 | fi
47 | else
48 | PROVIDERS['desktop']="${0} list-entries${DEL}${0} describe-desktop \"{1}\"${DEL}${0} run-desktop '{1}' {2}"
49 | PROVIDERS['command']="${0} list-commands${DEL}${0} describe-command \"{1}\"${DEL}${TERMINAL_COMMAND} {1}"
50 | if [[ ! -v HIST_FILE ]]; then
51 | HIST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/${0##*/}-history.txt"
52 | fi
53 | fi
54 | PROVIDERS['user']="exit${DEL}exit${DEL}{1}" # Fallback provider that simply executes the exact command if there were no matches
55 |
56 | if [[ -n "${HIST_FILE}" ]]; then
57 | mkdir -p "${HIST_FILE%/*}" && touch "$HIST_FILE"
58 | readarray HIST_LINES <"$HIST_FILE"
59 | fi
60 |
61 | function describe() {
62 | # shellcheck disable=SC2086
63 | readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${1}]}
64 | # shellcheck disable=SC2086
65 | [ -n "${PROVIDER_ARGS[1]}" ] && eval "${PROVIDER_ARGS[1]//\{1\}/${2}}"
66 | }
67 | function describe-desktop() {
68 | description=$(sed -ne '/^Comment=/{s/^Comment=//;p;q}' "$1")
69 | echo -e "\033[33m$(sed -ne '/^Name=/{s/^Name=//;p;q}' "$1")\033[0m"
70 | echo "${description:-No description}"
71 | }
72 | function describe-command() {
73 | readarray arr < <(whatis -l "$1" 2>/dev/null)
74 | description="${arr[0]}"
75 | description="${description#* - }"
76 | echo -e "\033[33m${1}\033[0m"
77 | echo "${description:-No description}"
78 | }
79 |
80 | function provide() {
81 | # shellcheck disable=SC2086
82 | readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[$1]}
83 | eval "${PROVIDER_ARGS[0]}"
84 | }
85 | function list-commands() {
86 | IFS=: read -ra path <<<"$PATH"
87 | for dir in "${path[@]}"; do
88 | printf '%s\n' "$dir/"* |
89 | awk -F / -v pre="$GLYPH_COMMAND" '{print $NF "\034command\034\033[31m" pre "\033[0m" $NF;}'
90 | done | sort -u
91 | }
92 | function list-entries() {
93 | # Get locations of desktop application folders according to spec
94 | # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
95 | IFS=':' read -ra DIRS <<<"${XDG_DATA_HOME-${HOME}/.local/share}:${XDG_DATA_DIRS-/usr/local/share:/usr/share}"
96 | for i in "${!DIRS[@]}"; do
97 | if [[ ! -d "${DIRS[i]}" ]]; then
98 | unset -v 'DIRS[$i]'
99 | else
100 | DIRS[$i]="${DIRS[i]}/applications/**/*.desktop"
101 | fi
102 | done
103 | # shellcheck disable=SC2068
104 | entries ${DIRS[@]}
105 | }
106 | function entries() {
107 | # shellcheck disable=SC2068
108 | awk -v pre="$GLYPH_DESKTOP" -F= '
109 | function desktopFileID(filename){
110 | sub("^.*applications/", "", filename);
111 | sub("/", "-", filename);
112 | return filename
113 | }
114 | BEGINFILE{
115 | application=0;
116 | block="";
117 | a=0
118 |
119 | id=desktopFileID(FILENAME)
120 | if(id in fileIds){
121 | nextfile;
122 | }else{
123 | fileIds[id]=0
124 | }
125 | }
126 | /^\[Desktop Entry\]/{block="entry"}
127 | /^Type=Application/{application=1}
128 | /^\[Desktop Action/{
129 | sub("^\\[Desktop Action ", "");
130 | sub("\\]$", "");
131 | block="action";
132 | a++;
133 | actions[a,"key"]=$0
134 | }
135 | /^\[X-/{
136 | sub("^\\[X-", "");
137 | sub("\\]$", "");
138 | block="action";
139 | a++;
140 | actions[a,"key"]=$0
141 | }
142 | /^Name=/{ (block=="action")? actions[a,"name"]=$2 : name=$2 }
143 | ENDFILE{
144 | if (application){
145 | print FILENAME "\034desktop\034\033[33m" pre name "\033[0m";
146 | if (a>0)
147 | for (i=1; i<=a; i++)
148 | print FILENAME "\034desktop\034\033[33m" pre name "\033[0m (" actions[i, "name"] ")\034" actions[i, "key"]
149 | }
150 | }' \
151 | $@ &3)"
156 | echo "Generated Launch command from .desktop file: ${CMD}" >&3
157 | bash -c "${CMD}"
158 | }
159 | function generate-command() {
160 | # Define the search pattern that specifies the block to search for within the .desktop file
161 | PATTERN="^\\\\[Desktop Entry\\\\]"
162 | if [[ -n $2 ]]; then
163 | PATTERN="^\\\\[Desktop Action ${2}\\\\]"
164 | fi
165 | echo "Searching for pattern: ${PATTERN}" >&3
166 | # 1. We see a line starting [Desktop, but we're already searching: deactivate search again
167 | # 2. We see the specified pattern: start search
168 | # 3. We see an Exec= line during search: remove field codes and set variable
169 | # 3. We see a Path= line during search: set variable
170 | # 4. Finally, build command line
171 | awk -v pattern="${PATTERN}" -v terminal_cmd="${TERMINAL_COMMAND}" -F= '
172 | BEGIN{a=0;exec=0;path=0}
173 | /^\[Desktop/{
174 | if(a){ a=0 }
175 | }
176 | $0 ~ pattern{ a=1 }
177 | /^Terminal=/{
178 | sub("^Terminal=", "");
179 | if ($0 == "true") { terminal=1 }
180 | }
181 | /^Exec=/{
182 | if(a && !exec){
183 | sub("^Exec=", "");
184 | gsub(" ?%[cDdFfikmNnUuv]", "");
185 | exec=$0;
186 | }
187 | }
188 | /^Path=/{
189 | if(a && !path){ path=$2 }
190 | }
191 | END{
192 | if(path){ printf "cd " path " && " }
193 | if (terminal){ printf terminal_cmd " " }
194 | print exec
195 | }' "$1"
196 | }
197 |
198 | function autostart() {
199 | for application in $(list-autostart); do
200 | (exec setsid /bin/sh -c "$(run-desktop "${application}")" &>/dev/null &)
201 | done
202 | }
203 |
204 | function list-autostart() {
205 | # Get locations of desktop application folders according to spec
206 | # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
207 | IFS=':' read -ra DIRS <<<"${XDG_CONFIG_HOME-${HOME}/.config}:${XDG_CONFIG_DIRS-/etc/xdg}"
208 | for i in "${!DIRS[@]}"; do
209 | if [[ ! -d "${DIRS[i]}" ]]; then
210 | unset -v 'DIRS[$i]'
211 | else
212 | DIRS[$i]="${DIRS[i]}/autostart/*.desktop"
213 | fi
214 | done
215 |
216 | # shellcheck disable=SC2068
217 | awk -v pre="$GLYPH_DESKTOP" -F= '
218 | function desktopFileID(filename){
219 | sub("^.*autostart/", "", filename);
220 | sub("/", "-", filename);
221 | return filename
222 | }
223 | BEGINFILE{
224 | application=0;
225 | block="";
226 | a=0
227 |
228 | id=desktopFileID(FILENAME)
229 | if(id in fileIds){
230 | nextfile;
231 | }else{
232 | fileIds[id]=0
233 | }
234 | }
235 | /^\[Desktop Entry\]/{block="entry"}
236 | /^Type=Application/{application=1}
237 | /^Name=/{ iname=$2 }
238 | ENDFILE{
239 | if (application){
240 | print FILENAME;
241 | }
242 | }' \
243 | ${DIRS[@]} &3
253 |
254 | FZFPIPE=$(mktemp -u)
255 | mkfifo "$FZFPIPE"
256 | trap 'rm "$FZFPIPE"' EXIT INT
257 |
258 | # Append Launcher History, removing usage count
259 | (printf '%s' "${HIST_LINES[@]#* }" >>"$FZFPIPE") &
260 |
261 | # Iterate over providers and run their list-command
262 | for PROVIDER_NAME in "${!PROVIDERS[@]}"; do
263 | (bash -c "${0} provide ${PROVIDER_NAME}" >>"$FZFPIPE") &
264 | done
265 |
266 | readarray -t COMMAND_STR <<<$(
267 | fzf --ansi +s -x -d '\034' --nth ..3 --with-nth 3 \
268 | --print-query \
269 | --preview "$0 describe {2} {1}" \
270 | --preview-window=up:2:noborder \
271 | --no-multi --cycle \
272 | --prompt="${GLYPH_PROMPT-# }" \
273 | --header='' --no-info --margin='1,2' \
274 | --color='16,gutter:-1' \
275 | <"$FZFPIPE"
276 | ) || exit 1
277 | # 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
278 | # If there were matches, it contains the selected item
279 | COMMAND_STR=$(printf '%s\n' "${COMMAND_STR[@]: -1}")
280 | # We still need to format the query to conform to our fallback provider.
281 | # We check for the presence of field separator character to determine if we're dealing with a custom command
282 | if [[ $COMMAND_STR != *$'\034'* ]]; then
283 | COMMAND_STR="${COMMAND_STR}"$'\034user\034'"${COMMAND_STR}"$'\034'
284 | SKIP_HIST=1 # I chose not to include custom commands in the history. If this is a bad idea, open an issue please
285 | fi
286 |
287 | [ -z "$COMMAND_STR" ] && exit 1
288 |
289 | if [[ -n "${HIST_FILE}" && ! "$SKIP_HIST" ]]; then
290 | # update history
291 | for i in "${!HIST_LINES[@]}"; do
292 | if [[ "${HIST_LINES[i]}" == *" $COMMAND_STR"$'\n' ]]; then
293 | HIST_COUNT=${HIST_LINES[i]%% *}
294 | HIST_LINES[$i]="$((HIST_COUNT + 1)) $COMMAND_STR"$'\n'
295 | match=1
296 | break
297 | fi
298 | done
299 | if ! ((match)); then
300 | HIST_LINES+=("1 $COMMAND_STR"$'\n')
301 | fi
302 |
303 | printf '%s' "${HIST_LINES[@]}" | sort -nr >"$HIST_FILE"
304 | fi
305 |
306 | # shellcheck disable=SC2086
307 | readarray -d $'\034' -t PARAMS <<<${COMMAND_STR}
308 | # shellcheck disable=SC2086
309 | readarray -d ${DEL} -t PROVIDER_ARGS <<<${PROVIDERS[${PARAMS[1]}]}
310 | # Substitute {1}, {2} etc with the correct values
311 | COMMAND=${PROVIDER_ARGS[2]//\{1\}/${PARAMS[0]}}
312 | COMMAND=${COMMAND//\{2\}/${PARAMS[3]}}
313 | COMMAND=${COMMAND%%[[:space:]]}
314 |
315 | if [ -t 1 ]; then
316 | echo "Launching command: ${COMMAND}" >&3
317 | setsid /bin/sh -c "${COMMAND}" >&/dev/null
197 | " https://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
198 | let mapleader = "\"
199 | if executable('ag')
200 | set grepprg=ag\ --nogroup\ --nocolor
201 | endif
202 | if executable('rg')
203 | set grepprg=rg\ --no-heading\ --vimgrep
204 | set grepformat=%f:%l:%c:%m
205 | endif
206 |
207 | " session management
208 | let g:session_directory = "~/.config/nvim/session"
209 | let g:session_autoload = "no"
210 | let g:session_autosave = "no"
211 | let g:session_command_aliases = 1
212 |
213 | " deal with colors
214 | if !has('gui_running')
215 | set t_Co=256
216 | endif
217 | if (match($TERM, "-256color") != -1) && (match($TERM, "screen-256color") == -1)
218 | " screen does not (yet) support truecolor
219 | set termguicolors
220 | endif
221 | let base16colorspace=256
222 |
223 |
224 | " IndentLine
225 | let g:indentLine_enabled = 1
226 | let g:indentLine_concealcursor = 0
227 | let g:indentLine_char = '┆'
228 | let g:indentLine_faster = 1
229 |
230 | au TermEnter * setlocal scrolloff=0
231 | au TermLeave * setlocal scrolloff=3
232 |
233 | "" Status bar
234 | set laststatus=2
235 |
236 | "" Use modeline overrides
237 | set modeline
238 | set modelines=10
239 | set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
240 |
241 | " remove trailing whitespaces
242 | command! FixWhitespace :%s/\s\+$//e
243 |
244 | "" Copy/Paste/Cut to system clipboard
245 | if has('unnamedplus')
246 | set clipboard=unnamed,unnamedplus
247 | endif
248 |
249 | " Sane splits
250 | set splitright
251 | set splitbelow
252 |
253 | " Permanent undo
254 | set undodir=~/.vimdid
255 | set undofile
256 |
257 | " Decent wildmenu
258 | set wildmenu
259 | set wildmode=list:longest
260 | set wildignore=.hg,.svn,*~,*.png,*.jpg,*.gif,*.settings,Thumbs.db,*.min.js,*.swp,publish/*,intermediate/*,*.o,*.hi,Zend,vendor
261 |
262 | "" Searching
263 | set hlsearch
264 | set incsearch
265 | set ignorecase
266 | set smartcase
267 |
268 | "*****************************************************************************
269 | "" End of Base Settings
270 | "*****************************************************************************
271 |
272 | "*****************************************************************************
273 | "" Plugin Settings
274 | "*****************************************************************************
275 |
276 | " vim-airline
277 | if !exists('g:airline_symbols')
278 | let g:airline_symbols = {}
279 | endif
280 | let g:airline_symbols.branch = ''
281 | let g:airline_symbols.readonly = ''
282 | let g:airline_symbols.linenr = ''
283 | let g:airline#extensions#branch#enabled = 1
284 | let g:airline#extensions#ale#enabled = 1
285 | let g:airline#extensions#tabline#enabled = 1
286 | let g:airline_skip_empty_sections = 1
287 | let g:airline_theme='gruvbox'
288 |
289 | "" NERDTree configuration
290 | let g:NERDTreeChDirMode=2
291 | let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
292 | let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
293 | let g:NERDTreeShowHidden=1
294 | let g:nerdtree_tabs_focus_on_files=1
295 | let g:NERDTreeMapOpenInTabSilent = ''
296 | let g:NERDTreeWinSize = 30
297 | set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
298 | nnoremap :NERDTreeFind
299 | nnoremap :NERDTreeToggle
300 |
301 | " grep.vim
302 | nnoremap f :Rgrep
303 | let Grep_Default_Options = '-IR'
304 | let Grep_Skip_Files = '*.log *.db'
305 | let Grep_Skip_Dirs = '.git node_modules'
306 |
307 | " vim rooter
308 | let g:rooter_silent_chdir = 1
309 |
310 | "*****************************************************************************
311 | "" End of Plugin Settings
312 | "*****************************************************************************
313 |
314 | "*****************************************************************************
315 | "" Language Settings
316 | "*****************************************************************************
317 |
318 | " PYTHON
319 | " vim-python
320 | augroup vimrc-python
321 | autocmd!
322 | autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
323 | \ formatoptions+=croq softtabstop=4
324 | \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
325 | augroup END
326 | " jedi-vim
327 | let g:jedi#popup_on_dot = 0
328 | let g:jedi#goto_assignments_command = "g"
329 | let g:jedi#goto_definitions_command = "d"
330 | let g:jedi#documentation_command = "K"
331 | let g:jedi#usages_command = "n"
332 | let g:jedi#rename_command = "r"
333 | let g:jedi#show_call_signatures = "0"
334 | let g:jedi#completions_command = ""
335 | let g:jedi#smart_auto_mappings = 0
336 | " ale
337 | let g:ale_linters = {}
338 | :call extend(g:ale_linters, {
339 | \'python': ['flake8'], })
340 | " vim-airline
341 | let g:airline#extensions#virtualenv#enabled = 1
342 | " Syntax highlight
343 | let python_highlight_all = 1
344 |
345 | " JAVASCRIPT
346 | let g:javascript_enable_domhtmlcss = 1
347 | " vim-javascript
348 | augroup vimrc-javascript
349 | autocmd!
350 | autocmd FileType javascript setl tabstop=4|setl shiftwidth=4|setl expandtab softtabstop=4
351 | augroup END
352 |
353 | " RUST
354 | " Vim racer
355 | au FileType rust nmap gd (rust-def)
356 | au FileType rust nmap gs (rust-def-split)
357 | au FileType rust nmap gx (rust-def-vertical)
358 | au FileType rust nmap gd (rust-doc)
359 |
360 | " GOLANG
361 | " vim-go
362 | " run :GoBuild or :GoTestCompile based on the go file
363 | function! s:build_go_files()
364 | let l:file = expand('%')
365 | if l:file =~# '^\f\+_test\.go$'
366 | call go#test#Test(0, 1)
367 | elseif l:file =~# '^\f\+\.go$'
368 | call go#cmd#Build(0)
369 | endif
370 | endfunction
371 | let g:go_list_type = "quickfix"
372 | let g:go_fmt_command = "goimports"
373 | let g:go_fmt_fail_silently = 1
374 | let g:go_highlight_types = 1
375 | let g:go_highlight_fields = 1
376 | let g:go_highlight_functions = 1
377 | let g:go_highlight_methods = 1
378 | let g:go_highlight_operators = 1
379 | let g:go_highlight_build_constraints = 1
380 | let g:go_highlight_structs = 1
381 | let g:go_highlight_generate_tags = 1
382 | let g:go_highlight_space_tab_error = 0
383 | let g:go_highlight_array_whitespace_error = 0
384 | let g:go_highlight_trailing_whitespace_error = 0
385 | let g:go_highlight_extra_types = 1
386 | autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4
387 | augroup completion_preview_close
388 | autocmd!
389 | if v:version > 703 || v:version == 703 && has('patch598')
390 | autocmd CompleteDone * if !&previewwindow && &completeopt =~ 'preview' | silent! pclose | endif
391 | endif
392 | augroup END
393 | augroup go
394 | au!
395 | au Filetype go command! -bang A call go#alternate#Switch(0, 'edit')
396 | au Filetype go command! -bang AV call go#alternate#Switch(0, 'vsplit')
397 | au Filetype go command! -bang AS call go#alternate#Switch(0, 'split')
398 | au Filetype go command! -bang AT call go#alternate#Switch(0, 'tabe')
399 | au FileType go nmap dd (go-def-vertical)
400 | au FileType go nmap dv (go-doc-vertical)
401 | au FileType go nmap db (go-doc-browser)
402 | au FileType go nmap r (go-run)
403 | au FileType go nmap t (go-test)
404 | au FileType go nmap gt (go-coverage-toggle)
405 | au FileType go nmap i (go-info)
406 | au FileType go nmap l (go-metalinter)
407 | au FileType go nmap :GoDecls
408 | au FileType go nmap dr :GoDeclsDir
409 | au FileType go imap :GoDecls
410 | au FileType go imap dr :GoDeclsDir
411 | au FileType go nmap rb :call build_go_files()
412 | augroup END
413 | " ale
414 | :call extend(g:ale_linters, {
415 | \"go": ['golint', 'go vet'], })
416 |
417 | " HTML
418 | " for html files, 2 spaces
419 | autocmd Filetype html setlocal ts=2 sw=2 expandtab
420 |
421 | " C/C++
422 | autocmd FileType c setlocal tabstop=4 shiftwidth=4 expandtab
423 | autocmd FileType cpp setlocal tabstop=4 shiftwidth=4 expandtab
424 |
425 | " HASKELL
426 | let g:haskell_conceal_wide = 1
427 | let g:haskell_multiline_strings = 1
428 | let g:necoghc_enable_detailed_browse = 1
429 | autocmd Filetype haskell setlocal omnifunc=necoghc#omnifunc
430 |
431 | " RUBY
432 | let g:rubycomplete_buffer_loading = 1
433 | let g:rubycomplete_classes_in_global = 1
434 | let g:rubycomplete_rails = 1
435 | augroup vimrc-ruby
436 | autocmd!
437 | autocmd BufNewFile,BufRead *.rb,*.rbw,*.gemspec setlocal filetype=ruby
438 | autocmd FileType ruby set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2
439 | augroup END
440 | let g:tagbar_type_ruby = {
441 | \ 'kinds' : [
442 | \ 'm:modules',
443 | \ 'c:classes',
444 | \ 'd:describes',
445 | \ 'C:contexts',
446 | \ 'f:methods',
447 | \ 'F:singleton methods'
448 | \ ]
449 | \ }
450 | " RSpec.vim mappings
451 | map t :call RunCurrentSpecFile()
452 | map s :call RunNearestSpec()
453 | map l :call RunLastSpec()
454 | map a :call RunAllSpecs()
455 | " For ruby refactory
456 | if has('nvim')
457 | runtime! macros/matchit.vim
458 | else
459 | packadd! matchit
460 | endif
461 | " Ruby refactory
462 | nnoremap rap :RAddParameter
463 | nnoremap rcpc :RConvertPostConditional
464 | nnoremap rel :RExtractLet
465 | vnoremap rec :RExtractConstant
466 | vnoremap relv :RExtractLocalVariable
467 | nnoremap rit :RInlineTemp
468 | vnoremap rrlv :RRenameLocalVariable
469 | vnoremap rriv :RRenameInstanceVariable
470 | vnoremap rem :RExtractMethod
471 |
472 | " ELM
473 | " elm-vim
474 | let g:elm_setup_keybindings = 0
475 | let g:elm_format_autosave = 1
476 |
477 | " ERLANG
478 | let erlang_folding = 1
479 | let erlang_show_errors = 1
480 |
481 | " VUE
482 | " vim vue
483 | let g:vue_disable_pre_processors=1
484 | " vim vue plugin
485 | let g:vim_vue_plugin_load_full_syntax = 1
486 |
487 | " SVELTE
488 | let g:vim_svelte_plugin_load_full_syntax = 1
489 |
490 | " TYPESCRIPT
491 | let g:yats_host_keyword = 1
492 |
493 | "*****************************************************************************
494 | "" End of Language Settings
495 | "*****************************************************************************
496 |
497 | "*****************************************************************************
498 | "" Key Bindings / Shortcuts
499 | "*****************************************************************************
500 |
501 | " Reload Nvim
502 | noremap r :so %
503 |
504 | " Confirm before quitting all
505 | noremap :confirm qall
506 |
507 | " Switch split-windows
508 | nmap :wincmd k
509 | nmap :wincmd j
510 | nmap