diff --git a/hosts/configuration.nix b/hosts/configuration.nix index 5460b55..ed6b0f4 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -19,6 +19,12 @@ xkbOptions = "caps:super"; desktopManager.plasma5.enable = true; + windowManager.awesome = { + enable = true; + luaModules = with pkgs.luaPackages; [ + luarocks # is the package manager for Lua modules + ]; + }; displayManager = { sddm.enable = true; diff --git a/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-high-symbolic.svg b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-high-symbolic.svg new file mode 100644 index 0000000..985c107 --- /dev/null +++ b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-high-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-low-symbolic.svg b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-low-symbolic.svg new file mode 100644 index 0000000..7eb4531 --- /dev/null +++ b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-low-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-medium-symbolic.svg b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-medium-symbolic.svg new file mode 100644 index 0000000..11e44fe --- /dev/null +++ b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-medium-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-muted-symbolic.svg b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-muted-symbolic.svg new file mode 100644 index 0000000..e577d05 --- /dev/null +++ b/rsrcs/awesome/awesome-wm-widgets/icons/audio-volume-muted-symbolic.svg @@ -0,0 +1,88 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/rsrcs/awesome/convert ffmmpeg in a folder.sh b/rsrcs/awesome/convert ffmmpeg in a folder.sh new file mode 100644 index 0000000..3dab010 --- /dev/null +++ b/rsrcs/awesome/convert ffmmpeg in a folder.sh @@ -0,0 +1,2 @@ +for i in *.jpg; do ffmpeg -i "$i" "${i%.*}.png"; done +for i in *.png; do ffmpeg -i "$i" -map_metadata -1 "${i%.*}.jpg"; done \ No newline at end of file diff --git a/rsrcs/awesome/dbus.lua b/rsrcs/awesome/dbus.lua new file mode 100644 index 0000000..1d8a8e4 --- /dev/null +++ b/rsrcs/awesome/dbus.lua @@ -0,0 +1,17 @@ +local p = require 'dbus_proxy' + +local dbus = {} + +dbus.proxy = p.Proxy:new( + { + bus = p.Bus.SESSION, + name = "org.awesome.galaxymenu", + interface = "org.awsome.galaxymenu", + path = "/org/awsome/galaxymenu/Main" + } +) + + +dbus.callback = function () { + +} diff --git a/rsrcs/awesome/key_conf.lua b/rsrcs/awesome/key_conf.lua new file mode 100644 index 0000000..5b74fa6 --- /dev/null +++ b/rsrcs/awesome/key_conf.lua @@ -0,0 +1,240 @@ + +local awful = require("awful") +local gears = require("gears") + +local hotkeys_popup = require("awful.hotkeys_popup") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +require("awful.hotkeys_popup.keys") + +-- 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 = "Mod3" + +local key_conf = {} + +-- {{{ Key bindings +key_conf.globalkeys = gears.table.join( + + -- misc hotkeys + awful.key({modkey, }, "z", function() awful.spawn.with_shell("rofi -show run") end, + {description = "launch rofi run window", group="launcher"}), + 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, "Control" }, "l", function() awful.spawn.with_shell("/usr/bin/i3lock-fancy") end, + {description = "Lock the computer with i3lock-fancy", group="awesome"}), + + -- focusing hotkeys + 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"}), + + -- 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, "Shift" }, "q", awesome.quit, + -- {description = "quit awesome", group = "awesome"}), + + 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"}), + + -- 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"}) +) + +key_conf.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" }, "c", function (c) c:kill() end, + {description = "defenstrate", 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 + key_conf.globalkeys = gears.table.join(key_conf.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 + +key_conf.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) +) + +-- Set keys +root.keys(key_conf.globalkeys) +-- }}} + +return key_conf \ No newline at end of file diff --git a/rsrcs/awesome/menu_conf.lua b/rsrcs/awesome/menu_conf.lua new file mode 100644 index 0000000..10bb43f --- /dev/null +++ b/rsrcs/awesome/menu_conf.lua @@ -0,0 +1,290 @@ + +local awful = require("awful") +local gears = require("gears") +local beautiful = require("beautiful") +local wibox = require("wibox") +local menubar = require("menubar") +local cpu_widget = require("cpu-widget") +local battery_widget = require("batteryarc") +local ram_widget = require("ram-widget") + +-- Mod+p for a simple .desktop thing, probably not going to use +local vicious = require("vicious") + +local hotkeys_popup = require("awful.hotkeys_popup") +-- Enable hotkeys help widget for VIM and other apps +-- when client with a matching name is opened: +require("awful.hotkeys_popup.keys") + +local menu_conf = {} + +menu_conf.init = function( + theme_dir, terminal, editor, editor_cmd) + + beautiful.init(theme_dir) + + -- {{{ 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 + -- }}} + + -- {{{ Wibar + -- Create a textclock widget + mytextclock = wibox.widget.background() + mytextclock:set_widget(awful.widget.textclock()) + mytextclock:set_bg(beautiful.bg_normal) + + + -- 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) + ) + + 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)) + + 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 + 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) + + -- Each screen has its own tag table. + awful.tag({ "1", "2", "3", "4", "5" }, s, awful.layout.layouts[1]) + + -- Create an imagebox widget which will contain an icon indicating which layout we're using. + -- We need one layoutbox per screen. + local layoutbox = awful.widget.layoutbox(s) + layoutbox: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))) + + s.mylayoutbox = wibox.widget.background() + s.mylayoutbox:set_widget(layoutbox) + s.mypromptbox = awful.widget.prompt() + + -- 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, + layout = { + spacing = 0, + layout = wibox.layout.flex.horizontal, + }, + widget_template = { + { + { + { + { + id = 'icon_role', + widget = wibox.widget.imagebox, + }, + margins = 0, + widget = wibox.container.margin, + }, + { + id = 'text_role', + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + left = 20, + right = 20, + widget = wibox.container.margin, + }, + id = 'background_role', + widget = wibox.container.background, + }, + } + + s.battery_widget = wibox.widget { + battery_widget({ + show_current_level = true, + bg_color = "#ff0000", + size = 30, + arc_thickness = 3, + }), + bg = beautiful.bg_normal, + widget = wibox.container.background, + } + + s.cpu_widget = cpu_widget({ + width = 70, + step_width = 2, + step_spacing = 0, + color = '#434c9e', + background_color = beautiful.bg_normal, + }) + + s.ram_widget = wibox.widget { + ram_widget({ + --color_used= + --color_buf= + --color_free= + widget_width=35, + widget_height=35, + widget_show_buf=true, + }), + bg = beautiful.bg_normal, + widget = wibox.container.background, + } + + + function left_endpoint_shape(cr, width, height) + -- insert custom shape building here: + gears.shape.transform(gears.shape.rectangular_tag) + : translate(0, -height) + (cr, width, height*2, width) + end + + function right_endpoint_shape(cr, width, height) + -- insert custom shape building here: + gears.shape.transform(gears.shape.rectangular_tag) + : rotate_at(width/2, height, math.pi) + : translate(0, height) + (cr, width, height*2, width) + end + + -- Custom Widget the makes the left-side angle + local left_endpoint = { + { + { + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + bg = beautiful.bg_normal, + forced_width = beautiful.menu_height, + shape = left_endpoint_shape, + widget = wibox.container.background, + } + + -- Custom widget that makes the right-side angle + local right_endpoint = { + { + { + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + bg = beautiful.bg_normal, + forced_width = beautiful.menu_height, + shape = right_endpoint_shape, + widget = wibox.container.background, + } + + -- Create the wibox + s.mywibox = awful.wibar({ + position = "top", + screen = s, + bg = beautiful.bg_systray + }) + + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + expand = "none", + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + + mylauncher, + s.mytaglist, + s.mypromptbox, + right_endpoint, + }, + { + layout = wibox.layout.fixed.horizontal, + + left_endpoint, + s.mytasklist, -- Middle widget + right_endpoint, + }, + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + + left_endpoint, + s.cpu_widget, + s.ram_widget, + s.battery_widget, + wibox.widget.systray(), + mytextclock, + s.mylayoutbox, + }, + } + end) + -- }}} +end + +return menu_conf diff --git a/rsrcs/awesome/rc.lua b/rsrcs/awesome/rc.lua new file mode 100644 index 0000000..6b0911c --- /dev/null +++ b/rsrcs/awesome/rc.lua @@ -0,0 +1,148 @@ +package.path = package.path .. ';/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.3/?.lua;/usr/share/lua/5.3/?/init.lua;/usr/lib/lua/5.3/?.lua;/usr/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/home/nick/.luarocks/share/lua/5.3/?.lua;/home/nick/.luarocks/share/lua/5.3/?/init.lua;/usr/local/share/lua/5.3/?/init.lua;/home/nicholas/.luarocks/share/lua/5.3/?.lua;/home/nicholas/.luarocks/share/lua/5.3/?/init.lua' +package.cpath = package.cpath .. ';/usr/lib/lua/5.3/?.so;/usr/lib/lua/5.3/loadall.so;./?.so;/home/nick/.luarocks/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/?.so;/home/nicholas/.luarocks/lib/lua/5.3/?.so' + +-- 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") + +-- Standard awesome library +local gears = require("gears") +local awful = require("awful") +require("awful.autofocus") +-- Widget and layout library +local wibox = require("wibox") +-- Theme handling librarykey +local beautiful = require("beautiful") +-- Notification library +local naughty = require("naughty") + +local key_conf = require("key_conf") +local menu_conf = require("menu_conf") +local signals = require("signals") +local rules = require("window_rules") + + +-- {{{ 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) +if awesome.startup_errors then + 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 + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) +end +-- }}} + +-- {{{ Variable definitions +-- Themes define colours, icons, font and wallpapers. +local theme_name = "galaxymenu" +beautiful.init(string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), theme_name )) +-- beautiful.wallpaper = string.format("%s/.config/awesome/themes/%s/wallpapers/earth2.png", os.getenv("HOME"), theme_name ) + +-- {{{ Function definitions + +-- scan directory, and optionally filter outputs +function scandir(directory) + local i, fileList, popen = 0, {}, io.popen + for filename in popen([[find "]] ..directory.. [[" -type f]]):lines() do + i = i + 1 + fileList[i] = filename + end + return fileList +end + +-- }}} + +-- configuration - edit to your liking +wp_timeout = 180 + +-- simply put more pictures in this folder +wp_path = string.format("%s/.config/awesome/themes/%s/wallpapers/", os.getenv("HOME"), theme_name ) +wp_filter = function(s) return string.match(s,"%.png$") end +wp_files = scandir(wp_path) +wp_index = math.random(1, #wp_files) + +local rand_wllppr = function() + + -- set wallpaper to current index for all screens + beautiful.wallpaper = wp_files[wp_index] + gears.wallpaper.maximized(beautiful.wallpaper) + + -- stop the timer (we don't need multiple instances running at the same time) + wp_timer:stop() + + -- get next random index + wp_index = math.random( 1, #wp_files) + + --restart the timer + wp_timer.timeout = wp_timeout + wp_timer:start() +end +-- setup the timer +wp_timer = timer { timeout = wp_timeout } +wp_timer:connect_signal("timeout", rand_wllppr) + +-- initial start when rc.lua is first run +wp_timer:start() +rand_wllppr() + + +-- This is used later as the default terminal and editor to run. +terminal = "urxvt" +editor = os.getenv("EDITOR") or "vim" +editor_cmd = terminal .. " -e " .. editor + + +-- Table of layouts to cover with awful.layout.inc, order matters. +awful.layout.layouts = { + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.floating, + 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, + -- awful.layout.suit.corner.ne, + -- awful.layout.suit.corner.sw, + -- awful.layout.suit.corner.se, +} +-- }}} + +menu_conf.init(theme_dir, terminal, editor, editor_cmd) + +-- {{{ 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.spawn.with_shell(string.format("%s/.config/autostart.sh", os.getenv("HOME"))) +awful.spawn.with_shell(string.format("%s/.config/polybar/start_polybar.sh", os.getenv("HOME"))) +-- XDG autostart +-- awful.spawn.with_shell( +-- 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' .. +-- 'xrdb -merge <<< "awesome.started:true";' .. + -- list each of your autostart commands, followed by ; inside single quotes, followed by .. +-- 'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex +-- ) diff --git a/rsrcs/awesome/signals.lua b/rsrcs/awesome/signals.lua new file mode 100644 index 0000000..89b19a2 --- /dev/null +++ b/rsrcs/awesome/signals.lua @@ -0,0 +1,161 @@ + +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +local beautiful = require("beautiful") +local naughty = require("naughty") + +-- {{{ 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 + + 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. +local create_titlebar = function(c, is_floating) + -- 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) + ) + + local my_close_btn = awful.titlebar.widget.closebutton(c) + -- The part that actually removes the tooltip + my_close_btn._private.tooltip:remove_from_object(my_close_btn) + + local defenstrate_tooltip = awful.tooltip { } + defenstrate_tooltip:add_to_object(my_close_btn) + my_close_btn:connect_signal('mouse::enter', function() + defenstrate_tooltip.text = "Defenstrate" + end) + + function drag_bar_shape(cr, width, height) + local radius = 10 + gears.shape.rounded_rect(cr, width, height, radius) + end + + if (is_floating) + then + 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), + my_close_btn, + --awful.titlebar.widget.closebutton (c), + layout = wibox.layout.fixed.horizontal() + }, + layout = wibox.layout.align.horizontal + } + else + awful.titlebar(c, { + size = beautiful.tiled_titlebar_height, + bg_normal = beautiful.tiled_titlebar_bg_normal, + bg_focus = beautiful.tiled_titlebar_bg_focus, + }) : setup { + { + layout = wibox.layout.fixed.horizontal + }, + { -- Middle + { + { + { + widget = wibox.widget.textbox, + }, + layout = wibox.layout.flex.horizontal, + }, + bg = beautiful.tiled_titlebar_center, + forced_width = 80, + shape = drag_bar_shape, + widget = wibox.container.background, + }, + layout = wibox.layout.align.horizontal, + buttons = buttons, + }, + { -- Right + layout = wibox.layout.fixed.horizontal() + }, + expand = "outside", + layout = wibox.layout.align.horizontal + } + end +end + +client.connect_signal("request::titlebars", function(c) + create_titlebar(c, true) + 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}) +end) + +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +-- }}} + +client.connect_signal("property::floating", function(c) + if c.floating then + --awful.titlebar.show(c) + create_titlebar(c, true) + else + --awful.titlebar.hide(c) + create_titlebar(c, false) + end +end) + +function dynamic_title(c) + if c.floating or c.first_tag.layout.name == "floating" then + --awful.titlebar.show(c) + create_titlebar(c, true) + else + --awful.titlebar.hide(c) + create_titlebar(c, false) + end +end + +tag.connect_signal("property::layout", function(t) + local clients = t:clients() + for k,c in pairs(clients) do + if c.floating or c.first_tag.layout.name == "floating" then + --awful.titlebar.show(c) + create_titlebar(c, true) + else + --awful.titlebar.hide(c) + create_titlebar(c, false) + end + end +end) + +client.connect_signal("manage", dynamic_title) +client.connect_signal("tagged", dynamic_title) diff --git a/rsrcs/awesome/themes/galaxymenu/README b/rsrcs/awesome/themes/galaxymenu/README new file mode 100644 index 0000000..1ddb349 --- /dev/null +++ b/rsrcs/awesome/themes/galaxymenu/README @@ -0,0 +1,3 @@ +Background images: + Mikael Eriksson + Licensed under CC-BY-SA-3.0 diff --git a/rsrcs/awesome/themes/galaxymenu/background.png b/rsrcs/awesome/themes/galaxymenu/background.png new file mode 100644 index 0000000..8f52b6b Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/background.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/background_white.png b/rsrcs/awesome/themes/galaxymenu/background_white.png new file mode 100644 index 0000000..bb0c5d0 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/background_white.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornerne.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornerne.png new file mode 100644 index 0000000..c85bd56 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornerne.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornernew.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornernew.png new file mode 100644 index 0000000..c3fd986 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornernew.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornernw.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornernw.png new file mode 100644 index 0000000..dfe78b3 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornernw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornernww.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornernww.png new file mode 100644 index 0000000..f489010 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornernww.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornerse.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornerse.png new file mode 100644 index 0000000..023ae79 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornerse.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornersew.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornersew.png new file mode 100644 index 0000000..f7cfa1c Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornersew.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornersw.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornersw.png new file mode 100644 index 0000000..c1453c9 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornersw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/cornersww.png b/rsrcs/awesome/themes/galaxymenu/layouts/cornersww.png new file mode 100644 index 0000000..a65a043 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/cornersww.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/dwindle.png b/rsrcs/awesome/themes/galaxymenu/layouts/dwindle.png new file mode 100644 index 0000000..9902d22 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/dwindle.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/dwindlew.png b/rsrcs/awesome/themes/galaxymenu/layouts/dwindlew.png new file mode 100644 index 0000000..9199049 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/dwindlew.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fairh.png b/rsrcs/awesome/themes/galaxymenu/layouts/fairh.png new file mode 100644 index 0000000..d41deea Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fairh.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fairhw.png b/rsrcs/awesome/themes/galaxymenu/layouts/fairhw.png new file mode 100644 index 0000000..bb50e3a Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fairhw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fairv.png b/rsrcs/awesome/themes/galaxymenu/layouts/fairv.png new file mode 100644 index 0000000..f5f0288 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fairv.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fairvw.png b/rsrcs/awesome/themes/galaxymenu/layouts/fairvw.png new file mode 100644 index 0000000..4f4ed52 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fairvw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/floating.png b/rsrcs/awesome/themes/galaxymenu/layouts/floating.png new file mode 100644 index 0000000..b8061a0 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/floating.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/floatingw.png b/rsrcs/awesome/themes/galaxymenu/layouts/floatingw.png new file mode 100644 index 0000000..4815894 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/floatingw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fullscreen.png b/rsrcs/awesome/themes/galaxymenu/layouts/fullscreen.png new file mode 100644 index 0000000..d02f6fc Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fullscreen.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/fullscreenw.png b/rsrcs/awesome/themes/galaxymenu/layouts/fullscreenw.png new file mode 100644 index 0000000..5c35bfa Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/fullscreenw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/magnifier.png b/rsrcs/awesome/themes/galaxymenu/layouts/magnifier.png new file mode 100644 index 0000000..2925414 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/magnifier.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/magnifierw.png b/rsrcs/awesome/themes/galaxymenu/layouts/magnifierw.png new file mode 100644 index 0000000..6209556 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/magnifierw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/max.png b/rsrcs/awesome/themes/galaxymenu/layouts/max.png new file mode 100644 index 0000000..8d20844 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/max.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/maxw.png b/rsrcs/awesome/themes/galaxymenu/layouts/maxw.png new file mode 100644 index 0000000..85f5ce3 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/maxw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/spiral.png b/rsrcs/awesome/themes/galaxymenu/layouts/spiral.png new file mode 100644 index 0000000..d9434be Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/spiral.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/spiralw.png b/rsrcs/awesome/themes/galaxymenu/layouts/spiralw.png new file mode 100644 index 0000000..b78dd86 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/spiralw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tile.png b/rsrcs/awesome/themes/galaxymenu/layouts/tile.png new file mode 100644 index 0000000..3ede21e Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tile.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tilebottom.png b/rsrcs/awesome/themes/galaxymenu/layouts/tilebottom.png new file mode 100644 index 0000000..6f8c257 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tilebottom.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tilebottomw.png b/rsrcs/awesome/themes/galaxymenu/layouts/tilebottomw.png new file mode 100644 index 0000000..a1de7b2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tilebottomw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tileleft.png b/rsrcs/awesome/themes/galaxymenu/layouts/tileleft.png new file mode 100644 index 0000000..31d6870 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tileleft.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tileleftw.png b/rsrcs/awesome/themes/galaxymenu/layouts/tileleftw.png new file mode 100644 index 0000000..cf14c25 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tileleftw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tiletop.png b/rsrcs/awesome/themes/galaxymenu/layouts/tiletop.png new file mode 100644 index 0000000..98cade2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tiletop.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tiletopw.png b/rsrcs/awesome/themes/galaxymenu/layouts/tiletopw.png new file mode 100644 index 0000000..d1d0872 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tiletopw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/layouts/tilew.png b/rsrcs/awesome/themes/galaxymenu/layouts/tilew.png new file mode 100644 index 0000000..fde2ca4 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/layouts/tilew.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/submenu.png b/rsrcs/awesome/themes/galaxymenu/submenu.png new file mode 100644 index 0000000..b2778e2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/submenu.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/taglist/squarefw.png b/rsrcs/awesome/themes/galaxymenu/taglist/squarefw.png new file mode 100644 index 0000000..2a86430 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/taglist/squarefw.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/taglist/squarew.png b/rsrcs/awesome/themes/galaxymenu/taglist/squarew.png new file mode 100644 index 0000000..913f2ca Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/taglist/squarew.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/theme.lua b/rsrcs/awesome/themes/galaxymenu/theme.lua new file mode 100644 index 0000000..11cf56e --- /dev/null +++ b/rsrcs/awesome/themes/galaxymenu/theme.lua @@ -0,0 +1,148 @@ +--------------------------- +-- awesome theme -- +--------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local themes_path = string.format("%s/.config/awesome/themes/galaxymenu", os.getenv("HOME")) + +local theme = {} + +theme.font = "DejaVu Sans Condensed Regular 10" + +theme.bg_normal = "#373B41" +theme.bg_focus = "#004B25" +theme.bg_urgent = "#C41113" +theme.bg_minimize = "#444444" +theme.bg_systray = "#00000000" + +theme.fg_normal = "#43B9EC" +theme.fg_focus = "#ffffff" +theme.fg_urgent = "#ffffff" +theme.fg_minimize = "#ffffff" + +theme.useless_gap = dpi(3) +theme.border_width = dpi(1) +theme.border_normal = "#000000" +theme.border_focus = "#00FF80" +theme.border_marked = "#91231c" + +theme.tiled_titlebar_height = dpi(5) +theme.tiled_titlebar_center = "#CECECE" +theme.tiled_titlebar_bg_normal = theme.bg_systray +theme.tiled_titlebar_bg_focus = "#02709fBB" + + +-- overriding the one when +-- defined, the sets are: +-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] +-- tasklist_[bg|fg]_[focus|urgent] +-- titlebar_[bg|fg]_[normal|focus] +theme.titlebar_bg_focus = "#03723A" +-- 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.."/submenu.png" +theme.menu_height = dpi(20) +theme.menu_width = dpi(100) +theme.menu_text_color_contrast = "#002477" + +theme.taglist_fg_focus = theme.menu_text_color_contrast +theme.taglist_bg_focus = "#79B7D1" +theme.taglist_fg_urgent = theme.menu_text_color_contrast +theme.taglist_fg_occupied = theme.menu_text_color_contrast +theme.taglist_bg_occupied = "#3286AA" +theme.taglist_bg_empty = theme.bg_normal + + +-- 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.."/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path.."/titlebar/close_focus.png" + +theme.titlebar_minimize_button_normal = themes_path.."/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path.."/titlebar/minimize_focus.png" + +theme.titlebar_ontop_button_normal_inactive = themes_path.."/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path.."/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path.."/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path.."/titlebar/ontop_focus_active.png" + +theme.titlebar_sticky_button_normal_inactive = themes_path.."/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path.."/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path.."/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path.."/titlebar/sticky_focus_active.png" + +theme.titlebar_floating_button_normal_inactive = themes_path.."/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path.."/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path.."/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path.."/titlebar/floating_focus_active.png" + +--when not focused, but maximized +theme.titlebar_maximized_button_normal_inactive = themes_path.."/titlebar/maximized_normal_inactive.png" +--when focused and not maximized +theme.titlebar_maximized_button_focus_inactive = themes_path.."/titlebar/maximized_focus_inactive.png" +--when not focused or maximized +theme.titlebar_maximized_button_normal_active = themes_path.."/titlebar/maximized_normal_active.png" +--when focused and maximized +theme.titlebar_maximized_button_focus_active = themes_path.."/titlebar/maximized_focus_active.png" + +--theme.wallpaper = themes_path.."/background.png" + +-- You can use your own layout icons like this: +theme.layout_fairh = themes_path.."/layouts/fairhw.png" +theme.layout_fairv = themes_path.."/layouts/fairvw.png" +theme.layout_floating = themes_path.."/layouts/floatingw.png" +theme.layout_magnifier = themes_path.."/layouts/magnifierw.png" +theme.layout_max = themes_path.."/layouts/maxw.png" +theme.layout_fullscreen = themes_path.."/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path.."/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path.."/layouts/tileleftw.png" +theme.layout_tile = themes_path.."/layouts/tilew.png" +theme.layout_tiletop = themes_path.."/layouts/tiletopw.png" +theme.layout_spiral = themes_path.."/layouts/spiralw.png" +theme.layout_dwindle = themes_path.."/layouts/dwindlew.png" +theme.layout_cornernw = themes_path.."/layouts/cornernww.png" +theme.layout_cornerne = themes_path.."/layouts/cornernew.png" +theme.layout_cornersw = themes_path.."/layouts/cornersww.png" +theme.layout_cornerse = themes_path.."/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 + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/close_focus.png b/rsrcs/awesome/themes/galaxymenu/titlebar/close_focus.png new file mode 100644 index 0000000..7afb2d9 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/close_focus.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/close_normal.png b/rsrcs/awesome/themes/galaxymenu/titlebar/close_normal.png new file mode 100644 index 0000000..306482b Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/close_normal.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_active.png new file mode 100644 index 0000000..82dcc7c Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_inactive.png new file mode 100644 index 0000000..c19ba80 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_focus_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_active.png new file mode 100644 index 0000000..62342d1 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_inactive.png new file mode 100644 index 0000000..e2bbdfa Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/floating_normal_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_active.png new file mode 100644 index 0000000..99708e2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_inactive.png new file mode 100644 index 0000000..11aadf6 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_focus_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_active.png new file mode 100644 index 0000000..e7ed1c4 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_inactive.png new file mode 100644 index 0000000..9b5c810 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/maximized_normal_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_focus.png b/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_focus.png new file mode 100644 index 0000000..caaceb2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_focus.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_normal.png b/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_normal.png new file mode 100644 index 0000000..36621d0 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/minimize_normal.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_active.png new file mode 100644 index 0000000..312c00b Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_inactive.png new file mode 100644 index 0000000..a48e1c5 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_focus_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_active.png new file mode 100644 index 0000000..117a203 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_inactive.png new file mode 100644 index 0000000..d3a10c8 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/ontop_normal_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_active.png new file mode 100644 index 0000000..814499b Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_inactive.png new file mode 100644 index 0000000..21b000d Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_focus_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_active.png b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_active.png new file mode 100644 index 0000000..bdb5595 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_active.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_inactive.png b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_inactive.png new file mode 100644 index 0000000..a96b9b1 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/titlebar/sticky_normal_inactive.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/astronaut1.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/astronaut1.png new file mode 100644 index 0000000..ab03125 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/astronaut1.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/earth1.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth1.png new file mode 100644 index 0000000..a812dbd Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth1.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/earth2.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth2.png new file mode 100644 index 0000000..904bccc Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth2.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/earth3.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth3.png new file mode 100644 index 0000000..896b414 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/earth3.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/space1.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/space1.png new file mode 100644 index 0000000..efaed38 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/space1.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/space2.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/space2.png new file mode 100644 index 0000000..4f2effa Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/space2.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/space3.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/space3.png new file mode 100644 index 0000000..a969bda Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/space3.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/stars1.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars1.png new file mode 100644 index 0000000..52b87fc Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars1.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/stars2.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars2.png new file mode 100644 index 0000000..ebd05b2 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars2.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/stars3.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars3.png new file mode 100644 index 0000000..ed0c6e3 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars3.png differ diff --git a/rsrcs/awesome/themes/galaxymenu/wallpapers/stars4.png b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars4.png new file mode 100644 index 0000000..f4bc224 Binary files /dev/null and b/rsrcs/awesome/themes/galaxymenu/wallpapers/stars4.png differ diff --git a/rsrcs/awesome/volume-widget/README.md b/rsrcs/awesome/volume-widget/README.md new file mode 100644 index 0000000..4fc7f55 --- /dev/null +++ b/rsrcs/awesome/volume-widget/README.md @@ -0,0 +1,119 @@ +# Volume widget + +Volume widget based on [amixer](https://linux.die.net/man/1/amixer) (is used for controlling the audio volume) and [pacmd](https://linux.die.net/man/1/pacmd) (is used for selecting a sink/source). Also, the widget provides an easy way to customize how it looks, following types are supported out-of-the-box: + +![types](screenshots/variations.png) + +From left to right: `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` + +A right-click on the widget opens a popup where you can choose a sink/source: +![sink-sources](screenshots/volume-sink-sources.png) + +Left click toggles mute and middle click opens a mixer ([pavucontrol](https://freedesktop.org/software/pulseaudio/pavucontrol/) by default). + +### Features + + - switch between sinks/sources by right click on the widget; + - more responsive than previous versions of volume widget, which were refreshed once a second; + - 5 predefined customizable looks; + +## Installation + +Clone the repo under **~/.config/awesome/** and add widget in **rc.lua**: + +```lua +local volume_widget = require('awesome-wm-widgets.volume-widget.volume') +... +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + -- default + volume_widget(), + -- customized + volume_widget{ + widget_type = 'arc' + }, +``` + +Note that widget uses following command the get the current volume: `amixer -D pulse sget Master`, so please make sure that it works for you, otherwise you need to set parameter `device = 'default'`. + +### Shortcuts + +To improve responsiveness of the widget when volume level is changed by a shortcut use corresponding methods of the widget: + +```lua +awful.key({ modkey }, "]", function() volume_widget:inc(5) end), +awful.key({ modkey }, "[", function() volume_widget:dec(5) end), +awful.key({ modkey }, "\\", function() volume_widget:toggle() end), +``` + +## Customization + +It is possible to customize the widget by providing a table with all or some of the following config parameters: + +### Generic parameter + +| Name | Default | Description | +|---|---|---| +| `mixer_cmd` | `pavucontrol` | command to run on middle click (e.g. a mixer program) | +| `step` | `5` | How much the volume is raised or lowered at once (in %) | +| `widget_type`| `icon_and_text`| Widget type, one of `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` | +| `device` | `pulse` | Select the device name to control | + +Depends on the chosen widget type add parameters from the corresponding section below: + +#### `icon` parameters + +| Name | Default | Description | +|---|---|---| +| `icon_dir`| `./icons`| Path to the folder with icons | + +_Note:_ if you are changing icons, the folder should contain following .svg images: + - audio-volume-high-symbolic + - audio-volume-medium-symbolic + - audio-volume-low-symbolic + - audio-volume-muted-symbolic + +#### `icon_and_text` parameters + +| Name | Default | Description | +|---|---|---| +| `icon_dir`| `./icons`| Path to the folder with icons | +| `font` | `beautiful.font` | Font name and size, like `Play 12` | + +#### `arc` parameters + +| Name | Default | Description | +|---|---|---| +| `thickness` | 2 | Thickness of the arc | +| `main_color` | `beautiful.fg_color` | Color of the arc | +| `bg_color` | `#ffffff11` | Color of the arc's background | +| `mute_color` | `beautiful.fg_urgent` | Color of the arc when mute | +| `size` | 18 | Size of the widget | + +#### `horizontal_bar` parameters + +| Name | Default | Description | +|---|---|---| +| `main_color` | `beautiful.fg_normal` | Color of the bar | +| `mute_color` | `beautiful.fg_urgent` | Color of the bar when mute | +| `bg_color` | `'#ffffff11'` | Color of the bar's background | +| `width` | `50` | The bar width | +| `margins` | `10` | Top and bottom margins (if your wibar is 22 px high, bar will be 2 px = 22 - 2*10) | +| `shape` | `'bar'` | [gears.shape](https://awesomewm.org/doc/api/libraries/gears.shape.html), could be `octogon`, `hexagon`, `powerline`, etc | +| `with_icon` | `true` | Show volume icon| + +_Note:_ I didn't figure out how does the `forced_height` property of progressbar widget work (maybe it doesn't work at all), thus there is a workaround with margins. + +#### `vertical_bar` parameters + +| Name | Default | Description | +|---|---|---| +| `main_color` | `beautiful.fg_normal` | Color of the bar | +| `mute_color` | `beautiful.fg_urgent` | Color of the bar when mute | +| `bg_color` | `'#ffffff11'` | Color of the bar's background | +| `width` | `10` | The bar width | +| `margins` | `20` | Top and bottom margins (if your wibar is 22 px high, bar will be 2 px = 22 - 2*10) | +| `shape` | `'bar'` | [gears.shape](https://awesomewm.org/doc/api/libraries/gears.shape.html), could be `octogon`, `hexagon`, `powerline`, etc | +| `with_icon` | `true` | Show volume icon| diff --git a/rsrcs/awesome/volume-widget/screenshots/variations.png b/rsrcs/awesome/volume-widget/screenshots/variations.png new file mode 100644 index 0000000..21d7ead Binary files /dev/null and b/rsrcs/awesome/volume-widget/screenshots/variations.png differ diff --git a/rsrcs/awesome/volume-widget/screenshots/volume-sink-sources.png b/rsrcs/awesome/volume-widget/screenshots/volume-sink-sources.png new file mode 100644 index 0000000..7d010bc Binary files /dev/null and b/rsrcs/awesome/volume-widget/screenshots/volume-sink-sources.png differ diff --git a/rsrcs/awesome/volume-widget/utils.lua b/rsrcs/awesome/volume-widget/utils.lua new file mode 100644 index 0000000..417a666 --- /dev/null +++ b/rsrcs/awesome/volume-widget/utils.lua @@ -0,0 +1,105 @@ + + +local utils = {} + +local function split(string_to_split, separator) + if separator == nil then separator = "%s" end + local t = {} + + for str in string.gmatch(string_to_split, "([^".. separator .."]+)") do + table.insert(t, str) + end + + return t +end + +function utils.extract_sinks_and_sources(pacmd_output) + local sinks = {} + local sources = {} + local device + local properties + local ports + local in_sink = false + local in_source = false + local in_device = false + local in_properties = false + local in_ports = false + for line in pacmd_output:gmatch("[^\r\n]+") do + if string.match(line, 'source%(s%) available.') then + in_sink = false + in_source = true + end + if string.match(line, 'sink%(s%) available.') then + in_sink = true + in_source = false + end + + if string.match(line, 'index:') then + in_device = true + in_properties = false + device = { + id = line:match(': (%d+)'), + is_default = string.match(line, '*') ~= nil + } + if in_sink then + table.insert(sinks, device) + elseif in_source then + table.insert(sources, device) + end + end + + if string.match(line, '^\tproperties:') then + in_device = false + in_properties = true + properties = {} + device['properties'] = properties + end + + if string.match(line, 'ports:') then + in_device = false + in_properties = false + in_ports = true + ports = {} + device['ports'] = ports + end + + if string.match(line, 'active port:') then + in_device = false + in_properties = false + in_ports = false + device['active_port'] = line:match(': (.+)'):gsub('<',''):gsub('>','') + end + + if in_device then + local t = split(line, ': ') + local key = t[1]:gsub('\t+', ''):lower() + local value = t[2]:gsub('^<', ''):gsub('>$', '') + device[key] = value + end + + if in_properties then + local t = split(line, '=') + local key = t[1]:gsub('\t+', ''):gsub('%.', '_'):gsub('-', '_'):gsub(':', ''):gsub("%s+$", "") + local value + if t[2] == nil then + value = t[2] + else + value = t[2]:gsub('"', ''):gsub("^%s+", ""):gsub(' Analog Stereo', '') + end + properties[key] = value + end + + if in_ports then + local t = split(line, ': ') + local key = t[1] + if key ~= nil then + key = key:gsub('\t+', '') + end + ports[key] = t[2] + end + end + + return sinks, sources +end + +return utils \ No newline at end of file diff --git a/rsrcs/awesome/volume-widget/volume-2.svg b/rsrcs/awesome/volume-widget/volume-2.svg new file mode 100644 index 0000000..10f1c67 --- /dev/null +++ b/rsrcs/awesome/volume-widget/volume-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/rsrcs/awesome/volume-widget/volume.lua b/rsrcs/awesome/volume-widget/volume.lua new file mode 100644 index 0000000..4c44042 --- /dev/null +++ b/rsrcs/awesome/volume-widget/volume.lua @@ -0,0 +1,228 @@ +------------------------------------------------- +-- The Ultimate Volume Widget for Awesome Window Manager +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volume-widget + +-- @author Pavel Makhov +-- @copyright 2020 Pavel Makhov +------------------------------------------------- + +local awful = require("awful") +local wibox = require("wibox") +local spawn = require("awful.spawn") +local gears = require("gears") +local beautiful = require("beautiful") +local watch = require("awful.widget.watch") +local utils = require("awesome-wm-widgets.volume-widget.utils") + + +local LIST_DEVICES_CMD = [[sh -c "pacmd list-sinks; pacmd list-sources"]] +local function GET_VOLUME_CMD(device) return 'amixer -D ' .. device .. ' sget Master' end +local function INC_VOLUME_CMD(device, step) return 'amixer -D ' .. device .. ' sset Master ' .. step .. '%+' end +local function DEC_VOLUME_CMD(device, step) return 'amixer -D ' .. device .. ' sset Master ' .. step .. '%-' end +local function TOG_VOLUME_CMD(device) return 'amixer -D ' .. device .. ' sset Master toggle' end + + +local widget_types = { + icon_and_text = require("awesome-wm-widgets.volume-widget.widgets.icon-and-text-widget"), + icon = require("awesome-wm-widgets.volume-widget.widgets.icon-widget"), + arc = require("awesome-wm-widgets.volume-widget.widgets.arc-widget"), + horizontal_bar = require("awesome-wm-widgets.volume-widget.widgets.horizontal-bar-widget"), + vertical_bar = require("awesome-wm-widgets.volume-widget.widgets.vertical-bar-widget") +} +local volume = {} + +local rows = { layout = wibox.layout.fixed.vertical } + +local popup = awful.popup{ + bg = beautiful.bg_normal, + ontop = true, + visible = false, + shape = gears.shape.rounded_rect, + border_width = 1, + border_color = beautiful.bg_focus, + maximum_width = 400, + offset = { y = 5 }, + widget = {} +} + +local function build_main_line(device) + if device.active_port ~= nil and device.ports[device.active_port] ~= nil then + return device.properties.device_description .. ' ยท ' .. device.ports[device.active_port] + else + return device.properties.device_description + end +end + +local function build_rows(devices, on_checkbox_click, device_type) + local device_rows = { layout = wibox.layout.fixed.vertical } + for _, device in pairs(devices) do + + local checkbox = wibox.widget { + checked = device.is_default, + color = beautiful.bg_normal, + paddings = 2, + shape = gears.shape.circle, + forced_width = 20, + forced_height = 20, + check_color = beautiful.fg_urgent, + widget = wibox.widget.checkbox + } + + checkbox:connect_signal("button::press", function() + spawn.easy_async(string.format([[sh -c 'pacmd set-default-%s "%s"']], device_type, device.name), function() + on_checkbox_click() + end) + end) + + local row = wibox.widget { + { + { + { + checkbox, + valign = 'center', + layout = wibox.container.place, + }, + { + { + text = build_main_line(device), + align = 'left', + widget = wibox.widget.textbox + }, + left = 10, + layout = wibox.container.margin + }, + spacing = 8, + layout = wibox.layout.align.horizontal + }, + margins = 4, + layout = wibox.container.margin + }, + bg = beautiful.bg_normal, + widget = wibox.container.background + } + + row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) + row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) + + local old_cursor, old_wibox + row:connect_signal("mouse::enter", function() + local wb = mouse.current_wibox + old_cursor, old_wibox = wb.cursor, wb + wb.cursor = "hand1" + end) + row:connect_signal("mouse::leave", function() + if old_wibox then + old_wibox.cursor = old_cursor + old_wibox = nil + end + end) + + row:connect_signal("button::press", function() + spawn.easy_async(string.format([[sh -c 'pacmd set-default-%s "%s"']], device_type, device.name), function() + on_checkbox_click() + end) + end) + + table.insert(device_rows, row) + end + + return device_rows +end + +local function build_header_row(text) + return wibox.widget{ + { + markup = "" .. text .. "", + align = 'center', + widget = wibox.widget.textbox + }, + bg = beautiful.bg_normal, + widget = wibox.container.background + } +end + +local function rebuild_popup() + spawn.easy_async(LIST_DEVICES_CMD, function(stdout) + + local sinks, sources = utils.extract_sinks_and_sources(stdout) + + for i = 0, #rows do rows[i]=nil end + + table.insert(rows, build_header_row("SINKS")) + table.insert(rows, build_rows(sinks, function() rebuild_popup() end, "sink")) + table.insert(rows, build_header_row("SOURCES")) + table.insert(rows, build_rows(sources, function() rebuild_popup() end, "source")) + + popup:setup(rows) + end) +end + + +local function worker(user_args) + + local args = user_args or {} + + local mixer_cmd = args.mixer_cmd or 'pavucontrol' + local widget_type = args.widget_type + local refresh_rate = args.refresh_rate or 1 + local step = args.step or 5 + local device = args.device or 'pulse' + + if widget_types[widget_type] == nil then + volume.widget = widget_types['icon_and_text'].get_widget(args.icon_and_text_args) + else + volume.widget = widget_types[widget_type].get_widget(args) + end + + local function update_graphic(widget, stdout) + local mute = string.match(stdout, "%[(o%D%D?)%]") -- \[(o\D\D?)\] - [on] or [off] + if mute == 'off' then widget:mute() + elseif mute == 'on' then widget:unmute() + end + local volume_level = string.match(stdout, "(%d?%d?%d)%%") -- (\d?\d?\d)\%) + volume_level = string.format("% 3d", volume_level) + widget:set_volume_level(volume_level) + end + + function volume:inc(s) + spawn.easy_async(INC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:dec(s) + spawn.easy_async(DEC_VOLUME_CMD(device, s or step), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:toggle() + spawn.easy_async(TOG_VOLUME_CMD(device), function(stdout) update_graphic(volume.widget, stdout) end) + end + + function volume:mixer() + if mixer_cmd then + spawn.easy_async(mixer_cmd) + end + end + + volume.widget:buttons( + awful.util.table.join( + awful.button({}, 3, function() + if popup.visible then + popup.visible = not popup.visible + else + rebuild_popup() + popup:move_next_to(mouse.current_widget_geometry) + end + end), + awful.button({}, 4, function() volume:inc() end), + awful.button({}, 5, function() volume:dec() end), + awful.button({}, 2, function() volume:mixer() end), + awful.button({}, 1, function() volume:toggle() end) + ) + ) + + watch(GET_VOLUME_CMD(device), refresh_rate, update_graphic, volume.widget) + + return volume.widget +end + +return setmetatable(volume, { __call = function(_, ...) return worker(...) end }) diff --git a/rsrcs/awesome/volume-widget/widgets/arc-widget.lua b/rsrcs/awesome/volume-widget/widgets/arc-widget.lua new file mode 100644 index 0000000..b512f12 --- /dev/null +++ b/rsrcs/awesome/volume-widget/widgets/arc-widget.lua @@ -0,0 +1,46 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local thickness = args.thickness or 2 + local main_color = args.main_color or beautiful.fg_color + local bg_color = args.bg_color or '#ffffff11' + local mute_color = args.mute_color or beautiful.fg_urgent + local size = args.size or 18 + + return wibox.widget { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = true, + widget = wibox.widget.imagebox, + }, + max_value = 100, + thickness = thickness, + start_angle = 4.71238898, -- 2pi*3/4 + forced_height = size, + forced_width = size, + bg = bg_color, + paddings = 2, + widget = wibox.container.arcchart, + set_volume_level = function(self, new_value) + self.value = new_value + end, + mute = function(self) + self.colors = { mute_color } + end, + unmute = function(self) + self.colors = { main_color } + end + } + +end + + +return widget \ No newline at end of file diff --git a/rsrcs/awesome/volume-widget/widgets/horizontal-bar-widget.lua b/rsrcs/awesome/volume-widget/widgets/horizontal-bar-widget.lua new file mode 100644 index 0000000..be1f38d --- /dev/null +++ b/rsrcs/awesome/volume-widget/widgets/horizontal-bar-widget.lua @@ -0,0 +1,58 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') +local gears = require("gears") + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local main_color = args.main_color or beautiful.fg_normal + local mute_color = args.mute_color or beautiful.fg_urgent + local bg_color = args.bg_color or '#ffffff11' + local width = args.width or 50 + local margins = args.margins or 10 + local shape = args.shape or 'bar' + local with_icon = args.with_icon == true and true or false + + local bar = wibox.widget { + { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + visible = with_icon, + layout = wibox.container.place, + }, + { + id = 'bar', + max_value = 100, + forced_width = width, + color = main_color, + margins = { top = margins, bottom = margins }, + background_color = bg_color, + shape = gears.shape[shape], + widget = wibox.widget.progressbar, + }, + spacing = 4, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('bar')[1]:set_value(tonumber(new_value)) + end, + mute = function(self) + self:get_children_by_id('bar')[1]:set_color(mute_color) + end, + unmute = function(self) + self:get_children_by_id('bar')[1]:set_color(main_color) + end + } + + return bar +end + +return widget diff --git a/rsrcs/awesome/volume-widget/widgets/icon-and-text-widget.lua b/rsrcs/awesome/volume-widget/widgets/icon-and-text-widget.lua new file mode 100644 index 0000000..b1a2793 --- /dev/null +++ b/rsrcs/awesome/volume-widget/widgets/icon-and-text-widget.lua @@ -0,0 +1,59 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') + +local widget = {} + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local font = args.font or beautiful.font + local icon_dir = args.icon_dir or ICON_DIR + + return wibox.widget { + { + { + id = "icon", + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place + }, + { + id = 'txt', + font = font, + widget = wibox.widget.textbox + }, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('txt')[1]:set_text(new_value) + local volume_icon_name + if self.is_muted then + volume_icon_name = 'audio-volume-muted-symbolic' + else + local new_value_num = tonumber(new_value) + if (new_value_num >= 0 and new_value_num < 33) then + volume_icon_name="audio-volume-low-symbolic" + elseif (new_value_num < 66) then + volume_icon_name="audio-volume-medium-symbolic" + else + volume_icon_name="audio-volume-high-symbolic" + end + end + self:get_children_by_id('icon')[1]:set_image(icon_dir .. volume_icon_name .. '.svg') + end, + mute = function(self) + self.is_muted = true + self:get_children_by_id('icon')[1]:set_image(icon_dir .. 'audio-volume-muted-symbolic.svg') + end, + unmute = function(self) + self.is_muted = false + end + } + +end + + +return widget \ No newline at end of file diff --git a/rsrcs/awesome/volume-widget/widgets/icon-widget.lua b/rsrcs/awesome/volume-widget/widgets/icon-widget.lua new file mode 100644 index 0000000..cc39a3d --- /dev/null +++ b/rsrcs/awesome/volume-widget/widgets/icon-widget.lua @@ -0,0 +1,46 @@ +local wibox = require("wibox") + +local widget = {} + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local icon_dir = args.icon_dir or ICON_DIR + + return wibox.widget { + { + id = "icon", + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + layout = wibox.container.place, + set_volume_level = function(self, new_value) + local volume_icon_name + if self.is_muted then + volume_icon_name = 'audio-volume-muted-symbolic' + else + local new_value_num = tonumber(new_value) + if (new_value_num >= 0 and new_value_num < 33) then + volume_icon_name="audio-volume-low-symbolic" + elseif (new_value_num < 66) then + volume_icon_name="audio-volume-medium-symbolic" + else + volume_icon_name="audio-volume-high-symbolic" + end + end + self:get_children_by_id('icon')[1]:set_image(icon_dir .. volume_icon_name .. '.svg') + end, + mute = function(self) + self.is_muted = true + self:get_children_by_id('icon')[1]:set_image(icon_dir .. 'audio-volume-muted-symbolic.svg') + end, + unmute = function(self) + self.is_muted = false + end + } +end + +return widget \ No newline at end of file diff --git a/rsrcs/awesome/volume-widget/widgets/vertical-bar-widget.lua b/rsrcs/awesome/volume-widget/widgets/vertical-bar-widget.lua new file mode 100644 index 0000000..6f32b50 --- /dev/null +++ b/rsrcs/awesome/volume-widget/widgets/vertical-bar-widget.lua @@ -0,0 +1,64 @@ +local wibox = require("wibox") +local beautiful = require('beautiful') +local gears = require("gears") + +local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/volume-widget/icons/' + +local widget = {} + +function widget.get_widget(widgets_args) + local args = widgets_args or {} + + local main_color = args.main_color or beautiful.fg_normal + local mute_color = args.mute_color or beautiful.fg_urgent + local bg_color = args.bg_color or '#ffffff11' + local width = args.width or 10 + local margins = args.height or 2 + local shape = args.shape or 'bar' + local with_icon = args.with_icon == true and true or false + + local bar = wibox.widget { + { + { + id = "icon", + image = ICON_DIR .. 'audio-volume-high-symbolic.svg', + resize = false, + widget = wibox.widget.imagebox, + }, + valign = 'center', + visible = with_icon, + layout = wibox.container.place, + }, + { + { + id = 'bar', + max_value = 100, + forced_width = width, + forced_height = 5, + margins = { top = margins, bottom = margins }, + color = main_color, + background_color = bg_color, + shape = gears.shape[shape], + widget = wibox.widget.progressbar, + }, + forced_width = width, + direction = 'east', + layout = wibox.container.rotate, + }, + spacing = 4, + layout = wibox.layout.fixed.horizontal, + set_volume_level = function(self, new_value) + self:get_children_by_id('bar')[1]:set_value(tonumber(new_value)) + end, + mute = function(self) + self:get_children_by_id('bar')[1]:set_color(mute_color) + end, + unmute = function(self) + self:get_children_by_id('bar')[1]:set_color(main_color) + end + } + + return bar +end + +return widget diff --git a/rsrcs/awesome/window_rules.lua b/rsrcs/awesome/window_rules.lua new file mode 100644 index 0000000..0bdd623 --- /dev/null +++ b/rsrcs/awesome/window_rules.lua @@ -0,0 +1,65 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local keys = require("key_conf") + +local clientkeys = keys.clientkeys +local clientbuttons = keys.clientbuttons + +-- {{{ 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 + } + }, + + -- Floating clients. + { rule_any = { + instance = { + "DTA", -- Firefox addon DownThemAll. + "copyq", -- Includes session name in class. + "pinentry", + }, + class = { + "constellation", + "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 }}, + + -- Add titlebars to normal clients and dialogs + { rule_any = {type = { "normal", "dialog" } + }, properties = { titlebars_enabled = true } + }, + + -- Set Firefox to always map on the tag named "2" on screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { screen = 1, tag = "2" } }, +} +-- }}} diff --git a/users/nicholix.nix b/users/nicholix.nix index ce33a19..7d96784 100644 --- a/users/nicholix.nix +++ b/users/nicholix.nix @@ -29,6 +29,12 @@ in programs.direnv.nix-direnv.enable = true; home = { + file = { + "awesome" = { + source = ../rsrcs/awesome; + target = "/home/nicholix/.config/awesome"; + }; + }; # Home Manager needs a bit of information about you and the # paths it should manage. username = local_user; @@ -81,4 +87,8 @@ in NIX_SHELL_PRESERVE_PROMPT = 1; }; }; + xsession = { + enable = true; + windowManager.command = "none+awesome-wm"; + }; }