From 564c398714539b924db4e2217a753fd429960603 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 22 Feb 2023 13:18:03 +0000 Subject: [PATCH] [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/lazy-lock.json | 3 +- .config/nvim/lua/plugins/lazy.lua | 4 + .config/nvim/syntax/hypr.vim | 67 +++++++++++++++ .config/xmonad/xmonad.hs | 132 +++++++++++------------------- .xinitrc | 2 + 9 files changed, 143 insertions(+), 90 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/lazy-lock.json b/.config/nvim/lazy-lock.json index 69db2d8..e9c708f 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -12,6 +12,7 @@ "fidget.nvim": { "branch": "main", "commit": "44585a0c0085765195e6961c15529ba6c5a2a13b" }, "friendly-snippets": { "branch": "main", "commit": "046e4d3491baf664e0eef5231d28beb49333578b" }, "impatient.nvim": { "branch": "main", "commit": "c90e273f7b8c50a02f956c24ce4804a47f18162e" }, + "kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" }, "lazy.nvim": { "branch": "main", "commit": "15fe46a728b7473d4cae368838bbc1c79c3a3f48" }, "leap.nvim": { "branch": "main", "commit": "ff4c3663e5a0a0ecbb3fffbc8318825def35d2aa" }, "lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" }, @@ -26,11 +27,11 @@ "nvim-treesitter-context": { "branch": "master", "commit": "cacee4828152dd3a83736169ae61bbcd29a3d213" }, "nvim-web-devicons": { "branch": "master", "commit": "3548363849878ef895ce54edda02421279b419d8" }, "onedark.vim": { "branch": "main", "commit": "b6b5ffe31a195a3077338d7a506b905e4a51590f" }, - "orgmode": { "branch": "master", "commit": "dadf56334d2be7d9e8ad1e22c697a6e75f0164b7" }, "plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" }, "startup.nvim": { "branch": "master", "commit": "b060480d2e647534faf70fa1263fe7623b77b0ce" }, "telescope.nvim": { "branch": "master", "commit": "b79cd6c88b3d96b0f49cb7d240807cd59b610cd8" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vimtex": { "branch": "master", "commit": "c77ec4e15768ffcb97a96d1bf2df1ef58e94acdd" }, + "yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }, "zen-mode.nvim": { "branch": "main", "commit": "2c8f9f3758a4c430ff867e547741424ac16208bb" } } \ No newline at end of file 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) - , ("", spawn "flameshot gui") + , ("", spawn "flameshot gui") , ("", spawn "pamixer set --toggle-mute") , ("", spawn "pamixer -d 5") , ("", spawn "pamixer -i 5") - ,("", spawn "lux -a 10%") - ,("", spawn "lux -s 10%") - ,("M-n", spawn $ myTerminal ++ " -e nmtui") + , ("", spawn "lux -a 10%") + , ("", spawn "lux -s 10%") + , ("M-n", spawn $ myTerminal ++ " -e nmtui") , ("M-q", kill) , ("M-S-", sendMessage NextLayout) , ("M-", 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-","M-S-p","M-S-c","M-","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