From 0f3aa9e045d19a7950e50c943816bc143c82bcb2 Mon Sep 17 00:00:00 2001
From: afranco <afonso@francof.net>
Date: Wed, 22 Feb 2023 13:18:03 +0000
Subject: [PATCH] chore(SYNC): Synced a lot of small changes so I can pull on
 laptop

---
 .config/fish/config.fish          |   9 +-
 .config/kmonad/config.kbd         |  11 ++-
 .config/nvim/ftdetect/hypr.vim    |   4 +
 .config/nvim/ftplugin/hypr.vim    |   1 +
 .config/nvim/lua/plugins/lazy.lua |   4 +
 .config/nvim/syntax/hypr.vim      |  67 +++++++++++++++
 .config/xmonad/xmonad.hs          | 132 +++++++++++-------------------
 .xinitrc                          |   2 +
 8 files changed, 141 insertions(+), 89 deletions(-)
 create mode 100644 .config/nvim/ftdetect/hypr.vim
 create mode 100644 .config/nvim/ftplugin/hypr.vim
 create mode 100644 .config/nvim/syntax/hypr.vim

diff --git a/.config/fish/config.fish b/.config/fish/config.fish
index 6bd948f..1f018dd 100644
--- a/.config/fish/config.fish
+++ b/.config/fish/config.fish
@@ -20,6 +20,10 @@ function launch-term
 	docker exec -it core xterm -bg black -fg white -fa 'DejaVu Sans Mono' -fs 16 -e vcmd -c /tmp/pycore.1/$argv -- sh -c "cd /rust-cc && /bin/bash"
 end
 
+function cat
+    bat $argv
+end
+
 function core
     xhost +local:root
     sudo docker exec -it core core-gui
@@ -44,10 +48,13 @@ end
 set -gx EDITOR vim
 set -gx TERM 'xterm-256color'
 
+fish_add_path $HOME/.nix-profile/bin
 fish_add_path /var/lib/snapd/snap/bin
 fish_add_path $HOME/.local/share/nvim/mason/bin
-set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin /home/afonso/.ghcup/bin $PATH # ghcup-env
+#set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin /home/afonso/.ghcup/bin $PATH # ghcup-env
 fish_add_path /home/afonso/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin
 fish_add_path $HOME/.local/bin 
 fish_add_path $HOME/.cargo/bin 
 
+
+set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin /home/afonso/.ghcup/bin $PATH # ghcup-env
diff --git a/.config/kmonad/config.kbd b/.config/kmonad/config.kbd
index 0a0b87d..8e0e64a 100644
--- a/.config/kmonad/config.kbd
+++ b/.config/kmonad/config.kbd
@@ -18,8 +18,7 @@
 
 #| SET KEY TO LAYOUT |#
 
-(defalias esc (tap-hold 200 esc (layer-toggle numbers)))
-
+(defalias esc (tap-hold 200 esc (layer-toggle numrow)))
 
 #| LAYOUTS |#
 
@@ -32,11 +31,11 @@
   lctl  lmet lalt           spc             ralt rmet cmp  rctl            left down rght
 )
 
-(deflayer numbers
+(deflayer numrow
   _    _    _    _    _    _    _    _    _    _    _    _    _          _    _    _
   _    _    _    _    _    _    _    _    _    _    _    _    _    _     _    _    _
-  _    _    _    _    _    _    _    7    8    9    _    _    _    _     _    _    _
-  _    _    _    _    _    _    _    4    5    6    _    _    _
-  _    _    _    _    _    _    _    1    2    3    _    _                    _
+  _    _    _    _    _    _    _    _    _    _    _    _    _    _     _    _    _
+  _    1    2    3    4    5    6    7    8    9    0    _    _
+  _    _    _    _    _    _    _    _    _    _    _    _                    _
   _    _    _              _              _    _    _    _               _    _    _
 )
diff --git a/.config/nvim/ftdetect/hypr.vim b/.config/nvim/ftdetect/hypr.vim
new file mode 100644
index 0000000..dfc90fb
--- /dev/null
+++ b/.config/nvim/ftdetect/hypr.vim
@@ -0,0 +1,4 @@
+augroup hypr_ftdetect
+  au!
+  au BufRead,BufNewFile *hypr/*.conf,*hypr/*/*.conf set ft=hypr
+augroup END
diff --git a/.config/nvim/ftplugin/hypr.vim b/.config/nvim/ftplugin/hypr.vim
new file mode 100644
index 0000000..463eea9
--- /dev/null
+++ b/.config/nvim/ftplugin/hypr.vim
@@ -0,0 +1 @@
+setlocal commentstring=#\ %s
diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua
index 741df44..c976444 100644
--- a/.config/nvim/lua/plugins/lazy.lua
+++ b/.config/nvim/lua/plugins/lazy.lua
@@ -145,5 +145,9 @@ lazy.setup({
         end,
     },
 
+    -------------------------------------------SYNTAX----------------------------------------------
+    'kmonad/kmonad-vim',
+    'elkowar/yuck.vim'
+
 
 })
diff --git a/.config/nvim/syntax/hypr.vim b/.config/nvim/syntax/hypr.vim
new file mode 100644
index 0000000..2bc8e05
--- /dev/null
+++ b/.config/nvim/syntax/hypr.vim
@@ -0,0 +1,67 @@
+
+" Vim syntax file
+" Language: Hyprland config file
+" Maintainer: Gabriel Carneiro
+" Latest Revision: 26 October 2022
+
+if exists("b:current_syntax")
+  finish
+endif
+
+" Strings
+syn match	Path "\(\.\|\~\)\/.*" display
+syn match	Symbol "=" skipwhite display nextgroup=Value
+syn match	Str "[a-zA-Z _ .-\"\'?]\+$" contained display
+syn match	Num "\d\+\(\.\d\+\)\?" contained display
+syn match	Num "e[+-]\d\+" contained display
+syn match	Num "[+-]\d\+\(\.\d\+\)\?" contained display
+syn match	ShellVar "\$\w\+" contained display
+syn keyword	Logical on off true false no yes contained display
+syn region  HyprSimpleString keepend start='[^ \t]' end='$\|#' contained contains=HyprVar,HyprComment
+syn match   HyprQuotedString '"[^"]\+"' contained
+syn cluster HyprString contains=HyprSimpleString,HyprQuotedString
+
+" Settings
+syn keyword Block input general animations decoration gestures misc dwindle master
+syn region OptBlock start="{" end="}" fold transparent display contains=HyprVar,Value,OptBlock,Num,Str,HyprComment,Disp,ShellVar
+syn match HyprVar '\s[a-z _ .]\+ ' skipwhite contained display nextgroup=Symbol
+syn region Value start="=" end="$\|," transparent display contains=Str,Num,Logical,ShellVar,Path,HyprComment,Disp,Dispatchers
+syn match Disp '[a-zA-Z][a-zA-Z0-9 _.]\+,' contained display contains=Num
+syn match N ', [a-zA-Z][a-zA-Z0-9 _.]\+,' contained skipwhite
+
+" Commands
+syn region Command start='^[a-zA-Z][a-zA-Z_. -]\+ =' end='$' skipwhite transparent contains=HyprKeyModifier,ShellVar,HyprConfigCommand,Dispatchers,HyprComment,Str,Disp,Path,Num
+syn keyword HyprKeyModifier SUPER SHIFT CTRL ALT Mod1 Mod2 Mod3 Mod4 Mod5 Mode_switch nextgroup=N
+syn keyword HyprConfigCommand bind bindm monitor source windowrule nextgroup=Symbol contained
+
+" Comments
+syn keyword HyprTodo contained TODO FIXME XXX NOTE
+syn match   HyprComment "\(#\|\/\/\).*$" contains=HyprTodo
+
+
+highlight link Dispatchers		        Special
+highlight link Windowrules		        Special
+highlight link Disp				        Special
+
+highlight link Num						Constant
+highlight link NumRule					Constant
+
+highlight link HyprVar                  Identifier
+highlight link HyprConfigCommand        Identifier
+
+highlight link HyprKeyModifier          Constant
+highlight link KeyBind					Constant
+highlight link Logical					Constant
+
+highlight link Str						String
+highlight link BindCmd					String
+highlight link Path						String
+highlight link HyprSimpleString         String
+highlight link HyprQuotedString         String
+
+highlight link Block					Define
+
+highlight link ShellVar			        Define
+
+highlight link HyprTodo                 Todo
+highlight link HyprComment              Comment
diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs
index 4ced5b3..8ed53ff 100644
--- a/.config/xmonad/xmonad.hs
+++ b/.config/xmonad/xmonad.hs
@@ -1,42 +1,47 @@
 {-# OPTIONS_GHC -Wno-deprecations #-}
 
 import XMonad
+
+--Utils
 import XMonad.Util.EZConfig (additionalKeysP,removeKeysP)
-import XMonad.Hooks.DynamicLog
 import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL)
