Move shortcuts to sxhkdrc

This commit is contained in:
Oystein Kristoffer Tveit 2021-06-28 12:38:23 +02:00
parent 405e6e904d
commit ea0fabd21c
2 changed files with 116 additions and 27 deletions

View File

@ -0,0 +1,71 @@
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
# Applications
super + e
emacs
super + shift + e
$FILEBROWSER
super + s
$BROWSER
super + r
rofi -show drun
# Volume
super + {@F7,@F8}
amixer set Master 2%{-,+}
{XF86AudioLowerVolume,XF86AudioRaiseVolume}
amixer set Master 2%{-,+}
XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle
# Music
super + p
mpc toggle
XF86AudioPlay
mpc toggle
XF86AudioPrev
mpc prev
XF86AudioNext
mpc next
# Monitor
XF86MonBrightnessUp
light -A 5
XF86MonBrightnessDown
light -U 5
@Print
skushoclip
shift + @Print
skusho
super + @Print
boomer
# Misc
super + a
copyq toggle
super + {b,n,m}
fcitx-remote -s {mozc,fcitx-keyboard-no,fcitx-keyboard-us}
super + v
rofi -modi lpass:$HOME/.scripts/rofi/lpass//rofi-lpass -show lpass
super + -
xcalib -invert -alter

View File

