Commit 40766d6a authored by Guilherme Semente's avatar Guilherme Semente 🌱

Minor improvements in multiple configuration files

parent 7b3dfec2
! st.color0: #edeeeb
! st.color7: #383e3f
*.font: FiraCode-13
! fonts: Monoid-12 Hack-14 FiraCode-14
st.color0: #202122
st.color7: #d3d7cf
urxvt.font: xft:Monoid:size=12
urxvt.background: #202122
urxvt.foreground: #d3d7cf
urxvt.scrollBar: false
Sxiv.foreground: #d3d7cf
Sxiv.background: #202122
emacs.font: Monoid-12
dzen2.background: #202122
dzen2.foreground: #d3d7cf
st.font: Monoid-12
st.color0: #202122
st.color7: #d3d7cf
Sxiv.foreground: #d3d7cf
Sxiv.background: #202122
#!/bin/sh
#
# - Get window class names using the `xprop WM_CLASS' command
#
WALLPAPER_COLOR="#424344"
BORDER_COLOR="#535355"
FOCUSED_COLOR="#d3d7cf"
PRESEL_COLOR="$FOCUSED_COLOR"
#
# displays
#
......@@ -11,10 +18,6 @@
# turn off display after 8 minutes of inactivity
xset dpms 480 480 480
# set wallpaper and cursor
{ test -f "$HOME/.wallpaper" && hsetroot -fill "$HOME/.wallpaper"; } || hsetroot -solid "#424344"
xsetroot -cursor_name left_ptr
#
# bspwm config
......@@ -27,14 +30,11 @@ bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config single_monocle false
bspc config gapless_monocle false
bspc config single_monocle true
bspc config window_gap 32
bspc config border_width 1
bspc config normal_border_color "#333333"
bspc config focused_border_color "#333333"
bspc config presel_feedback_color "#8b008b"
bspc config window_gap 8
bspc config border_width 6
bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitors true
......@@ -44,6 +44,14 @@ bspc monitor -d 1 2 3 4
bspc rule -a "*" state=floating
# set wallpaper and cursor
{ test -f "$HOME/.wallpaper" && hsetroot -fill "$HOME/.wallpaper"; } || hsetroot -solid "$WALLPAPER_COLOR"
xsetroot -cursor_name left_ptr
bspc config normal_border_color "$BORDER_COLOR"
bspc config focused_border_color "$FOCUSED_COLOR"
bspc config presel_feedback_color "$PRESEL_COLOR"
#
# startup
......@@ -55,5 +63,3 @@ pkill -USR1 -x sxhkd || sxhkd &
# auto lock screen after 8 minutes of inactivity
xautolock -secure -time 8 -locker x-lock &
# power management
xfce4-power-manager
# -*- mode: conf -*-
#
# To Do
# - hotkeys with the [Alt+Super] modifier do desktop related operations
# - hotkeys with the [Super] only modifier do frequent or run operations
# - hotkeys with the [Shift+Super] modifier do infrequent or kill operations
#
# - Write about AltGr + {`,F1-12}
# - Write about hotkeys with shift
#
# general hotkeys
#
# make sxhkd reload its configuration files
super + shift + r
shift + super + r
pkill -USR1 -x sxhkd
......@@ -18,69 +18,81 @@ super + shift + r
# applications
#
# terminal
super + Return
gnome-terminal -e "tmux new-session -A -s 0"
super + {0-9}
gnome-terminal -e "tmux new-session -A -s {0-9}"
# rofi launcher
super + space
rofi -modi combi -show combi -combi-modi run,drun,window,ssh
shift + super + space
bspc rule -a \* -o desktop=^5 follow=on;
rofi -modi combi -show combi -combi-modi run,drun,window,ssh
# lock screen
super + shift + l
x-lock
# screen capture
shift + super + @p
super + @Print
mkdir -p ~/downloads/screenshots;\
x-message "PrtSc";\
cd ~/downloads/screenshots && scrot --select --exec 'sxiv -b -g 1300x700 $f'
# terminal
super + Return
st -g 96x32
# quick launch
super + semicolon ; {t,e,f,v}
{st -g 96x32,emacsclient -a="" -c,firejail firefox, x-view}
#
# multimedia
# bspwm
#
# volume
super + {bracketleft,bracketright}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)"
# quit node
shift + super + k
bspc node -c
{XF86AudioLowerVolume,XF86AudioRaiseVolume}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)"
# focus the next/previous desktop or node
{alt +,_} super + {Prior,p,Next,n,o}
bspc {desktop,node} -f {prev,prev,next,next,next}.local
{XF86AudioMute,super + backslash}
pulsemixer --toggle-mute && x-message "($(pulsemixer --get-volume | cut -d ' ' -f2))"
# focus the last desktop
super + {alt + l,alt + Tab,Tab}
bspc desktop -f last
# player control
super + {comma,period,slash}
playerctl {previous,next,play-pause}
# focus the last node
{super + l,alt + Tab}
bspc node -f last.local
XF86MonBrightnessDown
xbacklight -dec 10 && x-message "$(printf "%d" $(xbacklight -get))"
# change focus to given desktop
{alt,super} + {F1,F2,F3,F4}
{true,true};\
curdesk="$(bspc query -D -d --names)";\
deskname="{1,2,3,4}";\
test "$curdesk" -eq "$deskname" && bspc desktop -f last || bspc desktop -f "$deskname"
XF86MonBrightnessUp
xbacklight -inc 10 && x-message "$(printf "%d" $(xbacklight -get))"
# send node to given desktop
alt + super + shift + {F1,F2,F3,F4}
deskname="{1,2,3,4}";\
bspc node -d "$deskname";\
bspc desktop -f "$deskname"
alt + super + shift + {p,n,o}
deskname="{prev,next,next}";\
bspc node -d "$deskname";\
bspc desktop -f "$deskname"
# alternate node between tiled and floating state
super + t
bspc node focused -t tiled || bspc node focused -t floating
#
# bspwm
#
# toggle node fullscreen state
super + f
bspc node focused -t \~fullscreen
# quit node
shift + super + k
bspc node -c
# alternate between the tiled and monocle layouts
super + m
bspc desktop -l next
# focus the next node in the current desktop
super + o
bspc node -f next.local
# change window gap
super + g
bspc config -d focused window_gap {0,4,8,16,32,64,96,128} && x-message "$(bspc config -d focused window_gap)px"
# circulate windows in the current desktop
super + c
......@@ -91,7 +103,7 @@ super + r
bspc node @/ -R 90
# flip windows in the current desktop
super + f
super + v
bspc node @/ -F {horizontal,horizontal,vertical}
# balance windows area
......@@ -102,56 +114,71 @@ super + b
super + e
bspc node @/ -E
# alternate node between tiled and floating state
super + t
bspc node focused -t tiled || bspc node focused -t floating
# alternate node between tiled and floating state
shift + super + f
bspc node focused -t fullscreen || bspc node focused -t floating
# alternate all nodes between tiled and floating state
shift + super + t
bspc query -N -n .window.local | xargs -n1 -I '%nid' bspc node %nid -t {tiled,floating}
# shift + super + t
# bspc query -N -n .window.local | xargs -n1 -I '%nid' bspc node %nid -t {tiled,floating}
# alternate between the tiled and monocle layouts
super + m
bspc desktop -l next
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-50 0,0 50,0 -50,50 0}
# change window gap
super + g
bspc config -d focused window_gap {0,4,8,16,32,64,96,128} && x-message "$(bspc config -d focused window_gap)"
# set the node flags
# super + ctrl + {m,l,s,p}
# bspc node -g {marked,locked,sticky,private}
# change focus to given desktop
{super,alt} + {F1,F2,F3,F4}
{true,true};\
curdesk="$(bspc query -D -d --names)";\
deskname="{1,2,3,4}";\
test "$curdesk" -eq "$deskname" && bspc desktop -f last || bspc desktop -f "$deskname";\
x-message "$(bspc query -D -d --names)"
# preselect the direction
shift + super + {Left,Down,Up,Right}
bspc node -p {west,south,north,east}
# send node to given desktop
{super,alt} + shift + {F1,F2,F3,F4}
{true,true};\
bspc node -d "{1,2,3,4,0}"
# send the focused node to the newest preselected node
shift + super + y
bspc node "focused" -n "newest.!automatic.local"
# focus the next/previous desktop
super + {Prior,p,Next,n}
bspc desktop -f {prev,prev,next,next};\
x-message "$(bspc query -D -d --names)"
# cancel the preselection
shift + super + BackSpace
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
# focus the last desktop
{super + l, alt + Tab}
bspc desktop -f last && x-message "$(bspc query -D -d --names)"
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-50 0,0 50,0 -50,50 0}
#
# move/resize
#
# expand a window by moving one of its side
# expand a window by moving one of its side outward
super + alt + {Left,Down,Up,Right}
bspc node -z {left -50 0,bottom 0 50,top 0 -50,right 50 0}
# super + alt + {Left,Down,Up,Right}
# bspc node -z {left -50 0,bottom 0 50,top 0 -50,right 50 0}
# contract a window by moving one of its side inward
super + alt + shift + {Left,Down,Up,Right}
bspc node -z {right -50 0,top 0 50,bottom 0 -50,left 50 0}
# super + alt + shift + {Left,Down,Up,Right}
# bspc node -z {right -50 0,top 0 50,bottom 0 -50,left 50 0}
#
# multimedia
#
# volume
super + {bracketleft,bracketright}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
{XF86AudioLowerVolume,XF86AudioRaiseVolume}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
{XF86AudioMute,super + backslash}
pulsemixer --toggle-mute && x-message "0🔇"
# player control
super + {comma,period,slash}
playerctl {previous,next,play-pause}
# brightness and screen color temperature
XF86MonBrightnessDown
xbacklight -dec 10 && x-message "$(printf "%d💡" $(xbacklight -get))"
XF86MonBrightnessUp
xbacklight -inc 10 && x-message "$(printf "%d💡" $(xbacklight -get))"
shift + super + s
temp="{6500k default,5000k day*,4000k moon,3000k warm*,2800k xwarm,1800k candle}";\
sct "$temp" && x-message "$(printf "%s" $temp)"
......@@ -27,6 +27,10 @@
And load `use-package'..."
(require 'package)
;; Fix for emacs <26.3
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(setq package-enable-at-startup nil)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
......@@ -85,6 +89,13 @@ user)."
(select-window (active-minibuffer-window))
(error "Minibuffer is not active")))
(defun startup--get-buffer-create-scratch ()
(or (get-buffer "*scratch*")
(with-current-buffer (get-buffer-create "*scratch*")
(set-buffer-major-mode (current-buffer))
(setq-local lexical-binding t)
(current-buffer))))
(defun semente-switch-to-scratch-buffer (&optional arg)
(interactive)
(if (get-buffer "*scratch*")
......@@ -173,40 +184,40 @@ You may find other key bindings inside use-package statements."
set-mark-command-repeat-pop t
window-combination-resize t)
(progn
"Side Windows"
(defvar semente-side-window-parameters
'(window-parameters . ((no-other-window . t)
(no-delete-other-windows . t))))
(setq fit-window-to-buffer-horizontally t
window-resize-pixelwise t)
(setq
display-buffer-alist
`(("\\*\\(?:help\\|\\(Ido \\)?Completions\\)\\*"
display-buffer-in-side-window
(side . bottom)
(slot . -1)
(window-height . 8)
(preserve-size . (nil . t))
,semente-side-window-parameters)
("\\*\\(?:shell\\|compilation\\|Backtrace\\)\\*"
display-buffer-in-side-window
(side . bottom)
(slot . 0)
(window-height . 12)
(preserve-size . (nil . t))
,semente-side-window-parameters)
("\\*\\(?:Buffer List\\|Proced\\)\\*"
display-buffer-in-side-window
(side . bottom)
(slot . 1)
(window-height . 8)
(preserve-size . (nil . t))
,semente-side-window-parameters))))
;; (progn
;; "Side Windows"
;; (defvar semente-side-window-parameters
;; '(window-parameters . ((no-other-window . t)
;; (no-delete-other-windows . t))))
;; (setq fit-window-to-buffer-horizontally t
;; window-resize-pixelwise t)
;; (setq
;; display-buffer-alist
;; `(("\\*\\(?:help\\|\\(Ido \\)?Completions\\)\\*"
;; display-buffer-in-side-window
;; (side . bottom)
;; (slot . -1)
;; (window-height . 8)
;; (preserve-size . (nil . t))
;; ,semente-side-window-parameters)
;; ("\\*\\(?:shell\\|compilation\\|Backtrace\\)\\*"
;; display-buffer-in-side-window
;; (side . bottom)
;; (slot . 0)
;; (window-height . 12)
;; (preserve-size . (nil . t))
;; ,semente-side-window-parameters)
;; ("\\*\\(?:Buffer List\\|Proced\\)\\*"
;; display-buffer-in-side-window
;; (side . bottom)
;; (slot . 1)
;; (window-height . 8)
;; (preserve-size . (nil . t))
;; ,semente-side-window-parameters))))
(setq kill-whole-line t)
......@@ -290,6 +301,11 @@ You may find other key bindings inside use-package statements."
:config
(smooth-scrolling-mode 1))
(use-package doom-themes
:ensure t
:config
(setq doom-themes-padded-modeline t))
(use-package kaolin-themes
:ensure t
:config
......@@ -389,7 +405,8 @@ You may find other key bindings inside use-package statements."
"Tramp and remote access"
(require 'tramp)
(setq tramp-default-method "ssh"
(setq tramp-terminal-type "tramp"
tramp-default-method "ssh"
password-cache-expiry 900)
;; reuse SSH connections
......@@ -849,6 +866,12 @@ You may find other key bindings inside use-package statements."
:config
(add-hook 'python-mode-hook 'eldoc-mode))
(use-package blacken
:ensure t
:after python
:config
(add-hook 'python-mode-hook 'blacken-mode))
(use-package rust-mode
:ensure t
:pin melpa-stable
......@@ -904,6 +927,12 @@ You may find other key bindings inside use-package statements."
;; let electric-pair-mode do this job
(setq web-mode-enable-auto-pairing nil))
(use-package prettier-js
:ensure t
:config
(add-hook 'css-mode-hook 'prettier-js-mode)
(add-hook 'js-mode-hook 'prettier-js-mode))
(use-package which-func
:config
(which-function-mode t))
......@@ -958,6 +987,7 @@ You may find other key bindings inside use-package statements."
semente-holiday-belohorizonte-holidays)))
(use-package org
:ensure org-plus-contrib
:bind (("C-c a" . org-agenda)
("C-c c" . org-capture)
("C-c l" . org-store-link)
......@@ -979,7 +1009,7 @@ You may find other key bindings inside use-package statements."
(require 'ob-shell nil t)
(require 'org-habit)
(require 'org-protocol)
(require 'org-checklist)
(diminish 'orgstruct-mode "")
(diminish 'orgtbl-mode "") ; XXX: not working
......@@ -1017,7 +1047,7 @@ You may find other key bindings inside use-package statements."
org-agenda-todo-ignore-scheduled 'future
org-agenda-todo-ignore-timestamp 'future
org-agenda-todo-ignore-deadlines 'near
org-agenda-todo-list-sublevels nil)
org-agenda-todo-list-sublevels t)
(setq org-icalendar-include-todo t
org-icalendar-use-deadline '(todo-due)
org-icalendar-alarm-time 45
......@@ -1118,7 +1148,7 @@ You may find other key bindings inside use-package statements."
("date:7d..now AND NOT m:/spam" "Last 7 days" ?7))
mu4e-sent-messages-behavior
(lambda ()
"Don't save sent messages for certain services
"Do NOT save sent messages for certain services
Useful for SMTP services that already save a copy in the Sent folder
even if you aren't using their client."
......
noblacklist /storage/downloads/firefox
include /etc/firejail/firefox.profile
# vanilla firefox installation
whitelist /opt/firefox
whitelist ${HOME}/.local/opt/firefox
# my downloads directory is located in an external disk
whitelist /storage/downloads/firefox
whitelist /opt/firefox
# GTK settings
whitelist ${HOME}/src/dotfiles/gnome
......@@ -23,8 +23,8 @@ export LESS='-F -i -J -M -R -W -x4 -X -z-4'
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# ls
# LS_ARGS="-CF --classify --ignore-backups"
LS_ARGS="-CF --classify"
# LS_ARGS="-CF --classify --group-directories-first --ignore-backups"
LS_ARGS="-CF --classify --group-directories-first"
if [ $TERM != "dump" ]; then
eval "`dircolors -b`"
LS_ARGS="$LS_ARGS --color=auto"
......
......@@ -17,15 +17,29 @@ umask 022
# the search path for commands
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin"
# python
PATH="./.venv/bin:$PATH"
PIPENV_COLORBLIND=1
PIPENV_NOSPIN=1
PIPENV_VENV_IN_PROJECT=1
PIPENV_SHELL_FANCY=0
# nodejs
PATH="./node_modules/.bin:$PATH"
# rust
export PATH="$HOME/.cargo/bin:$PATH"
PATH="$HOME/.cargo/bin:$PATH"
# golang
export GOPATH="$HOME/src/go"
export PATH="$GOPATH/bin:$PATH"
GOPATH="$HOME/src/go"
PATH="$GOPATH/bin:$PATH"
# cp, ln, ...
export VERSION_CONTROL=numbered
VERSION_CONTROL=numbered
export PATH GOPATH VERSION_CONTROL
export PIPENV_COLORBLIND PIPENV_NOSPIN PIPENV_SHELL_FANCY PIPENV_VENV_IN_PROJECT
# link gpg-agent to the connected terminal (manpage gpg-agent(1))
_set_gpg_tty () {
......
# Fork of https://github.com/kevinywlui/zlong_alert.zsh
# Use zsh/datetime for $EPOCHSECONDS
zmodload zsh/datetime || return
# Be sure we can actually set hooks
autoload -Uz add-zsh-hook || return
# Use notify-send if it exists and is not explicitly disabled
if ! [[ -x "$(command -v notify-send)" ]]; then
zlong_use_notify_send='false'
fi
(( ${+zlong_use_notify_send} )) || zlong_use_notify_send='true'
# Define a long duration if needed
(( ${+zlong_duration} )) || zlong_duration=15
# Set commands to ignore if needed
(( ${+zlong_ignore_cmds} )) || zlong_ignore_cmds='vim ssh'
# Need to set an initial timestamps otherwise, we'll be comparing an empty
# string with an integer.
zlong_timestamp=$EPOCHSECONDS
# Define the alerting function, do the text processing here
zlong_alert_func() {
local cmd=$1
local secs=$2
local mins=$(($2 / 60))
# local ftime=$(printf '%dh:%dm:%ds\n' $(($secs / 3600)) $(($secs % 3600 / 60)) $(($secs % 60)))
if [[ "$zlong_use_notify_send" == true ]]; then
notify-send -i "utilities-terminal-symbolic" "zsh" "$1\n<i>Finished in ${secs} seconds</i>"
fi
echo "\a"
}
zlong_alert_pre() {
zlong_timestamp=$EPOCHSECONDS
zlong_last_cmd=$1
}
zlong_alert_post() {
local duration=$(($EPOCHSECONDS - $zlong_timestamp))
local lasted_long=$(($duration - $zlong_duration))
local cmd_head=$(echo $zlong_last_cmd | cut -d ' ' -f 1)
# TODO: improve zlong_ignore_cmds
if [[ $lasted_long -gt 0 && ! -z $zlong_last_cmd && ! $zlong_ignore_cmds =~ $cmd_head ]]; then
zlong_alert_func $zlong_last_cmd $duration
fi
zlong_last_cmd=''
}
add-zsh-hook preexec zlong_alert_pre
add-zsh-hook precmd zlong_alert_post
# skip on dumb terminals
[ "$TERM" = "dumb" -a -z "$INSIDE_EMACS" ] && return
# TRAMP setup - prevent hangs
# See https://www.emacswiki.org/emacs/TrampMode
#
# NOTE: (1) You must set `tramp-terminal-type' to "tramp" in your local .emacs
# (2) This must be on your remote's .zshrc if you have one causing hangs
#
if [ "$TERM" = "tramp" ]; then
unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
if whence -w precmd >/dev/null; then
unfunction precmd
fi
if whence -w preexec >/dev/null; then
unfunction preexec
fi
PS1='$ '
return
fi
# load aliases (shared with bash)
[ -f "$HOME/.aliases" ] && emulate sh -c "source $HOME/.aliases"
......@@ -19,6 +38,11 @@ select-word-style bash
# report CPU usage for commands running longer than N seconds
REPORTTIME=8
zlong_use_notify_send=true
zlong_duration="60"
zlong_ignore_cmds="emacs nano vim ssh man more less"
source ~/.local/lib/zsh/zlong_alert.zsh
# history
HISTFILE=~/.zhistory
HISTSIZE=SAVEHIST=8192
......@@ -53,10 +77,9 @@ setopt notify
unsetopt beep
unsetopt nomatch
# if [[ "${INSIDE_EMACS}" == *"comint"* ]]; then
# provide custom settings when running a shell inside Emacs
if [ -n "$INSIDE_EMACS" ]; then
unsetopt zle
PROMPT=" » ${?##0} "
PROMPT=" » "
export PAGER="cat"
else
# set a 8 min timeout policy when not under X
......
......@@ -71,7 +71,7 @@ set -g status-left-length 32
set -g status-right-length 32
set -g status-interval 5
set -g status-left " [#S] #h "
set -g status-right " #(cat /proc/loadavg | cut -d' ' -f1) #(expr $(cat /sys/class/thermal/thermal_zone?/temp | sort -r | head -n1) / 1000 )° #(cat /sys/class/power_supply/BAT0/capacity)% #(date '+%a, %H:%M' | sed 's/.*/\\u&/') "
set -g status-right " #(cat /proc/loadavg | cut -d' ' -f1) #(expr $(cat /sys/class/thermal/thermal_zone?/temp | sort -r | head -n1) / 1000 )° #(cat /sys/class/power_supply/BAT0/capacity)% #(date '+%b %d, %H:%M' | sed 's/.*/\\u&/') "
# misc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment