...
 
Commits (6)
......@@ -8,12 +8,13 @@
SCREEN_WIDTH=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f1)
bspc config automatic_scheme alternate
bspc config split_ratio 0.52
bspc config focus_follows_pointer false
bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc config borderless_monocle false
bspc config gapless_monocle false
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config single_monocle false
bspc config window_gap 64
bspc config border_width 6
......@@ -24,16 +25,22 @@ bspc config normal_border_color "$BSPWM_BORDER_COLOR"
bspc config focused_border_color "$BSPWM_FOCUSED_COLOR"
bspc config presel_feedback_color "$BSPWM_PRESEL_COLOR"
bspc monitor -d 1 2 3 4
bspc rule -r "*"
bspc rule -a "Emacs" state=tiled
if [ "$SCREEN_WIDTH" -gt 1440 ]; then
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config right_monocle_padding "$(((SCREEN_WIDTH - 1440) / 2))"
bspc config left_monocle_padding "$(((SCREEN_WIDTH - 1440) / 2))"
fi
bspc monitor -d 1 2 3 4
bspc rule -a "*" state=pseudo_tiled
else
bspc config window_gap 16
bspc desktop -l monocle
bspc rule -a "*" state=floating
bspc rule -a "*" state=pseudo_tiled split_dir=south
fi
# bspc subscribe handler daemon
# start bspwm subscribe handler daemon
bspwm-subscribe-handler &
# -*- mode: conf -*-
#
# - 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
#
#
# general hotkeys
......@@ -18,20 +13,37 @@ shift + super + r
# applications
#
# terminal
# scratch terminal
super + Return
gnome-terminal -e "tmux new-session -A -s 0"
bspwm-scratch "bspwm-scratch-term" "state=floating border=off sticky=on" \
${BSPWM_SCRATCH_TERM_COMMAND}
super + {0-9}
gnome-terminal -e "tmux new-session -A -s {0-9}"
bspc rule -a \* -o state=tiled && st -f "Monoid-14" -e tmux new-session -A -s {0-9}
# quick launch
super + semicolon ; {e,f,t}
{emacsclient -a="" -c,firefox,st -f monoid-14}
bspc rule -a \* -o state=tiled && {emacsclient -a="" -c,firefox,st -f "Monoid-14"}
# rofi launcher
super + space
rofi -modi combi -show combi -combi-modi run,drun,window,ssh
# calc
super + F5
bspwm-scratch "bspwm-scratch-calc" "state=floating border=off sticky=on" \
st -c "bspwm-scratch-calc" -g "16x12" -f Monoid-24 -e bc -q
# translator
super + F8
bspc rule -a \* -o state=floating && \
st -g "70x20" -f "Monoid-14" -e bash -c "torsocks trans -b -t pt '$(xclip -o)' && read"
# telegram
super + F9
bspwm-scratch "TelegramDesktop" "state=floating border=off sticky=on" \
flatpak run org.telegram.desktop || flatpak run org.telegram.desktop
# lock screen
super + shift + l
......@@ -71,16 +83,20 @@ super + {alt + l,alt + Tab,Tab}
deskname="{1,2,3,4}";\
test "$curdesk" -eq "$deskname" && bspc desktop -f last || bspc desktop -f "$deskname"
# 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"
# hide current node (cut)
super + w
stack_file="${XDG_RUNTIME_DIR}/bspwm-hidden-nodes.txt"; \
target_node=$(bspc query -N -n focused); \
echo "$target_node" >> "$stack_file"; \
bspc node "$target_node" --flag hidden=on
# unhide the most recently hidden node (paste/reinsert)
super + y
stack_file="${XDG_RUNTIME_DIR}/bspwm-hidden-nodes.txt"; \
target_node=$(tail --lines=1 "$stack_file"); \
sed -i '$d' "$stack_file"; \
bspc node "$target_node" --to-desktop focused; \
bspc node "$target_node" --flag hidden=off --focus;
# alternate node between tiled and floating state
super + t
......@@ -164,13 +180,13 @@ shift + super + BackSpace
# volume
super + {bracketleft,bracketright}
pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)%"
{XF86AudioLowerVolume,XF86AudioRaiseVolume}
pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)%"
{XF86AudioMute,super + backslash}
pulsemixer --toggle-mute && xwrite "0🔇"
pulsemixer --toggle-mute && xwrite "0%"
# player control
super + {comma,period,slash}
......@@ -178,11 +194,24 @@ super + {comma,period,slash}
# brightness and screen color temperature
XF86MonBrightnessDown
xbacklight -dec 10 && xwrite "$(printf "%d💡" $(xbacklight -get))"
xbacklight -dec 10 && xwrite "$(printf "%d%%" $(xbacklight -get))"
XF86MonBrightnessUp
xbacklight -inc 10 && xwrite "$(printf "%d💡" $(xbacklight -get))"
xbacklight -inc 10 && xwrite "$(printf "%d%%" $(xbacklight -get))"
shift + super + s
temp="{6500k default,5000k day*,4000k moon,3000k warm*,2800k xwarm,1800k candle}";\
sct "$temp" && xwrite "$(printf "%s" $temp)"
# DEPRECATED: use super + {w,y} instead
# 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"
#!/bin/bash
## bspwm-scratch ---
#
# SYNOPSIS
#
# bspwm-scratch CLASS-NAME RULE COMMAND
#
# EXAMPLE
#
# For a classic scratchpad terminal use the following sxhkd hotkey:
#
# super + Return
# bspwm-scratch scratch-term "state=floating sticky=on" \
# stterm -c scratch-term -e tmux new -s scratch
#
# Another example:
#
# super + F12
# bspwm-scratch transmission-gtk "state=floating sticky=on" \
# transmission-gtk
#
# And, optionally, the following bspwm configuration:
#
# # hide scratch windows when they are not focused
# SCRATCH_CLASS_PATTERN="scratch-term|transmission-gtk"
# bspc subscribe desktop_focus node_focus | while read -a msg; do
# _focused_xid=$(xdotool getwindowfocus)
# _scratch_xids=$(xdotool search --onlyvisible --class "$SCRATCH_CLASS_PATTERN")
# case "${msg[0]}" in
# desktop_focus)
# # hide scratch window on desktop changes
# echo "$scratch_xids" | xargs -rI{} bspc node "{}" --flag hidden=on
# ;;
# node_focus)
# # hide scratch window when it lose focus
# for scratch_xid in $scratch_xids; do
# [ "${focused_xid:-nil}" != "${scratch_xid:-nil}" ] \
# && bspc node "$scratch_xid" --flag hidden=on
# done
# ;;
# esac
# done &
# unset _focused_xid _scratch_xid _scratch_xids
#
# exit on first error
set -e
# exit when an undefined variable is accessed
set -u
function main() {
local classname command xids
classname="$1"
rule="$2"
command="${*:3}"
xids=$(xdotool search --class "$classname" || true)
if [ -n "$xids" ]; then
# toggle window
echo "$xids" | xargs -rI{} bspc node "{}" --flag hidden --focus
else
# first run
bspc rule -l | grep -q "^${classname}:" || bspc rule -a "$classname" "$rule"
# shellcheck disable=SC2086
exec $command
fi
}
main "$@"
#!/bin/bash
function query_layout() {
bspc query -T -d | jshon -e layout -u
# meta data
PROGNAME=bspwm-subscribe-handler
function pidlock() {
local progname rundir pidfile
progname="$1"
rundir="${XDG_RUNTIME_DIR:-$HOME/.local/run}"
pidfile="${rundir}/pidlock/${progname}.pid"
mkdir -p "$rundir"
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
return 1
else
echo $$ > "$pidfile"
fi
}
function hide_node() {
bspc node "$1" --flag hidden=on
}
function set_monocle_wallpaper() {
hsetroot -solid "#000000"
function query_layout() {
bspc query -T -d | jshon -e layout -u
}
function set_default_wallpaper() {
if [ -f "$X_WALLPAPER" ]; then
hsetroot -fill "$X_WALLPAPER"
function set_wallpaper_color_or_image() {
local wallpaper="$1"
if [ -f "$wallpaper" ]; then
hsetroot -fill "$wallpaper"
else
hsetroot -solid "$X_WALLPAPER"
hsetroot -solid "$wallpaper"
fi
}
function set_wallpaper() {
if [ "$(query_layout)" = "monocle" ]; then
set_monocle_wallpaper
set_wallpaper_color_or_image "${X_MONOCLE_WALLPAPER:-$X_WALLPAPER}"
else
set_default_wallpaper
set_wallpaper_color_or_image "${X_WALLPAPER}"
fi
}
bspc subscribe all | while read -a msg ; do
echo "${msg[@]}"
case "${msg[0]}" in
desktop_focus)
#xwrite "$(bspc query -D -d --names)" &
set_wallpaper
;;
desktop_layout)
set_wallpaper
;;
node_focus)
# if [ -f "$XDG_RUNTIME_DIR/bspwm-scratchpad.wid" ]; then
# id=$(cat "$XDG_RUNTIME_DIR/bspwm-scratchpad.wid")
# bspc node "$id" --flag hidden
# fi
;;
node_activate)
;;
node_flag)
;;
*)
esac
done
function subscribe() {
# shellcheck disable=SC2162
bspc subscribe all | while read -a msg ; do
local desktop_name focused_xid scratch_xid scratch_xids
desktop_name="$(bspc query -D -d --names)"
focused_xid=$(xdotool getwindowfocus)
scratch_xids=$(xdotool search --onlyvisible --class "bspwm-scratch-|TelegramDesktop|Slack")
#echo "${msg[@]}"
case "${msg[0]}" in
desktop_focus)
# hide scratch windows on desktop changes
echo "$scratch_xids" | xargs -rI{} bspc node "{}" --flag hidden=on
# just print desktop name
#xwrite "$desktop_name" &
;;
desktop_layout)
;;
node_focus)
# hide scratch windows when it lose focus
for scratch_xid in $scratch_xids; do
[ "${focused_xid:-nil}" != "${scratch_xid:-nil}" ] \
&& bspc node "$scratch_xid" --flag hidden=on
done
;;
node_activate)
;;
node_flag)
;;
*)
esac
done
}
function main() {
pidlock "$PROGNAME" || {
echo "${PROGNAME} is already running!"
exit 1
}
subscribe
}
main
......@@ -5,12 +5,39 @@
# by your desktop environment clipboard.
#
while true; do
# 240000 milliseconds / 4 minutes
if [ "$(xprintidle)" -gt 240000 ]; then
xclip -selection "primary" /dev/null
xclip -selection "secondary" /dev/null
xclip -selection "clipboard" /dev/null
readonly PROGNAME=cbd
function pidlock() {
local progname rundir pidfile
progname="$1"
rundir="${XDG_RUNTIME_DIR:-$HOME/.local/run}"
pidfile="${rundir}/pidlock/${progname}.pid"
mkdir -p "$rundir"
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
return 1
else
echo $$ > "$pidfile"
fi
sleep 60 && echo Plop!
done
}
function main() {
pidlock "$PROGNAME" || {
echo "${PROGNAME} is already running!"
exit 1
}
while true; do
# 240000 milliseconds / 4 minutes
if [ "$(xprintidle)" -gt 240000 ]; then
xclip -selection "primary" /dev/null
xclip -selection "secondary" /dev/null
xclip -selection "clipboard" /dev/null
fi
sleep 60 && echo Plop!
done
}
main
......@@ -4,16 +4,18 @@
# See <https://iristech.co/what-is-the-best-color-temperature/>.
#
readonly PROGNAME=sctd
SCTD_TEMP_TABLE=(
2800 # 00h00
2800
2800
2800
2800
3000 # 05h00
5000 # 06h00
5000
5000
2300 # 00h00
2600
2900
3200
3500
3800
4100 # 06h00
4400
4700
5000
5000
5000
......@@ -21,22 +23,44 @@ SCTD_TEMP_TABLE=(
5000
5000
5000
5000
5000
4000 # 18h00
4000
3000 # 20h00
3000
3000
3000 # 23h00
2800 # 24h00
4700
4400
4100 # 18h00
3800
3500
3200
2900
2600 # 23h00
)
while true; do
now=$(date +"%H")
#ind=$(bc <<< "$now + 1")
ind=$((10#$now + 1))
val=${SCTD_TEMP_TABLE[$ind]}
sct "$val" && echo "i:$ind v:$val"
sleep 240
done
function pidlock() {
local progname rundir pidfile
progname="$1"
rundir="${XDG_RUNTIME_DIR:-$HOME/.local/run}"
pidfile="${rundir}/pidlock/${progname}.pid"
mkdir -p "$rundir"
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
return 1
else
echo $$ > "$pidfile"
fi
}
function main() {
pidlock "$PROGNAME" || {
echo "${PROGNAME} is already running!"
exit 1
}
while true; do
ind=$(date +"%-H")
val=${SCTD_TEMP_TABLE[$ind]}
sct "$val" && echo "i:$ind v:$val"
sleep 120
done
}
main
......@@ -24,8 +24,8 @@ fi
# auto lock screen after TIME minutes of inactivity
# suspend-then-hibernate after KILLTIME minutes
xautolock -detectsleep \
-time "$X_LOCKTIME" -locker "xlock" \
-killtime "$X_KILLTIME" -killer "systemctl suspend-then-hibernate" &
-time "${X_LOCKTIME:-5}" -locker "xlock" \
-killtime "${X_KILLTIME:-30}" -killer "${X_KILLTIME_COMMAND:-systemctl suspend-then-hibernate}" &
# start notification server
/usr/lib/notification-daemon/notification-daemon &
......
......@@ -15,15 +15,18 @@
# set wallpaper to filename or solid color
export X_WALLPAPER="${X_WALLPAPER:-#222222}"
export X_MONOCLE_WALLPAPER="${X_MONOCLE_WALLPAPER:-$X_WALLPAPER}"
# bspwm
export BSPWM_BORDER_COLOR="${BSPWM_BORDER_COLOR:-#888888}"
export BSPWM_FOCUSED_COLOR="${BSPWM_FOCUSED_COLOR:-#FFFFFF}"
export BSPWM_PRESEL_COLOR="${BSPWM_PRESEL_COLOR:-$BSPWM_FOCUSED_COLOR}"
export BSPWM_SCRATCH_TERM_COMMAND
# xautolock
export X_LOCKTIME="${X_LOCKTIME:-8}"
export X_KILLTIME="${X_KILLTIME:-24}"
export X_LOCKTIME
export X_KILLTIME
export X_KILLTIME_COMMAND
# power management
export X_DPMS="${X_DPMS:-yes}"
......
......@@ -88,22 +88,7 @@ the current buffer."
(interactive)
(if (active-minibuffer-window)
(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*")
(switch-to-buffer "*scratch*")
(find-file "~/scratch")
(funcall initial-major-mode)
(rename-buffer "*scratch*"))))
(error "Minibuffer is not active"))))
......@@ -145,16 +130,7 @@ You may find other key bindings inside use-package statements."
auto-save-timeout 20
auto-save-interval 100)
(setq inhibit-startup-screen t
initial-major-mode 'lisp-interaction-mode)
(setq initial-buffer-choice
(lambda ()
(switch-to-buffer "*scratch*")
;; see also semente-maybe-bury-kill-buffer-query-function
(kill-buffer (rename-buffer "*scratch*<bypass-maybe-bury>" t))
(semente-switch-to-scratch-buffer)
(get-buffer "*scratch*")))
(setq inhibit-startup-screen t)
(setq visible-bell t ; no beep!
completion-show-help nil
......@@ -170,7 +146,7 @@ You may find other key bindings inside use-package statements."
'((:eval (if buffer-file-name "%f" "%b")) " - " "Emacs")
icon-title-format frame-title-format)
(add-to-list 'default-frame-alist '(height . 30))
(add-to-list 'default-frame-alist '(height . 25))
(add-to-list 'default-frame-alist '(width . 90))
;; If you are using emacs under X you might like the following
......@@ -837,7 +813,7 @@ You may find other key bindings inside use-package statements."
(:weight bold)
(:weight bold)
(:weight bold)))
(global-highlight-parentheses-mode))
(add-hook 'emacs-lisp-mode-hook 'highlight-parentheses-mode))
(use-package lisp-extra-font-lock
:ensure t
......@@ -1137,13 +1113,10 @@ You may find other key bindings inside use-package statements."
'((:name "inbox" :key "i" :query "tag:inbox" )
(:name "unread" :key "u" :query "tag:unread" )
(:name "flagged" :key "f" :query "tag:flagged")
(:name "last-7d" :key "7" :search-type tree
:query "date:7-days.. OR (date:7-days.. AND (tag:deleted OR tag:spam))")
(:name "blitz" :key "b" :query "tag:blitz")
(:name "list" :key "l" :query "tag:list and tag:unread")
(:name "news" :key "n" :query "tag:news and tag:unread")
(:name "junk" :key "j" :query "tag:junk and tag:unread")
(:name "spam" :key "s" :query "tag:spam" )
(:name "sent" :key "t" :query "tag:sent" )
......
......@@ -78,6 +78,8 @@ if [ -n "$ZSH_VERSION" ]; then
_set_gpg_tty
_set_ssh_agent
test -e /etc/zsh_command_not_found && . /etc/zsh_command_not_found
# Zsh reads ~/.zshrc in all interactive shells, whether they
# are login shells or not, we don't need load ~/.zshrc here
:
......
......@@ -110,7 +110,7 @@ else
setopt PROMPT_SUBST
PROMPT="
%B%{$fg[magenta]%} » \${?##0} %{$reset_color%}%B%{$fg[green]%}%{$reset_color%}"
%B%{$fg[magenta]%} » %{$reset_color%}%{$fg[magenta]%}\${?##0} %{$reset_color%}%B%{$fg[green]%}%{$reset_color%}"
RPROMPT="%B%{$fg[white]%}\${vcs_info_msg_0_}%B%{$fg[blue]%}%~%{$reset_color%}%B%{$reset_color%}"
# more extensive tab completion
......