aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitsuo Tokumori <mitsuo@tokumori.xyz>2025-07-16 00:18:24 +0900
committerMitsuo Tokumori <mitsuo@tokumori.xyz>2025-07-16 00:18:24 +0900
commit3ae41fadb4837262801dfddce098587e99ae609f (patch)
tree8774752137c10425553bc0054923c1b65a749390
parentcfe0c5ee80a0aec8ef819f15d8b6010ae842ac7a (diff)
Add dmenu-openbook.sh
Also update xinitrc to disable screen power management (prevent it to turn off after 5 minutes inactivity).
-rwxr-xr-xpublic/.local/bin/dmenu-openbook.sh18
-rw-r--r--public/.xbindkeysrc3
-rw-r--r--public/.xinitrc5
3 files changed, 25 insertions, 1 deletions
diff --git a/public/.local/bin/dmenu-openbook.sh b/public/.local/bin/dmenu-openbook.sh
new file mode 100755
index 0000000..6a257c7
--- /dev/null
+++ b/public/.local/bin/dmenu-openbook.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# xdg-open a file selected through dmenu
+
+path="$HOME/docs/books"
+
+notify() {
+ mimetype=$(xdg-mime query filetype "$selected")
+ defaultprogram=$(xdg-mime query default "$mimetype")
+ notify-send "Opening $selected ($mimetype) with $defaultprogram"
+}
+
+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"
+ notify
+fi
diff --git a/public/.xbindkeysrc b/public/.xbindkeysrc
index 869a1c8..c5c87b0 100644
--- a/public/.xbindkeysrc
+++ b/public/.xbindkeysrc
@@ -165,6 +165,9 @@
"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
diff --git a/public/.xinitrc b/public/.xinitrc
index 8bd56ff..9070452 100644
--- a/public/.xinitrc
+++ b/public/.xinitrc
@@ -43,6 +43,7 @@ fi
# Thanks: https://bbs.archlinux.org/viewtopic.php?pid=1565341#p1565341
run_after_dwm() {
+ setxkbmap -option caps:escape
## Bind the right Alt key to Mod4 (for DWM)
## https://wiki.archlinux.org/title/Dwm#Bind_the_right_Alt_key_to_Mod4
## xmodmap -pke | grep Alt_R
@@ -50,6 +51,9 @@ run_after_dwm() {
#xmodmap -e "remove mod1 = Super_L"
# update audio status bar info (idk why it isn't immediatly available)
audio_control.sh
+ # Disable DPMS and prevent screen from blanking
+ # https://wiki.archlinux.org/title/Display_Power_Management_Signaling
+ xset s off -dpms
}
# fcitx (CJK and emoji input method)
@@ -58,7 +62,6 @@ export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
xrandr --dpi 144 # Original mac: 72, stupid windows: 96 pulse15: 188
-setxkbmap -option caps:escape
laptop-xinput_setup.sh
laptop-xrandr.sh
xbindkeys