-import XMonad.Hooks.SetWMName
-import XMonad.Actions.SpawnOn
-import XMonad.Actions.UpdateFocus (focusUnderPointer)
-import XMonad.Hooks.StatusBar
-import XMonad.Layout.NoBorders
-import qualified XMonad.StackSet as W
-import XMonad.Hooks.EwmhDesktops
 import XMonad.Util.Run
-import Data.Maybe (fromJust)
+import XMonad.Util.SpawnOnce
+import XMonad.Util.NamedScratchpad as NS
+
+--Hooks
+import XMonad.Hooks.DynamicLog
+import XMonad.Hooks.SetWMName
+import XMonad.Hooks.StatusBar
+import XMonad.Hooks.EwmhDesktops
 import XMonad.Hooks.ManageDocks
 import XMonad.Hooks.ManageHelpers
-import Data.Monoid
-import Colors.Teal
-import System.Exit
-import XMonad.Util.SpawnOnce
-import XMonad.Layout.Spacing
 import XMonad.Hooks.WindowSwallowing
+
+--Actions
+import XMonad.Actions.SpawnOn
+import XMonad.Actions.UpdateFocus (focusUnderPointer)
+
+--Layouts
+import XMonad.Layout.NoBorders
+import XMonad.Layout.Spacing
+
+--Miscellaneous
 import qualified XMonad.StackSet as W
 import qualified Data.Map        as M
+import System.Exit
+
+--Color Scheme
+import Colors.Teal
 
 myTerminal      = "alacritty" 
 myTextEditor    = "nvim"
 myWebBrowser    = "firefox"
+myModMask       = mod4Mask
 
 myFocusFollowsMouse :: Bool
 myFocusFollowsMouse = True
 
-myFocusUnderPointer action = do
-                            c <- focusUnderPointer
-                            a <- action
-                            b <- focusUnderPointer
-                            return ()
-
 myClickJustFocuses :: Bool
 myClickJustFocuses = False
 
@@ -49,24 +54,36 @@ myFocusedBorderColor = "#01F9C6"
 myBorderWidth   = 2
 
 myWorkspaces    = ["main","web","text","code","social","mail"]
+myWorkspaceIndices = zip myWorkspaces [1..]
 
-myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..]
+myScratchPads :: [NamedScratchpad]
+myScratchPads = [NS "terminal" spawnTerm findTerm manageTerm]
+    where
+        spawnTerm  = myTerminal ++ " -t scratchpad"
+        findTerm   = title =? "scratchpad"
+        manageTerm = customFloating $ W.RationalRect l t w h
+            where
+                h = 0.6
+                w = 0.6
+                t = 0.7 -h
+                l = 0.8 -w
 
-myModMask       = mod4Mask
 
 myKeys :: [(String, X ())]
 myKeys =
-    [ ("M-x" ,myFocusUnderPointer  (spawn myTerminal) )
+    [ ("M-x" ,spawn myTerminal )
+    , ("M-S-x", namedScratchpadAction myScratchPads "terminal")
     , ("M-p", spawn "rofi -show drun")
+    , ("M-S-p", spawn "eww open --toggle powermenu")
     , ("M-s", spawn "selected=$(ls ~/scripts/|rofi -dmenu -p \"Run: \") && bash ~/.config/rofi/scripts/$selected")
     , ("M-b", spawn myWebBrowser)
-   , ("<Print>", spawn "flameshot gui")
+    , ("<Print>", spawn "flameshot gui")
     , ("<XF86AudioMute>", spawn "pamixer set --toggle-mute")
     , ("<XF86AudioLowerVolume>", spawn "pamixer -d 5")
     , ("<XF86AudioRaiseVolume>", spawn "pamixer -i 5")
-    ,("<XF86MonBrightnessUp>", spawn "lux -a 10%")
-    ,("<XF86MonBrightnessDown>", spawn "lux -s 10%")
-    ,("M-n", spawn $ myTerminal ++  " -e nmtui")
+    , ("<XF86MonBrightnessUp>", spawn "lux -a 10%")
+    , ("<XF86MonBrightnessDown>", spawn "lux -s 10%")
+    , ("M-n", spawn $ myTerminal ++  " -e nmtui")
     , ("M-q",  kill)
     , ("M-S-<Space>", sendMessage NextLayout)
     , ("M-<Down>", windows W.focusDown)
@@ -81,7 +98,7 @@ myKeys =
     ]
     ++
     [("M-" ++ m ++ (show k), windows $ f i)
-        | (i, k) <- zip myWorkspaces [1..]
+        | (i, k) <- myWorkspaceIndices
         , (f, m) <- [(W.greedyView, "0"), (W.shift, "S-")]]
     ++
     [("M-" ++ m ++ key, screenWorkspace sc >>= flip whenJust (windows . f))
@@ -89,6 +106,7 @@ myKeys =
         , (f, m) <- [(W.view, "0"), (W.shift, "S-")]]
 
 myRemoveKeys = ["M-S-<Return>","M-S-p","M-S-c","M-<Space>","M-n","M-S-q"]
+
 myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
     [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
                                       >> windows W.shiftMaster))
