huge change in xmonad

- added copy window feature
- keybindings are set in the "myKeys" variable
- only one "qualified" instance of StackSet
- a variable that dictates my workspaces (needed in the myKeys definition)
main
hashirama 2024-07-13 02:28:18 +00:00
parent 3888160cb1
commit a6de086c3b
1 changed files with 48 additions and 29 deletions

View File

@ -6,7 +6,7 @@ import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.StackSet as W -- float purposes
import XMonad.Actions.MouseResize
@ -25,7 +25,7 @@ import XMonad.Util.SpawnOnce (spawnOnce)
-- run or raise
import XMonad.Actions.WindowGo (raiseMaybe, runOrRaise)
import XMonad.ManageHook (className)
import XMonad.StackSet (RationalRect(..))
--
import XMonad.Layout.Decoration
@ -36,7 +36,6 @@ import XMonad.Actions.PerWindowKeys
import XMonad.Actions.FindEmptyWorkspace
import XMonad.Layout.Grid
import XMonad.Layout.PerScreen (ifWider)
import XMonad.StackSet
import XMonad.Layout
import XMonad.Layout.Reflect
import XMonad.Layout.WindowArranger
@ -45,8 +44,10 @@ import XMonad.Layout.WindowArranger
import Data.List (find)
import XMonad.Actions.EasyMotion (selectWindow)
import XMonad.Actions.FocusNth (swapNth)
import qualified XMonad.StackSet as W
import XMonad.Layout.LimitWindows
import XMonad.Actions.CopyWindow
import qualified XMonad.StackSet as W
@ -57,12 +58,52 @@ main = xmonad
. withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig
workspacen :: [String]
workspacen = ["ws1", "ws2", "ws3", "ws4", "ws5", "ws6", "ws7", "ws8", "ws9", "ws10"]
myKeys =
[ (otherModMasks ++ "M-" ++ key, action tag)
| (tag, key) <- zip workspacen (words "1 2 3 4 5 6 7 8 9 0")
, (otherModMasks, action) <-
[ ("z-" , windows . W.greedyView)
, ("S-", windows . W.shift)
, ("C-", windows .copy)
]
] ++
[ ("M-d", spawn "rofi -show run")
, ("M-s", spawn "bash -c dictpopup")
, ("M-S-e", spawn "flameshot full --path=/mnt/Data/mpv-screenshots/screenshots/light_novels")
, ("M-e", runOrRaise "goldendict" (className =? "GoldenDict-ng"))
, ("M-p", runOrRaise "librewolf" (className =? "librewolf-default"))
, ("M-S-g", spawn "~/.local/bin/mpv-tube.sh")
, ("M-S-c", spawn "emacsclient --eval '(emacs-everywhere)'")
, ("M-S-p", runOrRaise "nyxt" (className =? "Nyxt"))
, ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window
, ("M-`", runOrRaise "emacs" (className =? "Emacs"))
, ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm.
, ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q
, ("M-m", spawn "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1 --idle")
, ("M-S-r", spawn "~/.local/bin/run_anki.sh")
, ("M-S-d", spawn "~/.local/bin/recent_journal.py | popup")
, ("M-r", runOrRaise "~/.local/bin/run_anki.sh" (className =? "Anki"))
, ("M-g", runOrRaise "foliate" (className =? "com.github.johnfactotum.Foliate"))
, ("M-S-f", sendToEmptyWorkspace) -- View an empty workspace
, ("M-f", viewEmptyWorkspace) -- View an empty workspace
, ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots")
, ("M-w", spawn "~/.local/bin/copy_image.sh")
, ("M-v", easySwap)
]
myConfig = def
{ modMask = mod4Mask -- Rebind Mod to the Super key
, layoutHook = windowArrange myLayout -- Use custom layouts
, terminal = "kitty"
, focusedBorderColor = "#000000"
, workspaces = workspacen
, manageHook = myManageHook -- Match on certain windows
, startupHook = do
-- other startup commands
@ -75,31 +116,9 @@ myConfig = def
spawnOnce "fcitx5 -d -r"
spawnOnce "emacs --daemon"
}
`additionalKeysP`
[ ("M-d", spawn "rofi -show run")
, ("M-s", spawn "bash -c dictpopup")
, ("M-S-e", spawn "flameshot full --path=/mnt/Data/mpv-screenshots/screenshots/light_novels")
, ("M-e", runOrRaise "goldendict" (className =? "GoldenDict-ng"))
, ("M-p", runOrRaise "librewolf" (className =? "librewolf-default"))
, ("M-S-g", spawn "~/.local/bin/mpv-tube.sh")
, ("M-S-c", spawn "emacsclient --eval '(emacs-everywhere)'")
, ("M-S-p", runOrRaise "nyxt" (className =? "Nyxt"))
, ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window
, ("M-`", runOrRaise "emacs" (className =? "Emacs"))
, ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm.
, ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q
, ("M-m", spawn "mpv --audio-pitch-correction=yes --vf=setpts=PTS/1 --idle")
, ("M-S-r", spawn "~/.local/bin/run_anki.sh")
, ("M-S-d", spawn "~/.local/bin/recent_journal.py | popup")
, ("M-r", runOrRaise "~/.local/bin/run_anki.sh" (className =? "Anki"))
, ("M-g", runOrRaise "foliate" (className =? "com.github.johnfactotum.Foliate"))
, ("M-S-f", sendToEmptyWorkspace) -- View an empty workspace
, ("M-f", viewEmptyWorkspace) -- View an empty workspace
, ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots")
, ("M-w", spawn "~/.local/bin/copy_image.sh")
, ("M-v", easySwap)
]
`additionalKeysP` myKeys
easySwap :: X ()
easySwap = do