From f1e8c2b9e8982dce30d39df9bb863a5073ce5adc Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 3 Aug 2021 08:09:31 +0200 Subject: [PATCH] fixed rules with single screen --- autorun.sh | 12 +++--- rc.lua | 110 ++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 95 insertions(+), 27 deletions(-) diff --git a/autorun.sh b/autorun.sh index a874fdd..9d6ff5b 100755 --- a/autorun.sh +++ b/autorun.sh @@ -14,11 +14,13 @@ run /usr/bin/nm-applet run /usr/bin/blueman-manager # screenshot utility run /usr/bin/shutter +# volume control +run /usr/bin/pasystray # tag 1 -run /usr/local/bin/idea +run idea # tag 2 -run /opt/google/chrome/chrome +run /opt/google/chrome/chrome # tag 3 run /usr/bin/terminator # tag 4 @@ -26,9 +28,9 @@ run /usr/bin/code # tag 5 run /usr/bin/zoom run /usr/bin/teams -# tag 6 -run /usr/bin/rocketchat-desktop +tag 6 +run /snap/bin/rocketchat-desktop run /usr/bin/thunderbird # tag 7 run /usr/local/bin/bitwarden -run /usr/bin/keepass2 +run /usr/bin/keepassx diff --git a/rc.lua b/rc.lua index 91b5eec..476cc20 100644 --- a/rc.lua +++ b/rc.lua @@ -35,6 +35,43 @@ local tags = { tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9 } +local wibar_font="Deja Vu Sans Mono 14" + +-- d_sep = wibox.widget.textbox(" | ") +d_sep = wibox.widget{ + markup = '|', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox, + font = wibar_font +} +l_sep = wibox.widget{ + markup = '[', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox, + font = wibar_font +} + +m_sep = wibox.widget{ + markup = '][', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox, + font = wibar_font +} + +r_sep = wibox.widget{ + markup = ']', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox, + font = wibar_font +} + + + + -- {{{ 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) @@ -63,7 +100,10 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") -beautiful.font = "DejaVu Sans 12" +beautiful.font = wibar_font +beautiful.wibar_bg="#6C3483cc" +beautiful.bg_systray="#6C3483cc" + -- This is used later as the default terminal and editor to run. terminal = "x-terminal-emulator" @@ -157,7 +197,7 @@ mykeyboardlayout = awful.widget.keyboardlayout() -- mytextclock = wibox.widget.textclock() mytextclock = wibox.widget.textclock("%Y-%m-%d, %a, %H:%M:%S",1) -mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC" } +mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC", widget_font = wibar_font } -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( @@ -249,7 +289,7 @@ end s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = 34 }) -- Add widgets to the wibox s.mywibox:setup { @@ -264,9 +304,14 @@ end { -- Right widgets layout = wibox.layout.fixed.horizontal, mykeyboardlayout, + d_sep, wibox.widget.systray(), + d_sep, mytextclock, + l_sep, mybatterywidget, + r_sep, + d_sep, s.mylayoutbox, }, } @@ -549,6 +594,25 @@ clientbuttons = gears.table.join( root.keys(globalkeys) -- }}} +local function getScreenByTagName(tagName) + print("getScreenByTagName 1:" .. tagName) + local tagByName = awful.tag.find_by_name(nil, tagName) + print("getScreenByTagName 2:" .. tostring(tagByName) ) + local screenOfTag = tagByName.screen + print("getScreenByTagName 3:" .. tostring(screenOfTag) ) + if screenOfTag then + local indexOfScreen = screenOfTag.index + print( "tag " .. tostring(tagName) .. " is on screen " .. tostring(indexOfScreen)) + return indexOfScreen + end + return awful.screen.focused().index + end + + +local function getTagByName(tagName) + return awful.tag.find_by_name(nil, tagName) +end + -- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { @@ -596,35 +660,37 @@ awful.rules.rules = { }, properties = { titlebars_enabled = true } }, -- jetbrains-idea -> tag 1 - { rule = { class = "jetbrains-idea" }, - properties = { tag = tag1 } }, + { rule = { instance = "jetbrains-idea" }, + properties = { screen = function () return getScreenByTagName(tag1) end, tag = tag1 } }, -- chrome -> tag 2 - { rule = { class = "google-chrome" }, - properties = { tag = tag2 } }, + { rule = { instance = "google-chrome" }, + properties = { sreen = function () return getScreenByTagName(tag2) end, tag = tag2 } }, -- terminator-> tag 3 - { rule = { class = "terminator" }, - properties = { tag = tag3 } }, + { rule = { instance = "terminator" }, + properties = { screen = function () return getScreenByTagName(tag3) end, tag = tag3 } }, + { rule = { instance = "x-terminal-emulator" }, + properties = { function () return getScreenByTagName(tag7) end, tag = tag3 } }, -- vscode -> tag 4 - { rule = { class = "code" }, - properties = { tag = tag4 } }, + { rule = { instance = "code" }, + properties = { screen = function () return getScreenByTagName(tag4) end, tag = tag4 } }, -- zoom -> tag5 - { rule = { class = "zoom" }, - properties = { tag = tag5 } }, + { rule = { instance = "zoom" }, + properties = { screen = function () return getScreenByTagName(tag5) end, tag = tag5 } }, -- microsoft teams - preview -> tag5 - { rule = { class = "microsoft teams - preview" }, - properties = { tag = tag5 } }, + { rule = { instance = "microsoft teams - preview" }, + properties = { screen = function () return getScreenByTagName(tag5) end, tag = tag5 } }, -- rocket.chat-> tag6 - { rule = { class = "rocket.chat" }, - properties = { tag = tag6 } }, + { rule = { instance = "rocket.chat" }, + properties = { screen = function () return getScreenByTagName(tag6) end, tag = tag6 } }, -- Thunderbird -> tag6 { rule = { class = "Thunderbird" }, - properties = { tag = tag6 } }, + properties = { screen = function () return getScreenByTagName(tag6) end, tag = tag6 } }, -- Bitwarden -> tag7 - { rule = { class = "bitwarden" }, - properties = { tag = tag7 } }, + { rule = { instance = "bitwarden" }, + properties = { screen = function () return getScreenByTagName(tag7) end, tag = tag7 } }, -- keepass2 -> tag7 - { rule = { class = "keepass2" }, - properties = { tag = tag7 } }, + { rule = { instance = "keepassx" }, + properties = { screen = function () return getScreenByTagName(tag7) end, tag = tag7 } }, -- Set Firefox to always map on the tag named "2" on screen 1. -- { rule = { class = "Firefox" }, -- properties = { screen = 1, tag = "2" } },