@ -16,6 +16,8 @@ import XMonad.ManageHook
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import qualified Data.Map as M import qualified Data.Map as M
import qualified Data.List as L
import Data.Maybe
import XMonad.Util.Run (spawnPipe, hPutStrLn, runProcessWithInput) import XMonad.Util.Run (spawnPipe, hPutStrLn, runProcessWithInput)
import XMonad.Util.NamedScratchpad import XMonad.Util.NamedScratchpad
@ -57,7 +59,8 @@ cyan = "#a1efe4"
type TerminalCommand = String type TerminalCommand = String
myTerminal = "alacritty" myTerminal = "alacritty"
myBrowser = "qutebrowser" -- myBrowser = "qutebrowser"
myBrowser = "google-chrome-stable"
myFileBrowser = "thunar" myFileBrowser = "thunar"
emacsCommand :: TerminalCommand emacsCommand :: TerminalCommand
@ -93,9 +96,15 @@ myScratchpads = [ NS "ncmpcpp" spawnNC findNC layoutNC
t = 0.05 t = 0.05
l = 0.05 l = 0.05
spawnTM = myTerminal ++ " --class instanceClass,floatingTerminal -e tmux new-session -A -s floating" spawnTM = myTerminal ++ " --class instanceClass,floatingTerminal -e tmux new-session -A -s f"
findTM = className =? "floatingTerminal" findTM = className =? "floatingTerminal"
layoutTM = customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)
layoutTM = customFloating $ W.RationalRect l t w h
where
l = 0.025
t = 0.05
h = 0.9
w = 0.95
spawnSC = "sxiv ~/uni/schedule.png" spawnSC = "sxiv ~/uni/schedule.png"
findSC = className =? "sxiv" findSC = className =? "sxiv"
@ -151,47 +160,56 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- TODO: Clean up formatting -- TODO: Clean up formatting
[ [
((modm .|. shiftMask , xK_Return), spawn $ myTerminal ++ " -e tmux") ((modm .|. shiftMask , xK_Return), spawn $ myTerminal ++ " --class instanceClass,termTerminal -e tmux new-session -A -s term")
, ((modm , xK_BackSpace), kill) , ((modm , xK_BackSpace), kill)
, ((modm , xK_s), spawn myBrowser) , ((modm , xK_s), spawn myBrowser)
, ((modm , xK_f), sendMessage $ Toggle FULL) , ((modm , xK_f), sendMessage $ Toggle FULL)
, ((modm .|. shiftMask , xK_w), spawn "io.elementary.code -t") -- , ((modm .|. shiftMask , xK_w), spawn "io.elementary.code -t")
, ((modm , xK_a), spawn "copyq toggle") -- , ((modm , xK_a), spawn "copyq toggle")
, ((modm , xK_e), spawn emacsCommand) -- , ((modm , xK_e), spawn emacsCommand)
, ((modm .|. shiftMask , xK_e), spawn myFileBrowser) -- , ((modm .|. shiftMask , xK_e), spawn myFileBrowser)
, ((modm , xK_r), spawn "rofi -show drun") -- , ((modm , xK_r), spawn "rofi -show drun")
, ((modm , xK_p), spawn "mpc toggle") -- , ((modm , xK_p), spawn "mpc toggle")
, ((modm , xK_q), namedScratchpadAction myScratchpads "ncmpcpp") , ((modm , xK_q), namedScratchpadAction myScratchpads "ncmpcpp")
, ((modm , xK_minus), namedScratchpadAction myScratchpads "schedule") , ((modm , xK_minus), namedScratchpadAction myScratchpads "schedule")
, ((modm , xK_F7), spawn "amixer set Master 2%-") -- , ((modm , xK_F7), spawn "amixer set Master 2%-")
, ((modm , xK_F8), spawn "amixer set Master 2%+") -- , ((modm , xK_F8), spawn "amixer set Master 2%+")
-- , ((modm , xK_c), spawn myTerminal ++ " -e cfile") -- , ((modm , xK_c), spawn myTerminal ++ " -e cfile")
, ((modm , xK_n), spawn "fcitx-remote -s fcitx-keyboard-no") -- , ((modm , xK_n), spawn "fcitx-remote -s fcitx-keyboard-no")
, ((modm , xK_m), spawn "fcitx-remote -s fcitx-keyboard-us") -- , ((modm , xK_m), spawn "fcitx-remote -s fcitx-keyboard-us")
, ((modm , xK_b), spawn "fcitx-remote -s mozc") -- , ((modm , xK_b), spawn "fcitx-remote -s mozc")
, ((modm , xK_Return), namedScratchpadAction myScratchpads "terminal") , ((modm , xK_Return), namedScratchpadAction myScratchpads "terminal")
, ((modm , xK_space ), namedScratchpadAction myScratchpads "terminal") , ((modm , xK_space ), namedScratchpadAction myScratchpads "terminal")
, ((modm .|. shiftMask , xK_space ), spawn $ myTerminal ++ " -e tmux") , ((modm .|. shiftMask , xK_space ), spawn $ myTerminal ++ " -e tmux")
, ((0 , xK_Print ), spawn "skushoclip") -- , ((0 , xK_Print ), spawn "skushoclip")
, ((shiftMask , xK_Print ), spawn "skusho") -- , ((shiftMask , xK_Print ), spawn "skusho")
, ((modm , xK_Print ), spawn "$HOME/.scripts/git/boomer/boomer") -- , ((modm , xK_Print ), spawn "$HOME/.scripts/git/boomer/boomer")
, ((modm , xK_v ), spawn "rofi -modi lpass:$HOME/.scripts/rofi/lpass//rofi-lpass -show lpass") , ((modm , xK_v ), spawn "rofi -modi lpass:$HOME/.scripts/rofi/lpass//rofi-lpass -show lpass")
, ((0, xF86XK_AudioRaiseVolume ), spawn "amixer set Master 2%+") -- , ((0, xF86XK_AudioRaiseVolume ), spawn "amixer set Master 2%+")
, ((0, xF86XK_AudioLowerVolume ), spawn "amixer set Master 2%-") -- , ((0, xF86XK_AudioLowerVolume ), spawn "amixer set Master 2%-")
, ((0, xF86XK_AudioMute ), spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle") -- , ((0, xF86XK_AudioMute ), spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
, ((0, xF86XK_AudioPlay ), spawn "mpc toggle") -- , ((0, xF86XK_AudioPlay ), spawn "mpc toggle")
, ((0, xF86XK_AudioPrev ), spawn "mpc prev") -- , ((0, xF86XK_AudioPrev ), spawn "mpc prev")
, ((0, xF86XK_AudioNext ), spawn "mpc next") -- , ((0, xF86XK_AudioNext ), spawn "mpc next")
, ((0, xF86XK_MonBrightnessUp ), spawn "light -A 5") -- , ((0, xF86XK_MonBrightnessUp ), spawn "light -A 5")
, ((0, xF86XK_MonBrightnessDown ), spawn "light -U 5") -- , ((0, xF86XK_MonBrightnessDown ), spawn "light -U 5")
, ((modm .|. shiftMask, xK_slash ), namedScratchpadAction myScratchpads "help") , ((modm .|. shiftMask, xK_slash ), namedScratchpadAction myScratchpads "help")
, ((modm .|. shiftMask, xK_d ), viewDropboxStatus) , ((modm .|. shiftMask, xK_d ), viewDropboxStatus)
] ]
termIsOpen :: X Bool
termIsOpen = isOpen
where
output :: X String
output = liftIO $ runProcessWithInput "tmux" ["ls", "-F", "#{session_name}", "#{?session_attached,1,}"] ""
isOpen = ((\(Just x) -> (x!!5) == '1')
<$> (listToMaybe . filter (L.isInfixOf "term") . lines))
<$> output
viewDropboxStatus :: X () viewDropboxStatus :: X ()
viewDropboxStatus = spawn =<< ((++) "notify-send -t 3000 " . unpack) <$> status viewDropboxStatus = spawn =<< ((++) "notify-send -t 3000 " . unpack) <$> status
@ -346,7 +364,7 @@ myRestartHook = do
main :: IO () main :: IO ()
main = do main = do
xmproc <- spawnPipe "xmobar" xmproc <- spawnPipe "xmobar --recompile"
xmonad xmonad
$ fullscreenSupport $ fullscreenSupport
$ docks def { $ docks def {