From bdc9927c6211f9ad66b4554d796f0233d47baf87 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 16 Sep 2020 06:30:31 -0500 Subject: [PATCH] Added more of awesome into fennel over lua --- awesome/init.fnl | 22 +++++++++++-- awesome/keys.fnl | 11 +++---- awesome/module/notifications.lua | 28 +++++++---------- awesome/rc.lua | 54 +++++++++++--------------------- awesome/rules.fnl | 20 ++++++++++-- awesome/theme.lua | 2 ++ picom.conf | 21 ++++++++----- rofi/launchers-git/windows.sh | 17 ++++++++++ 8 files changed, 104 insertions(+), 71 deletions(-) create mode 100755 rofi/launchers-git/windows.sh diff --git a/awesome/init.fnl b/awesome/init.fnl index bf720c5..2841cf9 100644 --- a/awesome/init.fnl +++ b/awesome/init.fnl @@ -5,8 +5,24 @@ (local gears (require "gears")) (local keys (require "keys")) -;; (gears.wallpaper.set (beautiful.wallpaper)) - +;;; rules (set awful.rules.rules rules) -(root.keys keys.globalkeys) +;;; wallpaper +(fn set-wallpaper [s] + (local wallpaper beautiful.wallpaper) + (gears.wallpaper.maximized wallpaper s false)) + +(awful.screen.connect_for_each_screen set-wallpaper) +(screen.connect_signal "property::geometry" set-wallpaper) + +;;; autostart applications +(awful.spawn.with_shell "picom --experimental-backend") +(awful.spawn.with_shell "xset r rate 220 90") +(awful.spawn.with_shell "/usr/lib/polkit-kde-authentication-agent-1") +(awful.spawn.with_shell "feh --bg-fill ~/Pictures/wallpapers/RoyalKing.png") +(awful.spawn.with_shell "flameshot") +(awful.spawn.with_shell "caffeine") +(awful.spawn.with_shell "nextcloud --background") +(awful.spawn.with_shell "emacs -daemon") +(awful.spawn.with_shell "libinput-gestures-setup start") diff --git a/awesome/keys.fnl b/awesome/keys.fnl index b972f41..c7116a4 100644 --- a/awesome/keys.fnl +++ b/awesome/keys.fnl @@ -10,13 +10,12 @@ :alt "Mod1" }) -(local globalkeys (gears.table.join - (key [:mod :alt] "m" (awful.spawn "mpv --player-operation-mode=pseudo-gui")) - (key [:mod] "s" hotkeys_popup.show_help) - )) +(local globalkeys (awful.keyboard.append_global_keybindings [ + (awful.key [:mod :alt] "m" (awful.spawn "mpv --player-operation-mode=pseudo-gui")) + (awful.key [:mod] "s" hotkeys_popup.show_help) + ])) -(root.keys globalkeys) -keys +globalkeys diff --git a/awesome/module/notifications.lua b/awesome/module/notifications.lua index 81ff7df..25c2b4d 100644 --- a/awesome/module/notifications.lua +++ b/awesome/module/notifications.lua @@ -18,17 +18,15 @@ naughty.config.defaults.title = 'System Notification' naughty.config.defaults.margin = dpi(100) naughty.config.defaults.border_width = 0 naughty.config.defaults.position = 'top_right' +naughty.config.defaults.screen = 1 naughty.config.defaults.shape = function(cr, w, h) gears.shape.rounded_rect(cr, w, h, dpi(6)) end -- Apply theme variables -naughty.config.padding = 8 -naughty.config.spacing = 8 +naughty.config.padding = dpi(20) +naughty.config.spacing = dpi(20) naughty.config.icon_dirs = { - "/usr/share/icons/Tela", - "/usr/share/icons/Tela-blue-dark", "/usr/share/icons/Papirus/", - "/usr/share/icons/la-capitaine-icon-theme/", "/usr/share/icons/gnome/", "/usr/share/icons/hicolor/", "/usr/share/pixmaps/" @@ -150,7 +148,7 @@ naughty.connect_signal("request::display", function(n) notification = n, type = "notification", screen = awful.screen.preferred(), - shape = gears.shape.rectangle, + shape = gears.shape.rounded_rectangle, widget_template = { { { @@ -168,7 +166,6 @@ naughty.connect_signal("request::display", function(n) align = 'center', valign = 'center', widget = wibox.widget.textbox - }, margins = beautiful.notification_margin, widget = wibox.container.margin, @@ -192,11 +189,11 @@ naughty.connect_signal("request::display", function(n) nil, { { - align = 'left', + align = 'center', widget = naughty.widget.title }, { - align = "left", + align = "center", widget = naughty.widget.message, }, layout = wibox.layout.fixed.vertical @@ -248,15 +245,14 @@ naughty.connect_signal("request::display", function(n) }, -- Margin of the fake BG to have a space between notification and the screen edge -- margins = dpi(15),--beautiful.notification_margin, - right = dpi(10), - left = dpi(10), - bottom = dpi(10), - top = dpi(15), + right = dpi(20), + left = dpi(0), + bottom = dpi(0), + top = dpi(20), widget = wibox.container.margin }, - right = dpi(100), - top = dpi(150), - widget = wibox.container.margin + bg = beautiful.transparent, + widget = wibox.container.background } -- Destroy popups if dont_disturb mode is on diff --git a/awesome/rc.lua b/awesome/rc.lua index a717b59..d78fc4f 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -37,31 +37,6 @@ require('module.brightness-osd') -- require('module.battery-notifier') -- require('module.lockscreen') --- -- {{{ 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. beautiful.init("/home/chris/.config/awesome/theme.lua") @@ -560,6 +535,16 @@ awful.keyboard.append_global_keybindings({ awful.util.spawn("/home/chris/.dotfiles/rofi/launchers-git/launcher.sh") end, {description = "launch rofi", group = "launcher"}), + -- Window Switcher + awful.key({ modkey }, "Tab", function () + awful.util.spawn("/home/chris/.dotfiles/rofi/launchers-git/windows.sh") end, + {description = "launch rofi window switcher", group = "launcher"}), + + -- Emoji Selector + awful.key({ modkey }, ".", function () + awful.util.spawn("/home/chris/.dotfiles/rofi/launchers-git/emoji.sh") end, + {description = "launch rofi emoji picker", group = "launcher"}), + awful.key({ modkey }, "x", function () awful.prompt.run { @@ -717,23 +702,20 @@ end) -- c:emit_signal("request::activate", "mouse_enter", {raise = false}) -- end) --- Enable nice titlebars -nice() - 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) -- }}} -- {{{ Autostart Applications -awful.spawn.with_shell("picom --experimental-backend") -awful.spawn.with_shell("libinput-gestures-setup start") -awful.spawn.with_shell("flameshot") -awful.spawn.with_shell("xset r rate 220 90") +-- awful.spawn.with_shell("picom --experimental-backend") +-- awful.spawn.with_shell("libinput-gestures-setup start") +-- awful.spawn.with_shell("flameshot") +-- awful.spawn.with_shell("xset r rate 220 90") -- awful.spawn.with_shell("feh --bg-fill ~/Pictures/wallpapers/RoyalKing.png") -awful.spawn.with_shell("/usr/lib/polkit-kde-authentication-agent-1") -awful.spawn.with_shell("emacs -daemon") -awful.spawn.with_shell("nextcloud --background") -awful.spawn.with_shell("caffeine") +-- awful.spawn.with_shell("/usr/lib/polkit-kde-authentication-agent-1") +-- awful.spawn.with_shell("emacs -daemon") +-- awful.spawn.with_shell("nextcloud --background") +-- awful.spawn.with_shell("caffeine") -- }}} diff --git a/awesome/rules.fnl b/awesome/rules.fnl index 95dc3bf..536bd33 100644 --- a/awesome/rules.fnl +++ b/awesome/rules.fnl @@ -11,7 +11,7 @@ :propertites { :border-width beautiful.border_width :border_color beautiful.border_normal - :focus awful.client.focus.filter + :focus true :raise true :screen awful.screen.preferred :placement (+ awful.placement.no_overlap awful.placement.no_offscreen) @@ -23,6 +23,20 @@ :rule_any { :class [ "mpv" + ] + } + :properties { + :floating true + :raise true + :focus true + :height 800 + :screen 2 + :placement (+ awful.placement.no_offscreen awful.placement.centered) + } + } + { + :rule_any { + :class [ "dolphin" "feh" "Arandr" @@ -36,8 +50,10 @@ "GtkFileChooserDialog" ]} :properties { - :placement awful.placement.centered :floating true + :raise true + :focus true + :placement (+ awful.placement.no_offscreen awful.placement.centered) } } ]) diff --git a/awesome/theme.lua b/awesome/theme.lua index 5a6492e..1607694 100644 --- a/awesome/theme.lua +++ b/awesome/theme.lua @@ -33,6 +33,7 @@ theme.red = "#ff5c57" theme.useless_gap = dpi(16) theme.border_width = dpi(0) +theme.transparent = "#00000000" theme.border_normal = "#00000000" theme.border_focus = "#00000000" theme.border_marked = "#00000000" @@ -71,6 +72,7 @@ theme.tasklist_bg = theme.red -- notification_font -- notification_[bg|fg] -- notification_[width|height|margin] +theme.notification_margin = 4 -- notification_[border_color|border_width|shape|opacity] -- Variables set for theming the menu: diff --git a/picom.conf b/picom.conf index 22ead53..bd88939 100644 --- a/picom.conf +++ b/picom.conf @@ -2,7 +2,7 @@ # Corners # ################################# # requires: https://github.com/sdhand/compton -corner-radius = 11.0; +corner-radius = 12.0; rounded-corners-exclude = [ #"window_type = 'normal'", "class_g = 'awesome'", @@ -40,11 +40,11 @@ shadow-opacity = .75 # The left offset for shadows, in pixels. (defaults to -15) # shadow-offset-x = -15 -shadow-offset-x = 0; +shadow-offset-x = 3; # The top offset for shadows, in pixels. (defaults to -15) # shadow-offset-y = -15 -shadow-offset-y = 0; +shadow-offset-y = 3; # Avoid drawing shadows on dock/panel windows. This option is deprecated, # you should use the *wintypes* option in your config file instead. @@ -98,7 +98,7 @@ shadow-exclude = [ # shadow-exclude-reg = "x10+0+0" # for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. # -shadow-exclude-reg = "x90+0+0" +shadow-exclude-reg = "x0+0+0" # Crop shadow of a window fully on a particular Xinerama screen to the screen. # xinerama-shadow-crop = false @@ -116,11 +116,11 @@ fading = true; # Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) # fade-in-step = 0.028 -fade-in-step = 0.03; +fade-in-step = 0.3; # Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) # fade-out-step = 0.03 -fade-out-step = 0.03; +fade-out-step = 0.3; # The time between steps in fade step, in milliseconds. (> 0, defaults to 10) # fade-delta = 10 @@ -159,7 +159,7 @@ frame-opacity = 0.7; inactive-opacity-override = false; # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) -active-opacity = 1.0; +active-opacity = 0.8; # Dim inactive windows. (0.0 - 1.0, defaults to 0.0) # inactive-dim = 0.0 @@ -196,6 +196,9 @@ opacity-rule = [ "70:class_g = 'TelegramDesktop'", "90:class_g = 'Joplin'", "100:class_g = 'firefox'", + "100:class_g = 'dolphin'", + "100:class_g = 'mpv'", + "100:class_g = 'libreoffice'", "100:class_g = 'Thunderbird'" ]; @@ -259,7 +262,9 @@ blur-background-exclude = [ # when taking selection screenshot with `main` # https://github.com/naelstrof/maim/issues/130 "class_g = 'slop'", - "_GTK_FRAME_EXTENTS@:c" + "_GTK_FRAME_EXTENTS@:c", + # "window_type = '_NET_WM_WINDOW_TYPE_NOTIFICATION'" + "window_type = 'notification'" ]; diff --git a/rofi/launchers-git/windows.sh b/rofi/launchers-git/windows.sh new file mode 100755 index 0000000..cd1d8ce --- /dev/null +++ b/rofi/launchers-git/windows.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya (adi1090x) +## Mail : adi1090x@gmail.com +## Github : @adi1090x +## Reddit : @adi1090x + +# Available Styles +# >> Styles Below Only Works With "rofi-git(AUR)", Current Version: 1.5.4-76-gca067234 +# +# blurry blurry_full kde_simplemenu kde_krunner launchpad +# gnome_do slingshot appdrawer appfolder column +# row row_center screen row_dock row_dropdown + +style="blurry" + +rofi -no-lazy-grab -show window -modi drun,window,calc,ssh,run,emoji -theme launchers-git/"$style".rasi