14 changed files with 648 additions and 9 deletions
@ -0,0 +1,37 @@ |
|||||||
|
#!/bin/bash |
||||||
|
#---------------------------------------------------------------- |
||||||
|
# screenshot — Capture screen, window, or region |
||||||
|
# |
||||||
|
# Captures once, saves to ~/Pictures and copies to clipboard. |
||||||
|
# |
||||||
|
# Usage: |
||||||
|
# screenshot full — full screen |
||||||
|
# screenshot area — select region with slurp |
||||||
|
# screenshot window — focused window |
||||||
|
# |
||||||
|
# Dependencies: grim, slurp, wl-copy, swaymsg, jq |
||||||
|
#---------------------------------------------------------------- |
||||||
|
|
||||||
|
dir=~/Pictures |
||||||
|
mkdir -p "$dir" |
||||||
|
file="$dir/screenshot_$(date +%Y%m%d_%H%M%S).png" |
||||||
|
|
||||||
|
case "$1" in |
||||||
|
full) |
||||||
|
grim -t png "$file" |
||||||
|
;; |
||||||
|
area) |
||||||
|
geo=$(slurp) |
||||||
|
grim -t png -g "$geo" "$file" |
||||||
|
;; |
||||||
|
window) |
||||||
|
geo=$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused) | .rect | "\(.x),\(.y) \(.width)x\(.height)"') |
||||||
|
grim -t png -g "$geo" "$file" |
||||||
|
;; |
||||||
|
*) |
||||||
|
echo "Usage: screenshot {full|area|window}" |
||||||
|
exit 1 |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
wl-copy -t image/png < "$file" |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
|
||||||
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
||||||
|
source "${CURRENT_DIR}/src/gruvbox-main.sh" |
||||||
|
|
||||||
|
# vim: ai et ft=bash |
||||||
@ -0,0 +1,98 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
||||||
|
readonly CURRENT_DIR |
||||||
|
|
||||||
|
# hold the array of all command to configure tmux theme |
||||||
|
declare -a TMUX_CMDS |
||||||
|
|
||||||
|
# load libraries |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/helper_methods.sh" |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/tmux_utils.sh" |
||||||
|
|
||||||
|
readonly TMUX_GRUVBOX="@tmux-gruvbox" |
||||||
|
readonly TMUX_GRUVBOX_STATUSBAR_ALPHA="@tmux-gruvbox-statusbar-alpha" |
||||||
|
readonly TMUX_GRUVBOX_LEFT_STATUS_A="@tmux-gruvbox-left-status-a" |
||||||
|
readonly TMUX_GRUVBOX_RIGHT_STAUTS_X="@tmux-gruvbox-right-status-x" |
||||||
|
readonly TMUX_GRUVBOX_RIGHT_STAUTS_Y="@tmux-gruvbox-right-status-y" |
||||||
|
readonly TMUX_GRUVBOX_RIGHT_STAUTS_Z="@tmux-gruvbox-right-status-z" |
||||||
|
|
||||||
|
# define simple theme options (no color interpolation required) |
||||||
|
readonly DEFAULT_THEME="dark256" |
||||||
|
readonly DEFAULT_STATUSBAR_ALPHA='false' |
||||||
|
# defaults for theme option (with color interpolation) |
||||||
|
readonly DEFAULT_LEFT_STATUS_A='#S' |
||||||
|
readonly DEFAULT_RIGHT_STATUS_X='%Y-%m-%d' |
||||||
|
readonly DEFAULT_RIGHT_STATUS_Y='%H:%M' |
||||||
|
readonly DEFAULT_RIGHT_STATUS_Z='#h' |
||||||
|
|
||||||
|
main() { |
||||||
|
TMUX_CMDS=() # clear |
||||||
|
|
||||||
|
# load proper palette for the theme asap to avoid additional variable interpolation |
||||||
|
local _theme |
||||||
|
_theme=$(tmux_get_option "${TMUX_GRUVBOX}" "${DEFAULT_THEME}") |
||||||
|
_statusbar_alpha=$(tmux_get_option "${TMUX_GRUVBOX_STATUSBAR_ALPHA}" "${DEFAULT_STATUSBAR_ALPHA}") |
||||||
|
|
||||||
|
case "$_theme" in |
||||||
|
light) |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/palette_gruvbox_light.sh" |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/theme_gruvbox_light.sh" |
||||||
|
;; |
||||||
|
light256) |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/palette_gruvbox_light256.sh" |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/theme_gruvbox_light256.sh" |
||||||
|
;; |
||||||
|
dark) |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/palette_gruvbox_dark.sh" |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/theme_gruvbox_dark.sh" |
||||||
|
;; |
||||||
|
dark256 | *) |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/palette_gruvbox_dark256.sh" |
||||||
|
# shellcheck disable=1091 |
||||||
|
source "${CURRENT_DIR}/theme_gruvbox_dark.sh" |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
local _status_left _status_right _window_status_current_format _window_status_format |
||||||
|
_status_left_a=$(tmux_get_option "$TMUX_GRUVBOX_LEFT_STATUS_A" "$DEFAULT_LEFT_STATUS_A") |
||||||
|
_status_right_x=$(tmux_get_option "$TMUX_GRUVBOX_RIGHT_STAUTS_X" "$DEFAULT_RIGHT_STATUS_X") |
||||||
|
_status_right_y=$(tmux_get_option "$TMUX_GRUVBOX_RIGHT_STAUTS_Y" "$DEFAULT_RIGHT_STATUS_Y") |
||||||
|
_status_right_z=$(tmux_get_option "$TMUX_GRUVBOX_RIGHT_STAUTS_Z" "$DEFAULT_RIGHT_STATUS_Z") |
||||||
|
|
||||||
|
local _theme_args |
||||||
|
_theme_args=( |
||||||
|
"$_status_left_a" |
||||||
|
"$_status_right_x" |
||||||
|
"$_status_right_y" |
||||||
|
"$_status_right_z" |
||||||
|
"$_statusbar_alpha" |
||||||
|
) |
||||||
|
|
||||||
|
case $_theme in |
||||||
|
light256) |
||||||
|
# light256 have slightly different colors placement then regular light 16-bit |
||||||
|
theme_set_light256 "${_theme_args[@]}" |
||||||
|
;; |
||||||
|
light) |
||||||
|
theme_set_light "${_theme_args[@]}" |
||||||
|
;; |
||||||
|
dark | dark256 | *) |
||||||
|
theme_set_dark "${_theme_args[@]}" |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
# execute commands with tmux as array of options |
||||||
|
tmux "${TMUX_CMDS[@]}" |
||||||
|
} |
||||||
|
|
||||||
|
main "$@" |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
# simply print passed array |
||||||
|
# |
||||||
|
# example |
||||||
|
# |
||||||
|
# myarray=() |
||||||
|
# print_array myarray |
||||||
|
# |
||||||
|
print_array() { |
||||||
|
local -n arr # -n available over bash 4.3 |
||||||
|
arr=$1 |
||||||
|
|
||||||
|
echo "" |
||||||
|
echo "begin >>>" |
||||||
|
printf "%s\n" "${arr[@]}" |
||||||
|
echo "<<< end" |
||||||
|
echo "" |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
########################## |
||||||
|
# gruvbox dark pallete |
||||||
|
########################## |
||||||
|
|
||||||
|
#### |
||||||
|
# When using 'colour124' you are using the color default in terminal pallete. |
||||||
|
# This could be important for people which terminals support only 256 colors |
||||||
|
# and does not support HEX values. |
||||||
|
# |
||||||
|
# The names of colors used from https://github.com/morhetz/gruvbox |
||||||
|
|
||||||
|
# shellcheck disable=2034 # ignored as this file only contains var definitions |
||||||
|
col_bg="#282828" |
||||||
|
col_bg0_h="#1d2021" |
||||||
|
col_bg0="#282828" |
||||||
|
col_bg1="#3c3836" |
||||||
|
col_bg2="#504945" |
||||||
|
col_bg3="#665c54" |
||||||
|
col_bg4="#7c6f64" |
||||||
|
col_gray0="#a89984" |
||||||
|
col_gray1="#928374" |
||||||
|
col_gray2="#928374" |
||||||
|
col_bg0_s="#32302f" |
||||||
|
col_fg="#ebdbb2" |
||||||
|
col_fg4="#a89984" |
||||||
|
col_fg3="#bdae93" |
||||||
|
col_fg2="#d5c4a1" |
||||||
|
col_fg1="#ebdbb2" |
||||||
|
col_fg0="#fbf1c7" |
||||||
|
|
||||||
|
col_red="#cc241d" |
||||||
|
col_red2="#fb4934" |
||||||
|
col_green="#98971a" |
||||||
|
col_green2="#b8bb26" |
||||||
|
col_yellow="#d79921" |
||||||
|
col_yellow2="#fabd2f" |
||||||
|
col_blue="#458588" |
||||||
|
col_blue2="#83a598" |
||||||
|
col_purple="#b16286" |
||||||
|
col_purple2="#d3869b" |
||||||
|
col_aqua="#689d6a" |
||||||
|
col_aqua2="#8ec07c" |
||||||
|
col_orange="#d65d0e" |
||||||
|
col_orange2="#fe8019" |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
########################## |
||||||
|
# gruvbox dark256 pallete |
||||||
|
########################## |
||||||
|
|
||||||
|
#### |
||||||
|
# When using 'colour124' you are using the color default in terminal pallete. |
||||||
|
# This could be important for people which terminals support only 256 colors |
||||||
|
# and does not support HEX values. |
||||||
|
# |
||||||
|
# The names of colors used from https://github.com/morhetz/gruvbox |
||||||
|
|
||||||
|
# shellcheck disable=2034 # ignored as this file only contains var definitions |
||||||
|
col_bg=colour235 |
||||||
|
col_bg0_h=colour234 |
||||||
|
col_bg0=colour235 |
||||||
|
col_bg1=colour237 |
||||||
|
col_bg2=colour239 |
||||||
|
col_bg3=colour241 |
||||||
|
col_bg4=colour243 |
||||||
|
col_gray0=colour246 |
||||||
|
col_gray1=colour245 |
||||||
|
col_gray2=colour245 |
||||||
|
col_bg0_s=colour236 |
||||||
|
col_fg=colour223 |
||||||
|
col_fg4=colour246 |
||||||
|
col_fg3=colour248 |
||||||
|
col_fg2=colour250 |
||||||
|
col_fg1=colour223 |
||||||
|
col_fg0=colour229 |
||||||
|
|
||||||
|
col_red=colour124 |
||||||
|
col_red2=colour167 |
||||||
|
col_green=colour106 |
||||||
|
col_green2=colour142 |
||||||
|
col_yellow=colour172 |
||||||
|
col_yellow2=colour214 |
||||||
|
col_blue=colour66 |
||||||
|
col_blue2=colour109 |
||||||
|
col_purple=colour132 |
||||||
|
col_purple2=colour175 |
||||||
|
col_aqua=colour72 |
||||||
|
col_aqua2=colour108 |
||||||
|
col_orange=colour166 |
||||||
|
col_orange2=colour208 |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
########################## |
||||||
|
# gruvbox light pallete |
||||||
|
########################## |
||||||
|
|
||||||
|
#### |
||||||
|
# When using 'colour124' you are using the color default in terminal pallete. |
||||||
|
# This could be important for people which terminals support only 256 colors |
||||||
|
# and does not support HEX values. |
||||||
|
# |
||||||
|
# The names of colors used from https://github.com/morhetz/gruvbox |
||||||
|
|
||||||
|
# shellcheck disable=2034 # ignored as this file only contains var definitions |
||||||
|
col_bg="#fbf1c7" |
||||||
|
col_bg0_h="#f9f5d7" |
||||||
|
col_bg0="#fbf1c7" |
||||||
|
col_bg1="#ebdbb2" |
||||||
|
col_bg2="#d5c4a1" |
||||||
|
col_bg3="#bdae93" |
||||||
|
col_bg4="#a89984" |
||||||
|
col_gray0="#7c6f64" |
||||||
|
col_gray1="#928374" |
||||||
|
col_gray2="#928374" |
||||||
|
col_bg0_s="#f2e5bc" |
||||||
|
col_fg="#3c3836" |
||||||
|
col_fg4="#7c6f64" |
||||||
|
col_fg3="#665c54" |
||||||
|
col_fg2="#504945" |
||||||
|
col_fg1="#3c3836" |
||||||
|
col_fg0="#282828" |
||||||
|
|
||||||
|
col_red="#cc241d" |
||||||
|
col_red2="#9d0006" |
||||||
|
col_green="#98971a" |
||||||
|
col_green2="#79740e" |
||||||
|
col_yellow="#d79921" |
||||||
|
col_yellow2="#b57614" |
||||||
|
col_blue="#458588" |
||||||
|
col_blue2="#076678" |
||||||
|
col_purple="#b16286" |
||||||
|
col_purple2="#8f3f71" |
||||||
|
col_aqua="#689d6a" |
||||||
|
col_aqua2="#427b58" |
||||||
|
col_orange="#d65d0e" |
||||||
|
col_orange2="#af3a03" |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
########################## |
||||||
|
# gruvbox light256 pallete |
||||||
|
########################## |
||||||
|
|
||||||
|
#### |
||||||
|
# When using 'colour124' you are using the color default in terminal pallete. |
||||||
|
# This could be important for people which terminals support only 256 colors |
||||||
|
# and does not support HEX values. |
||||||
|
# |
||||||
|
# The names of colors used from https://github.com/morhetz/gruvbox |
||||||
|
|
||||||
|
# shellcheck disable=2034 # ignored as this file only contains var definitions |
||||||
|
col_bg=colour229 |
||||||
|
col_bg0_h=colour230 |
||||||
|
col_bg0=colour229 |
||||||
|
col_bg1=colour223 |
||||||
|
col_bg2=colour250 |
||||||
|
col_bg3=colour248 |
||||||
|
col_bg4=colour246 |
||||||
|
col_gray0=colour246 |
||||||
|
col_gray1=colour245 |
||||||
|
col_gray2=colour244 |
||||||
|
col_bg0_s=colour228 |
||||||
|
col_fg=colour223 |
||||||
|
col_fg4=colour243 |
||||||
|
col_fg3=colour241 |
||||||
|
col_fg2=colour239 |
||||||
|
col_fg1=colour237 |
||||||
|
col_fg0=colour235 |
||||||
|
|
||||||
|
col_red=colour124 |
||||||
|
col_red2=colour88 |
||||||
|
col_green=colour106 |
||||||
|
col_green2=colour100 |
||||||
|
col_yellow=colour172 |
||||||
|
col_yellow2=colour136 |
||||||
|
col_blue=colour66 |
||||||
|
col_blue2=colour24 |
||||||
|
col_purple=colour132 |
||||||
|
col_purple2=colour96 |
||||||
|
col_aqua=colour72 |
||||||
|
col_aqua2=colour66 |
||||||
|
col_orange=colour166 |
||||||
|
col_orange2=colour130 |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
# get desired tmux option or use given default value |
||||||
|
tmux_get_option() { |
||||||
|
local _option_name _default_value |
||||||
|
_option_name="$1" |
||||||
|
_default_value="$2" |
||||||
|
|
||||||
|
local _current_option_value |
||||||
|
_current_option_value=$(tmux show-option -gqv "$_option_name") |
||||||
|
if [[ -n "$_current_option_value" ]]; then |
||||||
|
echo "$_current_option_value" |
||||||
|
else |
||||||
|
echo "$_default_value" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
# get desired window-option from tmux or default |
||||||
|
tmux_get_window_option() { |
||||||
|
local _option_name _default_value |
||||||
|
_option_name="$1" |
||||||
|
_default_value="$2" |
||||||
|
|
||||||
|
local _current_option_value |
||||||
|
_current_option_value=$(tmux show-window-option -gqv "$_option_name") |
||||||
|
if [[ -n "$_current_option_value" ]]; then |
||||||
|
echo "$_current_option_value" |
||||||
|
else |
||||||
|
echo "$_default_value" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
# append preconfigured tmux set-option to global array |
||||||
|
tmux_append_seto() { |
||||||
|
local _option _value _result |
||||||
|
_option="$1" |
||||||
|
_value="$2" |
||||||
|
TMUX_CMDS+=("set-option" "-gq" "${_option}" "${_value}" ";") |
||||||
|
} |
||||||
|
|
||||||
|
# append preconfigured tmux set-window-option to global array |
||||||
|
tmux_append_setwo() { |
||||||
|
local _option _value _result |
||||||
|
_option="$1" |
||||||
|
_value="$2" |
||||||
|
TMUX_CMDS+=("set-window-option" "-gq" "${_option}" "${_value}" ";") |
||||||
|
} |
||||||
|
|
||||||
|
# imediately execute tmux option |
||||||
|
tmux_set_option_now() { |
||||||
|
local _option_name _value |
||||||
|
_option_name="$1" |
||||||
|
_value="$2" |
||||||
|
tmux set-option -gq "$_option_name" "$_value" |
||||||
|
} |
||||||
|
|
||||||
|
# imediately execute tmux option |
||||||
|
tmux_set_window_option_now() { |
||||||
|
local _option_name _value |
||||||
|
_option_name="$1" |
||||||
|
_value="$2" |
||||||
|
tmux set-window-option -gq "$_option_name" "$_value" |
||||||
|
} |
||||||
Loading…
Reference in new issue