aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitsuo Tokumori <mitsuo@tokumori.xyz>2025-12-30 01:17:10 +0900
committerMitsuo Tokumori <mitsuo@tokumori.xyz>2025-12-30 01:17:10 +0900
commit897ffe7b3ba43fee0c4418148a185d1cbb7d6425 (patch)
tree9d5fca789746ebb9b8a99902b7aa66b0f6bde2c5
parentd0a3fa2ddd2843a55cce25d29fe61daf27ef1d38 (diff)
QoL small changes
-rw-r--r--minimal_linking_example.sh1
-rw-r--r--public/.bash_aliases1
-rw-r--r--public/.bashrc5
-rw-r--r--public/.config/gtk-3.0/settings.ini2
-rw-r--r--public/.config/zathura/zathurarc3
-rwxr-xr-xpublic/.local/bin/dmenu-openbook.sh7
-rwxr-xr-xpublic/.local/bin/dmenu-opentable.sh7
-rwxr-xr-xpublic/.local/bin/dmenu-webshortcuts.sh27
-rwxr-xr-xpublic/.local/bin/laptop-xrandr.sh3
-rwxr-xr-xpublic/.local/bin/myfile-handler.sh9
-rwxr-xr-xpublic/.local/bin/network_control.sh7
-rwxr-xr-xpublic/.local/bin/ocrthis.sh2
-rw-r--r--public/.local/share/dmenu/chars/unicode2
-rw-r--r--public/.xbindkeysrc35
-rw-r--r--public/code/dwm/config.h2
15 files changed, 83 insertions, 30 deletions
diff --git a/minimal_linking_example.sh b/minimal_linking_example.sh
index f4e0103..c7fc44a 100644
--- a/minimal_linking_example.sh
+++ b/minimal_linking_example.sh
@@ -12,6 +12,7 @@ dest=$HOME
cd $dest
ln -sf $target/.inputrc
ln -sf $target/.git-prompt.sh
+ln -sf $target/.profile
ln -sf $target/.bashrc
ln -sf $target/.bash_aliases
mkdir -p $dest/.config
diff --git a/public/.bash_aliases b/public/.bash_aliases
index 5ea253d..80f8cc9 100644
--- a/public/.bash_aliases
+++ b/public/.bash_aliases
@@ -7,6 +7,7 @@
# ======================================================================
alias e="$EDITOR"
+alias o="xdg-open"
alias aliases="$EDITOR ~/.bash_aliases && source ~/.bash_aliases"
# wtf error with Code-OSS
# Ref.: https://stackoverflow.com/a/73317738/7498073
diff --git a/public/.bashrc b/public/.bashrc
index bfc3a43..f8bbbdf 100644
--- a/public/.bashrc
+++ b/public/.bashrc
@@ -13,7 +13,10 @@
export TERMINAL=st
export EDITOR=nvim
export VISUAL=nvim
-export TERM=xterm-256color # Required for AWS VPS work good when SSHing
+#export TERM=xterm-256color # Required for AWS VPS work good when SSHing
+ # but causes issues with linux tty (before X11)
+ # ssh into AWS setting it to something else,
+ # but leave the default value alone.
# https://wiki.archlinux.org/title/GnuPG#Configure_pinentry_to_use_the_correct_TTY
export GPG_TTY=$(tty)
diff --git a/public/.config/gtk-3.0/settings.ini b/public/.config/gtk-3.0/settings.ini
index 7033423..8790fb3 100644
--- a/public/.config/gtk-3.0/settings.ini
+++ b/public/.config/gtk-3.0/settings.ini
@@ -5,7 +5,7 @@ gtk-cursor-theme-name=breeze_cursors
gtk-cursor-theme-size=24
gtk-decoration-layout=icon:minimize,maximize,close
gtk-enable-animations=true
-gtk-font-name=Noto Sans, 12
+gtk-font-name=Noto Sans, 14
gtk-icon-theme-name=breeze
gtk-menu-images=true
gtk-modules=colorreload-gtk-module:window-decorations-gtk-module
diff --git a/public/.config/zathura/zathurarc b/public/.config/zathura/zathurarc
index c033af9..c35c6d7 100644
--- a/public/.config/zathura/zathurarc
+++ b/public/.config/zathura/zathurarc
@@ -22,7 +22,8 @@ set guioptions sv
# TODO: map the right mouse button (Button2) to 'help to pan document' (which is
# mapped to middle button (Button3)
-map <Button2> scroll down
+# These two don't work. And will mess up the Button2 "panning functionality"
+#map <Button2> scroll down
#map <Button2> feedkeys <Button3>
unmap [normal] <C-n>
diff --git a/public/.local/bin/dmenu-openbook.sh b/public/.local/bin/dmenu-openbook.sh
index 6a257c7..e5766d5 100755
--- a/public/.local/bin/dmenu-openbook.sh
+++ b/public/.local/bin/dmenu-openbook.sh
@@ -1,5 +1,10 @@
#!/bin/bash
# xdg-open a file selected through dmenu
+# TODO: merge dmenu-open* into dmenu-open.sh, call it with 1 argument:
+# `dmenu-open.sh books|spreadsheet`
+# `dmenu-open.sh` with no arguments opens a preliminary dmenu to select
+# the category (base directory) from a list. Each category is defined by
+# a path and white-listed file extensions.
path="$HOME/docs/books"
@@ -13,6 +18,6 @@ cd $path
files=$(find . -type f \( -iname "*.pdf" -o -iname "*.epub" \))
selected=$(echo "$files" | dmenu -i -l 20 -p "Select book:")
if [ -n "$selected" ]; then
- xdg-open "$selected"
+ xdg-open "$selected" &
notify
fi
diff --git a/public/.local/bin/dmenu-opentable.sh b/public/.local/bin/dmenu-opentable.sh
index 69786bb..229efff 100755
--- a/public/.local/bin/dmenu-opentable.sh
+++ b/public/.local/bin/dmenu-opentable.sh
@@ -1,7 +1,14 @@
#!/bin/bash
# xdg-open a file selected through dmenu
+notify() {
+ mimetype=$(xdg-mime query filetype "$DIR/$FILE")
+ defaultprogram=$(xdg-mime query default "$mimetype")
+ notify-send "Opening $FILE ($mimetype) with $defaultprogram"
+}
+
DIR="$HOME/docs/spreadsheet"
FILE=$(ls "$DIR" | dmenu -i -l 10 -p "Select spreadsheet:")
[ -z "$FILE" ] && exit 1
+notify
xdg-open "$DIR/$FILE"
diff --git a/public/.local/bin/dmenu-webshortcuts.sh b/public/.local/bin/dmenu-webshortcuts.sh
index 411525d..1578b5d 100755
--- a/public/.local/bin/dmenu-webshortcuts.sh
+++ b/public/.local/bin/dmenu-webshortcuts.sh
@@ -8,15 +8,15 @@
# TODO: Integrate it to dmenu_run (so that this script doens't require a
# dedicated keybinding)
#
+# Usage:
+# 1. Execute program (e.g., keybinding)
+# 2. Input keyword:search_term and press enter
+# 3. If keyword is correct, browser should open the appropiate page
+#
# Mitsuo
# 2023-11-23
input=$(echo "" | dmenu -p 'wp:Hello World')
-## Set Internal Field Separator, save separated fields as an array in $CMD (-a),
-## don't allow backslashes to escape any characters (-r). Feed $input as stdin.
-#IFS=':' read -ra CMD <<< "$input"
-#keyword=${CMD[0]}
-#search_term=${CMD[1]}
keyword="${input%%:*}"
search_term="${input#*:}"
@@ -36,7 +36,7 @@ case "$keyword" in
# Maps
"ggm") xdg-open "https://www.google.com/maps/search/${search_term// /+}" ;;
"osm") xdg-open "https://www.openstreetmap.org/search?query=$search_term" ;;
-
+
# Reference
"wp") xdg-open "https://en.wikipedia.org/wiki/${search_term// /_}" ;;
"wt") xdg-open "https://en.wiktionary.org/wiki/${search_term// /_}" ;;
@@ -46,6 +46,9 @@ case "$keyword" in
# Computer
"arch") xdg-open "https://wiki.archlinux.org/index.php?search=${search_term// /+}" ;;
+ "debian") xdg-open "https://wiki.debian.org/${search_term// /}" ;;
+ "gentoo") xdg-open "https://wiki.gentoo.org/index.php?search=${search_term// /+}" ;;
+ "apt") xdg-open "https://packages.debian.org/search?lang=en&searchon=names&keywords=${search_term// /-}" ;;
"aur") xdg-open "https://aur.archlinux.org/packages?O=0&K=${search_term// /+}" ;;
"so") xdg-open "https://stackoverflow.com/search?q=${search_term// /+}" ;;
"gh") xdg-open "https://github.com/search?q=${search_term// /+}&type=repositories" ;;
@@ -83,13 +86,17 @@ case "$keyword" in
"jisho") xdg-open "https://jisho.org/search/$search_term" ;;
"rae") xdg-open "https://dle.rae.es/?w=$search_term" ;;
- # Mitsuo
- "pw") xdg-open "http://wiki.localhost/index.php?search=${search_term// /+}" ;;
+ # Games
"factorio") xdg-open "https://wiki.factorio.com/${search_term// /_}" ;;
"dst") xdg-open "https://dontstarve.wiki.gg/wiki/${search_term// /_}" ;;
"mc") xdg-open "https://minecraft.wiki/w/${search_term// /_}" ;;
"terraria") xdg-open "https://terraria.wiki.gg/wiki/${search_term// /_}" ;;
+ "gungeon") xdg-open "https://enterthegungeon.fandom.com/wiki/${search_term// /_}" ;;
- *) exit 1 ;;
-esac
+ # Localhost
+ "pw") xdg-open "http://wiki.localhost/index.php?search=${search_term// /+}" ;;
+ *)
+ notify-send "Bad keyword: $keyword"
+ exit 1 ;;
+esac
diff --git a/public/.local/bin/laptop-xrandr.sh b/public/.local/bin/laptop-xrandr.sh
index 833586c..deee7c9 100755
--- a/public/.local/bin/laptop-xrandr.sh
+++ b/public/.local/bin/laptop-xrandr.sh
@@ -25,7 +25,8 @@ only_hdmi_4k() {
}
only_hdmi_2k() {
- xrandr --output eDP --off --output HDMI-A-0 --mode 1920x1080
+ #xrandr --output eDP --off --output HDMI-A-0 --mode 1920x1080
+ xrandr --output eDP --off --output HDMI-A-0 --auto
}
case $1 in
diff --git a/public/.local/bin/myfile-handler.sh b/public/.local/bin/myfile-handler.sh
index 52496cd..df57a9a 100755
--- a/public/.local/bin/myfile-handler.sh
+++ b/public/.local/bin/myfile-handler.sh
@@ -1,8 +1,15 @@
#!/bin/bash
# A script to handle custom protocol
-url="$1"
+notify() {
+ mimetype=$(xdg-mime query filetype "$file_path")
+ defaultprogram=$(xdg-mime query default "$mimetype")
+ notify-send "Opening $(basename $file_path) ($mimetype) with $defaultprogram"
+}
+
+url="$1"
file_path="${url#myfile://}"
file_path=$(echo "$file_path" | sed 's/%20/ /g')
file_path="${file_path/\~/$HOME}"
+notify
xdg-open "$file_path"
diff --git a/public/.local/bin/network_control.sh b/public/.local/bin/network_control.sh
index 4dc4b38..8fe580f 100755
--- a/public/.local/bin/network_control.sh
+++ b/public/.local/bin/network_control.sh
@@ -35,9 +35,12 @@ toggle_network_quarantine() {
fi
}
-# WIP
toggle_bluetooth() {
- :
+ if bluetoothctl show | grep -q "Powered: yes"; then
+ bluetoothctl power off
+ else
+ bluetoothctl power on
+ fi
}
case $1 in
diff --git a/public/.local/bin/ocrthis.sh b/public/.local/bin/ocrthis.sh
index 3010a6a..0275d01 100755
--- a/public/.local/bin/ocrthis.sh
+++ b/public/.local/bin/ocrthis.sh
@@ -17,4 +17,4 @@ convert "$1" "${b}.pdf"
# TODO: some contrast enhancement step would help. If text has low contrast
# with background (e.g., blue on black, green on black), then OCR fails.
ocrmypdf "${b}.pdf" "${b}.ocr.pdf"
-mv -f "${b}.ocr.pdf" "${b}.pdf"
+#mv -f "${b}.ocr.pdf" "${b}.pdf"
diff --git a/public/.local/share/dmenu/chars/unicode b/public/.local/share/dmenu/chars/unicode
new file mode 100644
index 0000000..c92f975
--- /dev/null
+++ b/public/.local/share/dmenu/chars/unicode
@@ -0,0 +1,2 @@
+# useful unicode characters
+〒 jp post mark 郵便記号
diff --git a/public/.xbindkeysrc b/public/.xbindkeysrc
index c5c87b0..94dba99 100644
--- a/public/.xbindkeysrc
+++ b/public/.xbindkeysrc
@@ -39,7 +39,7 @@
# Examples of commands:
-#"xbindkeys_show"
+#"xbindkeys_show"
# control+shift + q
## set directly keycode (here control + f with my keyboard)
@@ -101,7 +101,7 @@
"audio_control.sh inc"
Mod4 + 0
-
+
"audio_control.sh dec"
Mod4 + 9
@@ -110,7 +110,7 @@
"audio_control.sh micinc"
Mod4 + 8
-
+
"audio_control.sh micdec"
Mod4 + 7
@@ -148,10 +148,16 @@
Alt + w
"dmenu-emoji.sh"
- Alt + e
+ Mod4 + u
"dmenu-snippet.sh"
- Alt + s
+ Mod4 + c
+
+"dmenu-opentable.sh"
+ Mod4 + d
+
+"dmenu-openbook.sh"
+ Mod4 + b
"screenshot.sh"
Print
@@ -162,12 +168,6 @@
"screenshot_ocr.sh"
Mod4 + s
-"dmenu-opentable.sh"
- Mod4 + d
-
-"dmenu-openbook.sh"
- Mod4 + b
-
# This key combination (Mod4 + Space) seems to break xbindkeys
# See Also:
# https://bbs.archlinux.org/viewtopic.php?id=226182
@@ -221,3 +221,16 @@
"playerctl previous"
Mod4 + Left
+
+# Mouse
+# -----
+
+# The following mappings have the unexpected but useful side-effect that
+# double-clicking still preserves previous/following page function in Firefox
+# "previous page: temporarily hold control (zoom control)"
+"xdotool keydown Control && sleep 1 && xdotool keyup Control"
+ b:8
+
+# "following page": temporarily hold shift (yomitan look-ups)
+"xdotool keydown Shift && sleep 1 && xdotool keyup Shift"
+ b:9
diff --git a/public/code/dwm/config.h b/public/code/dwm/config.h
index c798838..2265824 100644
--- a/public/code/dwm/config.h
+++ b/public/code/dwm/config.h
@@ -36,6 +36,8 @@ static const Rule rules[] = {
{ "GoldenDict", NULL, NULL, 0, 1, -1 },
{ "st", NULL, NULL, 0, 1, -1 },
{ "nsxiv", NULL, NULL, 0, 1, -1 },
+ { "pcmanfm", NULL, NULL, 0, 1, -1 },
+ { "libreoffice", NULL, NULL, 0, 1, -1 },
};
/* layout(s) */