ENH generalize (most) dmenu commands
This commit is contained in:
parent
adfbb92136
commit
394eca3ad2
|
@ -798,14 +798,14 @@ externalBindings :: (XIO () -> IO ()) -> X () -> DBusState -> [KeyGroup FeatureX
|
|||
externalBindings runIO cleanup db =
|
||||
[ KeyGroup
|
||||
"Launchers"
|
||||
[ KeyBinding "<XF86Search>" "select/launch app" $ Left runAppMenu
|
||||
, KeyBinding "M-g" "launch clipboard manager" $ Left runClipMenu
|
||||
, KeyBinding "M-a" "launch network selector" $ Left $ runNetMenu sys
|
||||
, KeyBinding "M-w" "launch window selector" $ Left runWinMenu
|
||||
, KeyBinding "M-u" "launch device selector" $ Left runDevMenu
|
||||
, KeyBinding "M-b" "launch bitwarden selector" $ Left $ runBwMenu ses
|
||||
, KeyBinding "M-v" "launch ExpressVPN selector" $ Left runVPNMenu
|
||||
, KeyBinding "M-e" "launch bluetooth selector" $ Left runBTMenu
|
||||
[ KeyBinding "<XF86Search>" "select/launch app" $ Left $ toX runAppMenu
|
||||
, KeyBinding "M-g" "launch clipboard manager" $ Left $ toX runClipMenu
|
||||
, KeyBinding "M-a" "launch network selector" $ Left $ toX $ runNetMenu sys
|
||||
, KeyBinding "M-w" "launch window selector" $ Left $ toX runWinMenu
|
||||
, KeyBinding "M-u" "launch device selector" $ Left $ toX runDevMenu
|
||||
, KeyBinding "M-b" "launch bitwarden selector" $ Left $ toX $ runBwMenu ses
|
||||
, KeyBinding "M-v" "launch ExpressVPN selector" $ Left $ toX runVPNMenu
|
||||
, KeyBinding "M-e" "launch bluetooth selector" $ Left $ toX runBTMenu
|
||||
, KeyBinding "M-C-e" "launch editor" $ Left $ toX runEditor
|
||||
, KeyBinding "M-C-w" "launch browser" $ Left $ toX runBrowser
|
||||
, KeyBinding "M-C-t" "launch terminal with tmux" $ Left $ toX runTMux
|
||||
|
@ -816,7 +816,7 @@ externalBindings runIO cleanup db =
|
|||
, KeyGroup
|
||||
"Actions"
|
||||
[ KeyBinding "M-q" "close window" $ ftrAlways "kill window function" kill1
|
||||
, KeyBinding "M-r" "run program" $ Left runCmdMenu
|
||||
, KeyBinding "M-r" "run program" $ Left $ toX runCmdMenu
|
||||
, KeyBinding "M-<Space>" "warp pointer" $ ftrAlways "warp function" $ warpToWindow 0.5 0.5
|
||||
, KeyBinding "M-C-s" "capture area" $ Left $ toX $ runAreaCapture ses
|
||||
, KeyBinding "M-C-S-s" "capture screen" $ Left $ toX $ runScreenCapture ses
|
||||
|
@ -857,7 +857,7 @@ externalBindings runIO cleanup db =
|
|||
, -- M-<F1> reserved for showing the keymap
|
||||
KeyBinding "M-<F2>" "restart xmonad" restartf
|
||||
, KeyBinding "M-<F3>" "recompile xmonad" recompilef
|
||||
, KeyBinding "M-<F8>" "select autorandr profile" $ Left runAutorandrMenu
|
||||
, KeyBinding "M-<F8>" "select autorandr profile" $ Left $ toX runAutorandrMenu
|
||||
, KeyBinding "M-<F9>" "toggle ethernet" $ Left $ toX runToggleEthernet
|
||||
, KeyBinding "M-<F10>" "toggle bluetooth" $ Left $ toX $ runToggleBluetooth sys
|
||||
, KeyBinding "M-<F11>" "toggle screensaver" $ Left $ toX $ callToggle ses
|
||||
|
|
|
@ -22,6 +22,7 @@ import DBus
|
|||
import Data.Internal.DBus
|
||||
import Data.Internal.XIO
|
||||
import Graphics.X11.Types
|
||||
import RIO hiding (hClose)
|
||||
import RIO.Directory
|
||||
( XdgDirectory (..)
|
||||
, getXdgDirectory
|
||||
|
@ -74,7 +75,7 @@ clipboardPkgs = [Package AUR "rofi-greenclip"]
|
|||
--------------------------------------------------------------------------------
|
||||
-- Other internal functions
|
||||
|
||||
spawnDmenuCmd :: T.Text -> [T.Text] -> SometimesX
|
||||
spawnDmenuCmd :: MonadUnliftIO m => T.Text -> [T.Text] -> Sometimes (m ())
|
||||
spawnDmenuCmd n =
|
||||
sometimesExeArgs n "rofi preset" dmenuPkgs True myDmenuCmd
|
||||
|
||||
|
@ -97,7 +98,7 @@ dmenuDep = sysExe dmenuPkgs myDmenuCmd
|
|||
-- Exported Commands
|
||||
|
||||
-- TODO test that veracrypt and friends are installed
|
||||
runDevMenu :: SometimesX
|
||||
runDevMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runDevMenu = sometimesIO_ "device manager" "rofi devices" t x
|
||||
where
|
||||
t = dmenuTree $ Only_ (localExe [] myDmenuDevices)
|
||||
|
@ -110,7 +111,7 @@ runDevMenu = sometimesIO_ "device manager" "rofi devices" t x
|
|||
++ myDmenuMatchingArgs
|
||||
|
||||
-- TODO test that bluetooth interface exists
|
||||
runBTMenu :: SometimesX
|
||||
runBTMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runBTMenu =
|
||||
Sometimes
|
||||
"bluetooth selector"
|
||||
|
@ -120,7 +121,7 @@ runBTMenu =
|
|||
cmd = spawnCmd myDmenuBluetooth $ "-c" : themeArgs "#0044bb"
|
||||
tree = dmenuTree $ Only_ $ sysExe [] myDmenuBluetooth
|
||||
|
||||
runVPNMenu :: SometimesX
|
||||
runVPNMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runVPNMenu =
|
||||
Sometimes
|
||||
"VPN selector"
|
||||
|
@ -136,16 +137,16 @@ runVPNMenu =
|
|||
socketExists "expressVPN" [] $
|
||||
return "/var/lib/expressvpn/expressvpnd.socket"
|
||||
|
||||
runCmdMenu :: SometimesX
|
||||
runCmdMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runCmdMenu = spawnDmenuCmd "command menu" ["-show", "run"]
|
||||
|
||||
runAppMenu :: SometimesX
|
||||
runAppMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runAppMenu = spawnDmenuCmd "app launcher" ["-show", "drun"]
|
||||
|
||||
runWinMenu :: SometimesX
|
||||
runWinMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runWinMenu = spawnDmenuCmd "window switcher" ["-show", "window"]
|
||||
|
||||
runNetMenu :: Maybe SysClient -> SometimesX
|
||||
runNetMenu :: MonadUnliftIO m => Maybe SysClient -> Sometimes (m ())
|
||||
runNetMenu cl =
|
||||
Sometimes
|
||||
"network control menu"
|
||||
|
@ -161,7 +162,7 @@ runNetMenu cl =
|
|||
DBusIO $
|
||||
sysExe [Package AUR "networkmanager-dmenu-git"] myDmenuNetworks
|
||||
|
||||
runAutorandrMenu :: SometimesX
|
||||
runAutorandrMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runAutorandrMenu = sometimesIO_ "autorandr menu" "rofi autorandr" tree cmd
|
||||
where
|
||||
cmd = spawnCmd myDmenuMonitors $ themeArgs "#ff0066"
|
||||
|
@ -170,7 +171,7 @@ runAutorandrMenu = sometimesIO_ "autorandr menu" "rofi autorandr" tree cmd
|
|||
--------------------------------------------------------------------------------
|
||||
-- Password manager
|
||||
|
||||
runBwMenu :: Maybe SesClient -> SometimesX
|
||||
runBwMenu :: MonadUnliftIO m => Maybe SesClient -> Sometimes (m ())
|
||||
runBwMenu cl = sometimesDBus cl "password manager" "rofi bitwarden" tree cmd
|
||||
where
|
||||
cmd _ =
|
||||
|
@ -183,7 +184,7 @@ runBwMenu cl = sometimesDBus cl "password manager" "rofi bitwarden" tree cmd
|
|||
--------------------------------------------------------------------------------
|
||||
-- Clipboard
|
||||
|
||||
runClipMenu :: SometimesX
|
||||
runClipMenu :: MonadUnliftIO m => Sometimes (m ())
|
||||
runClipMenu = sometimesIO_ "clipboard manager" "rofi greenclip" tree act
|
||||
where
|
||||
act = spawnCmd myDmenuCmd args
|
||||
|
|
Loading…
Reference in New Issue