Skip to content

Commit f4c6a59

Browse files
♻️ refactor(menu.firefox.history): Extract firefox.history.
1 parent d965c79 commit f4c6a59

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.bin/firefox.history

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ src="${profile_dir}/places.sqlite"
88
db="$(mktemp --tmpdir "${USER}-firefox.history-places.XXXXXXXX.sqlite")"
99
cp "$src" "$db"
1010

11-
url=$(sqlite3 -separator ' -- ' "$db" 'SELECT title, url FROM (SELECT visit_date, visit_type,'\
11+
sqlite3 -separator ' -- ' "$db" 'SELECT title, url FROM (SELECT visit_date, visit_type,'\
1212
'url, title FROM moz_historyvisits JOIN moz_places ON moz_historyvisits.place_id ='\
13-
'moz_places.id AND visit_type = 1 GROUP BY url ORDER BY visit_date DESC);' |\
14-
dmenu_center -p '' -sb '#54A8A8' -i -z -fullscreen)
13+
'moz_places.id AND visit_type = 1 GROUP BY url ORDER BY visit_date DESC);'
1514

1615
rm "$db"
17-
18-
if [ "$url" = '' ] ; then
19-
exit 1
20-
fi
21-
22-
firefox -p "$profile" --new-window "$(printf '%s\n' "$url" | rev | cut -d ' ' -f 1 | rev)"

.bin/menu.firefox.history

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
3+
profile="${1:-default}"
4+
5+
url=$(firefox.history "$profile" | dmenu_center -p '' -sb '#54A8A8' -i -z -fullscreen)
6+
7+
if [ "$url" = '' ] ; then
8+
exit 1
9+
fi
10+
11+
firefox -p "$profile" --new-window "$(printf '%s\n' "$url" | rev | cut -d ' ' -f 1 | rev)"

.config/i3/config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ mode "internet" {
485485
bindcode 27 exec router.config; mode "default"
486486
#-- bindsym u exec browser.url; mode "default"
487487
bindcode 30 exec browser.url; mode "default"
488-
#-- bindsym h exec firefox.history; mode "default"
489-
bindcode 43 exec firefox.history; mode "default"
488+
#-- bindsym h exec menu.firefox.history; mode "default"
489+
bindcode 43 exec menu.firefox.history; mode "default"
490490
#-- bindsym s exec search; mode "default"
491491
bindcode 39 exec search; mode "default"
492492
#-- bindsym w exec wikipedia; mode "default"

0 commit comments

Comments
 (0)