diff --git a/README.org b/README.org index 9fc0342..dd877be 100644 --- a/README.org +++ b/README.org @@ -44,7 +44,6 @@ local wibox = require("wibox") local beautiful = require("beautiful") -- Notification library local naughty = require("naughty") -local menubar = require("menubar") local hotkeys_popup = require("awful.hotkeys_popup") -- Enable hotkeys help widget for VIM and other apps -- when client with a matching name is opened: @@ -85,13 +84,33 @@ end #+BEGIN_SRC lua :tangle rc.lua -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. -beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") +beautiful.init("/home/sravan/.config/awesome/theme.lua") -- This is used later as the default terminal and editor to run. -terminal = "xterm" -editor = os.getenv("EDITOR") or "nano" +terminal = "kitty" +editor = os.getenv("EDITOR") or "vim" editor_cmd = terminal .. " -e " .. editor +rofi_cmd = "rofi -show combi" +control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi" +brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi" +clipboard_cmd = "rofi -show clipboard" +rbw_cmd = "rofi-rbw" +volume_cmd = "/home/sravan/.scripts/pactl.sh --rofi" +media_cmd = "/home/sravan/.scripts/playerctl.sh --rofi" +notification_cmd = "/home/sravan/.scripts/deadd.sh --rofi" +session_cmd = "/home/sravan/.scripts/session.sh --rofi" +compositor_cmd = "/home/sravan/.scripts/picom.sh --rofi" +lower_volume_cmd = "/home/sravan/.scripts/pactl.sh --lower" +mute_volume_cmd = "/home/sravan/.scripts/pactl.sh --mute" +raise_volume_cmd = "/home/sravan/.scripts/pactl.sh --raise" +player_play_pause_cmd = "/home/sravan/.scripts/playerctl.sh --play-pause" +player_next_cmd = "/home/sravan/.scripts/playerctl.sh --next" +player_prev_cmd = "/home/sravan/.scripts/playerctl.sh --prev" +flameshot_cmd = "flameshot gui" +force_close_window_cmd = "xkill" +trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh" + -- 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, @@ -101,7 +120,6 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - awful.layout.suit.floating, awful.layout.suit.tile, awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, @@ -113,10 +131,11 @@ awful.layout.layouts = { awful.layout.suit.max, awful.layout.suit.max.fullscreen, awful.layout.suit.magnifier, - awful.layout.suit.corner.nw, + -- awful.layout.suit.corner.nw, -- awful.layout.suit.corner.ne, -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, + awful.layout.suit.floating, } -- }}} #+END_SRC @@ -141,9 +160,6 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) - --- Menubar configuration -menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} #+END_SRC @@ -218,7 +234,7 @@ screen.connect_signal("property::geometry", set_wallpaper) awful.screen.connect_for_each_screen(function(s) -- Wallpaper - set_wallpaper(s) + -- set_wallpaper(s) -- Each screen has its own tag table. awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) @@ -262,7 +278,7 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, - mykeyboardlayout, + -- mykeyboardlayout, wibox.widget.systray(), mytextclock, s.mylayoutbox, @@ -318,9 +334,9 @@ globalkeys = gears.table.join( {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, + awful.key({ modkey, }, ".", 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, + awful.key({ modkey, }, ",", 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"}), @@ -334,7 +350,7 @@ globalkeys = gears.table.join( {description = "go back", group = "client"}), -- Standard program - awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), @@ -384,9 +400,24 @@ globalkeys = gears.table.join( } end, {description = "lua execute prompt", group = "awesome"}), + -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + awful.key({ modkey }, "p", function() awful.spawn(rofi_cmd) end, + {description = "show rofi menu", group = "launcher"}), + + -- Media Keys + awful.key({ }, "XF86AudioLowerVolume", function() awful.spawn(lower_volume_cmd) end, + {description = "Lower audio volume", group = "media"}), + awful.key({ }, "XF86AudioMute", function() awful.spawn(mute_volume_cmd) end, + {description = "Mute audio", group = "media"}), + awful.key({ }, "XF86AudioRaiseVolume", function() awful.spawn(raise_volume_cmd) end, + {description = "Raise audio volume", group = "media"}), + awful.key({ }, "XF86AudioPlay", function() awful.spawn(player_play_pause_cmd) end, + {description = "Play / Pause Media", group = "media"}), + awful.key({ }, "XF86AudioNext", function() awful.spawn(player_next_cmd) end, + {description = "Next media track", group = "media"}), + awful.key({ }, "XF86AudioPrev", function() awful.spawn(player_prev_cmd) end, + {description = "Previous media track", group = "media"}) ) clientkeys = gears.table.join( @@ -400,7 +431,7 @@ clientkeys = gears.table.join( {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, + awful.key({ modkey, }, "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"}), diff --git a/rc.lua b/rc.lua index 4e1d95a..882254f 100644 --- a/rc.lua +++ b/rc.lua @@ -12,7 +12,6 @@ local wibox = require("wibox") local beautiful = require("beautiful") -- Notification library local naughty = require("naughty") -local menubar = require("menubar") local hotkeys_popup = require("awful.hotkeys_popup") -- Enable hotkeys help widget for VIM and other apps -- when client with a matching name is opened: @@ -45,13 +44,33 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. -beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") +beautiful.init("/home/sravan/.config/awesome/theme.lua") -- This is used later as the default terminal and editor to run. -terminal = "xterm" -editor = os.getenv("EDITOR") or "nano" +terminal = "kitty" +editor = os.getenv("EDITOR") or "vim" editor_cmd = terminal .. " -e " .. editor +rofi_cmd = "rofi -show combi" +control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi" +brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi" +clipboard_cmd = "rofi -show clipboard" +rbw_cmd = "rofi-rbw" +volume_cmd = "/home/sravan/.scripts/pactl.sh --rofi" +media_cmd = "/home/sravan/.scripts/playerctl.sh --rofi" +notification_cmd = "/home/sravan/.scripts/deadd.sh --rofi" +session_cmd = "/home/sravan/.scripts/session.sh --rofi" +compositor_cmd = "/home/sravan/.scripts/picom.sh --rofi" +lower_volume_cmd = "/home/sravan/.scripts/pactl.sh --lower" +mute_volume_cmd = "/home/sravan/.scripts/pactl.sh --mute" +raise_volume_cmd = "/home/sravan/.scripts/pactl.sh --raise" +player_play_pause_cmd = "/home/sravan/.scripts/playerctl.sh --play-pause" +player_next_cmd = "/home/sravan/.scripts/playerctl.sh --next" +player_prev_cmd = "/home/sravan/.scripts/playerctl.sh --prev" +flameshot_cmd = "flameshot gui" +force_close_window_cmd = "xkill" +trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh" + -- 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, @@ -61,7 +80,6 @@ modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - awful.layout.suit.floating, awful.layout.suit.tile, awful.layout.suit.tile.left, awful.layout.suit.tile.bottom, @@ -73,10 +91,11 @@ awful.layout.layouts = { awful.layout.suit.max, awful.layout.suit.max.fullscreen, awful.layout.suit.magnifier, - awful.layout.suit.corner.nw, + -- awful.layout.suit.corner.nw, -- awful.layout.suit.corner.ne, -- awful.layout.suit.corner.sw, -- awful.layout.suit.corner.se, + awful.layout.suit.floating, } -- }}} @@ -97,9 +116,6 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) - --- Menubar configuration -menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} -- Keyboard map indicator and switcher @@ -166,7 +182,7 @@ screen.connect_signal("property::geometry", set_wallpaper) awful.screen.connect_for_each_screen(function(s) -- Wallpaper - set_wallpaper(s) + -- set_wallpaper(s) -- Each screen has its own tag table. awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) @@ -210,7 +226,7 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, - mykeyboardlayout, + -- mykeyboardlayout, wibox.widget.systray(), mytextclock, s.mylayoutbox, @@ -258,9 +274,9 @@ globalkeys = gears.table.join( {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, + awful.key({ modkey, }, ".", 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, + awful.key({ modkey, }, ",", 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"}), @@ -274,7 +290,7 @@ globalkeys = gears.table.join( {description = "go back", group = "client"}), -- Standard program - awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), @@ -324,9 +340,24 @@ globalkeys = gears.table.join( } end, {description = "lua execute prompt", group = "awesome"}), + -- Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}) + awful.key({ modkey }, "p", function() awful.spawn(rofi_cmd) end, + {description = "show rofi menu", group = "launcher"}), + + -- Media Keys + awful.key({ }, "XF86AudioLowerVolume", function() awful.spawn(lower_volume_cmd) end, + {description = "Lower audio volume", group = "media"}), + awful.key({ }, "XF86AudioMute", function() awful.spawn(mute_volume_cmd) end, + {description = "Mute audio", group = "media"}), + awful.key({ }, "XF86AudioRaiseVolume", function() awful.spawn(raise_volume_cmd) end, + {description = "Raise audio volume", group = "media"}), + awful.key({ }, "XF86AudioPlay", function() awful.spawn(player_play_pause_cmd) end, + {description = "Play / Pause Media", group = "media"}), + awful.key({ }, "XF86AudioNext", function() awful.spawn(player_next_cmd) end, + {description = "Next media track", group = "media"}), + awful.key({ }, "XF86AudioPrev", function() awful.spawn(player_prev_cmd) end, + {description = "Previous media track", group = "media"}) ) clientkeys = gears.table.join( @@ -340,7 +371,7 @@ clientkeys = gears.table.join( {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, + awful.key({ modkey, }, "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"}), diff --git a/theme.lua b/theme.lua new file mode 100644 index 0000000..e11a83c --- /dev/null +++ b/theme.lua @@ -0,0 +1,134 @@ +--------------------------------------------- +-- Awesome theme which follows xrdb config -- +-- by Yauhen Kirylau -- +--------------------------------------------- + +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi +local xrdb = xresources.get_current_theme() +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +-- inherit default theme +local theme = dofile(themes_path.."default/theme.lua") +-- load vector assets' generators for this theme + +theme.font = "sans 8" + +theme.bg_normal = xrdb.background +theme.bg_focus = xrdb.color12 +theme.bg_urgent = xrdb.color9 +theme.bg_minimize = xrdb.color8 +theme.bg_systray = theme.bg_normal + +theme.fg_normal = xrdb.foreground +theme.fg_focus = theme.bg_normal +theme.fg_urgent = theme.bg_normal +theme.fg_minimize = theme.bg_normal + +theme.useless_gap = dpi(3) +theme.border_width = dpi(2) +theme.border_normal = xrdb.color0 +theme.border_focus = theme.bg_focus +theme.border_marked = xrdb.color10 + +-- There are other variable sets +-- overriding the default one when +-- defined, the sets are: +-- taglist_[bg|fg]_[focus|urgent|occupied|empty|volatile] +-- tasklist_[bg|fg]_[focus|urgent] +-- titlebar_[bg|fg]_[normal|focus] +-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] +-- mouse_finder_[color|timeout|animate_timeout|radius|factor] +-- Example: +--theme.taglist_bg_focus = "#ff0000" + +theme.tooltip_fg = theme.fg_normal +theme.tooltip_bg = theme.bg_normal + +-- Variables set for theming the menu: +-- menu_[bg|fg]_[normal|focus] +-- menu_[border_color|border_width] +theme.menu_submenu_icon = themes_path.."default/submenu.png" +theme.menu_height = dpi(16) +theme.menu_width = dpi(100) + +-- You can add as many variables as +-- you wish and access them by using +-- beautiful.variable in your rc.lua +--theme.bg_widget = "#cc0000" + +-- Recolor Layout icons: +theme = theme_assets.recolor_layout(theme, theme.fg_normal) + +-- Recolor titlebar icons: +-- +local function darker(color_value, darker_n) + local result = "#" + for s in color_value:gmatch("[a-fA-F0-9][a-fA-F0-9]") do + local bg_numeric_value = tonumber("0x"..s) - darker_n + if bg_numeric_value < 0 then bg_numeric_value = 0 end + if bg_numeric_value > 255 then bg_numeric_value = 255 end + result = result .. string.format("%2.2x", bg_numeric_value) + end + return result +end +theme = theme_assets.recolor_titlebar( + theme, theme.fg_normal, "normal" +) +theme = theme_assets.recolor_titlebar( + theme, darker(theme.fg_normal, -60), "normal", "hover" +) +theme = theme_assets.recolor_titlebar( + theme, xrdb.color1, "normal", "press" +) +theme = theme_assets.recolor_titlebar( + theme, theme.fg_focus, "focus" +) +theme = theme_assets.recolor_titlebar( + theme, darker(theme.fg_focus, -60), "focus", "hover" +) +theme = theme_assets.recolor_titlebar( + theme, xrdb.color1, "focus", "press" +) + +-- 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 + +-- Generate Awesome icon: +theme.awesome_icon = theme_assets.awesome_icon( + theme.menu_height, theme.bg_focus, theme.fg_focus +) + +-- 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 +) + +-- Try to determine if we are running light or dark colorscheme: +local bg_numberic_value = 0; +for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do + bg_numberic_value = bg_numberic_value + tonumber("0x"..s); +end +local is_dark_bg = (bg_numberic_value < 383) + +-- Generate wallpaper: +local wallpaper_bg = xrdb.color8 +local wallpaper_fg = xrdb.color7 +local wallpaper_alt_fg = xrdb.color12 +if not is_dark_bg then + wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg +end +theme.wallpaper = function(s) + return theme_assets.wallpaper(wallpaper_bg, wallpaper_fg, wallpaper_alt_fg, s) +end + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80