Advertisement
Guest User

just my rc.lua

a guest
Sep 28th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.68 KB | None | 0 0
  1. --       █████╗ ██╗    ██╗███████╗███████╗ ██████╗ ███╗   ███╗███████╗
  2. --      ██╔══██╗██║    ██║██╔════╝██╔════╝██╔═══██╗████╗ ████║██╔════╝
  3. --      ███████║██║ █╗ ██║█████╗  ███████╗██║   ██║██╔████╔██║█████╗
  4. --      ██╔══██║██║███╗██║██╔══╝  ╚════██║██║   ██║██║╚██╔╝██║██╔══╝
  5. --      ██║  ██║╚███╔███╔╝███████╗███████║╚██████╔╝██║ ╚═╝ ██║███████╗
  6. --      ╚═╝  ╚═╝ ╚══╝╚══╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝
  7.  
  8.  
  9. -- Standard awesome libraries
  10. local gears = require("gears")
  11. local awful = require("awful")
  12.  
  13.  
  14. -- ===================================================================
  15. -- User Configuration
  16. -- ===================================================================
  17.  
  18. --require("widgets.wallpaper-blur")
  19.  
  20. local themes = {
  21.    "pastel", -- 1
  22.    "mirage"  -- 2
  23. }
  24.  
  25. -- change this number to use the corresponding theme
  26. local theme = themes[2]
  27. local theme_config_dir = gears.filesystem.get_configuration_dir() .. "/configuration/" .. theme .. "/"
  28.  
  29. -- define default apps (global variable so other components can access it)
  30. apps = {
  31.    network_manager = "nm-connection-editor", -- recommended: nm-connection-editor
  32.    power_manager = "", -- recommended: xfce4-power-manager
  33.    terminal = "alacritty",
  34.    launcher = "rofi -normal-window -modi drun -show drun -theme " .. theme_config_dir .. "rofi.rasi",
  35.    lock = "i3lock",
  36.    screenshot = "scrot -e 'mv $f ~/Pictures/ 2>/dev/null'",
  37.    filebrowser = "dolphin"
  38. }
  39.  
  40. -- define wireless and ethernet interface names for the network widget
  41. -- use `ip link` command to determine these
  42. network_interfaces = {
  43.    wlan = 'wlp1s0',
  44.    lan = 'enp1s0'
  45. }
  46.  
  47. -- List of apps to run on start-up
  48. --local run_on_start_up = {
  49. --   "picom --experimental-backends --config " .. theme_config_dir .. "picom.conf",
  50. --   "redshift",
  51. --   "unclutter",
  52. --   "yakuake",
  53. --   "nm-applet",
  54. --   "clight",
  55. --   "bluetoothctl power on"
  56. --}
  57.  
  58. local run_on_start_up = {
  59.    "picom --experimental-backends --config " .. theme_config_dir .. "picom.conf",
  60.    "redshift",
  61.    "unclutter"
  62. }
  63.  
  64.  
  65. -- ===================================================================
  66. -- Initialization
  67. -- ===================================================================
  68.  
  69.  
  70. -- Import notification appearance
  71. require("components.notifications")
  72.  
  73. -- Run all the apps listed in run_on_start_up
  74. for _, app in ipairs(run_on_start_up) do
  75.    local findme = app
  76.    local firstspace = app:find(" ")
  77.    if firstspace then
  78.       findme = app:sub(0, firstspace - 1)
  79.    end
  80.    -- pipe commands to bash to allow command to be shell agnostic
  81.    awful.spawn.with_shell(string.format("echo 'pgrep -u $USER -x %s > /dev/null || (%s)' | bash -", findme, app), false)
  82. end
  83.  
  84. -- Import theme
  85. local beautiful = require("beautiful")
  86. beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/" .. theme .. "-theme.lua")
  87.  
  88. -- Initialize theme
  89. local selected_theme = require(theme)
  90. selected_theme.initialize()
  91.  
  92. -- Import Keybinds
  93. local keys = require("keys")
  94. root.keys(keys.globalkeys)
  95. root.buttons(keys.desktopbuttons)
  96.  
  97. -- Import rules
  98. local create_rules = require("rules").create
  99. awful.rules.rules = create_rules(keys.clientkeys, keys.clientbuttons)
  100.  
  101. -- Define layouts
  102. awful.layout.layouts = {
  103.    awful.layout.suit.tile,
  104.    awful.layout.suit.floating,
  105.    awful.layout.suit.max,
  106. }
  107.  
  108. -- remove gaps if layout is set to max
  109. tag.connect_signal('property::layout', function(t)
  110.    local current_layout = awful.tag.getproperty(t, 'layout')
  111.    if (current_layout == awful.layout.suit.max) then
  112.       t.gap = 0
  113.    else
  114.       t.gap = beautiful.useless_gap
  115.    end
  116. end)
  117.  
  118. -- Signal function to execute when a new client appears.
  119. client.connect_signal("manage", function (c)
  120.    -- Set the window as a slave (put it at the end of others instead of setting it as master)
  121.    if not awesome.startup then
  122.       awful.client.setslave(c)
  123.    end
  124.  
  125.    if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
  126.       -- Prevent clients from being unreachable after screen count changes.
  127.       awful.placement.no_offscreen(c)
  128.    end
  129. end)
  130.  
  131.  
  132. -- ===================================================================
  133. -- Client Focusing
  134. -- ===================================================================
  135.  
  136.  
  137. -- Autofocus a new client when previously focused one is closed
  138. require("awful.autofocus")
  139.  
  140. -- Focus clients under mouse
  141. client.connect_signal("mouse::enter", function(c)
  142.    c:emit_signal("request::activate", "mouse_enter", {raise = false})
  143. end)
  144.  
  145.  
  146. -- ===================================================================
  147. -- Screen Change Functions (ie multi monitor)
  148. -- ===================================================================
  149.  
  150.  
  151. -- Reload config when screen geometry changes
  152. screen.connect_signal("property::geometry", awesome.restart)
  153.  
  154.  
  155. -- ===================================================================
  156. -- Garbage collection (allows for lower memory consumption)
  157. -- ===================================================================
  158.  
  159.  
  160. collectgarbage("setpause", 110)
  161. collectgarbage("setstepmul", 1000)
  162.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement