making nice only work on desktop for now

This commit is contained in:
Chris Cochrun 2020-09-16 06:36:21 -05:00
parent 697f504169
commit 93b95448cb
6 changed files with 194 additions and 20 deletions

View file

@ -18,11 +18,19 @@ local beautiful = require("beautiful")
-- local naughty = require("naughty") -- local naughty = require("naughty")
local menubar = require("menubar") local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup")
<<<<<<< HEAD
local nice = require("nice") local nice = require("nice")
=======
local ruled = require("ruled")
local ruls = require("configuration.client.rules")
-- local nice = require("nice")
>>>>>>> 05f8e08... making nice only work on desktop for now
-- Enable hotkeys help widget for VIM and other apps -- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened: -- when client with a matching name is opened:
require("awful.hotkeys_popup.keys") require("awful.hotkeys_popup.keys")
-- {{{ Modules
require('module.notifications') require('module.notifications')
-- require('module.decorate-client') -- require('module.decorate-client')
require('module.backdrop') require('module.backdrop')
@ -37,6 +45,36 @@ require('module.brightness-osd')
-- require('module.battery-notifier') -- require('module.battery-notifier')
-- require('module.lockscreen') -- require('module.lockscreen')
<<<<<<< HEAD
=======
-- }}}
-- -- {{{ 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
-- -- }}}
>>>>>>> 05f8e08... making nice only work on desktop for now
-- {{{ Variable definitions -- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers. -- Themes define colours, icons, font and wallpapers.
beautiful.init("/home/chris/.config/awesome/theme.lua") beautiful.init("/home/chris/.config/awesome/theme.lua")
@ -155,7 +193,7 @@ local function set_wallpaper(s)
if type(wallpaper) == "function" then if type(wallpaper) == "function" then
wallpaper = wallpaper(s) wallpaper = wallpaper(s)
end end
gears.wallpaper.maximized(wallpaper, s, true) gears.wallpaper.centered(wallpaper, s, "#282a36")
end end
end end
@ -187,7 +225,7 @@ awful.screen.connect_for_each_screen(function(s)
set_wallpaper(s) set_wallpaper(s)
-- Each screen has its own tag table. -- Each screen has its own tag table.
awful.tag({ "", "", "", ""}, s, awful.layout.layouts[1]) awful.tag({ "emacs", "web", "chat", "misc"}, s, awful.layout.layouts[1])
yoffset = dpi(45) yoffset = dpi(45)
@ -299,7 +337,7 @@ awful.screen.connect_for_each_screen(function(s)
} }
-- Create Battery, Network, and Volume widget -- Create Battery, Network, and Volume widget
s.battery = require('widget.battery')() s.battery = require('widget.battery')()
s.network = require('widget.network')() -- s.network = require('widget.network')()
s.volume = require('widget.volume')() s.volume = require('widget.volume')()
s.updater = require('widget.package-updater')() s.updater = require('widget.package-updater')()
@ -316,7 +354,7 @@ awful.screen.connect_for_each_screen(function(s)
s.volume, s.volume,
s.mysystray, s.mysystray,
s.updater, s.updater,
s.network, -- s.network,
s.battery, s.battery,
wibox.container.margin (s.mylayoutbox,0,dpi(25),0,0), wibox.container.margin (s.mylayoutbox,0,dpi(25),0,0),
}, },
@ -681,6 +719,91 @@ end)
root.keys(globalkeys) root.keys(globalkeys)
-- }}} -- }}}
<<<<<<< HEAD
=======
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
ruled.client.connect_signal(
'request::rules',
function()
-- All clients will match this rule.
ruled.client.append_rule {
-- 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,
rounded_corners = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
},
}
ruled.client.append_rule {
-- make mpv float
rule_any = {
class = {
"mpv",
"gl",
"vlc"
}
},
properties = {
placement = awful.placement.centered,
floating = true,
ontop = true,
raise = true
},
}
end)
-- ruled.client.append_rule {
-- -- Floating clients.
-- rule_any = {
-- class = {
-- "Arandr",
-- "Blender",
-- "dolphin",
-- },
-- name = {
-- "Event Tester", -- xev.
-- "remove images?" -- darktable delete window.
-- },
-- role = {
-- "AlarmWindow", -- Thunderbird's calendar.
-- "ConfigManager", -- Thunderbird's about:config.
-- "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
-- }
-- },
-- properties = { floating = true },
-- }
-- ruled.client.append_rule {
-- -- Add titlebars to normal clients and dialogs
-- rule_any = { type = { "normal", "dialog" } },
-- properties = { titlebars_enabled = false},
-- }
-- ruled.client.append_rule {
-- -- Set Firefox to never have titlebars
-- rule = { class = "Firefox" },
-- properties = { requests_no_titlebar = true, titlebars_enabled = false },
-- }
-- ruled.client.append_rule {
-- -- Set Feh center
-- rule = { class = "feh" },
-- properties = {
-- placement = awful.placement.centered,
-- floating = true
-- },
-- }
-- }}}
>>>>>>> 05f8e08... making nice only work on desktop for now
-- {{{ Signals -- {{{ Signals
-- Signal function to execute when a new client appears. -- Signal function to execute when a new client appears.
@ -695,6 +818,8 @@ client.connect_signal("manage", function (c)
-- Prevent clients from being unreachable after screen count changes. -- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
ruled.client.apply(c)
end) end)
-- Enable sloppy focus, so that focus follows mouse. -- Enable sloppy focus, so that focus follows mouse.
@ -702,12 +827,19 @@ end)
-- c:emit_signal("request::activate", "mouse_enter", {raise = false}) -- c:emit_signal("request::activate", "mouse_enter", {raise = false})
-- end) -- end)
<<<<<<< HEAD
=======
-- Enable nice titlebars
-- nice()
>>>>>>> 05f8e08... making nice only work on desktop for now
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus 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("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}} -- }}}
-- {{{ Autostart Applications -- {{{ Autostart Applications
<<<<<<< HEAD
-- awful.spawn.with_shell("picom --experimental-backend") -- awful.spawn.with_shell("picom --experimental-backend")
-- awful.spawn.with_shell("libinput-gestures-setup start") -- awful.spawn.with_shell("libinput-gestures-setup start")
-- awful.spawn.with_shell("flameshot") -- awful.spawn.with_shell("flameshot")
@ -717,5 +849,16 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
-- awful.spawn.with_shell("emacs -daemon") -- awful.spawn.with_shell("emacs -daemon")
-- awful.spawn.with_shell("nextcloud --background") -- awful.spawn.with_shell("nextcloud --background")
-- awful.spawn.with_shell("caffeine") -- awful.spawn.with_shell("caffeine")
=======
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")
>>>>>>> 05f8e08... making nice only work on desktop for now
-- }}} -- }}}

View file

@ -30,7 +30,11 @@ local beautiful = require("beautiful")
local menubar = require("menubar") local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup")
local ruled = require("ruled") local ruled = require("ruled")
<<<<<<< HEAD
local nice = require("nice")() local nice = require("nice")()
=======
-- local nice = require("nice")
>>>>>>> 05f8e08... making nice only work on desktop for now
-- Enable hotkeys help widget for VIM and other apps -- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened: -- when client with a matching name is opened:
require("awful.hotkeys_popup.keys") require("awful.hotkeys_popup.keys")
@ -240,7 +244,7 @@ local function set_wallpaper(s)
if type(wallpaper) == "function" then if type(wallpaper) == "function" then
wallpaper = wallpaper(s) wallpaper = wallpaper(s)
end end
gears.wallpaper.maximized(wallpaper, s, true) gears.wallpaper.centered(wallpaper, s, "#282a36")
end end
end end
@ -272,7 +276,7 @@ awful.screen.connect_for_each_screen(function(s)
set_wallpaper(s) set_wallpaper(s)
-- Each screen has its own tag table. -- Each screen has its own tag table.
awful.tag({ "◉", "◉", "◉", "◉"}, s, awful.layout.layouts[1]) awful.tag({ "emacs", "web", "chat", "misc"}, s, awful.layout.layouts[1])
yoffset = dpi(45) yoffset = dpi(45)
@ -384,7 +388,7 @@ awful.screen.connect_for_each_screen(function(s)
} }
-- Create Battery, Network, and Volume widget -- Create Battery, Network, and Volume widget
s.battery = require('widget.battery')() s.battery = require('widget.battery')()
s.network = require('widget.network')() -- s.network = require('widget.network')()
s.volume = require('widget.volume')() s.volume = require('widget.volume')()
s.updater = require('widget.package-updater')() s.updater = require('widget.package-updater')()
@ -401,7 +405,7 @@ awful.screen.connect_for_each_screen(function(s)
s.volume, s.volume,
s.mysystray, s.mysystray,
s.updater, s.updater,
s.network, -- s.network,
s.battery, s.battery,
wibox.container.margin (s.mylayoutbox,0,dpi(25),0,0), wibox.container.margin (s.mylayoutbox,0,dpi(25),0,0),
}, },
@ -765,10 +769,13 @@ root.keys(globalkeys)
* Rules * Rules
Since I can't seem to figure out the rules myself, let's see if I can't use someone elses and modify them.
** Broken Rules that I can't figure out
#+BEGIN_SRC lua :tangle yes #+BEGIN_SRC lua :tangle yes
-- {{{ Rules -- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal). -- Rules to apply to new clients (through the "manage" signal).
ruled.client.connect_signal('request::manage', function() ruled.client.connect_signal("request::rules", function()
ruled.client.append_rule { ruled.client.append_rule {
-- All clients will match this rule. -- All clients will match this rule.
rule = {}, rule = {},
@ -847,6 +854,12 @@ end)
-- }}} -- }}}
awful.spawn.with_shell("mpv /home/chris/Videos/transcoded/a love letter.mp4") awful.spawn.with_shell("mpv /home/chris/Videos/transcoded/a love letter.mp4")
#+END_SRC
** Import other rules
#+BEGIN_SRC lua :tangle no
local rules = require("configuration.clients.rules")
#+END_SRC #+END_SRC
* Signals * Signals
@ -873,7 +886,7 @@ end)
-- end) -- end)
-- Enable nice titlebars -- Enable nice titlebars
nice() -- nice()
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)

View file

@ -9,7 +9,7 @@ local gears = require('gears')
local gfs = require("gears.filesystem") local gfs = require("gears.filesystem")
local themes_path = gfs.get_themes_dir() local themes_path = gfs.get_themes_dir()
local wallpaperdir = "/home/chris/Pictures/wallpapers" local wallpaperdir = "/home/chris/Pictures/wallpapers/"
local theme = {} local theme = {}
@ -133,7 +133,11 @@ theme.wibar_width = dpi(1850)
-- theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png" -- theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png"
-- theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png" -- theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png"
<<<<<<< HEAD
theme.wallpaper = wallpaperdir .. "RoyalKing.png" theme.wallpaper = wallpaperdir .. "RoyalKing.png"
=======
theme.wallpaper = (wallpaperdir.."RoyalKing.png")
>>>>>>> 05f8e08... making nice only work on desktop for now
-- You can use your own layout icons like this: -- You can use your own layout icons like this:
theme.layout_fairh = themes_path.."default/layouts/fairhw.png" theme.layout_fairh = themes_path.."default/layouts/fairhw.png"

View file

@ -36,7 +36,7 @@ local return_button = function()
font = 'VictorMono Nerd Font 10', font = 'VictorMono Nerd Font 10',
align = 'center', align = 'center',
valign = 'center', valign = 'center',
visible = false, visible = true,
widget = wibox.widget.textbox widget = wibox.widget.textbox
} }
@ -84,11 +84,11 @@ local return_button = function()
-- Get battery info script -- Get battery info script
local get_battery_info = function() local get_battery_info = function()
awful.spawn.easy_async_with_shell('upower -i $(upower -e | grep BAT)', function(stdout) awful.spawn.easy_async_with_shell('upower -i (upower -e | rg BAT)', function(stdout)
if (stdout == nil or stdout == '') then if (stdout == nil or stdout == '') then
battery_tooltip:set_text('No battery detected!') battery_tooltip:set_text('No battery detected!')
battery_widget:set_visible(false) battery_widget:set_visible(true)
return return
end end
@ -107,11 +107,11 @@ local return_button = function()
local check_percentage_cmd = [[ local check_percentage_cmd = [[
upower -i $(upower -e | grep BAT) | grep percentage | awk '{print $2}' | tr -d '\n%' upower -i (upower -e | rg BAT | rg 1) | rg percentage | awk '{print $2}' | tr -d '\n%'
]] ]]
local check_status_cmd = [[bash -c " local check_status_cmd = [[bash -c "
upower -i $(upower -e | grep BAT) | grep state | awk '{print $2}' | tr -d '\n' upower -i (upower -e | rg BAT | rg 1) | rg state | awk '{print $2}' | tr -d '\n'
"]] "]]
local last_battery_check = os.time() local last_battery_check = os.time()
@ -137,7 +137,7 @@ local return_button = function()
battery_widget.spacing = dpi(5) battery_widget.spacing = dpi(5)
battery_percentage_text.visible = true battery_percentage_text.visible = true
battery_percentage_text:set_text(battery_percentage .. '%') battery_percentage_text:set_text(battery_percentage .. "%")
local icon_name = 'battery' local icon_name = 'battery'
@ -243,7 +243,7 @@ local return_button = function()
if (stdout == nil or stdout == '') then if (stdout == nil or stdout == '') then
battery_widget.spacing = dpi(0) battery_widget.spacing = dpi(0)
battery_percentage_text.visible = false battery_percentage_text.visible = true
battery_tooltip:set_text('No battery detected!') battery_tooltip:set_text('No battery detected!')
battery_imagebox.icon:set_image(gears.surface.load_uncached(widget_icon_dir .. 'battery-unknown' .. '.svg')) battery_imagebox.icon:set_image(gears.surface.load_uncached(widget_icon_dir .. 'battery-unknown' .. '.svg'))

View file

@ -159,7 +159,11 @@ frame-opacity = 0.7;
inactive-opacity-override = false; inactive-opacity-override = false;
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
<<<<<<< HEAD
active-opacity = 0.8; active-opacity = 0.8;
=======
active-opacity = 0.85;
>>>>>>> 05f8e08... making nice only work on desktop for now
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) # Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
# inactive-dim = 0.0 # inactive-dim = 0.0
@ -196,8 +200,12 @@ opacity-rule = [
"70:class_g = 'TelegramDesktop'", "70:class_g = 'TelegramDesktop'",
"90:class_g = 'Joplin'", "90:class_g = 'Joplin'",
"100:class_g = 'firefox'", "100:class_g = 'firefox'",
<<<<<<< HEAD
"100:class_g = 'dolphin'", "100:class_g = 'dolphin'",
"100:class_g = 'mpv'", "100:class_g = 'mpv'",
=======
"100:class_g = 'soffice'",
>>>>>>> 05f8e08... making nice only work on desktop for now
"100:class_g = 'libreoffice'", "100:class_g = 'libreoffice'",
"100:class_g = 'Thunderbird'" "100:class_g = 'Thunderbird'"
]; ];
@ -262,9 +270,14 @@ blur-background-exclude = [
# when taking selection screenshot with `main` # when taking selection screenshot with `main`
# https://github.com/naelstrof/maim/issues/130 # https://github.com/naelstrof/maim/issues/130
"class_g = 'slop'", "class_g = 'slop'",
<<<<<<< HEAD
"_GTK_FRAME_EXTENTS@:c", "_GTK_FRAME_EXTENTS@:c",
# "window_type = '_NET_WM_WINDOW_TYPE_NOTIFICATION'" # "window_type = '_NET_WM_WINDOW_TYPE_NOTIFICATION'"
"window_type = 'notification'" "window_type = 'notification'"
=======
"class_g = 'soffice'",
"_GTK_FRAME_EXTENTS@:c"
>>>>>>> 05f8e08... making nice only work on desktop for now
]; ];
@ -330,7 +343,7 @@ refresh-rate = 0
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, # rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it. # provided that the WM supports it.
# #
# use-ewmh-active-win = false use-ewmh-active-win = true
# Unredirect all windows if a full-screen opaque window is detected, # Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering # to maximize performance for full-screen windows. Known to cause flickering

View file

@ -42,4 +42,5 @@ set searchurls.qwant https://www.qwant.com/?q=
bind v hint -W mpvsafe bind v hint -W mpvsafe
" command oc js -p tri.excmds.shellescape(JS_ARG).then(url => tri.excmds.exclaim_quiet('org-capture ' + url)) bind gc composite get_current_url | org-capture
command org-capture js -p tri.excmds.shellescape(JS_ARG).then(url => tri.excmds.exclaim_quiet('org-capture ' + url))