added submap to xmonad keybindings for mod+s a (for all) and mod+s d (for duckduckgo), and updated dmenusearch to facillitate this

This commit is contained in:
Solomon Laing 2021-04-11 14:57:15 +09:30
parent c8cedf6892
commit fdb831d019
3 changed files with 33 additions and 13 deletions

View File

@ -22,5 +22,6 @@
"viewType": "jupyter.notebook.ipynb", "viewType": "jupyter.notebook.ipynb",
"filenamePattern": "*.ipynb" "filenamePattern": "*.ipynb"
} }
] ],
"window.zoomLevel": -1
} }

View File

@ -1,8 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Script name: dmsearch # Script name: dmenusearch
# Description: Search various search engines (inspired by surfraw). # Description: Search various search engines (inspired by surfraw).
# Dependencies: dmenu and a web browser # Dependencies: dmenu and a web browser
# Usage: dmenusearch <engine>
# where engine is amazon, duckduckgo, etc.
# without engine all options will be listed
# Pilfered from Derek Taylor @ https://www.gitlab.com/dwt1/dmscripts # Pilfered from Derek Taylor @ https://www.gitlab.com/dwt1/dmscripts
@ -65,17 +68,23 @@ options[googleOpenSource]="https://opensource.google/projects/search?q="
options[googleExperimentswithGoogle]="https://experiments.withgoogle.com/search?q=" options[googleExperimentswithGoogle]="https://experiments.withgoogle.com/search?q="
options[googleDataset]="https://datasetsearch.research.google.com/search?query=" options[googleDataset]="https://datasetsearch.research.google.com/search?query="
# Picking a search engine. if [ -z "$1" ]; then
# shellcheck disable=SC2154 # Picking a search engine.
while [ -z "$engine" ]; do # shellcheck disable=SC2154
engine=$(printf '%s\n' "${!options[@]}" | sort | dmenu -i -p 'Choose search engine:') "$@" || exit while [ -z "$engine" ]; do
url="${options["${engine}"]}" || exit engine=$(printf '%s\n' "${!options[@]}" | sort | dmenu -i -p 'Choose search engine:') "$@" || exit
done url="${options["${engine}"]}" || exit
done
else
engine="$1"
fi
url="${options["${engine}"]}" || exit
# Searching the chosen engine. # Searching the chosen engine.
# shellcheck disable=SC2154 # shellcheck disable=SC2154
while [ -z "$query" ]; do while [ -z "$query" ]; do
query=$(echo "$engine" | dmenu -p 'Enter search query:') "$@" || exit query=$(echo "$engine" | dmenu -p 'Enter search query:') || exit
done done
# Display search results in web browser # Display search results in web browser

View File

@ -13,6 +13,7 @@ import XMonad.Actions.CopyWindow (kill1)
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
import XMonad.Actions.GridSelect import XMonad.Actions.GridSelect
import XMonad.Actions.MouseResize import XMonad.Actions.MouseResize
import XMonad.Actions.Submap
import XMonad.Actions.Promote import XMonad.Actions.Promote
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown) import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
import qualified XMonad.Actions.TreeSelect as TS import qualified XMonad.Actions.TreeSelect as TS
@ -253,20 +254,29 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
, ((modm, xK_t ), spawn "/home/solomon/.local/bin/passwords") , ((modm, xK_t ), spawn "/home/solomon/.local/bin/passwords")
-- launch searcher -- launch searcher
,((modm, xK_s ), spawn "/home/solomon/.local/bin/dmenusearch") , ((modm, xK_s ), spawn "/home/solomon/.local/bin/dmenusearch")
, ((modm, xK_s), submap . M.fromList $
[
-- just open dmenusearch
((0, xK_a), spawn "/home/solomon/.local/bin/dmenusearch")
-- open dmenusearch with duckduckgo preselected
, ((0, xK_d), spawn "/home/solomon/.local/bin/dmenusearch duckduckgo")
])
-- launch mounter -- launch mounter
,((modm, xK_c ), spawn "/home/solomon/.local/bin/dmenumount") , ((modm, xK_c ), spawn "/home/solomon/.local/bin/dmenumount")
-- launch unmounter -- launch unmounter
,((modm .|. shiftMask, xK_c ), spawn "/home/solomon/.local/bin/dmenuumount") , ((modm .|. shiftMask, xK_c ), spawn "/home/solomon/.local/bin/dmendduumount")
] ]
++ ++
-- --
-- music controlls as I figure them out -- music controlls as I figure them out
-- --por
[ [
-- decrease volume with mod+f11 -- decrease volume with mod+f11
((modm, xK_F11), spawn "/home/solomon/.local/bin/dec-sink-volume") ((modm, xK_F11), spawn "/home/solomon/.local/bin/dec-sink-volume")