diff --git a/bindings/global_keys.lua b/bindings/global_keys.lua index d3ad94d..5ddc7c1 100644 --- a/bindings/global_keys.lua +++ b/bindings/global_keys.lua @@ -91,21 +91,49 @@ function _M.get() -- Prompt awful.key({ RC.vars.modkey }, "r", function() - awful.spawn("rofi -show drun") + awful.spawn("rofi -show run") end, { description = "run prompt", group = "launcher" }), + awful.key({ RC.vars.modkey }, "w", function() + awful.spawn("rofi -show window") + end, { description = "window prompt", group = "launcher" }), + awful.key({ RC.vars.modkey }, "[", function() + awful.spawn("rofi -show power-menu -modi power-menu:rofi-power-menu") + end, { description = "power menu", group = "launcher" }), - awful.key({ RC.vars.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({ RC.vars.modkey }, "p", function() - menubar.show() - end, { description = "show the menubar", group = "launcher" }) + awful.key({}, "XF86AudioRaiseVolume", function() + awful.spawn("pamixer -i 5") + end, { description = "raise volume", group = "media" }), + awful.key({}, "XF86AudioLowerVolume", function() + awful.spawn("pamixer -d 5") + end, { description = "lower volume", group = "media" }), + awful.key({}, "XF86AudioMute", function() + awful.spawn("pamixer -t") + end, { description = "toggle mute", group = "media" }), + + awful.key({}, "XF86MonBrightnessUp", function() + awful.spawn("light -A 5") + end, { description = "raise brightness", group = "system" }), + awful.key({}, "XF86MonBrightnessDown", function() + awful.spawn("light -U 5") + end, { description = "lower brightness", group = "system" }), + + awful.key({}, "Play", function() + awful.spawn("playerctl play-pause") + end, { description = "play/pause media", group = "media" }), + awful.key({}, "Next", function() + awful.spawn("playerctl next") + end, { description = "next media", group = "media" }), + awful.key({}, "Prior", function() + awful.spawn("playerctl previous") + end, { description = "previous media", group = "media" }), + + awful.key({ RC.vars.modkey, "Shift" }, "r", function() + awful.spawn("firefox") + end, { description = "launch browser", group = "launcher" }), + + awful.key({ RC.vars.modkey }, "b", function() + require("statusbar.bottom.widgets").get_battery_widget().toggle_percentage() + end, { description = "toggle battery percent", group = "system" }) ) for i = 1, 6 do @@ -148,7 +176,7 @@ function _M.get() ) end - return globalkeys + return globalkeys end return setmetatable({}, { diff --git a/deco/screens.lua b/deco/screens.lua new file mode 100644 index 0000000..4e29c85 --- /dev/null +++ b/deco/screens.lua @@ -0,0 +1,30 @@ +local awful = require("awful") + +local taglist = require("deco.taglist") +local tasklist = require("deco.tasklist") +local layoutbox = require("deco.layoutbox") +local wallpaper = require("deco.wallpaper") + +local bottom_statusbar = require("statusbar.bottom.statusbar") +local top_statusbar = require("statusbar.top.statusbar") + +local _M = {} + +function _M.setup() + awful.screen.connect_for_each_screen(function(s) + wallpaper(s) + + s.layoutbox = layoutbox(s) + s.taglist = taglist(s) + s.tasklist = tasklist(s) + + top_statusbar(s) + bottom_statusbar(s) + end) +end + +return setmetatable(_M, { + __call = function() + return _M.setup() + end, +}) diff --git a/deco/statusbar.lua b/deco/statusbar.lua deleted file mode 100644 index 4c9195c..0000000 --- a/deco/statusbar.lua +++ /dev/null @@ -1,41 +0,0 @@ -local gears = require("gears") -local awful = require("awful") -local wibox = require("wibox") - -local wallpaper = require("deco.wallpaper") -local taglist = require("deco.taglist") -local tasklist = require("deco.tasklist") -local layoutbox = require("deco.layoutbox") - -return function(s) - wallpaper(s) - - -- Create a promptbox for each screen - s.promptbox = awful.widget.prompt() - - s.layoutbox = layoutbox(s) - - s.taglist = taglist(s) - - s.tasklist = tasklist(s) - - -- Create the wibox - s.wibox = awful.wibar({ position = "bottom", screen = s }) - - -- Add widgets to the wibox - s.wibox:setup({ - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - s.taglist, - s.promptbox, - }, - s.tasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.widget.systray(), - wibox.widget.textclock(), - s.layoutbox, - }, - }) -end diff --git a/deco/taglist.lua b/deco/taglist.lua index 09514a3..36b6d89 100644 --- a/deco/taglist.lua +++ b/deco/taglist.lua @@ -1,5 +1,8 @@ local awful = require("awful") local gears = require("gears") +local wibox = require("wibox") +local beautiful = require("beautiful") +local lain = require("lain") local _M = {} @@ -27,9 +30,86 @@ function _M.get(s) end) ) - return awful.widget.taglist({ + local separators = lain.util.separators + + local arrl_dl = separators.arrow_right(beautiful.taglist_separator, "alpha") + local arrl_ld = separators.arrow_right("alpha", beautiful.taglist_separator) + + return awful.widget.taglist({ screen = s, filter = awful.widget.taglist.filter.all, + style = { + shape = gears.shape.powerline, + }, + layout = { + spacing = 10, + spacing_widget = arrl_ld, + layout = wibox.layout.fixed.horizontal, + }, + widget_template = { + { + { + arrl_dl, + { + { + id = "icon_role", + widget = wibox.widget.imagebox, + }, + margins = 2, + widget = wibox.container.margin, + }, + { + { + { + id = "index_role", + widget = wibox.widget.textbox, + }, + margins = 3, + widget = wibox.container.margin, + }, + bg = beautiful.taglist_bg_tag, + shape = gears.shape.circle, + widget = wibox.container.background, + }, + { + { + id = "icon_role", + widget = wibox.widget.imagebox, + }, + margins = 2, + widget = wibox.container.margin, + }, + { + id = "text_role", + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + right = 10, + widget = wibox.container.margin, + }, + id = "background_role", + widget = wibox.container.background, + -- Add support for hover colors and an index label + create_callback = function(self, c3, index, objects) --luacheck: no unused args + self:get_children_by_id("index_role")[1].markup = " " .. index .. " " + self:connect_signal("mouse::enter", function() + if self.bg ~= "#33cc3355" then + self.backup = self.bg + self.has_backup = true + end + self.bg = "#33cc3355" + end) + self:connect_signal("mouse::leave", function() + if self.has_backup then + self.bg = self.backup + end + end) + end, + update_callback = function(self, c3, index, objects) --luacheck: no unused args + self:get_children_by_id("index_role")[1].markup = " " .. index .. " " + end, + }, buttons = taglist_buttons, }) end diff --git a/deco/titlebar.lua b/deco/titlebar.lua index e531568..25b22a8 100644 --- a/deco/titlebar.lua +++ b/deco/titlebar.lua @@ -2,8 +2,7 @@ local awful = require("awful") local gears = require("gears") local wibox = require("wibox") --- Add a titlebar if titlebars_enabled is set to true in the rules. -client.connect_signal("request::titlebars", function(c) +return function(c) -- buttons for the titlebar local buttons = gears.table.join( awful.button({}, 1, function() @@ -31,13 +30,11 @@ client.connect_signal("request::titlebars", function(c) layout = wibox.layout.flex.horizontal, }, { -- Right - awful.titlebar.widget.floatingbutton(c), + awful.titlebar.widget.minimizebutton(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) +end diff --git a/deco/wallpaper.lua b/deco/wallpaper.lua index f28642c..13b21e9 100644 --- a/deco/wallpaper.lua +++ b/deco/wallpaper.lua @@ -1,10 +1,10 @@ -local awful = require("awful") +local beautiful = require("beautiful") local gears = require("gears") local _W = {} function _W.set_wallpaper(s) - local wallpaper = require("theme.wallpaper") + local wallpaper = beautiful.wallpaper if type(wallpaper) == "function" then wallpaper = wallpaper(s) diff --git a/lain b/lain new file mode 160000 index 0000000..88f5a8a --- /dev/null +++ b/lain @@ -0,0 +1 @@ +Subproject commit 88f5a8abd2649b348ffec433a24a263b37f122c0 diff --git a/main/rules.lua b/main/rules.lua index a4344b1..cfa8720 100644 --- a/main/rules.lua +++ b/main/rules.lua @@ -71,15 +71,6 @@ function _M.get(clientkeys, clientbuttons) titlebars_enabled = false, }, }, - - { - rule = { instance = "Discord" }, - properties = { - screen = 1, - tag = RC.tags[6], - titlebars_enabled = false, - }, - }, } return _R diff --git a/main/signals.lua b/main/signals.lua index e2e4fb3..864d1aa 100644 --- a/main/signals.lua +++ b/main/signals.lua @@ -1,5 +1,6 @@ local awful = require("awful") local beautiful = require("beautiful") +local titlebar = require("deco.titlebar") -- Signal function to execute when a new client appears. client.connect_signal("manage", function(c) @@ -9,6 +10,7 @@ client.connect_signal("manage", function(c) end end) +client.connect_signal("request::titlebars", titlebar) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) diff --git a/main/tags.lua b/main/tags.lua index 7e105a5..bd48564 100644 --- a/main/tags.lua +++ b/main/tags.lua @@ -6,21 +6,21 @@ function _M.get() local _T = {} local tags = { - "󰎤 Terminal", - "󰎧 Web", - "󰎪 Code", - "󰎭 Junk", - "󰎱 Music", - "󰎳 Chat", + "Terminal", + "Web", + "Code", + "Junk", + "Music", + "Chat", } local layouts = { - RC.layouts[0], RC.layouts[1], RC.layouts[2], RC.layouts[3], - RC.layouts[3], - RC.layouts[3], + RC.layouts[4], + RC.layouts[4], + RC.layouts[4], } awful.screen.connect_for_each_screen(function(s) diff --git a/main/user_vars.lua b/main/user_vars.lua index 47e01a0..fccc442 100644 --- a/main/user_vars.lua +++ b/main/user_vars.lua @@ -1,8 +1,13 @@ +local awful = require("awful") + local _M = {} function _M.get() local _V = {} + awful.spawn.with_shell("picom -b") + awful.spawn.with_shell("nm-applet") + _V = { terminal = "alacritty", editor = os.getenv("EDITOR") or "nvim", diff --git a/rc.lua b/rc.lua index 9823d40..30ec3f7 100644 --- a/rc.lua +++ b/rc.lua @@ -2,7 +2,6 @@ -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, "luarocks.loader") -local gears = require("gears") local awful = require("awful") local beautiful = require("beautiful") require("awful.autofocus") @@ -10,7 +9,7 @@ require("awful.autofocus") local main = require("main") local bindings = require("bindings") local theme = require("theme") -local statusbar = require("deco.statusbar") +local screen = require("deco.screens") beautiful.init(theme) @@ -19,11 +18,9 @@ RC.vars = main.user_vars() RC.layouts = main.layouts() RC.tags = main.tags() -awful.spawn.with_shell("picom -b") - awful.layout.layouts = RC.layouts -awful.screen.connect_for_each_screen(statusbar) +screen() -- Set keys root.buttons(bindings.global_buttons()) diff --git a/statusbar/bottom/statusbar.lua b/statusbar/bottom/statusbar.lua new file mode 100644 index 0000000..65040af --- /dev/null +++ b/statusbar/bottom/statusbar.lua @@ -0,0 +1,17 @@ +local awful = require("awful") +local wibox = require("wibox") + +return function(s) + local widgets = require("statusbar.bottom.widgets") + + -- Create the wibox + s.bottom_wibox = awful.wibar({ position = "bottom", screen = s }) + + -- Add widgets to the wibox + s.bottom_wibox:setup({ + layout = wibox.layout.align.horizontal, + s.taglist, -- Left widgets + nil, + widgets(s) + }) +end diff --git a/statusbar/bottom/widgets.lua b/statusbar/bottom/widgets.lua new file mode 100644 index 0000000..530c0e0 --- /dev/null +++ b/statusbar/bottom/widgets.lua @@ -0,0 +1,33 @@ +local wibox = require("wibox") +local widgets = require("widgets") + +local _M = {} + +_M.battery_widget = widgets.battery(false) +_M.volume_widget = widgets.volume() + +function _M.get() + return { + layout = wibox.layout.fixed.horizontal, + spacing = 7, + spacing_widget = wibox.widget.separator({ + orientation = "vertical", + color = "#333", + thickness = 2, + span_ratio = 0.75, + }), + _M.volume_widget, + _M.battery_widget, + widgets.text_clock(), + } +end + +function _M.get_battery_widget() + return _M.battery_widget +end + +return setmetatable(_M, { + __call = function(_, ...) + return _M.get(...) + end, +}) diff --git a/statusbar/top/statusbar.lua b/statusbar/top/statusbar.lua new file mode 100644 index 0000000..f6bee3b --- /dev/null +++ b/statusbar/top/statusbar.lua @@ -0,0 +1,17 @@ +local awful = require("awful") +local wibox = require("wibox") + +local widgets = require("statusbar.top.widgets") + +return function(s) + -- Create the wibox + s.top_wibox = awful.wibar({ position = "top", screen = s }) + + -- Add widgets to the wibox + s.top_wibox:setup({ + layout = wibox.layout.align.horizontal, + nil, + s.tasklist, -- Middle widget + widgets(s), -- Right widgets + }) +end diff --git a/statusbar/top/widgets.lua b/statusbar/top/widgets.lua new file mode 100644 index 0000000..752db67 --- /dev/null +++ b/statusbar/top/widgets.lua @@ -0,0 +1,19 @@ +local wibox = require("wibox") +local separator = require("widgets.separator") + +local _M = {} + +function _M.get(s) + return { + layout = wibox.layout.fixed.horizontal, + wibox.widget.systray(), + separator, + s.layoutbox, + } +end + +return setmetatable({}, { + __call = function(_, ...) + return _M.get(...) + end, +}) diff --git a/theme/background.jpg b/theme/background.jpg deleted file mode 100644 index 37a8d0b..0000000 Binary files a/theme/background.jpg and /dev/null differ diff --git a/theme/elements.lua b/theme/elements.lua new file mode 100644 index 0000000..eed67a1 --- /dev/null +++ b/theme/elements.lua @@ -0,0 +1,38 @@ +local gmc = require("theme.gmc") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local elements = {} + +elements.font = "sans 8" + +elements.useless_gap = dpi(3) +elements.border_width = dpi(2) + +elements.border_normal = gmc.color["green300"] .. "11" +elements.border_focus = gmc.color["green800"] .. "11" +elements.border_marked = gmc.color["green500"] .. "11" + +elements.bg_normal = gmc.color["white"] .. "44" +elements.bg_focus = gmc.color["green200"] .. "44" +elements.bg_urgent = gmc.color["orange900"] .. "44" +elements.bg_minimize = gmc.color["grey500"] .. "44" +elements.bg_systray = gmc.color["grey800"] .. "44" + +elements.systray_icon_spacing = dpi(5) + +elements.fg_normal = gmc.color["black"] +elements.fg_focus = gmc.color["white"] +elements.fg_urgent = gmc.color["white"] +elements.fg_minimize = gmc.color["white"] + +elements.taglist_bg_focus = gmc.color["green400"] .. "44" +elements.taglist_fg_focus = gmc.color["white"] +elements.taglist_separator = gmc.color["green300"] +elements.taglist_bg_tag = gmc.color["green600"] .. "88" + +elements.tasklist_bg_normal = gmc.color["green300"] .. "44" +elements.tasklist_bg_focus = gmc.color["green800"] .. "44" +elements.tasklist_fg_focus = gmc.color["black"] + +return elements diff --git a/theme/gmc.lua b/theme/gmc.lua new file mode 100644 index 0000000..44654ef --- /dev/null +++ b/theme/gmc.lua @@ -0,0 +1,144 @@ +local _M = {} + +-- google material colors +-- https://material.io/guidelines/style/color.html + +-- Associative Array (Hash) + +_M.color = { + ['white'] = '#ffffff', + ['black'] = '#000000', + + ['grey50'] = '#fafafa', + ['grey100'] = '#f5f5f5', + ['grey200'] = '#eeeeee', + ['grey300'] = '#e0e0e0', + ['grey400'] = '#bdbdbd', + ['grey500'] = '#9e9e9e', + ['grey600'] = '#757575', + ['grey700'] = '#616161', + ['grey800'] = '#424242', + ['grey900'] = '#212121', + + ['red50'] = '#ffebee', + ['red100'] = '#ffcdd2', + ['red200'] = '#ef9a9a', + ['red300'] = '#e57373', + ['red400'] = '#ef5350', + ['red500'] = '#f44336', + ['red600'] = '#e53935', + ['red700'] = '#d32f2f', + ['red800'] = '#c62828', + ['red900'] = '#b71c1c', + ['redA100'] = '#ff8a80', + ['redA200'] = '#ff5252', + ['redA400'] = '#ff1744', + ['redA700'] = '#d50000', + + ['pink50'] = '#fce4ec', + ['pink100'] = '#f8bbd0', + ['pink200'] = '#f48fb1', + ['pink300'] = '#f06292', + ['pink400'] = '#ec407a', + ['pink500'] = '#e91e63', + ['pink600'] = '#d81b60', + ['pink700'] = '#c2185b', + ['pink800'] = '#ad1457', + ['pink900'] = '#880e4f', + ['pinkA100'] = '#ff80ab', + ['pinkA200'] = '#ff4081', + ['pinkA400'] = '#f50057', + ['pinkA700'] = '#c51162', + + ['blue50'] = '#e3f2fd', + ['blue100'] = '#bbdefb', + ['blue200'] = '#90caf9', + ['blue300'] = '#64b5f6', + ['blue400'] = '#42a5f5', + ['blue500'] = '#2196f3', + ['blue600'] = '#1e88e5', + ['blue700'] = '#1976d2', + ['blue800'] = '#1565c0', + ['blue900'] = '#0d47a1', + ['blueA100'] = '#82b1ff', + ['blueA200'] = '#448aff', + ['blueA400'] = '#2979ff', + ['blueA700'] = '#2962ff', + + ['yellow50'] = '#fffde7', + ['yellow100'] = '#fff9c4', + ['yellow200'] = '#fff59d', + ['yellow300'] = '#fff176', + ['yellow400'] = '#ffee58', + ['yellow500'] = '#ffeb3b', + ['yellow600'] = '#fdd835', + ['yellow700'] = '#fbc02d', + ['yellow800'] = '#f9a825', + ['yellow900'] = '#f57f17', + ['yellowA100'] = '#ffff8d', + ['yellowA200'] = '#ffff00', + ['yellowA400'] = '#ffea00', + ['yellowA700'] = '#ffd600', + + ['teal50'] = '#e0f2f1', + ['teal100'] = '#b2dfdb', + ['teal200'] = '#80cbc4', + ['teal300'] = '#4db6ac', + ['teal400'] = '#26a69a', + ['teal500'] = '#009688', + ['teal600'] = '#00897b', + ['teal700'] = '#00796b', + ['teal800'] = '#00695c', + ['teal900'] = '#004d40', + ['tealA100'] = '#a7ffeb', + ['tealA200'] = '#64ffda', + ['tealA400'] = '#1de9b6', + ['tealA700'] = '#00bfa5', + + ['green50'] = '#e8f5e9', + ['green100'] = '#c8e6c9', + ['green200'] = '#a5d6a7', + ['green300'] = '#81c784', + ['green400'] = '#66bb6a', + ['green500'] = '#4caf50', + ['green600'] = '#43a047', + ['green700'] = '#388e3c', + ['green800'] = '#2e7d32', + ['green900'] = '#1b5e20', + ['greenA100'] = '#b9f6ca', + ['greenA200'] = '#69f0ae', + ['greenA400'] = '#00e676', + ['greenA700'] = '#00c853', + + ['orange50'] = '#fff3e0', + ['orange100'] = '#ffe0b2', + ['orange200'] = '#ffcc80', + ['orange300'] = '#ffb74d', + ['orange400'] = '#ffa726', + ['orange500'] = '#ff9800', + ['orange600'] = '#fb8c00', + ['orange700'] = '#f57c00', + ['orange800'] = '#ef6c00', + ['orange900'] = '#e65100', + ['orangeA100'] = '#ffd180', + ['orangeA200'] = '#ffab40', + ['orangeA400'] = '#ff9100', + ['orangeA700'] = '#ff6d00', + + ['deepOrange50'] = '#fbe9e7', + ['deepOrange100'] = '#ffccbc', + ['deepOrange200'] = '#ffab91', + ['deepOrange300'] = '#ff8a65', + ['deepOrange400'] = '#ff7043', + ['deepOrange500'] = '#ff5722', + ['deepOrange600'] = '#f4511e', + ['deepOrange700'] = '#e64a19', + ['deepOrange800'] = '#d84315', + ['deepOrange900'] = '#bf360c', + ['deepOrangeA100'] = '#ff9e80', + ['deepOrangeA200'] = '#ff6e40', + ['deepOrangeA400'] = '#ff3d00', + ['deepOrangeA700'] = '#dd2c00' +} + +return _M diff --git a/theme/init.lua b/theme/init.lua index 82ff74b..b0c47db 100644 --- a/theme/init.lua +++ b/theme/init.lua @@ -1,129 +1,23 @@ ---------------------------- --- Default awesome theme -- ---------------------------- - -local theme_assets = require("beautiful.theme_assets") -local xresources = require("beautiful.xresources") -local dpi = xresources.apply_dpi - -local gfs = require("gears.filesystem") -local themes_path = gfs.get_themes_dir() +local awful = require("awful") +local gears = require("gears") +awful.util = require("awful.util") local theme = {} -theme.font = "sans 8" +local elements = require("theme.elements") +theme = gears.table.join(theme, elements) -theme.bg_normal = "#222222" -theme.bg_focus = "#535d6c" -theme.bg_urgent = "#ff0000" -theme.bg_minimize = "#444444" -theme.bg_systray = theme.bg_normal +local layout_icons = require("theme.layout_icons") +theme = gears.table.join(theme, layout_icons) -theme.fg_normal = "#aaaaaa" -theme.fg_focus = "#ffffff" -theme.fg_urgent = "#ffffff" -theme.fg_minimize = "#ffffff" +local titlebar = require("theme.titlebar") +theme = gears.table.join(theme, titlebar) -theme.useless_gap = dpi(0) -theme.border_width = dpi(1) -theme.border_normal = "#000000" -theme.border_focus = "#535d6c" -theme.border_marked = "#91231c" +local widgets = require("theme.widgets") +theme = gears.table.join(theme, widgets) --- There are other variable sets --- overriding the default one when --- defined, the sets are: --- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] --- tasklist_[bg|fg]_[focus|urgent] --- titlebar_[bg|fg]_[normal|focus] --- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] --- mouse_finder_[color|timeout|animate_timeout|radius|factor] --- prompt_[fg|bg|fg_cursor|bg_cursor|font] --- hotkeys_[bg|fg|border_width|border_color|shape|opacity|modifiers_fg|label_bg|label_fg|group_margin|font|description_font] --- Example: ---theme.taglist_bg_focus = "#ff0000" - --- Generate taglist squares: -local taglist_square_size = dpi(4) -theme.taglist_squares_sel = theme_assets.taglist_squares_sel( - taglist_square_size, theme.fg_normal -) -theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( - taglist_square_size, theme.fg_normal -) - --- Variables set for theming notifications: --- notification_font --- notification_[bg|fg] --- notification_[width|height|margin] --- notification_[border_color|border_width|shape|opacity] - --- 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(15) -theme.menu_width = dpi(100) - --- You can add as many variables as --- you wish and access them by using --- beautiful.variable in your rc.lua ---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_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_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_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 = themes_path.."default/background.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" - --- Generate Awesome icon: -theme.awesome_icon = theme_assets.awesome_icon( - theme.menu_height, theme.bg_focus, theme.fg_focus -) - --- Define the icon theme for application icons. If not set then the icons --- from /usr/share/icons and /usr/share/icons/hicolor will be used. -theme.icon_theme = nil +theme.icon_theme = "Arc" +theme.font = "JetBrainsMono Nerd Font Mono 10" +theme.wallpaper = os.getenv("HOME") .. "/Pictures/background.jpg" return theme diff --git a/theme/layout_icons.lua b/theme/layout_icons.lua new file mode 100644 index 0000000..2467782 --- /dev/null +++ b/theme/layout_icons.lua @@ -0,0 +1,23 @@ +local gfs = require("gears.filesystem") +local theme_path = gfs.get_themes_dir() + +local icons = {} + +icons.layout_fairh = theme_path .. "zenburn/layouts/fairh.png" +icons.layout_fairv = theme_path .. "zenburn/layouts/fairv.png" +icons.layout_floating = theme_path .. "zenburn/layouts/floating.png" +icons.layout_magnifier = theme_path .. "zenburn/layouts/magnifier.png" +icons.layout_max = theme_path .. "zenburn/layouts/max.png" +icons.layout_fullscreen = theme_path .. "zenburn/layouts/fullscreen.png" +icons.layout_tilebottom = theme_path .. "zenburn/layouts/tilebottom.png" +icons.layout_tileleft = theme_path .. "zenburn/layouts/tileleft.png" +icons.layout_tile = theme_path .. "zenburn/layouts/tile.png" +icons.layout_tiletop = theme_path .. "zenburn/layouts/tiletop.png" +icons.layout_spiral = theme_path .. "zenburn/layouts/spiral.png" +icons.layout_dwindle = theme_path .. "zenburn/layouts/dwindle.png" +icons.layout_cornernw = theme_path .. "zenburn/layouts/cornernw.png" +icons.layout_cornerne = theme_path .. "zenburn/layouts/cornerne.png" +icons.layout_cornersw = theme_path .. "zenburn/layouts/cornersw.png" +icons.layout_cornerse = theme_path .. "zenburn/layouts/cornerse.png" + +return icons diff --git a/theme/titlebar.lua b/theme/titlebar.lua new file mode 100644 index 0000000..8f8f817 --- /dev/null +++ b/theme/titlebar.lua @@ -0,0 +1,20 @@ +local gmc = require("theme.gmc") +local icon_path = "/usr/share/icons/Papirus-Dark/22x22" + +local titlebar = {} + +titlebar.titlebar_fg_normal = gmc.color["black"] +titlebar.titlebar_fg_focus = gmc.color["green100"] + +titlebar.titlebar_close_button_normal = icon_path .. "/actions/window-close.svg" +titlebar.titlebar_close_button_focus = icon_path .. "/actions/window-close.svg" + +titlebar.titlebar_minimize_button_normal = icon_path .. "/actions/list-remove.svg" +titlebar.titlebar_minimize_button_focus = icon_path .. "/actions/list-remove.svg" + +titlebar.titlebar_maximized_button_normal_inactive = icon_path .. "/actions/list-add.svg" +titlebar.titlebar_maximized_button_focus_inactive = icon_path .. "/actions/list-add.svg" +titlebar.titlebar_maximized_button_normal_active = icon_path .. "/actions/go-bottom.svg" +titlebar.titlebar_maximized_button_focus_active = icon_path .. "/actions/go-bottom.svg" + +return titlebar diff --git a/theme/wallpaper.lua b/theme/wallpaper.lua deleted file mode 100644 index c8a5542..0000000 --- a/theme/wallpaper.lua +++ /dev/null @@ -1 +0,0 @@ -return require("gears.filesystem").get_themes_dir() .. "background.png" diff --git a/theme/widgets.lua b/theme/widgets.lua new file mode 100644 index 0000000..5cd56d9 --- /dev/null +++ b/theme/widgets.lua @@ -0,0 +1,29 @@ +local gmc = require("theme.gmc") +local icon_path = "/usr/share/icons/Papirus-Dark/22x22" + +local widgets = {} + +function widgets.battery_icon(icon) + icon = icon or "battery-missing" + return icon_path .. "/panel/" .. icon:gsub("'", "") .. ".svg" +end + +widgets.battery_text_color_charging = gmc.color["green900"] +widgets.battery_text_color_full = gmc.color["green900"] +widgets.battery_text_color_medium = gmc.color["yellow900"] +widgets.battery_text_color_low = gmc.color["orange900"] +widgets.battery_text_color_critical = gmc.color["red900"] + +widgets.clock_icon = icon_path .. "/actions/clock.svg" +widgets.clock_text_color = gmc.color["black"] +widgets.clock_date_color = gmc.color["green300"] + +widgets.net_internt_connected_icon = icon_path .. "/status/network-wireless-connected.svg" +widgets.net_internt_disconnected_icon = icon_path .. "/status/network-wireless-disconnected.svg" + +widgets.volume_high_icon = icon_path .. "/panel/audio-volume-high.svg" +widgets.volume_medium_icon = icon_path .. "/panel/audio-volume-medium.svg" +widgets.volume_low_icon = icon_path .. "/panel/audio-volume-low.svg" +widgets.volume_muted_icon = icon_path .. "/panel/audio-volume-muted.svg" + +return widgets diff --git a/widgets/battery.lua b/widgets/battery.lua new file mode 100644 index 0000000..abe7095 --- /dev/null +++ b/widgets/battery.lua @@ -0,0 +1,85 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local wibox = require("wibox") + +local _M = {} + +function _M.update(stdout) + local bat_now = { + present = "N/A", + state = "N/A", + warninglevel = "N/A", + energy = "N/A", + energyfull = "N/A", + energyrate = "N/A", + voltage = "N/A", + percentage = "N/A", + capacity = "N/A", + icon = "N/A", + } + + for k, v in stdout:gmatch("([%a]+[%a|-]+):%s*([%a|%d|']+[,|%a|%d|'|-]+)") do + if k == "present" then + bat_now.present = v + elseif k == "state" then + bat_now.state = v + elseif k == "warning-level" then + bat_now.warninglevel = v + elseif k == "energy" then + bat_now.energy = v:gsub(",", ".") -- Wh + elseif k == "energy-full" then + bat_now.energyfull = v:gsub(",", ".") -- Wh + elseif k == "energy-rate" then + bat_now.energyrate = v:gsub(",", ".") -- W + elseif k == "voltage" then + bat_now.voltage = v:gsub(",", ".") -- V + elseif k == "percentage" then + bat_now.percentage = tonumber(v) -- % + elseif k == "capacity" then + bat_now.capacity = v:gsub(",", ".") -- % + elseif k == "icon-name" then + bat_now.icon = v + end + end + + return bat_now +end + +function _M.get(show_percentage) + _M.show_percentage = show_percentage or true + local battery = awful.widget.watch( + { + awful.util.shell, + "-c", + "upower -i /org/freedesktop/UPower/devices/battery_BAT0 | sed -n '/present/,/icon-name/p'", + }, + 1, + function(widget, stdout) + local bat_now = _M.update(stdout) + + local icon = wibox.widget.imagebox(beautiful.battery_icon(bat_now.icon) or beautiful.battery_icon_full) + local text = wibox.widget.textbox(bat_now.percentage .. "%") + + widget.children = { + (_M.show_percentage and text) or wibox.widget.textbox(), + icon + } + end, + wibox.widget { + layout = wibox.layout.fixed.horizontal, + } + ) + + battery.toggle_percentage = function() + _M.show_percentage = not _M.show_percentage + battery:emit_signal("widget::redraw_needed") + end + + return battery +end + +return setmetatable({}, { + __call = function(_, ...) + return _M.get(...) + end, +}) diff --git a/widgets/init.lua b/widgets/init.lua new file mode 100644 index 0000000..060c242 --- /dev/null +++ b/widgets/init.lua @@ -0,0 +1,7 @@ +return { + battery = require("widgets.battery"), + volume = require("widgets.volume"), + separator = require("widgets.separator"), + text_clock = require("widgets.text_clock"), + net_widget = require("widgets.net_widgets").wireless({interface="wlp2s0", popup_position = "bottom_right"}), +} diff --git a/widgets/net_widgets b/widgets/net_widgets new file mode 160000 index 0000000..13bc07b --- /dev/null +++ b/widgets/net_widgets @@ -0,0 +1 @@ +Subproject commit 13bc07b8759d99e8aa03e7864ec34ff7dd4d2467 diff --git a/widgets/separator.lua b/widgets/separator.lua new file mode 100644 index 0000000..24d6d8e --- /dev/null +++ b/widgets/separator.lua @@ -0,0 +1,3 @@ +local wibox = require("wibox") + +return wibox.widget.textbox(" | ") diff --git a/widgets/text_clock.lua b/widgets/text_clock.lua new file mode 100644 index 0000000..89b6560 --- /dev/null +++ b/widgets/text_clock.lua @@ -0,0 +1,32 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local wibox = require("wibox") + +local lain = require("lain") +local markup = lain.util.markup + +local _M = {} + +function _M.get(icon) + if not icon then + icon = wibox.widget.imagebox(beautiful.clock_icon) + end + + local clock = awful.widget.textclock( + markup(beautiful.clock_date_color, "%A %B %d ") + .. markup(beautiful.clock_text_color, ">") + .. markup(beautiful.clock_text_color, " %I:%M %p ") + ) + + return wibox.widget({ + icon, + clock, + layout = wibox.layout.fixed.horizontal, + }) +end + +return setmetatable({}, { + __call = function(_, ...) + return _M.get(...) + end, +}) diff --git a/widgets/volume.lua b/widgets/volume.lua new file mode 100644 index 0000000..710b0b6 --- /dev/null +++ b/widgets/volume.lua @@ -0,0 +1,68 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local wibox = require("wibox") + +local _M = {} + +function _M.update(stdout) + local vol_now = { + volume = "N/A", + muted = "N/A", + icon = "N/A", + } + + vol_now.volume = stdout:gsub("%s+", "") + vol_now.volume = vol_now.volume:gsub("%%", "") + if vol_now.volume == "muted" then + vol_now.muted = true + vol_now.volume = -1 + else + vol_now.volume = tonumber(vol_now.volume) + vol_now.muted = false + end + + if vol_now.muted or vol_now.volume == 0 then + vol_now.icon = beautiful.volume_muted_icon + elseif vol_now.volume >= 66 then + vol_now.icon = beautiful.volume_high_icon + elseif vol_now.volume >= 33 then + vol_now.icon = beautiful.volume_medium_icon + else + vol_now.icon = beautiful.volume_low_icon + end + + return vol_now +end + +function _M.get() + local volume = awful.widget.watch( + { + awful.util.shell, + "-c", + "pamixer --get-volume-human", + }, + 1, + function(widget, stdout) + local vol_now = _M.update(stdout) + + local icon = wibox.widget.imagebox(vol_now.icon) + local text = wibox.widget.textbox(vol_now.volume .. "% ") + + widget.children = { + text, + icon, + } + end, + wibox.widget({ + layout = wibox.layout.fixed.horizontal, + }) + ) + + return volume +end + +return setmetatable({}, { + __call = function(_, ...) + return _M.get(...) + end, +})