commit 90a19a38d04716bae08533c0f40741c4a44820f9 Author: Kristof Vandam Date: Wed Nov 11 15:00:59 2020 +0100 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ed99df --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Vicious + +Vicious is a library that can retrieve many different data of the system. +It's meant to be used with own custom widgets. +The directory is a git clone, so you can keep it up to date. +More info at: https://github.com/vicious-widgets/vicious diff --git a/bindings/keys.lua b/bindings/keys.lua new file mode 100644 index 0000000..4d1a59d --- /dev/null +++ b/bindings/keys.lua @@ -0,0 +1,262 @@ +local awful = require('awful') +local hotkeys_popup = require("awful.hotkeys_popup") +local menubar = require("menubar") + +require("awful.hotkeys_popup.keys") + +modkey = "Mod4" + +-- {{{ Key bindings + +-- General Awesome keys +awful.keyboard.append_global_keybindings({ + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + {description="show help", group="awesome"}), + awful.key({ modkey, }, "w", function () mymainmenu:show() end, + {description = "show main menu", group = "awesome"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, + {description = "quit awesome", group = "awesome"}), + 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"}), + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, + {description = "run prompt", group = "launcher"}), + awful.key({ modkey }, "p", function() menubar.show() end, + {description = "show the menubar", group = "launcher"}), +}) + +-- Tags related keybindings +awful.keyboard.append_global_keybindings({ + 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"}), +}) + +-- Focus related keybindings +awful.keyboard.append_global_keybindings({ + 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, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "go back", 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, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + c:activate { raise = true, context = "key.unminimize" } + end + end, + {description = "restore minimized", group = "client"}), +}) + +-- Layout related keybindings +awful.keyboard.append_global_keybindings({ + 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, }, "u", awful.client.urgent.jumpto, + {description = "jump to urgent client", group = "client"}), + 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.keyboard.append_global_keybindings({ + awful.key( + {}, + 'XF86MonBrightnessUp', + function() + awful.spawn('redshift -b 1 -o -P -l 51.14:4.21', false) + awesome.emit_signal('widget::brightness') + awesome.emit_signal('module::brightness_osd:show', true) + end, + {description = 'increase brightness by 10%', group = 'hotkeys'} + ), + awful.key( + {}, + 'XF86MonBrightnessDown', + function() + awful.spawn('redshift -b 0.3 -o -P -l 51.14:4.21', false) + awesome.emit_signal('widget::brightness') + awesome.emit_signal('module::brightness_osd:show', true) + end, + {description = 'decrease brightness by 10%', group = 'hotkeys'} + ), + awful.key { + modifiers = { modkey }, + keygroup = "numrow", + description = "only view tag", + group = "tag", + on_press = function (index) + local screen = awful.screen.focused() + local tag = screen.tags[index] + if tag then + tag:view_only() + end + end, + }, + awful.key { + modifiers = { modkey, "Control" }, + keygroup = "numrow", + description = "toggle tag", + group = "tag", + on_press = function (index) + local screen = awful.screen.focused() + local tag = screen.tags[index] + if tag then + awful.tag.viewtoggle(tag) + end + end, + }, + awful.key { + modifiers = { modkey, "Shift" }, + keygroup = "numrow", + description = "move focused client to tag", + group = "tag", + on_press = function (index) + if client.focus then + local tag = client.focus.screen.tags[index] + if tag then + client.focus:move_to_tag(tag) + end + end + end, + }, + awful.key { + modifiers = { modkey, "Control", "Shift" }, + keygroup = "numrow", + description = "toggle focused client on tag", + group = "tag", + on_press = function (index) + if client.focus then + local tag = client.focus.screen.tags[index] + if tag then + client.focus:toggle_tag(tag) + end + end + end, + }, + awful.key { + modifiers = { modkey }, + keygroup = "numpad", + description = "select layout directly", + group = "layout", + on_press = function (index) + local t = awful.screen.focused().selected_tag + if t then + t.layout = t.layouts[index] or t.layout + end + end, + } +}) + +client.connect_signal("request::default_mousebindings", function() + awful.mouse.append_client_mousebindings({ + awful.button({ }, 1, function (c) + c:activate { context = "mouse_click" } + end), + awful.button({ modkey }, 1, function (c) + c:activate { context = "mouse_click", action = "mouse_move" } + end), + awful.button({ modkey }, 3, function (c) + c:activate { context = "mouse_click", action = "mouse_resize"} + end), + }) +end) + +client.connect_signal("request::default_keybindings", function() + awful.keyboard.append_client_keybindings({ + awful.key({ modkey, }, "f", + function (c) + c.fullscreen = not c.fullscreen + c:raise() + end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey, "Shift" }, "c", 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"}), + }) +end) + +-- }}} diff --git a/modules/client.lua b/modules/client.lua new file mode 100644 index 0000000..640fb47 --- /dev/null +++ b/modules/client.lua @@ -0,0 +1,8 @@ +local gears = require('gears') + +-- Create rounded corners for windows +client.connect_signal("manage", function (c) + c.shape = function(cr,w,h) + gears.shape.rounded_rect(cr,w,h,4) + end +end) \ No newline at end of file diff --git a/modules/panel.lua b/modules/panel.lua new file mode 100644 index 0000000..749783b --- /dev/null +++ b/modules/panel.lua @@ -0,0 +1,114 @@ +local awful = require('awful') +local wibox = require('wibox') +local gears = require('gears') + +local vicious = require("../vicious") +local battery = require('../widgets/battery') +--local volume = require('../widgets/volume') +local date = require('../widgets/date') + + +require("../modules.widget") + + +modkey = "Mod4" + +-- Keyboard map indicator and switcher +mykeyboardlayout = awful.widget.keyboardlayout() + +screen.connect_signal("request::desktop_decoration", function(s) + -- Each screen has its own tag table. + awful.tag({ "main", "term", "dev", "browse", "social", "misc" }, 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 { + screen = s, + buttons = { + 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, + widget_template = { + { + { + { + id = 'text_role', + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + left = 18, + right = 18, + widget = wibox.container.margin + }, + id = 'background_role', + widget = wibox.container.background, + }, + buttons = { + 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), + } + } + + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = { + awful.button({ }, 1, function (c) + c:activate { context = "tasklist", action = "toggle_minimization" } + 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), + } + } + + -- Create the wibox + s.mywibox = awful.wibar({ position = "top", height = 48, screen = s }) + + -- Add widgets to the wibox + s.mywibox.widget = { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + mylauncher, + s.mytaglist, + s.mypromptbox, + s.mytasklist + }, + nil, + -- s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + s.mylayoutbox, + -- mykeyboardlayout, + -- wibox.widget.systray(), + battery, + date, + }, + } +end) \ No newline at end of file diff --git a/modules/sidepanel.lua b/modules/sidepanel.lua new file mode 100644 index 0000000..edc0789 --- /dev/null +++ b/modules/sidepanel.lua @@ -0,0 +1,33 @@ +local awful = require('awful') +local wibox = require('wibox') +local timer = require("gears.timer") +local beautiful = require('beautiful') +local dpi = beautiful.xresources.apply_dpi + +screen.connect_signal("request::desktop_decoration", function(s) + local dock = awful.wibox({ + x = s.workarea.width, + y = 0, + ontop = true, + stretch = false, + width = dpi(64), + height = s.workarea.height, + visible = false + }) + local dock_trigger = awful.wibox({ + position = "left", + width = 1, + bg = "#00000000", + opacity = 0, + ontop = true, + visible = true + }) + local dock_hide_timer = timer({ timeout = 1}) + + dock_trigger:geometry({ width = 5, height = s.workarea.height }) + dock_hide_timer:connect_signal("timeout", function() dock.visible = false; dock_hide_timer:stop() end ) + + dock_trigger:connect_signal("mouse::enter", function() dock.visible = true end) + dock:connect_signal("mouse::enter", function() if dock_hide_timer.started then dock_hide_timer:stop() end end) + dock:connect_signal("mouse::leave", function() dock_hide_timer:again() end) +end) \ No newline at end of file diff --git a/modules/titlebar.lua b/modules/titlebar.lua new file mode 100644 index 0000000..7a72d71 --- /dev/null +++ b/modules/titlebar.lua @@ -0,0 +1,104 @@ +local awful = require("awful") +local gears = require("gears") +local beautiful = require("beautiful") +local wibox = require("wibox") + +local dpi = beautiful.xresources.apply_dpi + +client.connect_signal("request::titlebars", function(c) + local buttons = { + awful.button({ }, 1, function() + c:activate { context = "titlebar", action = "mouse_move" } + end), + awful.button({ }, 3, function() + c:activate { context = "titlebar", action = "mouse_resize"} + end), + } + + local titlebar_image_top = gears.surface(beautiful.titlebar_image_top) + local titlebar_image_middle = gears.surface(beautiful.titlebar_image_middle) + local titlebar_image_bottom = gears.surface(beautiful.titlebar_image_bottom) + local titlebar_image_top_width, titlebar_image_top_height = gears.surface.get_size(titlebar_image_top) + local titlebar_image_middle_width, titlebar_image_middle_height = gears.surface.get_size(titlebar_image_middle) + local titlebar_image_bottom_width, titlebar_image_bottom_height = gears.surface.get_size(titlebar_image_bottom) + local function bg_image_function(_, cr, width, height) + -- draw vertical top image + cr:set_source_surface(titlebar_image_top, 0, 0) + cr:paint() + + -- clip/mask the filing middle image + cr:save() + local mask_height = height - titlebar_image_top_height - titlebar_image_bottom_height + cr:set_source_rgba(0,1,0,1) + cr:rectangle(0, titlebar_image_top_height, width, mask_height) + cr:clip() + + for count=1, math.floor(height / titlebar_image_middle_height), 1 do + cr:set_source_surface(titlebar_image_middle, 0, count * titlebar_image_middle_height) + cr:paint() + end + cr:restore() + + -- draw vertical bottom image + cr:set_source_surface(titlebar_image_bottom, 0, height - titlebar_image_bottom_height) + cr:paint() + end + + local function decorate_titlebar(c, pos, bg, size) + print('Decorating titlebar') + c.titlebar_position = pos + local args = { + size = beautiful.titlebar_size or titlebar_image_middle_width, + position = 'left', + bg_normal = '#FFFFFF00', + bg_focus = '#FFFFFF00', + bgimage_normal = bg_image_function, + bgimage_focus = bg_image_function + } + awful.titlebar(c, args) : setup { + { -- Top + { + awful.titlebar.widget.closebutton(c), + awful.titlebar.widget.minimizebutton(c), + awful.titlebar.widget.maximizedbutton(c), + spacing = dpi(beautiful.titlebar_button_spacing), + layout = wibox.layout.fixed.vertical + }, + left = dpi(beautiful.titlebar_button_margin_left), + right = dpi(beautiful.titlebar_button_margin_right), + top = dpi(beautiful.titlebar_button_margin_top), + bottom = dpi(beautiful.titlebar_button_margin_bottom), + widget = wibox.container.margin + }, + { -- Middle + wibox.container { + { -- Title + align = "center", + widget = awful.titlebar.widget.titlewidget(c) + }, + direction = 'east', + widget = wibox.container.rotate + }, + buttons = buttons, + layout = wibox.layout.flex.vertical + }, + { -- Bottom + { + awful.titlebar.widget.ontopbutton(c), + awful.titlebar.widget.floatingbutton(c), + spacing = dpi(beautiful.titlebar_button_spacing), + layout = wibox.layout.fixed.vertical + }, + left = dpi(beautiful.titlebar_button_margin_left), + right = dpi(beautiful.titlebar_button_margin_right), + top = dpi(beautiful.titlebar_button_margin_top), + bottom = dpi(beautiful.titlebar_button_margin_bottom), + widget = wibox.container.margin + }, + layout = wibox.layout.align.vertical + } + end + + decorate_titlebar(c) +end) + diff --git a/modules/widget.lua b/modules/widget.lua new file mode 100644 index 0000000..86bf240 --- /dev/null +++ b/modules/widget.lua @@ -0,0 +1,78 @@ +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = require("gears") +local cairo = require("lgi").cairo +local dpi = beautiful.xresources.apply_dpi + +local widget_pill_top_left = gears.surface(beautiful.widget_pill_top_left) +local widget_pill_top_right = gears.surface(beautiful.widget_pill_top_right) +local widget_pill_bottom_left = gears.surface(beautiful.widget_pill_bottom_left) +local widget_pill_bottom_right = gears.surface(beautiful.widget_pill_bottom_right) +local widget_pill_top_left_width, widget_pill_top_left_height = gears.surface.get_size(widget_pill_top_left) +local widget_pill_top_right_width, widget_pill_top_right_height = gears.surface.get_size(widget_pill_top_right) +local widget_pill_bottom_left_width, widget_pill_bottom_left_height = gears.surface.get_size(widget_pill_bottom_left) +local widget_pill_bottom_right_width, widget_pill_bottom_right_height = gears.surface.get_size(widget_pill_bottom_right) + +function pill(content, color) + local color_default = "#00ff00" + + local function compose_background(_, cr, width, height) + + cr:push_group_with_content(cairo.Content.ALPHA) + + -- draw top left + cr:set_source_surface(widget_pill_top_left, 0, 0) + cr:paint() + + -- draw top right + cr:set_source_surface(widget_pill_top_right, width - widget_pill_top_right_width, 0) + cr:paint() + + -- draw bottom left + cr:set_source_surface(widget_pill_bottom_left, 0, height - widget_pill_bottom_left_height) + cr:paint() + + -- draw bottom right + cr:set_source_surface(widget_pill_bottom_right, width - widget_pill_bottom_right_width, height - widget_pill_bottom_left_height) + cr:paint() + + -- fill horizontal + cr:set_source_rgba(0,0,0,1) + cr:rectangle(0, widget_pill_top_left_height, width, height - (widget_pill_top_left_height + widget_pill_bottom_left_height)) + cr:fill() + + -- fill vertical + cr:set_source_rgba(0,0,0,1) + cr:rectangle(widget_pill_top_left_width, 0, width - (widget_pill_top_left_width + widget_pill_top_right_width), height) + cr:fill() + + local mask = cr:pop_group() + + cr:set_operator(cairo.Operator.SOURCE) + cr:set_source_rgba(gears.color.parse_color(color or color_default)) + cr:rectangle(0, 0, width, height) + + cr:mask(mask) + end + + return wibox.container { + { + { + content, + left = dpi(10), + right = dpi(10), + top = dpi(5), + bottom = dpi(5), + widget = wibox.container.margin + }, + bgimage = compose_background, + widget = wibox.container.background + }, + left = dpi(2), + right = dpi(2), + top = dpi(2), + bottom = dpi(2), + widget = wibox.container.margin + } +end + diff --git a/preferences/apps.lua b/preferences/apps.lua new file mode 100644 index 0000000..5a4eb50 --- /dev/null +++ b/preferences/apps.lua @@ -0,0 +1,31 @@ +local awful = require("awful") + +local apps = {} + +apps.default = { + terminal = "kitty", + lock = "i3lock", + screenshot = "scrot -e 'mv $f ~/Pictures/ 2>/dev/null'", + filebrowser = "nautilus" +} + +local run_on_start_up = { + "picom", + "redshift", + "unclutter" + } + + function apps.autostart() + for _, app in ipairs(run_on_start_up) do + local findme = app + local firstspace = app:find(" ") + if firstspace then + findme = app:sub(0, firstspace - 1) + end + awful.spawn.with_shell(string.format("bash -c 'pgrep -u $USER -x %s > /dev/null || (%s)'", findme, app), false) + end + end + + apps.autostart() + + \ No newline at end of file diff --git a/preferences/layouts.lua b/preferences/layouts.lua new file mode 100644 index 0000000..957d96c --- /dev/null +++ b/preferences/layouts.lua @@ -0,0 +1,19 @@ +local awful = require('awful') + +tag.connect_signal("request::default_layouts", function() + awful.layout.append_default_layouts({ + awful.layout.suit.tile, + -- 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.spiral, + awful.layout.suit.spiral.dwindle, + awful.layout.suit.max, + awful.layout.suit.max.fullscreen, + awful.layout.suit.magnifier, + awful.layout.suit.corner.nw, + }) +end) \ No newline at end of file diff --git a/rc.lua b/rc.lua new file mode 100644 index 0000000..11f90fd --- /dev/null +++ b/rc.lua @@ -0,0 +1,198 @@ +pcall(require, "luarocks.loader") + +local gears = require('gears') +local awful = require('awful') +local beautiful = require('beautiful') + +beautiful.init(require('theme')) + +require('awful.autofocus') + +require('preferences.apps') +require('preferences.layouts') + +require('modules.client') +require('modules.titlebar') +require('modules.panel') +-- require('modules.sidepanel') + +require('bindings.keys') +-- BELOW NEEDS CLEANUP -- + +-- Widget and layout library +local wibox = require("wibox") +-- Notification library +local naughty = require("naughty") +-- Declarative object management +local ruled = require("ruled") +local menubar = require("menubar") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: + +-- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +naughty.connect_signal("request::display_error", function(message, startup) + naughty.notification { + urgency = "critical", + title = "Oops, an error happened"..(startup and " during startup!" or "!"), + message = message + } +end) +-- }}} + +-- This is used later as the default terminal and editor to run. +terminal = "kitty" +editor = os.getenv("EDITOR") or "vi" +editor_cmd = terminal .. " -e " .. editor + +-- Default modkey. +-- Usually, Mod4 is the key with a logo between Control and Alt. +-- If you do not like this or do not have such a key, +-- I suggest you to remap Mod4 to another key using xmodmap or other tools. +-- However, you can use another modifier like Mod1, but it may interact with others. +modkey = "Mod4" +-- }}} + +-- {{{ 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 }, +} + +mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal } + } + }) + +mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, + menu = mymainmenu }) + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it +-- }}} + +-- {{{ Tag +-- Table of layouts to cover with awful.layout.inc, order matters. + +-- }}} + +-- {{{ Wibar + + + +screen.connect_signal("request::wallpaper", function(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 +end) + +-- {{{ Mouse bindings +awful.mouse.append_global_mousebindings({ + awful.button({ }, 3, function () mymainmenu:toggle() end), + awful.button({ }, 4, awful.tag.viewnext), + awful.button({ }, 5, awful.tag.viewprev), +}) +-- }}} + + + +-- {{{ Rules +-- Rules to apply to new clients. +ruled.client.connect_signal("request::rules", function() + -- All clients will match this rule. + ruled.client.append_rule { + id = "global", + rule = { }, + properties = { + focus = awful.client.focus.filter, + raise = true, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen + } + } + + -- Floating clients. + ruled.client.append_rule { + id = "floating", + rule_any = { + instance = { "copyq", "pinentry" }, + class = { + "Arandr", "Blueman-manager", "Gpick", "Kruler", "Sxiv", + "Tor Browser", "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 } + } + + -- Add titlebars to normal clients and dialogs + ruled.client.append_rule { + id = "titlebars", + rule_any = { type = { "normal", "dialog" } }, + properties = { titlebars_enabled = true } + } + ruled.client.append_rule { + rule = { class = "Plank" }, + properties = { + border_width = 0, + floating = true, + sticky = true, + ontop = true, + focusable = false, + below = true + } + } + + -- Set Firefox to always map on the tag named "2" on screen 1. + -- ruled.client.append_rule { + -- rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } + -- } +end) + +-- }}} + + +-- {{{ Notifications + +ruled.notification.connect_signal('request::rules', function() + -- All notifications will match this rule. + ruled.notification.append_rule { + rule = { }, + properties = { + screen = awful.screen.preferred, + implicit_timeout = 5, + } + } +end) + +naughty.connect_signal("request::display", function(n) + naughty.layout.box { notification = n } +end) + +-- }}} + +-- Enable sloppy focus, so that focus follows mouse. +client.connect_signal("mouse::enter", function(c) + c:activate { context = "mouse_enter", raise = false } +end) diff --git a/theme b/theme new file mode 120000 index 0000000..cac3d73 --- /dev/null +++ b/theme @@ -0,0 +1 @@ +themes/pixelos/ \ No newline at end of file diff --git a/themes/pixelos/assets/mockup.svg b/themes/pixelos/assets/mockup.svg new file mode 100644 index 0000000..0e018ed --- /dev/null +++ b/themes/pixelos/assets/mockup.svg @@ -0,0 +1,3270 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/themes/pixelos/assets/titlebar/buttons/button_blue_active.png b/themes/pixelos/assets/titlebar/buttons/button_blue_active.png new file mode 100644 index 0000000..68cb3f5 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_blue_active.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_blue_active_hover.png b/themes/pixelos/assets/titlebar/buttons/button_blue_active_hover.png new file mode 100644 index 0000000..adda96c Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_blue_active_hover.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_blue_inactive.png b/themes/pixelos/assets/titlebar/buttons/button_blue_inactive.png new file mode 100644 index 0000000..b1e40d6 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_blue_inactive.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_blue_inactive_hover.png b/themes/pixelos/assets/titlebar/buttons/button_blue_inactive_hover.png new file mode 100644 index 0000000..be379c0 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_blue_inactive_hover.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_red.png b/themes/pixelos/assets/titlebar/buttons/button_red.png new file mode 100644 index 0000000..36c0815 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_red.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_red_hover.png b/themes/pixelos/assets/titlebar/buttons/button_red_hover.png new file mode 100644 index 0000000..3c68460 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_red_hover.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_yellow.png b/themes/pixelos/assets/titlebar/buttons/button_yellow.png new file mode 100644 index 0000000..70389b0 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_yellow.png differ diff --git a/themes/pixelos/assets/titlebar/buttons/button_yellow_hover.png b/themes/pixelos/assets/titlebar/buttons/button_yellow_hover.png new file mode 100644 index 0000000..ad47318 Binary files /dev/null and b/themes/pixelos/assets/titlebar/buttons/button_yellow_hover.png differ diff --git a/themes/pixelos/assets/titlebar/titlebar_bottom.png b/themes/pixelos/assets/titlebar/titlebar_bottom.png new file mode 100644 index 0000000..7141578 Binary files /dev/null and b/themes/pixelos/assets/titlebar/titlebar_bottom.png differ diff --git a/themes/pixelos/assets/titlebar/titlebar_middle.png b/themes/pixelos/assets/titlebar/titlebar_middle.png new file mode 100644 index 0000000..d7c3ea0 Binary files /dev/null and b/themes/pixelos/assets/titlebar/titlebar_middle.png differ diff --git a/themes/pixelos/assets/titlebar/titlebar_top.png b/themes/pixelos/assets/titlebar/titlebar_top.png new file mode 100644 index 0000000..b9fb7fe Binary files /dev/null and b/themes/pixelos/assets/titlebar/titlebar_top.png differ diff --git a/themes/pixelos/assets/wallpaper/wallpaper1.png b/themes/pixelos/assets/wallpaper/wallpaper1.png new file mode 100644 index 0000000..b3514cb Binary files /dev/null and b/themes/pixelos/assets/wallpaper/wallpaper1.png differ diff --git a/themes/pixelos/assets/wallpaper/wallpaper2.jpg b/themes/pixelos/assets/wallpaper/wallpaper2.jpg new file mode 100644 index 0000000..67a9d38 Binary files /dev/null and b/themes/pixelos/assets/wallpaper/wallpaper2.jpg differ diff --git a/themes/pixelos/assets/wallpaper/wallpaper3.jpg b/themes/pixelos/assets/wallpaper/wallpaper3.jpg new file mode 100644 index 0000000..a5ca0eb Binary files /dev/null and b/themes/pixelos/assets/wallpaper/wallpaper3.jpg differ diff --git a/themes/pixelos/assets/wallpaper/wallpaper4.jpg b/themes/pixelos/assets/wallpaper/wallpaper4.jpg new file mode 100644 index 0000000..e4a416d Binary files /dev/null and b/themes/pixelos/assets/wallpaper/wallpaper4.jpg differ diff --git a/themes/pixelos/assets/widget/widget_pill_bottom_left.png b/themes/pixelos/assets/widget/widget_pill_bottom_left.png new file mode 100644 index 0000000..ac64112 Binary files /dev/null and b/themes/pixelos/assets/widget/widget_pill_bottom_left.png differ diff --git a/themes/pixelos/assets/widget/widget_pill_bottom_right.png b/themes/pixelos/assets/widget/widget_pill_bottom_right.png new file mode 100644 index 0000000..10e7800 Binary files /dev/null and b/themes/pixelos/assets/widget/widget_pill_bottom_right.png differ diff --git a/themes/pixelos/assets/widget/widget_pill_top_left.png b/themes/pixelos/assets/widget/widget_pill_top_left.png new file mode 100644 index 0000000..320ce12 Binary files /dev/null and b/themes/pixelos/assets/widget/widget_pill_top_left.png differ diff --git a/themes/pixelos/assets/widget/widget_pill_top_right.png b/themes/pixelos/assets/widget/widget_pill_top_right.png new file mode 100644 index 0000000..f299745 Binary files /dev/null and b/themes/pixelos/assets/widget/widget_pill_top_right.png differ diff --git a/themes/pixelos/init.lua b/themes/pixelos/init.lua new file mode 100644 index 0000000..22b895e --- /dev/null +++ b/themes/pixelos/init.lua @@ -0,0 +1,136 @@ +local filesystem = require('gears.filesystem') +local beautiful = require('beautiful') +local gears = require('gears') +local dpi = beautiful.xresources.apply_dpi + +local assets = filesystem.get_configuration_dir() .. '/theme/assets/' + +local theme = {} + +-- Font +theme.font = 'ProggyCleanTTCE Nerd Font Mono 12' + +-- Misc +-- -- Wallpaper Image +theme.wallpaper = assets .. 'wallpaper/wallpaper4.jpg' +-- -- Solid Color +gears.wallpaper.set("#20BEC6") + +theme.useless_gap = 10 + +-- Colors +theme.color_transparent = '#00000000' +theme.background = '#1a1a1a' + +theme.fg_normal = '#ffffffff' +theme.fg_focus = '#e4e4e4' +theme.fg_urgent = '#CC9393' + +theme.bg_normal = theme.background +theme.bg_focus = '#5a5a5a' +theme.bg_urgent = '#3F3F3F' + +-- Taglist +theme.taglist_bg_empty = theme.background .. '00' +theme.taglist_bg_occupied = '#2a2a2a' .. 'ff' +theme.taglist_bg_urgent = '#E91E63' .. '99' +theme.taglist_bg_focus = '#3a3a3a' +theme.taglist_spacing = dpi(0) + +-- Tasklist +theme.tasklist_bg_normal = theme.background .. '99' +theme.tasklist_bg_focus = theme.background +theme.tasklist_bg_urgent = '#E91E63' .. '99' +theme.tasklist_fg_focus = '#DDDDDD' +theme.tasklist_fg_urgent = '#ffffff' +theme.tasklist_fg_normal = '#AAAAAA' + +-- Notification +theme.notification_position = 'top_right' +theme.notification_bg = theme.transparent +theme.notification_margin = dpi(5) +theme.notification_border_width = dpi(0) +theme.notification_border_color = theme.transparent +theme.notification_spacing = dpi(5) +theme.notification_icon_resize_strategy = 'center' +theme.notification_icon_size = dpi(32) + +theme.widget_pill_top_left = assets .. 'widget/widget_pill_top_left.png' +theme.widget_pill_top_right = assets .. 'widget/widget_pill_top_right.png' +theme.widget_pill_bottom_left = assets .. 'widget/widget_pill_bottom_left.png' +theme.widget_pill_bottom_right = assets .. 'widget/widget_pill_bottom_right.png' + +-- Titlebar +theme.titlebar_size = nil -- use image width/height +theme.titlebar_image_top = assets .. 'titlebar/titlebar_top.png' +theme.titlebar_image_middle = assets .. 'titlebar/titlebar_middle.png' +theme.titlebar_image_bottom = assets .. 'titlebar/titlebar_bottom.png' +theme.titlebar_bgimage_normal = theme.titlebar_middle + +-- Titlebar Buttons +theme.titlebar_button_margin_left = dpi(2.5) +theme.titlebar_button_margin_right = dpi(3) +theme.titlebar_button_margin_top = dpi(3) +theme.titlebar_button_margin_bottom = dpi(3) +theme.titlebar_button_spacing = dpi(2.5) + +theme.titlebar_button_close = assets .. 'titlebar/buttons/button_red.png' +theme.titlebar_button_close_hover = assets .. 'titlebar/buttons/button_red_hover.png' + +theme.titlebar_button_minimize = assets .. 'titlebar/buttons/button_yellow.png' +theme.titlebar_button_minimize_hover = assets .. 'titlebar/buttons/button_yellow_hover.png' + +theme.titlebar_button_maximize_inactive = assets .. 'titlebar/buttons/button_blue_inactive.png' +theme.titlebar_button_maximize_inactive_hover = assets .. 'titlebar/buttons/button_blue_inactive_hover.png' +theme.titlebar_button_maximize_active = assets .. 'titlebar/buttons/button_blue_active.png' +theme.titlebar_button_maximize_active_hover = assets .. 'titlebar/buttons/button_blue_active_hover.png' + +theme.titlebar_button_floating_inactive = assets .. 'titlebar/buttons/button_blue_inactive.png' +theme.titlebar_button_floating_inactive_hover = assets .. 'titlebar/buttons/button_blue_inactive_hover.png' +theme.titlebar_button_floating_active = assets .. 'titlebar/buttons/button_blue_active.png' +theme.titlebar_button_floating_active_hover = assets .. 'titlebar/buttons/button_blue_active_hover.png' + +theme.titlebar_button_ontop_inactive = assets .. 'titlebar/buttons/button_blue_inactive.png' +theme.titlebar_button_ontop_inactive_hover = assets .. 'titlebar/buttons/button_blue_inactive_hover.png' +theme.titlebar_button_ontop_active = assets .. 'titlebar/buttons/button_blue_active.png' +theme.titlebar_button_ontop_active_hover = assets .. 'titlebar/buttons/button_blue_active_hover.png' + + +-- Don't touch, it's for semantics +theme.titlebar_close_button_normal = theme.titlebar_button_close +theme.titlebar_close_button_normal_hover = theme.titlebar_button_close_hover +theme.titlebar_close_button_focus = theme.titlebar_button_close +theme.titlebar_close_button_focus_hover = theme.titlebar_button_close_hover + +theme.titlebar_minimize_button_normal = theme.titlebar_button_minimize +theme.titlebar_minimize_button_normal_hover = theme.titlebar_button_minimize_hover +theme.titlebar_minimize_button_focus = theme.titlebar_button_minimize +theme.titlebar_minimize_button_focus_hover = theme.titlebar_button_minimize_hover + +theme.titlebar_maximized_button_normal_inactive = theme.titlebar_button_maximize_inactive +theme.titlebar_maximized_button_normal_inactive_hover = theme.titlebar_button_maximize_inactive_hover +theme.titlebar_maximized_button_normal_active = theme.titlebar_button_maximize_active +theme.titlebar_maximized_button_normal_active_hover = theme.titlebar_button_maximize_active_hover +theme.titlebar_maximized_button_focus_inactive = theme.titlebar_button_maximize_inactive +theme.titlebar_maximized_button_focus_inactive_hover = theme.titlebar_button_maximize_inactive_hover +theme.titlebar_maximized_button_focus_active = theme.titlebar_button_maximize_active +theme.titlebar_maximized_button_focus_active_hover = theme.titlebar_button_maximize_active_hover + +theme.titlebar_floating_button_normal_inactive = theme.titlebar_button_floating_inactive +theme.titlebar_floating_button_normal_inactive_hover = theme.titlebar_button_floating_inactive_hover +theme.titlebar_floating_button_normal_active = theme.titlebar_button_floating_active +theme.titlebar_floating_button_normal_active_hover = theme.titlebar_button_floating_active_hover +theme.titlebar_floating_button_focus_inactive = theme.titlebar_button_floating_inactive +theme.titlebar_floating_button_focus_inactive_hover = theme.titlebar_button_floating_inactive_hover +theme.titlebar_floating_button_focus_active = theme.titlebar_button_floating_active +theme.titlebar_floating_button_focus_active_hover = theme.titlebar_button_floating_active_hover + +theme.titlebar_ontop_button_normal_inactive = theme.titlebar_button_ontop_inactive +theme.titlebar_ontop_button_normal_inactive_hover = theme.titlebar_button_ontop_inactive_hover +theme.titlebar_ontop_button_normal_active = theme.titlebar_button_ontop_active +theme.titlebar_ontop_button_normal_active_hover = theme.titlebar_button_ontop_active_hover +theme.titlebar_ontop_button_focus_inactive = theme.titlebar_button_ontop_inactive +theme.titlebar_ontop_button_focus_inactive_hover = theme.titlebar_button_ontop_inactive_hover +theme.titlebar_ontop_button_focus_active = theme.titlebar_button_ontop_active +theme.titlebar_ontop_button_focus_active_hover = theme.titlebar_button_ontop_active_hover +return theme diff --git a/vicious b/vicious new file mode 160000 index 0000000..edfd512 --- /dev/null +++ b/vicious @@ -0,0 +1 @@ +Subproject commit edfd51215e364b0460c17027ff4f8f951f03405a diff --git a/widgets/battery.lua b/widgets/battery.lua new file mode 100644 index 0000000..a854b80 --- /dev/null +++ b/widgets/battery.lua @@ -0,0 +1,34 @@ +local vicious = require("../vicious") +local wibox = require("wibox") +local gears = require("gears") +require("../modules.widget") + + +local function pill_color() + battery_level = tonumber(vicious.call(vicious.widgets.bat, "$2", "BAT0")) + if (battery_level < 5) then + return "#f15a5bff" + elseif (battery_level <= 99) then + return "#fec35aff" + else + return "#20bec6ff" + end +end + +local textbox = wibox.widget.textbox() +battery = pill(textbox, pill_color()) + +local timer = gears.timer.start_new(1, function() + battery:emit_signal("battery::redraw_needed") +end) + +timer:emit_signal("timeout") + +-- battery = update_batter(textbox) + +-- Register battery widget +vicious.register(textbox, vicious.widgets.bat, "$2%", 61, "BAT0") + + + +return battery \ No newline at end of file diff --git a/widgets/date.lua b/widgets/date.lua new file mode 100644 index 0000000..d103afe --- /dev/null +++ b/widgets/date.lua @@ -0,0 +1,11 @@ +local wibox = require('wibox') +local vicious = require('../vicious') +require("../modules.widget") + +textbox = wibox.widget.textbox() + +date = pill(textbox, "#2D2D2D") + +vicious.register(textbox, vicious.widgets.date, "%b %d, %R") + +return date \ No newline at end of file diff --git a/widgets/volume.lua b/widgets/volume.lua new file mode 100644 index 0000000..80b4918 --- /dev/null +++ b/widgets/volume.lua @@ -0,0 +1,9 @@ +local wibox = require('wibox') +local vicious = require("../vicious") + + +vol = wibox.widget.textbox() +local sink = "alsa_output.pci-0000_00_1b.0.analog-stereo" +vicious.register(vol, vicious.widget.volume, " $1%", 2, sink) + +return vol \ No newline at end of file