diff --git a/.config/VSCodium/User/settings.json b/.config/VSCodium/User/settings.json index 8c877ea7..32b99fc0 100644 --- a/.config/VSCodium/User/settings.json +++ b/.config/VSCodium/User/settings.json @@ -29,12 +29,15 @@ "terminal.integrated.fontFamily": "JetBrainsMono NF", "terminal.integrated.defaultProfile.linux": "zsh", "cSpell.userWords": [ + "alacritty", "blit", "Cagulis", "Cena", "cenu", + "cirala", "dirnx", "dirny", + "dotfiles", "grafiki", "Istabu", "Izvietošanas", @@ -42,10 +45,14 @@ "Kristiāns", "Kristofers", "Kvadratūra", + "lfimg", + "nsxiv", + "nvim", "pathlib", "pygame", "roboto", "Sērija", + "Solorice", "Stāvs", "xlabel", "xticks", @@ -56,7 +63,10 @@ "suppressLineUncommittedWarning": true }, "vsicons.dontShowNewVersionMessage": true, - "indentRainbow.excludedLanguages": ["plaintext", "django-txt"], + "indentRainbow.excludedLanguages": [ + "plaintext", + "django-txt" + ], "[markdown]": { "editor.defaultFormatter": "yzhang.markdown-all-in-one" }, @@ -109,5 +119,6 @@ ] }, "workbench.colorTheme": "Dracula Soft", - "workbench.iconTheme": "material-icon-theme" -} + "workbench.iconTheme": "material-icon-theme", + "Lua.telemetry.enable": true +} \ No newline at end of file diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index af8656aa..73a98529 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -39,8 +39,6 @@ window: columns: 0 lines: 0 - - opacity: 0.9 # Window position (changes require restart) # @@ -72,9 +70,6 @@ window: # - buttonless: Title bar, transparent background and no title bar buttons decorations: none - - - # Startup Mode (changes require restart) # # Values for `startup_mode`: @@ -94,10 +89,10 @@ window: # Window class (Linux/BSD only): # class: - # Application instance name - # instance: Alacritty - # General application class - # general: Alacritty + # Application instance name + # instance: Alacritty + # General application class + # general: Alacritty # GTK theme variant (Linux/BSD only) # @@ -191,8 +186,8 @@ draw_bold_text_with_bright_colors: true colors: # Default colors primary: - background: '#1d1f21' - foreground: '#c5c8c6' + background: "#1d1f21" + foreground: "#c5c8c6" # Bright and dim foreground colors # @@ -200,8 +195,8 @@ colors: # present. If the bright foreground color is not set, or # `draw_bold_text_with_bright_colors` is `false`, the normal foreground # color will be used. - dim_foreground: '#828482' - bright_foreground: '#eaeaea' + dim_foreground: "#828482" + bright_foreground: "#eaeaea" # Cursor colors # @@ -237,8 +232,8 @@ colors: # background: '#000000' bar: - background: '#282828' - foreground: '#EBEBE9' + background: "#282828" + foreground: "#EBEBE9" # Keyboard regex hints hints: @@ -247,16 +242,16 @@ colors: # Allowed values are CellForeground/CellBackground, which reference the # affected cell, or hexadecimal colors like #ff00ff. start: - foreground: '#1d1f21' - background: '#e9ff5e' + foreground: "#1d1f21" + background: "#e9ff5e" # All characters after the first one in the hint label # # Allowed values are CellForeground/CellBackground, which reference the # affected cell, or hexadecimal colors like #ff00ff. end: - foreground: '#e9ff5e' - background: '#1d1f21' + foreground: "#e9ff5e" + background: "#1d1f21" # Line indicator # @@ -280,39 +275,39 @@ colors: # Normal colors normal: - black: '#313539' - red: '#b02626' - green: '#40a62f' - yellow: '#f1e635' - blue: '#314ad0' - magenta: '#b30ad0' - cyan: '#32d0fc' - white: '#acadb1' + black: "#313539" + red: "#b02626" + green: "#40a62f" + yellow: "#f1e635" + blue: "#314ad0" + magenta: "#b30ad0" + cyan: "#32d0fc" + white: "#acadb1" # Bright colors bright: - black: '#717174' - red: '#b02626' - green: '#40a62f' - yellow: '#f1e635' - blue: '#314ad0' - magenta: '#b30ad0' - cyan: '#32d0fc' - white: '#acadb1' + black: "#717174" + red: "#b02626" + green: "#40a62f" + yellow: "#f1e635" + blue: "#314ad0" + magenta: "#b30ad0" + cyan: "#32d0fc" + white: "#acadb1" # Dim colors # # If the dim colors are not set, they will be calculated automatically based # on the `normal` colors. dim: - black: '#676f78' - red: '#b55454' - green: '#78a670' - yellow: '#faf380' - blue: '#707fd0' - magenta: '#c583d0' - cyan: '#8adaf1' - white: '#e0e3e7' + black: "#676f78" + red: "#b55454" + green: "#78a670" + yellow: "#faf380" + blue: "#707fd0" + magenta: "#c583d0" + cyan: "#8adaf1" + white: "#e0e3e7" # Indexed Colors # @@ -335,44 +330,42 @@ colors: # # The bell is rung every time the BEL control character is received. #bell: - # Visual Bell Animation - # - # Animation effect for flashing the screen when the visual bell is rung. - # - # Values for `animation`: - # - Ease - # - EaseOut - # - EaseOutSine - # - EaseOutQuad - # - EaseOutCubic - # - EaseOutQuart - # - EaseOutQuint - # - EaseOutExpo - # - EaseOutCirc - # - Linear - #animation: EaseOutExpo +# Visual Bell Animation +# +# Animation effect for flashing the screen when the visual bell is rung. +# +# Values for `animation`: +# - Ease +# - EaseOut +# - EaseOutSine +# - EaseOutQuad +# - EaseOutCubic +# - EaseOutQuart +# - EaseOutQuint +# - EaseOutExpo +# - EaseOutCirc +# - Linear +#animation: EaseOutExpo - # Duration of the visual bell flash in milliseconds. A `duration` of `0` will - # disable the visual bell animation. - #duration: 0 +# Duration of the visual bell flash in milliseconds. A `duration` of `0` will +# disable the visual bell animation. +#duration: 0 - # Visual bell animation color. - #color: '#ffffff' +# Visual bell animation color. +#color: '#ffffff' - - - # Bell Command - # - # This program is executed whenever the bell is rung. - # - # When set to `command: None`, no command will be executed. - # - # Example: - # command: - # program: notify-send - # args: ["Hello, World!"] - # - #command: None +# Bell Command +# +# This program is executed whenever the bell is rung. +# +# When set to `command: None`, no command will be executed. +# +# Example: +# command: +# program: notify-send +# args: ["Hello, World!"] +# +#command: None selection: # This string contains all characters that are used as separators for @@ -435,7 +428,7 @@ cursor: # - (Linux/BSD) user login shell # - (Windows) powershell shell: - program: /bin/zsh + program: /bin/zsh # args: # - --login @@ -452,60 +445,60 @@ shell: #ipc_socket: true #mouse: - # Click settings - # - # The `double_click` and `triple_click` settings control the time - # alacritty should wait for accepting multiple clicks as one double - # or triple click. - #double_click: { threshold: 300 } - #triple_click: { threshold: 300 } +# Click settings +# +# The `double_click` and `triple_click` settings control the time +# alacritty should wait for accepting multiple clicks as one double +# or triple click. +#double_click: { threshold: 300 } +#triple_click: { threshold: 300 } - # If this is `true`, the cursor is temporarily hidden when typing. - #hide_when_typing: false +# If this is `true`, the cursor is temporarily hidden when typing. +#hide_when_typing: false # Regex hints # # Terminal hints can be used to find text in the visible part of the terminal # and pipe it to other applications. #hints: - # Keys used for the hint labels. - #alphabet: "jfkdls;ahgurieowpq" +# Keys used for the hint labels. +#alphabet: "jfkdls;ahgurieowpq" - # List with all available hints - # - # Each hint must have a `regex` and either an `action` or a `command` field. - # The fields `mouse`, `binding` and `post_processing` are optional. - # - # The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and - # `mouse.mods` accept the same values as they do in the `key_bindings` section. - # - # The `mouse.enabled` field controls if the hint should be underlined while - # the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. - # - # If the `post_processing` field is set to `true`, heuristics will be used to - # shorten the match if there are characters likely not to be part of the hint - # (e.g. a trailing `.`). This is most useful for URIs. - # - # Values for `action`: - # - Copy - # Copy the hint's text to the clipboard. - # - Paste - # Paste the hint's text to the terminal or search. - # - Select - # Select the hint's text. - # - MoveViModeCursor - # Move the vi mode cursor to the beginning of the hint. - #enabled: - # - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ - # [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" - # command: xdg-open - # post_processing: true - # mouse: - # enabled: true - # mods: None - # binding: - # key: U - # mods: Control|Shift +# List with all available hints +# +# Each hint must have a `regex` and either an `action` or a `command` field. +# The fields `mouse`, `binding` and `post_processing` are optional. +# +# The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and +# `mouse.mods` accept the same values as they do in the `key_bindings` section. +# +# The `mouse.enabled` field controls if the hint should be underlined while +# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it. +# +# If the `post_processing` field is set to `true`, heuristics will be used to +# shorten the match if there are characters likely not to be part of the hint +# (e.g. a trailing `.`). This is most useful for URIs. +# +# Values for `action`: +# - Copy +# Copy the hint's text to the clipboard. +# - Paste +# Paste the hint's text to the terminal or search. +# - Select +# Select the hint's text. +# - MoveViModeCursor +# Move the vi mode cursor to the beginning of the hint. +#enabled: +# - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ +# [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" +# command: xdg-open +# post_processing: true +# mouse: +# enabled: true +# mods: None +# binding: +# key: U +# mods: Control|Shift # Mouse bindings # @@ -536,8 +529,8 @@ shell: # # - `mods` (see key bindings) mouse_bindings: -# - { mouse: Right, action: ExpandSelection } -- { mouse: Middle, mode: ~Vi, action: PasteSelection } + # - { mouse: Right, action: ExpandSelection } + - { mouse: Middle, mode: ~Vi, action: PasteSelection } # Key bindings # @@ -750,17 +743,17 @@ key_bindings: #- { key: Copy, action: Copy } # - { key: L, mods: Control, action: clear } #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } - - { key: Up, mods: Shift, mode: ~Alt, action: ScrollPageUp } - - { key: Down, mods: Shift, mode: ~Alt, action: ScrollPageDown } - - { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } - - { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + - { key: Up, mods: Shift, mode: ~Alt, action: ScrollPageUp } + - { key: Down, mods: Shift, mode: ~Alt, action: ScrollPageDown } + - { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } + - { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } # - { key: Delete, actions: Del } # - { key: Key9, mods: Control|Shift, action: CreateNewWindow, } # Vi Mode # - { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } # - { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } -# - { key: Escape, mode: ~Search, action: ToggleViMode } + # - { key: Escape, mode: ~Search, action: ToggleViMode } # - { key: Escape, mode: Vi|~Search, action: ClearSelection } # - { key: I, mode: Vi|~Search, action: ToggleViMode } # - { key: I, mode: Vi|~Search, action: ScrollToBottom } @@ -821,21 +814,21 @@ key_bindings: #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } # (Windows, Linux, and BSD only) - - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - - { key: C, mods: Control|Shift, action: Copy } - - { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } - - { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } + - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } + - { key: C, mods: Control|Shift, action: Copy } + - { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } + - { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } #- { key: Insert, mods: Shift, action: PasteSelection } - - { key: Key0, mods: Control, action: ResetFontSize } - - { key: Equals, mods: Control, action: IncreaseFontSize } + - { key: Key0, mods: Control, action: ResetFontSize } + - { key: Equals, mods: Control, action: IncreaseFontSize } # - { key: Plus, mods: Control, action: IncreaseFontSize } - - { key: NumpadAdd, mods: Control, action: IncreaseFontSize } - - { key: Minus, mods: Control, action: DecreaseFontSize } - - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } - - { key: Q, mods: Control|Shift, action: Quit } + - { key: NumpadAdd, mods: Control, action: IncreaseFontSize } + - { key: Minus, mods: Control, action: DecreaseFontSize } + - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } + - { key: Q, mods: Control|Shift, action: Quit } # (Windows only) - - { key: F11, action: ToggleFullscreen } + - { key: F11, action: ToggleFullscreen } # (macOS only) #- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" } @@ -858,24 +851,23 @@ key_bindings: #- { key: F, mods: Command|Control, action: ToggleFullscreen } #- { key: F, mods: Command, mode: ~Search, action: SearchForward } #- { key: B, mods: Command, mode: ~Search, action: SearchBackward } - #debug: - # Display the time it takes to redraw each frame. - #render_timer: false +# Display the time it takes to redraw each frame. +#render_timer: false - # Keep the log file after quitting Alacritty. - #persistent_logging: false +# Keep the log file after quitting Alacritty. +#persistent_logging: false - # Log level - # - # Values for `log_level`: - # - Off - # - Error - # - Warn - # - Info - # - Debug - # - Trace - #log_level: Warn +# Log level +# +# Values for `log_level`: +# - Off +# - Error +# - Warn +# - Info +# - Debug +# - Trace +#log_level: Warn - # Print all received window events. - #print_events: false +# Print all received window events. +#print_events: false diff --git a/.config/awesome/desktop/rc.lua b/.config/awesome/desktop/rc.lua index a7814167..2b871921 100644 --- a/.config/awesome/desktop/rc.lua +++ b/.config/awesome/desktop/rc.lua @@ -1,4 +1,3 @@ - -- If LuaRocks is installed, make sure that packages installed through it are -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, "luarocks.loader") @@ -35,24 +34,24 @@ require("awful.hotkeys_popup.keys") -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors }) + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) end -- Handle runtime errors after startup do - local in_error = false - awesome.connect_signal("debug::error", function (err) - -- Make sure we don't go into an endless error loop - if in_error then return end - in_error = true + local in_error = false + awesome.connect_signal("debug::error", function(err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) }) - in_error = false - end) + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) end -- }}} @@ -79,38 +78,38 @@ awful.layout.layouts = { awful.layout.suit.spiral.dwindle, awful.layout.suit.spiral, --awful.layout.suit.floating, - --awful.layout.suit.tile.left, - --awful.layout.suit.tile.bottom, - --awful.layout.suit.tile.top, - awful.layout.suit.fair, - --awful.layout.suit.fair.horizontal, - --awful.layout.suit.max, - --awful.layout.suit.max.fullscreen, - --awful.layout.suit.magnifier, - --awful.layout.suit.corner.nw, - --awful.layout.suit.corner.ne, - --awful.layout.suit.corner.sw, - --awful.layout.suit.corner.se, + --awful.layout.suit.tile.left, + --awful.layout.suit.tile.bottom, + --awful.layout.suit.tile.top, + awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, + --awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + --awful.layout.suit.magnifier, + --awful.layout.suit.corner.nw, + --awful.layout.suit.corner.ne, + --awful.layout.suit.corner.sw, + --awful.layout.suit.corner.se, } -- }}} -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { - { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { "quit", function() awesome.quit() end }, + { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, + { "manual", terminal .. " -e man awesome" }, + { "edit config", editor_cmd .. " " .. awesome.conffile }, + { "restart", awesome.restart }, + { "quit", function() awesome.quit() end }, } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "open terminal", terminal } - } - }) + { "open terminal", terminal } +} +}) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, - menu = mymainmenu }) + menu = mymainmenu }) -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it @@ -124,377 +123,377 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ mytextclock = wibox.widget.textclock() local cw = calendar_widget({ - theme = 'nord', - placement = "top_right", - previous_month_button = 4, - next_month_button = 5, + theme = 'nord', + placement = "top_right", + previous_month_button = 4, + next_month_button = 5, }) mytextclock:connect_signal("button::press", - function(_, _, _, button) - if button == 1 then cw.toggle() end - end) + function(_, _, _, button) + if button == 1 then cw.toggle() end + end) -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) - ) + awful.button({}, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({}, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end) +) local tasklist_buttons = gears.table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - c:emit_signal( - "request::activate", - "tasklist", - {raise = true} - ) - end - end), - awful.button({ }, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end)) + awful.button({}, 1, function(c) + if c == client.focus then + c.minimized = true + else + c:emit_signal( + "request::activate", + "tasklist", + { raise = true } + ) + end + end), + awful.button({}, 3, function() + awful.menu.client_list({ theme = { width = 250 } }) + end), + awful.button({}, 4, function() + awful.client.focus.byidx(1) + end), + awful.button({}, 5, function() + awful.client.focus.byidx(-1) + end)) local function set_wallpaper(s) - -- Wallpaper - if beautiful.wallpaper then - local wallpaper = beautiful.wallpaper - -- If wallpaper is a function, call it with the screen - if type(wallpaper) == "function" then - wallpaper = wallpaper(s) - end - gears.wallpaper.maximized(wallpaper, s, true) - end + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", set_wallpaper) awful.screen.connect_for_each_screen(function(s) - -- Wallpaper - set_wallpaper(s) + -- Wallpaper + set_wallpaper(s) - -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9"}, s, awful.layout.layouts[1]) + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({ }, 1, function () awful.layout.inc( 1) end), - awful.button({ }, 3, function () awful.layout.inc(-1) end), - awful.button({ }, 4, function () awful.layout.inc( 1) end), - awful.button({ }, 5, function () awful.layout.inc(-1) end))) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist { - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons - } + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(gears.table.join( + awful.button({}, 1, function() awful.layout.inc(1) end), + awful.button({}, 3, function() awful.layout.inc(-1) end), + awful.button({}, 4, function() awful.layout.inc(1) end), + awful.button({}, 5, function() awful.layout.inc(-1) end))) + -- Create a taglist widget + s.mytaglist = awful.widget.taglist { + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons + } - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons - } + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons + } - -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s }) + -- Create the wibox + s.mywibox = awful.wibar({ position = "top", screen = s }) - -- Add widgets to the wibox - s.mywibox:setup { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - --mylauncher, - s.mytaglist, - s.mypromptbox, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - cpu_widget(), - ram_widget(), - net_speed_widget(), - spotify_widget({ - dim_when_paused = true, - dim_opacity = 0.5, - max_lenght = -1, - }), - weather_widget({ - api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1', - coordinates = {56.861415323546815, 24.386162623793343}, - show_daily_forecast = true, - }), - --volume_widget{ - --widget_type = 'arc', - --mixer_cmd = 'pulsemixer', - --}, - logout_menu_widget(), - mytextclock, - s.mylayoutbox, - }, - } + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + --mylauncher, + s.mytaglist, + s.mypromptbox, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + wibox.widget.systray(), + cpu_widget(), + ram_widget(), + net_speed_widget(), + spotify_widget({ + dim_when_paused = true, + dim_opacity = 0.5, + max_lenght = -1, + }), + weather_widget({ + api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1', + coordinates = { 56.861415323546815, 24.386162623793343 }, + show_daily_forecast = true, + }), + --volume_widget{ + --widget_type = 'arc', + --mixer_cmd = 'pulsemixer', + --}, + logout_menu_widget(), + mytextclock, + s.mylayoutbox, + }, + } end) -- }}} -- {{{ Mouse bindings root.buttons(gears.table.join( - awful.button({ }, 3, function () mymainmenu:toggle() end), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) + awful.button({}, 3, function() mymainmenu:toggle() end), + awful.button({}, 4, awful.tag.viewnext), + awful.button({}, 5, awful.tag.viewprev) )) -- }}} -- {{{ Key bindings globalkeys = gears.table.join( - awful.key( {}, "Pause", function () awful.spawn.with_shell("playerctl -a play-pause") end, - {description="pause/play", group="media controls"}), + awful.key({}, "Pause", function() awful.spawn.with_shell("playerctl -a play-pause") end, + { description = "pause/play", group = "media controls" }), - awful.key( {}, "#117", function () awful.spawn.with_shell("playerctl next") end, - {description="play next", group="media controls"}), + awful.key({}, "#117", function() awful.spawn.with_shell("playerctl next") end, + { description = "play next", group = "media controls" }), - awful.key( {}, "#112", function () awful.spawn.with_shell("playerctl previous") end, - {description="play previous", group="media controls"}), + awful.key({}, "#112", function() awful.spawn.with_shell("playerctl previous") end, + { description = "play previous", group = "media controls" }), --awful.key( {}, "#123", function () volume_widget:inc(5) end ), -- increase volume --awful.key( {}, "#122", function () volume_widget:dec(5) end ), -- decrease volume --awful.key( {}, "#121", function () volume_widget:toggle() end ), -- mute - awful.key( {}, "#123", function () awful.spawn.with_shell("pulsemixer --change-volume +5") end ), -- increase volume - awful.key( {}, "#122", function () awful.spawn.with_shell("pulsemixer --change-volume -5") end ), -- decrease volume - awful.key( {}, "#121", function () awful.spawn.with_shell("pulsemixer --toggle-mute") end ), -- mute - awful.key( {}, "#171", function () awful.spawn.with_shell("playerctl next") end ), -- play next - awful.key( {}, "#173", function () awful.spawn.with_shell("playerctl previous") end ), -- play previous - awful.key( {}, "#174", function () awful.spawn.with_shell("playerctl -a stop") end ), -- stop - awful.key( {}, "#172", function () awful.spawn.with_shell("playerctl -a play-pause") end ), -- play/pause + awful.key({}, "#123", function() awful.spawn.with_shell("pulsemixer --change-volume +5") end), -- increase volume + awful.key({}, "#122", function() awful.spawn.with_shell("pulsemixer --change-volume -5") end), -- decrease volume + awful.key({}, "#121", function() awful.spawn.with_shell("pulsemixer --toggle-mute") end), -- mute + awful.key({}, "#171", function() awful.spawn.with_shell("playerctl next") end), -- play next + awful.key({}, "#173", function() awful.spawn.with_shell("playerctl previous") end), -- play previous + awful.key({}, "#174", function() awful.spawn.with_shell("playerctl -a stop") end), -- stop + awful.key({}, "#172", function() awful.spawn.with_shell("playerctl -a play-pause") end), -- play/pause - awful.key( { "Control" }, "#107", function () awful.spawn.with_shell("flameshot gui") end, - {description="take region screenshot", group="launcher"}), -- take region screenshot + awful.key({ "Control" }, "#107", function() awful.spawn.with_shell("flameshot gui") end, + { description = "take region screenshot", group = "launcher" }), -- take region screenshot - awful.key({ modkey, }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), - awful.key({ modkey, }, "Left", awful.tag.viewprev, - {description = "view previous", group = "tag"}), - awful.key({ modkey, }, "Right", awful.tag.viewnext, - {description = "view next", group = "tag"}), - awful.key({ modkey, }, "Escape", awful.tag.history.restore, - {description = "go back", group = "tag"}), + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + { description = "show help", group = "awesome" }), + awful.key({ modkey, }, "Left", awful.tag.viewprev, + { description = "view previous", group = "tag" }), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + { description = "view next", group = "tag" }), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, + { description = "go back", group = "tag" }), - awful.key({ modkey, }, "j", - function () - awful.client.focus.byidx( 1) - end, - {description = "focus next by index", group = "client"} - ), - awful.key({ modkey, }, "k", - function () - awful.client.focus.byidx(-1) - end, - {description = "focus previous by index", group = "client"} - ), - awful.key({ modkey, }, "w", function () mymainmenu:show() end, - {description = "show main menu", group = "awesome"}), + awful.key({ modkey, }, "j", + function() + awful.client.focus.byidx(1) + end, + { description = "focus next by index", group = "client" } + ), + awful.key({ modkey, }, "k", + function() + awful.client.focus.byidx(-1) + end, + { description = "focus previous by index", group = "client" } + ), + awful.key({ modkey, }, "w", function() mymainmenu:show() end, + { description = "show main menu", group = "awesome" }), - -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, - {description = "swap with next client by index", group = "client"}), - awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, - {description = "swap with previous client by index", group = "client"}), - awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, - {description = "focus the next screen", group = "screen"}), - awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, - {description = "focus the previous screen", group = "screen"}), - awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), - awful.key({ modkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, - {description = "go back", group = "client"}), + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end, + { description = "swap with next client by index", group = "client" }), + awful.key({ modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end, + { description = "swap with previous client by index", group = "client" }), + awful.key({ modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end, + { description = "focus the next screen", group = "screen" }), + awful.key({ modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end, + { description = "focus the previous screen", group = "screen" }), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto, + { description = "jump to urgent client", group = "client" }), + awful.key({ modkey, }, "Tab", + function() + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + { description = "go back", group = "client" }), - -- Standard program - awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, - {description = "open a terminal", group = "launcher"}), - awful.key({ modkey, "Control" }, "r", awesome.restart, - {description = "reload awesome", group = "awesome"}), --- awful.key({ modkey, "Control" }, "q", awesome.quit, --- {description = "quit awesome", group = "awesome"}), - awful.key({ modkey, }, "v", function () awful.spawn("vivaldi-stable") end, - {description = "open vivaldi", group = "launcher"}), - awful.key({ modkey, }, "n", function () awful.spawn("spacefm") end, - {description = "open spacefm", group = "launcher"}), + -- Standard program + awful.key({ modkey, }, "Return", function() awful.spawn(terminal) end, + { description = "open a terminal", group = "launcher" }), + awful.key({ modkey, "Control" }, "r", awesome.restart, + { description = "reload awesome", group = "awesome" }), + -- awful.key({ modkey, "Control" }, "q", awesome.quit, + -- {description = "quit awesome", group = "awesome"}), + awful.key({ modkey, }, "v", function() awful.spawn("vivaldi-stable") end, + { description = "open vivaldi", group = "launcher" }), + awful.key({ modkey, }, "n", function() awful.spawn("spacefm") end, + { description = "open spacefm", group = "launcher" }), - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, - {description = "increase master width factor", group = "layout"}), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, - {description = "decrease master width factor", group = "layout"}), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, - {description = "increase the number of master clients", group = "layout"}), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, - {description = "decrease the number of master clients", group = "layout"}), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, - {description = "increase the number of columns", group = "layout"}), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, - {description = "decrease the number of columns", group = "layout"}), - awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, - {description = "select next", group = "layout"}), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, - {description = "select previous", group = "layout"}), + awful.key({ modkey, }, "l", function() awful.tag.incmwfact(0.05) end, + { description = "increase master width factor", group = "layout" }), + awful.key({ modkey, }, "h", function() awful.tag.incmwfact(-0.05) end, + { description = "decrease master width factor", group = "layout" }), + awful.key({ modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end, + { description = "increase the number of master clients", group = "layout" }), + awful.key({ modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end, + { description = "decrease the number of master clients", group = "layout" }), + awful.key({ modkey, "Control" }, "h", function() awful.tag.incncol(1, nil, true) end, + { description = "increase the number of columns", group = "layout" }), + awful.key({ modkey, "Control" }, "l", function() awful.tag.incncol(-1, nil, true) end, + { description = "decrease the number of columns", group = "layout" }), + awful.key({ modkey, }, "space", function() awful.layout.inc(1) end, + { description = "select next", group = "layout" }), + awful.key({ modkey, "Shift" }, "space", function() awful.layout.inc(-1) end, + { description = "select previous", group = "layout" }), - -- Prompt - awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, - {description = "run prompt", group = "launcher"}), + -- Prompt + awful.key({ modkey }, "r", function() awful.screen.focused().mypromptbox:run() end, + { description = "run prompt", group = "launcher" }), - awful.key({ modkey }, "x", - function () - awful.prompt.run { - prompt = "Run Lua code: ", - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval" - } - end, - {description = "lua execute prompt", group = "awesome"}), - -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + awful.key({ modkey }, "x", + function() + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end, + { description = "lua execute prompt", group = "awesome" }), + -- Menubar + awful.key({ modkey }, "p", function() menubar.show() end, + { description = "show the menubar", group = "launcher" }) ) clientkeys = gears.table.join( - awful.key({ modkey, }, "f", - function (c) - c.fullscreen = not c.fullscreen - c:raise() - end, - {description = "toggle fullscreen", group = "client"}), - awful.key({ modkey, "Shift" }, "q", function (c) c:kill() end, - {description = "close", group = "client"}), - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , - {description = "toggle floating", group = "client"}), - awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, - {description = "move to master", group = "client"}), - awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, - {description = "move to screen", group = "client"}), - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, - {description = "toggle keep on top", group = "client"}), - awful.key({ modkey, }, "n", - function (c) - -- The client currently has the input focus, so it cannot be - -- minimized, since minimized clients can't have the focus. - c.minimized = true - end , - {description = "minimize", group = "client"}), - awful.key({ modkey, }, "m", - function (c) - c.maximized = not c.maximized - c:raise() - end , - {description = "(un)maximize", group = "client"}), - awful.key({ modkey, "Control" }, "m", - function (c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end , - {description = "(un)maximize vertically", group = "client"}), - awful.key({ modkey, "Shift" }, "m", - function (c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end , - {description = "(un)maximize horizontally", group = "client"}) + awful.key({ modkey, }, "f", + function(c) + c.fullscreen = not c.fullscreen + c:raise() + end, + { description = "toggle fullscreen", group = "client" }), + awful.key({ modkey, "Shift" }, "q", function(c) c:kill() end, + { description = "close", group = "client" }), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, + { description = "toggle floating", group = "client" }), + awful.key({ modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end, + { description = "move to master", group = "client" }), + awful.key({ modkey, }, "o", function(c) c:move_to_screen() end, + { description = "move to screen", group = "client" }), + awful.key({ modkey, }, "t", function(c) c.ontop = not c.ontop end, + { description = "toggle keep on top", group = "client" }), + awful.key({ modkey, }, "n", + function(c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end, + { description = "minimize", group = "client" }), + awful.key({ modkey, }, "m", + function(c) + c.maximized = not c.maximized + c:raise() + end, + { description = "(un)maximize", group = "client" }), + awful.key({ modkey, "Control" }, "m", + function(c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end, + { description = "(un)maximize vertically", group = "client" }), + awful.key({ modkey, "Shift" }, "m", + function(c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end, + { description = "(un)maximize horizontally", group = "client" }) ) -- Bind all key numbers to tags. -- Be careful: we use keycodes to make it work on any keyboard layout. -- This should map on the top row of your keyboard, usually 1 to 9. for i = 1, 9 do - globalkeys = gears.table.join(globalkeys, - -- View tag only. - awful.key({ modkey }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end, - {description = "view tag #"..i, group = "tag"}), - -- Toggle tag display. - awful.key({ modkey, "Control" }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end, - {description = "toggle tag #" .. i, group = "tag"}), - -- Move client to tag. - awful.key({ modkey, "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, - {description = "move focused client to tag #"..i, group = "tag"}), - -- Toggle tag on focused client. - awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) - ) + globalkeys = gears.table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + { description = "view tag #" .. i, group = "tag" }), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + { description = "toggle tag #" .. i, group = "tag" }), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + { description = "move focused client to tag #" .. i, group = "tag" }), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + { description = "toggle focused client on tag #" .. i, group = "tag" }) + ) end clientbuttons = gears.table.join( - awful.button({ }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - end), - awful.button({ modkey }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - awful.mouse.client.move(c) - end), - awful.button({ modkey }, 3, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - awful.mouse.client.resize(c) - end) + awful.button({}, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + end), + awful.button({ modkey }, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.resize(c) + end) ) -- Set keys @@ -504,134 +503,134 @@ root.keys(globalkeys) -- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { - -- All clients will match this rule. - { rule = { }, - properties = { border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = clientkeys, - -- buttons = clientbuttons, - screen = awful.screen.preferred, - --placement = awful.placement.no_overlap+awful.placement.no_offscreen - } - }, + -- All clients will match this rule. + { rule = {}, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + -- buttons = clientbuttons, + screen = awful.screen.preferred, + --placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + }, - -- Floating clients. - { rule_any = { - instance = { - "DTA", -- Firefox addon DownThemAll. - "copyq", -- Includes session name in class. - "pinentry", - }, - class = { - "Arandr", - "Blueman-manager", - "Gpick", - "Kruler", - "MessageWin", -- kalarm. - "Sxiv", - "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. - "Wpa_gui", - "veromix", - "xtightvncviewer"}, + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Arandr", + "Blueman-manager", + "Gpick", + "Kruler", + "MessageWin", -- kalarm. + "Sxiv", + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "Wpa_gui", + "veromix", + "xtightvncviewer" }, - -- Note that the name property shown in xprop might be set slightly after creation of the client - -- and the name shown there might not match defined rules here. - name = { - "Event Tester", -- xev. - }, - role = { - "AlarmWindow", -- Thunderbird's calendar. - "ConfigManager", -- Thunderbird's about:config. - "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. - } - }, properties = { floating = true, beautiful.useless }}, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + } + }, properties = { floating = true, beautiful.useless } }, - -- Add titlebars to normal clients and dialogs - { rule_any = {type = { "normal", "dialog" } - }, properties = { titlebars_enabled = false } - }, - - { - rule_any = { - class = { "discord", "telegram-desktop", "TelegramDesktop" } - }, properties = { screen = 2, tag = "8" } - }, - - { - rule_any = { - class = { "firefox" } - }, properties = { screen = 1, tag = "7" } + -- Add titlebars to normal clients and dialogs + { rule_any = { type = { "normal", "dialog" } + }, properties = { titlebars_enabled = false } }, { - rule_any = { - class = { "spotify", "Spotify" }, - name = { "Spotify" } - }, properties = { screen = 2, tag = "9" } + rule_any = { + class = { "discord", "telegram-desktop", "TelegramDesktop" } + }, properties = { screen = 2, tag = "8" } + }, + + { + rule_any = { + class = { "firefox" } + }, properties = { screen = 1, tag = "7" } + }, + + { + rule_any = { + class = { "spotify", "Spotify" }, + name = { "Spotify" } + }, properties = { screen = 2, tag = "9" } }, } -- {{{ Signals -- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c) - -- Set the windows at the slave, - -- i.e. put it at the end of others instead of setting it master. - -- if not awesome.startup then awful.client.setslave(c) end +client.connect_signal("manage", function(c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- if not awesome.startup then awful.client.setslave(c) end - if awesome.startup - and not c.size_hints.user_position - and not c.size_hints.program_position then - -- Prevent clients from being unreachable after screen count changes. - awful.placement.no_offscreen(c) - end + if awesome.startup + and not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end end) -- Add a titlebar if titlebars_enabled is set to true in the rules. client.connect_signal("request::titlebars", function(c) - -- buttons for the titlebar - local buttons = gears.table.join( - awful.button({ }, 1, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.resize(c) - end) - ) + -- buttons for the titlebar + local buttons = gears.table.join( + awful.button({}, 1, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({}, 3, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.resize(c) + end) + ) - awful.titlebar(c) : setup { - { -- Left - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal - }, - { -- Middle - { -- Title - align = "center", - widget = awful.titlebar.widget.titlewidget(c) - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal - }, - { -- Right - awful.titlebar.widget.floatingbutton (c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.stickybutton (c), - awful.titlebar.widget.ontopbutton (c), - awful.titlebar.widget.closebutton (c), - layout = wibox.layout.fixed.horizontal() - }, - layout = wibox.layout.align.horizontal - } + awful.titlebar(c):setup { + { -- Left + awful.titlebar.widget.iconwidget(c), + buttons = buttons, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + awful.titlebar.widget.floatingbutton(c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.stickybutton(c), + awful.titlebar.widget.ontopbutton(c), + awful.titlebar.widget.closebutton(c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } end) -- Enable sloppy focus, so that focus follows mouse. client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", {raise = false}) + c:emit_signal("request::activate", "mouse_enter", { raise = false }) end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) @@ -643,4 +642,3 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n -- Autostart Applications awful.spawn.with_shell("picom --experimental-backends") awful.spawn.with_shell("setxkbmap lv") - diff --git a/.config/awesome/json.lua b/.config/awesome/json.lua index 711ef786..ab9af7b5 100644 --- a/.config/awesome/json.lua +++ b/.config/awesome/json.lua @@ -31,111 +31,105 @@ local json = { _version = "0.1.2" } local encode local escape_char_map = { - [ "\\" ] = "\\", - [ "\"" ] = "\"", - [ "\b" ] = "b", - [ "\f" ] = "f", - [ "\n" ] = "n", - [ "\r" ] = "r", - [ "\t" ] = "t", + ["\\"] = "\\", + ["\""] = "\"", + ["\b"] = "b", + ["\f"] = "f", + ["\n"] = "n", + ["\r"] = "r", + ["\t"] = "t", } -local escape_char_map_inv = { [ "/" ] = "/" } +local escape_char_map_inv = { ["/"] = "/" } for k, v in pairs(escape_char_map) do - escape_char_map_inv[v] = k + escape_char_map_inv[v] = k end local function escape_char(c) - return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) + return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) end - local function encode_nil(val) - return "null" + return "null" end - local function encode_table(val, stack) - local res = {} - stack = stack or {} + local res = {} + stack = stack or {} - -- Circular reference? - if stack[val] then error("circular reference") end + -- Circular reference? + if stack[val] then error("circular reference") end - stack[val] = true + stack[val] = true - if rawget(val, 1) ~= nil or next(val) == nil then - -- Treat as array -- check keys are valid and it is not sparse - local n = 0 - for k in pairs(val) do - if type(k) ~= "number" then - error("invalid table: mixed or invalid key types") - end - n = n + 1 - end - if n ~= #val then - error("invalid table: sparse array") - end - -- Encode - for i, v in ipairs(val) do - table.insert(res, encode(v, stack)) - end - stack[val] = nil - return "[" .. table.concat(res, ",") .. "]" + if rawget(val, 1) ~= nil or next(val) == nil then + -- Treat as array -- check keys are valid and it is not sparse + local n = 0 + for k in pairs(val) do + if type(k) ~= "number" then + error("invalid table: mixed or invalid key types") + end + n = n + 1 + end + if n ~= #val then + error("invalid table: sparse array") + end + -- Encode + for i, v in ipairs(val) do + table.insert(res, encode(v, stack)) + end + stack[val] = nil + return "[" .. table.concat(res, ",") .. "]" - else - -- Treat as an object - for k, v in pairs(val) do - if type(k) ~= "string" then - error("invalid table: mixed or invalid key types") - end - table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) - end - stack[val] = nil - return "{" .. table.concat(res, ",") .. "}" - end + else + -- Treat as an object + for k, v in pairs(val) do + if type(k) ~= "string" then + error("invalid table: mixed or invalid key types") + end + table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) + end + stack[val] = nil + return "{" .. table.concat(res, ",") .. "}" + end end - local function encode_string(val) - return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' + return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' end - local function encode_number(val) - -- Check for NaN, -inf and inf - if val ~= val or val <= -math.huge or val >= math.huge then - error("unexpected number value '" .. tostring(val) .. "'") - end - return string.format("%.14g", val) + -- Check for NaN, -inf and inf + if val ~= val or val <= -math.huge or val >= math.huge then + error("unexpected number value '" .. tostring(val) .. "'") + end + return string.format("%.14g", val) end - local type_func_map = { - [ "nil" ] = encode_nil, - [ "table" ] = encode_table, - [ "string" ] = encode_string, - [ "number" ] = encode_number, - [ "boolean" ] = tostring, + ["nil"] = encode_nil, + ["table"] = encode_table, + ["string"] = encode_string, + ["number"] = encode_number, + ["boolean"] = tostring, } encode = function(val, stack) - local t = type(val) - local f = type_func_map[t] - if f then - return f(val, stack) - end - error("unexpected type '" .. t .. "'") + local t = type(val) + local f = type_func_map[t] + if f then + return f(val, stack) + end + error("unexpected type '" .. t .. "'") end function json.encode(val) - return ( encode(val) ) + return (encode(val)) end - ------------------------------------------------------------------------------- -- Decode ------------------------------------------------------------------------------- @@ -143,246 +137,236 @@ end local parse local function create_set(...) - local res = {} - for i = 1, select("#", ...) do - res[ select(i, ...) ] = true - end - return res + local res = {} + for i = 1, select("#", ...) do + res[select(i, ...)] = true + end + return res end -local space_chars = create_set(" ", "\t", "\r", "\n") -local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") -local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") -local literals = create_set("true", "false", "null") +local space_chars = create_set(" ", "\t", "\r", "\n") +local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") +local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") +local literals = create_set("true", "false", "null") local literal_map = { - [ "true" ] = true, - [ "false" ] = false, - [ "null" ] = nil, + ["true"] = true, + ["false"] = false, + ["null"] = nil, } local function next_char(str, idx, set, negate) - for i = idx, #str do - if set[str:sub(i, i)] ~= negate then - return i - end - end - return #str + 1 + for i = idx, #str do + if set[str:sub(i, i)] ~= negate then + return i + end + end + return #str + 1 end - local function decode_error(str, idx, msg) - local line_count = 1 - local col_count = 1 - for i = 1, idx - 1 do - col_count = col_count + 1 - if str:sub(i, i) == "\n" then - line_count = line_count + 1 - col_count = 1 - end - end - error( string.format("%s at line %d col %d", msg, line_count, col_count) ) + local line_count = 1 + local col_count = 1 + for i = 1, idx - 1 do + col_count = col_count + 1 + if str:sub(i, i) == "\n" then + line_count = line_count + 1 + col_count = 1 + end + end + error(string.format("%s at line %d col %d", msg, line_count, col_count)) end - local function codepoint_to_utf8(n) - -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa - local f = math.floor - if n <= 0x7f then - return string.char(n) - elseif n <= 0x7ff then - return string.char(f(n / 64) + 192, n % 64 + 128) - elseif n <= 0xffff then - return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) - elseif n <= 0x10ffff then - return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, - f(n % 4096 / 64) + 128, n % 64 + 128) - end - error( string.format("invalid unicode codepoint '%x'", n) ) + -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa + local f = math.floor + if n <= 0x7f then + return string.char(n) + elseif n <= 0x7ff then + return string.char(f(n / 64) + 192, n % 64 + 128) + elseif n <= 0xffff then + return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) + elseif n <= 0x10ffff then + return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, + f(n % 4096 / 64) + 128, n % 64 + 128) + end + error(string.format("invalid unicode codepoint '%x'", n)) end - local function parse_unicode_escape(s) - local n1 = tonumber( s:sub(1, 4), 16 ) - local n2 = tonumber( s:sub(7, 10), 16 ) - -- Surrogate pair? - if n2 then - return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) - else - return codepoint_to_utf8(n1) - end + local n1 = tonumber(s:sub(1, 4), 16) + local n2 = tonumber(s:sub(7, 10), 16) + -- Surrogate pair? + if n2 then + return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) + else + return codepoint_to_utf8(n1) + end end - local function parse_string(str, i) - local res = "" - local j = i + 1 - local k = j + local res = "" + local j = i + 1 + local k = j - while j <= #str do - local x = str:byte(j) + while j <= #str do + local x = str:byte(j) - if x < 32 then - decode_error(str, j, "control character in string") + if x < 32 then + decode_error(str, j, "control character in string") - elseif x == 92 then -- `\`: Escape - res = res .. str:sub(k, j - 1) - j = j + 1 - local c = str:sub(j, j) - if c == "u" then - local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1) - or str:match("^%x%x%x%x", j + 1) - or decode_error(str, j - 1, "invalid unicode escape in string") - res = res .. parse_unicode_escape(hex) - j = j + #hex - else - if not escape_chars[c] then - decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string") - end - res = res .. escape_char_map_inv[c] - end - k = j + 1 + elseif x == 92 then -- `\`: Escape + res = res .. str:sub(k, j - 1) + j = j + 1 + local c = str:sub(j, j) + if c == "u" then + local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1) + or str:match("^%x%x%x%x", j + 1) + or decode_error(str, j - 1, "invalid unicode escape in string") + res = res .. parse_unicode_escape(hex) + j = j + #hex + else + if not escape_chars[c] then + decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string") + end + res = res .. escape_char_map_inv[c] + end + k = j + 1 - elseif x == 34 then -- `"`: End of string - res = res .. str:sub(k, j - 1) - return res, j + 1 - end + elseif x == 34 then -- `"`: End of string + res = res .. str:sub(k, j - 1) + return res, j + 1 + end - j = j + 1 - end + j = j + 1 + end - decode_error(str, i, "expected closing quote for string") + decode_error(str, i, "expected closing quote for string") end - local function parse_number(str, i) - local x = next_char(str, i, delim_chars) - local s = str:sub(i, x - 1) - local n = tonumber(s) - if not n then - decode_error(str, i, "invalid number '" .. s .. "'") - end - return n, x + local x = next_char(str, i, delim_chars) + local s = str:sub(i, x - 1) + local n = tonumber(s) + if not n then + decode_error(str, i, "invalid number '" .. s .. "'") + end + return n, x end - local function parse_literal(str, i) - local x = next_char(str, i, delim_chars) - local word = str:sub(i, x - 1) - if not literals[word] then - decode_error(str, i, "invalid literal '" .. word .. "'") - end - return literal_map[word], x + local x = next_char(str, i, delim_chars) + local word = str:sub(i, x - 1) + if not literals[word] then + decode_error(str, i, "invalid literal '" .. word .. "'") + end + return literal_map[word], x end - local function parse_array(str, i) - local res = {} - local n = 1 - i = i + 1 - while 1 do - local x - i = next_char(str, i, space_chars, true) - -- Empty / end of array? - if str:sub(i, i) == "]" then - i = i + 1 - break - end - -- Read token - x, i = parse(str, i) - res[n] = x - n = n + 1 - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "]" then break end - if chr ~= "," then decode_error(str, i, "expected ']' or ','") end - end - return res, i + local res = {} + local n = 1 + i = i + 1 + while 1 do + local x + i = next_char(str, i, space_chars, true) + -- Empty / end of array? + if str:sub(i, i) == "]" then + i = i + 1 + break + end + -- Read token + x, i = parse(str, i) + res[n] = x + n = n + 1 + -- Next token + i = next_char(str, i, space_chars, true) + local chr = str:sub(i, i) + i = i + 1 + if chr == "]" then break end + if chr ~= "," then decode_error(str, i, "expected ']' or ','") end + end + return res, i end - local function parse_object(str, i) - local res = {} - i = i + 1 - while 1 do - local key, val - i = next_char(str, i, space_chars, true) - -- Empty / end of object? - if str:sub(i, i) == "}" then - i = i + 1 - break - end - -- Read key - if str:sub(i, i) ~= '"' then - decode_error(str, i, "expected string for key") - end - key, i = parse(str, i) - -- Read ':' delimiter - i = next_char(str, i, space_chars, true) - if str:sub(i, i) ~= ":" then - decode_error(str, i, "expected ':' after key") - end - i = next_char(str, i + 1, space_chars, true) - -- Read value - val, i = parse(str, i) - -- Set - res[key] = val - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "}" then break end - if chr ~= "," then decode_error(str, i, "expected '}' or ','") end - end - return res, i + local res = {} + i = i + 1 + while 1 do + local key, val + i = next_char(str, i, space_chars, true) + -- Empty / end of object? + if str:sub(i, i) == "}" then + i = i + 1 + break + end + -- Read key + if str:sub(i, i) ~= '"' then + decode_error(str, i, "expected string for key") + end + key, i = parse(str, i) + -- Read ':' delimiter + i = next_char(str, i, space_chars, true) + if str:sub(i, i) ~= ":" then + decode_error(str, i, "expected ':' after key") + end + i = next_char(str, i + 1, space_chars, true) + -- Read value + val, i = parse(str, i) + -- Set + res[key] = val + -- Next token + i = next_char(str, i, space_chars, true) + local chr = str:sub(i, i) + i = i + 1 + if chr == "}" then break end + if chr ~= "," then decode_error(str, i, "expected '}' or ','") end + end + return res, i end - local char_func_map = { - [ '"' ] = parse_string, - [ "0" ] = parse_number, - [ "1" ] = parse_number, - [ "2" ] = parse_number, - [ "3" ] = parse_number, - [ "4" ] = parse_number, - [ "5" ] = parse_number, - [ "6" ] = parse_number, - [ "7" ] = parse_number, - [ "8" ] = parse_number, - [ "9" ] = parse_number, - [ "-" ] = parse_number, - [ "t" ] = parse_literal, - [ "f" ] = parse_literal, - [ "n" ] = parse_literal, - [ "[" ] = parse_array, - [ "{" ] = parse_object, + ['"'] = parse_string, + ["0"] = parse_number, + ["1"] = parse_number, + ["2"] = parse_number, + ["3"] = parse_number, + ["4"] = parse_number, + ["5"] = parse_number, + ["6"] = parse_number, + ["7"] = parse_number, + ["8"] = parse_number, + ["9"] = parse_number, + ["-"] = parse_number, + ["t"] = parse_literal, + ["f"] = parse_literal, + ["n"] = parse_literal, + ["["] = parse_array, + ["{"] = parse_object, } parse = function(str, idx) - local chr = str:sub(idx, idx) - local f = char_func_map[chr] - if f then - return f(str, idx) - end - decode_error(str, idx, "unexpected character '" .. chr .. "'") + local chr = str:sub(idx, idx) + local f = char_func_map[chr] + if f then + return f(str, idx) + end + decode_error(str, idx, "unexpected character '" .. chr .. "'") end function json.decode(str) - if type(str) ~= "string" then - error("expected argument of type string, got " .. type(str)) - end - local res, idx = parse(str, next_char(str, 1, space_chars, true)) - idx = next_char(str, idx, space_chars, true) - if idx <= #str then - decode_error(str, idx, "trailing garbage") - end - return res + if type(str) ~= "string" then + error("expected argument of type string, got " .. type(str)) + end + local res, idx = parse(str, next_char(str, 1, space_chars, true)) + idx = next_char(str, idx, space_chars, true) + if idx <= #str then + decode_error(str, idx, "trailing garbage") + end + return res end - return json diff --git a/.config/awesome/mytheme.lua b/.config/awesome/mytheme.lua index 7635686e..6b4b3449 100644 --- a/.config/awesome/mytheme.lua +++ b/.config/awesome/mytheme.lua @@ -11,18 +11,18 @@ local themes_path = gfs.get_themes_dir() local theme = {} -theme.font = "JetBrainsMono NF 8" +theme.font = "JetBrainsMono NF 8" -theme.bg_normal = "#222222" -theme.bg_focus = "#333333" -theme.bg_urgent = "#ff0000" -theme.bg_minimize = "#444444" -theme.bg_systray = theme.bg_normal +theme.bg_normal = "#222222" +theme.bg_focus = "#333333" +theme.bg_urgent = "#ff0000" +theme.bg_minimize = "#444444" +theme.bg_systray = theme.bg_normal -theme.fg_normal = "#aaaaaa" -theme.fg_focus = "#ffffff" -theme.fg_urgent = "#ffffff" -theme.fg_minimize = "#ffffff" +theme.fg_normal = "#aaaaaa" +theme.fg_focus = "#ffffff" +theme.fg_urgent = "#ffffff" +theme.fg_minimize = "#ffffff" theme.useless_gap = dpi(4) theme.border_width = dpi(2) @@ -47,10 +47,10 @@ theme.border_marked = "#91231c" -- Generate taglist squares: local taglist_square_size = dpi(4) theme.taglist_squares_sel = theme_assets.taglist_squares_sel( - taglist_square_size, theme.fg_normal + taglist_square_size, theme.fg_normal ) theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( - taglist_square_size, theme.fg_normal + taglist_square_size, theme.fg_normal ) -- Variables set for theming notifications: @@ -62,9 +62,9 @@ theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( -- Variables set for theming the menu: -- menu_[bg|fg]_[normal|focus] -- menu_[border_color|border_width] -theme.menu_submenu_icon = themes_path.."default/submenu.png" -theme.menu_height = dpi(16) -theme.menu_width = dpi(100) +theme.menu_submenu_icon = themes_path .. "default/submenu.png" +theme.menu_height = dpi(16) +theme.menu_width = dpi(100) -- You can add as many variables as -- you wish and access them by using @@ -72,55 +72,55 @@ theme.menu_width = dpi(100) --theme.bg_widget = "#cc0000" -- Define the image to load -theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png" -theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png" +theme.titlebar_close_button_normal = themes_path .. "default/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path .. "default/titlebar/close_focus.png" -theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png" -theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png" +theme.titlebar_minimize_button_normal = themes_path .. "default/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path .. "default/titlebar/minimize_focus.png" -theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png" -theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png" +theme.titlebar_ontop_button_normal_inactive = themes_path .. "default/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path .. "default/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path .. "default/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path .. "default/titlebar/ontop_focus_active.png" -theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png" -theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png" +theme.titlebar_sticky_button_normal_inactive = themes_path .. "default/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path .. "default/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path .. "default/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path .. "default/titlebar/sticky_focus_active.png" -theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png" -theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png" -theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png" +theme.titlebar_floating_button_normal_inactive = themes_path .. "default/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path .. "default/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path .. "default/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path .. "default/titlebar/floating_focus_active.png" -theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png" -theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png" +theme.titlebar_maximized_button_normal_inactive = themes_path .. "default/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = themes_path .. "default/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = themes_path .. "default/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = themes_path .. "default/titlebar/maximized_focus_active.png" theme.wallpaper = "~/.local/share/wallpaper.png" -- You can use your own layout icons like this: -theme.layout_fairh = themes_path.."default/layouts/fairhw.png" -theme.layout_fairv = themes_path.."default/layouts/fairvw.png" -theme.layout_floating = themes_path.."default/layouts/floatingw.png" -theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png" -theme.layout_max = themes_path.."default/layouts/maxw.png" -theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png" -theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png" -theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png" -theme.layout_tile = themes_path.."default/layouts/tilew.png" -theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png" -theme.layout_spiral = themes_path.."default/layouts/spiralw.png" -theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png" -theme.layout_cornernw = themes_path.."default/layouts/cornernww.png" -theme.layout_cornerne = themes_path.."default/layouts/cornernew.png" -theme.layout_cornersw = themes_path.."default/layouts/cornersww.png" -theme.layout_cornerse = themes_path.."default/layouts/cornersew.png" +theme.layout_fairh = themes_path .. "default/layouts/fairhw.png" +theme.layout_fairv = themes_path .. "default/layouts/fairvw.png" +theme.layout_floating = themes_path .. "default/layouts/floatingw.png" +theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png" +theme.layout_max = themes_path .. "default/layouts/maxw.png" +theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png" +theme.layout_tile = themes_path .. "default/layouts/tilew.png" +theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png" +theme.layout_spiral = themes_path .. "default/layouts/spiralw.png" +theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png" +theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png" +theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png" +theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png" +theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png" -- Generate Awesome icon: theme.awesome_icon = theme_assets.awesome_icon( - theme.menu_height, theme.bg_focus, theme.fg_focus + theme.menu_height, theme.bg_focus, theme.fg_focus ) -- Define the icon theme for application icons. If not set then the icons diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index b5efc34e..8612826c 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -1,4 +1,3 @@ - -- If LuaRocks is installed, make sure that packages installed through it are -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, "luarocks.loader") @@ -36,24 +35,24 @@ require("awful.hotkeys_popup.keys") -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors }) + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) end -- Handle runtime errors after startup do - local in_error = false - awesome.connect_signal("debug::error", function (err) - -- Make sure we don't go into an endless error loop - if in_error then return end - in_error = true + local in_error = false + awesome.connect_signal("debug::error", function(err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) }) - in_error = false - end) + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) end -- }}} @@ -80,38 +79,38 @@ awful.layout.layouts = { awful.layout.suit.spiral.dwindle, awful.layout.suit.spiral, --awful.layout.suit.floating, - --awful.layout.suit.tile.left, - --awful.layout.suit.tile.bottom, - --awful.layout.suit.tile.top, - awful.layout.suit.fair, - --awful.layout.suit.fair.horizontal, - --awful.layout.suit.max, - --awful.layout.suit.max.fullscreen, - --awful.layout.suit.magnifier, - --awful.layout.suit.corner.nw, - --awful.layout.suit.corner.ne, - --awful.layout.suit.corner.sw, - --awful.layout.suit.corner.se, + --awful.layout.suit.tile.left, + --awful.layout.suit.tile.bottom, + --awful.layout.suit.tile.top, + awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, + --awful.layout.suit.max, + --awful.layout.suit.max.fullscreen, + --awful.layout.suit.magnifier, + --awful.layout.suit.corner.nw, + --awful.layout.suit.corner.ne, + --awful.layout.suit.corner.sw, + --awful.layout.suit.corner.se, } -- }}} -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { - { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { "quit", function() awesome.quit() end }, + { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, + { "manual", terminal .. " -e man awesome" }, + { "edit config", editor_cmd .. " " .. awesome.conffile }, + { "restart", awesome.restart }, + { "quit", function() awesome.quit() end }, } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "open terminal", terminal } - } - }) + { "open terminal", terminal } +} +}) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, - menu = mymainmenu }) + menu = mymainmenu }) -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it @@ -124,375 +123,376 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ -- Create a textclock widget mytextclock = wibox.widget.textclock() local cw = calendar_widget({ - theme = 'nord', - placement = "top_right", - previous_month_button = 4, - next_month_button = 5, + theme = 'nord', + placement = "top_right", + previous_month_button = 4, + next_month_button = 5, }) mytextclock:connect_signal("button::press", - function(_, _, _, button) - if button == 1 then cw.toggle() end - end) + function(_, _, _, button) + if button == 1 then cw.toggle() end + end) -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) - ) + awful.button({}, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({}, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end) +) local tasklist_buttons = gears.table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - c:emit_signal( - "request::activate", - "tasklist", - {raise = true} - ) - end - end), - awful.button({ }, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end)) + awful.button({}, 1, function(c) + if c == client.focus then + c.minimized = true + else + c:emit_signal( + "request::activate", + "tasklist", + { raise = true } + ) + end + end), + awful.button({}, 3, function() + awful.menu.client_list({ theme = { width = 250 } }) + end), + awful.button({}, 4, function() + awful.client.focus.byidx(1) + end), + awful.button({}, 5, function() + awful.client.focus.byidx(-1) + end)) local function set_wallpaper(s) - -- Wallpaper - if beautiful.wallpaper then - local wallpaper = beautiful.wallpaper - -- If wallpaper is a function, call it with the screen - if type(wallpaper) == "function" then - wallpaper = wallpaper(s) - end - gears.wallpaper.maximized(wallpaper, s, true) - end + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", set_wallpaper) awful.screen.connect_for_each_screen(function(s) - -- Wallpaper - set_wallpaper(s) + -- Wallpaper + set_wallpaper(s) - -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({ }, 1, function () awful.layout.inc( 1) end), - awful.button({ }, 3, function () awful.layout.inc(-1) end), - awful.button({ }, 4, function () awful.layout.inc( 1) end), - awful.button({ }, 5, function () awful.layout.inc(-1) end))) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist { - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons - } + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(gears.table.join( + awful.button({}, 1, function() awful.layout.inc(1) end), + awful.button({}, 3, function() awful.layout.inc(-1) end), + awful.button({}, 4, function() awful.layout.inc(1) end), + awful.button({}, 5, function() awful.layout.inc(-1) end))) + -- Create a taglist widget + s.mytaglist = awful.widget.taglist { + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons + } - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons - } + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons + } - -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s }) + -- Create the wibox + s.mywibox = awful.wibar({ position = "top", screen = s }) - -- Add widgets to the wibox - s.mywibox:setup { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - --mylauncher, - s.mytaglist, - s.mypromptbox, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - cpu_widget(), - ram_widget(), - net_speed_widget(), - spotify_widget({ - dim_when_paused = true, - dim_opacity = 0.5, - max_lenght = -1, - }), - batteryarc_widget({ - show_current_level = true, - size = 32, - }), - brightness_widget{ - program = 'brightnessctl', - step = 5, - base = 60, - tooltip = true, - }, - weather_widget({ - api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1', - coordinates = {56.86140361300421, 24.386173343039193}, - show_hourly_forecst = true, - show_daily_forecast = true, - }), - logout_menu_widget(), - mytextclock, - s.mylayoutbox, - }, - } + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + --mylauncher, + s.mytaglist, + s.mypromptbox, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + wibox.widget.systray(), + cpu_widget(), + ram_widget(), + net_speed_widget(), + spotify_widget({ + dim_when_paused = true, + dim_opacity = 0.5, + max_lenght = -1, + }), + batteryarc_widget({ + show_current_level = true, + size = 32, + }), + brightness_widget { + program = 'brightnessctl', + step = 5, + base = 60, + tooltip = true, + }, + weather_widget({ + api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1', + coordinates = { 56.86140361300421, 24.386173343039193 }, + show_hourly_forecst = true, + show_daily_forecast = true, + }), + logout_menu_widget(), + mytextclock, + s.mylayoutbox, + }, + } end) -- }}} -- {{{ Mouse bindings root.buttons(gears.table.join( - awful.button({ }, 3, function () mymainmenu:toggle() end), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) + awful.button({}, 3, function() mymainmenu:toggle() end), + awful.button({}, 4, awful.tag.viewnext), + awful.button({}, 5, awful.tag.viewprev) )) -- }}} -- {{{ Key bindings globalkeys = gears.table.join( - awful.key( {}, "#233", function() brightness_widget:inc() end ), -- increase brightness - awful.key( {}, "#232", function() brightness_widget:dec() end ), -- decrease brightness + awful.key({}, "#233", function() brightness_widget:inc() end), -- increase brightness + awful.key({}, "#232", function() brightness_widget:dec() end), -- decrease brightness - awful.key( {}, "#123", function () awful.spawn.with_shell("pulsemixer --change-volume +5") end ), -- increase volume - awful.key( {}, "#122", function () awful.spawn.with_shell("pulsemixer --change-volume -5") end ), -- decrease volume - awful.key( {}, "#121", function () awful.spawn.with_shell("pulsemixer --toggle-mute") end ), -- mute - awful.key( {}, "#172", function () awful.spawn.with_shell("playerctl -a play-pause") end ), -- play/pause + awful.key({}, "#123", function() awful.spawn.with_shell("pulsemixer --change-volume +5") end), -- increase volume + awful.key({}, "#122", function() awful.spawn.with_shell("pulsemixer --change-volume -5") end), -- decrease volume + awful.key({}, "#121", function() awful.spawn.with_shell("pulsemixer --toggle-mute") end), -- mute + awful.key({}, "#172", function() awful.spawn.with_shell("playerctl -a play-pause") end), -- play/pause - awful.key( { "Control" }, "#107", function () awful.spawn.with_shell("flameshot gui") end, - {description="take region screenshot", group="launcher"}), -- take region screenshot + awful.key({ "Control" }, "#107", function() awful.spawn.with_shell("flameshot gui") end, + { description = "take region screenshot", group = "launcher" }), -- take region screenshot - awful.key({ modkey, }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), - awful.key({ modkey, }, "Left", awful.tag.viewprev, - {description = "view previous", group = "tag"}), - awful.key({ modkey, }, "Right", awful.tag.viewnext, - {description = "view next", group = "tag"}), - awful.key({ modkey, }, "Escape", awful.tag.history.restore, - {description = "go back", group = "tag"}), + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + { description = "show help", group = "awesome" }), + awful.key({ modkey, }, "Left", awful.tag.viewprev, + { description = "view previous", group = "tag" }), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + { description = "view next", group = "tag" }), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, + { description = "go back", group = "tag" }), - awful.key({ modkey, }, "j", function () awful.client.focus.byidx(1) end, - {description = "focus next by index", group = "client"} - ), - awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) end, - {description = "focus previous by index", group = "client"} - ), - awful.key({ modkey, }, "w", function () mymainmenu:show() end, - {description = "show main menu", group = "awesome"}), + awful.key({ modkey, }, "j", function() awful.client.focus.byidx(1) end, + { description = "focus next by index", group = "client" } + ), + awful.key({ modkey, }, "k", function() awful.client.focus.byidx(-1) end, + { description = "focus previous by index", group = "client" } + ), + awful.key({ modkey, }, "w", function() mymainmenu:show() end, + { description = "show main menu", group = "awesome" }), - -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, - {description = "swap with next client by index", group = "client"}), - awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, - {description = "swap with previous client by index", group = "client"}), - awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, - {description = "focus the next screen", group = "screen"}), - awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, - {description = "focus the previous screen", group = "screen"}), - awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), - awful.key({ modkey, }, "Tab", function () awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end end, - {description = "go back", group = "client"}), + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end, + { description = "swap with next client by index", group = "client" }), + awful.key({ modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end, + { description = "swap with previous client by index", group = "client" }), + awful.key({ modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end, + { description = "focus the next screen", group = "screen" }), + awful.key({ modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end, + { description = "focus the previous screen", group = "screen" }), + awful.key({ modkey, }, "u", awful.client.urgent.jumpto, + { description = "jump to urgent client", group = "client" }), + awful.key({ modkey, }, "Tab", function() awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + { description = "go back", group = "client" }), - -- Standard program - awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, - {description = "open a terminal", group = "launcher"}), - awful.key({ modkey, "Control" }, "r", awesome.restart, - {description = "reload awesome", group = "awesome"}), --- awful.key({ modkey, "Control" }, "q", awesome.quit, --- {description = "quit awesome", group = "awesome"}), - awful.key({ modkey, }, "v", function () awful.spawn("vivaldi-stable") end, - {description = "open vivaldi", group = "launcher"}), - awful.key({ modkey, }, "n", function () awful.spawn("spacefm") end, - {description = "open spacefm", group = "launcher"}), + -- Standard program + awful.key({ modkey, }, "Return", function() awful.spawn(terminal) end, + { description = "open a terminal", group = "launcher" }), + awful.key({ modkey, "Control" }, "r", awesome.restart, + { description = "reload awesome", group = "awesome" }), + -- awful.key({ modkey, "Control" }, "q", awesome.quit, + -- {description = "quit awesome", group = "awesome"}), + awful.key({ modkey, }, "v", function() awful.spawn("vivaldi-stable") end, + { description = "open vivaldi", group = "launcher" }), + awful.key({ modkey, }, "n", function() awful.spawn("spacefm") end, + { description = "open spacefm", group = "launcher" }), - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, - {description = "increase master width factor", group = "layout"}), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, - {description = "decrease master width factor", group = "layout"}), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, - {description = "increase the number of master clients", group = "layout"}), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, - {description = "decrease the number of master clients", group = "layout"}), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, - {description = "increase the number of columns", group = "layout"}), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, - {description = "decrease the number of columns", group = "layout"}), - awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, - {description = "select next", group = "layout"}), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, - {description = "select previous", group = "layout"}), + awful.key({ modkey, }, "l", function() awful.tag.incmwfact(0.05) end, + { description = "increase master width factor", group = "layout" }), + awful.key({ modkey, }, "h", function() awful.tag.incmwfact(-0.05) end, + { description = "decrease master width factor", group = "layout" }), + awful.key({ modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end, + { description = "increase the number of master clients", group = "layout" }), + awful.key({ modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end, + { description = "decrease the number of master clients", group = "layout" }), + awful.key({ modkey, "Control" }, "h", function() awful.tag.incncol(1, nil, true) end, + { description = "increase the number of columns", group = "layout" }), + awful.key({ modkey, "Control" }, "l", function() awful.tag.incncol(-1, nil, true) end, + { description = "decrease the number of columns", group = "layout" }), + awful.key({ modkey, }, "space", function() awful.layout.inc(1) end, + { description = "select next", group = "layout" }), + awful.key({ modkey, "Shift" }, "space", function() awful.layout.inc(-1) end, + { description = "select previous", group = "layout" }), - -- awful.key({ modkey, "Control" }, "n", - -- function () - -- local c = awful.client.restore() - -- -- Focus restored client - -- if c then - -- c:emit_signal( - -- "request::activate", "key.unminimize", {raise = true} - -- ) - -- end - -- end, - -- {description = "restore minimized", group = "client"}), + -- awful.key({ modkey, "Control" }, "n", + -- function () + -- local c = awful.client.restore() + -- -- Focus restored client + -- if c then + -- c:emit_signal( + -- "request::activate", "key.unminimize", {raise = true} + -- ) + -- end + -- end, + -- {description = "restore minimized", group = "client"}), - -- Prompt - awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, - {description = "run prompt", group = "launcher"}), + -- Prompt + awful.key({ modkey }, "r", function() awful.screen.focused().mypromptbox:run() end, + { description = "run prompt", group = "launcher" }), - awful.key({ modkey }, "x", - function () - awful.prompt.run { - prompt = "Run Lua code: ", - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval" - } - end, - {description = "lua execute prompt", group = "awesome"}), - -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + awful.key({ modkey }, "x", + function() + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end, + { description = "lua execute prompt", group = "awesome" }), + -- Menubar + awful.key({ modkey }, "p", function() menubar.show() end, + { description = "show the menubar", group = "launcher" }) ) clientkeys = gears.table.join( - awful.key({ modkey, }, "f", - function (c) - c.fullscreen = not c.fullscreen - c:raise() - end, - {description = "toggle fullscreen", group = "client"}), - awful.key({ modkey, "Shift" }, "q", function (c) c:kill() end, - {description = "close", group = "client"}), - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle , - {description = "toggle floating", group = "client"}), - awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end, - {description = "move to master", group = "client"}), - awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, - {description = "move to screen", group = "client"}), - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, - {description = "toggle keep on top", group = "client"}), - awful.key({ modkey, }, "n", - function (c) - -- The client currently has the input focus, so it cannot be - -- minimized, since minimized clients can't have the focus. - c.minimized = true - end , - {description = "minimize", group = "client"}), - awful.key({ modkey, }, "m", - function (c) - c.maximized = not c.maximized - c:raise() - end , - {description = "(un)maximize", group = "client"}), - awful.key({ modkey, "Control" }, "m", - function (c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end , - {description = "(un)maximize vertically", group = "client"}), - awful.key({ modkey, "Shift" }, "m", - function (c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end , - {description = "(un)maximize horizontally", group = "client"}) + awful.key({ modkey, }, "f", + function(c) + c.fullscreen = not c.fullscreen + c:raise() + end, + { description = "toggle fullscreen", group = "client" }), + awful.key({ modkey, "Shift" }, "q", function(c) c:kill() end, + { description = "close", group = "client" }), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, + { description = "toggle floating", group = "client" }), + awful.key({ modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end, + { description = "move to master", group = "client" }), + awful.key({ modkey, }, "o", function(c) c:move_to_screen() end, + { description = "move to screen", group = "client" }), + awful.key({ modkey, }, "t", function(c) c.ontop = not c.ontop end, + { description = "toggle keep on top", group = "client" }), + awful.key({ modkey, }, "n", + function(c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end, + { description = "minimize", group = "client" }), + awful.key({ modkey, }, "m", + function(c) + c.maximized = not c.maximized + c:raise() + end, + { description = "(un)maximize", group = "client" }), + awful.key({ modkey, "Control" }, "m", + function(c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end, + { description = "(un)maximize vertically", group = "client" }), + awful.key({ modkey, "Shift" }, "m", + function(c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end, + { description = "(un)maximize horizontally", group = "client" }) ) -- Bind all key numbers to tags. -- Be careful: we use keycodes to make it work on any keyboard layout. -- This should map on the top row of your keyboard, usually 1 to 9. for i = 1, 9 do - globalkeys = gears.table.join(globalkeys, - -- View tag only. - awful.key({ modkey }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end, - {description = "view tag #"..i, group = "tag"}), - -- Toggle tag display. - awful.key({ modkey, "Control" }, "#" .. i + 9, - function () - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end, - {description = "toggle tag #" .. i, group = "tag"}), - -- Move client to tag. - awful.key({ modkey, "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, - {description = "move focused client to tag #"..i, group = "tag"}), - -- Toggle tag on focused client. - awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, - function () - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) - ) + globalkeys = gears.table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, + { description = "view tag #" .. i, group = "tag" }), + -- Toggle tag display. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, + { description = "toggle tag #" .. i, group = "tag" }), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + { description = "move focused client to tag #" .. i, group = "tag" }), + -- Toggle tag on focused client. + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + { description = "toggle focused client on tag #" .. i, group = "tag" }) + ) end clientbuttons = gears.table.join( - awful.button({ }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - end), - awful.button({ modkey }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - awful.mouse.client.move(c) - end), - awful.button({ modkey }, 3, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - awful.mouse.client.resize(c) - end) + awful.button({}, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + end), + awful.button({ modkey }, 1, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function(c) + c:emit_signal("request::activate", "mouse_click", { raise = true }) + awful.mouse.client.resize(c) + end) ) -- Set keys @@ -502,121 +502,121 @@ root.keys(globalkeys) -- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { - -- All clients will match this rule. - { rule = { }, - properties = { border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = clientkeys, - -- buttons = clientbuttons, - screen = awful.screen.preferred, - --placement = awful.placement.no_overlap+awful.placement.no_offscreen - } - }, + -- All clients will match this rule. + { rule = {}, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = clientkeys, + -- buttons = clientbuttons, + screen = awful.screen.preferred, + --placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + }, - -- Floating clients. - { rule_any = { - instance = { - "DTA", -- Firefox addon DownThemAll. - "copyq", -- Includes session name in class. - "pinentry", - }, - class = { - "Blueman-manager", - "MessageWin", -- kalarm. - "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. - "Wpa_gui", - "veromix", - "xtightvncviewer"}, + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "Blueman-manager", + "MessageWin", -- kalarm. + "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size. + "Wpa_gui", + "veromix", + "xtightvncviewer" }, - -- Note that the name property shown in xprop might be set slightly after creation of the client - -- and the name shown there might not match defined rules here. - name = { - "Event Tester", -- xev. - }, - role = { - "AlarmWindow", -- Thunderbird's calendar. - "ConfigManager", -- Thunderbird's about:config. - "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. - } - }, properties = { floating = true, beautiful.useless }}, + -- Note that the name property shown in xprop might be set slightly after creation of the client + -- and the name shown there might not match defined rules here. + name = { + "Event Tester", -- xev. + }, + role = { + "AlarmWindow", -- Thunderbird's calendar. + "ConfigManager", -- Thunderbird's about:config. + "pop-up", -- e.g. Google Chrome's (detached) Developer Tools. + } + }, properties = { floating = true, beautiful.useless } }, - -- Add titlebars to normal clients and dialogs - { rule_any = {type = { "normal", "dialog" } - }, properties = { titlebars_enabled = false } - }, + -- Add titlebars to normal clients and dialogs + { rule_any = { type = { "normal", "dialog" } + }, properties = { titlebars_enabled = false } + }, { - rule_any = { - class = { "Thunderbird", "discord", "telegram-desktop", "TelegramDesktop" } - }, properties = { screen = 1, tag = "8" } - }, + rule_any = { + class = { "Thunderbird", "discord", "telegram-desktop", "TelegramDesktop" } + }, properties = { screen = 1, tag = "8" } + }, - -- Set Firefox to always map on the tag named "2" on screen 1. - -- { rule = { class = "Firefox" }, - -- properties = { screen = 1, tag = "2" } }, + -- Set Firefox to always map on the tag named "2" on screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } }, } -- }}} -- {{{ Signals -- Signal function to execute when a new client appears. -client.connect_signal("manage", function (c) - -- Set the windows at the slave, - -- i.e. put it at the end of others instead of setting it master. - -- if not awesome.startup then awful.client.setslave(c) end +client.connect_signal("manage", function(c) + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- if not awesome.startup then awful.client.setslave(c) end - if awesome.startup - and not c.size_hints.user_position - and not c.size_hints.program_position then - -- Prevent clients from being unreachable after screen count changes. - awful.placement.no_offscreen(c) - end + if awesome.startup + and not c.size_hints.user_position + and not c.size_hints.program_position then + -- Prevent clients from being unreachable after screen count changes. + awful.placement.no_offscreen(c) + end end) -- Add a titlebar if titlebars_enabled is set to true in the rules. client.connect_signal("request::titlebars", function(c) - -- buttons for the titlebar - local buttons = gears.table.join( - awful.button({ }, 1, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.resize(c) - end) - ) + -- buttons for the titlebar + local buttons = gears.table.join( + awful.button({}, 1, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.move(c) + end), + awful.button({}, 3, function() + c:emit_signal("request::activate", "titlebar", { raise = true }) + awful.mouse.client.resize(c) + end) + ) - awful.titlebar(c) : setup { - { -- Left - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal - }, - { -- Middle - { -- Title - align = "center", - widget = awful.titlebar.widget.titlewidget(c) - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal - }, - { -- Right - awful.titlebar.widget.floatingbutton (c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.stickybutton (c), - awful.titlebar.widget.ontopbutton (c), - awful.titlebar.widget.closebutton (c), - layout = wibox.layout.fixed.horizontal() - }, - layout = wibox.layout.align.horizontal - } + awful.titlebar(c):setup { + { -- Left + awful.titlebar.widget.iconwidget(c), + buttons = buttons, + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + buttons = buttons, + layout = wibox.layout.flex.horizontal + }, + { -- Right + awful.titlebar.widget.floatingbutton(c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.stickybutton(c), + awful.titlebar.widget.ontopbutton(c), + awful.titlebar.widget.closebutton(c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } end) -- Enable sloppy focus, so that focus follows mouse. client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", {raise = false}) + c:emit_signal("request::activate", "mouse_enter", { raise = false }) end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) @@ -624,11 +624,6 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n -- }}} - -- Autostart Applications awful.spawn.with_shell("picom --experimental-backends") -awful.spawn.with_shell("libinput-gestures-setup start") -awful.spawn.with_shell("dropbox") -awful.spawn.with_shell("flameshot") awful.spawn.with_shell("setxkbmap lv") -awful.spawn.with_shell("corectrl") diff --git a/.config/lf/cleaner b/.config/lf/cleaner index a184d84b..fdff1fbf 100755 --- a/.config/lf/cleaner +++ b/.config/lf/cleaner @@ -1,4 +1,4 @@ #!/bin/sh if [ -n "$FIFO_UEBERZUG" ]; then - printf '{"action": "remove", "identifier": "PREVIEW"}\n' > "$FIFO_UEBERZUG" + printf '{"action": "remove", "identifier": "PREVIEW"}\n' >"$FIFO_UEBERZUG" fi diff --git a/.config/lf/lfrc b/.config/lf/lfrc index c78ad948..c4c67624 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -17,13 +17,13 @@ cmd setwallpaper ${{ # 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 + case "$f" in + *.zip) unzip "$f" ;; + *.tar.gz) tar -xzvf "$f" ;; + *.tar.bz2) tar -xjvf "$f" ;; + *.tar) tar -xvf "$f" ;; + *) echo "Unsupported format" ;; + esac }} # cmds/functions diff --git a/.config/lf/preview b/.config/lf/preview index 4b70b2e8..af057f37 100755 --- a/.config/lf/preview +++ b/.config/lf/preview @@ -2,7 +2,7 @@ image() { if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then - printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2 - 1))" "$(($3 - 1))" "$1" >"$FIFO_UEBERZUG" exit 1 else chafa "$1" -s "$4x" @@ -12,8 +12,7 @@ image() { batorcat() { file="$1" shift - if command -v bat > /dev/null 2>&1 - then + if command -v bat >/dev/null 2>&1; then bat --color=always --style=plain --pager=never "$file" "$@" else cat "$file" @@ -23,61 +22,61 @@ batorcat() { CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" 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" ;; - *.md) glow -s dark "$1" ;; - *.7z) 7z l "$1" ;; - *.[1-8]) man "$1" | col -b ;; - *.o) nm "$1";; - *.torrent) transmission-show "$1" ;; - *.iso) iso-info --no-header -l "$1" ;; - *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; - *.doc) catdoc "$1" ;; - *.docx) docx2txt "$1" - ;; - *.xml|*.html) w3m -dump "$1";; - *.xls|*.xlsx) - ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv - ;; - *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) - exiftool "$1" - ;; - *.pdf) - [ ! -f "${CACHE}.jpg" ] && \ - pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" - image "${CACHE}.jpg" "$2" "$3" "$4" "$5" - ;; - *.epub) - [ ! -f "$CACHE" ] && \ - epub-thumbnailer "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.cbz|*.cbr|*.cbt) - [ ! -f "$CACHE" ] && \ - comicthumb "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) - [ ! -f "${CACHE}.jpg" ] && \ - ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5 - image "${CACHE}.jpg" "$2" "$3" "$4" "$5" - ;; - *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif) - image "$1" "$2" "$3" "$4" "$5" - ;; - *.svg) - [ ! -f "${CACHE}.jpg" ] && \ - convert "$1" "${CACHE}.jpg" - image "${CACHE}.jpg" "$2" "$3" "$4" "$5" - ;; - *.ino) - batorcat --language=cpp "$1" - ;; - *) - batorcat "$1" - ;; +*.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" ;; +*.md) glow -s dark "$1" ;; +*.7z) 7z l "$1" ;; +*.[1-8]) man "$1" | col -b ;; +*.o) nm "$1" ;; +*.torrent) transmission-show "$1" ;; +*.iso) iso-info --no-header -l "$1" ;; +*.odt | *.ods | *.odp | *.sxw) odt2txt "$1" ;; +*.doc) catdoc "$1" ;; +*.docx) docx2txt "$1" - ;; +*.xml | *.html) w3m -dump "$1" ;; +*.xls | *.xlsx) + ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv + ;; +*.wav | *.mp3 | *.flac | *.m4a | *.wma | *.ape | *.ac3 | *.og[agx] | *.spx | *.opus | *.as[fx] | *.mka) + exiftool "$1" + ;; +*.pdf) + [ ! -f "${CACHE}.jpg" ] && + pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; +*.epub) + [ ! -f "$CACHE" ] && + epub-thumbnailer "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; +*.cbz | *.cbr | *.cbt) + [ ! -f "$CACHE" ] && + comicthumb "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; +*.avi | *.mp4 | *.wmv | *.dat | *.3gp | *.ogv | *.mkv | *.mpg | *.mpeg | *.vob | *.fl[icv] | *.m2v | *.mov | *.webm | *.ts | *.mts | *.m4v | *.r[am] | *.qt | *.divx) + [ ! -f "${CACHE}.jpg" ] && + ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5 + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; +*.bmp | *.jpg | *.jpeg | *.png | *.xpm | *.webp | *.gif | *.jfif) + image "$1" "$2" "$3" "$4" "$5" + ;; +*.svg) + [ ! -f "${CACHE}.jpg" ] && + convert "$1" "${CACHE}.jpg" + image "${CACHE}.jpg" "$2" "$3" "$4" "$5" + ;; +*.ino) + batorcat --language=cpp "$1" + ;; +*) + batorcat "$1" + ;; esac exit 0 diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 4805a8a7..7c0e5a67 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -93,19 +93,19 @@ nnoremap S :%s//gI " Use tab for trigger completion with characters ahead and navigate. inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. if has('nvim') - inoremap coc#refresh() + inoremap coc#refresh() else - inoremap coc#refresh() + inoremap coc#refresh() endif @@ -113,32 +113,32 @@ endif lua << END require('Comment').setup() require('lualine').setup { - options = { - icons_enabled = true, - theme = 'dracula', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = {}, - always_divide_middle = true, - globalstatus = false, - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - extensions = {} + options = { + icons_enabled = true, + theme = 'dracula', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = {}, + always_divide_middle = true, + globalstatus = false, + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + extensions = {} } END diff --git a/.config/zlua/z.lua b/.config/zlua/z.lua index d0aa0ad9..1f7563db 100644 --- a/.config/zlua/z.lua +++ b/.config/zlua/z.lua @@ -1,4 +1,4 @@ -#! /usr/bin/env lua +#!/usr/bin/env lua --===================================================================== -- -- z.lua - a cd command that learns, by skywind 2018-2022 @@ -90,8 +90,8 @@ local modname = 'z' local MM = {} _G[modname] = MM -package.loaded[modname] = MM --return modname -setmetatable(MM, {__index = _G}) +package.loaded[modname] = MM --return modname +setmetatable(MM, { __index = _G }) if _ENV ~= nil then _ENV[modname] = MM @@ -166,7 +166,7 @@ function string:startswith(text) end function string:endswith(text) - return text == "" or self:sub(-#text) == text + return text == "" or self:sub(- #text) == text end function string:lstrip() @@ -215,7 +215,6 @@ function string:join(parts) return text end - ----------------------------------------------------------------------- -- table size ----------------------------------------------------------------------- @@ -226,16 +225,15 @@ function table.length(T) return count end - ----------------------------------------------------------------------- -- print table ----------------------------------------------------------------------- function dump(o) if type(o) == 'table' then local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' + for k, v in pairs(o) do + if type(k) ~= 'number' then k = '"' .. k .. '"' end + s = s .. '[' .. k .. '] = ' .. dump(v) .. ',' end return s .. '} ' else @@ -243,7 +241,6 @@ function dump(o) end end - ----------------------------------------------------------------------- -- print table ----------------------------------------------------------------------- @@ -254,10 +251,10 @@ function printT(table, level) level = level or 1 local indent = "" for i = 1, level do - indent = indent.." " + indent = indent .. " " end if key ~= "" then - print(indent..key.." ".."=".." ".."{") + print(indent .. key .. " " .. "=" .. " " .. "{") else print(indent .. "{") end @@ -268,7 +265,7 @@ function printT(table, level) key = k func(v, level + 1) else - local content = string.format("%s%s = %s", indent .. " ",tostring(k), tostring(v)) + local content = string.format("%s%s = %s", indent .. " ", tostring(k), tostring(v)) print(content) end end @@ -277,7 +274,6 @@ function printT(table, level) func(table, level) end - ----------------------------------------------------------------------- -- invoke command and retrive output ----------------------------------------------------------------------- @@ -291,7 +287,6 @@ function os.call(command) return line end - ----------------------------------------------------------------------- -- write log ----------------------------------------------------------------------- @@ -308,16 +303,15 @@ function os.log(text) fp:close() end - ----------------------------------------------------------------------- -- ffi optimize (luajit has builtin ffi module) ----------------------------------------------------------------------- os.native = {} -os.native.status, os.native.ffi = pcall(require, "ffi") +os.native.status, os.native.ffi = pcall(require, "ffi") if os.native.status then local ffi = os.native.ffi if windows then - ffi.cdef[[ + ffi.cdef [[ int GetFullPathNameA(const char *name, uint32_t size, char *out, char **name); int ReplaceFileA(const char *dstname, const char *srcname, void *, uint32_t, void *, void *); uint32_t GetTickCount(void); @@ -335,24 +329,30 @@ if os.native.status then local hr = kernel32.GetFullPathNameA(name, 4096, buffer, nil) return (hr > 0) and ffi.string(buffer, hr) or nil end + function os.native.ReplaceFile(replaced, replacement) local hr = kernel32.ReplaceFileA(replaced, replacement, nil, 2, nil, nil) return (hr ~= 0) and true or false end + function os.native.GetTickCount() return kernel32.GetTickCount() end + function os.native.GetFileAttributes(name) return kernel32.GetFileAttributesA(name) end + function os.native.GetLongPathName(name) local hr = kernel32.GetLongPathNameA(name, buffer, 4096) return (hr ~= 0) and ffi.string(buffer, hr) or nil end + function os.native.GetShortPathName(name) local hr = kernel32.GetShortPathNameA(name, buffer, 4096) return (hr ~= 0) and ffi.string(buffer, hr) or nil end + function os.native.GetRealPathName(name) local short = os.native.GetShortPathName(name) if short then @@ -360,10 +360,12 @@ if os.native.status then end return nil end + function os.native.exists(name) local attr = os.native.GetFileAttributes(name) return attr ~= INVALID_FILE_ATTRIBUTES end + function os.native.isdir(name) local attr = os.native.GetFileAttributes(name) local isdir = FILE_ATTRIBUTE_DIRECTORY @@ -372,13 +374,14 @@ if os.native.status then end return (attr % (2 * isdir)) >= isdir end + function os.native.getcwd() local hr = kernel32.GetCurrentDirectoryA(4096, buffer) if hr <= 0 then return nil end return ffi.string(buffer, hr) end else - ffi.cdef[[ + ffi.cdef [[ typedef struct { long tv_sec; long tv_usec; } timeval; int gettimeofday(timeval *tv, void *tz); int access(const char *name, int mode); @@ -393,13 +396,16 @@ if os.native.status then local usec = tonumber(timeval[0].tv_usec) return sec + (usec * 0.000001) end + function os.native.access(name, mode) return ffi.C.access(name, mode) end + function os.native.realpath(name) local path = ffi.C.realpath(name, buffer) return (path ~= nil) and ffi.string(buffer) or nil end + function os.native.getcwd() local hr = ffi.C.getcwd(buffer, 4099) return hr ~= nil and ffi.string(buffer) or nil @@ -412,6 +418,7 @@ if os.native.status then return math.floor(os.native.gettimeofday() * 1000) end end + os.native.init = true end @@ -446,7 +453,6 @@ function os.pwd() end end - ----------------------------------------------------------------------- -- which executable ----------------------------------------------------------------------- @@ -464,7 +470,7 @@ function os.path.which(exename) return name end else - for _, ext in pairs({'.exe', '.cmd', '.bat'}) do + for _, ext in pairs({ '.exe', '.cmd', '.bat' }) do local name = path .. '\\' .. exename .. ext if path == '.' then name = exename .. ext @@ -478,7 +484,6 @@ function os.path.which(exename) return nil end - ----------------------------------------------------------------------- -- absolute path (simulated) ----------------------------------------------------------------------- @@ -487,7 +492,6 @@ function os.path.absolute(path) return os.path.normpath(os.path.join(pwd, path)) end - ----------------------------------------------------------------------- -- absolute path (system call, can fall back to os.path.absolute) ----------------------------------------------------------------------- @@ -527,7 +531,7 @@ function os.path.abspath(path) return test end end - for _, python in pairs({'python3', 'python2', 'python'}) do + for _, python in pairs({ 'python3', 'python2', 'python' }) do local s = 'sys.stdout.write(os.path.abspath(sys.argv[1]))' local s = '-c "import os, sys;' .. s .. '" \'' .. path .. '\'' local s = python .. ' ' .. s @@ -543,7 +547,6 @@ function os.path.abspath(path) return os.path.absolute(path) end - ----------------------------------------------------------------------- -- dir exists ----------------------------------------------------------------------- @@ -570,7 +573,6 @@ function os.path.isdir(pathname) return os.path.exists(name) end - ----------------------------------------------------------------------- -- file or path exists ----------------------------------------------------------------------- @@ -586,7 +588,7 @@ function os.path.exists(name) if code == 13 or code == 17 then return true elseif code == 30 then - local f = io.open(name,"r") + local f = io.open(name, "r") if f ~= nil then io.close(f) return true @@ -603,7 +605,6 @@ function os.path.exists(name) return true end - ----------------------------------------------------------------------- -- is absolute path ----------------------------------------------------------------------- @@ -624,7 +625,6 @@ function os.path.isabs(path) return false end - ----------------------------------------------------------------------- -- normalize path ----------------------------------------------------------------------- @@ -638,7 +638,6 @@ function os.path.norm(pathname) return pathname end - ----------------------------------------------------------------------- -- normalize . and .. ----------------------------------------------------------------------- @@ -683,7 +682,6 @@ function os.path.normpath(path) return path == '' and '.' or path end - ----------------------------------------------------------------------- -- join two path ----------------------------------------------------------------------- @@ -744,7 +742,6 @@ function os.path.join(path1, path2) end end - ----------------------------------------------------------------------- -- split ----------------------------------------------------------------------- @@ -797,7 +794,6 @@ function os.path.split(path) return head, tail end - ----------------------------------------------------------------------- -- check subdir ----------------------------------------------------------------------- @@ -818,7 +814,6 @@ function os.path.subdir(basename, subname) return false end - ----------------------------------------------------------------------- -- check single name element ----------------------------------------------------------------------- @@ -834,7 +829,6 @@ function os.path.single(path) return true end - ----------------------------------------------------------------------- -- expand user home ----------------------------------------------------------------------- @@ -862,14 +856,12 @@ function os.path.expand(pathname) return pathname end - ----------------------------------------------------------------------- -- search executable ----------------------------------------------------------------------- function os.path.search(name) end - ----------------------------------------------------------------------- -- get lua executable ----------------------------------------------------------------------- @@ -892,7 +884,6 @@ function os.interpreter() return os.path.abspath(lua) end - ----------------------------------------------------------------------- -- get script name ----------------------------------------------------------------------- @@ -908,7 +899,6 @@ function os.scriptname() return os.path.abspath(script) end - ----------------------------------------------------------------------- -- get environ ----------------------------------------------------------------------- @@ -943,7 +933,6 @@ function os.environ(name, default) end end - ----------------------------------------------------------------------- -- parse option ----------------------------------------------------------------------- @@ -985,7 +974,6 @@ function os.getopt(argv) return options, args end - ----------------------------------------------------------------------- -- generate random seed ----------------------------------------------------------------------- @@ -1022,7 +1010,6 @@ function math.random_init() math.randomseed(number) end - ----------------------------------------------------------------------- -- math random string ----------------------------------------------------------------------- @@ -1042,7 +1029,6 @@ function math.random_string(N) return text end - ----------------------------------------------------------------------- -- returns true for path is insensitive ----------------------------------------------------------------------- @@ -1059,7 +1045,6 @@ function path_case_insensitive() return false end - ----------------------------------------------------------------------- -- load and split data ----------------------------------------------------------------------- @@ -1094,7 +1079,6 @@ function data_load(filename) return M end - ----------------------------------------------------------------------- -- save data ----------------------------------------------------------------------- @@ -1151,7 +1135,6 @@ function data_save(filename, M) return true end - ----------------------------------------------------------------------- -- filter out bad dirname ----------------------------------------------------------------------- @@ -1168,7 +1151,6 @@ function data_filter(M) return N end - ----------------------------------------------------------------------- -- insert item ----------------------------------------------------------------------- @@ -1224,7 +1206,6 @@ function data_insert(M, filename) return M end - ----------------------------------------------------------------------- -- change database ----------------------------------------------------------------------- @@ -1232,7 +1213,6 @@ function data_file_set(name) DATA_FILE = name end - ----------------------------------------------------------------------- -- change pattern ----------------------------------------------------------------------- @@ -1251,7 +1231,6 @@ function case_insensitive_pattern(pattern) return p end - ----------------------------------------------------------------------- -- pathmatch ----------------------------------------------------------------------- @@ -1286,7 +1265,6 @@ function path_match(pathname, patterns, matchlast) return true end - ----------------------------------------------------------------------- -- select matched pathnames ----------------------------------------------------------------------- @@ -1310,7 +1288,6 @@ function data_select(M, patterns, matchlast) return N end - ----------------------------------------------------------------------- -- update frecent ----------------------------------------------------------------------- @@ -1333,7 +1310,6 @@ function data_update_frecent(M) return M end - ----------------------------------------------------------------------- -- add path ----------------------------------------------------------------------- @@ -1403,7 +1379,6 @@ function z_add(path) return true end - ----------------------------------------------------------------------- -- remove path ----------------------------------------------------------------------- @@ -1447,7 +1422,6 @@ function z_remove(path) data_save(DATA_FILE, X) end - ----------------------------------------------------------------------- -- match method: frecent, rank, time ----------------------------------------------------------------------- @@ -1480,7 +1454,7 @@ function z_match(patterns, method, subdir) item.score = item.frecent end end - table.sort(M, function (a, b) return a.score > b.score end) + table.sort(M, function(a, b) return a.score > b.score end) local pwd = (PWD == nil or PWD == '') and os.getenv('PWD') or PWD if pwd == nil or pwd == '' then pwd = os.pwd() @@ -1511,7 +1485,6 @@ function z_match(patterns, method, subdir) return M end - ----------------------------------------------------------------------- -- pretty print ----------------------------------------------------------------------- @@ -1574,7 +1547,6 @@ function z_print(M, weight, number) end end - ----------------------------------------------------------------------- -- calculate jump dir ----------------------------------------------------------------------- @@ -1611,7 +1583,7 @@ function z_cd(patterns) return M[1].name end if os.environ('_ZL_INT_SORT', false) then - table.sort(M, function (a, b) return a.name < b.name end) + table.sort(M, function(a, b) return a.name < b.name end) end local retval = nil if Z_INTERACTIVE == 1 then @@ -1637,7 +1609,7 @@ function z_cd(patterns) local cmd = '--nth 2.. --reverse --inline-info --tac ' local flag = os.environ('_ZL_FZF_FLAG', '') flag = (flag == '' or flag == nil) and '+s -e' or flag - cmd = ((fzf == '') and 'fzf' or fzf) .. ' ' .. cmd .. ' ' .. flag + cmd = ((fzf == '') and 'fzf' or fzf) .. ' ' .. cmd .. ' ' .. flag if not windows then tmpname = os.tmpname() local height = os.environ('_ZL_FZF_HEIGHT', '35%') @@ -1667,7 +1639,6 @@ function z_cd(patterns) return (retval ~= '' and retval or nil) end - ----------------------------------------------------------------------- -- purge invalid paths ----------------------------------------------------------------------- @@ -1683,7 +1654,6 @@ function z_purge() return x, y end - ----------------------------------------------------------------------- -- find_vcs_root ----------------------------------------------------------------------- @@ -1706,7 +1676,6 @@ function find_vcs_root(path) return nil end - ----------------------------------------------------------------------- -- cd to parent directories which contains keyword -- #args == 0 -> returns to vcs root @@ -1775,7 +1744,6 @@ function cd_backward(args, options, pwd) end end - ----------------------------------------------------------------------- -- cd minus: "z -", "z --", "z -2" ----------------------------------------------------------------------- @@ -1801,7 +1769,6 @@ function cd_minus(args, options) return nil end - ----------------------------------------------------------------------- -- cd breadcrumbs: z -b -i, z -b -I ----------------------------------------------------------------------- @@ -1814,11 +1781,11 @@ function cd_breadcrumbs(pwd, interactive) local fullname = os.environ('_ZL_FULL_PATH', false) while true do local head, name = os.path.split(path) - if head == path then -- reached root - table.insert(elements, {head, head}) + if head == path then -- reached root + table.insert(elements, { head, head }) break elseif name ~= '' then - table.insert(elements, {name, path}) + table.insert(elements, { name, path }) else break end @@ -1886,7 +1853,6 @@ function cd_breadcrumbs(pwd, interactive) return elements[index][2] end - ----------------------------------------------------------------------- -- main entry ----------------------------------------------------------------------- @@ -1963,7 +1929,7 @@ function main(argv) elseif opts.fish then z_fish_init(opts) elseif opts.powershell then - z_windows_init(opts) + z_windows_init(opts) else z_shell_init(opts) end @@ -1976,8 +1942,8 @@ function main(argv) end elseif options['--complete'] then local line = args[1] and args[1] or '' - local head = line:sub(Z_CMD:len()+1):gsub('^%s+', '') - local M = z_match({head}, Z_METHOD, Z_SUBDIR) + local head = line:sub(Z_CMD:len() + 1):gsub('^%s+', '') + local M = z_match({ head }, Z_METHOD, Z_SUBDIR) for _, item in pairs(M) do print(item.name) end @@ -1987,7 +1953,6 @@ function main(argv) return true end - ----------------------------------------------------------------------- -- initialize from environment variable ----------------------------------------------------------------------- @@ -2060,7 +2025,6 @@ function z_init() end end - ----------------------------------------------------------------------- -- initialize clink hooks ----------------------------------------------------------------------- @@ -2078,14 +2042,16 @@ function z_clink_init() end z_add(clink.get_cwd()) end + clink.prompt.register_filter(z_add_to_database, _zl_clink_prompt_priority) function z_match_completion(word) - local M = z_match({word}, Z_METHOD, Z_SUBDIR) + local M = z_match({ word }, Z_METHOD, Z_SUBDIR) for _, item in pairs(M) do clink.add_match(item.name) end return {} end + local z_parser = clink.arg.new_parser() z_parser:set_arguments({ z_match_completion }) z_parser:set_flags("-c", "-r", "-i", "--cd", "-e", "-b", "--add", "-x", "--purge", @@ -2093,7 +2059,6 @@ function z_clink_init() clink.arg.register_parser("z", z_parser) end - ----------------------------------------------------------------------- -- shell scripts ----------------------------------------------------------------------- @@ -2168,9 +2133,9 @@ esac local script_init_bash_once = [[ _zlua_precmd() { - [ "$_ZL_PREVIOUS_PWD" = "$PWD" ] && return - _ZL_PREVIOUS_PWD="$PWD" - (_zlua --add "$PWD" 2> /dev/null &) + [ "$_ZL_PREVIOUS_PWD" = "$PWD" ] && return + _ZL_PREVIOUS_PWD="$PWD" + (_zlua --add "$PWD" 2> /dev/null &) } case "$PROMPT_COMMAND" in *_zlua_precmd*) ;; @@ -2187,9 +2152,9 @@ esac local script_init_posix_once = [[ _zlua_precmd() { - [ "$_ZL_PREVIOUS_PWD" = "$PWD" ] && return - _ZL_PREVIOUS_PWD="$PWD" - (_zlua --add "$PWD" 2> /dev/null &) + [ "$_ZL_PREVIOUS_PWD" = "$PWD" ] && return + _ZL_PREVIOUS_PWD="$PWD" + (_zlua --add "$PWD" 2> /dev/null &) } case "$PS1" in *_zlua_precmd*) ;; @@ -2343,7 +2308,6 @@ function z_shell_init(opts) end end - ----------------------------------------------------------------------- -- Fish shell init ----------------------------------------------------------------------- @@ -2468,7 +2432,6 @@ function z_fish_init(opts) end end - ----------------------------------------------------------------------- -- windows .cmd script ----------------------------------------------------------------------- @@ -2694,7 +2657,6 @@ function z_windows_init(opts) end end - ----------------------------------------------------------------------- -- help ----------------------------------------------------------------------- @@ -2713,7 +2675,6 @@ function z_help() print(cmd .. '-b foo # cd to the parent directory starting with foo') end - ----------------------------------------------------------------------- -- LFS optimize ----------------------------------------------------------------------- @@ -2726,10 +2687,10 @@ if os.lfs.enable ~= nil then os.lfs.status, os.lfs.pkg = pcall(require, 'lfs') if os.lfs.status then local lfs = os.lfs.pkg - os.path.exists = function (name) + os.path.exists = function(name) return lfs.attributes(name) and true or false end - os.path.isdir = function (name) + os.path.isdir = function(name) local mode = lfs.attributes(name) if not mode then return false diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index c0f33dbb..2f7719bb 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -1,6 +1,5 @@ #!/bin/zsh -if [[ "$(tty)" = "/dev/tty1" ]]; then +if [[ '$(tty)' = '/dev/tty1' ]]; then pgrep awesome || sx fi - diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index f1968dff..9d2ca712 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,21 +1,18 @@ -# clear -# cd ~ - # Flex on ubuntu users fastfetch # pfetch # Options # setopt correct # Auto correct mistakes -setopt extendedglob # Extended globaling. Allows using regular expressions with * -setopt nocaseglob # Case insensative globbing -setopt numericglobsort # Sort filenames numeracally when it makse sense -setopt nobeep # No beep -setopt appendhistory # Immediately append history instead of overwriting -setopt histignorealldups # If a new command is a duplicate, remove older one -setopt autocd # If only directory path is entered, cd there -setopt inc_append_history # Save commands are addded to the history immediately -setopt histignorespace # Don't save commands that start with space +setopt extendedglob # Extended globaling. Allows using regular expressions with * +setopt nocaseglob # Case insensative globbing +setopt numericglobsort # Sort filenames numeracally when it makse sense +setopt nobeep # No beep +setopt appendhistory # Immediately append history instead of overwriting +setopt histignorealldups # If a new command is a duplicate, remove older one +setopt autocd # If only directory path is entered, cd there +setopt inc_append_history # Save commands are addded to the history immediately +setopt histignorespace # Don't save commands that start with space autoload -U select-word-style @@ -24,7 +21,7 @@ autoload -U colors && colors zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case sensetive TAB completions zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors fr dirs/files/etc) -zstyle ':completion:*' rehash true # Automaticly find new executables in path +zstyle ':completion:*' rehash true # Automaticly find new executables in path # Speed up completions zstyle ':completion:*' accept-exact '*(N)' zstyle ':completion:*' use-cache on @@ -33,13 +30,12 @@ zstyle ':completion:*' menu select autoload -U compinit zmodload zsh/complist compinit -_comp_options+=(globdots) # Include hidden files +_comp_options+=(globdots) # Include hidden files HISTFILE=~/.config/zsh/.zshistory HISTSIZE=10000 SAVEHIST=10000 -WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain part of the word - +WORDCHARS=${WORDCHARS//\/[&.;]/} # Don't consider certain part of the word # theme/plugins source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null @@ -53,52 +49,50 @@ bindkey -e bindkey -v export KEYTIMEOUT=1 - # Change cursor shape for different vi modes. function zle-keymap-select { - case $KEYMAP in - vicmd) echo -ne "\e[1 q";; # block - viins|main) echo -ne "\e[5 q";; # beam - esac + case $KEYMAP in + vicmd) echo -ne '\e[1 q' ;; # block + viins | main) echo -ne '\e[5 q' ;; # beam + esac } zle -N zle-keymap-select zle-line-init() { - zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) - echo -ne "\e[5 q" + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne '\e[5 q' } zle -N zle-line-init -echo -ne "\e[5 q" # Use beam shape cursor on startup. -preexec() { echo -ne "\e[5 q" ;} # Use beam shape cursor for each new prompt. - +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q'; } # Use beam shape cursor for each new prompt. +# Run exa on directory change function cd() { - new_directory="$*"; - if [ $# -eq 0 ]; then - new_directory=${HOME}; - fi; - builtin cd "${new_directory}" && exa -a --icons --group-directories-first + new_directory="$*" + if [ $# -eq 0 ]; then + new_directory=${HOME} + fi + builtin cd "${new_directory}" && exa -a --icons --group-directories-first } # Use lf to switch directories and bind it to ctrl-o -lfcd () { - tmp="$(mktemp)" - lfrun -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" - rm -f "$tmp" >/dev/null - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" - fi +function lfcd() { + tmp="$(mktemp)" + lfrun -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(bat "$tmp")" + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi } - # Navigate words with CTRL+ARROW keys bindkey '^[Oc' forward-word bindkey '^[Od' backward-word bindkey '^[[1;5C' forward-word bindkey '^[[1;5D' backward-word -bindkey '^H' backward-kill-word # delete previous word with CTRL+BACKSPACE -bindkey '^[[Z' undo # SHIFT+TAB undo last action -bindkey "^[[3~" delete-char +bindkey '^H' backward-kill-word # delete previous word with CTRL+BACKSPACE +bindkey '^[[Z' undo # SHIFT+TAB undo last action +bindkey '^[[3~' delete-char bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down @@ -110,24 +104,25 @@ bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history bindkey -v '^?' backward-delete-char -bindkey -s "^o" "^ulfcd\n" -bindkey -s "^a" "ubc -lq\n" -bindkey "^[[P" delete-char +bindkey -s '^o' '^ulfcd\n' +# bindkey -s '^a' 'ubc -lq\n' +bindkey '^[[P' delete-char # Edit line in vim with ctrl-e -autoload edit-command-line; zle -N edit-command-line -bindkey "^e" edit-command-line -bindkey -M vicmd "^[[P" vi-delete-char -bindkey -M vicmd "^e" edit-command-line -bindkey -M visual "^[[P" vi-delete +autoload edit-command-line +zle -N edit-command-line +bindkey '^e' edit-command-line +bindkey -M vicmd '^[[P' vi-delete-char +bindkey -M vicmd '^e' edit-command-line +bindkey -M visual '^[[P' vi-delete # Aliases -alias cp='cp -iv' # Confirm before overwriting something -alias mv="mv -iv" -alias rm="rm -vI" -alias mkdir="mkdir -pv" -alias df='df -h' # Human-readable sizes -alias free='free -m' # Show sizes in MB +alias cp='cp -iv' # Confirm before overwriting something +alias mv='mv -iv' +alias rm='rm -vI' +alias mkdir='mkdir -pv' +alias df='df -h' # Human-readable sizes +alias free='free -m' # Show sizes in MB alias gitu='git add . && git commit && git push' alias ls='exa -a --icons --group-directories-first' alias lf='lfrun' @@ -138,18 +133,18 @@ alias pman='doas pacman' alias battery='acpi' alias airpods='bluetoothctl connect C8:B1:CD:E0:14:4F' alias weather='curl wttr.in/' -alias ww="nvim ~/vimwiki/index.wiki" -alias py="python" -alias grep="grep --color=auto" -alias diff="diff --color=auto" -alias ip="ip -color=auto" -alias grep="rg" -alias code="vscodium" - +alias ww='nvim ~/vimwiki/index.wiki' +alias py='python' +alias grep='grep --color=auto' +alias diff='diff --color=auto' +alias ip='ip -color=auto' +alias grep='rg' +alias code='vscodium' source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null -autoload -U promptinit; promptinit +autoload -U promptinit +promptinit prompt spaceship # PROMPT @@ -225,4 +220,3 @@ SPACESHIP_VENV_SHOW=true SPACESHIP_CONDA_SHOW=false SPACESHIP_PYENV_SHOW=true SPACESHIP_VI_MODE_SHOW=false - diff --git a/.gitignore b/.gitignore index 15965451..8b137891 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -vscodium/extensions + diff --git a/README.md b/README.md index 5a9fcbb6..79b0f0e6 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ - Very useful scripts are in `~/.local/bin/` - Settings for: - - vim/nvim (text editor) - - zsh (shell) - - lf (file manager) - - nsxiv (image/gif viewer) - - mpv (video player) + - vim/nvim (text editor) + - zsh (shell) + - lf (file manager) + - nsxiv (image/gif viewer) + - mpv (video player) - I try to minimize what's directly in `~` so: - - All configs that can be in `~/.config/` are. - - Some environmental variables have been set in `~/.zprofile` to move configs into `~/.config/` - + - All configs that can be in `~/.config/` are. + - Some environmental variables have been set in `~/.zprofile` to move configs into `~/.config/` ## Credits + - [lfimg by cirala](https://github.com/cirala/lfimg)