From 39a11abbeb5ef18e827db75ff8a84bca74fd19ac Mon Sep 17 00:00:00 2001 From: Luddifee Date: Tue, 27 Jul 2021 16:07:29 +0200 Subject: [PATCH] general update --- .xmonad/xmonad-laptop.hs | 7 +- .xmonad/xmonad-pc.hs | 193 ++++++++++++++++----------------------- scripts/basic-setup | 2 +- scripts/setup-pc | 7 +- 4 files changed, 87 insertions(+), 122 deletions(-) diff --git a/.xmonad/xmonad-laptop.hs b/.xmonad/xmonad-laptop.hs index a64bd7a..2104143 100644 --- a/.xmonad/xmonad-laptop.hs +++ b/.xmonad/xmonad-laptop.hs @@ -38,10 +38,7 @@ myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] myBorderWidth = 5 myNormalBorderColor = "#dddddd" - -myFocusedBorderColor1 = "#ff8700" -myFocusedBorderColor2 = "#00ffa1" -myFocusedBorderColor = myFocusedBorderColor1 +myFocusedBorderColor = "#ff8700" -- screen spacing, then window spacing mySpacing x y = spacingRaw False (Border x x x x) True (Border y y y y) True @@ -58,7 +55,7 @@ myKeys = [ -- killing, exiting and suspending keybindings ("M-q" , kill), ("M-S-q" , io (exitWith ExitSuccess)), - ("M-S-b" , spawn "systemctl suspend"), + ("M-S-s" , spawn "systemctl suspend"), -- restarting and recompiling keybindings ("M-r" , spawn "xmonad --restart"), diff --git a/.xmonad/xmonad-pc.hs b/.xmonad/xmonad-pc.hs index 133bccb..81f589f 100644 --- a/.xmonad/xmonad-pc.hs +++ b/.xmonad/xmonad-pc.hs @@ -1,22 +1,28 @@ import qualified Data.Map as M import Data.Monoid import System.Exit + import XMonad + import XMonad.Util.Run import XMonad.Util.SpawnOnce +import XMonad.Util.EZConfig + import XMonad.Layout.Spacing import XMonad.Hooks.ManageDocks + import qualified XMonad.StackSet as W myTerminal :: String myTerminal = "kitty" myBrowser :: String -myBrowser = "brave" +myBrowser = "firefox" +myAltBrowser :: String +myAltBrowser = "brave" myAppMenu :: String myAppMenu = "rofi -show run" - myAppMenuThemes :: String myAppMenuThemes = "rofi-theme-selector" @@ -26,88 +32,53 @@ myFocusFollowsMouse = True myClickJustFocuses :: Bool myClickJustFocuses = False -myBorderWidth = 3 - myModMask = mod4Mask myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] +myBorderWidth = 5 myNormalBorderColor = "#dddddd" myFocusedBorderColor = "#ff8700" -myKeys conf@(XConfig {XMonad.modMask = modm}) = - M.fromList $ - -- launch a terminal - [ ((modm, xK_Return), spawn $ XMonad.terminal conf), - -- launch dmenu - ((modm, xK_p), spawn myAppMenu), - -- launch gmrun - ((modm .|. shiftMask, xK_p), spawn myAppMenuThemes), - -- close focused window - ((modm, xK_q), kill), - -- Rotate through the available layout algorithms - ((modm, xK_space), sendMessage NextLayout), - -- Reset the layouts on the current workspace to default - ((modm .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf), - -- Resize viewed windows to the correct size - ((modm, xK_n), refresh), - -- Move focus to the next window - ((modm, xK_Tab), windows W.focusDown), - -- Move focus to the next window - ((modm, xK_j), windows W.focusDown), - -- Move focus to the previous window - ((modm, xK_k), windows W.focusUp), - -- Move focus to the master window - ((modm, xK_m), windows W.focusMaster), - -- Swap the focused window and the master window - ((modm, xK_s), windows W.swapMaster), - -- Swap the focused window with the next window - ((modm .|. shiftMask, xK_j), windows W.swapDown), - -- Swap the focused window with the previous window - ((modm .|. shiftMask, xK_k), windows W.swapUp), - -- Shrink the master area - ((modm, xK_h), sendMessage Shrink), - -- Expand the master area - ((modm, xK_l), sendMessage Expand), - -- Push window back into tiling - ((modm, xK_t), withFocused $ windows . W.sink), - -- Increment the number of windows in the master area - ((modm, xK_comma), sendMessage (IncMasterN 1)), - -- Deincrement the number of windows in the master area - ((modm, xK_period), sendMessage (IncMasterN (-1))), - -- Toggle the status bar gap - -- Use this binding with avoidStruts from Hooks.ManageDocks. - -- See also the statusBar function from Hooks.DynamicLog. - -- - -- , ((modm , xK_b ), sendMessage ToggleStruts) +-- screen spacing, then window spacing +mySpacing x y = spacingRaw False (Border x x x x) True (Border y y y y) True - -- Launch Browser - ((modm, xK_i), spawn myBrowser), - ((modm .|. shiftMask, xK_s), spawn "systemctl suspend"), - -- Quit xmonad - ((modm .|. shiftMask, xK_q), io (exitWith ExitSuccess)), - -- Restart xmonad - ((modm .|. shiftMask, xK_o), spawn "xmonad --recompile; xmonad --restart") - ] - ++ - -- - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - -- - [ ((m .|. modm, k), windows $ f i) - | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9], - (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] - ] - ++ - -- - -- - -- 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 - -- - [ ((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_w, xK_e, xK_r] [0 ..], - (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] +myKeys :: [(String, X ())] +myKeys = [ + -- spawning keybindings + ("M-" , spawn myTerminal), + ("M-d" , spawn myAppMenu), + ("M-S-d" , spawn myAppMenuThemes), + ("M-i" , spawn myBrowser), + ("M-S-i" , spawn myAltBrowser), + + -- killing, exiting and suspending keybindings + ("M-q" , kill), + ("M-S-q" , io (exitWith ExitSuccess)), + ("M-S-s" , spawn "systemctl suspend"), + + -- restarting and recompiling keybindings + ("M-r" , spawn "xmonad --restart"), + ("M-S-r" , spawn "xmonad --recompile; xmonad --restart"), + + -- window keybindings + ("M-" , windows W.focusDown), + ("M-S-" , windows W.focusMaster), + + -- spacing keybindings + ("M4-S-" , incWindowSpacing 1), + ("M4-S-" , decWindowSpacing 1), + ("M1-S-" , incScreenSpacing 1), + ("M1-S-" , decScreenSpacing 1), + + -- multimedia keybindings + ("" , spawn "amixer set Master 2%+"), + ("" , spawn "amixer set Master 2%-"), + ("" , spawn "amixer set Master toggle"), + ("M-" , spawn clipBoardScreenshotCommand), + ("M-" , spawn clipBoardScreenshotCommand) ] + +clipBoardScreenshotCommand = "bash -c \"gnome-screenshot -af /tmp/screenshot && cat /tmp/screenshot | xclip -i -selection clipboard -target image/png\"" ------------------------------------------------------------------------ -- Mouse bindings: default actions bound to mouse events @@ -133,57 +104,51 @@ myMouseBindings (XConfig {XMonad.modMask = modm}) = -- you may also bind events to the mouse scroll wheel (button4 and button5) ] -myLayout = spacing 24 $ avoidStruts (tiled ||| Mirror tiled ||| Full) + + +myLayoutHook = avoidStruts (tiled ||| Mirror tiled ||| Full) where - tiled = Tall nmaster delta ratio + tiled = mySpacing 32 8 $ Tall nmaster delta ratio nmaster = 1 ratio = 1/2 delta = 3/100 -myManageHook = - composeAll - [ className =? "MPlayer" --> doFloat, - className =? "Gimp" --> doFloat, - resource =? "desktop_window" --> doIgnore, - resource =? "kdesktop" --> doIgnore - ] +myManageHook = composeAll [ + className =? "Gimp" --> doFloat, + resource =? "desktop_window" --> doIgnore ] myEventHook = mempty myLogHook = return () myStartupHook = do - spawnOnce "xrandr --output DP-0 --primary --left-of HDMI-0 --auto &" - spawnOnce "nitrogen --restore &" - spawnOnce "killall picom; picom --config ~/.config/picom/picom.conf --vsync &" - spawnOnce "killall jackd;" + spawnOnce "xsetroot -cursor_name left_ptr" + spawnOnce "xrandr --output DP-0 --primary --left-of HDMI-0 --auto" main = do - -- xmproc0 <- spawnPipe "" - xmproc0 <- spawnPipe "killall xmobar; xmobar ~/.config/xmobar/xmobar.config" - xmproc1 <- spawnPipe "jackd" + xmproc0 <- spawnPipe "nitrogen --restore" + xmproc1 <- spawnPipe "killall picom; picom &" + xmproc2 <- spawnPipe "killall xmobar; xmobar ~/.config/xmobar/xmobar.config" xmonad $ docks defaults - -defaults = - def - { -- simple stuff - terminal = myTerminal, - focusFollowsMouse = myFocusFollowsMouse, - clickJustFocuses = myClickJustFocuses, - borderWidth = myBorderWidth, - modMask = myModMask, - workspaces = myWorkspaces, - normalBorderColor = myNormalBorderColor, - focusedBorderColor = myFocusedBorderColor, - -- key bindings - keys = myKeys, - mouseBindings = myMouseBindings, - -- hooks, layouts - layoutHook = myLayout, - manageHook = myManageHook, - handleEventHook = myEventHook, - logHook = myLogHook, - startupHook = myStartupHook - } +defaults = def { + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + + -- bindings + mouseBindings = myMouseBindings, + + -- hooks + layoutHook = myLayoutHook, + manageHook = myManageHook, + handleEventHook = myEventHook, + logHook = myLogHook, + startupHook = myStartupHook + } `additionalKeysP` myKeys diff --git a/scripts/basic-setup b/scripts/basic-setup index 3aa2ecf..5733cd7 100755 --- a/scripts/basic-setup +++ b/scripts/basic-setup @@ -85,7 +85,7 @@ sudo rm -f /etc/systemd/system/display-manager.service sudo ln -s /usr/lib/systemd/system/gdm.service /etc/systemd/system/display-manager.service # setup picom -ipkg picom +ipkg_yay picom-jonaburg-git mkdir -p ~/.config/picom cp $FILEDIR/.config/picom/picom.conf ~/.config/picom/ diff --git a/scripts/setup-pc b/scripts/setup-pc index fd0348f..10415fc 100755 --- a/scripts/setup-pc +++ b/scripts/setup-pc @@ -8,6 +8,9 @@ mkdir -p ~/.config/xmobar cp $FILEDIR/.xmonad/xmonad-pc.hs ~/.xmonad/xmonad.hs cp $FILEDIR/.config/xmobar/xmobar-pc.config ~/.config/xmobar/xmobar.config -# setup nvidia driver -# ipkg nvidia +# download nvidia driver +mkdir -p ~/Downloads +cd ~/Downloads +wget https://de.download.nvidia.com/XFree86/Linux-x86_64/470.57.02/NVIDIA-Linux-x86_64-470.57.02.run + sudo reboot