Compare commits

...

22 Commits

Author SHA1 Message Date
Emre AKYÜZ
7bfa7a51ea
Merge 0eaff5c245ccbbb0320dcdae06c778188774b0d9 into 1f7376c805cb57daef05713412f8e562141eead8 2024-05-12 22:38:24 +03:00
poeplva
1f7376c805
Corrects "application/octet-stream is for arbitrary binary files" (#1337)
* Corrects the syntax error in "application/octet-stream is for arbitrary binary files"

#1321 had a syntax error, this commit correct it.

* Update lfrc

support for ts
2024-05-11 14:22:52 +00:00
Stepan Chernov
97f2fa3872
Update sb-clock to fix display issue (#1380)
Co-authored-by: Stepan Chernov <me@chernov.land>
2024-05-11 12:56:27 +00:00
Tri Asep Tumbara
db8ee0df79
Fix the problem when taking a screenshot of the lf window (#1398)
Without -B option, the result of the screenshot is a blank picture.
2024-05-11 12:55:29 +00:00
David Nevado
97687287bd
fix: grep pattern to avoid unintended matches (#1383)
added `^` and `$` to the pattern used in `grep -v`
in order to avoid matching displays whose name
contains some other display name. e.g ("DPI", "eDPI")
2024-05-11 12:54:21 +00:00
TheYellowArchitect
5c8d46a4e7
Added 5 new mappings, 3 of which pipe to clipboard (#1373)
1. Copies the selected filename instead of the filepath, and pipes it to clipboard.

2. Copies the selected filename and if it matches the yt-dlp downloaded video format [1234567891011], gets the full youtube URL and pipes it to clipboard.

3. Copies the selected filename and if it matches the yt-dlp downloaded video format [1234567891011], gets the full piped.video URL and pipes it to the clipboard. (piped.video is a mirror of youtube, even includes comments)

4. Opens current folder in full picture mode. Think windows large icons mode. Good for browsing quickly through image albums.

5. Ctrl+l to unselect all selections so the behaviour matches the terminal.
2024-05-11 12:53:48 +00:00
Alessio Artoni
dd6eb37469
Remove unused vim configs and shortcuts (#1385)
Remove: ranger shortcuts, "nocompatible", plain Vim support for
NERDTreeBookmarksFile and vimling configuration.
2024-05-11 12:42:22 +00:00
Emre AKYÜZ
f1915e71e5
[compiler] - streamline | simplify | minimize (#1389)
* [compiler] - streamline | simplify | minimize

* Update compiler
2024-05-11 12:41:19 +00:00
Emre AKYÜZ
92f9fc458c
[getcomproot] - fix | minimize | posix compliance (#1388) 2024-05-11 12:39:43 +00:00
fennomaani
b545443993
Save command to history before it is executed (#1409) 2024-05-11 12:35:28 +00:00
Emre AKYÜZ
0eaff5c245
Use new lines & empty lines for readability 2024-01-07 09:59:57 +03:00
Emre AKYÜZ
5fb8b6ca90
use best practices for variables and formatting 2024-01-05 13:26:36 +03:00
Emre AKYÜZ
56304e551d
Improve comments. 2023-11-19 19:17:29 +03:00
Emre AKYÜZ
2a5cf35142
Add some comments and an example URL 2023-11-19 18:51:54 +03:00
Emre AKYÜZ
36add3ec99
Rename bookmark_manager.sh to browser_bookmarks.sh 2023-11-19 15:30:07 +03:00
Emre AKYÜZ
b71e0738ee
Update bookmark_manager.sh 2023-11-19 15:23:32 +03:00
Emre AKYÜZ
c9ad701e63
Do not open random entries if not on the query 2023-11-19 01:10:01 +03:00
Emre AKYÜZ
f51d7451cb
Make the name more intuitive. 2023-11-18 22:58:16 +03:00
Emre AKYÜZ
083da4d28c
Update chadmarked 2023-11-18 22:54:40 +03:00
Emre AKYÜZ
4854a853e4
simplify | improve | change jq to sed 2023-10-17 11:32:19 +03:00
Emre AKYÜZ
d3035edc7e
Simplify Further | Remove if statements
1- Used logical operators instead of if statements.
2- Improved indentations and blocks for better readibility.
3- Simplified in general.
2023-09-09 16:28:31 +03:00
Emre AKYÜZ
943220f884
Extremely Improved Bookmarks (Search + Strip URL + More)
The inspiration: (Luke Smith's Video): "Bookmarking for Unix Chads"
Instructions & Justifications & Very Detailed Explanation for Everything can be found below.

Short Summary
- Allows users to manage and navigate bookmarks using dmenu. 
- The user can perform actions such as adding, deleting, and editing bookmarks. The script also handles searching within specific websites if the bookmarked URL has the word "search" in it. Such as the SearxNG Instance: "paulgo.io/search?q=".
- One more interesting feature of it is that it modifies the order of bookmarks by their popularity (how frequently visited by you). 
- It can work with Dash and it has no bashisms.

Execution Time: Instant
Required Programs: dash (or bash) | jq | echo | grep | dmenu | notification daemon | browser | xclip (or "wl-paste" on Wayland)

Instructions:
These directories should exist: ~/.local/share/larbs/ 
1. pacman -s jq (it's a very small program (I.E. 690kb)
2. Open a browser and highlight (xclip -o users) or copy (Wayland users) a website's URL (starting with "http") such as "https://github.com" 
2. Run the script with a shortcut you created for the window manager that is used.
3. Write "@@" inside the terminal then enter (@@ can be changed of course). This opens the "Action Menu".
4. Select "Add a New Bookmark" option then enter.
5. The bookmark will be added inside the bookmarks menu. It can be edited or deleted later from the action menu that can be opened with "@@".
6. If a website that has the word "search" in it is added inside bookmarks such as a SearxNG instance "paulgo.io/search?q=" , its search function can be used. When selected, it will offer for a new prompt for the desired keywords.

Justification:

1. The script uses jq for parsing and modifying JSON data, which is a lightweight and powerful command-line JSON processor. This choice allows for easy manipulation of the JSON file that stores bookmarks.

2. The use of the while loop with the dmenu interface ensures that the user can perform multiple actions (adding, deleting, or editing bookmarks) in a single session without needing to restart the script.

3. The script checks for an existing URLQUERY_FILE and initializes it with an empty JSON array "[]" if it doesn't exist or is empty. This ensures that the file is always in a valid state for the script to operate.

4. The script sorts bookmarks by popularity, allowing users to quickly access their most frequently visited bookmarks. This is achieved by incrementing a popularity value each time a bookmark is opened.

5. The script supports searching within specific websites by checking if the word "search" is in the URL (More words can be added). This feature provides a convenient way to search within bookmarked websites directly from the script.

6. The use of the dash shell (#!/bin/sh) as the interpreter provides a lightweight and fast shell environment for the script, improving performance. Since the script is efficient enough so this performance difference is not huge, so it can also be used with bash.

Detailed Explanation

1. URLQUERY_FILE="~/.local/share/larbs/urlquery": Sets the path for the JSON file that will store the bookmarks.

2. The following block checks if the URLQUERY_FILE exists and if it's empty. If either condition is met, it initializes the file with an empty JSON array "[]". If there is no JSON array present, then no bookmark can be added.

`if [ ! -f "$URLQUERY_FILE" ] || [ ! -s "$URLQUERY_FILE" ]; then
  echo "[]" > "$URLQUERY_FILE"
fi`

3. ACTION_MENU='@@': Sets a special string for the action menu.

4. The read_bookmarks function reads the contents of the URLQUERY_FILE using jq. The write_bookmarks function writes the contents passed as an argument to a temporary file and then moves it to the URLQUERY_FILE. The update_bookmark_popularity function updates the popularity value of a bookmark, given its name.

5. The contains_search function checks if a given string contains the word "search". It returns 0 if it does, 1 otherwise.

6. bookmarks=$(read_bookmarks): Reads the bookmarks from the file and stores them in a variable.

7. touch "$URLQUERY_FILE": Ensures the URLQUERY_FILE exists by creating it if it doesn't.

8. The following while loop presents a menu to the user for choosing an action (Add, Delete, or Edit bookmark) or a bookmark to open. It continues until the user selects a bookmark to open or provides an empty input.

`while true; do
  SELECTION=$(echo "$bookmarks" | jq -r '. | sort_by(.[2]) | reverse | .[] | .[0]' | rofi -dmenu -p "Bookmark")

  if [ -z "$SELECTION" ] || [ "$SELECTION" != "$ACTION_MENU" ]; then
    write_bookmarks "$bookmarks"
    break
  fi

  ACTION=$(echo "Add a New Bookmark\nDelete a Bookmark\nEdit a Bookmark" | rofi -dmenu -p "Action")
  #...
done`

9. The case block inside the while loop performs the selected action (Add, Delete, or Edit) based on the user's input.

10. After the loop, the script checks if a valid bookmark is selected. If so, it updates the popularity value, writes the changes to the file, and opens the bookmark in Firefox or any browser. If the bookmark contains the word "search", it prompts the user for a search query before opening the URL in Firefox.

11. Creating and moving temporary files are for data integrity and safety. It ensures 0 file corruptions. Has no negative effect in terms of performance.
2023-04-24 12:43:35 +03:00
10 changed files with 211 additions and 78 deletions

View File

@ -30,7 +30,7 @@ set autoquit true
cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
image/vnd.djvu|application/pdf|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;;
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;;
@ -45,8 +45,14 @@ cmd open ${{
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pgp-encrypted) $EDITOR $fx ;;
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
application/octet-stream) case ${f##*.} in
doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;;
ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;;
ts) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
*) setsid -f zathura $fx >/dev/null 2>&1 ;;
esac ;;
*) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
esac
}}
@ -162,7 +168,14 @@ map V push :!nvim<space>
map W $setsid -f $TERMINAL >/dev/null 2>&1
map Y $printf "%s" "$fx" | xclip -selection clipboard
map U $printf "%s" "$fx" | xclip -selection clipboard
map u $printf "%s" "$fx" | sed 's/.*\///' | xclip -selection clipboard
map . $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/www.youtube.com\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard
map <gt> $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/piped.video\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard
map T $sxiv -t "$(pwd)" # opens thumbnail mode
map <c-l> unselect
# Source Bookmarks
source "~/.config/lf/shortcutrc"

View File

@ -34,7 +34,6 @@ set noshowcmd
" Some basics:
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
@ -55,22 +54,11 @@ set noshowcmd
" Nerd tree
map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if has('nvim')
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
else
let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks'
endif
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
" vimling:
nm <leader>d :call ToggleDeadKeys()<CR>
imap <leader>d <esc>:call ToggleDeadKeys()<CR>a
nm <leader>i :call ToggleIPA()<CR>
imap <leader>i <esc>:call ToggleIPA()<CR>a
nm <leader>q :call ToggleProse()<CR>
" vim-airline
if !exists('g:airline_symbols')
let g:airline_symbols = {}
let g:airline_symbols = {}
endif
let g:airline_symbols.colnr = ' C:'
let g:airline_symbols.linenr = ' L:'

View File

@ -11,6 +11,7 @@ setopt interactive_comments
HISTSIZE=10000000
SAVEHIST=10000000
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
setopt inc_append_history
# Load aliases and shortcuts if existent.
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"

View File

@ -0,0 +1,144 @@
#!/bin/dash
URLQUERY_FILE="${HOME}/.local/share/urlquery"
ACTION_MENU="@@"
# For additional search function, see information on open_bookmark function below
CLIPBOARD() {
xclip -o
}
DMENU() {
dmenu -i -l "${1}" -p "${2}"
}
error_notify() {
notify-send "${1}"
exit "1"
}
ensure_file_exists() {
[ -f "${URLQUERY_FILE}" ] || {
notify-send "${URLQUERY_FILE} does not exist. Creating it now."
printf "SearXNG=https://searx.tiekoetter.com/search?q=\n" > "${URLQUERY_FILE}"
}
}
get_selection() {
cut -d= -f1 "${URLQUERY_FILE}" | DMENU "${LINE_COUNT}" "Bookmarks"
}
update_file() {
pattern="${1}"
replacement="${2}"
sed "/${pattern}/c\\${replacement}" "${URLQUERY_FILE}" > "${URLQUERY_FILE}.tmp" &&
mv "${URLQUERY_FILE}.tmp" "${URLQUERY_FILE}" ||
error_notify "Failed to update the file."
}
is_valid_url() {
printf "%s\n" "${1}" | grep -qE "^https?://[^[:space:]/?#][^[:space:]]+$"
}
add_bookmark() {
URL="$(CLIPBOARD)"
is_valid_url "${URL}" || error_notify "The clipboard content is not a valid URL."
grep -q "=${URL}$" "${URLQUERY_FILE}" &&
notify-send "The URL is already in the list." && return
NAME="$(printf "" | DMENU "0" "Name")"
[ -n "${NAME}" ] && printf "%s\n" "${NAME}=${URL}" >> "${URLQUERY_FILE}" &&
notify-send "'${NAME}' is bookmarked."
}
delete_bookmark() {
NAME="$(get_selection)"
[ -z "${NAME}" ] && error_notify "Failed to delete the bookmark." && return
sed "/^${NAME}=/d" "${URLQUERY_FILE}" > "${URLQUERY_FILE}.tmp"
mv "${URLQUERY_FILE}.tmp" "${URLQUERY_FILE}"
[ -s "${URLQUERY_FILE}" ] && grep -qE "\S" "${URLQUERY_FILE}" || rm "${URLQUERY_FILE}"
notify-send "'${NAME}' is deleted."
}
edit_name() {
OLD_NAME="${1}"
NEW_NAME="$(printf "" | DMENU "0" "New Name")"
[ -z "${NEW_NAME}" ] && return
URL="$(grep "^${OLD_NAME}=" "${URLQUERY_FILE}" | cut -d= -f2)"
update_file "^${OLD_NAME}=" "${NEW_NAME}=${URL}"
}
edit_url() {
NAME="${1}"
NEW_URL="$(echo "" | DMENU "0" "New URL")"
[ -z "${NEW_URL}" ] && return
update_file "^${NAME}=.*" "${NAME}=${NEW_URL}"
}
edit_bookmark() {
NAME="$(get_selection)"
[ -z "${NAME}" ] && error_notify "Failed to edit the bookmark." && return
FIELD="$(printf "Name\nURL\n" | DMENU "2" "Edit")"
case "${FIELD}" in
"Name")edit_name "${NAME}";;
"URL")edit_url "${NAME}"
esac
notify-send "'${NAME}' is updated."
}
open_bookmark() {
URL="$(grep "^${SELECTION}=" "${URLQUERY_FILE}" | cut -d= -f2-)"
[ -z "${URL}" ] && notify-send "Bookmark not found." && exit "1"
case "${URL}" in
*"search"* | *"wiki"* | *"packages"*) QUERY="$(echo "" | DMENU "0" "Search")"
URL="${URL}${QUERY}"
;;
esac
"${BROWSER}" "${URL}" || notify-send "Failed to open the URL."
}
ensure_file_exists
LINE_COUNT="$(wc -l < "${URLQUERY_FILE}")"
[ "${LINE_COUNT}" -ge "15" ] && LINE_COUNT="15"
SELECTION="$(get_selection)"
[ -z "${SELECTION}" ] && exit
case "${SELECTION}" in
"${ACTION_MENU}")
ACTION="$(printf "Add\nDelete\nEdit\n" | DMENU "3" "Action")"
case "${ACTION}" in
"Add") add_bookmark ;;
"Delete") delete_bookmark ;;
"Edit") edit_bookmark ;;
esac
;;
*)
open_bookmark
;;
esac

