diff options
-rw-r--r-- | .config/XMonad/xmonad.hs | 26 | ||||
-rwxr-xr-x | .scripts/open_terminal | 27 |
2 files changed, 40 insertions, 13 deletions
diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs index 8e81f7e..100bfa4 100644 --- a/.config/XMonad/xmonad.hs +++ b/.config/XMonad/xmonad.hs @@ -45,16 +45,16 @@ myColorPicker = "colorpicker --short --one-shot --preview | xsel -b" myFont = "xft:Hack:style=Regular:size=14" -- volume -myVolUp = "pamixer -i 2 && killall lemonblocks -5" -myVolDown = "pamixer -d 2 && killall lemonblocks -5" -myVolMute = "pamixer -m && killall lemonblocks -5" +myVolUp = "pamixer -i 2" +myVolDown = "pamixer -d 2" +myVolMute = "pamixer -m" myExtraWorkspaces = [(xK_0, "十")] -- , (xK_comma, " 十一 "), (xK_period, " 十二 "), (xK_slash, " 十三 ")] myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", "九"] ++ (map snd myExtraWorkspaces) myScratchpads = [ NS "Phone" "scrcpy" (title =? "Motorola One Power") defaultFloating, - NS "Terminal" "prime-run alacritty -t 'TerminalScratchpad'" (title =? "TerminalScratchpad") defaultFloating, + NS "Terminal" "alacritty -t 'TerminalScratchpad'" (title =? "TerminalScratchpad") defaultFloating, NS "Nitrogen" "nitrogen" (title =? "Nitrogen") defaultFloating ] where role = stringProperty "WM_WINDOW_ROLE" @@ -95,7 +95,7 @@ myTreeMenu a = TS.treeselectAction a [ Node (TS.TSNode "Scrcpy" "" (spawn "scrcpy")) [] , Node (TS.TSNode "Pcmanfm" "" (spawn "pcmanfm")) [] , Node (TS.TSNode "Thunderbird" "" (spawn "thunderbird")) [] - , Node (TS.TSNode "lf" "" (spawn "prime-run alacritty -e lf")) [] + , Node (TS.TSNode "lf" "" (spawn "alacritty -e lf")) [] , Node (TS.TSNode "colorpicker" "" (spawn "lxappearance")) [] , Node (TS.TSNode "networking" "" (return())) [ Node (TS.TSNode "Konqueror" "" (spawn "konqueror")) [] @@ -104,9 +104,9 @@ myTreeMenu a = TS.treeselectAction a ] ] , Node (TS.TSNode "Media" "" (return())) - [ Node (TS.TSNode "VLC" "" (spawn "prime-run vlc")) [] - , Node (TS.TSNode "GIMP" "" (spawn "prime-run gimp")) [] - , Node (TS.TSNode "Kdenlive" "" (spawn "prime-run kdenlive")) [] + [ Node (TS.TSNode "VLC" "" (spawn "vlc")) [] + , Node (TS.TSNode "GIMP" "" (spawn "gimp")) [] + , Node (TS.TSNode "Kdenlive" "" (spawn "kdenlive")) [] ] , Node (TS.TSNode "Utilities" "" (return())) [ Node (TS.TSNode "Nitrogen" "" (spawn "nitrogen")) [] @@ -140,15 +140,15 @@ main = do emptyBSP ||| tabbed shrinkText myTabTheme ||| emptyBSP ||| Grid) , manageHook = namedScratchpadManageHook myScratchpads <+> manageDocks , startupHook = do - spawnOnce "polybar mybar" setWMName "LG3D" + spawnOnce "polybar mybar" setDefaultCursor xC_left_ptr } `additionalMouseBindings` [ ((altMask, 2), \w -> kill1) , ((myModMask, 4), \w -> prevWS) , ((myModMask, 5), \w -> nextWS) ] `additionalKeys` ([ - ((myModMask, xK_Return), spawn ("prime-run alacritty")) + ((myModMask, xK_Return), spawn ("open_terminal")) , ((0, xK_Print), spawn (myScreenshot)) , ((myModMask .|. shiftMask, xK_Return), spawn (myScreenshot)) , ((myModMask, xK_q), spawn (myLockscreen)) @@ -163,11 +163,11 @@ main = do , ((myModMask, xK_y), spawn ("gimp")) , ((myModMask, xK_e), spawn ("thunderbird")) , ((myModMask, xK_b), spawn ("konqueror")) - , ((myModMask, xK_r), spawn ("prime-run alacritty -e lf")) + , ((myModMask, xK_r), spawn ("alacritty -e lf")) , ((myModMask .|. shiftMask, xK_o), runOrCopy "pcmanfm" (className =? "Pcmanfm")) - , ((myModMask, xK_m), runOrCopy "prime-run vlc" (className =? "vlc")) - , ((myModMask .|. shiftMask, xK_m), spawn ("prime-run vlc")) + , ((myModMask, xK_m), runOrCopy "vlc" (className =? "vlc")) + , ((myModMask .|. shiftMask, xK_m), spawn ("vlc")) -- scratchpad keybindings , ((myModMask, xK_u), namedScratchpadAction myScratchpads "Phone") diff --git a/.scripts/open_terminal b/.scripts/open_terminal new file mode 100755 index 0000000..62ac7cc --- /dev/null +++ b/.scripts/open_terminal @@ -0,0 +1,27 @@ +#!/bin/sh + +ACTIVE_WINDOW=$(xdotool getactivewindow) +ACTIVE_WM_CLASS=$(xprop -id $ACTIVE_WINDOW | grep WM_CLASS) +if [[ $ACTIVE_WM_CLASS == *"Alacritty"* ]] +then + # Get PID. If _NET_WM_PID isn't set, bail. + PID=$(xprop -id $ACTIVE_WINDOW | grep _NET_WM_PID | grep -oP "\d+") + if [[ "$PID" == "" ]] + then + alacritty + fi + # Get first child of terminal + CHILD_PID=$(pgrep -P $PID) + if [[ "$PID" == "" ]] + then + alacritty + fi + # Get current directory of child. The first child should be the shell. + pushd "/proc/${CHILD_PID}/cwd" + SHELL_CWD=$(pwd -P) + popd + # Start alacritty with the working directory + alacritty --working-directory $SHELL_CWD +else + alacritty +fi |