@@ -118,6 +136,7 @@ myManageHook = composeAll
   , className =? "Xmessage" --> doFloat
   , title     =? "Steam - News" --> doFloat
   , title     =? "Friends List" --> doFloat
+  , title     =? "scratchpad"   --> doFloat
   , isFullscreen -->  doFullFloat]
 
 myEventHook = ewmhDesktopsEventHook
@@ -183,59 +202,8 @@ myConfig =  def
       layoutHook         = smartBorders . spacingWithEdge 10 $ myLayout,
       manageHook         = manageSpawn <+> myManageHook <+> manageHook def,
       handleEventHook    = myEventHook <+> fullscreenEventHook <+> swallowEventHook (className=?"Alacritty") (return True) ,
-      startupHook        = myStartupHook}
+      startupHook        = myStartupHook
+      }
 
 main :: IO ()
-main = do
-       xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
-
-help :: String
-help = unlines ["The default modifier key is 'alt'. Default keybindings:",
-    "",
-    "-- launching and killing programs",
-    "mod-Shift-Enter  Launch xterminal",
-    "mod-p            Launch dmenu",
-    "mod-Shift-p      Launch gmrun",
-    "mod-Shift-c      Close/kill the focused window",
-    "mod-Space        Rotate through the available layout algorithms",
-    "mod-Shift-Space  Reset the layouts on the current workSpace to default",
-    "mod-n            Resize/refresh viewed windows to the correct size",
-    "",
-    "-- move focus up or down the window stack",
-    "mod-Tab        Move focus to the next window",
-    "mod-Shift-Tab  Move focus to the previous window",
-    "mod-j          Move focus to the next window",
-    "mod-k          Move focus to the previous window",
-    "mod-m          Move focus to the master window",
-    "",
-    "-- modifying the window order",
-    "mod-Return   Swap the focused window and the master window",
-    "mod-Shift-j  Swap the focused window with the next window",
-    "mod-Shift-k  Swap the focused window with the previous window",
-    "",
-    "-- resizing the master/slave ratio",
-    "mod-h  Shrink the master area",
-    "mod-l  Expand the master area",
-    "",
-    "-- floating layer support",
-    "mod-t  Push window back into tiling; unfloat and re-tile it",
-    "",
-    "-- increase or decrease number of windows in the master area",
-    "mod-comma  (mod-,)   Increment the number of windows in the master area",
-    "mod-period (mod-.)   Deincrement the number of windows in the master area",
-    "",
-    "-- quit, or restart",
-    "mod-Shift-q  Quit xmonad",
-    "mod-q        Restart xmonad",
-    "mod-[1..9]   Switch to workSpace N",
-    "",
-    "-- Workspaces & screens",
-    "mod-Shift-[1..9]   Move client to workspace N",
-    "mod-{w,e,r}        Switch to physical/Xinerama screens 1, 2, or 3",
-    "mod-Shift-{w,e,r}  Move client to screen 1, 2, or 3",
-    "",
-    "-- Mouse bindings: default actions bound to mouse events",
-    "mod-button1  Set the window to floating mode and move by dragging",
-    "mod-button2  Raise the window to the top of the stack",
-    "mod-button3  Set the window to floating mode and resize by dragging"]
-
+main = xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
diff --git a/.xinitrc b/.xinitrc
index bcdb852..93af8e4 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+export XDG_SESSION_TYPE=x11
+export XDG_CURRENT_DESKTOP=X-Generic
 userresources=$HOME/.Xresources
 usermodmap=$HOME/.Xmodmap
 sysresources=/etc/X11/xinit/.Xresources