View File

@ -2,58 +2,51 @@
# This script will compile or run another finishing operation on a document. I
# have this script run via vim.
#
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extension or shebang.
#
# Note that .tex files which you wish to compile with XeLaTeX should have the
# string "xelatex" somewhere in a comment/command in the first 5 lines.
file=$(readlink -f "$1")
file="${1}"
ext="${file##*.}"
dir=${file%/*}
base="${file%.*}"
ext="${file##*.}"
cd "$dir" || exit 1
cd "${dir}" || exit "1"
textype() { \
textarget="$(getcomproot "$file" || echo "$file")"
echo "$textarget"
command="pdflatex"
( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex"
$command --output-directory="${textarget%/*}" "${textarget%.*}"
grep -qi addbibresource "$textarget" &&
biber --input-directory "${textarget%/*}" "${textarget%.*}" &&
$command --output-directory="${textarget%/*}" "${textarget%.*}" &&
$command --output-directory="${textarget%/*}" "${textarget%.*}"
}
case "$ext" in
# Try to keep these cases in alphabetical order.
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
c) cc "$file" -o "$base" && "$base" ;;
cpp) g++ "$file" -o "$base" && "$base" ;;
cs) mcs "$file" && mono "$base".exe ;;
go) go run "$file" ;;
h) sudo make install ;;
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
m) octave "$file" ;;
md) if [ -x "$(command -v lowdown)" ]; then
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf
elif [ -x "$(command -v groffdown)" ]; then
groffdown -i "$file" | groff -T pdf > "$base".pdf
else
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
fi ; ;;
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
py) python "$file" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "$file" "$base".css ;;
scad) openscad -o "$base".stl "$file" ;;
sent) setsid -f sent "$file" 2>/dev/null ;;
tex) textype "$file" ;;
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;;
case "${ext}" in
[0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf > "${base}.pdf" ;;
mom|ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;;
c) cc "${file}" -o "${base}" && "./${base}" ;;
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
cs) mcs "${file}" && mono "${base}.exe" ;;
go) go run "${file}" ;;
h) sudo make install ;;
java) javac -d classes "${file}" && java -cp classes "${base}" ;;
m) octave "${file}" ;;
md) [ -x "$(command -v lowdown)" ] && \
lowdown --parse-no-intraemph "${file}" -Tms | groff -mpdfmark -ms -kept -T pdf > "${base}.pdf" || \
[ -x "$(command -v groffdown)" ] && \
groffdown -i "${file}" | groff -T pdf > "${base}.pdf" || \
pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;;
org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;;
py) python "${file}" ;;
[rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "${file}" "${base}.css" ;;
scad) openscad -o "${base}.stl" "${file}" ;;
sent) setsid -f sent "${file}" 2> "/dev/null" ;;
tex)
textarget="$(getcomproot "${file}" || echo "${file}")"
command="pdflatex"
head -n5 "${textarget}" | grep -qi "xelatex" && command="xelatex"
${command} --output-directory="${textarget%/*}" "${textarget%.*}" &&
grep -qi addbibresource "${textarget}" &&
biber --input-directory "${textarget%/*}" "${textarget%.*}" &&
${command} --output-directory="${textarget%/*}" "${textarget%.*}" &&
${command} --output-directory="${textarget%/*}" "${textarget%.*}"
;;
*) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;;
esac

View File

@ -32,7 +32,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
secondary=$(echo "$screens" | grep -v ^"$primary"$)
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
@ -40,9 +40,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:")
secondary=$(echo "$screens" | grep -v ^"$primary"$ | dmenu -i -p "Select secondary display:")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:")
tertiary=$(echo "$screens" | grep -v ^"$primary"$ | grep -v ^"$secondary"$ | dmenu -i -p "Select third display:")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
}

View File

@ -1,12 +1,9 @@
#!/bin/bash
#!/bin/sh
# A helper script for LaTeX/groff files used by `compiler` and `opout`.
# The user can add the root file of a larger project as a comment as below:
# % root = mainfile.tex
# And the compiler script will run on that instead of the opened file.
texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")"
texroot="${texroot##*=}"
texroot="${texroot//[\"\' ]}"
[ -f "$texroot" ] && readlink -f "$texroot" || exit 1
texroot="$(sed -n 's/^\s*%.*root\s*=\s*\(\S\+\).*/\1/p' "${1}")"
[ -f "${texroot}" ] && readlink -f "${texroot}" || exit "1"

View File

@ -10,7 +10,7 @@ xclip_cmd="xclip -sel clip -t image/png"
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -u -s pic-selected-"${output}" ;;
"current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
"current window") maim -B -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;;
"full screen") maim -q -d 0.2 pic-full-"${output}" ;;
"a selected area (copy)") maim -u -s | ${xclip_cmd} ;;
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;

View File

@ -8,13 +8,12 @@ shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim"
ranger_shortcuts="/dev/null"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="/dev/null"
# Remove, prepare files
rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null
rm -f "$lf_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
@ -27,7 +26,6 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ;
printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ;
printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ;
printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ;
printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }"
@ -38,6 +36,5 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ;
printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ;
printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" ;
printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }"

View File

@ -19,7 +19,7 @@ case "$clock" in
esac
case $BLOCK_BUTTON in
1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|sed 's/ //g')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
2) setsid -f "$TERMINAL" -e calcurse ;;
3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
- Middle click opens calcurse if installed" ;;