From 4e01d507ff8ce1dc7ce270c20b8dc25defa87900 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 30 Jan 2017 10:40:13 +0100 Subject: more porting --- config/awesome/rc.lua | 139 ++++++++++++++++++++-------------------- config/awesome/weasel-rules.lua | 52 ++++++++------- 2 files changed, 95 insertions(+), 96 deletions(-) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 91d78f7..112ac19 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -104,57 +104,60 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ -- {{{ Wibox -- Create a textclock widget -mytextclock = awful.widget.textclock(nil, 5) +mytextclock = wibox.widget.textclock(nil, 5) -- Create a wibox for each screen and add it -mywibox = {} -mypromptbox = {} -mylayoutbox = {} -mytaglist = {} -mytaglist.buttons = awful.util.table.join( - awful.button({ }, 1, awful.tag.viewonly), - awful.button({ modkey }, 1, awful.client.movetotag), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, awful.client.toggletag), - awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end) - ) -mytasklist = {} -mytasklist.buttons = awful.util.table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() then - awful.tag.viewonly(c:tags()[1]) +local taglist_buttons = awful.util.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 = awful.util.table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() and c.first_tag then + c:tags()[1]:view_only() + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + -- c:raise() end - -- This will also un-minimize - -- the client, if needed - client.focus = c - -- c:raise() - end - end), - awful.button({ }, 3, function () - if instance then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ - theme = { width = 250 } - }) - end - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - if client.focus then client.focus:raise() end - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - if client.focus then client.focus:raise() end - end)) + end), + awful.button({ }, 3, function () + if instance then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ + theme = { width = 250 } + }) + end + end), + awful.button({ }, 4, function () + awful.client.focus.byidx(1) + if client.focus then client.focus:raise() end + end), + awful.button({ }, 5, function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end)) local function set_wallpaper(s) -- Wallpaper @@ -184,12 +187,10 @@ awful.screen.connect_for_each_screen(function(s) awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) -- Create a taglist widget - -- mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons, nil, nil, wibox.layout.fixed.horizontal()) - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) + s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) -- Create a tasklist widget - -- mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) - s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.alltags, mytasklist.buttons) + s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.alltags, tasklist_buttons) -- Create the wibox s.mywibox = awful.wibox({ position = "bottom", screen = s }) @@ -202,7 +203,7 @@ awful.screen.connect_for_each_screen(function(s) -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() - if s == 1 then right_layout:add(wibox.widget.systray()) end + right_layout:add(wibox.widget.systray()) right_layout:add(battery_widget) right_layout:add(volume_widget) right_layout:add(mytextclock) @@ -259,7 +260,7 @@ globalkeys = awful.util.table.join( end), -- Standard program - -- awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + -- awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end), --awful.key({ modkey, "Control" }, "r", awesome.restart), --awful.key({ modkey, "Shift" }, "q", awesome.quit), @@ -308,15 +309,15 @@ globalkeys = awful.util.table.join( awful.key({ modkey, }, "F4", function () awful.layout.set(awful.layout.suit.max) end), awful.key({ }, "XF86AudioRaiseVolume", function () - awful.util.spawn("amixer -q -D default sset Master 5%+", false) end), + awful.spawn("amixer -q -D default sset Master 5%+", false) end), awful.key({ }, "XF86AudioLowerVolume", function () - awful.util.spawn("amixer -q -D default sset Master 5%-", false) end), + awful.spawn("amixer -q -D default sset Master 5%-", false) end), awful.key({ "Shift" }, "XF86AudioRaiseVolume", function () - awful.util.spawn("amixer -q -D default sset Master 1%+", false) end), + awful.spawn("amixer -q -D default sset Master 1%+", false) end), awful.key({ "Shift" }, "XF86AudioLowerVolume", function () - awful.util.spawn("amixer -q -D default sset Master 1%-", false) end), + awful.spawn("amixer -q -D default sset Master 1%-", false) end), awful.key({ }, "XF86AudioMute", function () - awful.util.spawn("amixer -q -D default sset Master toggle", false) end), + awful.spawn("amixer -q -D default sset Master toggle", false) end), awful.key({ modkey }, "x", function () awful.util.spawn_with_shell("urxvt") end), awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn_with_shell("urxvt -title FURxvt") end), @@ -327,8 +328,8 @@ globalkeys = awful.util.table.join( -- awful.key({ "Control", "Mod1"}, "End", function () awful.util.spawn_with_shell("xscreensaver-command -lock; sleep 1; systemctl suspend") end), --awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn_with_shell("xscreensaver-command -lock") end), - -- awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn("xdg-screensaver lock") end), - --KDE--awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn("loginctl lock-session") end), + -- awful.key({ "Control", "Mod1"}, "l", function () awful.spawn("xdg-screensaver lock") end), + --KDE--awful.key({ "Control", "Mod1"}, "l", function () awful.spawn("loginctl lock-session") end), --KDE--awful.key({ "Control", "Mod1"}, "End", function () awful.util.spawn_with_shell("systemctl suspend -i; xdg-screensaver reset; loginctl unlock-session; xdg-screensaver reset") end), -- awful.key({ "Control", "Mod1"}, "End", function () awful.util.spawn_with_shell("xscreensaver-command -lock; sleep 1; systemctl suspend") end), -- awful.key({ "Control", "Mod1"}, "End", function () awful.util.spawn_with_shell("loginctl lock-session && systemctl suspend -i") end), @@ -372,7 +373,7 @@ globalkeys = awful.util.table.join( awful.key({ modkeytag }, tag_keys[i], function () local screen = awful.screen.focused() local tag = screen.tags[i] - if tag then awful.tag.viewonly(tag) end + if tag then tag:view_only() end end), -- Toggle tag. awful.key({ modkeytag, "Shift" }, tag_keys[i], function () @@ -385,8 +386,7 @@ globalkeys = awful.util.table.join( if client.focus then local tag = client.focus.screen.tags[i] if tag then - awful.client.movetotag(tag) - -- awful.tag.viewonly(tag) + client.focus:move_to_tag(tag) end end end), @@ -405,7 +405,7 @@ clientkeys = awful.util.table.join( -- awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), awful.key({ modkey, }, "Return", function (c) c:swap(awful.client.getmaster()) end), - awful.key({ modkey, }, "o", awful.client.movetoscreen ), + awful.key({ modkey, }, "o", function (c) c:move_to_screen() end), awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), -- weasel @@ -414,7 +414,7 @@ clientkeys = awful.util.table.join( if c.sticky then local screen = awful.screen.focused() local tag = awful.tag.selected(screen) - awful.client.movetotag(tag) + client.focus:move_to_tag(tag) end c.sticky = not c.sticky end), @@ -525,7 +525,8 @@ awful.rules.rules = { properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, - screen = awful.screen.focused, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen, raise = true, keys = clientkeys, buttons = clientbuttons } }, @@ -646,8 +647,8 @@ tag.connect_signal( terminal = "urxvt" awful.util.spawn_with_shell("pkill -x -f nm-applet; nm-applet") --awful.util.spawn_with_shell("pkill -x -f klipper; klipper") --- awful.util.spawn("xscreensaver -no-splash") ---KDE--awful.util.spawn("X-screensaver") +-- awful.spawn("xscreensaver -no-splash") +--KDE--awful.spawn("X-screensaver") awful.util.spawn_with_shell("pkill -x -f clipit; clipit") -- awful.util.spawn_with_shell("pkill -x -f dnssec-trigger-panel; dnssec-trigger-panel") awful.util.spawn_with_shell("pkill -x -f 'alsa-volume-monitor hw:0'; alsa-volume-monitor hw:0") diff --git a/config/awesome/weasel-rules.lua b/config/awesome/weasel-rules.lua index 9c48ba5..c692fe9 100644 --- a/config/awesome/weasel-rules.lua +++ b/config/awesome/weasel-rules.lua @@ -1,10 +1,8 @@ local awful = require("awful") function get_weasel_rules() - local browser_screen = awful.screen.focused() - local im_screen = awful.screen.focused() - local browser_screen = screen[1] - local im_screen = screen[1] + local browser_screen = 1 + local im_screen = 1 local rules = { { rule = { class = "mpv" }, @@ -17,31 +15,31 @@ function get_weasel_rules() properties = { floating = true } }, { rule = { class = "Firefox" , name = "Mozilla Firefox" }, - properties = { tag = browser_screen.tags[7], + properties = { screen = browser_screen, tag = '12', --border_width = 0 } }, - { rule = { class = "Firefox" }, - properties = { tag = browser_screen.tags[7] } }, - { rule = { class = "chromium" }, -- , name = "New Tab - Chromium" }, - properties = { tag = browser_screen.tags[8], - -- border_width = 0 - } }, - { rule = { class = "Tor Browser" , name = "Tor Browser" }, - properties = { tag = browser_screen.tags[12], floating = true } }, - { rule = { class = "Tor Browser" }, - properties = { tag = browser_screen.tags[12], floating = true } }, - - { rule = { class = "URxvt" , name = "IRC" }, - properties = { tag = im_screen.tags[1] } }, - { rule = { class = "URxvt" , name = "Mail" }, - properties = { tag = im_screen.tags[6] } }, - { rule = { class = "URxvt" , name = "Mail COSY" }, - properties = { tag = im_screen.tags[6] } }, - - { rule = { class = "chromium" , name = "Signal Private Messenger" }, - properties = { tag = im_screen.tags[11] } }, - { rule = { class = "chromium" , name = "Signal" }, - properties = { tag = im_screen.tags[11] } }, + { rule = { class = "Firefox" }, + properties = { screen = browser_screen, tag = '12' } }, + { rule = { class = "chromium" }, -- , name = "New Tab - Chromium" }, + properties = { screen = browser_screen, tag = '13', + -- border_width = 0 + } }, + { rule = { class = "Tor Browser" , name = "Tor Browser" }, + properties = { screen = browser_screen, tag = '22', floating = true } }, + { rule = { class = "Tor Browser" }, + properties = { screen = browser_screen, tag = '22', floating = true } }, + + { rule = { class = "URxvt" , name = "IRC" }, + properties = { screen = im_screen, tag = '1' } }, + { rule = { class = "URxvt" , name = "Mail" }, + properties = { screen = im_screen, tag = '11' } }, + { rule = { class = "URxvt" , name = "Mail COSY" }, + properties = { screen = im_screen, tag = '11' } }, + + { rule = { class = "chromium" , name = "Signal Private Messenger" }, + properties = { screen = im_screen, tag = '21' } }, + { rule = { class = "chromium" , name = "Signal" }, + properties = { screen = im_screen, tag = '21' } }, --{ rule = { maximized_horizontal = true }, -- these two should remove window borders from maximized windows because they get in the way -- properties = { border_width = 0 } }, -- cgit v1.2.3