mirror of
https://github.com/purhan/dotfiles.git
synced 2025-12-26 14:24:58 +08:00
refactor using stow
This commit is contained in:
parent
e82c005070
commit
01fec1ec27
64 changed files with 3216 additions and 29 deletions
109
src/.bashrc
Normal file
109
src/.bashrc
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
# Check Interactive
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
colors() {
|
||||
local fgc bgc vals seq0
|
||||
|
||||
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
|
||||
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
|
||||
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
|
||||
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
|
||||
|
||||
# foreground colors
|
||||
for fgc in {30..37}; do
|
||||
# background colors
|
||||
for bgc in {40..47}; do
|
||||
fgc=${fgc#37} # white
|
||||
bgc=${bgc#40} # black
|
||||
|
||||
vals="${fgc:+$fgc;}${bgc}"
|
||||
vals=${vals%%;}
|
||||
|
||||
seq0="${vals:+\e[${vals}m}"
|
||||
printf " %-9s" "${seq0:-(default)}"
|
||||
printf " ${seq0}TEXT\e[m"
|
||||
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
|
||||
done
|
||||
echo; echo
|
||||
done
|
||||
}
|
||||
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
|
||||
use_color=true
|
||||
|
||||
# Fallback Prompt
|
||||
# ===============
|
||||
# Set colorful PS1 only on colorful terminals.
|
||||
# dircolors --print-database uses its own built-in database
|
||||
# instead of using /etc/DIR_COLORS. Try to use the external file
|
||||
# first to take advantage of user additions. Use internal bash
|
||||
# globbing instead of external grep binary.
|
||||
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
|
||||
match_lhs=""
|
||||
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
|
||||
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
|
||||
[[ -z ${match_lhs} ]] \
|
||||
&& type -P dircolors >/dev/null \
|
||||
&& match_lhs=$(dircolors --print-database)
|
||||
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
|
||||
|
||||
if ${use_color} ; then
|
||||
# Enable colors for ls, etc. Prefer ~/.dir_colors
|
||||
if type -P dircolors >/dev/null ; then
|
||||
if [[ -f ~/.dir_colors ]] ; then
|
||||
eval $(dircolors -b ~/.dir_colors)
|
||||
elif [[ -f /etc/DIR_COLORS ]] ; then
|
||||
eval $(dircolors -b /etc/DIR_COLORS)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
|
||||
else
|
||||
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
|
||||
fi
|
||||
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --colour=auto'
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias fgrep='fgrep --colour=auto'
|
||||
else
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
# show root@ when we don't have colors
|
||||
PS1='\u@\h \W \$ '
|
||||
else
|
||||
PS1='\u@\h \w \$ '
|
||||
fi
|
||||
fi
|
||||
unset use_color safe_term match_lhs sh
|
||||
xhost +local:root > /dev/null 2>&1
|
||||
complete -cf sudo
|
||||
|
||||
# Starship bash prompt
|
||||
# ====================
|
||||
# Install using -> curl -fsSL https://starship.rs/install.sh | bash
|
||||
# To use as prompt -> eval "$(starship init bash)"
|
||||
eval "$(starship init bash 2>/dev/null)"
|
||||
|
||||
# Set shell options
|
||||
# =================
|
||||
shopt -s checkwinsize
|
||||
shopt -s expand_aliases
|
||||
shopt -s histappend # Enable history appending instead of overwriting.
|
||||
|
||||
# SUSPEND CTRL + S
|
||||
stty -ixon
|
||||
|
||||
# Other Aliases
|
||||
alias cp="cp -i" # confirm before overwriting something
|
||||
alias df='df -h' # human-readable sizes
|
||||
alias free='free -m' # show sizes in MB
|
||||
alias np='nano -w PKGBUILD'
|
||||
alias more=less
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# switch between shells
|
||||
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
||||
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||
4
src/.config/awesome/README.md
Normal file
4
src/.config/awesome/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
## Awesome WM Config
|
||||
|
||||
|
||||

|
||||
38
src/.config/awesome/configuration/apps.lua
Normal file
38
src/.config/awesome/configuration/apps.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
local filesystem = require('gears.filesystem')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
-- Thanks to jo148 on github for making rofi dpi aware!
|
||||
local with_dpi = require('beautiful').xresources.apply_dpi
|
||||
local get_dpi = require('beautiful').xresources.get_dpi
|
||||
local rofi_command = 'env /usr/bin/rofi -dpi ' .. get_dpi() .. ' -width ' .. with_dpi(100) ..
|
||||
' -show drun -display-drun -theme ' .. filesystem.get_configuration_dir() ..
|
||||
'/configuration/rofi.rasi -icon-theme ' .. beautiful.icon_theme ..
|
||||
' -run-command "/bin/bash -c -i \'shopt -s expand_aliases; {cmd}\'"'
|
||||
|
||||
return {
|
||||
-- List of apps to start by default on some actions
|
||||
default = {
|
||||
terminal = 'kitty',
|
||||
rofi = rofi_command,
|
||||
lock = 'i3lock-fancy',
|
||||
quake = 'kitty',
|
||||
power_command = '~/.config/awesome/configuration/utils/rofi-power',
|
||||
screenshot = '~/.config/awesome/configuration/utils/screenshot -m',
|
||||
region_screenshot = '~/.config/awesome/configuration/utils/screenshot -r',
|
||||
delayed_screenshot = '~/.config/awesome/configuration/utils/screenshot --delayed -r',
|
||||
browser = 'env firefox',
|
||||
editor = 'gvim',
|
||||
social = 'env discord',
|
||||
files = 'nautilus',
|
||||
power_manager = 'gnome-power-statistics'
|
||||
},
|
||||
-- List of apps to start once on start-up
|
||||
run_on_start_up = {'~/.config/awesome/configuration/awspawn',
|
||||
'compton --config ' .. filesystem.get_configuration_dir() .. '/configuration/compton.conf',
|
||||
'nm-applet --indicator', 'ibus-daemon --xim --daemonize', 'scream-start', 'numlockx on',
|
||||
'/usr/lib/xfce-polkit/xfce-polkit & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)', -- credential manager
|
||||
'blueman-tray',
|
||||
'xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Natural Scrolling Enabled" 1',
|
||||
'xinput set-prop "ETPS/2 Elantech Touchpad" "libinput Tapping Enabled" 1'}
|
||||
}
|
||||
|
||||
53
src/.config/awesome/configuration/awspawn
Executable file
53
src/.config/awesome/configuration/awspawn
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
## This configuration file is meant for applications that
|
||||
# still run in the background when a reload is triggered
|
||||
# for awesome, this script just kills the running instance
|
||||
# and starts a new one.
|
||||
# Only add applications/scripts without parameters here
|
||||
# (if you want to apply parameters then use a script file!)
|
||||
|
||||
# List of applications to run
|
||||
# the script $HOME/.config/awesomestart
|
||||
# is intended to be a copy of this file
|
||||
# to allow out of tree autostart programs
|
||||
APPS=(
|
||||
# keepassxc
|
||||
# kdeconnect-indicator
|
||||
radeon-profile
|
||||
$HOME/.config/awesomestart
|
||||
)
|
||||
# Some applications start child applications that need to be killed on reload
|
||||
KILL=(
|
||||
synergyc
|
||||
nextcloud
|
||||
)
|
||||
# Some applications need to be started without GUI
|
||||
SILENT=(
|
||||
gnome-clocks
|
||||
)
|
||||
|
||||
#Kill the polkit
|
||||
killall xfce-polkit
|
||||
|
||||
# First kill lingering apps
|
||||
for app in "${APPS[@]}"
|
||||
do
|
||||
kill -9 $(pidof $app)
|
||||
done
|
||||
for app in "${KILL[@]}"
|
||||
do
|
||||
kill -9 $(pidof $app)
|
||||
done
|
||||
|
||||
# Start new instances
|
||||
for app in "${APPS[@]}"
|
||||
do
|
||||
env $app ${@:2} &
|
||||
done
|
||||
|
||||
# Run silent apps
|
||||
Xvfb :99 &
|
||||
for silentapp in "${SILENT[@]}"
|
||||
do
|
||||
DISPLAY=:99 $silentapp &
|
||||
done
|
||||
13
src/.config/awesome/configuration/client/buttons.lua
Normal file
13
src/.config/awesome/configuration/client/buttons.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
local awful = require('awful')
|
||||
|
||||
local modkey = require('configuration.keys.mod').modKey
|
||||
|
||||
return awful.util.table.join(awful.button({}, 1, function(c)
|
||||
_G.client.focus = c
|
||||
c:raise()
|
||||
end), awful.button({modkey}, 1, awful.mouse.client.move), awful.button({modkey}, 3, awful.mouse.client.resize),
|
||||
awful.button({modkey}, 4, function()
|
||||
awful.layout.inc(1)
|
||||
end), awful.button({modkey}, 5, function()
|
||||
awful.layout.inc(-1)
|
||||
end))
|
||||
1
src/.config/awesome/configuration/client/init.lua
Normal file
1
src/.config/awesome/configuration/client/init.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require('configuration.client.rules')
|
||||
24
src/.config/awesome/configuration/client/keys.lua
Normal file
24
src/.config/awesome/configuration/client/keys.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
local awful = require('awful')
|
||||
require('awful.autofocus')
|
||||
local modkey = require('configuration.keys.mod').modKey
|
||||
local altkey = require('configuration.keys.mod').altKey
|
||||
|
||||
local clientKeys = awful.util.table.join(awful.key({modkey}, 'f', function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end, {
|
||||
description = 'toggle fullscreen',
|
||||
group = 'client'
|
||||
}), awful.key({modkey, 'Shift'}, 'q', function(c)
|
||||
c:kill()
|
||||
end, {
|
||||
description = 'close',
|
||||
group = 'client'
|
||||
}), awful.key({modkey, 'Shift'}, 'c', function(c)
|
||||
c:kill()
|
||||
end, {
|
||||
description = 'close',
|
||||
group = 'client'
|
||||
}))
|
||||
|
||||
return clientKeys
|
||||
81
src/.config/awesome/configuration/client/rules.lua
Normal file
81
src/.config/awesome/configuration/client/rules.lua
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
local awful = require('awful')
|
||||
local gears = require('gears')
|
||||
local client_keys = require('configuration.client.keys')
|
||||
local client_buttons = require('configuration.client.buttons')
|
||||
|
||||
-- Rules
|
||||
awful.rules.rules = {{
|
||||
rule = {},
|
||||
properties = {
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = client_keys,
|
||||
buttons = client_buttons,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_offscreen,
|
||||
floating = false,
|
||||
maximized = false,
|
||||
above = false,
|
||||
below = false,
|
||||
ontop = false,
|
||||
sticky = false,
|
||||
maximized_horizontal = false,
|
||||
maximized_vertical = false
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
instance = {"QuakeTerminal"}
|
||||
},
|
||||
properties = {
|
||||
skip_decoration = true
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
type = {'dialog'},
|
||||
class = {'Wicd-client.py', 'calendar.google.com'}
|
||||
},
|
||||
properties = {
|
||||
placement = awful.placement.centered,
|
||||
ontop = true,
|
||||
floating = true,
|
||||
drawBackdrop = true,
|
||||
shape = function()
|
||||
return function(cr, w, h)
|
||||
gears.shape.rounded_rect(cr, w, h, 8)
|
||||
end
|
||||
end,
|
||||
skip_decoration = true
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
type = {'modal'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true,
|
||||
floating = true,
|
||||
above = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
type = {'utility'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = false,
|
||||
floating = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}, {
|
||||
rule_any = {
|
||||
type = {'splash'},
|
||||
name = {'Discord Updater'}
|
||||
},
|
||||
properties = {
|
||||
floating = true,
|
||||
above = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}}
|
||||
102
src/.config/awesome/configuration/compton.conf
Normal file
102
src/.config/awesome/configuration/compton.conf
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
# corner-radius = 8.0;
|
||||
# round-borders = 1;
|
||||
|
||||
# Shadow
|
||||
shadow = true;
|
||||
no-dnd-shadow = false;
|
||||
no-dock-shadow = false;
|
||||
shadow-radius = 15.0;
|
||||
shadow-offset-x = -11;
|
||||
shadow-offset-y = -4.5;
|
||||
shadow-opacity = 0.16;
|
||||
# shadow-red = 0.0;
|
||||
# shadow-green = 0.0;
|
||||
# shadow-blue = 0.0;
|
||||
shadow-exclude = [
|
||||
"name = 'Notification'",
|
||||
"class_g = 'Conky'",
|
||||
"class_g = 'slop'",
|
||||
"class_g = 'Rofi'",
|
||||
"class_g ?= 'Notify-osd'",
|
||||
"class_g = 'Cairo-clock'",
|
||||
"_GTK_FRAME_EXTENTS@:c"
|
||||
];
|
||||
#"window_type = 'splash'"
|
||||
# shadow-exclude = "n:e:Notification";
|
||||
# shadow-exclude-reg = "x10+0+0";
|
||||
# xinerama-shadow-crop = true;
|
||||
|
||||
# Opacity
|
||||
menu-opacity = 1.0;
|
||||
inactive-opacity = 1.0;
|
||||
active-opacity = 1.0;
|
||||
frame-opacity = 1.0;
|
||||
inactive-opacity-override = false;
|
||||
alpha-step = 0.06;
|
||||
# inactive-dim = 0.2;
|
||||
# inactive-dim-fixed = true;
|
||||
blur-background = true;
|
||||
blur-background-frame = true;
|
||||
blur-method = "kawase";
|
||||
blur-strength = 10;
|
||||
blur-background-fixed = true;
|
||||
blur-background-exclude = [
|
||||
"window_type = 'dock'",
|
||||
"window_type = 'desktop'",
|
||||
"class_g = 'slop'",
|
||||
"_GTK_FRAME_EXTENTS@:c"
|
||||
];
|
||||
|
||||
# Fading
|
||||
fading = true;
|
||||
fade-delta = 4;
|
||||
fade-in-step = 0.04;
|
||||
fade-out-step = 0.04;
|
||||
no-fading-openclose = false;
|
||||
# no-fading-destroyed-argb = true;
|
||||
fade-exclude = [ ];
|
||||
|
||||
# Other
|
||||
backend = "glx";
|
||||
mark-wmwin-focused = true;
|
||||
mark-ovredir-focused = true;
|
||||
# use-ewmh-active-win = true;
|
||||
detect-rounded-corners = true;
|
||||
detect-client-opacity = true;
|
||||
#refresh-rate = 0;
|
||||
#vsync = "none";
|
||||
dbe = false;
|
||||
# sw-opti = true;
|
||||
#unredir-if-possible = true;
|
||||
# unredir-if-possible-delay = 5000;
|
||||
# unredir-if-possible-exclude = [ ];
|
||||
focus-exclude = [ "class_g = 'Cairo-clock'" ];
|
||||
detect-transient = true;
|
||||
detect-client-leader = true;
|
||||
invert-color-include = [ ];
|
||||
# resize-damage = 1;
|
||||
|
||||
# GLX backend
|
||||
vsync="opengl-swc";
|
||||
unredir-if-possible=true;
|
||||
#paint-on-overlay=true;
|
||||
#glx-no-stencil=true;
|
||||
glx-copy-from-front=false;
|
||||
# glx-no-stencil = true;
|
||||
# glx-copy-from-front = false;
|
||||
# glx-use-copysubbuffermesa = true;
|
||||
glx-no-rebind-pixmap = true;
|
||||
#glx-swap-method = "exchange";
|
||||
#glx-use-gpushader4 = true;
|
||||
# xrender-sync = true;
|
||||
# xrender-sync-fence = true;
|
||||
|
||||
# Window type settings
|
||||
wintypes:
|
||||
{
|
||||
tooltip = {
|
||||
fade = true;
|
||||
shadow = true;
|
||||
focus = true;
|
||||
};
|
||||
};
|
||||
4
src/.config/awesome/configuration/init.lua
Normal file
4
src/.config/awesome/configuration/init.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
keys = require('configuration.keys'),
|
||||
apps = require('configuration.apps')
|
||||
}
|
||||
375
src/.config/awesome/configuration/keys/global.lua
Normal file
375
src/.config/awesome/configuration/keys/global.lua
Normal file
|
|
@ -0,0 +1,375 @@
|
|||
require('awful.autofocus')
|
||||
local awful = require('awful')
|
||||
local beautiful = require('beautiful')
|
||||
local hotkeys_popup = require('awful.hotkeys_popup').widget
|
||||
local modkey = require('configuration.keys.mod').modKey
|
||||
local altkey = require('configuration.keys.mod').altKey
|
||||
local apps = require('configuration.apps')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local theme = require('theme')
|
||||
|
||||
-- Key bindings
|
||||
local globalKeys = awful.util.table.join( -- Hotkeys
|
||||
awful.key({modkey}, 'h', hotkeys_popup.show_help, {
|
||||
description = 'show help',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey}, 'F1', hotkeys_popup.show_help, {
|
||||
description = 'show help',
|
||||
group = 'awesome'
|
||||
}), -- Tag browsing
|
||||
awful.key({modkey}, 'w', awful.tag.viewprev, {
|
||||
description = 'view previous',
|
||||
group = 'tag'
|
||||
}), awful.key({modkey}, 's', awful.tag.viewnext, {
|
||||
description = 'view next',
|
||||
group = 'tag'
|
||||
}), awful.key({altkey, 'Control'}, 'Left', awful.tag.viewprev, {
|
||||
description = 'view previous',
|
||||
group = 'tag'
|
||||
}), awful.key({altkey, 'Control'}, 'Right', awful.tag.viewnext, {
|
||||
description = 'view next',
|
||||
group = 'tag'
|
||||
}), awful.key({modkey}, 'Escape', awful.tag.history.restore, {
|
||||
description = 'go back',
|
||||
group = 'tag'
|
||||
}), -- Default client focus
|
||||
awful.key({modkey}, 'd', function()
|
||||
awful.client.focus.byidx(1)
|
||||
end, {
|
||||
description = 'focus next by index',
|
||||
group = 'client'
|
||||
}), awful.key({modkey}, 'a', function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end, {
|
||||
description = 'focus previous by index',
|
||||
group = 'client'
|
||||
}), awful.key({modkey}, 'r', function()
|
||||
_G.awesome.spawn(apps.default.rofi)
|
||||
end, {
|
||||
description = 'show rofi menu',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey}, 'd', function()
|
||||
local flag = false
|
||||
for _, c in ipairs(mouse.screen.selected_tag:clients()) do
|
||||
if c.minimized == true then
|
||||
flag = true
|
||||
end
|
||||
c.minimized = true
|
||||
end
|
||||
for _, c in ipairs(mouse.screen.selected_tag:clients()) do
|
||||
if flag == true then
|
||||
c.minimized = false
|
||||
end
|
||||
end
|
||||
end, {
|
||||
description = 'minimize all clients',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey}, 'u', awful.client.urgent.jumpto, {
|
||||
description = 'jump to urgent client',
|
||||
group = 'client'
|
||||
}), awful.key({altkey}, 'Tab', function()
|
||||
-- awful.client.focus.history.previous()
|
||||
awful.client.focus.byidx(1)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:raise()
|
||||
end
|
||||
end, {
|
||||
description = 'switch to next window',
|
||||
group = 'client'
|
||||
}), awful.key({altkey, 'Shift'}, 'Tab', function()
|
||||
-- awful.client.focus.history.previous()
|
||||
awful.client.focus.byidx(-1)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:raise()
|
||||
end
|
||||
end, {
|
||||
description = 'switch to previous window',
|
||||
group = 'client'
|
||||
}), awful.key({modkey}, 'l', function()
|
||||
awful.spawn(apps.default.lock)
|
||||
end, {
|
||||
description = 'lock the screen',
|
||||
group = 'awesome'
|
||||
}), awful.key({'Control', 'Shift'}, 'Print', function()
|
||||
awful.util.spawn_with_shell(apps.default.delayed_screenshot)
|
||||
end, {
|
||||
description = 'mark an area and screenshot it (clipboard)',
|
||||
group = 'screenshots (clipboard)'
|
||||
}), awful.key({altkey}, 'Print', function()
|
||||
awful.util.spawn_with_shell(apps.default.screenshot)
|
||||
end, {
|
||||
description = 'take a screenshot of your active monitor and copy it to clipboard',
|
||||
group = 'screenshots (clipboard)'
|
||||
}), awful.key({'Control'}, 'Print', function()
|
||||
awful.util.spawn_with_shell(apps.default.region_screenshot)
|
||||
end, {
|
||||
description = 'mark an area and screenshot it to your clipboard',
|
||||
group = 'screenshots (clipboard)'
|
||||
}), awful.key({modkey}, 'c', function()
|
||||
awful.util.spawn(apps.default.editor)
|
||||
end, {
|
||||
description = 'open a text/code editor',
|
||||
group = 'launcher'
|
||||
}), awful.key({modkey}, 'b', function()
|
||||
awful.util.spawn(apps.default.browser)
|
||||
end, {
|
||||
description = 'open a browser',
|
||||
group = 'launcher'
|
||||
}), awful.key({modkey}, 't', function()
|
||||
awful.util.spawn_with_shell(apps.default.terminal)
|
||||
end, {
|
||||
description = 'open a terminal',
|
||||
group = 'launcher'
|
||||
}), awful.key({modkey, 'Control'}, 'r', _G.awesome.restart, {
|
||||
description = 'reload awesome',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey, 'Control'}, 'q', _G.awesome.quit, {
|
||||
description = 'quit awesome',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey, 'Shift'}, 'g', function(t)
|
||||
t = t or awful.screen.focused().selected_tag
|
||||
local current_gap = t.gap
|
||||
local new_gap
|
||||
if current_gap == 0 then
|
||||
new_gap = beautiful.gaps
|
||||
else
|
||||
new_gap = 0
|
||||
end
|
||||
t.gap = new_gap
|
||||
end, {
|
||||
description = 'toggle gaps',
|
||||
group = 'awesome'
|
||||
}), awful.key({modkey, 'Shift'}, 'p', function()
|
||||
awful.util.spawn_with_shell(apps.default.power_command)
|
||||
end, {
|
||||
description = 'end session menu',
|
||||
group = 'awesome'
|
||||
}), awful.key({altkey, 'Shift'}, 'Right', function()
|
||||
awful.tag.incmwfact(0.05)
|
||||
end, {
|
||||
description = 'increase master width factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'Left', function()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end, {
|
||||
description = 'decrease master width factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'Down', function()
|
||||
awful.client.incwfact(0.05)
|
||||
end, {
|
||||
description = 'decrease master height factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'Up', function()
|
||||
awful.client.incwfact(-0.05)
|
||||
end, {
|
||||
description = 'increase master height factor',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Shift'}, 'Left', function()
|
||||
awful.tag.incnmaster(1, nil, true)
|
||||
end, {
|
||||
description = 'increase the number of master clients',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Shift'}, 'Right', function()
|
||||
awful.tag.incnmaster(-1, nil, true)
|
||||
end, {
|
||||
description = 'decrease the number of master clients',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Control'}, 'Left', function()
|
||||
awful.tag.incncol(1, nil, true)
|
||||
end, {
|
||||
description = 'increase the number of columns',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Control'}, 'Right', function()
|
||||
awful.tag.incncol(-1, nil, true)
|
||||
end, {
|
||||
description = 'decrease the number of columns',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey}, 'space', function()
|
||||
awful.layout.inc(1)
|
||||
end, {
|
||||
description = 'select next layout',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Shift'}, 'space', function()
|
||||
awful.layout.inc(-1)
|
||||
end, {
|
||||
description = 'select previous layout',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'l', function()
|
||||
awful.tag.incmwfact(0.05)
|
||||
end, {
|
||||
description = 'increase master width factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'h', function()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end, {
|
||||
description = 'decrease master width factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'j', function()
|
||||
awful.client.incwfact(0.05)
|
||||
end, {
|
||||
description = 'decrease master height factor',
|
||||
group = 'layout'
|
||||
}), awful.key({altkey, 'Shift'}, 'k', function()
|
||||
awful.client.incwfact(-0.05)
|
||||
end, {
|
||||
description = 'increase master height factor',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Shift'}, 'h', function()
|
||||
awful.tag.incnmaster(1, nil, true)
|
||||
end, {
|
||||
description = 'increase the number of master clients',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Shift'}, 'l', function()
|
||||
awful.tag.incnmaster(-1, nil, true)
|
||||
end, {
|
||||
description = 'decrease the number of master clients',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Control'}, 'h', function()
|
||||
awful.tag.incncol(1, nil, true)
|
||||
end, {
|
||||
description = 'increase the number of columns',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Control'}, 'l', function()
|
||||
awful.tag.incncol(-1, nil, true)
|
||||
end, {
|
||||
description = 'decrease the number of columns',
|
||||
group = 'layout'
|
||||
}), awful.key({modkey, 'Control'}, 'n', function()
|
||||
local c = awful.client.restore()
|
||||
-- Focus restored client
|
||||
if c then
|
||||
_G.client.focus = c
|
||||
c:raise()
|
||||
end
|
||||
end, {
|
||||
description = 'restore minimized',
|
||||
group = 'client'
|
||||
}), awful.key({altkey, 'Control'}, 'k', function()
|
||||
_G.toggle_quake()
|
||||
end, {
|
||||
description = 'dropdown application',
|
||||
group = 'launcher'
|
||||
}), awful.key({}, 'XF86MonBrightnessUp', function()
|
||||
awful.spawn('xbacklight -inc 10')
|
||||
end, {
|
||||
description = '+10%',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({}, 'XF86MonBrightnessDown', function()
|
||||
awful.spawn('xbacklight -dec 10')
|
||||
end, {
|
||||
description = '-10%',
|
||||
group = 'hotkeys'
|
||||
}), -- ALSA volume control
|
||||
awful.key({altkey}, 'k', function()
|
||||
awful.spawn.easy_async('amixer -D pulse sset Master 5%+', function()
|
||||
_G.update_volume()
|
||||
end)
|
||||
end, {
|
||||
description = 'volume up',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({}, 'XF86AudioRaiseVolume', function()
|
||||
awful.spawn.easy_async('amixer -D pulse sset Master 5%+', function()
|
||||
_G.update_volume()
|
||||
end)
|
||||
end, {
|
||||
description = 'volume up',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({}, 'XF86AudioLowerVolume', function()
|
||||
awful.spawn.easy_async('amixer -D pulse sset Master 5%-', function()
|
||||
_G.update_volume()
|
||||
end)
|
||||
end, {
|
||||
description = 'volume down',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({altkey}, 'j', function()
|
||||
awful.spawn.easy_async('amixer -D pulse sset Master 5%-', function()
|
||||
_G.update_volume()
|
||||
end)
|
||||
end, {
|
||||
description = 'volume down',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({altkey}, 'm', function()
|
||||
awful.spawn('amixer -D pulse set Master 1+ toggle')
|
||||
_G.update_volume()
|
||||
end, {
|
||||
description = 'toggle mute',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({}, 'XF86AudioMute', function()
|
||||
awful.spawn('amixer -D pulse set Master 1+ toggle')
|
||||
_G.update_volume()
|
||||
end, {
|
||||
description = 'toggle mute',
|
||||
group = 'hotkeys'
|
||||
}), awful.key({modkey}, 'o', awful.client.movetoscreen, {
|
||||
description = 'move window to next screen',
|
||||
group = 'client'
|
||||
}), awful.key({modkey}, 'n', function()
|
||||
awful.spawn(awful.screen.focused().selected_tag.defaultApp, {
|
||||
tag = _G.mouse.screen.selected_tag,
|
||||
placement = awful.placement.bottom_right
|
||||
})
|
||||
end, {
|
||||
description = 'open default program for tag/workspace',
|
||||
group = 'tag'
|
||||
}), awful.key({'Control', altkey}, 'space', function()
|
||||
awful.util.spawn_with_shell('vm-attach attach')
|
||||
end))
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
for i = 1, 9 do
|
||||
-- Hack to only show tags 1 and 9 in the shortcut window (mod+s)
|
||||
local descr_view, descr_toggle, descr_move, descr_toggle_focus
|
||||
if i == 1 or i == 9 then
|
||||
descr_view = {
|
||||
description = 'view tag #',
|
||||
group = 'tag'
|
||||
}
|
||||
descr_toggle = {
|
||||
description = 'toggle tag #',
|
||||
group = 'tag'
|
||||
}
|
||||
descr_move = {
|
||||
description = 'move focused client to tag #',
|
||||
group = 'tag'
|
||||
}
|
||||
descr_toggle_focus = {
|
||||
description = 'toggle focused client on tag #',
|
||||
group = 'tag'
|
||||
}
|
||||
end
|
||||
globalKeys = awful.util.table.join(globalKeys, -- View tag only.
|
||||
awful.key({modkey}, '#' .. i + 9, function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
end, descr_view), -- Toggle tag display.
|
||||
awful.key({modkey, 'Control'}, '#' .. i + 9, function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end, descr_toggle), -- Move client to tag.
|
||||
awful.key({modkey, 'Shift'}, '#' .. i + 9, function()
|
||||
if _G.client.focus then
|
||||
local tag = _G.client.focus.screen.tags[i]
|
||||
if tag then
|
||||
_G.client.focus:move_to_tag(tag)
|
||||
end
|
||||
end
|
||||
end, descr_move), -- Toggle tag on focused client.
|
||||
awful.key({modkey, 'Control', 'Shift'}, '#' .. i + 9, function()
|
||||
if _G.client.focus then
|
||||
local tag = _G.client.focus.screen.tags[i]
|
||||
if tag then
|
||||
_G.client.focus:toggle_tag(tag)
|
||||
end
|
||||
end
|
||||
end, descr_toggle_focus))
|
||||
end
|
||||
|
||||
return globalKeys
|
||||
4
src/.config/awesome/configuration/keys/init.lua
Normal file
4
src/.config/awesome/configuration/keys/init.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
mod = require('configuration.keys.mod'),
|
||||
global = require('configuration.keys.global')
|
||||
}
|
||||
4
src/.config/awesome/configuration/keys/mod.lua
Normal file
4
src/.config/awesome/configuration/keys/mod.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
modKey = 'Mod4',
|
||||
altKey = 'Mod1'
|
||||
}
|
||||
148
src/.config/awesome/configuration/rofi.rasi
Normal file
148
src/.config/awesome/configuration/rofi.rasi
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* User: deadguy
|
||||
* Copyright: deadguy
|
||||
*/
|
||||
|
||||
configuration {
|
||||
display-drun: "Activate";
|
||||
display-run: "Execute";
|
||||
show-icons: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
* {
|
||||
background-color: rgb(0, 0, 0, 0);
|
||||
text-color: rgb(255, 255, 255);
|
||||
selbg: rgb(255, 255, 255, 0.5);
|
||||
urgbg: rgb(255, 255, 255);
|
||||
actbg: rgb(255, 255, 255, 0.05);
|
||||
winbg: rgb(255, 255, 255);
|
||||
|
||||
selected-normal-foreground: @winbg;
|
||||
normal-foreground: @text-color;
|
||||
selected-normal-background: @actbg;
|
||||
normal-background: @background-color;
|
||||
|
||||
selected-urgent-foreground: @background-color;
|
||||
urgent-foreground: @text-color;
|
||||
selected-urgent-background: @urgbg;
|
||||
urgent-background: @background-color;
|
||||
|
||||
selected-active-foreground: @winbg;
|
||||
active-foreground: @text-color;
|
||||
selected-active-background: @actbg;
|
||||
active-background: @selbg;
|
||||
|
||||
line-margin: 2;
|
||||
line-padding: 2;
|
||||
separator-style: "none";
|
||||
hide-scrollbar: "true";
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font: "FiraCode Nerd Font Mono Medium 10";
|
||||
}
|
||||
|
||||
window {
|
||||
location: west;
|
||||
anchor: west;
|
||||
x-offset: 0px;
|
||||
height: 100%;
|
||||
width: 30%;
|
||||
padding: 0%;
|
||||
orientation: horizontal;
|
||||
children: [mainbox];
|
||||
background-color: rgb(20, 20, 20, 0.9);
|
||||
}
|
||||
|
||||
mainbox {
|
||||
spacing: 0em;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
children: [ inputbar, listview ];
|
||||
expand: true;
|
||||
}
|
||||
|
||||
button { padding: 5px 2px; }
|
||||
|
||||
button selected {
|
||||
background-color: @active-background;
|
||||
text-color: @background-color;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
children: [ entry ];
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
text-color: inherit;
|
||||
expand: false;
|
||||
margin: 0 0.3em 0em 0em;
|
||||
}
|
||||
|
||||
listview {
|
||||
spacing: 0em;
|
||||
dynamic: false;
|
||||
cycle: false;
|
||||
}
|
||||
|
||||
element {
|
||||
padding: 16px;
|
||||
border: 0 0 0 0 solid;
|
||||
}
|
||||
|
||||
entry {
|
||||
expand: true;
|
||||
text-color: @normal-foreground;
|
||||
background-color: rgb(0, 0, 0, 0);
|
||||
vertical-align: 1;
|
||||
padding: 12px;
|
||||
font: "FiraCode Nerd Font Mono Bold 18";
|
||||
}
|
||||
|
||||
element normal.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
|
||||
element normal.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
|
||||
element normal.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
|
||||
element selected.normal {
|
||||
background-color: @selected-normal-background;
|
||||
text-color: @selected-normal-foreground;
|
||||
padding: 16px;
|
||||
border: 0 0 0 5px solid;
|
||||
border-color: @active-background;
|
||||
}
|
||||
|
||||
element selected.urgent {
|
||||
background-color: @selected-urgent-background;
|
||||
text-color: @selected-urgent-foreground;
|
||||
}
|
||||
|
||||
element selected.active {
|
||||
background-color: @selected-active-background;
|
||||
text-color: @selected-active-foreground;
|
||||
}
|
||||
|
||||
element alternate.normal {
|
||||
background-color: @normal-background;
|
||||
text-color: @normal-foreground;
|
||||
}
|
||||
|
||||
element alternate.urgent {
|
||||
background-color: @urgent-background;
|
||||
text-color: @urgent-foreground;
|
||||
}
|
||||
|
||||
element alternate.active {
|
||||
background-color: @active-background;
|
||||
text-color: @active-foreground;
|
||||
}
|
||||
35
src/.config/awesome/configuration/utils/rofi-power
Executable file
35
src/.config/awesome/configuration/utils/rofi-power
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# rofi-power
|
||||
# Use rofi to call systemctl for shutdown, reboot, etc
|
||||
|
||||
# 2016 Oliver Kraitschy - http://okraits.de
|
||||
|
||||
OPTIONS="Power-off\nExit\nReboot\nSuspend\nHibernate"
|
||||
|
||||
config_path=$(dirname "$0")
|
||||
|
||||
LAUNCHER="rofi -dmenu -show-icons -icon-theme papirus -theme $config_path/../rofi.rasi"
|
||||
USE_LOCKER="false"
|
||||
LOCKER="i3lock-fancy"
|
||||
|
||||
option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'`
|
||||
case $option in
|
||||
Exit)
|
||||
kill -9 -1
|
||||
;;
|
||||
Reboot)
|
||||
systemctl reboot
|
||||
;;
|
||||
Power-off)
|
||||
systemctl poweroff
|
||||
;;
|
||||
Suspend)
|
||||
$($USE_LOCKER) && "$LOCKER"; systemctl suspend
|
||||
;;
|
||||
Hibernate)
|
||||
$($USE_LOCKER) && "$LOCKER"; systemctl hibernate
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
8
src/.config/awesome/configuration/utils/screenshot
Executable file
8
src/.config/awesome/configuration/utils/screenshot
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
if [ $1 == "--delayed" ]; then
|
||||
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
|
||||
else
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
39
src/.config/awesome/layout/init.lua
Normal file
39
src/.config/awesome/layout/init.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
local awful = require('awful')
|
||||
local top_bar = require('layout.top-bar')
|
||||
|
||||
local key_grabber
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
if s.index == 1 then
|
||||
s.top_bar = top_bar(s, true)
|
||||
else
|
||||
s.top_bar = top_bar(s, false)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Hide bars when app go fullscreen
|
||||
function updateBarsVisibility()
|
||||
for s in screen do
|
||||
if s.selected_tag then
|
||||
local fullscreen = s.selected_tag.fullscreenMode
|
||||
s.top_bar.visible = not fullscreen
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_G.tag.connect_signal('property::selected', function(t)
|
||||
updateBarsVisibility()
|
||||
end)
|
||||
|
||||
_G.client.connect_signal('property::fullscreen', function(c)
|
||||
c.screen.selected_tag.fullscreenMode = c.fullscreen
|
||||
updateBarsVisibility()
|
||||
end)
|
||||
|
||||
_G.client.connect_signal('unmanage', function(c)
|
||||
if c.fullscreen then
|
||||
c.screen.selected_tag.fullscreenMode = false
|
||||
updateBarsVisibility()
|
||||
end
|
||||
end)
|
||||
106
src/.config/awesome/layout/top-bar.lua
Normal file
106
src/.config/awesome/layout/top-bar.lua
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
local awful = require('awful')
|
||||
local beautiful = require('beautiful')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local mat_icon_button = require('widget.material.icon-button')
|
||||
local wibox = require('wibox')
|
||||
local TagList = require('widget.tag-list')
|
||||
local TaskList = require('widget.task-list')
|
||||
local gears = require('gears')
|
||||
local icons = require('theme.icons')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
local separator = wibox.widget {
|
||||
orientation = 'vertical',
|
||||
forced_width = dpi(2),
|
||||
opacity = 0.5,
|
||||
widget = wibox.widget.separator
|
||||
}
|
||||
|
||||
local TopBar = function(s, offset)
|
||||
|
||||
-- LAYOUT BOX
|
||||
-- ==========
|
||||
local LayoutBox = require('widget.layoutbox')
|
||||
|
||||
-- BATTERY
|
||||
-- =======
|
||||
local battery_widget = require('widget.battery')
|
||||
|
||||
-- SYSTEM TRAY
|
||||
-- ===========
|
||||
local systray = wibox.widget.systray()
|
||||
systray:set_horizontal(true)
|
||||
|
||||
-- TASK LIST
|
||||
-- =========
|
||||
local task_list = wibox.widget {
|
||||
nil,
|
||||
wibox.container.margin(TaskList(s), dpi(2), dpi(2), dpi(3), dpi(3)),
|
||||
nil,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
-- SYSTEM DETAILS
|
||||
-- ==============
|
||||
local volume_widget = require('widget.volume.volume-percentage')
|
||||
local date_widget = require('widget.date')
|
||||
local clock_widget = require('widget.clock')
|
||||
local mem_widget = require('widget.memory')
|
||||
local cpu_widget = require('widget.cpu')
|
||||
local system_details = wibox.widget {
|
||||
wibox.widget {
|
||||
wibox.container.background(systray, beautiful.primary.hue_800),
|
||||
wibox.container.background(battery_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(mem_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(cpu_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(volume_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(date_widget, beautiful.primary.hue_800),
|
||||
separator,
|
||||
wibox.container.background(clock_widget, beautiful.primary.hue_800),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
bg = beautiful.primary.hue_900,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local calendar = require('widget.calendar')
|
||||
calendar:attach(date_widget)
|
||||
|
||||
-- TOP BAR
|
||||
-- =======
|
||||
local panel = wibox({
|
||||
ontop = false,
|
||||
screen = s,
|
||||
height = dpi(24),
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.y,
|
||||
stretch = false,
|
||||
bg = beautiful.primary.hue_900,
|
||||
fg = beautiful.fg_normal
|
||||
})
|
||||
|
||||
panel:struts({
|
||||
top = panel.height - panel.y
|
||||
})
|
||||
|
||||
panel:setup{
|
||||
layout = wibox.layout.align.horizontal,
|
||||
spacing = dpi(0),
|
||||
TagList(s),
|
||||
task_list,
|
||||
wibox.widget {
|
||||
wibox.container.margin(system_details, dpi(2), dpi(2), dpi(3), dpi(3)),
|
||||
LayoutBox(s),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
}
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
return TopBar
|
||||
19
src/.config/awesome/module/auto-start.lua
Normal file
19
src/.config/awesome/module/auto-start.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- MODULE AUTO-START
|
||||
-- Run all the apps listed in configuration/apps.lua as run_on_start_up only once when awesome start
|
||||
|
||||
local awful = require('awful')
|
||||
local apps = require('configuration.apps')
|
||||
|
||||
local function run_once(cmd)
|
||||
local findme = cmd
|
||||
local firstspace = cmd:find(' ')
|
||||
if firstspace then
|
||||
findme = cmd:sub(0, firstspace - 1)
|
||||
end
|
||||
awful.spawn.with_shell(string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd))
|
||||
--This broke compton ===> awful.spawn.single_instance(string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd))
|
||||
end
|
||||
|
||||
for _, app in ipairs(apps.run_on_start_up) do
|
||||
run_once(app)
|
||||
end
|
||||
93
src/.config/awesome/module/decorate-client.lua
Normal file
93
src/.config/awesome/module/decorate-client.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
local awful = require('awful')
|
||||
local gears = require('gears')
|
||||
local beautiful = require('beautiful')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
local function renderClient(client, mode)
|
||||
if client.skip_decoration or (client.rendering_mode == mode) then
|
||||
return
|
||||
end
|
||||
|
||||
client.rendering_mode = mode
|
||||
client.floating = false
|
||||
client.maximized = false
|
||||
client.above = false
|
||||
client.below = false
|
||||
client.ontop = false
|
||||
client.sticky = false
|
||||
client.maximized_horizontal = false
|
||||
client.maximized_vertical = false
|
||||
|
||||
client.border_width = beautiful.border_width
|
||||
client.shape = function(cr, w, h)
|
||||
gears.shape.rectangle(cr, w, h)
|
||||
end
|
||||
end
|
||||
|
||||
local changesOnScreenCalled = false
|
||||
|
||||
local function changesOnScreen(currentScreen)
|
||||
local tagIsMax = currentScreen.selected_tag ~= nil and currentScreen.selected_tag.layout == awful.layout.suit.max
|
||||
local clientsToManage = {}
|
||||
|
||||
for _, client in pairs(currentScreen.clients) do
|
||||
if not client.skip_decoration and not client.hidden then
|
||||
table.insert(clientsToManage, client)
|
||||
end
|
||||
end
|
||||
|
||||
if (tagIsMax or #clientsToManage == 1) then
|
||||
currentScreen.client_mode = 'maximized'
|
||||
else
|
||||
currentScreen.client_mode = 'tiled'
|
||||
end
|
||||
|
||||
for _, client in pairs(clientsToManage) do
|
||||
renderClient(client, currentScreen.client_mode)
|
||||
end
|
||||
changesOnScreenCalled = false
|
||||
end
|
||||
|
||||
function clientCallback(client)
|
||||
if not changesOnScreenCalled then
|
||||
if not client.skip_decoration and client.screen then
|
||||
changesOnScreenCalled = true
|
||||
local screen = client.screen
|
||||
gears.timer.delayed_call(function()
|
||||
changesOnScreen(screen)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tagCallback(tag)
|
||||
if not changesOnScreenCalled then
|
||||
if tag.screen then
|
||||
changesOnScreenCalled = true
|
||||
local screen = tag.screen
|
||||
gears.timer.delayed_call(function()
|
||||
changesOnScreen(screen)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_G.client.connect_signal('manage', clientCallback)
|
||||
|
||||
_G.client.connect_signal('unmanage', clientCallback)
|
||||
|
||||
_G.client.connect_signal('property::hidden', clientCallback)
|
||||
|
||||
_G.client.connect_signal('property::minimized', clientCallback)
|
||||
|
||||
_G.client.connect_signal('property::fullscreen', function(c)
|
||||
if c.fullscreen then
|
||||
renderClient(c, 'maximized')
|
||||
else
|
||||
clientCallback(c)
|
||||
end
|
||||
end)
|
||||
|
||||
_G.tag.connect_signal('property::selected', tagCallback)
|
||||
|
||||
_G.tag.connect_signal('property::layout', tagCallback)
|
||||
53
src/.config/awesome/module/notifications.lua
Normal file
53
src/.config/awesome/module/notifications.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
local naughty = require('naughty')
|
||||
local beautiful = require('beautiful')
|
||||
local gears = require('gears')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
-- Naughty presets
|
||||
naughty.config.padding = 8
|
||||
naughty.config.spacing = 8
|
||||
|
||||
naughty.config.defaults.timeout = 5
|
||||
naughty.config.defaults.screen = 1
|
||||
naughty.config.defaults.position = 'top_right'
|
||||
naughty.config.defaults.margin = dpi(16)
|
||||
naughty.config.defaults.ontop = true
|
||||
naughty.config.defaults.font = beautiful.font
|
||||
naughty.config.defaults.icon = nil
|
||||
naughty.config.defaults.icon_size = dpi(32)
|
||||
naughty.config.defaults.shape = gears.shape.rectangle
|
||||
naughty.config.defaults.border_width = dpi(0)
|
||||
naughty.config.defaults.hover_timeout = nil
|
||||
|
||||
-- Error handling
|
||||
if _G.awesome.startup_errors then
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = 'Oops, there were errors during startup!',
|
||||
text = _G.awesome.startup_errors
|
||||
})
|
||||
end
|
||||
|
||||
do
|
||||
local in_error = false
|
||||
_G.awesome.connect_signal('debug::error', function(err)
|
||||
if in_error then
|
||||
return
|
||||
end
|
||||
in_error = true
|
||||
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = 'Oops, an error happened!',
|
||||
text = tostring(err)
|
||||
})
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
|
||||
function log_this(title, txt)
|
||||
naughty.notify({
|
||||
title = 'log: ' .. title,
|
||||
text = txt
|
||||
})
|
||||
end
|
||||
66
src/.config/awesome/module/quake-terminal.lua
Normal file
66
src/.config/awesome/module/quake-terminal.lua
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
local awful = require('awful')
|
||||
local app = require('configuration.apps').default.quake
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local beautiful = require('beautiful')
|
||||
local screen = awful.screen.focused()
|
||||
|
||||
-- Theme
|
||||
beautiful.init(require('theme'))
|
||||
|
||||
local quake_id = 'notnil'
|
||||
local quake_client
|
||||
local opened = false
|
||||
function create_shell()
|
||||
quake_id = awful.spawn.with_shell("exec -a QuakeTerminal " .. app)
|
||||
end
|
||||
|
||||
function open_quake()
|
||||
quake_client.hidden = false
|
||||
end
|
||||
|
||||
function close_quake()
|
||||
quake_client.hidden = true
|
||||
end
|
||||
|
||||
toggle_quake = function()
|
||||
opened = not opened
|
||||
if not quake_client then
|
||||
create_shell()
|
||||
else
|
||||
if opened then
|
||||
open_quake()
|
||||
client.focus = quake_client
|
||||
quake_client:raise()
|
||||
else
|
||||
close_quake()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_G.client.connect_signal('manage', function(c)
|
||||
if (c.pid == quake_id) then
|
||||
quake_client = c
|
||||
c.x = c.screen.geometry.x
|
||||
c.height = (c.screen.geometry.height / 5) * 3
|
||||
c.y = c.screen.geometry.height - c.height - beautiful.border_width
|
||||
c.floating = true
|
||||
c.skip_taskbar = true
|
||||
c.skip_decoration = true
|
||||
c.ontop = true
|
||||
c.floating = true
|
||||
c.above = true
|
||||
c.sticky = true
|
||||
c.type = 'dock'
|
||||
c.hidden = not opened
|
||||
c.maximized_horizontal = true
|
||||
c.border_width = beautiful.border_width
|
||||
c:move_to_tag(screen.tags[3])
|
||||
end
|
||||
end)
|
||||
|
||||
_G.client.connect_signal('unmanage', function(c)
|
||||
if (c.pid == quake_id) then
|
||||
opened = false
|
||||
quake_client = nil
|
||||
end
|
||||
end)
|
||||
65
src/.config/awesome/rc.lua
Normal file
65
src/.config/awesome/rc.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
require('awful.autofocus')
|
||||
local gears = require('gears')
|
||||
local awful = require('awful')
|
||||
local naughty = require('naughty')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
-- Theme
|
||||
beautiful.init(require('theme'))
|
||||
|
||||
-- Layout
|
||||
require('layout')
|
||||
|
||||
-- Init all modules
|
||||
require('module.notifications')
|
||||
require('module.auto-start')
|
||||
require('module.decorate-client')
|
||||
require('module.quake-terminal')
|
||||
|
||||
-- Setup all configurations
|
||||
require('configuration.client')
|
||||
require('configuration.tags')
|
||||
_G.root.keys(require('configuration.keys.global'))
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if beautiful.wallpaper then
|
||||
if type(beautiful.wallpaper) == "string" then
|
||||
if beautiful.wallpaper:sub(1, #"#") == "#" then
|
||||
gears.wallpaper.set(beautiful.wallpaper)
|
||||
elseif beautiful.wallpaper:sub(1, #"/") == "/" then
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
||||
end
|
||||
else
|
||||
beautiful.wallpaper(s)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Signal function to execute when a new client appears.
|
||||
_G.client.connect_signal('manage', function(c)
|
||||
-- Set the windows at the slave,
|
||||
-- i.e. put it at the end of others instead of setting it master.
|
||||
if not _G.awesome.startup then
|
||||
awful.client.setslave(c)
|
||||
end
|
||||
|
||||
if _G.awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
|
||||
-- Prevent clients from being unreachable after screen count changes.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
-- _G.client.connect_signal('mouse::enter', function(c)
|
||||
-- c:emit_signal('request::activate', 'mouse_enter', {raise = true})
|
||||
-- end)
|
||||
|
||||
-- Make the focused window have a glowing border
|
||||
_G.client.connect_signal('focus', function(c)
|
||||
c.border_color = beautiful.border_focus
|
||||
end)
|
||||
_G.client.connect_signal('unfocus', function(c)
|
||||
c.border_color = beautiful.border_normal
|
||||
end)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
src/.config/awesome/theme/color-schemes.lua
Normal file
15
src/.config/awesome/theme/color-schemes.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
-- Dracula
|
||||
dracula = {
|
||||
hue_50 = '#f8f8f2',
|
||||
hue_100 = '#f1fa8c',
|
||||
hue_200 = '#50fa7b',
|
||||
hue_300 = '#8be9fd',
|
||||
hue_400 = '#ff5555',
|
||||
hue_500 = '#6272a4',
|
||||
hue_600 = '#ff79c6',
|
||||
hue_700 = '#ffb86c',
|
||||
hue_800 = '#44475a',
|
||||
hue_900 = '#282a36'
|
||||
}
|
||||
}
|
||||
10
src/.config/awesome/theme/init.lua
Normal file
10
src/.config/awesome/theme/init.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local gtable = require('gears.table')
|
||||
local theme = require('theme.theme')
|
||||
|
||||
local final_theme = {}
|
||||
gtable.crush(final_theme, theme.theme)
|
||||
gtable.crush(final_theme, theme.theme)
|
||||
theme.awesome_overrides(final_theme)
|
||||
theme.awesome_overrides(final_theme)
|
||||
|
||||
return final_theme
|
||||
56
src/.config/awesome/theme/theme.lua
Normal file
56
src/.config/awesome/theme/theme.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
local filesystem = require('gears.filesystem')
|
||||
local color_schemes = require('theme.color-schemes')
|
||||
local theme_dir = filesystem.get_configuration_dir() .. '/theme'
|
||||
local gears = require('gears')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local theme = {}
|
||||
theme.icons = theme_dir .. '/icons/'
|
||||
|
||||
-- Primary Color Scheme
|
||||
theme.primary = color_schemes.dracula
|
||||
|
||||
local awesome_overrides = function(theme)
|
||||
theme.dir = os.getenv('HOME') .. '/.config/awesome/theme'
|
||||
|
||||
theme.icons = theme.dir .. '/icons/'
|
||||
theme.wallpaper = theme.dir .. '/wallpapers/4.png' -- Can be replaced with a color (eg: '#e0e0e0')
|
||||
theme.font = 'FiraCode Nerd Font Mono bold 9'
|
||||
|
||||
-- Layout
|
||||
theme.layout_max = theme.icons .. 'layouts/arrow-expand-all.png'
|
||||
theme.layout_tile = theme.icons .. 'layouts/view-quilt.png'
|
||||
theme.layout_floating = theme.icons .. 'layouts/floating.png'
|
||||
|
||||
-- Taglist
|
||||
theme.taglist_font = theme.font
|
||||
theme.taglist_bg_empty = theme.primary.hue_900
|
||||
theme.taglist_bg_occupied = 'linear:0,0:0,' .. dpi(32) .. ':0,' .. theme.primary.hue_800 .. ':0.1,' ..
|
||||
theme.primary.hue_800 .. ':0.1,' .. theme.primary.hue_900 .. ':0.9,' ..
|
||||
theme.primary.hue_900
|
||||
theme.taglist_bg_urgent = 'linear:0,0:0,' .. dpi(48) .. ':0,' .. theme.primary.hue_700 .. ':0.07,' ..
|
||||
theme.primary.hue_700 .. ':0.07,' .. theme.primary.hue_900 .. ':1,' ..
|
||||
theme.primary.hue_900
|
||||
theme.taglist_bg_focus = theme.primary.hue_200
|
||||
theme.taglist_fg_focus = theme.primary.hue_900
|
||||
|
||||
-- Tasklist
|
||||
theme.tasklist_font = theme.font
|
||||
theme.tasklist_bg_normal = theme.primary.hue_900
|
||||
theme.tasklist_bg_focus = theme.primary.hue_800
|
||||
theme.tasklist_bg_urgent = theme.primary.hue_900
|
||||
|
||||
-- Icons
|
||||
theme.icon_theme = 'Papirus'
|
||||
|
||||
-- Client
|
||||
theme.gaps = dpi(4)
|
||||
theme.border_width = dpi(2)
|
||||
theme.border_focus = theme.primary.hue_200
|
||||
theme.border_normal = theme.primary.hue_900
|
||||
theme.bg_normal = theme.primary.hue_900
|
||||
theme.bg_systray = theme.primary.hue_800
|
||||
end
|
||||
return {
|
||||
theme = theme,
|
||||
awesome_overrides = awesome_overrides
|
||||
}
|
||||
107
src/.config/awesome/widget/battery/init.lua
Normal file
107
src/.config/awesome/widget/battery/init.lua
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
-------------------------------------------------
|
||||
-- Battery Widget for Awesome Window Manager
|
||||
-- Shows the battery status using the ACPI tool
|
||||
-- More details could be found here:
|
||||
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/battery-widget
|
||||
-- @author Pavel Makhov
|
||||
-- @copyright 2017 Pavel Makhov
|
||||
-------------------------------------------------
|
||||
local awful = require('awful')
|
||||
local naughty = require('naughty')
|
||||
local watch = require('awful.widget.watch')
|
||||
local wibox = require('wibox')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local gears = require('gears')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local apps = require('configuration.apps')
|
||||
|
||||
-- acpi sample outputs
|
||||
-- Battery 0: Discharging, 75%, 01:51:38 remaining
|
||||
-- Battery 0: Charging, 53%, 00:57:43 until charged
|
||||
|
||||
local HOME = os.getenv('HOME')
|
||||
local PATH_TO_ICONS = HOME .. '/.config/awesome/widget/battery/icons/'
|
||||
local percentage = wibox.widget.textbox()
|
||||
|
||||
local widget = wibox.widget {
|
||||
{
|
||||
id = 'icon',
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = true
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
local battery_widget = wibox.widget {
|
||||
wibox.container.margin(widget, dpi(4), dpi(4), dpi(3), dpi(3)),
|
||||
wibox.container.margin(percentage, dpi(0), dpi(4), dpi(4), dpi(4)),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
-- Alternative to naughty.notify - tooltip. You can compare both and choose the preferred one
|
||||
local battery_popup = awful.tooltip({
|
||||
objects = {battery_widget},
|
||||
mode = 'outside',
|
||||
align = 'left',
|
||||
preferred_positions = {'right', 'left', 'top', 'bottom'}
|
||||
})
|
||||
|
||||
-- To use colors from beautiful theme put
|
||||
-- following lines in rc.lua before require("battery"):
|
||||
-- beautiful.tooltip_fg = beautiful.fg_normal
|
||||
-- beautiful.tooltip_bg = beautiful.bg_normal
|
||||
|
||||
watch('acpi -i', 1, function(_, stdout)
|
||||
local batteryIconName = 'battery'
|
||||
|
||||
local battery_info = {}
|
||||
local capacities = {}
|
||||
for s in stdout:gmatch('[^\r\n]+') do
|
||||
local status, charge_str, time = string.match(s, '.+: (%a+), (%d?%d?%d)%%,?.*')
|
||||
if status ~= nil then
|
||||
table.insert(battery_info, {
|
||||
status = status,
|
||||
charge = tonumber(charge_str)
|
||||
})
|
||||
else
|
||||
local cap_str = string.match(s, '.+:.+last full capacity (%d+)')
|
||||
table.insert(capacities, tonumber(cap_str))
|
||||
end
|
||||
end
|
||||
|
||||
local capacity = 0
|
||||
for _, cap in ipairs(capacities) do
|
||||
capacity = capacity + cap
|
||||
end
|
||||
|
||||
local charge = 0
|
||||
local status
|
||||
for i, batt in ipairs(battery_info) do
|
||||
if batt.charge >= charge then
|
||||
status = batt.status -- use most charged battery status
|
||||
-- this is arbitrary, and maybe another metric should be used
|
||||
end
|
||||
|
||||
charge = charge + batt.charge * capacities[i]
|
||||
end
|
||||
charge = charge / capacity
|
||||
|
||||
if status == 'Charging' or status == 'Full' then
|
||||
batteryIconName = batteryIconName .. '-charging'
|
||||
end
|
||||
|
||||
local roundedCharge = math.floor(charge / 10) * 10
|
||||
if (roundedCharge == 0) then
|
||||
batteryIconName = batteryIconName .. '-outline'
|
||||
elseif (roundedCharge ~= 100) then
|
||||
batteryIconName = batteryIconName .. '-' .. roundedCharge
|
||||
end
|
||||
|
||||
widget.icon:set_image(PATH_TO_ICONS .. batteryIconName .. '.svg')
|
||||
-- Update popup text
|
||||
battery_popup.text = string.gsub(stdout, '\n$', '')
|
||||
percentage.text = math.floor(charge)
|
||||
collectgarbage('collect')
|
||||
end, widget)
|
||||
|
||||
return battery_widget
|
||||
44
src/.config/awesome/widget/cpu/init.lua
Normal file
44
src/.config/awesome/widget/cpu/init.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
local wibox = require('wibox')
|
||||
local beautiful = require('beautiful')
|
||||
local icons = require('theme.icons')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local watch = require('awful.widget.watch')
|
||||
|
||||
local icon = wibox.widget {
|
||||
wibox.widget {
|
||||
image = icons.cpu,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
top = dpi(3),
|
||||
bottom = dpi(3),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local percentage = wibox.widget.textbox()
|
||||
local total_prev = 0
|
||||
local idle_prev = 0
|
||||
|
||||
watch([[bash -c "cat /proc/stat | grep '^cpu '"]], 1, function(_, stdout)
|
||||
local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
|
||||
stdout:match('(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s')
|
||||
|
||||
local total = user + nice + system + idle + iowait + irq + softirq + steal
|
||||
|
||||
local diff_idle = idle - idle_prev
|
||||
local diff_total = total - total_prev
|
||||
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
|
||||
|
||||
percentage.text = math.floor(diff_usage) .. '%'
|
||||
|
||||
total_prev = total
|
||||
idle_prev = idle
|
||||
collectgarbage('collect')
|
||||
end)
|
||||
|
||||
local cpu_widget = wibox.widget {
|
||||
icon,
|
||||
wibox.container.margin(percentage, dpi(4), dpi(4), dpi(4), dpi(4)),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
return wibox.container.margin(cpu_widget, dpi(4), dpi(4))
|
||||
39
src/.config/awesome/widget/material/clickable-container.lua
Normal file
39
src/.config/awesome/widget/material/clickable-container.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
local wibox = require('wibox')
|
||||
|
||||
function build(widget)
|
||||
local container = wibox.widget {
|
||||
widget,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
local old_cursor, old_wibox
|
||||
|
||||
container:connect_signal('mouse::enter', function()
|
||||
container.bg = '#ffffff11'
|
||||
-- Hm, no idea how to get the wibox from this signal's arguments...
|
||||
local w = _G.mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = 'hand1'
|
||||
end
|
||||
end)
|
||||
|
||||
container:connect_signal('mouse::leave', function()
|
||||
container.bg = '#ffffff00'
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end)
|
||||
|
||||
container:connect_signal('button::press', function()
|
||||
container.bg = '#ffffff22'
|
||||
end)
|
||||
|
||||
container:connect_signal('button::release', function()
|
||||
container.bg = '#ffffff11'
|
||||
end)
|
||||
|
||||
return container
|
||||
end
|
||||
|
||||
return build
|
||||
14
src/.config/awesome/widget/material/icon-button.lua
Normal file
14
src/.config/awesome/widget/material/icon-button.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
local wibox = require('wibox')
|
||||
local gears = require('gears')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
function build(imagebox, args)
|
||||
return wibox.widget {
|
||||
imagebox,
|
||||
shape = gears.shape.circle,
|
||||
widget = clickable_container
|
||||
}
|
||||
end
|
||||
|
||||
return build
|
||||
80
src/.config/awesome/widget/material/icon.lua
Normal file
80
src/.config/awesome/widget/material/icon.lua
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
-- Default widget requirements
|
||||
local base = require('wibox.widget.base')
|
||||
local gtable = require('gears.table')
|
||||
local setmetatable = setmetatable
|
||||
|
||||
-- Commons requirements
|
||||
local wibox = require('wibox')
|
||||
|
||||
-- Local declarations
|
||||
|
||||
local mat_list_item = {mt = {}}
|
||||
|
||||
function mat_list_item:layout(_, width, height)
|
||||
local layout = {}
|
||||
|
||||
-- Add divider if present
|
||||
if self._private.icon then
|
||||
table.insert(
|
||||
layout,
|
||||
base.place_widget_at(
|
||||
self._private.imagebox,
|
||||
width / 2 - self._private.size / 2,
|
||||
height / 2 - self._private.size / 2,
|
||||
self._private.size,
|
||||
self._private.size
|
||||
)
|
||||
)
|
||||
end
|
||||
return layout
|
||||
end
|
||||
|
||||
function mat_list_item:fit(_, width, height)
|
||||
local min = math.min(width, height)
|
||||
return min, min
|
||||
end
|
||||
|
||||
function mat_list_item:set_icon(icon)
|
||||
self._private.icon = icon
|
||||
self._private.imagebox.image = icon
|
||||
end
|
||||
|
||||
function mat_list_item:get_icon()
|
||||
return self._private.icon
|
||||
end
|
||||
|
||||
function mat_list_item:set_size(size)
|
||||
self._private.size = size
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:get_size()
|
||||
return self._private.size
|
||||
end
|
||||
|
||||
local function new(icon, size)
|
||||
local ret =
|
||||
base.make_widget(
|
||||
nil,
|
||||
nil,
|
||||
{
|
||||
enable_properties = true
|
||||
}
|
||||
)
|
||||
|
||||
gtable.crush(ret, mat_list_item, true)
|
||||
ret._private.icon = icon
|
||||
ret._private.imagebox = wibox.widget.imagebox(icon)
|
||||
ret._private.size = size
|
||||
return ret
|
||||
end
|
||||
|
||||
function mat_list_item.mt:__call(...)
|
||||
return new(...)
|
||||
end
|
||||
|
||||
--@DOC_widget_COMMON@
|
||||
|
||||
--@DOC_object_COMMON@
|
||||
|
||||
return setmetatable(mat_list_item, mat_list_item.mt)
|
||||
186
src/.config/awesome/widget/material/list-item.lua
Normal file
186
src/.config/awesome/widget/material/list-item.lua
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
-- Default widget requirements
|
||||
local base = require('wibox.widget.base')
|
||||
local gtable = require('gears.table')
|
||||
local setmetatable = setmetatable
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
-- Commons requirements
|
||||
local wibox = require('wibox')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
-- Local declarations
|
||||
|
||||
local mat_list_item = {
|
||||
mt = {}
|
||||
}
|
||||
|
||||
function mat_list_item:build_separator()
|
||||
self._private.separator = wibox.widget {
|
||||
orientation = 'horizontal',
|
||||
forced_height = 1,
|
||||
opacity = 0.08,
|
||||
widget = wibox.widget.separator
|
||||
}
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:build_clickable_container()
|
||||
self._private.clickable_container = wibox.widget {
|
||||
wibox.widget {
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
widget = clickable_container
|
||||
}
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:layout(_, width, height)
|
||||
local content_width = width - dpi(32)
|
||||
local content_x = dpi(dpi(16))
|
||||
local layout = {}
|
||||
|
||||
-- Add divider if present
|
||||
if self._private.divider then
|
||||
table.insert(layout, base.place_widget_at(self._private.separator, 0, 0, width, 1))
|
||||
end
|
||||
|
||||
-- Add clickable_container if clickable
|
||||
if self._private.clickable then
|
||||
table.insert(layout, base.place_widget_at(self._private.clickable_container, 0, 0, width, height))
|
||||
end
|
||||
|
||||
if self._private.prefix then
|
||||
content_x = content_x + dpi(54)
|
||||
content_width = content_width - dpi(54)
|
||||
table.insert(layout, base.place_widget_at(self._private.prefix, dpi(16), 0, dpi(48), height))
|
||||
end
|
||||
|
||||
if self._private.suffix then
|
||||
content_width = content_width - dpi(54)
|
||||
table.insert(layout, base.place_widget_at(self._private.suffix, width - dpi(40), dpi(12), width, height))
|
||||
end
|
||||
table.insert(layout, base.place_widget_at(self._private.content, content_x, 0, content_width, height))
|
||||
return layout
|
||||
end
|
||||
|
||||
function mat_list_item:fit(_, width)
|
||||
return width, dpi(48)
|
||||
end
|
||||
|
||||
---- Properties ----
|
||||
|
||||
-- Property clickable
|
||||
function mat_list_item:set_clickable(value)
|
||||
if self._private.clickable ~= value then
|
||||
self._private.clickable = value
|
||||
self:emit_signal('property::clickable')
|
||||
self:emit_signal('widget::layout_changed')
|
||||
|
||||
if self._private.clickable and not self._private.clickable_container then
|
||||
self:build_clickable_container()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mat_list_item:get_clickable()
|
||||
return self._private.clickable
|
||||
end
|
||||
|
||||
-- Property divider
|
||||
|
||||
function mat_list_item:set_divider(value)
|
||||
if self._private.divider ~= value then
|
||||
self._private.divider = value
|
||||
self:emit_signal('property::divider')
|
||||
self:emit_signal('widget::layout_changed')
|
||||
|
||||
if self._private.divider and not self._private.separator then
|
||||
self:build_separator()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mat_list_item:get_divider()
|
||||
return self._private.divider
|
||||
end
|
||||
|
||||
function mat_list_item:set_prefix(widget)
|
||||
if widget then
|
||||
base.check_widget(widget)
|
||||
end
|
||||
self._private.prefix = widget
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:get_prefix()
|
||||
return self._private.prefix
|
||||
end
|
||||
|
||||
function mat_list_item:set_suffix(widget)
|
||||
if widget then
|
||||
base.check_widget(widget)
|
||||
end
|
||||
self._private.suffix = widget
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:get_suffix()
|
||||
return self._private.suffix
|
||||
end
|
||||
|
||||
--- The widget who will be the content.
|
||||
-- @property content
|
||||
-- @tparam widget widget The widget
|
||||
|
||||
function mat_list_item:set_content(widget)
|
||||
if widget then
|
||||
base.check_widget(widget)
|
||||
end
|
||||
self._private.content = widget
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
|
||||
function mat_list_item:get_content()
|
||||
return self._private.content
|
||||
end
|
||||
|
||||
-- Get the number of children element
|
||||
-- @treturn table The children
|
||||
function mat_list_item:get_children()
|
||||
return {self._private.widget}
|
||||
end
|
||||
|
||||
-- Replace the layout children
|
||||
-- This layout only accept one children, all others will be ignored
|
||||
-- @tparam table children A table composed of valid widgets
|
||||
function mat_list_item:set_children(children)
|
||||
if not children[2] then
|
||||
self:set_content(children[1])
|
||||
else
|
||||
self:set_prefix(children[1])
|
||||
self:set_content(children[2])
|
||||
end
|
||||
if children[3] then
|
||||
self:set_suffix(children[3])
|
||||
end
|
||||
end
|
||||
|
||||
local function new(widget)
|
||||
local ret = base.make_widget(nil, nil, {
|
||||
enable_properties = true
|
||||
})
|
||||
|
||||
gtable.crush(ret, mat_list_item, true)
|
||||
|
||||
ret._private.content = widget
|
||||
return ret
|
||||
end
|
||||
|
||||
function mat_list_item.mt:__call(...)
|
||||
return new(...)
|
||||
end
|
||||
|
||||
-- @DOC_widget_COMMON@
|
||||
|
||||
-- @DOC_object_COMMON@
|
||||
|
||||
return setmetatable(mat_list_item, mat_list_item.mt)
|
||||
117
src/.config/awesome/widget/material/slider.lua
Normal file
117
src/.config/awesome/widget/material/slider.lua
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
-- Default widget requirements
|
||||
local base = require('wibox.widget.base')
|
||||
local gtable = require('gears.table')
|
||||
local setmetatable = setmetatable
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
-- Commons requirements
|
||||
local wibox = require('wibox')
|
||||
local gears = require('gears')
|
||||
local beautiful = require('beautiful')
|
||||
local mat_colors = require('theme.mat-colors')
|
||||
-- Local declarations
|
||||
|
||||
local mat_slider = {
|
||||
mt = {}
|
||||
}
|
||||
|
||||
local properties = {
|
||||
read_only = false
|
||||
}
|
||||
|
||||
function mat_slider:set_value(value)
|
||||
if self._private.value ~= value then
|
||||
self._private.value = value
|
||||
self._private.progress_bar:set_value(self._private.value)
|
||||
self._private.slider:set_value(self._private.value)
|
||||
self:emit_signal('property::value')
|
||||
-- self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
end
|
||||
|
||||
function mat_slider:get_value(value)
|
||||
return self._private.value
|
||||
end
|
||||
|
||||
function mat_slider:set_read_only(value)
|
||||
if self._private.read_only ~= value then
|
||||
self._private.read_only = value
|
||||
self:emit_signal('property::read_only')
|
||||
self:emit_signal('widget::layout_changed')
|
||||
end
|
||||
end
|
||||
|
||||
function mat_slider:get_read_only(value)
|
||||
return self._private.read_only
|
||||
end
|
||||
|
||||
function mat_slider:layout(_, width, height)
|
||||
local layout = {}
|
||||
table.insert(layout, base.place_widget_at(self._private.progress_bar, 0, dpi(21), width, height - dpi(42)))
|
||||
if (not self._private.read_only) then
|
||||
table.insert(layout, base.place_widget_at(self._private.slider, 0, dpi(6), width, height - dpi(12)))
|
||||
end
|
||||
return layout
|
||||
end
|
||||
|
||||
function mat_slider:draw(_, cr, width, height)
|
||||
if (self._private.read_only) then
|
||||
self._private.slider.forced_height = 0
|
||||
end
|
||||
end
|
||||
|
||||
function mat_slider:fit(_, width, height)
|
||||
return width, height
|
||||
end
|
||||
|
||||
local function new(args)
|
||||
local ret = base.make_widget(nil, nil, {
|
||||
enable_properties = true
|
||||
})
|
||||
|
||||
gtable.crush(ret._private, args or {})
|
||||
|
||||
gtable.crush(ret, mat_slider, true)
|
||||
|
||||
ret._private.progress_bar = wibox.widget {
|
||||
max_value = 100,
|
||||
value = 25,
|
||||
forced_height = dpi(6),
|
||||
paddings = 0,
|
||||
shape = gears.shape.rounded_rect,
|
||||
background_color = beautiful.primary.hue_900,
|
||||
color = beautiful.primary.hue_400,
|
||||
widget = wibox.widget.progressbar
|
||||
}
|
||||
|
||||
ret._private.slider = wibox.widget {
|
||||
forced_height = dpi(8),
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = 0,
|
||||
bar_color = beautiful.primary.hue_500,
|
||||
handle_color = beautiful.primary.hue_300,
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_border_color = '#00000012',
|
||||
handle_border_width = dpi(3),
|
||||
value = 25,
|
||||
widget = wibox.widget.slider
|
||||
}
|
||||
|
||||
ret._private.slider:connect_signal('property::value', function()
|
||||
ret:set_value(ret._private.slider.value)
|
||||
end)
|
||||
|
||||
ret._private.read_only = false
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function mat_slider.mt:__call(...)
|
||||
return new(...)
|
||||
end
|
||||
|
||||
-- @DOC_widget_COMMON@
|
||||
|
||||
-- @DOC_object_COMMON@
|
||||
|
||||
return setmetatable(mat_slider, mat_slider.mt)
|
||||
127
src/.config/awesome/widget/tag-list/init.lua
Normal file
127
src/.config/awesome/widget/tag-list/init.lua
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
local awful = require('awful')
|
||||
local wibox = require('wibox')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local capi = {
|
||||
button = _G.button
|
||||
}
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local modkey = require('configuration.keys.mod').modKey
|
||||
--- Common method to create buttons.
|
||||
-- @tab buttons
|
||||
-- @param object
|
||||
-- @treturn table
|
||||
local function create_buttons(buttons, object)
|
||||
if buttons then
|
||||
local btns = {}
|
||||
for _, b in ipairs(buttons) do
|
||||
-- Create a proxy button object: it will receive the real
|
||||
-- press and release events, and will propagate them to the
|
||||
-- button object the user provided, but with the object as
|
||||
-- argument.
|
||||
local btn = capi.button {
|
||||
modifiers = b.modifiers,
|
||||
button = b.button
|
||||
}
|
||||
btn:connect_signal('press', function()
|
||||
b:emit_signal('press', object)
|
||||
end)
|
||||
btn:connect_signal('release', function()
|
||||
b:emit_signal('release', object)
|
||||
end)
|
||||
btns[#btns + 1] = btn
|
||||
end
|
||||
|
||||
return btns
|
||||
end
|
||||
end
|
||||
|
||||
local function list_update(w, buttons, label, data, objects)
|
||||
-- update the widgets, creating them if needed
|
||||
w:reset()
|
||||
for i, o in ipairs(objects) do
|
||||
local cache = data[o]
|
||||
local ib, tb, bgb, tbm, ibm, l, bg_clickable
|
||||
if cache then
|
||||
ib = cache.ib
|
||||
tb = cache.tb
|
||||
bgb = cache.bgb
|
||||
tbm = cache.tbm
|
||||
ibm = cache.ibm
|
||||
else
|
||||
ib = wibox.widget.imagebox()
|
||||
tb = wibox.widget.textbox()
|
||||
bgb = wibox.container.background()
|
||||
tbm = wibox.container.margin(tb, dpi(6), dpi(6), dpi(4), dpi(4))
|
||||
ibm = wibox.container.margin(ib, dpi(8), dpi(8), dpi(9), dpi(9))
|
||||
l = wibox.layout.fixed.horizontal()
|
||||
bg_clickable = clickable_container()
|
||||
|
||||
-- All of this is added in a fixed widget
|
||||
l:fill_space(true)
|
||||
-- l:add(ibm)
|
||||
l:add(tbm)
|
||||
bg_clickable:set_widget(l)
|
||||
|
||||
-- And all of this gets a background
|
||||
bgb:set_widget(bg_clickable)
|
||||
|
||||
bgb:buttons(create_buttons(buttons, o))
|
||||
|
||||
data[o] = {
|
||||
ib = ib,
|
||||
tb = tb,
|
||||
bgb = bgb,
|
||||
tbm = tbm,
|
||||
ibm = ibm
|
||||
}
|
||||
end
|
||||
|
||||
local text, bg, bg_image, icon, args = label(o, tb)
|
||||
args = args or {}
|
||||
|
||||
if text == nil or text == '' then
|
||||
tbm:set_margins(0)
|
||||
else
|
||||
if not tb:set_markup_silently(text) then
|
||||
tb:set_markup('<i><Invalid text></i>')
|
||||
end
|
||||
end
|
||||
bgb:set_bg(bg)
|
||||
if type(bg_image) == 'function' then
|
||||
bg_image = bg_image(tb, o, nil, objects, i)
|
||||
end
|
||||
bgb:set_bgimage(bg_image)
|
||||
if icon then
|
||||
ib.image = icon
|
||||
else
|
||||
ibm:set_margins(0)
|
||||
end
|
||||
|
||||
bgb.shape = args.shape
|
||||
bgb.shape_border_width = args.shape_border_width
|
||||
bgb.shape_border_color = args.shape_border_color
|
||||
|
||||
w:add(bgb)
|
||||
end
|
||||
end
|
||||
|
||||
local TagList = function(s)
|
||||
return awful.widget.taglist(s, awful.widget.taglist.filter.all,
|
||||
awful.util.table.join(awful.button({}, 1, function(t)
|
||||
t:view_only()
|
||||
end), awful.button({modkey}, 1, function(t)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:move_to_tag(t)
|
||||
t:view_only()
|
||||
end
|
||||
end), awful.button({}, 3, awful.tag.viewtoggle), awful.button({modkey}, 3, function(t)
|
||||
if _G.client.focus then
|
||||
_G.client.focus:toggle_tag(t)
|
||||
end
|
||||
end), awful.button({}, 4, function(t)
|
||||
awful.tag.viewprev(t.screen)
|
||||
end), awful.button({}, 5, function(t)
|
||||
awful.tag.viewnext(t.screen)
|
||||
end)), {}, list_update, wibox.layout.fixed.horizontal())
|
||||
end
|
||||
return TagList
|
||||
144
src/.config/awesome/widget/task-list/init.lua
Normal file
144
src/.config/awesome/widget/task-list/init.lua
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
local awful = require('awful')
|
||||
local wibox = require('wibox')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
local capi = {
|
||||
button = _G.button
|
||||
}
|
||||
local gears = require('gears')
|
||||
local clickable_container = require('widget.material.clickable-container')
|
||||
local tasklist_mode = 'text'
|
||||
local beautiful = require('beautiful')
|
||||
--- Common method to create buttons.
|
||||
-- @tab buttons
|
||||
-- @param object
|
||||
-- @treturn table
|
||||
local function create_buttons(buttons, object)
|
||||
if buttons then
|
||||
local btns = {}
|
||||
for _, b in ipairs(buttons) do
|
||||
-- Create a proxy button object: it will receive the real
|
||||
-- press and release events, and will propagate them to the
|
||||
-- button object the user provided, but with the object as
|
||||
-- argument.
|
||||
local btn = capi.button {
|
||||
modifiers = b.modifiers,
|
||||
button = b.button
|
||||
}
|
||||
btn:connect_signal('press', function()
|
||||
b:emit_signal('press', object)
|
||||
end)
|
||||
btn:connect_signal('release', function()
|
||||
b:emit_signal('release', object)
|
||||
end)
|
||||
btns[#btns + 1] = btn
|
||||
end
|
||||
|
||||
return btns
|
||||
end
|
||||
end
|
||||
|
||||
local function list_update(w, buttons, label, data, objects)
|
||||
-- update the widgets, creating them if needed
|
||||
w:reset()
|
||||
for i, o in ipairs(objects) do
|
||||
local cache = data[o]
|
||||
local ib, tb, bgb, tbm, ibm, l, ll, bg_clickable
|
||||
if cache then
|
||||
ib = cache.ib
|
||||
tb = cache.tb
|
||||
bgb = cache.bgb
|
||||
tbm = cache.tbm
|
||||
ibm = cache.ibm
|
||||
else
|
||||
ib = wibox.widget.imagebox()
|
||||
tb = wibox.widget.textbox()
|
||||
bg_clickable = clickable_container()
|
||||
bgb = wibox.container.background()
|
||||
tbm = wibox.container.margin(tb, dpi(4), dpi(4), dpi(1), dpi(1))
|
||||
ibm = wibox.container.margin(ib, dpi(2), dpi(2), dpi(2), dpi(2))
|
||||
l = wibox.layout.fixed.horizontal()
|
||||
ll = wibox.layout.flex.horizontal()
|
||||
|
||||
-- All of this is added in a fixed widget
|
||||
l:fill_space(true)
|
||||
l:add(ibm)
|
||||
l:add(tbm)
|
||||
ll:add(l)
|
||||
|
||||
bg_clickable:set_widget(ll)
|
||||
-- And all of this gets a background
|
||||
bgb:set_widget(bg_clickable)
|
||||
|
||||
l:buttons(create_buttons(buttons, o))
|
||||
|
||||
data[o] = {
|
||||
ib = ib,
|
||||
tb = tb,
|
||||
bgb = bgb,
|
||||
tbm = tbm,
|
||||
ibm = ibm
|
||||
}
|
||||
end
|
||||
|
||||
local text, bg, bg_image, icon, args = label(o, tb)
|
||||
args = args or {}
|
||||
|
||||
-- The text might be invalid, so use pcall.
|
||||
if tasklist_mode == 'icon' then
|
||||
text = nil
|
||||
end
|
||||
if text == nil or text == '' then
|
||||
tbm:set_margins(0)
|
||||
else
|
||||
if not tb:set_markup_silently(text) then
|
||||
tb:set_markup('<i><Invalid text></i>')
|
||||
end
|
||||
end
|
||||
bgb:set_bg(bg)
|
||||
if type(bg_image) == 'function' then
|
||||
bg_image = bg_image(tb, o, nil, objects, i)
|
||||
end
|
||||
bgb:set_bgimage(bg_image)
|
||||
if icon then
|
||||
ib.image = icon
|
||||
ib.resize = true
|
||||
else
|
||||
ibm:set_margins(0)
|
||||
end
|
||||
|
||||
bgb.shape = args.shape
|
||||
bgb.shape_border_width = args.shape_border_width
|
||||
bgb.shape_border_color = args.shape_border_color
|
||||
|
||||
w:add(bgb)
|
||||
end
|
||||
end
|
||||
|
||||
local tasklist_buttons = awful.util.table.join(awful.button({}, 1, function(c)
|
||||
if c == _G.client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
-- Without this, the following
|
||||
-- :isvisible() makes no sense
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
-- This will also un-minimize
|
||||
-- the client, if needed
|
||||
_G.client.focus = c
|
||||
c:raise()
|
||||
end
|
||||
end), awful.button({}, 4, function()
|
||||
awful.client.focus.byidx(1)
|
||||
end), awful.button({}, 5, function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end), awful.button({}, 2, function(c)
|
||||
c.kill(c)
|
||||
end))
|
||||
|
||||
local TaskList = function(s)
|
||||
return awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons, nil, list_update)
|
||||
end
|
||||
|
||||
return TaskList
|
||||
19
src/.config/kitty/diff.conf
Normal file
19
src/.config/kitty/diff.conf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
foreground #f8f8f2
|
||||
background #282a36
|
||||
title_fg #f8f8f2
|
||||
title_bg #282a36
|
||||
margin_bg #6272a4
|
||||
margin_fg #44475a
|
||||
removed_bg #ff5555
|
||||
highlight_removed_bg #ff5555
|
||||
removed_margin_bg #ff5555
|
||||
added_bg #50fa7b
|
||||
highlight_added_bg #50fa7b
|
||||
added_margin_bg #50fa7b
|
||||
filler_bg #44475a
|
||||
hunk_margin_bg #44475a
|
||||
hunk_bg #bd93f9
|
||||
search_bg #8be9fd
|
||||
search_fg #282a36
|
||||
select_bg #f1fa8c
|
||||
select_fg #282a36
|
||||
62
src/.config/kitty/dracula.conf
Normal file
62
src/.config/kitty/dracula.conf
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# https://draculatheme.com/kitty
|
||||
#
|
||||
# Installation instructions:
|
||||
#
|
||||
# cp dracula.conf ~/.config/kitty/
|
||||
# echo "include dracula.conf" >> ~/.config/kitty/kitty.conf
|
||||
#
|
||||
# Then reload kitty for the config to take affect.
|
||||
# Alternatively copy paste below directly into kitty.conf
|
||||
|
||||
foreground #f8f8f2
|
||||
background #282a36
|
||||
selection_foreground #ffffff
|
||||
selection_background #44475a
|
||||
|
||||
url_color #8be9fd
|
||||
|
||||
# black
|
||||
color0 #21222c
|
||||
color8 #6272a4
|
||||
|
||||
# red
|
||||
color1 #ff5555
|
||||
color9 #ff6e6e
|
||||
|
||||
# green
|
||||
color2 #50fa7b
|
||||
color10 #69ff94
|
||||
|
||||
# yellow
|
||||
color3 #f1fa8c
|
||||
color11 #ffffa5
|
||||
|
||||
# blue
|
||||
color4 #bd93f9
|
||||
color12 #d6acff
|
||||
|
||||
# magenta
|
||||
color5 #ff79c6
|
||||
color13 #ff92df
|
||||
|
||||
# cyan
|
||||
color6 #8be9fd
|
||||
color14 #a4ffff
|
||||
|
||||
# white
|
||||
color7 #f8f8f2
|
||||
color15 #ffffff
|
||||
|
||||
# Cursor colors
|
||||
cursor #f8f8f2
|
||||
cursor_text_color background
|
||||
|
||||
# Tab bar colors
|
||||
active_tab_foreground #282a36
|
||||
active_tab_background #f8f8f2
|
||||
inactive_tab_foreground #282a36
|
||||
inactive_tab_background #6272a4
|
||||
|
||||
# Marks
|
||||
mark1_foreground #282a36
|
||||
mark1_background #ff5555
|
||||
10
src/.config/kitty/kitty.conf
Normal file
10
src/.config/kitty/kitty.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
include dracula.conf
|
||||
|
||||
background_opacity 0.95
|
||||
font_family FiraCode Nerd Font Mono
|
||||
bold_font auto
|
||||
italic_font auto
|
||||
bold_italic_font auto
|
||||
window_padding_width 4
|
||||
font_size 12
|
||||
disable_ligatures always
|
||||
77
src/.config/starship.toml
Normal file
77
src/.config/starship.toml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[battery]
|
||||
full_symbol = ""
|
||||
charging_symbol = ""
|
||||
discharging_symbol = ""
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
[directory]
|
||||
read_only = " "
|
||||
|
||||
[docker]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = "ﯣ "
|
||||
|
||||
4
src/.config/sublime-text-3/Packages/User/C++.sublime-settings
Executable file
4
src/.config/sublime-text-3/Packages/User/C++.sublime-settings
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
// These settings override both User and Default settings for the C++ syntax
|
||||
{
|
||||
|
||||
}
|
||||
24
src/.config/sublime-text-3/Packages/User/CP-build-no-timeout.sublime-build
Executable file
24
src/.config/sublime-text-3/Packages/User/CP-build-no-timeout.sublime-build
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"target": "terminus_open",
|
||||
"cancel": "terminus_cancel_build",
|
||||
"title": "Terminal",
|
||||
"auto_close": false,
|
||||
"timeit": true,
|
||||
|
||||
"post_window_hooks": [["carry_file_to_pane", { "direction": "right" }]],
|
||||
|
||||
"focus": false,
|
||||
"cmd": [
|
||||
"bash",
|
||||
"-c",
|
||||
"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"
|
||||
],
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"working_dir": "${file_path}",
|
||||
"selector": "source.c, source.c++",
|
||||
"variants": [
|
||||
{
|
||||
"name": "Run"
|
||||
}
|
||||
]
|
||||
}
|
||||
24
src/.config/sublime-text-3/Packages/User/CP-build-system-alt.sublime-build
Executable file
24
src/.config/sublime-text-3/Packages/User/CP-build-system-alt.sublime-build
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"target": "terminus_open",
|
||||
"cancel": "terminus_cancel_build",
|
||||
"title": "Terminal",
|
||||
"auto_close": false,
|
||||
"timeit": true,
|
||||
|
||||
"post_window_hooks": [["carry_file_to_pane", { "direction": "down" }]],
|
||||
|
||||
"focus": false,
|
||||
"cmd": [
|
||||
"bash",
|
||||
"-c",
|
||||
"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"
|
||||
],
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"working_dir": "${file_path}",
|
||||
"selector": "source.c, source.c++",
|
||||
"variants": [
|
||||
{
|
||||
"name": "Run"
|
||||
}
|
||||
]
|
||||
}
|
||||
24
src/.config/sublime-text-3/Packages/User/CP-build-system.sublime-build
Executable file
24
src/.config/sublime-text-3/Packages/User/CP-build-system.sublime-build
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"target": "terminus_open",
|
||||
"cancel": "terminus_cancel_build",
|
||||
"title": "Terminal",
|
||||
"auto_close": false,
|
||||
"timeit": true,
|
||||
|
||||
"post_window_hooks": [["carry_file_to_pane", { "direction": "down" }]],
|
||||
|
||||
"focus": false,
|
||||
"cmd": [
|
||||
"bash",
|
||||
"-c",
|
||||
"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"
|
||||
],
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"working_dir": "${file_path}",
|
||||
"selector": "source.c, source.c++",
|
||||
"variants": [
|
||||
{
|
||||
"name": "Run"
|
||||
}
|
||||
]
|
||||
}
|
||||
21
src/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap
Executable file
21
src/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
[
|
||||
{ "keys": ["ctrl+e"], "command": "toggle_side_bar" },
|
||||
{
|
||||
"keys": ["ctrl+b"],
|
||||
"command": "chain",
|
||||
"args": {
|
||||
"commands": [
|
||||
["focus_group",{"group":0}],
|
||||
["terminus_close_all"],
|
||||
["build"],
|
||||
["focus_group",{"group":0}],
|
||||
]
|
||||
}
|
||||
},
|
||||
{ "keys": ["ctrl+t"],
|
||||
"command": "terminus_open",
|
||||
"args" : {
|
||||
"cwd": "${file_path:${folder}}"
|
||||
}
|
||||
},
|
||||
]
|
||||
4
src/.config/sublime-text-3/Packages/User/Origami.sublime-settings
Executable file
4
src/.config/sublime-text-3/Packages/User/Origami.sublime-settings
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
// Create a new pane when switching in a direction without one
|
||||
"create_new_pane_if_necessary": false
|
||||
}
|
||||
27
src/.config/sublime-text-3/Packages/User/Package Control.sublime-settings
Executable file
27
src/.config/sublime-text-3/Packages/User/Package Control.sublime-settings
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"bootstrapped": true,
|
||||
"in_process_packages":
|
||||
[
|
||||
],
|
||||
"installed_packages":
|
||||
[
|
||||
"1337 Color Scheme",
|
||||
"BracketGuard",
|
||||
"BracketHighlighter",
|
||||
"Chain of Command",
|
||||
"Color Scheme - Eazy Light",
|
||||
"Dracula Color Scheme",
|
||||
"molokai",
|
||||
"Monokai - Spacegray",
|
||||
"Monokai Gray",
|
||||
"Monokai++",
|
||||
"Notepad++ Color Scheme",
|
||||
"Origami",
|
||||
"Package Control",
|
||||
"SublimeAStyleFormatter",
|
||||
"SublimeLinter",
|
||||
"SublimeLinter-clang",
|
||||
"SublimeLinter-gcc",
|
||||
"Terminus"
|
||||
]
|
||||
}
|
||||
0
src/.config/sublime-text-3/Packages/User/Package Control.user-ca-bundle
Executable file
0
src/.config/sublime-text-3/Packages/User/Package Control.user-ca-bundle
Executable file
18
src/.config/sublime-text-3/Packages/User/Preferences.sublime-settings
Executable file
18
src/.config/sublime-text-3/Packages/User/Preferences.sublime-settings
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"color_scheme": "Packages/Color Scheme - Eazy Light/Eazy Light.tmTheme",
|
||||
"file_exclude_patterns":
|
||||
[
|
||||
"*.o"
|
||||
],
|
||||
"font_face": "Consolas Regular",
|
||||
"font_size": 10,
|
||||
"ignored_packages":
|
||||
[
|
||||
"Vintage"
|
||||
],
|
||||
"line_padding_bottom": 1,
|
||||
"line_padding_top": 1,
|
||||
"theme": "Adaptive.sublime-theme",
|
||||
"translate_tabs_to_spaces": true,
|
||||
"word_wrap": "true"
|
||||
}
|
||||
3
src/.config/sublime-text-3/Packages/User/Terminus.sublime-settings
Executable file
3
src/.config/sublime-text-3/Packages/User/Terminus.sublime-settings
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"theme": "3024-day"
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"name": "Terminus",
|
||||
"variables": {
|
||||
"blue": "#01a0e4",
|
||||
"light_green": "#3a3432",
|
||||
"light_brown": "#4a4543",
|
||||
"green": "#01a252",
|
||||
"light_blue": "#807d7c",
|
||||
"cyan": "#b5e4f4",
|
||||
"light_red": "#e8bbd0",
|
||||
"black": "#090300",
|
||||
"light_white": "#f7f7f8",
|
||||
"magenta": "#a16a94",
|
||||
"background": "#f7f7f8",
|
||||
"light_cyan": "#cdab53",
|
||||
"caret": "#4a4543",
|
||||
"brown": "#fded02",
|
||||
"white": "#a5a2a2",
|
||||
"light_black": "#5c5855",
|
||||
"light_magenta": "#d6d5d4",
|
||||
"red": "#db2d20",
|
||||
"foreground": "#4a4543"
|
||||
},
|
||||
"globals": {
|
||||
"background": "#f7f7f7"
|
||||
}
|
||||
}
|
||||
14
src/.config/sublime-text-3/Packages/User/cpp.sublime-snippet
Executable file
14
src/.config/sublime-text-3/Packages/User/cpp.sublime-snippet
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<tabTrigger>cpp</tabTrigger>
|
||||
</snippet>
|
||||
66
src/.config/sublime-text-3/Packages/User/template.sublime-snippet
Executable file
66
src/.config/sublime-text-3/Packages/User/template.sublime-snippet
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
/* INCLUDE STATEMENTS */
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
/* NAMESPACES */
|
||||
using namespace std; // (┛ಠ_ಠ)┛ "Bad" Practice
|
||||
|
||||
/* ALIASES */
|
||||
typedef long long lli;
|
||||
typedef long double ld;
|
||||
typedef unsigned uns;
|
||||
|
||||
typedef pair<int, int> pi;
|
||||
typedef pair<lli, lli> pl;
|
||||
typedef pair<ld, ld> pd;
|
||||
|
||||
typedef vector<int> vi;
|
||||
typedef vector<ld> vd;
|
||||
typedef vector<lli> vl;
|
||||
typedef vector<pi> vpi;
|
||||
typedef vector<pl> vpl;
|
||||
|
||||
/* DEFINITIONS */
|
||||
#define mp make_pair
|
||||
#define pb push_back
|
||||
#define F first
|
||||
#define S second
|
||||
#define lb lower_bound
|
||||
#define ub upper_bound
|
||||
|
||||
#define fo(i, a, b) for(auto i=a; i<(b); i++)
|
||||
#define forev(i, b, a) for(auto i = (b)-1; i >= a; i--)
|
||||
#define all(x) x.begin(), x.end()
|
||||
#define sortall(x) sort(all(x))
|
||||
#define sz(x) (int)x.size()
|
||||
#define enl "\n"
|
||||
#define deb(x) cout << #x << ": " << x << enl;
|
||||
|
||||
/* CONSTANTS */
|
||||
// const ld PI = 4 * atan((ld)1);
|
||||
// const int MOD = 1000000007;
|
||||
// const lli INF = 1e18;
|
||||
// const int MX = INT_MAX - 1;
|
||||
|
||||
/* UTILITIES */
|
||||
template<typename T> bool _odd(T a) {return a & 1;}
|
||||
template<typename T> bool _even(T a) {return !(a & 1);}
|
||||
|
||||
/*======================= ROBERT'S GOT A QUICK HAND =======================*/
|
||||
|
||||
void solve() {
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
ios_base::sync_with_stdio(0); cin.tie(0);
|
||||
// int testcase; cin >> testcase; for (int i = 1; i <= testcase; ++i)
|
||||
solve();
|
||||
return 0;
|
||||
}
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<tabTrigger>template</tabTrigger>
|
||||
</snippet>
|
||||
|
||||
11
src/.config/zsh/Makefile
Normal file
11
src/.config/zsh/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
.PHONY: all
|
||||
all: autosuggestions syntax-highlighting tab-completions
|
||||
|
||||
autosuggestions:
|
||||
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.config/zsh/plugins/zsh-autosuggestions
|
||||
|
||||
syntax-highlighting:
|
||||
git clone https://github.com/zdharma/fast-syntax-highlighting ~/.config/zsh/plugins/fast-syntax-highlighting
|
||||
|
||||
tab-completions:
|
||||
git clone https://github.com/zsh-users/zsh-completions ~/.config/zsh/plugins/zsh-completions
|
||||
108
src/.config/zsh/keybindings.zsh
Normal file
108
src/.config/zsh/keybindings.zsh
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
# Keybindings adapted from :https://github.com/ohmyzsh/ohmyzsh/
|
||||
# All credit goes to the creators of oh-my-zsh
|
||||
|
||||
# Make sure that the terminal is in application mode when zle is active, since
|
||||
# only then values from $terminfo are valid
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init() {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish() {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
# [PageUp] - Up a line of history
|
||||
if [[ -n "${terminfo[kpp]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
|
||||
bindkey -M viins "${terminfo[kpp]}" up-line-or-history
|
||||
bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
|
||||
fi
|
||||
# [PageDown] - Down a line of history
|
||||
if [[ -n "${terminfo[knp]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[knp]}" down-line-or-history
|
||||
bindkey -M viins "${terminfo[knp]}" down-line-or-history
|
||||
bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
|
||||
fi
|
||||
|
||||
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
|
||||
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
fi
|
||||
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
fi
|
||||
|
||||
# [Home] - Go to beginning of line
|
||||
if [[ -n "${terminfo[khome]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[khome]}" beginning-of-line
|
||||
bindkey -M viins "${terminfo[khome]}" beginning-of-line
|
||||
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
|
||||
fi
|
||||
# [End] - Go to end of line
|
||||
if [[ -n "${terminfo[kend]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kend]}" end-of-line
|
||||
bindkey -M viins "${terminfo[kend]}" end-of-line
|
||||
bindkey -M vicmd "${terminfo[kend]}" end-of-line
|
||||
fi
|
||||
|
||||
# [Shift-Tab] - move through the completion menu backwards
|
||||
if [[ -n "${terminfo[kcbt]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
|
||||
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
|
||||
bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
|
||||
fi
|
||||
|
||||
# [Backspace] - delete backward
|
||||
bindkey -M emacs '^?' backward-delete-char
|
||||
bindkey -M viins '^?' backward-delete-char
|
||||
bindkey -M vicmd '^?' backward-delete-char
|
||||
# [Delete] - delete forward
|
||||
if [[ -n "${terminfo[kdch1]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kdch1]}" delete-char
|
||||
bindkey -M viins "${terminfo[kdch1]}" delete-char
|
||||
bindkey -M vicmd "${terminfo[kdch1]}" delete-char
|
||||
else
|
||||
bindkey -M emacs "^[[3~" delete-char
|
||||
bindkey -M viins "^[[3~" delete-char
|
||||
bindkey -M vicmd "^[[3~" delete-char
|
||||
|
||||
bindkey -M emacs "^[3;5~" delete-char
|
||||
bindkey -M viins "^[3;5~" delete-char
|
||||
bindkey -M vicmd "^[3;5~" delete-char
|
||||
fi
|
||||
|
||||
# [Ctrl-Delete] - delete whole forward-word
|
||||
bindkey -M emacs '^[[3;5~' kill-word
|
||||
bindkey -M viins '^[[3;5~' kill-word
|
||||
bindkey -M vicmd '^[[3;5~' kill-word
|
||||
|
||||
# [Ctrl-RightArrow] - move forward one word
|
||||
bindkey -M emacs '^[[1;5C' forward-word
|
||||
bindkey -M viins '^[[1;5C' forward-word
|
||||
bindkey -M vicmd '^[[1;5C' forward-word
|
||||
# [Ctrl-LeftArrow] - move backward one word
|
||||
bindkey -M emacs '^[[1;5D' backward-word
|
||||
bindkey -M viins '^[[1;5D' backward-word
|
||||
bindkey -M vicmd '^[[1;5D' backward-word
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
||||
# file rename magick
|
||||
bindkey "^[m" copy-prev-shell-word
|
||||
|
|
@ -10,17 +10,7 @@ set softtabstop=4
|
|||
set expandtab
|
||||
set updatetime=250
|
||||
set title
|
||||
autocmd GUIEnter * set vb t_vb=
|
||||
set belloff=all
|
||||
function! ToggleGUICruft()
|
||||
if &guioptions==''
|
||||
exec('set guioptions=mT')
|
||||
else
|
||||
exec('set guioptions=')
|
||||
endif
|
||||
endfunction
|
||||
noremap <C-m> <Esc>:call ToggleGUICruft()<cr>
|
||||
|
||||
|
||||
"KEYBINDINGS
|
||||
nmap <S-Up> v<Up>
|
||||
|
|
@ -39,6 +29,8 @@ vmap <C-c> y<Esc>i
|
|||
vmap <C-x> d<Esc>i
|
||||
map <C-v> pi
|
||||
map <S-End> v$
|
||||
nmap <S-j> 10j
|
||||
nmap <S-k> 10k
|
||||
imap <C-v> <Esc>pi
|
||||
map <C-z> <Esc>u
|
||||
map <C-y> <Esc><C-r>i
|
||||
|
|
@ -50,7 +42,6 @@ map <silent><C-w> <C-C>:bd<CR>
|
|||
map <silent><C-q> <C-C>:q!<CR>
|
||||
map <silent><C-O> <Esc>:tabnew#<CR>
|
||||
map <silent><C-R> <Esc>:source ~/.vimrc<CR>
|
||||
noremap i a
|
||||
|
||||
|
||||
" VUNDLE PLUGINS
|
||||
|
|
@ -101,32 +92,19 @@ let g:NERDTreeWinPos = "right"
|
|||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
|
||||
nnoremap <C-H> :bprevious<CR>
|
||||
nnoremap <C-L> :bnext<CR>
|
||||
nmap <C-e> :NERDTreeToggle<CR>
|
||||
let NERDTreeShowHidden=1
|
||||
|
||||
|
||||
" THEMING
|
||||
" set guioptions=
|
||||
" let g:dracula_colorterm = 0
|
||||
set termguicolors
|
||||
colorscheme dracula
|
||||
set background=dark
|
||||
hi Normal guibg=NONE ctermbg=NONE
|
||||
" set guifont=Source\ Code\ Pro\ 10
|
||||
|
||||
" SYSTEM SPECIFIC SETTINGS
|
||||
cd ~/Desktop/Coding\ Library/Ongoing
|
||||
function! Templatecpp()
|
||||
:1,$d
|
||||
:read ~/Desktop/Coding\ Library/IDE/template.cpp
|
||||
:1d
|
||||
endfunction
|
||||
command Template :call Templatecpp()
|
||||
|
||||
|
||||
" COMPILE RUN
|
||||
map <C-b> <Esc>:w<CR>:!g++ -o compiled.o % -std=c++17 && ./compiled.o<Enter>
|
||||
auto BufWritePost *.cpp execute 'silent :!astyle > /dev/null 2>&1'shellescape(expand('%'),1)
|
||||
" CHANGE CURSOR SHAPE BASED ON MODE
|
||||
" (Only works on VTE-based terminal)
|
||||
let &t_SI = "\<Esc>[6 q"
|
||||
let &t_SR = "\<Esc>[4 q"
|
||||
let &t_EI = "\<Esc>[2 q"
|
||||
161
src/.zshrc
Normal file
161
src/.zshrc
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
# Enable colors and change prompt:
|
||||
autoload -U colors && colors # Load colors
|
||||
setopt autocd # Automatically cd into typed directory.
|
||||
stty stop undef # Disable ctrl-s to freeze terminal.
|
||||
setopt interactive_comments
|
||||
|
||||
# Basic auto/tab complete:
|
||||
autoload -U compinit
|
||||
zstyle ':completion:*' menu select '' 'm:{a-zA-Z}={A-Za-z}'
|
||||
zmodload zsh/complist
|
||||
compinit
|
||||
_comp_options+=(globdots) # Include hidden files.
|
||||
|
||||
# History in cache directory:
|
||||
HISTSIZE=1000000
|
||||
SAVEHIST=1000000
|
||||
HISTFILE=~/.cache/.zsh_history
|
||||
|
||||
### EXPORTS
|
||||
export TERM="xterm-256color" # getting proper colors
|
||||
export HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
|
||||
|
||||
### SET VI MODE ###
|
||||
bindkey -v
|
||||
bindkey -v "^?" backward-delete-char # Backspace interferes with vi mode
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Use Beam cursor in Insert mode
|
||||
function zle-keymap-select {
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[1 q'
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} = '' ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[5 q'
|
||||
fi
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
zle-line-init() {
|
||||
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
||||
echo -ne "\e[5 q"
|
||||
}
|
||||
zle -N zle-line-init
|
||||
echo -ne '\e[5 q' # Use beam shape cursor on startup.
|
||||
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
|
||||
|
||||
|
||||
### PATH
|
||||
if [ -d "$HOME/.bin" ] ;
|
||||
then PATH="$HOME/.bin:$PATH"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.local/bin" ] ;
|
||||
then PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
### ARCHIVE EXTRACTION
|
||||
# usage: ex <file>
|
||||
ex ()
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*.deb) ar x $1 ;;
|
||||
*.tar.xz) tar xf $1 ;;
|
||||
*.tar.zst) unzstd $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
### ALIASES ###
|
||||
# =========== #
|
||||
# switch between shells
|
||||
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
||||
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
||||
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
||||
|
||||
# navigation
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias .3='cd ../../..'
|
||||
alias .4='cd ../../../..'
|
||||
alias .5='cd ../../../../..'
|
||||
|
||||
# Colorize grep output (good for log files)
|
||||
alias grep='grep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
|
||||
# confirm before overwriting something
|
||||
alias cp="cp -i"
|
||||
alias mv='mv -i'
|
||||
alias rm='rm -i'
|
||||
alias np='nano -w PKGBUILD'
|
||||
alias more=less
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# adding flags
|
||||
alias df='df -h' # human-readable sizes
|
||||
alias free='free -m' # show sizes in MB
|
||||
alias lynx='lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss -vikeys'
|
||||
alias vifm='./.config/vifm/scripts/vifmrun'
|
||||
|
||||
## get top process eating memory
|
||||
alias psmem='ps auxf | sort -nr -k 4'
|
||||
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
|
||||
|
||||
## get top process eating cpu ##
|
||||
alias pscpu='ps auxf | sort -nr -k 3'
|
||||
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
|
||||
|
||||
### Fallback Prompt ###
|
||||
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
|
||||
|
||||
### Starship Prompt ###
|
||||
# =================== #
|
||||
# Install using -> curl -fsSL https://starship.rs/install.sh | bash
|
||||
eval "$(starship init zsh 2>/dev/null)"
|
||||
|
||||
### PLUGIN CONFIGURATIONS ###
|
||||
# ========================= #
|
||||
# (Applicable for plugins installed in the section below)
|
||||
### zsh-autosuggestions
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=true
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion match_prev_cmd)
|
||||
|
||||
### PLUGINS/KEYBINDINGS ###
|
||||
# ======================= #
|
||||
# (MUST be at the end of file)
|
||||
# Install using makefile at ~/.config/zsh... Ditch package managers
|
||||
plugins () {
|
||||
source ~/.config/zsh/keybindings.zsh
|
||||
source ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source ~/.config/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
source ~/.config/zsh/plugins/zsh-completions/zsh-completions.plugin.zsh # Better tab-completion
|
||||
}
|
||||
plugins || make -i -C ~/.config/zsh
|
||||
|
||||
export NVM_DIR="/home/purhan/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
67
src/scripts/Makefile
Normal file
67
src/scripts/Makefile
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
.PHONY: all
|
||||
all: debian
|
||||
|
||||
.PHONY: debian
|
||||
debian: essentials others apt snap snap-classic
|
||||
|
||||
# Packages to be installed using apt
|
||||
apt = firefox \
|
||||
chromium-browser \
|
||||
compton \
|
||||
rofi \
|
||||
vlc \
|
||||
peek \
|
||||
obs-studio \
|
||||
gnome-tweaks \
|
||||
htop \
|
||||
vim \
|
||||
awesome \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
fonts-powerline \
|
||||
npm \
|
||||
nodejs \
|
||||
kitty \
|
||||
zsh \
|
||||
fish \
|
||||
stow \
|
||||
arandr
|
||||
|
||||
# Packages to be installed as snaps
|
||||
snap = discord
|
||||
|
||||
# Some snaps require confinement
|
||||
snap-classic = sublime-text \
|
||||
code \
|
||||
postman
|
||||
|
||||
|
||||
apt:
|
||||
sudo apt-get install $(apt)
|
||||
|
||||
snap:
|
||||
sudo snap install $(snap)
|
||||
|
||||
snap-classic:
|
||||
for package in $(snap-classic) ; do \
|
||||
sudo snap install $$package --classic ; \
|
||||
done
|
||||
|
||||
essentials:
|
||||
### INSTALLING ESSENTIAL PACKAGES ###
|
||||
# ================================= #
|
||||
sudo apt install \
|
||||
git \
|
||||
curl \
|
||||
|
||||
others:
|
||||
### SETTING UP SHELLS ###
|
||||
# Install starship shell prompt
|
||||
curl -fsSL https://starship.rs/install.sh | bash
|
||||
|
||||
# Install zsh plugins
|
||||
make -i -C ~/.config/zsh
|
||||
|
||||
### SETTING UP AWESOME ###
|
||||
# ====================== #
|
||||
make -i -C ~/.config/requirements/awesome
|
||||
2
src/scripts/monitor_setups/1.sh
Executable file
2
src/scripts/monitor_setups/1.sh
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output eDP1 --mode 1280x720 --pos 0x0 --rotate normal --output HDMI1 --primary --mode 1920x1080 --pos 1280x0 --rotate normal --output VIRTUAL1 --off
|
||||
2
src/scripts/monitor_setups/2.sh
Executable file
2
src/scripts/monitor_setups/2.sh
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output eDP1 --same-as HDMI1
|
||||
51
src/scripts/vampire.sh
Executable file
51
src/scripts/vampire.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
shell=$(basename $SHELL)
|
||||
kernel="$(uname -r | cut -d '-' -f1)"
|
||||
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 \")"
|
||||
|
||||
|
||||
# __.......__
|
||||
# .-:::::::::::::-.
|
||||
# .:::''':::::::''':::.
|
||||
# .:::' ':::' ':::.
|
||||
# .'\ ::' ':' ':: /'.
|
||||
# : \ :: :: / :
|
||||
# : \': ___ ___ :'/ :
|
||||
# : /\ ( •)\ /( •) /\ :
|
||||
# : / .\ ‾‾ | | ‾‾ /. \ :
|
||||
# : \ ( (_) ) / :
|
||||
# : '_( )_' :
|
||||
# '. \ < _____ > / .'
|
||||
# '. \ \ / / .'
|
||||
# '._ '-._ _.-' _.'
|
||||
# .''-.__ .''-._.-''. __.-''.
|
||||
# .' '. .' '.
|
||||
# .' '-. .-' '.
|
||||
|
||||
a=$'[1;34m' # PURPLE
|
||||
r=$'[1;31m' # RED
|
||||
w=$'[1;39m' # WHITE
|
||||
g=$'[1;35m' # MAGENTA
|
||||
t=$'[01;49;32m' # GREEN
|
||||
m=$'[m' # NORMAL
|
||||
tput clear
|
||||
cat << EOF
|
||||
$a __.......__
|
||||
.-:::::::::::::-.
|
||||
.:::''':::::::''':::.
|
||||
.:::' ':::' ':::.$m
|
||||
$g.'\ $a::'$m $a':'$m $a'::$g /'.$m
|
||||
$g: \ $a::$m $a::$g / :$m
|
||||
$g: \'$a:$m ___ ___ $a:$g'/ :
|
||||
:$w /\ ( •)\ /$w( •)$w /\ $g:
|
||||
:$w / .\ ‾‾ | | ‾‾ /. \ $g:
|
||||
:$w \ ( (_) ) / $g:
|
||||
:$w '_( )_' $g:
|
||||
'.$w \ < _____ > / $g.'
|
||||
'.$w \ $r\ /$g $w/ $g.'
|
||||
'._$w '-._ _.-' $g _.'
|
||||
$t .''-.__$w .''-._.-''.$t __.-''.
|
||||
.' '. .' '.
|
||||
.' '-. .-' '. $m
|
||||
EOF
|
||||
Loading…
Add table
Add a link
Reference in a new issue