aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-01-14 00:34:41 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-01-14 00:34:41 -0700
commitd3354e4a7099bd7b70973a66b836ba4f63b60bd6 (patch)
tree73518e32a1b78aedeedbae4b596d04713c5908e0
parent0f05c8b099cc6a1f6299f095d96e6a79d4a96b4c (diff)
parent0bde08d5180d08ef102d3d5bff0f50f2e7533e4e (diff)
downloadrde-d3354e4a7099bd7b70973a66b836ba4f63b60bd6.tar.gz
rde-d3354e4a7099bd7b70973a66b836ba4f63b60bd6.tar.bz2
rde-d3354e4a7099bd7b70973a66b836ba4f63b60bd6.zip
Merge branch 'v017' of josher.dev:rde into v017
-rw-r--r--extras/HOME/.config/rofi/config.rasi11
-rwxr-xr-xextras/HOME/.local/bin/bluetooth-select.sh6
-rwxr-xr-xextras/HOME/.local/bin/emoji-select.sh6
-rwxr-xr-xextras/HOME/.local/bin/emoticon-select.sh6
-rwxr-xr-xextras/HOME/.local/bin/library-view.sh28
-rwxr-xr-xextras/HOME/.local/bin/rofi-pass6
-rwxr-xr-xextras/HOME/.local/bin/set-sink.sh6
-rwxr-xr-xextras/HOME/.local/bin/set-volume.sh95
-rw-r--r--extras/HOME/.xmonad/emoticons.txt16
-rw-r--r--extras/HOME/.xmonad/unicode.gzbin297505 -> 325355 bytes
-rw-r--r--src/Internal/DMenu.hs14
-rw-r--r--src/Internal/Keys.hs33
-rw-r--r--src/Main.hs14
13 files changed, 226 insertions, 15 deletions
diff --git a/extras/HOME/.config/rofi/config.rasi b/extras/HOME/.config/rofi/config.rasi
index 1fec00f..fe47aa6 100644
--- a/extras/HOME/.config/rofi/config.rasi
+++ b/extras/HOME/.config/rofi/config.rasi
@@ -4,18 +4,21 @@
theme-color: #8888ff;
selected-normal-background: @theme-color;
normal-foreground: @theme-color;
+ selected-normal-foreground: @main-background;
alternate-normal-foreground: @theme-color;
main-background: #202020f0;
- font: "Monofur Bold Nerd Font 34";
+ font: "Monofur Nerd Font 24";
}
window {
border: 0;
width: 100%;
height: 100%;
- padding: 20%;
+ padding: 5% 20% 5% 20%;
background-color: rgba ( 0, 0, 0, 75 % );
+ anchor:north;
+ location: north;
}
#case-indicator {
@@ -31,6 +34,7 @@ window {
}
inputbar {
+ border-radius: 10px 10px 10px 10px;
children: [ prompt,entry,case-indicator ];
}
@@ -46,9 +50,12 @@ inputbar {
border-color: rgba ( 0, 0, 0, 75 % );
scrollbar: true;
background-color: @main-background;
+ padding: 50px;
+ border-radius: 10px 10px 10px 10px;
}
element {
border: 0;
padding: 10px 10px 20px 10px ;
+ border-radius: 5px 5px 5px 5px;
}
diff --git a/extras/HOME/.local/bin/bluetooth-select.sh b/extras/HOME/.local/bin/bluetooth-select.sh
index 8c901ee..3a25387 100755
--- a/extras/HOME/.local/bin/bluetooth-select.sh
+++ b/extras/HOME/.local/bin/bluetooth-select.sh
@@ -1,8 +1,12 @@
#!/bin/bash
+if [[ -z "$ROFI" ]] ; then
+ ROFI='rofi -dmenu'
+fi
+
devices="$(bluetoothctl -- devices | sed 's#^Device ##')"
selection="$(
- echo -e "$devices\nDisconnect" | rofi -i -p "Connect Bluetooth" \
+ echo -e "$devices\nDisconnect" | $ROFI -i -p "Connect Bluetooth" \
-theme-str '* {theme-color: #8888ff;}' \
-dmenu)"
diff --git a/extras/HOME/.local/bin/emoji-select.sh b/extras/HOME/.local/bin/emoji-select.sh
index 5d244d8..a64a6e9 100755
--- a/extras/HOME/.local/bin/emoji-select.sh
+++ b/extras/HOME/.local/bin/emoji-select.sh
@@ -1,7 +1,11 @@
#!/bin/bash
+if [[ -z "$ROFI" ]] ; then
+ ROFI='rofi -dmenu'
+fi
+
if ( which rofi ) ; then
- menu=(rofi -dmenu -i -p "Select Character" -theme-str '* {theme-color: #ffff88;}' -show run)
+ menu=($ROFI -i -p "Select Character" -theme-str '* {theme-color: #ffff88;}' -show run)
else
menu=(dmenu -fn NotoSans:size=24 -i -nf "#ffff88" -sb "#ffff88" -p "Select Character" -l 12 -dim 0.4)
fi
diff --git a/extras/HOME/.local/bin/emoticon-select.sh b/extras/HOME/.local/bin/emoticon-select.sh
index cb593b4..e1637d1 100755
--- a/extras/HOME/.local/bin/emoticon-select.sh
+++ b/extras/HOME/.local/bin/emoticon-select.sh
@@ -1,7 +1,11 @@
#!/bin/bash
+if [[ -z "$ROFI" ]] ; then
+ ROFI='rofi -dmenu'
+fi
+
if ( which rofi ) ; then
- menu=(rofi -i -theme-str '* {theme-color: #ffa050;}' -p "Select Emoticon" -dmenu)
+ menu=($ROFI -i -theme-str '* {theme-color: #ffa050;}' -p "Select Emoticon")
else
menu=(dmenu -fn NotoSans:size=24 -i -nf "#ffff88" -sb "#ffff88" -p "Select Emoticon" -l 12 -dim 0.4)
fi
diff --git a/extras/HOME/.local/bin/library-view.sh b/extras/HOME/.local/bin/library-view.sh
new file mode 100755
index 0000000..29925a8
--- /dev/null
+++ b/extras/HOME/.local/bin/library-view.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+MENU=(rofi -i -dmenu -sort -theme-str '* {theme-color: #ff88ff;}' -p "Library")
+
+if (which zathura) ; then
+ pdfviewer=zathura
+elif (which evince) ; then
+ pdfviewer=evince
+else
+ pdfviewer='xdg-open'
+fi
+
+
+cd ~/Library
+
+files=(*.pdf)
+
+file_with_title="$(for file in "${files[@]}" ; do
+ echo "$file| $(echo "$file" | sed 's#\(^\|_\|\s\)\([a-z]\)#\1\U\2#g' | tr '_' ' ' | sed 's/.[^.]*$//')"
+done)"
+
+selected=$(echo "$file_with_title" | (while read file ; do
+ echo "${file//*|}"
+done) | "${MENU[@]}")
+
+if [ ! -z "${selected}" ] ; then
+ $pdfviewer "$(echo "$file_with_title" | grep "$selected" | sed 's/|.*//')"
+fi
diff --git a/extras/HOME/.local/bin/rofi-pass b/extras/HOME/.local/bin/rofi-pass
index 6eb58b7..d78870a 100755
--- a/extras/HOME/.local/bin/rofi-pass
+++ b/extras/HOME/.local/bin/rofi-pass
@@ -2,6 +2,10 @@
shopt -s nullglob globstar
+if [[ -z "$ROFI" ]] ; then
+ ROFI='rofi -dmenu'
+fi
+
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
@@ -12,7 +16,7 @@ if [[ -n $WAYLAND_DISPLAY ]]; then
dmenu=dmenu-wl
xdotool="ydotool type --file -"
elif [[ -n $DISPLAY ]]; then
- dmenu=(rofi -i -dmenu -p 'Password')
+ dmenu=($ROFI -i -p 'Password')
xdotool="xdotool type --clearmodifiers --file -"
else
echo "Error: No Wayland or X11 display detected" >&2
diff --git a/extras/HOME/.local/bin/set-sink.sh b/extras/HOME/.local/bin/set-sink.sh
index 9cd6f93..cca8746 100755
--- a/extras/HOME/.local/bin/set-sink.sh
+++ b/extras/HOME/.local/bin/set-sink.sh
@@ -1,6 +1,10 @@
#!/bin/bash
-DMENU=(rofi -i -theme-str '* {theme-color: #88ff88;}' -dmenu)
+if [[ -z "$ROFI" ]] ; then
+ ROFI='rofi -dmenu'
+fi
+
+DMENU=($ROFI -i -theme-str '* {theme-color: #88ff88;}')
sinks="$(
pactl list sinks | while read line ; do
diff --git a/extras/HOME/.local/bin/set-volume.sh b/extras/HOME/.local/bin/set-volume.sh
new file mode 100755
index 0000000..94423d0
--- /dev/null
+++ b/extras/HOME/.local/bin/set-volume.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+rofi=($ROFI -theme-str "* {theme-color: #88ffff;}")
+
+if [[ "$1" == "-a" ]] ; then
+ sinks="$(pactl list sinks | (while read line ; do
+ case $line in
+ Description:*)
+ descr=${line//*: }
+ ;;
+ Sink\ \#*)
+ if [ ! -z "$sink" ] ; then
+ echo "$state $descr ($volume)|$sink"
+ fi
+ sink=${line//*#} ;;
+ Volume:*)
+ volume=$(sed 's/.* \([0-9]\+%\).*/\1/g' <<< "$line")
+ ;;
+ *State:*)
+ state=${line//*: }
+ if [[ "$state" == 'RUNNING' ]] ; then
+ state='⏺'
+ else
+ state=' '
+ fi ;;
+ esac
+ done
+ echo "$state $descr ($volume)|$sink"))"
+ sinks="$(grep "^⏺" <<< "$sinks" ; grep -v "^⏺" <<< "$sinks")"
+
+ sink_inputs="$(pactl list sink-inputs | (while read line ; do
+ case $line in
+ *application.name\ =*)
+ app="${line//*= \"}"
+ app="${app%%\"}"
+ ;;
+ *media.name\ =*)
+ media="${line//*= \"}"
+ media="${media%%\"}"
+ ;;
+ *Volume:*)
+ volume=$(sed 's/.* \([0-9]\+%\).*/\1/g' <<< "$line")
+ ;;
+ Sink\ Input\ \#*)
+ if [ ! -z "$sink" ] ; then
+ echo "⏺ $app: $media ($volume)|$sink"
+ fi
+ sink=${line//*#} ;;
+ esac
+ done
+ echo "⏺ $app: $media ($volume)|$sink"))"
+
+ selection=$(
+ (echo "$sinks" ; echo '' ; echo "$sink_inputs") | \
+ cut -d'|' -f1 | \
+ "${rofi[@]}" -p "Set Volume For")
+
+ if [[ -z "$selection" ]] ; then
+ echo "Cancelled" >&2
+ exit 0
+ fi
+
+ value=$(grep "$selection" <<< "$sinks")
+ command="set-sink-volume"
+ if [[ -z "$value" ]] ; then
+ command="set-sink-input-volume"
+ value=$(grep "$selection" <<< "$sink_inputs")
+ if [[ -z "$value" ]] ; then
+ echo "Invalid Selection" >&2
+ exit 1
+ fi
+ fi
+ echo "Setting $value"
+ value=${value//*|}
+else
+ command="set-sink-volume"
+ value="@DEFAULT_SINK@"
+fi
+
+volume=$(echo '10%
+ 20%
+ 30%
+ 40%
+ 50%
+ 60%
+ 70%
+ 80%
+ 90%
+ 100%
+ 110%
+ 120%
+ 130%' | "${rofi[@]}" -p 'Set Volume To')
+
+echo pactl "$command" "$value" "$volume"
+pactl "$command" "$value" $volume
diff --git a/extras/HOME/.xmonad/emoticons.txt b/extras/HOME/.xmonad/emoticons.txt
index 40b83c5..65289c4 100644
--- a/extras/HOME/.xmonad/emoticons.txt
+++ b/extras/HOME/.xmonad/emoticons.txt
@@ -1,5 +1,8 @@
+Bear - (''')(0.0)(''')
+Cry - ಥ_ಥ
Deal with it - (•_•) ( •_•)>⌐■-■ (⌐■_■)
Deal with it. - (▀̿Ĺ̯▀̿ ̿)
+Disapprove - ಠ_ಠ
Do It Right - (☞゚ヮ゚)☞
Do it Left - ☜(゚ヮ゚☜)
Happy Gary - ᕕ( ᐛ )ᕗ
@@ -8,9 +11,18 @@ IDFK - ¯\(°_o)/¯
Lenny - ( ͡° ͜ʖ ͡°)
Mad Lenny - ( ͡° ʖ̯ ͡°)
Person Flip - (╯°□°)╯︵ (\ .o.)\
+Person Flip - (ノಠ益ಠ) ノ彡 (\ .o.)\
+Personback - (/ °o°)/ノ(ಠ_ಠノ)
+Raise Dongers - ヽ༼ຈل͜ຈ༽ノ
Shrug - ¯\_(ツ)_/¯
Smiley - :-)
+Surprised - (⚆_⚆)
Tableback - ┬─┬ノ(ಠ_ಠノ)
-Tableflip - (╯°□°)╯︵ ┻━┻
-Unamused - ಠ_ಠ
+Tableflip - (╯°□°)╯︵ ┻━┻
+Tableflip - (ノಠ益ಠ) ノ彡 ┻━┻
+Tableflip Shrug - ┻━┻ ︵ ¯\_(ᴼل͜ᴼ)_/¯ ︵ ┻━┻
+Table Flipped Me - ┬─┬ ︵ /(.□. \)
+Tears of Joy - ಥ‿ಥ
+Unamused - ( ͡ಠ ʖ̯ ͡ಠ)
Y u no - ლ(ಠ益ಠ)ლ
+LOL F U - ( ° ͜ʖ͡°)╭∩╮
diff --git a/extras/HOME/.xmonad/unicode.gz b/extras/HOME/.xmonad/unicode.gz
index 5dd0826..fa47bf1 100644
--- a/extras/HOME/.xmonad/unicode.gz
+++ b/extras/HOME/.xmonad/unicode.gz
Binary files differ
diff --git a/src/Internal/DMenu.hs b/src/Internal/DMenu.hs
index f964544..0ec7927 100644
--- a/src/Internal/DMenu.hs
+++ b/src/Internal/DMenu.hs
@@ -16,9 +16,17 @@ data Colors =
bg :: String
} | DefaultColors
+menuCommand :: [String]
+menuCommand = ["rofi", "-monitor", "-4", "-dmenu", "-sort", "-levenshtein-sort"]
+
+menuCommandString :: String
+menuCommandString = unwords menuCommand
+
runDMenu :: X ()
runDMenu = void $
- safeSpawn "rofi" ["-display-run", "Execute", "-show", "run"]
+ safeSpawn
+ "rofi"
+ ["-monitor", "-4", "-display-run", "Execute", "-show", "run"]
runDMenuPrompt :: String -> Maybe String -> [String] -> X String
runDMenuPrompt prompt color select =
@@ -34,5 +42,5 @@ runDMenuPromptWithMap :: String -> Maybe String -> Map String a -> X (Maybe a)
runDMenuPromptWithMap prompt color map = do
let realColor = maybe [] (
\c -> ["-theme-str", printf "* {theme-color: %s;}" c]) color
- menuMapArgs "rofi"
- (["-p", prompt, "-dmenu"] ++ realColor) map
+ menuMapArgs (head menuCommand)
+ (tail menuCommand ++ ["-p", prompt] ++ realColor) map
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index bf9b62c..27315cd 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE RankNTypes #-}
module Internal.Keys (applyKeys) where
+import Control.Monad.Fix (fix)
import Graphics.X11.ExtraTypes.XF86;
import Internal.KeysM
import Internal.SwapMaster (swapMaster)
@@ -171,7 +172,7 @@ keymap = runKeys $ do
bind xK_minus $ do
justMod $ sendMessage (IncMasterN (-1))
- shiftMod $ withFocused $ sendMessage . expandWindowAlt
+ shiftMod $ withFocused $ sendMessage . shrinkWindowAlt
bind xK_m $ do
justMod $ subkeys $
@@ -206,6 +207,23 @@ keymap = runKeys $ do
shiftMod $ withFocused $ windows . W.sink
altMod $ spawn (terminal config ++ " -t Floating\\ Term")
+ bind xK_v $
+ -- Allows repeated strokes of M-h and M-l to reduce and increase volume
+ -- respectively.
+ justMod $ fix $ \recur -> subkeys $ do
+ bind xK_h $ do
+ justMod $ do
+ spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"
+ recur
+
+ bind xK_l $ do
+ justMod $ do
+ spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"
+ recur
+
+ bind xK_v $ do
+ justMod $ recur
+
bind xK_w $ do
justMod windowJump
@@ -228,6 +246,9 @@ keymap = runKeys $ do
str
(show (map ord str))
+ bind xK_n $ do
+ (justMod -|- noMod) $ spawn (terminal config ++ " -t Notes -e notes new")
+
bind xK_c $ do
shiftMod CopyWindow.killAllOtherCopies
@@ -237,6 +258,16 @@ keymap = runKeys $ do
bind xK_a $
(justMod -|- noMod) $ spawn "set-sink.sh"
+
+ bind xK_w $
+ (justMod -|- noMod) $ spawn "networkmanager_dmenu"
+
+ bind xK_o $
+ (justMod -|- noMod) $ spawn "library-view.sh"
+
+ bind xK_v $ do
+ (justMod -|- noMod) $ spawn "set-volume.sh"
+ (shiftMod -|- rawMask shiftMask) $ spawn "set-volume.sh -a"
-- Double-tap Z to toggle zoom.
diff --git a/src/Main.hs b/src/Main.hs
index da3b4f1..f70496c 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -13,9 +13,10 @@ import Data.Monoid
import Internal.XMobarLog
import Internal.Keys
import Internal.Layout
+import Internal.DMenu (menuCommandString)
import qualified XMonad as X
-import qualified XMonad.StackSet as S
+import qualified XMonad.StackSet as W
main = do
@@ -24,6 +25,7 @@ main = do
let fp = homeDir </> ".xmonad" </> "startup"
setEnv "SUDO_ASKPASS" "/usr/bin/ssh-askpass"
+ setEnv "ROFI" menuCommandString
xmobar <- spawnXMobar
@@ -43,7 +45,8 @@ main = do
, className =? "yakuake" --> doFloat
, className =? "MPlayer" --> doFloat
, title =? "Event Tester" --> doFloat
- , title =? "Floating Term" --> doFloat
+ , title =? "Floating Term" --> doCenterFloat
+ , title =? "Notes" --> doCenterFloat
, title =? "xmessage" --> doFloat
, title =? "gxmessage" --> doFloat
, className =? "mpv" --> doFloat
@@ -55,3 +58,10 @@ main = do
, clickJustFocuses = False
, logHook = xMobarLogHook xmobar
}
+
+doCenterFloat :: ManageHook
+doCenterFloat =
+ ask >>= \w -> doF . W.float w . centerRect . snd =<< liftX (floatLocation w)
+
+centerRect :: W.RationalRect -> W.RationalRect
+centerRect (W.RationalRect x y w h) = W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h