From 1e364ec0f24e4a3033ad54fab8e911e56448b26d Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 10 Jan 2022 23:40:19 -0700 Subject: changes to rofi config --- extras/HOME/.config/rofi/config.rasi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extras/HOME/.config/rofi/config.rasi b/extras/HOME/.config/rofi/config.rasi index 1fec00f..440194b 100644 --- a/extras/HOME/.config/rofi/config.rasi +++ b/extras/HOME/.config/rofi/config.rasi @@ -4,6 +4,7 @@ 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; @@ -14,8 +15,10 @@ 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; } -- cgit From 663657bc5c691d0d08f9069e6918842af7735090 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 11 Jan 2022 19:45:24 -0700 Subject: Better Rofi integration --- extras/HOME/.config/rofi/config.rasi | 2 +- extras/HOME/.local/bin/bluetooth-select.sh | 6 +- extras/HOME/.local/bin/emoji-select.sh | 6 +- extras/HOME/.local/bin/emoticon-select.sh | 6 +- extras/HOME/.local/bin/rofi-pass | 6 +- extras/HOME/.local/bin/set-sink.sh | 6 +- extras/HOME/.local/bin/set-volume.sh | 95 ++++++++++++++++++++++++++++++ src/Internal/DMenu.hs | 14 ++++- src/Internal/Keys.hs | 10 ++++ src/Main.hs | 14 ++++- 10 files changed, 154 insertions(+), 11 deletions(-) create mode 100755 extras/HOME/.local/bin/set-volume.sh diff --git a/extras/HOME/.config/rofi/config.rasi b/extras/HOME/.config/rofi/config.rasi index 440194b..fe47aa6 100644 --- a/extras/HOME/.config/rofi/config.rasi +++ b/extras/HOME/.config/rofi/config.rasi @@ -8,7 +8,7 @@ alternate-normal-foreground: @theme-color; main-background: #202020f0; - font: "Monofur Bold Nerd Font 34"; + font: "Monofur Nerd Font 24"; } window { 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/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/src/Internal/DMenu.hs b/src/Internal/DMenu.hs index f964544..b611d87 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"] + +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..51a1453 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -228,6 +228,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 +240,13 @@ keymap = runKeys $ do bind xK_a $ (justMod -|- noMod) $ spawn "set-sink.sh" + + bind xK_w $ + (justMod -|- noMod) $ spawn "networkmanager_dmenu" + + 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 -- cgit From a0cce47b957501e61c27eea247a48d6eccbd5559 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 11 Jan 2022 19:58:18 -0700 Subject: added more emoticons --- extras/HOME/.xmonad/emoticons.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extras/HOME/.xmonad/emoticons.txt b/extras/HOME/.xmonad/emoticons.txt index 40b83c5..51fdd2d 100644 --- a/extras/HOME/.xmonad/emoticons.txt +++ b/extras/HOME/.xmonad/emoticons.txt @@ -1,5 +1,7 @@ +Cry - ಥ_ಥ Deal with it - (•_•) ( •_•)>⌐■-■ (⌐■_■) Deal with it. - (▀̿Ĺ̯▀̿ ̿) +Disapprove - ಠ_ಠ Do It Right - (☞゚ヮ゚)☞ Do it Left - ☜(゚ヮ゚☜) Happy Gary - ᕕ( ᐛ )ᕗ @@ -8,9 +10,12 @@ IDFK - ¯\(°_o)/¯ Lenny - ( ͡° ͜ʖ ͡°) Mad Lenny - ( ͡° ʖ̯ ͡°) Person Flip - (╯°□°)╯︵ (\ .o.)\ +Raise Dongers - ヽ༼ຈل͜ຈ༽ノ Shrug - ¯\_(ツ)_/¯ Smiley - :-) +Surprised - (⚆_⚆) Tableback - ┬─┬ノ(ಠ_ಠノ) Tableflip - (╯°□°)╯︵ ┻━┻ -Unamused - ಠ_ಠ +Tears of Joy - ಥ‿ಥ +Unamused - ( ͡ಠ ʖ̯ ͡ಠ) Y u no - ლ(ಠ益ಠ)ლ -- cgit From e45c6c02ab92c3b4d4d8303ebfb11db513c29ece Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 11 Jan 2022 20:43:07 -0700 Subject: Fix so that shrinks the alt window, not expand it --- src/Internal/Keys.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs index 51a1453..3189ddb 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -171,7 +171,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 $ -- cgit From 66347d17f3f4afb6dfc9c6e43c7e8924634d64f8 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 11 Jan 2022 22:41:48 -0700 Subject: Add NERD font glyphs to unicode selector --- extras/HOME/.xmonad/unicode.gz | Bin 297505 -> 325355 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/HOME/.xmonad/unicode.gz b/extras/HOME/.xmonad/unicode.gz index 5dd0826..fa47bf1 100644 Binary files a/extras/HOME/.xmonad/unicode.gz and b/extras/HOME/.xmonad/unicode.gz differ -- cgit From cd5f031e28ecda974e2f0515892e1b48a2a34170 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 12 Jan 2022 11:00:33 -0700 Subject: added more emoticons --- extras/HOME/.xmonad/emoticons.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extras/HOME/.xmonad/emoticons.txt b/extras/HOME/.xmonad/emoticons.txt index 51fdd2d..65289c4 100644 --- a/extras/HOME/.xmonad/emoticons.txt +++ b/extras/HOME/.xmonad/emoticons.txt @@ -1,3 +1,4 @@ +Bear - (''')(0.0)(''') Cry - ಥ_ಥ Deal with it - (•_•) ( •_•)>⌐■-■ (⌐■_■) Deal with it. - (▀̿Ĺ̯▀̿ ̿) @@ -10,12 +11,18 @@ IDFK - ¯\(°_o)/¯ Lenny - ( ͡° ͜ʖ ͡°) Mad Lenny - ( ͡° ʖ̯ ͡°) Person Flip - (╯°□°)╯︵ (\ .o.)\ +Person Flip - (ノಠ益ಠ) ノ彡 (\ .o.)\ +Personback - (/ °o°)/ノ(ಠ_ಠノ) Raise Dongers - ヽ༼ຈل͜ຈ༽ノ Shrug - ¯\_(ツ)_/¯ Smiley - :-) Surprised - (⚆_⚆) Tableback - ┬─┬ノ(ಠ_ಠノ) -Tableflip - (╯°□°)╯︵ ┻━┻ +Tableflip - (╯°□°)╯︵ ┻━┻ +Tableflip - (ノಠ益ಠ) ノ彡 ┻━┻ +Tableflip Shrug - ┻━┻ ︵ ¯\_(ᴼل͜ᴼ)_/¯ ︵ ┻━┻ +Table Flipped Me - ┬─┬ ︵ /(.□. \) Tears of Joy - ಥ‿ಥ Unamused - ( ͡ಠ ʖ̯ ͡ಠ) Y u no - ლ(ಠ益ಠ)ლ +LOL F U - ( ° ͜ʖ͡°)╭∩╮ -- cgit From bda81bc101bff7caf76d9a27aa31fccd24dcec84 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 13 Jan 2022 13:53:45 -0700 Subject: Added library-view.sh and bound it to o --- extras/HOME/.local/bin/library-view.sh | 28 ++++++++++++++++++++++++++++ src/Internal/Keys.hs | 3 +++ 2 files changed, 31 insertions(+) create mode 100755 extras/HOME/.local/bin/library-view.sh 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/src/Internal/Keys.hs b/src/Internal/Keys.hs index 3189ddb..936b12a 100644 --- a/src/Internal/Keys.hs +++ b/src/Internal/Keys.hs @@ -244,6 +244,9 @@ keymap = runKeys $ do 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" -- cgit From 0bde08d5180d08ef102d3d5bff0f50f2e7533e4e Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 13 Jan 2022 13:55:48 -0700 Subject: Added ability to control volume with hhhh* and 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 -- cgit