From 6e9091e26593a145e6350a01bad53f26acea75a1 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 8 Apr 2021 16:41:50 +0530 Subject: pushing all the dotfiles again --- .config/XMonad/xmonad.hs | 426 ++++++++++++++++++++++++++++ .config/dunst/dunstrc | 471 +++++++++++++++++++++++++++++++ .config/lemonblocks/config.txt | 5 + .config/lemonblocks/modules/cpu_load.sh | 10 + .config/lemonblocks/modules/cpu_temp.sh | 5 + .config/lemonblocks/modules/date.sh | 3 + .config/lemonblocks/modules/mem_usage.sh | 4 + .config/lemonblocks/modules/volume.sh | 9 + .config/lemonblocks/start.sh | 41 +++ .config/lf/draw_img | 67 +++++ .config/lf/image | 17 ++ .config/lf/lfrc | 178 ++++++++++++ .config/lf/preview | 48 ++++ .config/lf/pv | 9 + .config/nvim/init.vim | 85 ++++++ .config/picom.conf | 429 ++++++++++++++++++++++++++++ .config/startpage/background.jpg | Bin 0 -> 522763 bytes .config/startpage/index.html | 67 +++++ .config/startpage/server.go | 22 ++ .config/zsh/.zshrc | 75 +++++ 20 files changed, 1971 insertions(+) create mode 100644 .config/XMonad/xmonad.hs create mode 100644 .config/dunst/dunstrc create mode 100644 .config/lemonblocks/config.txt create mode 100755 .config/lemonblocks/modules/cpu_load.sh create mode 100755 .config/lemonblocks/modules/cpu_temp.sh create mode 100755 .config/lemonblocks/modules/date.sh create mode 100755 .config/lemonblocks/modules/mem_usage.sh create mode 100755 .config/lemonblocks/modules/volume.sh create mode 100755 .config/lemonblocks/start.sh create mode 100755 .config/lf/draw_img create mode 100755 .config/lf/image create mode 100755 .config/lf/lfrc create mode 100755 .config/lf/preview create mode 100644 .config/lf/pv create mode 100644 .config/nvim/init.vim create mode 100644 .config/picom.conf create mode 100644 .config/startpage/background.jpg create mode 100644 .config/startpage/index.html create mode 100644 .config/startpage/server.go create mode 100644 .config/zsh/.zshrc (limited to '.config') diff --git a/.config/XMonad/xmonad.hs b/.config/XMonad/xmonad.hs new file mode 100644 index 0000000..110997d --- /dev/null +++ b/.config/XMonad/xmonad.hs @@ -0,0 +1,426 @@ +import XMonad +import qualified XMonad.StackSet as W +import XMonad.ManageHook + +-- xmonad-log imports +-- import qualified DBus as D +-- import qualified DBus.Client as D +-- import qualified Codec.Binary.UTF8.String as UTF8 + +-- data +import Data.Tree +import qualified Data.Map as M + +-- actions +import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen) +import XMonad.Actions.CopyWindow +import XMonad.Actions.CycleWS +import XMonad.Actions.GridSelect +import XMonad.Actions.SwapWorkspaces +import XMonad.Actions.WindowBringer +import XMonad.Actions.MouseResize +import XMonad.Actions.SpawnOn +import qualified XMonad.Actions.TreeSelect as TS + +-- layouts modifiers +import XMonad.Layout.Spacing +import XMonad.Layout.LayoutModifier +import XMonad.Layout.WindowNavigation as WN +import XMonad.Layout.Renamed as R (renamed, Rename(Replace)) +import XMonad.Layout.Maximize +-- import XMonad.Layout.PerWorkspace + +-- Layouts +import XMonad.Layout.BinarySpacePartition as BSP +import XMonad.Layout.Grid +import XMonad.Layout.ThreeColumns +import XMonad.Layout.TwoPane +import XMonad.Layout.ResizableTile +import XMonad.Layout.Tabbed -- fix this it doesnt work +import XMonad.Layout.NoBorders +import XMonad.Layout.Accordion +import XMonad.Layout.ZoomRow + + +-- hooks +import XMonad.Hooks.SetWMName +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.EwmhDesktops + +-- utilities +import XMonad.Util.SpawnOnce +import XMonad.Util.EZConfig +import XMonad.Util.Cursor +import XMonad.Util.Paste +import XMonad.Util.Run +import XMonad.Util.NamedScratchpad + + +myStartupHook :: X () +myStartupHook = do + spawnOnce "start-lemonbar.sh" + spawnOn " 二 " "firefox" + setWMName "AnimeThighsWM" + -- setWMName "LG3D" + setDefaultCursor xC_left_ptr + +-- defaults +-- myModMask :: KeyMask +myModMask = mod4Mask + +altMask :: KeyMask +altMask = mod1Mask + +myTerminal :: String +myTerminal = "st" + +myLauncher :: String +myLauncher = "run_dmenu" + +myBrowser :: String +myBrowser = "brave" + +myFileManager :: String +myFileManager = "pcmanfm" + +myEmailClient :: String +myEmailClient = "thunderbird" + +myEditor :: String +myEditor = "nvim" + +myLockscreen :: String +myLockscreen = "betterlockscreen -l -t 'Yo, Vidhu!'" + +myScreenshot :: String +myScreenshot = "scrot /zt/Screenshots/Screenshot-%Y-%d-%m--%T.png" + +myColorPicker :: String +myColorPicker = "colorpicker --short --one-shot --preview | xsel -b" + +-- volume +myVolUp :: String +myVolUp = "pulseaudio-ctl up && killall lemonblocks -5" + +myVolDown :: String +myVolDown = "pulseaudio-ctl down && killall lemonblocks -5" + +myVolMute :: String +myVolMute = "pulseaudio-ctl mute && killall lemonblocks -5" + + +myFont :: String +myFont = "xft:Hack:style=Regular:size=12" + + +-- wm variables + +-- fBorder = "#bf00ff" +-- fBorder = "#3804f4" +fBorder = "#00ff85" +nBorder = "#130F23" + +myBorderWidth = 1 + +sGap = 1 -- screen gap +wGap = 2 -- window gap + +myExtraWorkspaces = [(xK_0, " 十 ")] -- , (xK_comma, " 十一 "), (xK_period, " 十二 "), (xK_slash, " 十三 ")] +myWorkspaces = [" 一 "," 二 "," 三 "," 四 "," 五 "," 六 "," 七 "," 八 ", " 九 "] ++ (map snd myExtraWorkspaces) + +-- treeselect config +defaultNavigation = M.fromList + [ ((0, xK_Escape), TS.cancel) + , ((0, xK_Return), TS.select) + , ((0, xK_space), TS.select) + , ((0, xK_Up), TS.movePrev) + , ((0, xK_Down), TS.moveNext) + , ((0, xK_Left), TS.moveParent) + , ((0, xK_Right), TS.moveChild) + , ((0, xK_k), TS.movePrev) + , ((0, xK_j), TS.moveNext) + , ((0, xK_h), TS.moveParent) + , ((0, xK_l), TS.moveChild) + , ((0, xK_o), TS.moveHistBack) + , ((0, xK_i), TS.moveHistForward) + ] + +myTSConfig = TS.TSConfig { TS.ts_hidechildren = False + , TS.ts_background = 0xdd282c34 + , TS.ts_font = myFont + , TS.ts_node = (0xffd0d0d0, 0xff1c1f24) + , TS.ts_nodealt = (0xffd0d0d0, 0xff282c34) + , TS.ts_highlight = (0xffffffff, 0xff755999) + , TS.ts_extra = 0xffd0d0d0 + , TS.ts_node_width = 200 + , TS.ts_node_height = 28 + , TS.ts_originX = 100 + , TS.ts_originY = 100 + , TS.ts_indent = 80 + , TS.ts_navigate = TS.defaultNavigation + } + +myTreeMenu :: TS.TSConfig (X ()) -> X () +myTreeMenu a = TS.treeselectAction a + [ Node (TS.TSNode "Section Screenshot" "Take screenshot of a section on the screen" (spawn "scrot -s /zt/Screenshots/Screenshot-%Y-%d-%m--%T.png")) [] + , Node (TS.TSNode "Utilities" "" (return())) + [ Node (TS.TSNode "Pavucontrol" "" (spawn "pavucontrol")) [] + , Node (TS.TSNode "Color Picker" "" (spawn myColorPicker)) [] + , Node (TS.TSNode "bashtop" "" (spawn "st -e bashtop")) [] + , Node (TS.TSNode "htop" "" (spawn "st -e htop")) [] + , Node (TS.TSNode "lxappearance" "" (spawn "st -e lxappearance")) [] + ] + , Node (TS.TSNode "Apps" "" (return())) + [ Node (TS.TSNode "Torrents" "" (spawn "qbittorrent")) [] + , Node (TS.TSNode "Discord" "" (spawn "discord-canary")) [] + , Node (TS.TSNode "LibreOffice" "" (spawn "libreoffice")) [] + , Node (TS.TSNode "Browsers" "" (return())) + [ Node (TS.TSNode "Vivaldi" "" (spawn "vivaldi-stable")) [] + , Node (TS.TSNode "Firefox" "" (spawn "firefox")) [] + , Node (TS.TSNode "Brave" "" (spawn "brave")) [] + ] + ] + , Node (TS.TSNode "Other" "" (return())) + [ Node (TS.TSNode "Recompile XMonad" "Recompile and restart the window manager" (spawn "xmonad --recompile && xmonad --restart")) [] + , Node (TS.TSNode "Launch DMenu" "just in case the keybinding doesn't work" (spawn "run_dmenu")) [] + , Node (TS.TSNode "Restart server" "Restart startpage server" (spawn "killall startpage-server;startpage-server")) [] + , Node (TS.TSNode "notify" "send a notification" (spawn "notify-send 'This is a notification' 'Hello World!'")) [] + ] + , Node (TS.TSNode "Power" "" (return())) + [ Node (TS.TSNode "Shutdown" "It's not like I'll miss you b- baka!" (spawn "shutdown now")) [] + , Node (TS.TSNode "Reboot" "What are you doing!" (spawn "reboot")) [] + , Node (TS.TSNode "Cancel" "Yamete kudasai" (return())) [] + ] + ] + + + +-- scratchpad config +myScratchpads = [ + NS "Phone" "scrcpy" (title =? "Motorola One Power") defaultFloating, + NS "Terminal" "st -t 'TerminalScratchpad'" (title =? "TerminalScratchpad") defaultFloating, + NS "Nitrogen" "nitrogen" (title =? "Nitrogen") defaultFloating + ] where role = stringProperty "WM_WINDOW_ROLE" + + +-- keybindings +myKeys = [ + ((myModMask, xK_Return), spawn (myTerminal)) + , ((myModMask .|. shiftMask, xK_Return), spawn (myScreenshot)) + , ((myModMask, xK_q), spawn (myLockscreen)) + , ((myModMask, xK_n), spawn ("dunstctl close-all")) + + , ((altMask, xK_w), kill1) + , ((myModMask, xK_a), withFocused $ windows . W.sink) -- unfloat windows + + -- launch apps/execute scripts + , ((myModMask, xK_o), spawn (myFileManager)) + , ((myModMask, xK_y), spawn ("gimp")) + , ((myModMask, xK_e), spawn (myEmailClient)) + , ((myModMask, xK_b), spawn ("konqueror")) + , ((myModMask, xK_r), spawn (myTerminal ++ " -e lf")) + + -- launch/copy apps + , ((myModMask .|. shiftMask, xK_o), runOrCopy "pcmanfm" (className =? "Pcmanfm")) + , ((myModMask, xK_m), runOrCopy "vlc" (className =? "vlc")) + , ((myModMask .|. shiftMask, xK_m), spawnOn " 十 " "vlc") + + -- volume + , ((altMask, xK_0), spawn (myVolMute)) + , ((altMask, xK_minus), spawn (myVolDown)) + , ((altMask, xK_equal), spawn (myVolUp)) + + -- scratchpad keybindings + , ((myModMask, xK_u), namedScratchpadAction myScratchpads "Phone") + , ((myModMask, xK_t), namedScratchpadAction myScratchpads "Terminal") + , ((myModMask, xK_w), namedScratchpadAction myScratchpads "Nitrogen") + + -- view prev/next workspaces + , ((altMask, xK_h), prevWS) + , ((altMask, xK_l), nextWS) + + -- move to prev/next workspaces + , ((altMask .|. shiftMask, xK_h), shiftToPrev >> prevWS) + , ((altMask .|. shiftMask, xK_l), shiftToNext >> nextWS) + + -- modify gaps on runtime + , ((myModMask, xK_equal), incWindowSpacing 1) + , ((myModMask, xK_minus), decWindowSpacing 1) + , ((myModMask .|. shiftMask, xK_equal), incScreenSpacing 1) + , ((myModMask .|. shiftMask, xK_minus), decScreenSpacing 1) + + -- Swap the focused window and the master window + , ((mod1Mask .|. shiftMask, xK_Return), windows W.swapMaster) + + -- these keybindings are for WindowNavigation + -- and they conflict with BSP layout + -- directional navigation of windows + , ((myModMask, xK_l), sendMessage $ Go R) + , ((myModMask, xK_h), sendMessage $ Go L) + , ((myModMask, xK_k), sendMessage $ Go U) + , ((myModMask, xK_j), sendMessage $ Go D) + + -- swap windows + , ((myModMask .|. shiftMask, xK_l), sendMessage $ WN.Swap R) + , ((myModMask .|. shiftMask, xK_h), sendMessage $ WN.Swap L) + , ((myModMask .|. shiftMask, xK_k), sendMessage $ WN.Swap U) + , ((myModMask .|. shiftMask, xK_j), sendMessage $ WN.Swap D) + + -- cycle through windows + , ((altMask, xK_j), windows W.focusDown) + , ((altMask, xK_k), windows W.focusUp) + + -- kinda bad horizontal resizing of windows in non-bsp layouts + , ((myModMask, xK_Right), sendMessage Expand) + , ((myModMask, xK_Left), sendMessage Shrink) + + -- paste x selection + , ((altMask, xK_v), pasteSelection) + + -- toggle bars + , ((myModMask, xK_backslash), sendMessage ToggleStruts) -- toggle both bars + + -- BSP layout keybindings + -- resize + , ((myModMask .|. mod1Mask, xK_l ), sendMessage $ ExpandTowards R) + , ((myModMask .|. mod1Mask, xK_h ), sendMessage $ ExpandTowards L) + , ((myModMask .|. mod1Mask, xK_j ), sendMessage $ ExpandTowards D) + , ((myModMask .|. mod1Mask, xK_k ), sendMessage $ ExpandTowards U) + , ((myModMask .|. mod1Mask .|. shiftMask , xK_l ), sendMessage $ ShrinkFrom R) + , ((myModMask .|. mod1Mask .|. shiftMask , xK_h ), sendMessage $ ShrinkFrom L) + , ((myModMask .|. mod1Mask .|. shiftMask , xK_j ), sendMessage $ ShrinkFrom D) + , ((myModMask .|. mod1Mask .|. shiftMask , xK_k ), sendMessage $ ShrinkFrom U) + -- other + , ((myModMask, xK_d ), sendMessage Rotate) + , ((myModMask, xK_s ), sendMessage BSP.Swap) + , ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) + ] ++ [ -- for extra workspace(s) + ((myModMask, key), (windows $ W.greedyView ws)) + | (key,ws) <- myExtraWorkspaces + ] ++ [ -- also for extra workspaces + ((myModMask .|. shiftMask, key), (windows $ W.shift ws)) + | (key,ws) <- myExtraWorkspaces + ] ++ [ -- to swap workspaces + ((mod1Mask .|. shiftMask, k), windows $ swapWithCurrent i) + | (i, k) <- zip myWorkspaces [xK_1 ..] + ] ++ [ -- copy + ((m .|. myModMask, k), windows $ f i) + | (i, k) <- zip (myWorkspaces) [xK_1 ..] + , (f, m) <- [(copy, shiftMask .|. altMask)] + ] ++ [ -- sticky-ing windows + ((myModMask, xK_v), windows copyToAll) -- make window visible on all screens + , ((myModMask .|. shiftMask, xK_v), killAllOtherCopies) + ] +-- Emacs style keybindings +myKeys' :: [(String, X ())] +myKeys' = + [-- Running or copying browsers + ("M-i f", runOrCopy "firefox" (className =? "Firefox")) + , ("M-i S-f", spawn "firefox --private-window") + , ("M-i b", spawn "brave") + , ("M-i S-b", spawn "brave --incognito") + -- this doesn't work when in myKeys + , ("M-c", spawn myColorPicker) + -- Launchers + , ("M-p", myTreeMenu myTSConfig) + , ("M-S-p", spawn myLauncher) + -- GridSelect + , ("M-g g", goToSelected defaultGSConfig) + , ("M-g b", bringSelected defaultGSConfig) + ] +-- mouse keybindings +-- 1, 2, 3 = left, middle, right +myMouseBindings = [((altMask, 2), \w -> kill1) + -- , ((altMask, 1), \w -> spawn "pcmanfm") + -- , ((altMask, 3), \w -> spawn "konqueror") + , ((altMask, 2), \w -> spawn myVolMute) + , ((altMask, 4), \w -> spawn myVolDown) + , ((altMask, 5), \w -> spawn myVolUp) + , ((myModMask, 4), \w -> prevWS) + , ((myModMask, 5), \w -> nextWS) + ] + +-- tabs config +myTabTheme = def { fontName = myFont + , activeColor = "#755999" + , inactiveColor = "#282c35" + , activeBorderColor = "#755999" + , inactiveBorderColor = "#313846" + , activeTextColor = "#FFFFFF" + , inactiveTextColor = "#d0d0d0" + , decoHeight = 20 + } + +-- layouts +myGap = spacingRaw True (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True + + +-- myLayoutHook = onWorkspaces [" 二 "," 九 "," 十 "] altLayouts $ onWorkspaces [" 一 "," 三 "," 四 "," 五 "," 六 "," 七 "," 八 "] defLayouts +-- myLayoutHook = onWorkspace " 二 " renamed [R.Replace "Tabbed"] (avoidstruts $ smartBorders $ windowNavigation $ myGap $ tabbed shrinkText myTabTheme) ||| defLayouts + +myLayoutHook = avoidStruts ( -- layouts to be used in almost every workspace + renamed [R.Replace "BSP"] (maximize $ smartBorders $ windowNavigation $ myGap $ emptyBSP) + ||| renamed [R.Replace "Tabbed"] (maximize $ smartBorders $ windowNavigation $ myGap $ tabbed shrinkText myTabTheme) + ||| renamed [R.Replace "Accordion"] (maximize $ smartBorders $ windowNavigation $ myGap $ Accordion) + ||| renamed [R.Replace "ZoomRow"] (maximize $ smartBorders $ windowNavigation $ myGap $ zoomRow) + ||| renamed [R.Replace "TwoPane"] (maximize $ smartBorders $ windowNavigation $ myGap $ TwoPane (3/100) (1/2)) + ||| renamed [R.Replace "ZoomRow Mirrored"] (maximize $ smartBorders $ windowNavigation $ myGap $ Mirror zoomRow) + ||| renamed [R.Replace "ThreeCol Mid (1)"] (maximize $ smartBorders $ windowNavigation $ myGap $ ThreeColMid 1 (3/100) (1/2)) + ||| renamed [R.Replace "ThreeCol Mid (2)"] (maximize $ smartBorders $ windowNavigation $ myGap $ ThreeColMid 2 (3/100) (1/2)) + ||| renamed [R.Replace "Grid"] (maximize $ smartBorders $ windowNavigation $ myGap $ Grid) + ||| renamed [R.Replace "ThreeCol (1)"] (maximize $ smartBorders $ windowNavigation $ myGap $ ThreeCol 1 (3/100) (1/2)) + ||| renamed [R.Replace "Tabbed"] (maximize $ smartBorders $ windowNavigation $ myGap $ tabbed shrinkText myTabTheme) + ||| renamed [R.Replace "ThreeCol (2)"] (maximize $ smartBorders $ windowNavigation $ myGap $ ThreeCol 2 (3/100) (1/2)) + -- ||| onWorkspace " 二 " renamed [R.Replace "Tabbed"] (smartBorders $ windowNavigation $ myGap $ tabbed shrinkText myTabTheme) + ) + +-- myLemonbarPP :: D.Client -> PP +-- myLemonbarPP dbus = def { ppOutput = dbusOutput dbus +myLemonbarPP = def { + ppCurrent = wrap "%{B#d33682}%{F-}" "%{B-}" + , ppWsSep = "" + , ppHidden = wrap "%{F#02fc45}%{B#130F23}" "%{B-}%{f-}" + , ppHiddenNoWindows = wrap "%{F#268bd2}" "%{F-}" + , ppTitle = wrap " %{B#130F23}%{F#6c71c4} " " %{F-}%{B-}" . shorten 60 + , ppUrgent = wrap "%{B#9cfc02} " " %{B-}%{F-}" + , ppLayout = wrap "%{B#130F23}%{F#cb31d6} " " %{F-}%{B-}" + , ppSep = " " + , ppOrder = \(ws:l:t:ex) -> [ws]++[l]++[t]++ex + } + +-- dbusOutput :: D.Client -> String -> IO () +-- dbusOutput dbus str = do +-- let signal = (D.signal objectPath interfaceName memberName) { +-- D.signalBody = [D.toVariant $ UTF8.decodeString str] +-- } +-- D.emit dbus signal +-- where +-- objectPath = D.objectPath_ "/org/xmonad/Log" +-- interfaceName = D.interfaceName_ "org.xmonad.Log" +-- memberName = D.memberName_ "Update" + +main :: IO () +main = do + notXMobar <- spawnPipe "lemonbar -p -b -g 800x21+0+0 -B '#171520' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'" + -- dbus <- D.connectSession + -- Request access to the DBus name + -- D.requestName dbus (D.busName_ "org.xmonad.Log") + -- [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue] + xmonad $ docks def + { + terminal = myTerminal, + focusFollowsMouse = True, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = nBorder, + focusedBorderColor = fBorder, + layoutHook = myLayoutHook, + manageHook = manageSpawn <+> namedScratchpadManageHook myScratchpads, + handleEventHook = handleEventHook def <+> fullscreenEventHook, + + -- logHook = dynamicLogWithPP (myLemonbarPP dbus), + logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x}, + startupHook = myStartupHook +} `additionalMouseBindings` myMouseBindings `additionalKeys` myKeys `additionalKeysP` myKeys' diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc new file mode 100644 index 0000000..f9c88b6 --- /dev/null +++ b/.config/dunst/dunstrc @@ -0,0 +1,471 @@ +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = keyboard + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectively. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "300x5+30+20" + + # Turn on the progess bar + progress_bar = true + + # Set the progress bar height. This includes the frame, so make sure + # it's at least twice as big as the frame width. + progress_bar_heiht = 10 ## is this a typo? + + # Set the frame width of the progress bar + progress_bar_frame_width = 1 + + # Set the minimum width for the progress bar + progress_bar_min_width = 150 + + # Set the maximum width for the progress bar + progress_bar_max_width = 300 + + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = no + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing window manager is + # present (e.g. xcompmgr, compiz, etc.). + transparency = 0 + + # The height of the entire notification. If the height is smaller + # than the font height and padding combined, it will be raised + # to the font height and padding. + notification_height = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 1 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Padding between text and icon. + text_icon_padding = 0 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 1 + + # Defines color of the frame around the notification window. + frame_color = "#FFFFFF" + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort messages by urgency. + sort = yes + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # A client can set the 'transient' hint to bypass this. See the rules + # section for how to disable this if necessary + idle_threshold = 120 + + ### Text ### + + font = Hack:style=Regular 10 + + # The spacing between lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 15 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # When word_wrap is set to no, specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = true + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + ### Icons ### + + # Align icons left/right/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. Helpful + # for e.g. small files or high-dpi screens. In case of conflict, + # max_icon_size takes precedence over this. + min_icon_size = 0 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 32 + + # Paths to default icons. + icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/firefox -new-tab + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = true + + # Manage dunst's desire for talking + # Can be one of the following values: + # crit: Critical features. Dunst aborts + # warn: Only non-fatal warnings + # mesg: Important Messages + # info: all unimportant stuff + # debug: all less than unimportant stuff + verbosity = mesg + + # Define the corner radius of the notification window + # in pixel size. If the radius is 0, you have no rounded + # corners. + # The radius will be automatically lowered if it exceeds half of the + # notification height to avoid clipping text and/or icons. + corner_radius = 0 + + # Ignore the dbus closeNotification message. + # Useful to enforce the timeout set by dunst configuration. Without this + # parameter, an application may close the notification sent before the + # user defined timeout. + ignore_dbusclose = false + + ### Wayland ### + # These settings are Wayland-specific. They have no effect when using X11 + + # Uncomment this if you want to let notications appear under fullscreen + # applications (default: overlay) + # layer = top + + # Set this to true to use X11 output on Wayland. + force_xwayland = false + + ### Legacy + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + + ### mouse + + # Defines list of actions for each mouse event + # Possible values are: + # * none: Don't do anything. + # * do_action: If the notification has exactly one action, or one is marked as default, + # invoke it. If there are multiple and no default, open the context menu. + # * close_current: Close current notification. + # * close_all: Close all notifications. + # These values can be strung together for each mouse event, and + # will be executed in sequence. + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + +# The internal keyboard shortcut support in dunst is now considered deprecated +# and should be replaced by dunstctl calls. You can use the configuration of your +# WM or DE to bind these to shortcuts of your choice. +# Check the dunstctl manual page for more info. +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. Equivalent dunstctl command: + # dunstctl close + # close = mod4+n + + # Close all notifications. Equivalent dunstctl command: + # dunstctl close-all + # close_all = mod4+shift+n + close_all = mod4+n + + # Redisplay last message(s). Equivalent dunstctl command: + # dunstctl history-pop + # history = ctrl+grave + + # Context menu. Equivalent dunstctl command: + # dunstctl context + # context = ctrl+shift+period + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + # background = "#FF0032" + # foreground = "#FFFFFF" + background = "#232627" + foreground = "#5B76B7" + timeout = 8 + frame_color = "#FFFFFF" + # Icon for notifications with low urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_normal] + background = "#232627" + foreground = "#5B76B7" + timeout = 8 + frame_color = "#FFFFFF" + # Icon for notifications with normal urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_critical] + background = "#232627" + foreground = "#5B76B7" + timeout = 0 + frame_color = "#FFFFFF" + # Icon for notifications with critical urgency, uncomment to enable + #icon = /path/to/icon + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# +# Messages can be matched by +# appname (discouraged, see desktop_entry) +# body +# category +# desktop_entry +# icon +# match_transient +# msg_urgency +# stack_tag +# summary +# +# and you can override the +# background +# foreground +# format +# frame_color +# fullscreen +# new_icon +# set_stack_tag +# set_transient +# timeout +# urgency +# +# Shell-like globbing will get expanded. +# +# Instead of the appname filter, it's recommended to use the desktop_entry filter. +# GLib based applications export their desktop-entry name. In comparison to the appname, +# the desktop-entry won't get localized. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +# Disable the transient hint so that idle_threshold cannot be bypassed from the +# client +#[transient_disable] +# match_transient = yes +# set_transient = no +# +# Make the handling of transient notifications more strict by making them not +# be placed in history. +#[transient_history_ignore] +# match_transient = yes +# history_ignore = yes + +# fullscreen values +# show: show the notifications, regardless if there is a fullscreen window opened +# delay: displays the new notification, if there is no fullscreen window active +# If the notification is already drawn, it won't get undrawn. +# pushback: same as delay, but when switching into fullscreen, the notification will get +# withdrawn from screen again and will get delayed like a new notification +#[fullscreen_delay_everything] +# fullscreen = delay +#[fullscreen_show_critical] +# msg_urgency = critical +# fullscreen = show + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[skip-display] +# # This notification will not be displayed, but will be included in the history +# summary = "foobar" +# skip_display = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[stack-volumes] +# appname = "some_volume_notifiers" +# set_stack_tag = "volume" +# +# vim: ft=cfgg diff --git a/.config/lemonblocks/config.txt b/.config/lemonblocks/config.txt new file mode 100644 index 0000000..62991c3 --- /dev/null +++ b/.config/lemonblocks/config.txt @@ -0,0 +1,5 @@ +0,5,NULL,/usr/bin/lbscripts/volume.sh,r,NULL,130F23,fe6c69,pamixer -t; killall lemonblocks -5,NULL,pavucontrol && killall lemonblocks -5,pamixer -i 5; killall lemonblocks -5,pamixer -d 5; killall lemonblocks -5, , +5,4,NULL,/usr/bin/lbscripts/cpu_temp.sh,r,NULL,130F23,1045cc,NULL,NULL,NULL,NULL,NULL, , +5,3,NULL,/usr/bin/lbscripts/cpu_load.sh,r,NULL,130F23,7410cc,st -e htop,NULL,NULL,NULL,NULL, , +5,2,NULL,/usr/bin/lbscripts/mem_usage.sh,r,NULL,130F23,10cc8e,NULL,NULL,NULL,NULL,NULL, , +30,1,NULL,/usr/bin/lbscripts/date.sh,r,NULL,130F23,6C71C4,NULL,NULL,NULL,NULL,NULL, , diff --git a/.config/lemonblocks/modules/cpu_load.sh b/.config/lemonblocks/modules/cpu_load.sh new file mode 100755 index 0000000..1a677a9 --- /dev/null +++ b/.config/lemonblocks/modules/cpu_load.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +read cpu a b c previdle rest < /proc/stat +prevtotal=$((a+b+c+previdle)) +sleep 0.5 +read cpu a b c idle rest < /proc/stat +total=$((a+b+c+idle)) +cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + +printf " CPU:%s%% " $cpu diff --git a/.config/lemonblocks/modules/cpu_temp.sh b/.config/lemonblocks/modules/cpu_temp.sh new file mode 100755 index 0000000..a5286ad --- /dev/null +++ b/.config/lemonblocks/modules/cpu_temp.sh @@ -0,0 +1,5 @@ +#!/bin/bash +CEL=$'\xc2\xb0C' +temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp ) +temp=`expr $temp / 1000` +printf " TEMP:$temp$CEL " diff --git a/.config/lemonblocks/modules/date.sh b/.config/lemonblocks/modules/date.sh new file mode 100755 index 0000000..dcd0681 --- /dev/null +++ b/.config/lemonblocks/modules/date.sh @@ -0,0 +1,3 @@ +#!/bin/bash +date=$(date +"%d %b(%A) %H:%M") +printf " $date " diff --git a/.config/lemonblocks/modules/mem_usage.sh b/.config/lemonblocks/modules/mem_usage.sh new file mode 100755 index 0000000..6b939eb --- /dev/null +++ b/.config/lemonblocks/modules/mem_usage.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}') +printf " MEM: %.0f%% " $mem diff --git a/.config/lemonblocks/modules/volume.sh b/.config/lemonblocks/modules/volume.sh new file mode 100755 index 0000000..a0843dd --- /dev/null +++ b/.config/lemonblocks/modules/volume.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +printf " VOL:$(pamixer --get-volume-human)% " +# if [ $volume_level == "muted" ]; then + # printf "%{F#ff0058}VOL: $(pamixer --get-volume)%{F-}" +# else + # printf "VOL: $volume_level" +# fi + diff --git a/.config/lemonblocks/start.sh b/.config/lemonblocks/start.sh new file mode 100755 index 0000000..0537b89 --- /dev/null +++ b/.config/lemonblocks/start.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +CLICKABLE_AREAS=8 +PANEL_WIDTH=566 +PANEL_HEIGHT=21 +PANEL_HORIZONTAL_OFFSET=800 +PANEL_VERTICAL_OFFSET=0 +PANEL_FONT="Source Han Sans JP:size=10" +PANEL_ICON_FONT="RobotoMono Nerd Font:style=Regular:size=15" +COLOR_DEFAULT_FG="#FFFFFF" +COLOR_DEFAULT_BG="#171520" +UNDERLINE_HEIGHT=3 +PANEL_WM_NAME="lemon" + +# Kill potential instances of lemonblocks +#killall "lemonbar" +killall "lemonblocks" + +# Make sure the named pipe already exists +mkfifo /tmp/lemonblockspipe + +# start xmonad status lemonbar +# Start lemonbar +cat "/tmp/lemonblockspipe" | lemonbar -b -a "$CLICKABLE_AREAS" \ + -g "$PANEL_WIDTH"x"$PANEL_HEIGHT"+"$PANEL_HORIZONTAL_OFFSET"+"$PANEL_VERTICAL_OFFSET" \ + -o -3 -f "$PANEL_FONT" -o 0 -f "$PANEL_ICON_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" \ + -u "$UNDERLINE_HEIGHT" -n "$PANEL_WM_NAME" | bash & + +sleep 0.5 + +# Make sure lemonbar is hidden below a fullscreen window +## Bspwm +# wid=$(xdo id -a "$PANEL_WM_NAME") +# xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid" + +if [ $# -eq 0 ] +then + lemonblocks +else + ./bin/lemonblocks +fi diff --git a/.config/lf/draw_img b/.config/lf/draw_img new file mode 100755 index 0000000..5a70d5e --- /dev/null +++ b/.config/lf/draw_img @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +clear_screen() { + printf '\e[%sH\e[9999C\e[1J%b\e[1;%sr' \ + "$((LINES-2))" "${TMUX:+\e[2J}" "$max_items" +} + +# Get a file's mime_type. +mime_type=$(file -bi "$1") + +# File isn't an image file, give warning. +if [[ $mime_type != image/* ]]; then + lf -remote "send $id echoerr 'Not an image'" + exit +fi + +w3m_paths=(/usr/{local/,}{lib,libexec,lib64,libexec64}/w3m/w3mi*) +read -r w3m _ < <(type -p w3mimgdisplay "${w3m_paths[@]}") +read -r LINES COLUMNS < <(stty size) + +# Get terminal window size in pixels and set it to WIDTH and HEIGHT. +export $(xdotool getactivewindow getwindowgeometry --shell) + +# Get the image size in pixels. +read -r img_width img_height < <("$w3m" <<< "5;${CACHE:-$1}") + +((img_width > WIDTH)) && { + ((img_height=img_height*WIDTH/img_width)) + ((img_width=WIDTH)) +} + +((img_height > HEIGHT)) && { + ((img_width=img_width*HEIGHT/img_height)) + ((img_height=HEIGHT)) +} + +# Variable needed for centering image. +HALF_HEIGHT=$(expr $HEIGHT / 2) +HALF_WIDTH=$(expr $WIDTH / 2) +HALF_IMG_HEIGHT=$(expr $img_height / 2) +HALF_IMG_WIDTH=$(expr $img_width / 2) +X_POS=$(expr $HALF_WIDTH - $HALF_IMG_WIDTH) +Y_POS=$(expr $HALF_HEIGHT - $HALF_IMG_HEIGHT) + +clear_screen +# Hide the cursor. +printf '\e[?25l' + +# Display the image. +printf '0;1;%s;%s;%s;%s;;;;;%s\n3;\n4\n' \ + ${X_POS:-0} \ + ${Y_POS:-0} \ + "$img_width" \ + "$img_height" \ + "${CACHE:-$1}" | "$w3m" &>/dev/null + +# Wait for user input. +read -ern 1 + +# Clear the image. +printf '6;%s;%s;%s;%s\n3;' \ + "${X_POS:-0}" \ + "${Y_POS:-0}" \ + "$WIDTH" \ + "$HEIGHT" | "$w3m" &>/dev/null + +clear_screen diff --git a/.config/lf/image b/.config/lf/image new file mode 100755 index 0000000..db64bf2 --- /dev/null +++ b/.config/lf/image @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +readonly ID_PREVIEW="preview" +main() { + case "$1" in + "clear") + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ + > "$FIFO_UEBERZUG" + ;; + "draw") + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" \ + [x]="$3" [y]="$4" [max_width]="$5" [max_height]="$6" \ + [path]="$2") > "$FIFO_UEBERZUG" + ;; + "*") echo "Unknown command: '$1', '$2'" ;; + esac +} +main "$@" diff --git a/.config/lf/lfrc b/.config/lf/lfrc new file mode 100755 index 0000000..029cc8f --- /dev/null +++ b/.config/lf/lfrc @@ -0,0 +1,178 @@ +# Basic Settings +set previewer ~/.config/lf/preview +set preview true +# set drawbox true +# set icons true +set ignorecase true +set scrolloff 1 +set shell zsh + +# unmap keys +map y +map d +map m + +# keymappings +# rename +map C rename # at the end +map c push C +map push C # new rename +map B bulk-rename # fix this + +# lf commands +map H set hidden! +map reload + +# cut/copy/paste +map p paste +map yy copy +map dd cut +map D delete + +# new files/directories +map md push :mkdir +map mf push :mkfile +map mF push :touch + +# opening files +map o push :open-with +map L open_ext +map P share + +# selecting files/globs +map t toggle + +# custom commands +cmd open ${{ + case $(file --mime-type "$f" -bL) in + text/*|application/json) $EDITOR "$f";; + *) xdg-open "$f" ;; + esac +}} + +# open in another terminal +cmd open_ext ${{ + case $(file --mime-type "$f" -bL) in + text/*|application/json) $TERMINAL "-e" $EDITOR "$f";; + *) xdg-open "$f" ;; + esac +}} + +# cmd mkdir ${{ +# set -f +# printf "Directory Name: " +# read ans +# mkdir $ans +# }} + +# cmd mkfile ${{ +# printf "File Name: " +# read ans +# $EDITOR $ans +# }} + +# cmd mkdir %mkdir "$@" +cmd mkdir %{{ + IFS=" " + mkdir -p -- "$*" + lf -remote "send $id select \"$*\"" +}} +cmd mkfile %nvim "$@" +# cmd touch %touch "$@" +cmd touch %{{ + IFS=" " + touch "$*" + lf -remote "send $id select \"$*\"" +}} + +cmd chmod ${{ + printf "Mode Bits: " + read ans + + for file in "$fx" + do + chmod $ans $file + done + + lf -remote 'send reload' +}} + +cmd open-with %"$@" $fx +cmd share $curl -F"file=@$fx" https://0x0.st | xclip -selection c + +# bulk rename non-hidden or selected files +# cmd bulk-rename ${{ +# old="$(mktemp)" +# new="$(mktemp)" +# [ -n "$fs" ] && fs="$(ls)" +# printf '%s\n' "$fs" >"$old" +# printf '%s\n' "$fs" >"$new" +# $EDITOR "$new" +# [ "$(wc -l "$new")" -ne "$(wc -l "$old")" ] && exit +# paste "$old" "$new" | while IFS= read -r names; do +# src="$(printf '%s' "$names" | cut -f1)" +# dst="$(printf '%s' "$names" | cut -f2)" +# if [ "$src" = "$dst" ] || [ -e "$dst" ]; then +# continue +# fi +# mv -- "$src" "$dst" +# done +# rm -- "$old" "$new" +# lf -remote "send $id unselect" +# }} + +# override paste with cp-p +cmd paste $cp-p --lf-paste $id + +# archive bindings +cmd unarchive ${{ + case "$f" in + *.zip) unzip "$f" ;; + *.tar.gz) tar -xzvf "$f" ;; + *.tar.bz2) tar -xjvf "$f" ;; + *.tar) tar -xvf "$f" ;; + *) echo "Unsupported format" ;; + esac +}} + +cmd zip %zip -r "$f" "$f" +cmd tar %tar cvf "$f.tar" "$f" +cmd targz %tar cvzf "$f.tar.gz" "$f" +cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f" + +# archive mappings +map az zip +map at tar +map ag targz +map ab targz +map au unarchive + +# this runs on each directory change +cmd on-cd &{{ + # display git repository status in your prompt + source /usr/share/git/completion/git-prompt.sh + GIT_PS1_SHOWDIRTYSTATE=auto + GIT_PS1_SHOWSTASHSTATE=auto + GIT_PS1_SHOWUNTRACKEDFILES=auto + GIT_PS1_SHOWUPSTREAM=auto + GIT_PS1_COMPRESSSPARSESTATE=auto + git=$(__git_ps1 " [GIT BRANCH:> %s]") || true + fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m" + lf -remote "send $id set promptfmt \"$fmt\"" + + # update window title + printf "\033]0; $PWD\007" > /dev/tty +}} + +# set number of columns depending +# on window size on startup +# %{{ +# w=$(tput cols) +# if [ $w -le 80 ]; then +# lf -remote "send $id set ratios 1:2" +# elif [ $w -le 160 ]; then +# lf -remote "send $id set ratios 1:2:3" +# else +# lf -remote "send $id set ratios 1:2:3:5" +# fi +# }} diff --git a/.config/lf/preview b/.config/lf/preview new file mode 100755 index 0000000..3069a06 --- /dev/null +++ b/.config/lf/preview @@ -0,0 +1,48 @@ +#!/bin/sh + +# Clear the last preview (if any) +$HOME/.config/lf/image clear + +# Calculate where the image should be placed on the screen. +num=$(printf "%0.f\n" "`echo "$(tput cols) / 2" | bc`") +numb=$(printf "%0.f\n" "`echo "$(tput cols) - $num - 1" | bc`") +numc=$(printf "%0.f\n" "`echo "$(tput lines) - 2" | bc`") + +case "$1" in + *.tgz|*.tar.gz) tar tzf "$1";; + *.tar.bz2|*.tbz2) tar tjf "$1";; + *.tar.txz|*.txz) xz --list "$1";; + *.tar) tar tf "$1";; + *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1";; + *.rar) unrar l "$1";; + *.7z) 7z l "$1";; + *.[1-8]) man "$1" | col -b ;; + *.o) nm "$1" | less ;; + *.torrent) transmission-show "$1";; + *.iso) iso-info --no-header -l "$1";; + *odt,*.ods,*.odp,*.sxw) odt2txt "$1";; + *.doc) catdoc "$1" ;; + *.docx) docx2txt "$1" - ;; + *.csv) cat "$1" | sed s/,/\\n/g ;; + *.pdf) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + pdftoppm -png -f 1 -singlefile "$1" "$CACHE" + $HOME/.config/lf/image draw "$CACHE.png" $num 1 $numb $numc + ;; + *.epub) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + epub-thumbnailer "$1" "$CACHE" 1024 + $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc + ;; + *.bmp|*.jpg|*.jpeg|*.png|*.xpm) + $HOME/.config/lf/image draw "$1" $num 1 $numb $numc + ;; + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.flac) exiftool "$1";; + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + CACHE=$(mktemp /tmp/thumbcache.XXXXX) + ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc + ;; + *) highlight --out-format ansi "$1" || cat "$1";; +esac + diff --git a/.config/lf/pv b/.config/lf/pv new file mode 100644 index 0000000..9330eed --- /dev/null +++ b/.config/lf/pv @@ -0,0 +1,9 @@ +#!bin/sh +case "$1" in + *.tar*) tar tf "$1";; + *.zip) unzip -l "$1";; + *.rar) unrar l "$1";; + *.7z) 7z l "$1";; + *.pdf) pdftotext "$1" -;; + *) highlight -O ansi "$1";; +esac diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..9b2bb27 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,85 @@ +call plug#begin('~/local/share/nvim/plugged') + +" find a better plugin to do this +" which works with tsx and +" doesn't interfere with coc-pairs +Plug 'alvan/vim-closetag' + +Plug 'itchyny/lightline.vim' +Plug 'Yggdroot/indentLine' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'romgrk/doom-one.vim' +Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } +Plug 'maxmellon/vim-jsx-pretty' +Plug 'yuezk/vim-js' + + +" Plug 'leafgarland/typescript-vim' +" Plug 'vim-airline/vim-airline' +" Plug 'dracula/vim', { 'as': 'dracula' } +" Plug 'sts10/vim-pink-moon' + +call plug#end() + +" closetag config +let g:closetag_filenames = '*.html,*.xhtml,*.phtml' +let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' +let g:closetag_filetypes = 'html,xhtml,phtml' +let g:closetag_xhtml_filetypes = 'xhtml,jsx' +let g:closetag_emptyTags_caseSensitive = 1 +let g:closetag_regions = { + \ 'typescript.tsx': 'jsxRegion,tsxRegion', + \ 'javascript.jsx': 'jsxRegion', + \ } +let g:closetag_shortcut = '>' +let g:closetag_close_shortcut = '>' + +let g:indentLine_color_term = 239 + +" coc config +let g:coc_global_extentions = [ + \ 'coc-snippets', + \ 'coc-pairs', + \ 'coc-eslint', + \ 'coc-prettier', + \ 'coc-go', + \ 'coc-json', + \ 'coc-tsserver', + \ 'coc-css', + \ 'coc-html', + \ ] + +" line numbers +set number +set nu + +" colorscheme config +colorscheme doom-one +set termguicolors +syntax enable + +" remove vim status because lightline replaces it +set noshowmode + +" lightline config +" colorscheme wombat for lightline +let g:lightline = { + \ 'colorscheme': 'darcula' + \ } + +" hexokinase config +let g:Hexokinase_highlighters = ['virtual'] + +" jsx-pretty config +let g:vim_jsx_pretty_highlight_close_tag = 1 +let g:vim_jsx_pretty_colorful_config = 1 + +" set filetypes as typescriptreact +" augroup SyntaxSettings +" autocmd! +" autocmd BufNewFile,BufRead *.tsx set filetype=typescript +" augroup END + + +" colors and theming (copied from DT's config) +highlight LineNr ctermfg=1 ctermbg=none cterm=none diff --git a/.config/picom.conf b/.config/picom.conf new file mode 100644 index 0000000..8ab18b1 --- /dev/null +++ b/.config/picom.conf @@ -0,0 +1,429 @@ +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +shadow = true; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +shadow-radius = 7; + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +# shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +shadow-offset-x = -7; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +shadow-offset-y = -7; + +# Avoid drawing shadows on dock/panel windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dock-shadow = false + +# Don't draw shadows on drag-and-drop windows. This option is deprecated, +# you should use the *wintypes* option in your config file instead. +# +# no-dnd-shadow = false + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Do not paint shadows on shaped windows. Note shaped windows +# here means windows setting its shape through X Shape extension. +# Those using ARGB background is beyond our control. +# Deprecated, use +# shadow-exclude = 'bounding_shaped' +# or +# shadow-exclude = 'bounding_shaped && !rounded_corners' +# instead. +# +# shadow-ignore-shaped = '' + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] +shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "class_g = 'lemonbar'", + "class_g = 'st-256color'", + "class_g = 'Pcmanfm'", + "_GTK_FRAME_EXTENTS@:c" +]; + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = true + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 +fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 +fade-out-step = 0.03; + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +# fade-exclude = [] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +inactive-opacity = 1; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +frame-opacity = 1; + +# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0) +menu-opacity = 0.9; + +# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +# active-opacity = 1.0 + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should always be considered focused. +# focus-exclude = [] +focus-exclude = [ "class_g = 'Cairo-clock'" ]; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = +# blur-size = 12 +# +# blur-deviation = false + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = false + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = '' +blur-kern = "3x3box"; + + +# Exclude conditions for background blur. +# blur-background-exclude = [] +blur-background-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; + +################################# +# General Settings # +################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +# backend = 'glx' +backend = "xrender"; + +# Enable/disable VSync. +# vsync = false +vsync = true + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false +detect-rounded-corners = true; + +# Detect '_NET_WM_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false +detect-client-opacity = true; + +# Specify refresh rate of the screen. If not specified or 0, picom will +# try detecting this with X RandR extension. +# +# refresh-rate = 60 +refresh-rate = 0 + +# Limit picom to repaint at most once every 1 / 'refresh_rate' second to +# boost performance. This should not be used with +# vsync drm/opengl/opengl-oml +# as they essentially does sw-opti's job already, +# unless you wish to specify a lower refresh rate than the actual value. +# +# sw-opti = + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if +# detect-transient is enabled, too. +# +# detect-client-leader = false +detect-client-leader = true + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +# glx-no-stencil = false + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +use-damage = true + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = '' + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "warn"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = '/path/to/your/log/file' + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = '/path/to/your/log/file' + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = false; } + dnd = { shadow = false; } + popup_menu = { opacity = 0.8; } + dropdown_menu = { opacity = 0.8; } +}; + +opacity-rule = [ +]; diff --git a/.config/startpage/background.jpg b/.config/startpage/background.jpg new file mode 100644 index 0000000..3e8476f Binary files /dev/null and b/.config/startpage/background.jpg differ diff --git a/.config/startpage/index.html b/.config/startpage/index.html new file mode 100644 index 0000000..18b2dd2 --- /dev/null +++ b/.config/startpage/index.html @@ -0,0 +1,67 @@ + + + + + Welcome, Vidhu Kant! + + + +
+ {{ .time }} +
+ + + diff --git a/.config/startpage/server.go b/.config/startpage/server.go new file mode 100644 index 0000000..b2eef0c --- /dev/null +++ b/.config/startpage/server.go @@ -0,0 +1,22 @@ +package main + +import ( + "github.com/gin-gonic/gin" + "net/http" + "time" +) + +func main() { + router := gin.New() + router.LoadHTMLGlob("/home/zt/.config/startpage/index.html") + router.Static("main", "/home/zt/.config/startpage/") + + router.GET("/", func (c *gin.Context) { + time := time.Now().Format("15:04 02 Jan (Monday)") + c.HTML(http.StatusOK, "index.html", gin.H{ + "time": time, + }) + }) + + router.Run(":8081") +} diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc new file mode 100644 index 0000000..f5ee04b --- /dev/null +++ b/.config/zsh/.zshrc @@ -0,0 +1,75 @@ +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt autocd beep notify +bindkey -v +# autoload -U colors && colors +# source /home/zt/.local/zsh-autocomplete/zsh-autocomplete.plugin.zsh + +# paths +# export PATH=/:$PATH +export PATH=/zt/Docs/Go:$PATH +export PATH=/home/zt/.config/scripts:$PATH +export PATH=/zt/Programs:$PATH +export PATH=/home/zt/.local/bin:$PATH +export PATH=/zt/Docs/GoMinder:$PATH +export PATH=/usr/local/bin:$PATH +export PATH=/home/zt/.emacs.d/bin:$PATH + +export GOPATH="/zt/Docs/Go/" + +# aliases +# directories +alias waifu='cd /zt/waifu' +alias docs='cd /zt/Docs' +alias zt='/zt/' +alias progs='/zt/Programs/' +alias scripts='~/.config/scripts/' +alias goproj='/zt/Docs/Go/src/github.com/MikunoNaka' +alias wd='/zt/Docs/web' + +# programs +alias pf='clear && pfetch' +alias rm='rm -i' +alias ls='exa -l' +alias la='exa -a' +alias lsa='exa -al' +alias nf='neofetch' +alias adbc='adb connect 10.0.0.51:5555' +alias x='chmod +x' + +# git +alias gs='git status' +alias ga='git add' +alias gA='git add -A' +alias gc='git commit' +alias gcm='git commit -m' +alias gi='nvim .gitignore' +alias gp='git push' +alias gcl='git clone' + +# dotfiles +alias xc='nvim /home/zt/.config/XMonad/xmonad.hs' +alias zrc='nvim /home/zt/.config/zsh/.zshrc' + +# git bare +alias dots='git --git-dir=$HOME/.dots/ --work-tree=$HOME' +alias da='dots add' +alias dc='dots commit' +# if ssh daemon isn't running, start it and retry pushing +alias dp='dots push || ssh-v && dots push' + +# ssh +alias ssh-k='eval $(ssh-agent)&& ssh-add /home/zt/.ssh/kalawati_git_key' +alias ssh-v='eval $(ssh-agent)&& ssh-add /home/zt/.ssh/vidhukant' + +# to change title of terminal +title() { + echo -n -e "\033]0;$@\007" +} + +neofetch +exa +eval "$(starship init zsh)" +# syntax highlighting, needs to be at the end +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -- cgit v1.2.3