From: Samir Benmendil Date: Sat, 1 Apr 2017 17:48:19 +0000 (+0100) Subject: Merge branch 'cadscan' (early part) X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/172cfbb4b15794f9dd12a4531e6ba6b8f0edbb2a?hp=1b34e5bf23e5d5a68632e0d6ab0433472accde7d Merge branch 'cadscan' (early part) --- diff --git a/.gitmodules b/.gitmodules index 80b041d..ab22f2a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,13 +7,21 @@ [submodule "awesome/widgets/net_widgets"] path = awesome/widgets/net_widgets url = git@github.com:Ram-Z/net_widgets.git -[submodule "awesome/widgets/pomodoro"] - path = awesome/widgets/pomodoro - url = git@github.com:/Ram-Z/awesome-pomodoro - branch = module-path [submodule "zsh/lib/zsh-syntax-highlighting"] path = zsh/lib/zsh-syntax-highlighting url = https://github.com/zsh-users/zsh-syntax-highlighting -[submodule "urxvt/urxvt-perls"] - path = urxvt/urxvt-perls +[submodule "urxvt/perls"] + path = urxvt/perls url = https://github.com/muennich/urxvt-perls +[submodule "urxvt/autocomplete-ALL-the-things"] + path = urxvt/autocomplete-ALL-the-things + url = https://github.com/Vifon/autocomplete-ALL-the-things +[submodule "weechat/python/wee-slack"] + path = weechat/python/wee-slack + url = https://github.com/rawdigits/wee-slack +[submodule "weechat/lua/matrix"] + path = weechat/lua/matrix + url = https://github.com/torhve/weechat-matrix-protocol-script +[submodule "awesome/widgets/pomodoro"] + path = awesome/widgets/pomodoro + url = git@github.com:ram-z/awesome-pomodoro diff --git a/Makefile b/Makefile index 327a438..8af2d32 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,72 @@ APATH := $(realpath .) FILES := bin -DOTFILES := conky* goobookrc msmtp* mutt ncmpcpp profile tmux.conf weechat Xresources xprofile zprofile zshenv zshrc -CONFIGFILES := aliases compton.conf git gnupg mimeo.conf mpd mpv offlineimap ranger retroarch systemd vim xbindkeys xkb zsh +DOTFILES := conky* goobookrc msmtp* mutt profile tmux.conf weechat Xresources +CONFIGFILES := aliases compton.conf git mpv offlineimap ranger retroarch xbindkeys xkb .PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES) install: $(FILES) $(DOTFILES) $(CONFIGFILES) +~/.config: + mkdir -p ~/.config + +vim: + ln -sfT $(APATH)/vim ~/.config/vim + mkdir -p ~/.local/share/vim + git clone https://github.com/gmarik/vundle ~/.local/share/vim/vundle +.PHONY: vim + +awesome: ~/.config + ln -sfT $(APATH)/awesome ~/.config/awesome +.PHONY: awesome + +qutebrowser: ~/.config + ln -sfT $(APATH)/qutebrowser ~/.config/qutebrowser + mkdir -p ~/downloads +.PHONY: qutebrowser + +mpd: systemd + ln -sfT $(APATH)/mpd ~/.config/mpd + mkdir -p ~/.local/share/mpd/playlists + systemctl --user enable mpd + systemctl --user start mpd +.PHONY: mpd + +ncmpcpp: + ln -sfT $(APATH)/ncmpcpp ~/.config/ncmpcpp + mkdir -p ~/.local/share/mpd/lyrics +.PHONY: ncmpcpp + +systemd: + ln -sfT $(APATH)/$@ ~/.config/$@ +.PHONY: systemd + +gnupg: systemd + ln -sfT $(APATH)/$@ ~/.config/$@ + systemctl --user enable gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket + systemctl --user start gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket +.PHONY: gnupg + +zsh: + ln -sfT $(APATH)/zshrc ~/.zshrc + ln -sfT $(APATH)/zprofile ~/.zprofile + ln -sfT $(APATH)/zshenv ~/.zshenv + ln -sfT $(APATH)/zsh ~/.config/zsh + mkdir -p ~/.cache/zsh +.PHONY: zsh + +xprofile: + ln -sfT $(APATH)/xprofile ~/.xprofile +.PHONY: xprofile + +dircolors: + ln -sfT $(APATH)/dircolors ~/.config/dircolors +.PHONY: dircolors + +urxvt: + ln -sfT $(APATH)/urxvt ~/.config/urxvt +.PHONY: urxvt + $(FILES): @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \ if [[ -d $@ ]]; then \ @@ -29,7 +89,7 @@ $(DOTFILES): fi; ln -sfT $(APATH)/$@ ~/.$@ -$(CONFIGFILES): +$(CONFIGFILES): ~/.config @if [[ -e ~/.config/$@ && ! -L ~/.config/$@ ]]; then \ if [[ -d .config/$@ ]]; then \ cp -r ~/.config/$@/* $@; \ diff --git a/Xresources b/Xresources index 97edfa4..d188baa 100644 --- a/Xresources +++ b/Xresources @@ -21,12 +21,11 @@ URxvt.iso14755: false URxvt.iso14755_52: false ! {{{1 Perl extensions -URxvt.perl-lib: .config/urxvt/urxvt-perls URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select,autocomplete-ALL-the-things ! {{{2 url-select URxvt.keysym.C-F: perl:url-select:select_next URxvt.url-select.button: 1 -URxvt.url-select.launcher: mimeo +URxvt.url-select.launcher: rifle URxvt.url-select.underline: true ! {{{2 keyboard-select URxvt.keysym.C-S-space: perl:keyboard-select:activate diff --git a/aliases b/aliases index 92baf77..a1641cb 100644 --- a/aliases +++ b/aliases @@ -19,13 +19,13 @@ alias svi='sudo -e' alias vs='vim SPLITBUILD' # colours, I want more colours -alias diff='colordiff' +[[ -x /usr/bin/colordiff ]] && alias diff='colordiff' # colours and case insensitive search export LESS='-RSi' # yes I'm that lazy -alias o='mimeo' +alias o='rifle' # suspend screensaver when vlc is running alias vlc-suspend='xdg-screensaver suspend $(xprop -name vlc | grep "WM_CLIENT_LEADER(WINDOW)" | sed "s/.*\(0x\d*\)/\1/")' diff --git a/awesome/autostart.lua b/awesome/autostart.lua deleted file mode 100644 index 707d8b7..0000000 --- a/awesome/autostart.lua +++ /dev/null @@ -1,7 +0,0 @@ -local utils = require("utils") - -utils.run_once("qutebrowser") -utils.run_once("urxvtc -name ncmpcpp -icon ~/src/dotfiles/icons/bmp.png -e ncmpcpp", nil, "ncmpcpp") -utils.run_once("urxvtc -name mopidy -icon ~/src/dotfiles/icons/bmp.png -e ncmpcpp -p 6601", nil, "ncmpcpp -p 6601") -utils.run_once("urxvtc -name weechat -icon ~/src/dotfiles/icons/im-irc.png -e weechat", nil, "weechat") -utils.run_once("urxvtc -name mutt -icon ~/src/dotfiles/icons/internet-mail.png -e mutt", nil, "mutt") diff --git a/awesome/awesome-freedesktop b/awesome/awesome-freedesktop index e514e74..251dda5 160000 --- a/awesome/awesome-freedesktop +++ b/awesome/awesome-freedesktop @@ -1 +1 @@ -Subproject commit e514e742864495f23fd725f8c596f41a01d67795 +Subproject commit 251dda50c2957e455f9242186db4089f09cdee18 diff --git a/awesome/bindings.lua b/awesome/bindings.lua index c57c87a..16d579a 100644 --- a/awesome/bindings.lua +++ b/awesome/bindings.lua @@ -1,3 +1,5 @@ +local hotkeys_popup = require("awful.hotkeys_popup").widget + -- Default modkey. modkey = "Mod4" altkey = "Mod1" @@ -7,125 +9,182 @@ root.buttons(awful.util.table.join( awful.button({ }, 3, function () mymainmenu:toggle() end) )) -clientbuttons = awful.util.table.join( - awful.button({ }, 1, function (c) client.focus = c; c:raise() end), - awful.button({ modkey }, 1, awful.mouse.client.move), - awful.button({ modkey }, 3, awful.mouse.client.resize)) - -- Global Keys {{{1 globalkeys = awful.util.table.join(globalkeys, - -- Awesome Keys {{{2 - awful.key({ modkey, }, "j", - function () - awful.client.focus.byidx(-1) - if client.focus then client.focus:raise() end - end), + awful.key({ modkey, }, "s", hotkeys_popup.show_help, + {description="show help", group="awesome"}), + awful.key({ modkey, }, "Left", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + awful.key({ modkey, }, "Down", awful.tag.viewprev, + {description = "view previous", group = "tag"}), + awful.key({ modkey, }, "Right", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ modkey, }, "Up", awful.tag.viewnext, + {description = "view next", group = "tag"}), + awful.key({ modkey, }, "Escape", awful.tag.history.restore, + {description = "go back", group = "tag"}), + awful.key({ modkey, }, "k", function () awful.client.focus.byidx( 1) - if client.focus then client.focus:raise() end - end), + end, + {description = "focus next by index", group = "client"} + ), + awful.key({ modkey, }, "j", + function () + awful.client.focus.byidx(-1) + end, + {description = "focus previous by index", group = "client"} + ), + awful.key({ modkey, }, "w", function () mymainmenu:show({ coords = { x = 0, y = 0}}) end, + {description = "show main menu", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), - awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), - awful.key({ modkey, }, "u", awful.client.urgent.jumpto), + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, + {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, }, "#49", function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (chronos) + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, }, "=", function () awful.screen.focus_relative( 1) end, -- that's the key left of 1 (kinesis) + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end, + {description = "focus the next screen", group = "screen"}), + awful.key({ modkey, "Control" }, "Left", 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"}), awful.key({ modkey, }, "Tab", function () awful.client.focus.history.previous() if client.focus then client.focus:raise() end - end), + end, + {description = "go back", group = "client"}), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, + {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, + {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, + {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, + {description = "decrease the number of columns", group = "layout"}), + -- resize slave + awful.key({ modkey, "Control" }, "j", function () awful.client.incwfact( 0.05) end, + {description = "increase focused client window factor", group = "layout"}), + awful.key({ modkey, "Control" }, "k", function () awful.client.incwfact(-0.05) end, + {description = "decrease focused client window factor", group = "layout"}), - awful.key({ modkey, "Control" }, "n", awful.client.restore), + -- switch between layouts + awful.key({ modkey, }, "]", function () awful.layout.inc( 1) end, + {description = "select next", group = "layout"}), + awful.key({ modkey, }, "[", function () awful.layout.inc(-1) end, + {description = "select previous", group = "layout"}), - awful.key({ modkey }, "x", + awful.key({ modkey, "Control" }, "n", function () - awful.prompt.run({ prompt = "Run Lua code: " }, - mypromptbox[mouse.screen].widget, - awful.util.eval, nil, - awful.util.getdir("cache") .. "/history_eval") - end), - -- Menubar - -- awful.key({ modkey }, "p", function() menubar.show() end), - - -- My Keys {{{2 - awful.key({ modkey, }, "Left", awful.tag.viewprev ), - awful.key({ modkey, }, "Down", awful.tag.viewprev ), - awful.key({ modkey, }, "Right", awful.tag.viewnext ), - awful.key({ modkey, }, "Up", awful.tag.viewnext ), - - -- Menu - awful.key({ modkey }, "w", function () mymainmenu:show({ coords = { x = 0, y = 0}}) end), + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"}), + -- Prompt - awful.key({ modkey }, "space", function () mypromptbox[mouse.screen]:run() end), - -- switch layout - awful.key({ modkey }, "]", function () awful.layout.inc( 1, mouse.screen, layouts) end), - awful.key({ modkey }, "[", function () awful.layout.inc(-1, mouse.screen, layouts) end), - -- resize slave - awful.key({ modkey, "Control" }, "j", function () awful.client.incwfact( 0.05) end), - awful.key({ modkey, "Control" }, "k", function () awful.client.incwfact(-0.05) end), + awful.key({ modkey }, "space", function () awful.screen.focused().mypromptbox:run() end, + {description = "run prompt", group = "launcher"}), + + awful.key({ modkey }, "x", + function () + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end, + {description = "lua execute prompt", group = "awesome"}), + + -- Applications {{{2 -- Ksnapshot - awful.key({ }, "F13", function () awful.util.spawn("ksnapshot") end), - awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end), + awful.key({ }, "F13", function () awful.spawn("ksnapshot") end), + awful.key({ }, "Print", function () awful.spawn("ksnapshot") end), -- ranger - awful.key({ modkey }, "r", function () awful.util.spawn(terminal .. " -e ranger") end), - -- Layout manipulation - awful.key({ modkey, }, "Escape", awful.tag.history.restore), - awful.key({ modkey, }, "#49", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (chronos) - awful.key({ modkey, }, "#94", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (shada) - awful.key({ modkey, }, "=", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (kinesis) - awful.key({ modkey, "Control" }, "Left", function () awful.screen.focus_relative( 1) end), - awful.key({ modkey, "Control" }, "Right", function () awful.screen.focus_relative(-1) end), + awful.key({ modkey }, "r", function () awful.spawn(terminal .. " -e ranger") end), -- Volume - awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("ponymix increase 5") end), - awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("ponymix decrease 5") end), - awful.key({ }, "XF86AudioMute", function () awful.util.spawn("ponymix toggle") end), - awful.key({ modkey }, "F10", function () awful.util.spawn("ponymix toggle") end), - awful.key({ modkey }, "F11", function () awful.util.spawn("ponymix decrease 5") end), - awful.key({ modkey }, "F12", function () awful.util.spawn("ponymix increase 5") end) + awful.key({ }, "XF86AudioMute", function () awful.spawn("ponymix toggle") end, + {description = "toggle mute", group = "volume"}), + awful.key({ }, "XF86AudioLowerVolume", function () awful.spawn("ponymix decrease 5") end, + {description = "decrease volume", group = "volume"}), + awful.key({ }, "XF86AudioRaiseVolume", function () awful.spawn("ponymix increase 5") end, + {description = "increase volume", group = "volume"}), + awful.key({ modkey }, "F10", function () awful.spawn("ponymix toggle") end, + {description = "toggle mute", group = "volume"}), + awful.key({ modkey }, "F11", function () awful.spawn("ponymix decrease 5") end, + {description = "decrease volume", group = "volume"}), + awful.key({ modkey }, "F12", function () awful.spawn("ponymix increase 5") end, + {description = "increase volume", group = "volume"}), + -- Lock + awful.key({ modkey, "Control" }, "Escape", function () awful.spawn("xautolock -locknow") end), + -- VimWiki + awful.key({ modkey }, "i", function () + awful.spawn(terminal.." -name vimwiki -e vim -c 'call vimwiki#base#goto_index(v:count1)'") + end) ) -- Client keys {{{1 clientkeys = awful.util.table.join( - -- Awesome Client Keys {{{2 - awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), - awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), - awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), - awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), + awful.key({ modkey, }, "f", + function (c) + c.fullscreen = not c.fullscreen + c:raise() + end, + {description = "toggle fullscreen", group = "client"}), + awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end, + {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, + {description = "move to master", group = "client"}), + awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end, + {description = "toggle keep on top", group = "client"}), + awful.key({ modkey, }, "b", function (c) c.below = not c.below end, + {description = "toggle keep below", group = "client"}), awful.key({ modkey, }, "n", function (c) -- The client currently has the input focus, so it cannot be -- minimized, since minimized clients can't have the focus. c.minimized = true - end), + end , + {description = "minimize", group = "client"}), awful.key({ modkey, }, "m", function (c) - c.maximized_horizontal = not c.maximized_horizontal - c.maximized_vertical = not c.maximized_vertical - end), + c.maximized = not c.maximized + c:raise() + end , + {description = "maximize", group = "client"}), - -- My Client Keys {{{2 -- Move client to screen - awful.key({ modkey, "Shift" }, "#94", awful.client.movetoscreen ), - awful.key({ modkey, "Shift" }, "#49", awful.client.movetoscreen ), - awful.key({ modkey, "Shift" }, "=", awful.client.movetoscreen ), -- kinesis - -- ontop and below - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), - awful.key({ modkey, }, "b", function (c) c.below = not c.below end) - -- }}} + awful.key({ modkey, "Shift" }, "#94", function (c) c:move_to_screen() end, + {description = "move to screen", group = "client"}), + awful.key({ modkey, "Shift" }, "#49", function (c) c:move_to_screen() end, + {description = "move to screen", group = "client"}), + awful.key({ modkey, "Shift" }, "=", function (c) c:move_to_screen() end, + {description = "move to screen", group = "client"}) ) -- Tags {{{1 @@ -134,38 +193,57 @@ clientkeys = awful.util.table.join( -- This should map on the top row of your keyboard, usually 1 to 9. for i = 1, 9 do globalkeys = awful.util.table.join(globalkeys, + -- View tag only. awful.key({ modkey }, "#" .. i + 9, function () - local screen = mouse.screen - local tag = awful.tag.gettags(screen)[i] - if tag then - if tag == awful.tag.selected(screen) then - awful.tag.history.restore(screen) - else - awful.tag.viewonly(tag) - end - end - end), + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + if tag.selected then + awful.tag.history.restore(screen) + else + tag:view_only() + end + end + end, + {description = "view tag #"..i, group = "tag"}), + -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () - local screen = mouse.screen - local tag = awful.tag.gettags(screen)[i] + local screen = awful.screen.focused() + local tag = screen.tags[i] if tag then awful.tag.viewtoggle(tag) end - end), + end, + {description = "toggle tag #" .. i, group = "tag"}), + -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () - local tag = awful.tag.gettags(client.focus.screen)[i] - if client.focus and tag then - awful.client.movetotag(tag) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end end - end), + end, + {description = "move focused client to tag #"..i, group = "tag"}), + -- Toggle tag on focused client. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function () - local tag = awful.tag.gettags(client.focus.screen)[i] - if client.focus and tag then - awful.client.toggletag(tag) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end end - end)) + end, + {description = "toggle focused client on tag #" .. i, group = "tag"}) + ) end + +-- Client Buttons {{{1 +clientbuttons = awful.util.table.join( + awful.button({ }, 1, function (c) client.focus = c; c:raise() end), + awful.button({ modkey }, 1, awful.mouse.client.move), + awful.button({ modkey }, 3, awful.mouse.client.resize)) diff --git a/awesome/rc.lua b/awesome/rc.lua index af38777..9a11324 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -28,13 +28,13 @@ do naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, an error happened!", - text = err }) + text = tostring(err) }) in_error = false end) end -- Variable definitions {{{1 --- Themes define colours, icons, and wallpapers +-- Themes define colours, icons, font and wallpapers. beautiful.init(awful.util.getdir("config").."/themes/mlp/theme.lua") -- This is used later as the default terminal and editor to run. @@ -42,13 +42,6 @@ terminal = "urxvtc" editor = os.getenv("EDITOR") or "vim" editor_cmd = terminal .. " -e " .. editor --- Wallpaper {{{1 -if beautiful.wallpaper then - for s = 1, screen.count() do - gears.wallpaper.maximized(beautiful.wallpaper, s, true) - end -end - -- Require files {{{1 require("bindings") require("tags") @@ -56,7 +49,6 @@ require("menu") require("topbar") require("rules") -- require("conky") -require("autostart") require("signals") -- Set keys diff --git a/awesome/rules.lua b/awesome/rules.lua index fe8ffc0..e794943 100644 --- a/awesome/rules.lua +++ b/awesome/rules.lua @@ -21,35 +21,34 @@ awful.rules.rules = { properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, + raise = true, keys = clientkeys, - buttons = clientbuttons } }, - { rule = { class = "mpv" }, - properties = { floating = true } }, - { rule = { class = "MPlayer" }, - properties = { floating = true } }, - { rule = { class = "pinentry" }, - properties = { floating = true } }, - { rule = { class = "gimp" }, + buttons = clientbuttons, + screen = awful.screen.preferred, + placement = awful.placement.no_overlap+awful.placement.no_offscreen } }, + { rule_any = { + class = { + "Sensation Editor", + "MPlayer", + "pinentry", + "mpv", + "gimp", + } }, properties = { floating = true } }, { rule = { class = "URxvt", instance = "pulsemixer" }, properties = { floating = true, skip_taskbar = true, ontop = true, + placement = awful.placement.top_right, function (c) - c:geometry({ x = 1920 - 500, y = mywibox[mouse.screen].height, - width = 500, height = 300}) - c:connect_signal("unfocus", function (c) c:kill() end) + s = awful.screen.focused() + c:connect_signal("unfocus", function (c) c:kill() end) end } }, { rule = { class = "URxvt"}, properties = { opacity = 0.8 } }, { rule = { class = "URxvt", instance = "mutt" }, properties = { tag = wwwtag, function (c) awful.client.setslave(c) end } }, - { rule = { class = "Dwb", type = "normal", instance = "dwb-default" }, - properties = { tag = wwwtag, - function (c) awful.client.setmaster(c) end } }, - { rule = { class = "Dwb", type = "normal", instance = "dwb-social" }, - properties = { tag = socialtag } }, { rule = { class = "URxvt", instance = "ncmpcpp" }, properties = { tag = mediatag, function (c) awful.client.setmaster(c) end } }, diff --git a/awesome/tags.lua b/awesome/tags.lua index 7a98a97..f79c9d1 100644 --- a/awesome/tags.lua +++ b/awesome/tags.lua @@ -3,12 +3,10 @@ layouts = { awful.layout.suit.floating, - lain.layout.uselesstile, - lain.layout.uselesstile.left, - lain.layout.uselesstile.bottom, - lain.layout.uselesstile.top, - lain.layout.uselessfair, - lain.layout.uselessfair.horizontal, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, -- lain.layout.uselesspiral, -- lain.layout.uselesspiral.dwindle, awful.layout.suit.max, @@ -26,50 +24,71 @@ local mytags = {} local path = beautiful.path local icon_only = true +--TODO create a list of tag objects and place them according to number of screens (sb:20170130) -- single screen {{{2 mytags[1] = {} mytags[1][1] = { - { name = "1", layout = lain.layout.uselesstile.left, mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, - { name = "2", layout = lain.layout.uselesstile, mwfact=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, - { name = "3", layout = awful.layout.suit.max, mwfact=0.50, icon = path.."/cutiemarks/twilight_sparkle.png"}, - { name = "4", layout = lain.layout.uselesstile.left, mwfact=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, - { name = "5", layout = lain.layout.uselesstile, mwfact=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, - { name = "6", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/trixie.png"}, - { name = "7", layout = lain.layout.uselesstile.bottom, mwfact=0.80, icon = path.."/cutiemarks/soarin.png"}, - { name = "8", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/princess_celestia.png"}, - { name = "9", layout = awful.layout.suit.floating, mwfact=0.50, icon = path.."/cutiemarks/princess_luna.png"}, + { name = "1", layout = awful.layout.suit.tile.left, master_width_factor=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, + { name = "2", layout = awful.layout.suit.tile, master_width_factor=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, + { name = "3", layout = awful.layout.suit.max, master_width_factor=0.50, icon = path.."/cutiemarks/twilight_sparkle.png"}, + { name = "4", layout = awful.layout.suit.tile.left, master_width_factor=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, + { name = "5", layout = awful.layout.suit.tile, master_width_factor=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, + { name = "6", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/trixie.png"}, + { name = "7", layout = awful.layout.suit.tile.bottom, master_width_factor=0.80, icon = path.."/cutiemarks/soarin.png"}, + { name = "8", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/princess_celestia.png"}, + { name = "9", layout = awful.layout.suit.floating, master_width_factor=0.50, icon = path.."/cutiemarks/princess_luna.png"}, } -- Dual screen {{{2 mytags[2] = {} mytags[2][1] = { - { name = "1", layout = lain.layout.uselesstile.left, mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, - { name = "2", layout = lain.layout.uselesstile.left, mwfact=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, - { name = "3", layout = lain.layout.uselesstile.left, mwfact=0.60, icon = path.."/cutiemarks/twilight_sparkle.png"}, - { name = "4", layout = lain.layout.uselesstile.left, mwfact=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, - { name = "5", layout = lain.layout.uselesstile.left, mwfact=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, - { name = "6", layout = lain.layout.uselesstile.left, mwfact=0.70, icon = path.."/cutiemarks/trixie.png"}, - { name = "7", layout = lain.layout.uselesstile.left, mwfact=0.88, icon = path.."/cutiemarks/soarin.png"}, - { name = "8", layout = lain.layout.uselesstile.left, mwfact=0.84, icon = path.."/cutiemarks/princess_celestia.png"}, - { name = "9", layout = awful.layout.suit.floating, mwfact=0.50, icon = path.."/cutiemarks/princess_luna.png"}, + { name = "1", layout = awful.layout.suit.tile.left, master_width_factor=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, + { name = "2", layout = awful.layout.suit.tile.left, master_width_factor=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, + { name = "3", layout = awful.layout.suit.tile.left, master_width_factor=0.60, icon = path.."/cutiemarks/twilight_sparkle.png"}, + { name = "4", layout = awful.layout.suit.tile.left, master_width_factor=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, + { name = "5", layout = awful.layout.suit.tile.left, master_width_factor=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, + { name = "6", layout = awful.layout.suit.tile.left, master_width_factor=0.70, icon = path.."/cutiemarks/trixie.png"}, + { name = "7", layout = awful.layout.suit.tile.left, master_width_factor=0.88, icon = path.."/cutiemarks/soarin.png"}, + { name = "8", layout = awful.layout.suit.tile.left, master_width_factor=0.84, icon = path.."/cutiemarks/princess_celestia.png"}, + { name = "9", layout = awful.layout.suit.floating, master_width_factor=0.50, icon = path.."/cutiemarks/princess_luna.png"}, } mytags[2][2] = { - { name = "1", layout = lain.layout.uselesstile, mwfact=0.60, icon = path.."/cutiemarks/snails.png"}, - { name = "2", layout = awful.layout.suit.max, mwfact=0.88, icon = path.."/cutiemarks/snips.png"}, - { name = "3", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/lyra_heartstrings.png"}, - { name = "4", layout = lain.layout.uselesstile.left, mwfact=0.80, icon = path.."/cutiemarks/rarity.png"}, - { name = "5", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/fluttershy.png"}, - { name = "6", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/applejack.png"}, - { name = "7", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/snowflake.png"}, - { name = "8", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/thunderlane.png"}, - { name = "9", layout = awful.layout.suit.max, mwfact=0.50, icon = path.."/cutiemarks/bon_bon.png"}, + { name = "1", layout = awful.layout.suit.tile, master_width_factor=0.60, icon = path.."/cutiemarks/snails.png"}, + { name = "2", layout = awful.layout.suit.max, master_width_factor=0.88, icon = path.."/cutiemarks/snips.png"}, + { name = "3", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/lyra_heartstrings.png"}, + { name = "4", layout = awful.layout.suit.tile.left, master_width_factor=0.80, icon = path.."/cutiemarks/rarity.png"}, + { name = "5", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/fluttershy.png"}, + { name = "6", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/applejack.png"}, + { name = "7", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/snowflake.png"}, + { name = "8", layout = awful.layout.suit.tile, master_width_factor=0.50, icon = path.."/cutiemarks/thunderlane.png"}, + { name = "9", layout = awful.layout.suit.max, master_width_factor=0.50, icon = path.."/cutiemarks/bon_bon.png"}, } +-- Wallpaper {{{2 +local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) +screen.connect_signal("property::geometry", set_wallpaper) + -- Tags {{{2 tags = {} local sc = screen.count() -for s = 1, sc do +awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + local s = s.index tags[s] = {} for i,p in ipairs(mytags[sc][s]) do local props = {} @@ -81,4 +100,4 @@ for s = 1, sc do tags[s][i] = awful.tag.add(p.name, props) end tags[s][1].selected = true -end +end) diff --git a/awesome/themes/mlp/theme.lua b/awesome/themes/mlp/theme.lua index f603a7d..dda9e05 100644 --- a/awesome/themes/mlp/theme.lua +++ b/awesome/themes/mlp/theme.lua @@ -2,7 +2,7 @@ -- Default awesome theme -- --------------------------- -theme = {} +local theme = {} theme.path = awful.util.getdir("config").."/themes/mlp" @@ -19,6 +19,8 @@ theme.fg_focus = "#ffffff" theme.fg_urgent = "#ffffff" theme.fg_minimize = "#ffffff" +theme.useless_gap = 10 +theme.gap_single_client = false theme.border_width = 2 theme.border_normal = "#000000" theme.border_focus = "#535d6c" @@ -51,9 +53,6 @@ theme.menu_width = 100 --theme.bg_widget = "#cc0000" -- Define the image to load -theme.titlebar_close_button_normal = theme.path.."/titlebar/close_normal.png" -theme.titlebar_close_button_focus = theme.path.."/titlebar/close_focus.png" - theme.titlebar_ontop_button_normal_inactive = theme.path.."/titlebar/ontop_normal_inactive.png" theme.titlebar_ontop_button_focus_inactive = theme.path.."/titlebar/ontop_focus_inactive.png" theme.titlebar_ontop_button_normal_active = theme.path.."/titlebar/ontop_normal_active.png" @@ -89,8 +88,11 @@ theme.layout_tile = theme.path.."/layouts/tilew.png" theme.layout_tiletop = theme.path.."/layouts/tiletopw.png" theme.layout_spiral = theme.path.."/layouts/spiralw.png" theme.layout_dwindle = theme.path.."/layouts/dwindlew.png" +theme.layout_cornernw = theme.path.."/layouts/cornernww.png" +theme.layout_cornerne = theme.path.."/layouts/cornernew.png" +theme.layout_cornersw = theme.path.."/layouts/cornersww.png" +theme.layout_cornerse = theme.path.."/layouts/cornersew.png" -- lain stuff -theme.useless_gap_width = 10 theme.lain_icons = "/usr/share/awesome/lib/lain/icons/layout/default/" theme.layout_uselessfairh = theme.path.."/layouts/fairhw.png" theme.layout_uselessfair = theme.path.."/layouts/fairvw.png" @@ -107,9 +109,10 @@ theme.layout_centerwork = theme.lain_icons .. "centerworkw.png" theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png" --- Define the icon theme for application icons. If not set then the icons +-- 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 return theme + -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/awesome/topbar.lua b/awesome/topbar.lua index 91b04fa..27493b3 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -8,22 +8,39 @@ local wibox = require("wibox") separator = wibox.widget.textbox() separator:set_markup('│') +local function client_menu_toggle_fn() + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ theme = { width = 250 } }) + end + end +end + -- Wibox {{{1 -- 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), +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, 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({ 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 @@ -31,8 +48,8 @@ mytasklist.buttons = awful.util.table.join( -- Without this, the following -- :isvisible() makes no sense c.minimized = false - if not c:isvisible() then - awful.tag.viewonly(c:tags()[1]) + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() end -- This will also un-minimize -- the client, if needed @@ -41,73 +58,63 @@ mytasklist.buttons = awful.util.table.join( end end), awful.button({ }, 2, function (c) c:kill() end), - awful.button({ }, 3, function () - if instance then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ width=250 }) - end - end), + awful.button({ }, 3, client_menu_toggle_fn()), 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)) -for s = 1, screen.count() do +awful.screen.connect_for_each_screen(function(s) -- Create a promptbox for each screen - mypromptbox[s] = awful.widget.prompt() + s.mypromptbox = awful.widget.prompt() -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. - mylayoutbox[s] = awful.widget.layoutbox(s) - mylayoutbox[s]:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(awful.util.table.join( + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) -- Create a taglist widget - mytaglist[s] = 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.currenttags, tasklist_buttons) -- Create the wibox - mywibox[s] = awful.wibox({ position = "top", screen = s }) - - -- Widgets that are aligned to the left - local left_layout = wibox.layout.fixed.horizontal() - -- left_layout:add(mylauncher) - left_layout:add(mytaglist[s]) - left_layout:add(mypromptbox[s]) + s.mywibox = awful.wibar({ position = "top", screen = 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(separator) - right_layout:add(require("widgets/pomodoro")) - right_layout:add(separator) - right_layout:add(require("widgets/awesompd")) - right_layout:add(require("widgets/volume_widget")) - if utils.host == "chronos" then - right_layout:add(separator) - right_layout:add(require("widgets/battery_widget")) - end - right_layout:add(separator) - right_layout:add(require("widgets/network_widget")) - right_layout:add(separator) - right_layout:add(require("widgets/calendar")) - right_layout:add(mylayoutbox[s]) - - -- Now bring it all together (with the tasklist in the middle) - local layout = wibox.layout.align.horizontal() - layout:set_left(left_layout) - layout:set_middle(mytasklist[s]) - layout:set_right(right_layout) - - mywibox[s]:set_widget(layout) -end + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + s.mytaglist, + s.mypromptbox, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + mykeyboardlayout, + wibox.widget.systray(), + separator, + require("widgets/pomodoro"), + separator, + require("widgets/awesompd"), + require("widgets/volume_widget"), + utils.has_battery() and { + layout = wibox.layout.fixed.horizontal, + separator, + require("widgets/battery_widget"), + }, + separator, + require("widgets/network_widget"), + separator, + require("widgets/calendar"), + s.mylayoutbox, + }, + } +end) diff --git a/awesome/utils.lua b/awesome/utils.lua index 0c56131..070cb3e 100644 --- a/awesome/utils.lua +++ b/awesome/utils.lua @@ -9,6 +9,10 @@ utils.globalkeys = { } local host = io.popen("hostname") utils.host = host:read("*l") +function utils.is_dir(path) + return os.execute(('[ -d "%s" ]'):format(path)) +end + function utils.run_or_kill(prg, cprop, screen) if not prg then do return nil end @@ -43,7 +47,7 @@ function utils.run_or_kill(prg, cprop, screen) end end end - awful.util.spawn_with_shell(prg, screen) + awful.spawn.with_shell(prg, screen) end -- http://awesome.naquadah.org/wiki/Autostart#Simple_way @@ -57,9 +61,9 @@ function utils.run_once(prg,arg_string,pname,screen) end if not arg_string then - awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen) + awful.spawn.with_shell("pgrep -f -u $USER -x '" .. pname .. "' || (" .. prg .. ")",screen) else - awful.util.spawn_with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen) + awful.spawn.with_shell("pgrep -f -u $USER -x '" .. pname .. " ".. arg_string .."' || (" .. prg .. " " .. arg_string .. ")",screen) end end @@ -82,4 +86,8 @@ function utils.globalkeys.append(keys) globalkeys = awful.util.table.join(globalkeys, keys) end +function utils.has_battery() + return utils.is_dir("/sys/class/power_supply/BAT0") +end + return utils diff --git a/awesome/widgets/awesompd b/awesome/widgets/awesompd index 3157a1c..d9a2e4b 160000 --- a/awesome/widgets/awesompd +++ b/awesome/widgets/awesompd @@ -1 +1 @@ -Subproject commit 3157a1c765ce4ae9130ee472d162bcf4026965d1 +Subproject commit d9a2e4b2d274eab33e09bd1544f0ed0b94a488c2 diff --git a/awesome/widgets/awesompd.lua b/awesome/widgets/awesompd.lua index 38e82e8..20fdd1b 100644 --- a/awesome/widgets/awesompd.lua +++ b/awesome/widgets/awesompd.lua @@ -23,7 +23,7 @@ musicwidget.album_cover_size = 50 musicwidget.mpd_config = os.getenv("XDG_CONFIG_HOME").."/mpd/mpd.conf" -- Specify the browser you use so awesompd can open links from -- Jamendo in it. -musicwidget.browser = "mimeo" +musicwidget.browser = "rifle" -- Specify decorators on the left and the right side of the -- widget. Or just leave empty strings if you decorate the widget -- from outside. diff --git a/awesome/widgets/battery_widget.lua b/awesome/widgets/battery_widget.lua index 3cdcb3e..dceaacd 100644 --- a/awesome/widgets/battery_widget.lua +++ b/awesome/widgets/battery_widget.lua @@ -33,7 +33,7 @@ local function batclosure () return function (_, args) local state, charge = args[1], args[2] if not charge then return end - if state ~= "-" then + if state == "−" then dirsign = "↓" if charge <= nextlim then naughty.notify({title = "⚡ Warning! ⚡", @@ -45,7 +45,7 @@ local function batclosure () }) nextlim = getnextlim(charge) end - elseif state ~= "+" then + elseif state == "+" then dirsign = "↑" nextlim = limits[1][1] else @@ -57,6 +57,6 @@ local function batclosure () end batterywidget = wibox.widget.textbox() -vicious.register(batterywidget, vicious.widgets.bat, batclosure(), 31, "BAT0") +vicious.register(batterywidget, vicious.widgets.bat, batclosure(), 5, "BAT0") return batterywidget diff --git a/awesome/widgets/calendar.lua b/awesome/widgets/calendar.lua index cdf58ae..565e390 100644 --- a/awesome/widgets/calendar.lua +++ b/awesome/widgets/calendar.lua @@ -9,6 +9,7 @@ local awful = require("awful") local beautiful = require("beautiful") local naughty = require("naughty") +local wibox = require("wibox") local io = { popen = io.popen } local os = { date = os.date } @@ -22,7 +23,7 @@ calendar.bg = beautiful.bg_normal or "#FFFFFF" calendar.position = "top_right" calendar.offset = 0 -local calwidget = awful.widget.textclock(" %a %b %d, %k:%M ", 10) +local calwidget = wibox.widget.textclock(" %a %b %d, %H:%M ", 10) calwidget:connect_signal("mouse::enter", function () calendar:show(0) end) calwidget:connect_signal("mouse::leave", function () calendar:hide() end) diff --git a/awesome/widgets/net_widgets b/awesome/widgets/net_widgets index 6f86968..14ddf2e 160000 --- a/awesome/widgets/net_widgets +++ b/awesome/widgets/net_widgets @@ -1 +1 @@ -Subproject commit 6f869684f7745c7e7aae9336facdc47d2896cc30 +Subproject commit 14ddf2e767ab2f4be8b032f51f7d37cafadf2d9a diff --git a/awesome/widgets/network_widget.lua b/awesome/widgets/network_widget.lua index 4be6982..2d9700b 100644 --- a/awesome/widgets/network_widget.lua +++ b/awesome/widgets/network_widget.lua @@ -8,11 +8,14 @@ end if utils.host == "smartlab-imac2" then widget = net_widget.wireless({interface="wlp3s0", command_mode="newer", font='monospace'}) end -if utils.host == "shada" then +if utils.host == "hactar" then widget = net_widget.indicator({interfaces={"enp3s0"}, command_mode="newer", font='monospace'}) end if utils.host == "sb-arch" then widget = net_widget.indicator({interfaces={"enp0s31f6"}, command_mode="newer", font='monospace'}) end +if utils.host == "UH-LPT044" then + widget = net_widget.wireless({interface="wlp4s0", command_mode="newer", font='monospace'}) +end return widget diff --git a/awesome/widgets/pomodoro b/awesome/widgets/pomodoro index a861385..cf59559 160000 --- a/awesome/widgets/pomodoro +++ b/awesome/widgets/pomodoro @@ -1 +1 @@ -Subproject commit a861385355d0ac10091eda49757fc9eda05480a3 +Subproject commit cf595599d926fe975ce4207ae9d3e61bbd36e340 diff --git a/awesome/widgets/pomodoro.lua b/awesome/widgets/pomodoro.lua index 3c7af63..7e7a5c1 100644 --- a/awesome/widgets/pomodoro.lua +++ b/awesome/widgets/pomodoro.lua @@ -8,6 +8,7 @@ pomodoro.work_duration = 25 * 60 -- format string pomodoro.format = function (t) return " "..t.."" end +pomodoro.auto_start_pomodoro = false pomodoro.init() @@ -15,8 +16,16 @@ pombox = wibox.layout.fixed.horizontal() pombox:add(pomodoro.icon_widget) pombox:add(pomodoro.widget) +--TODO connect signals to something sensible (sb:20170130) +-- pomodoro:connect_signal("stop_working", function () naughty.notify{ text = "stop_working", timeout = 10 } end) +-- pomodoro:connect_signal("stop_pause", function () naughty.notify{ text = "stop_pause", timeout = 10 } end) +-- pomodoro:connect_signal("start_working", function () naughty.notify{ text = "start_working", timeout = 10 } end) +pomodoro:connect_signal("work_stop", function () + awful.spawn(terminal.." -name diary -e diary") +end) + globalkeys = awful.util.table.join(globalkeys, - awful.key({ modkey, "Shift" }, "p", function() pomodoro:start() end) + awful.key({ modkey, "Shift" }, "p", function() pomodoro:toggle() end) ) return pombox diff --git a/awesome/widgets/volume_progressbar_widget.lua b/awesome/widgets/volume_progressbar_widget.lua index fc9c82e..d920113 100644 --- a/awesome/widgets/volume_progressbar_widget.lua +++ b/awesome/widgets/volume_progressbar_widget.lua @@ -17,7 +17,7 @@ volwidget:set_ticks_size(2) -- Select device local device = "" if utils.host == "chronos" then device = "alsa_output.pci-0000_00_1b.0.analog-stereo" end -if utils.host == "shada" then device = "alsa_output.pci-0000_00_14.2.analog-stereo" end +if utils.host == "hactar" then device = "alsa_output.pci-0000_00_14.2.analog-stereo" end -- Register widget vicious.register(volwidget, vicious.contrib.pulse, "$1", 1, device) diff --git a/bin/diary b/bin/diary new file mode 100755 index 0000000..e6ec3a2 --- /dev/null +++ b/bin/diary @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +vim \ + -c "call vimwiki#diary#make_note(v:count1)" \ + + \ + -c 'r !date +"\%n== \%H:\%M ==\%n * "' \ + -c "start!" diff --git a/bin/weechat b/bin/weechat index 483fd31..885837c 100755 --- a/bin/weechat +++ b/bin/weechat @@ -6,5 +6,5 @@ host=rmz.io if [[ "$(hostnamectl --static)" == "$host" ]]; then /usr/bin/weechat "$@" else - autossh -M0 -t $host "tmux -u new-session -As weechat weechat" + autossh -M0 -t $host "LANG=en_GB.UTF-8 tmux -u new-session -As weechat weechat" fi diff --git a/flexget/config.yml b/flexget/config.yml index 34d5dcb..88e898d 100644 --- a/flexget/config.yml +++ b/flexget/config.yml @@ -1,11 +1,14 @@ -secrets: private.yml +variables: private.yml templates: # {{{1 email: # {{{2 - email: - from: flexget@tardis - to: ramsi@localhost + notify: + task: + via: + - email: + from: flexget@tardis + to: ramsi@localhost torrents: # {{{2 @@ -21,24 +24,28 @@ templates: # {{{1 transmission: host: localhost port: 9091 - path: /mnt/Skaro/torrents/done + path: /srv/torrents/done ratio: 0.0 usenet: # {{{2 sabnzbd: - key: '{{secrets.sabnzbd.key}}' - url: '{{secrets.sabnzbd.url}}' + key: '{?sabnzbd.key?}' + url: '{?sabnzbd.url?}' usenet-movies: # {{{2 inputs: - - rss: { url: 'https://www.usenet-crawler.com/rss?t=2040&dl=1&num=100{{secrets.crawler.api}}', silent: yes } # Movies HD + - rss: { url: 'https://www.usenet-crawler.com/rss?t=2040&dl=1&num=100{?crawler.api?}', silent: yes } # Movies HD + - rss: { url: 'https://newztown.co.za/rss?t=2040&dl=1&num=100{?newztown.api?}', silent: yes } # Movies HD + - rss: { url: 'https://api.drunkenslug.com/rss?t=2040&dl=1&num=100{?drunkenslug.api?}', silent: yes } # Movies HD usenet-tv: # {{{2 inputs: - - rss: { url: 'https://www.usenet-crawler.com/rss?t=5030,5040&dl=1&num=100{{secrets.crawler.api}}', silent: yes } # TV SD/HD + - rss: { url: 'https://www.usenet-crawler.com/rss?t=5030,5040&dl=1&num=100{?crawler.api?}', silent: yes } # TV SD/HD + - rss: { url: 'https://newztown.co.za/rss?t=5030,5040&dl=1&num=100{?newztown.api?}', silent: yes } # TV SD/HD + - rss: { url: 'https://api.drunkenslug.com/rss?t=2040&dl=1&num=100{?drunkenslug.api?}', silent: yes } # Movies HD filters: # {{{2 @@ -67,6 +74,7 @@ templates: # {{{1 - \[facepalm\]: {from: title} - \bASAP\b: {from: title} - \b Go\): {from: title} # filter those misplaced french only movies + - \b(HEVC|x265)\b: {from: title} # don't get x265/HEVC series: # {{{2 @@ -82,7 +90,7 @@ templates: # {{{1 upgrade: yes exists_series: path: - - '/mnt/Skaro/Series/{{tvdb_series_name}}' + - '/mnt/series/{{tvdb_series_name}}' allow_different_qualities: better content_size: min: 100 @@ -96,6 +104,7 @@ templates: # {{{1 - american dad - archer 2009 - better call saul + - black mirror - boardwalk empire - breaking bad - broadchurch @@ -110,7 +119,7 @@ templates: # {{{1 - family guy - foyle's war - futurama - - game of thrones + - game of thrones: { timeframe: 9 hours } - homeland - house of cards 2013: { alternate_name: house of cards us } - how i met your mother @@ -125,19 +134,21 @@ templates: # {{{1 - suits - the big bang theory - the blacklist + - the blacklist redemption - the cleveland show - the walking dead - two and a half men - the wire: { quality: 720p+ } - vinyl + - westworld series-trakt: # {{{2 configure_series: from: trakt_list: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' + username: '{?trakt.username?}' + account: '{?trakt.account?}' list: followlist type: shows settings: *default_settings @@ -147,8 +158,8 @@ templates: # {{{1 configure_series: from: trakt_list: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' + username: '{?trakt.username?}' + account: '{?trakt.account?}' list: backfill type: shows settings: # *default_settings @@ -158,15 +169,15 @@ templates: # {{{1 interval: 1 hours what: - trakt_list: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' + username: '{?trakt.username?}' + account: '{?trakt.account?}' list: backfill type: episodes - - emit_series: + - next_series_episodes: from_start: yes from: - newznab: - url: 'https://www.usenet-crawler.com/api?apikey={{secrets.crawler.apikey}}&t=tvsearch&cat=5030,5040&extended=1' + url: 'https://www.usenet-crawler.com/api?apikey={?crawler.apikey?}&t=tvsearch&cat=5030,5040&extended=1' category: tv all_series: yes @@ -177,17 +188,18 @@ templates: # {{{1 priority: '-2' exists_movie: path: - - '/mnt/Skaro/Movies' + - '/mnt/movies' allow_different_qualities: better type: files lookup: imdb movies-imdb: # {{{2 + imdb_lookup: yes + require_field: imdb_url imdb: min_score: 7.5 min_votes: 30000 - imdb_required: on movies-1080p: # {{{2 @@ -206,23 +218,24 @@ templates: # {{{1 max: 10000 strict: yes - movies-discover-queue: # {{{2 - movie_queue: accept - discover: - what: - - emit_movie_queue: yes - from: - - newznab: - url: 'https://www.usenet-crawler.com/api?apikey={{secrets.crawler.apikey}}&t=movie&extended=1&cat=2040' - category: movie - interval: 7 days # search each entry only once a week + # movies-discover-queue: # {{{2 + # movie_queue: accept + # discover: + # what: + # - emit_movie_queue: yes + # from: + # - newznab: + # url: 'https://www.usenet-crawler.com/api?apikey={?crawler.apikey?}&t=movie&extended=1&cat=2040' + # category: movie + # interval: 7 days # search each entry only once a week trakt-add-collection: # {{{2 - trakt_add: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' - list: collection + list_add: + - trakt_list: + username: '{?trakt.username?}' + account: '{?trakt.account?}' + list: collection tasks: # {{{1 @@ -248,33 +261,33 @@ tasks: # {{{1 # digest: backfill - dl-movies-trakt: # {{{2 - priority: 10 - trakt_list: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' - list: watchlist - type: movies - accept_all: yes - movie_queue: add - - - dl-movies-trakt-remove: # {{{2 - priority: 20 - disable: - - seen - emit_movie_queue: yes - crossmatch: - from: - - trakt_list: - username: '{{secrets.trakt.username}}' - account: '{{secrets.trakt.account}}' - list: watchlist - type: movies - fields: [imdb_id] - action: reject - accept_all: yes - movie_queue: remove + # dl-movies-trakt: # {{{2 + # priority: 10 + # trakt_list: + # username: '{?trakt.username?}' + # account: '{?trakt.account?}' + # list: watchlist + # type: movies + # accept_all: yes + # movie_queue: add + + + # dl-movies-trakt-remove: # {{{2 + # priority: 20 + # disable: + # - seen + # emit_movie_queue: yes + # crossmatch: + # from: + # - trakt_list: + # username: '{?trakt.username?}' + # account: '{?trakt.account?}' + # list: watchlist + # type: movies + # fields: [imdb_id] + # action: reject + # accept_all: yes + # movie_queue: remove dl-movies-discover-queue-1080p: # {{{2 @@ -357,8 +370,8 @@ tasks: # {{{1 filesystem: path: - - /mnt/Skaro/usenet/done - - /mnt/Skaro/torrents/done + - /srv/usenet/done + - /srv/torrents/done recursive: yes retrieve: files regexp: '.*\.(avi|mkv|mp4|mpg|divx|webm)$' @@ -371,15 +384,18 @@ tasks: # {{{1 all_series: parse_only: yes accept_all: yes - require_field: tvdb_episode + require_field: + - tvdb_season + - tvdb_episode + - tvdb_ep_name set: - destination: '/mnt/Skaro/Series' + destination: '/mnt/series' folder: "{{tvdb_series_name}}/{% if tvdb_season == 0 %}Specials{% else %}Season {{tvdb_season}}{% endif %}" filename: "{{tvdb_season}}x{{tvdb_episode|pad(2)}} {{tvdb_ep_name|replace('/','-')}} ({{tvdb_ep_air_date|formatdate('%Y')}}){{'{'}}{{quality|replace(' ','}{')}}{{'}'}}[en]" move: - to: "/mnt/Skaro/Series/{{folder}}" - filename: "{{filename}}" + to: "/mnt/series/{{folder}}" + rename: "{{filename}}" clean_source: 100 # removes dir if < [N] MB # log: "<<<{{folder}}/{{filename}}>>>" @@ -401,8 +417,8 @@ tasks: # {{{1 filesystem: path: - - /mnt/Skaro/usenet/done - - /mnt/Skaro/torrents/done + - /srv/usenet/done + - /srv/torrents/done recursive: yes regexp: '.*\.(mkv|avi|mp4)$' @@ -415,19 +431,21 @@ tasks: # {{{1 - movie_name is None: manipulate: - title: - extract: '([^/]*)/[^/]*$' + extract: 'done/([^/]*)/[^/]*$' from: location imdb_lookup: yes accept_all: yes - require_field: imdb_name + require_field: + - imdb_name + - imdb_year set: - destination: '/mnt/Skaro/Movies' + destination: '/mnt/movies' filename: "{{imdb_name}} ({{imdb_year}}){{'{'}}{{quality|replace(' ','}{')}}{{'}'}}[en]" move: - to: "/mnt/Skaro/Movies" - filename: "{{filename}}" + to: "/mnt/movies" + rename: "{{filename}}" clean_source: 100 # removes dir if < [N] MB exec: @@ -439,14 +457,17 @@ tasks: # {{{1 daily-mail: # {{{2 manual: yes no_entries_ok: yes - emit_digest: + from_digest: list: move-tasks seen: local accept_all: yes - email: - from: flexget@tardis - to: ramsi@localhost - template: move + notify: + task: + template: move + via: + - email: + from: flexget@tardis + to: ramsi@localhost backfill-mail: # {{{2 @@ -455,7 +476,7 @@ tasks: # {{{1 template: - email no_entries_ok: yes - emit_digest: + from_digest: list: backfill seen: local accept_all: yes @@ -467,7 +488,7 @@ tasks: # {{{1 filesystem: path: - - '/mnt/Skaro/Series' + - '/mnt/series' recursive: yes retrieve: files regexp: '.*\.(avi|mkv|mp4|webm|m4v)$' @@ -505,7 +526,7 @@ tasks: # {{{1 filesystem: path: - - '/mnt/Skaro/Series' + - '/mnt/series' recursive: yes retrieve: files regexp: '.*\.(avi|mkv|mp4|webm|m4v)$' @@ -541,7 +562,7 @@ tasks: # {{{1 - trakt-add-collection filesystem: path: - - '/mnt/Skaro/Movies' + - '/mnt/movies' recursive: yes retrieve: files regexp: '.*\.(avi|mkv|mp4|webm|m4v)$' diff --git a/git/config b/git/config index f3865cf..2892abb 100644 --- a/git/config +++ b/git/config @@ -29,3 +29,7 @@ [rebase] autostash = true autosquash = true +[status] + submodulesummary = true +[rerere] + enabled = true diff --git a/mimeo.conf b/mimeo.conf deleted file mode 100644 index 1a619af..0000000 --- a/mimeo.conf +++ /dev/null @@ -1,2 +0,0 @@ -/usr/bin/mpv --profile=mimeo "%u" - ^https?://www.youtube.com/watch\?(.*&)*v=.* diff --git a/mpd/mpd.conf b/mpd/mpd.conf index eaa611b..749bf35 100644 --- a/mpd/mpd.conf +++ b/mpd/mpd.conf @@ -9,10 +9,7 @@ log_file "~/.local/share/mpd/log" pid_file "~/.local/share/mpd/pid" state_file "~/.local/share/mpd/state" sticker_file "~/.local/share/mpd/sticker.sql" - -input { - plugin "curl" -} +max_output_buffer_size "16384" audio_output { type "pulse" diff --git a/mpv/config b/mpv/config index 5958775..5164e39 100644 --- a/mpv/config +++ b/mpv/config @@ -5,7 +5,3 @@ cache=auto cache-default=50000 cache-initial=100 no-sub - -# profiles -[mimeo] -quiet diff --git a/mutt/bindings b/mutt/bindings index a8dfb0a..028fa0a 100644 --- a/mutt/bindings +++ b/mutt/bindings @@ -19,8 +19,8 @@ macro index,pager gs "=gmail/spam" "go to spam" macro index,pager gc "=gmail/cadscan" "go to cadscan" bind index q noop -bind index Q noop -bind index x noop +bind index,pager Q noop +bind index,pager x noop # completion bind editor complete-query diff --git a/mutt/hooks b/mutt/hooks index ccc2334..f1f39aa 100644 --- a/mutt/hooks +++ b/mutt/hooks @@ -20,3 +20,9 @@ folder-hook inbox push '!~(~U|~F|~d<3m)' folder-hook youtube push '=(=U|=F)' # delete other mails folder-hook youtube push '!~(~U|~F)' + +# open video in mpv +folder-hook * bind index,pager m mail +folder-hook * bind pager next-line +folder-hook youtube 'macro index,pager m "~/.mutt/mutt_mpv"' +folder-hook youtube 'macro pager "~/.mutt/mutt_mpv"' diff --git a/mutt/mailcap b/mutt/mailcap index 104fcfd..b5c4dee 100644 --- a/mutt/mailcap +++ b/mutt/mailcap @@ -1,5 +1,4 @@ text/html; ~/.mutt/mutt_bgrun qutebrowser %s; test=test -n "$DISPLAY"; nametemplate=%s.html text/html; w3m -I %{charset} -dump %s -T text/html -cols "$COLUMNS" -o display_link_number=1; copiousoutput; nametemplate=%s.html -image/*; ~/.mutt/mutt_bgrun feh %s; -application/pdf; ~/.mutt/mutt_bgrun okular %s; -application/*; ~/.mutt/mutt_bgrun mimeo %s; +application/*; ~/.mutt/mutt_bgrun rifle -f F %s; +image/*; rifle -f F %s; diff --git a/mutt/mutt_mpv b/mutt/mutt_mpv new file mode 100755 index 0000000..a339a05 --- /dev/null +++ b/mutt/mutt_mpv @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +url=$(grep -Eo '^https?://www.youtube.com/watch\?v=[[:alnum:]_-]{11}' +record-macro + q + +run-macro + @ + [insert] # Keybindings for insert mode. # Since normal keypresses are passed through, only special keys are @@ -551,6 +557,14 @@ prompt-accept no prompt-open-download +prompt-item-focus prev + + + +prompt-item-focus next + + + [command,prompt] rl-backward-char diff --git a/qutebrowser/qutebrowser.conf b/qutebrowser/qutebrowser.conf index b14fedb..d1c56d3 100644 --- a/qutebrowser/qutebrowser.conf +++ b/qutebrowser/qutebrowser.conf @@ -36,13 +36,20 @@ # # startpage (List of String): # The default page(s) to open at the start, separated by commas. -# Default: https://duckduckgo.com +# Default: https://start.duckduckgo.com # # yank-ignored-url-parameters (List of String): # The URL parameters to strip with :yank url, separated by commas. # Default: # ref,utm_source,utm_medium,utm_campaign,utm_term,utm_content # +# default-open-dispatcher (String): +# The default program used to open downloads. Set to an empty string +# to use the default internal handler. +# Any {} in the string will be expanded to the filename, else the +# filename will be appended. +# Default: +# # default-page (FuzzyUrl): # The page to open if :open -t/-b/-w is used without URL. Use # `about:blank` for a blank page. @@ -85,7 +92,8 @@ # developer-extras (Bool): # Enable extra tools for Web developers. # This needs to be enabled for `:inspector` to work and also adds an -# _Inspect_ entry to the context menu. +# _Inspect_ entry to the context menu. For QtWebEngine, see +# 'qutebrowser --help' instead. # Valid values: true, false # Default: false # @@ -166,6 +174,7 @@ ignore-case = smart startpage = https://duckduckgo.com/?t=chakra yank-ignored-url-parameters = ref,utm_source,utm_medium,utm_campaign,utm_term,utm_content +default-open-dispatcher = default-page = ${startpage} auto-search = naive auto-save-config = true @@ -237,11 +246,15 @@ url-incdec-segments = path,query # Valid values: true, false # Default: false # -# user-stylesheet (UserStyleSheet): -# User stylesheet to use (absolute filename, filename relative to -# the config directory or CSS string). Will expand environment -# variables. -# Default: html > ::-webkit-scrollbar { width: 0px; height: 0px; } +# user-stylesheet (File): +# User stylesheet to use (absolute filename or filename relative to +# the config directory). Will expand environment variables. +# Default: +# +# hide-scrollbar (Bool): +# Hide the main scrollbar. +# Valid values: true, false +# Default: true # # css-media-type (String): # Set the CSS media type. @@ -277,6 +290,7 @@ url-incdec-segments = path,query # * `{id}`: The internal window ID of this window. # * `{scroll_pos}`: The page scroll position. # * `{host}`: The host of the current web page. +# * `{backend}`: Either 'webkit' or 'webengine' # Default: {perc}{title}{title_sep}qutebrowser # # modal-js-dialog (Bool): @@ -294,6 +308,15 @@ url-incdec-segments = path,query # Globs are supported, so ';*' will blacklist all keychainsstarting # with ';'. Use '*' to disable keyhints # Default: +# +# prompt-radius (Int): +# The rounding radius for the edges of prompts. +# Default: 8 +# +# prompt-filebrowser (Bool): +# Show a filebrowser in upload/download prompts. +# Valid values: true, false +# Default: true zoom-levels = 25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,250%,300%,400%,500% default-zoom = 100% downloads-position = top @@ -303,7 +326,8 @@ message-unfocused = false confirm-quit = downloads zoom-text-only = false frame-flattening = false -user-stylesheet = html > ::-webkit-scrollbar { width: 0px; height: 0px; } +user-stylesheet = +hide-scrollbar = true css-media-type = smooth-scrolling = false remove-finished-downloads = -1 @@ -313,6 +337,8 @@ window-title-format = {perc}{title}{title_sep}qutebrowser modal-js-dialog = false hide-wayland-decoration = false keyhint-blacklist = +prompt-radius = 8 +prompt-filebrowser = true [network] # Settings related to the network. @@ -365,6 +391,11 @@ keyhint-blacklist = # custom-headers (HeaderDict): # Set custom headers for qutebrowser HTTP requests. # Default: +# +# netrc-file (File): +# Set location of a netrc-file for HTTP authentication. If empty, +# ~/.netrc is used. +# Default: do-not-track = true accept-language = en-US,en,de,fr referer-header = same-domain @@ -374,6 +405,7 @@ proxy-dns-requests = true ssl-strict = ask dns-prefetch = true custom-headers = +netrc-file = [completion] # Options related to completion and command history. @@ -507,7 +539,7 @@ scrollbar-padding = 2 # into zoom increments. # Default: 512 timeout = 500 -partial-timeout = 1000 +partial-timeout = 5000 insert-mode-on-plugins = false auto-leave-insert-mode = true auto-insert-mode = false @@ -527,25 +559,27 @@ mouse-zoom-divider = 512 # # select-on-remove (SelectOnRemove): # Which tab to select when the focused tab is removed. -# left: Select the tab on the left. -# right: Select the tab on the right. -# previous: Select the previously selected tab. -# Default: right +# prev: Select the tab which came before the closed one (left in +# horizontal, above in vertical). +# next: Select the tab which came after the closed one (right in +# horizontal, below in vertical). +# last-used: Select the previously selected tab. +# Default: next # # new-tab-position (NewTabPosition): # How new tabs are positioned. -# left: On the left of the current tab. -# right: On the right of the current tab. -# first: At the left end. -# last: At the right end. -# Default: right +# prev: Before the current tab. +# next: After the current tab. +# first: At the beginning. +# last: At the end. +# Default: next # # new-tab-position-explicit (NewTabPosition): # How new tabs opened explicitly are positioned. -# left: On the left of the current tab. -# right: On the right of the current tab. -# first: At the left end. -# last: At the right end. +# prev: Before the current tab. +# next: After the current tab. +# first: At the beginning. +# last: At the end. # Default: last # # last-close (String): @@ -623,6 +657,7 @@ mouse-zoom-divider = 512 # * `{id}`: The internal tab ID of this tab. # * `{scroll_pos}`: The page scroll position. # * `{host}`: The host of the current web page. +# * `{backend}`: Either 'webkit' or 'webengine' # Default: {index}: {title} # # title-alignment (TextAlignment): @@ -643,9 +678,9 @@ mouse-zoom-divider = 512 # Padding for indicators (top, bottom, left, right). # Default: 2,2,0,4 background-tabs = false -select-on-remove = left -new-tab-position = right -new-tab-position-explicit = right +select-on-remove = prev +new-tab-position = next +new-tab-position-explicit = next last-close = ignore show = always show-switching-delay = 800 @@ -773,7 +808,7 @@ cache-size = 52428800 # Enables or disables WebGL. For QtWebEngine, Qt/PyQt >= 5.7 is # required for this setting. # Valid values: true, false -# Default: false +# Default: true # # css-regions (Bool): # Enable or disable support for CSS regions. @@ -795,6 +830,11 @@ cache-size = 52428800 # Valid values: true, false, ask # Default: ask # +# media-capture (BoolAsk): +# Allow websites to record audio/video. +# Valid values: true, false, ask +# Default: ask +# # javascript-can-open-windows-automatically (Bool): # Whether JavaScript programs can open new windows without user # interaction. @@ -855,7 +895,7 @@ cache-size = 52428800 # - A zip-file of any of the above, with either only one file, or a # file named 'hosts' (with any extension). # Default: -# http://www.malwaredomainlist.com/hostslist/hosts.txt,http://someonewhocares.org/hosts/hosts,http://winhelp2002.mvps.org/hosts.zip,http://malwaredomains.lehigh.edu/files/justdomains.zip,http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext +# https://www.malwaredomainlist.com/hostslist/hosts.txt,http://someonewhocares.org/hosts/hosts,http://winhelp2002.mvps.org/hosts.zip,http://malwaredomains.lehigh.edu/files/justdomains.zip,https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext # # host-blocking-enabled (Bool): # Whether host blocking is enabled. @@ -884,6 +924,7 @@ css-regions = true hyperlink-auditing = false geolocation = ask notifications = false +media-capture = ask javascript-can-open-windows-automatically = false javascript-can-close-windows = false javascript-can-access-clipboard = false @@ -1012,7 +1053,7 @@ cv = http://docs.opencv.org/3.1.0/index.html#gsc.tab=0&gsc.ref=more%3A3.1&gsc.q= # Aliases for commands. # By default, no aliases are defined. Example which adds a new command # `:qtb` to open qutebrowsers website: -# `qtb = open http://www.qutebrowser.org/` +# `qtb = open https://www.qutebrowser.org/` quit = close q = close exit = quit @@ -1098,30 +1139,6 @@ mpv = spawn --userscript ~/src/qutebrowser/misc/userscripts/view_in_mpv # Background color of the statusbar. # Default: black # -# statusbar.fg.error (QssColor): -# Foreground color of the statusbar if there was an error. -# Default: ${statusbar.fg} -# -# statusbar.bg.error (QssColor): -# Background color of the statusbar if there was an error. -# Default: red -# -# statusbar.fg.warning (QssColor): -# Foreground color of the statusbar if there is a warning. -# Default: ${statusbar.fg} -# -# statusbar.bg.warning (QssColor): -# Background color of the statusbar if there is a warning. -# Default: darkorange -# -# statusbar.fg.prompt (QssColor): -# Foreground color of the statusbar if there is a prompt. -# Default: ${statusbar.fg} -# -# statusbar.bg.prompt (QssColor): -# Background color of the statusbar if there is a prompt. -# Default: darkblue -# # statusbar.fg.insert (QssColor): # Foreground color of the statusbar in insert mode. # Default: ${statusbar.fg} @@ -1315,6 +1332,54 @@ mpv = spawn --userscript ~/src/qutebrowser/misc/userscripts/view_in_mpv # keyhint.bg (QssColor): # Background color of the keyhint widget. # Default: rgba(0, 0, 0, 80%) +# +# messages.fg.error (QssColor): +# Foreground color of an error message. +# Default: white +# +# messages.bg.error (QssColor): +# Background color of an error message. +# Default: red +# +# messages.border.error (QssColor): +# Border color of an error message. +# Default: #bb0000 +# +# messages.fg.warning (QssColor): +# Foreground color a warning message. +# Default: white +# +# messages.bg.warning (QssColor): +# Background color of a warning message. +# Default: darkorange +# +# messages.border.warning (QssColor): +# Border color of an error message. +# Default: #d47300 +# +# messages.fg.info (QssColor): +# Foreground color an info message. +# Default: white +# +# messages.bg.info (QssColor): +# Background color of an info message. +# Default: black +# +# messages.border.info (QssColor): +# Border color of an info message. +# Default: #333333 +# +# prompts.fg (QssColor): +# Foreground color for prompts. +# Default: white +# +# prompts.bg (QssColor): +# Background color for prompts. +# Default: darkblue +# +# prompts.selected.bg (QssColor): +# Background color for the selected item in filename prompts. +# Default: #308cc6 completion.fg = white completion.bg = #333333 completion.alternate-bg = #444444 @@ -1331,12 +1396,6 @@ completion.scrollbar.fg = ${completion.fg} completion.scrollbar.bg = ${completion.bg} statusbar.fg = white statusbar.bg = black -statusbar.fg.error = ${statusbar.fg} -statusbar.bg.error = red -statusbar.fg.warning = ${statusbar.fg} -statusbar.bg.warning = darkorange -statusbar.fg.prompt = ${statusbar.fg} -statusbar.bg.prompt = darkblue statusbar.fg.insert = ${statusbar.fg} statusbar.bg.insert = darkgreen statusbar.fg.command = ${statusbar.fg} @@ -1381,6 +1440,18 @@ webpage.bg = white keyhint.fg = #FFFFFF keyhint.fg.suffix = #FFFF00 keyhint.bg = rgba(0, 0, 0, 80%) +messages.fg.error = ${statusbar.fg} +messages.bg.error = red +messages.border.error = #bb0000 +messages.fg.warning = ${statusbar.fg} +messages.bg.warning = darkorange +messages.border.warning = #d47300 +messages.fg.info = white +messages.bg.info = black +messages.border.info = #333333 +prompts.fg = ${statusbar.fg} +prompts.bg = #333333 +prompts.selected.bg = #308cc6 [fonts] # Fonts used for the UI, with optional style/weight/size. @@ -1465,7 +1536,23 @@ keyhint.bg = rgba(0, 0, 0, 80%) # keyhint (Font): # Font used in the keyhint widget. # Default: 8pt ${_monospace} -_monospace = Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Liberation Mono", "Courier New", Courier, monospace, Fixed, Consolas, Terminal +# +# messages.error (Font): +# Font used for error messages. +# Default: 8pt ${_monospace} +# +# messages.warning (Font): +# Font used for warning messages. +# Default: 8pt ${_monospace} +# +# messages.info (Font): +# Font used for info messages. +# Default: 8pt ${_monospace} +# +# prompts (Font): +# Font used for prompts. +# Default: 8pt sans-serif +_monospace = Hack, Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Liberation Mono", "Courier New", Courier, monospace, Fixed, Consolas, Terminal completion = 8pt ${_monospace} completion.category = bold ${completion} tabbar = 8pt ${_monospace} @@ -1484,3 +1571,7 @@ web-size-minimum-logical = web-size-default = web-size-default-fixed = keyhint = 8pt ${_monospace} +messages.error = 8pt ${_monospace} +messages.warning = 8pt ${_monospace} +messages.info = 8pt ${_monospace} +prompts = 8pt sans-serif diff --git a/ranger/rifle.conf b/ranger/rifle.conf index 27a2767..610f39b 100644 --- a/ranger/rifle.conf +++ b/ranger/rifle.conf @@ -21,6 +21,7 @@ # name | The regexp matches the basename of $1 # path | The regexp matches the absolute path of $1 # has | The program is installed (i.e. located in $PATH) +# env | The environment variable "variable" is non-empty # file | $1 is a file # directory | $1 is a directory # number | change the number of this command to n @@ -47,27 +48,35 @@ # Note: When using rifle in ranger, there is an additional flag "c" for # only running the current file even if you have marked multiple files. +# Play videos with mpv +match ^https?://www.youtube.com/watch\?, has mpv, X, terminal = mpv -- $1 +match ^https?://www.youtube.com/watch\?, has mpv, X, flag f = mpv --quiet -- $1 +match ^https?://youtu.be/, has mpv, X, terminal = mpv --quiet -- $1 +match ^https?://youtu.be/, has mpv, X, flag f = mpv --quiet -- $1 + +# open web url with BROWSER +match ^https?://, X, flag f = $BROWSER -- "$@" + #------------------------------------------- # Websites #------------------------------------------- # Rarely installed browsers get higher priority; It is assumed that if you # install a rare browser, you probably use it. Firefox/konqueror/w3m on the # other hand are often only installed as fallback browsers. -ext x?html?, has dwb, X, flag f = dwb -- "$@" -ext x?html?, has luakit, X, flag f = luakit -- "$@" -ext x?html?, has chromium, X, flag f = chromium -- "$@" -ext x?html?, has elinks, terminal = elinks "$@" -ext x?html?, has lynx, terminal = lynx -- "$@" -ext x?html?, has w3m, terminal = w3m "$@" +ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@" +ext x?html?, has dwb, X, flag f = dwb -- "$@" +ext x?html?, has chromium, X, flag f = chromium -- "$@" +ext x?html?, has elinks, terminal = elinks "$@" +ext x?html?, has w3m, terminal = w3m "$@" #------------------------------------------- # Misc #------------------------------------------- # Define the "editor" for text files as first action -mime ^text, label editor = "$EDITOR" -- "$@" +mime ^text, label editor = $EDITOR -- "$@" mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" -!mime ^text, label pager, ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" +!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" +!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" @@ -87,64 +96,35 @@ ext php = php -- "$1" #-------------------------------------------- # Audio without X #------------------------------------------- -mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@" -mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@" -ext midi?, terminal, has wildmidi = wildmidi -- "$@" +mime ^audio|ogg$, terminal, has mpv = mpv -- "$@" #-------------------------------------------- # Video/Audio with a GUI #------------------------------------------- mime ^video|audio, has umpv, X, flag f = umpv -- "$@" mime ^video|audio, has mpv, X, flag f = mpv -- "$@" -mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@" -mime ^video|audio, has smplayer, X, flag f = smplayer "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@" -mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -- "$@" -mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@" -mime ^video|audio, has vlc, X, flag f = vlc -- "$@" -mime ^video|audio, has totem, X, flag f = totem -- "$@" -mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@" - -#-------------------------------------------- -# Video without X: -#------------------------------------------- -mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@" -mime ^video, terminal, !X, has mplayer = mplayer -- "$@" - -#------------------------------------------- -# Image Viewing: -#------------------------------------------- -ext svg, has inkscape, X, flag f = inkscape -- "$@" -mime ^image, has eog, X, flag f = eog -- "$@" -mime ^image, has sxiv, X, flag f = sxiv -- "$@" -mime ^image, has feh, X, flag f = feh -- "$@" -mime ^image, has mirage, X, flag f = mirage -- "$@" -mime ^image, has gimp, X, flag f = gimp -- "$@" -ext xcf, has gimp, X, flag f = gimp -- "$@" #------------------------------------------- # Documents #------------------------------------------- -ext pdf, has llpp, X, flag f = llpp "$@" ext pdf, has zathura, X, flag f = zathura -- "$@" -ext pdf, has mupdf, X, flag f = mupdf -- "$@" -ext pdf, has apvlv, X, flag f = apvlv -- "$@" -ext pdf, has xpdf, X, flag f = xpdf -- "$@" -ext pdf, has evince, X, flag f = evince -- "$@" ext pdf, has okular, X, flag f = okular -- "$@" -ext pdf, has epdfview, X, flag f = epdfview -- "$@" ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER" -ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@" -ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@" -ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" -ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@" -ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" +ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@" ext djvu, has evince, X, flag f = evince -- "$@" +#------------------------------------------- +# Image Viewing: +#------------------------------------------- +mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@" + +mime ^image, has feh, X, flag f = feh -- "$@" +mime ^image, has gimp, X, flag f = gimp -- "$@" +ext xcf, X, flag f = gimp -- "$@" + #------------------------------------------- # Archives #------------------------------------------- @@ -161,12 +141,15 @@ ext tar|gz, has tar = tar vvxf "$@" #------------------------------------------- # Misc #------------------------------------------- -label wallpaper, number 11, mime ^image, X = feh --bg-scale "$1" -label wallpaper, number 12, mime ^image, X = feh --bg-tile "$1" -label wallpaper, number 13, mime ^image, X = feh --bg-center "$1" -label wallpaper, number 14, mime ^image, X = feh --bg-fill "$1" +label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1" +label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1" +label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1" +label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1" # Define the editor for non-text files + pager as last action - !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = ask -label editor, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$EDITOR" -- "$@" -label pager, !mime ^text, !ext xml|csv|tex|py|pl|rb|sh|php = "$PAGER" -- "$@" + !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask +label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@" +label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" + +# The very last action, so that it's never triggered accidentally, is to execute a program: +mime application/x-executable = "$1" diff --git a/ranger/scope.sh b/ranger/scope.sh index 0d7e0df..44fcec2 100755 --- a/ranger/scope.sh +++ b/ranger/scope.sh @@ -16,31 +16,52 @@ # 3 | fix width | success. Don't reload when width changes # 4 | fix height | success. Don't reload when height changes # 5 | fix both | success. Don't ever reload +# 6 | image | success. display the image $cached points to as an image preview +# 7 | image | success. display the file directly as an image # Meaningful aliases for arguments: -path="$1" # Full path of the selected file -width="$2" # Width of the preview pane (number of fitting characters) -height="$3" # Height of the preview pane (number of fitting characters) +path="$1" # Full path of the selected file +width="$2" # Width of the preview pane (number of fitting characters) +height="$3" # Height of the preview pane (number of fitting characters) +cached="$4" # Path that should be used to cache image previews +preview_images="$5" # "True" if image previews are enabled, "False" otherwise. maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln # Find out something about the file: mimetype=$(file --mime-type -Lb "$path") -extension=${path##*.} +extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}') # Functions: # runs a command and saves its output into $output. Useful if you need # the return value AND want to use the output in a pipe try() { output=$(eval '"$@"'); } -# writes the output of the previouosly used "try" command -dump() { echo "$output"; } +# writes the output of the previously used "try" command +dump() { /bin/echo "$output"; } # a common post-processing function used after most commands trim() { head -n "$maxln"; } # wraps highlight to treat exit code 141 (killed by SIGPIPE) as success -highlight() { command highlight "$@"; test $? = 0 -o $? = 141; } +safepipe() { "$@"; test $? = 0 -o $? = 141; } + +# Image previews, if enabled in ranger. +if [ "$preview_images" = "True" ]; then + case "$mimetype" in + # Image previews for SVG files, disabled by default. + ###image/svg+xml) + ### convert "$path" "$cached" && exit 6 || exit 1;; + # Image previews for image files. w3mimgdisplay will be called for all + # image files (unless overriden as above), but might fail for + # unsupported types. + image/*) + exit 7;; + # Image preview for video, disabled by default.: + ###video/*) + ### ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;; + esac +fi case "$extension" in # Archive extensions: @@ -59,6 +80,9 @@ case "$extension" in # BitTorrent Files torrent) try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; + # ODT Files + odt|ods|odp|sxw) + try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; # HTML Pages: htm|html|xhtml) try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } @@ -70,10 +94,19 @@ esac case "$mimetype" in # Syntax highlight for text files: text/* | */xml) - try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;; + if [ "$(tput colors)" -ge 256 ]; then + pygmentize_format=terminal256 + highlight_format=xterm256 + else + pygmentize_format=terminal + highlight_format=ansi + fi + try safepipe highlight --out-format=${highlight_format} "$path" && { dump | trim; exit 5; } + try safepipe pygmentize -f ${pygmentize_format} "$path" && { dump | trim; exit 5; } + exit 2;; # Ascii-previews of images: - #image/*) - # img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; + image/*) + img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; # Display information about media files: video/* | audio/*) exiftool "$path" && exit 5 diff --git a/systemd/user/dirmngr.socket.d/override.conf b/systemd/user/dirmngr.socket.d/override.conf new file mode 100644 index 0000000..12835e0 --- /dev/null +++ b/systemd/user/dirmngr.socket.d/override.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=%h/.config/gnupg/S.dirmngr diff --git a/systemd/user/gpg-agent-browser.socket.d/override.conf b/systemd/user/gpg-agent-browser.socket.d/override.conf new file mode 100644 index 0000000..ca05f47 --- /dev/null +++ b/systemd/user/gpg-agent-browser.socket.d/override.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=%h/.config/gnupg/S.gpg-agent.browser diff --git a/systemd/user/gpg-agent-extra.socket.d/override.conf b/systemd/user/gpg-agent-extra.socket.d/override.conf new file mode 100644 index 0000000..159db13 --- /dev/null +++ b/systemd/user/gpg-agent-extra.socket.d/override.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=%h/.config/gnupg/S.gpg-agent.extra diff --git a/systemd/user/gpg-agent-ssh.socket.d/override.conf b/systemd/user/gpg-agent-ssh.socket.d/override.conf new file mode 100644 index 0000000..33ad172 --- /dev/null +++ b/systemd/user/gpg-agent-ssh.socket.d/override.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=%h/.config/gnupg/S.gpg-agent.ssh diff --git a/systemd/user/gpg-agent.socket.d/override.conf b/systemd/user/gpg-agent.socket.d/override.conf new file mode 100644 index 0000000..2d27428 --- /dev/null +++ b/systemd/user/gpg-agent.socket.d/override.conf @@ -0,0 +1,3 @@ +[Socket] +ListenStream= +ListenStream=%h/.config/gnupg/S.gpg-agent diff --git a/systemd/user/ssh-agent.service b/systemd/user/ssh-agent.service index 8a1d157..df24fe9 100644 --- a/systemd/user/ssh-agent.service +++ b/systemd/user/ssh-agent.service @@ -4,7 +4,7 @@ Description=SSH key agent [Service] Type=forking PassEnvironment=SSH_AUTH_SOCK -ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK +ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK -t 1h [Install] WantedBy=default.target diff --git a/tmux.conf b/tmux.conf index 000fb30..cc1ad44 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,7 +1,5 @@ set -g default-terminal "screen-256color" -set -g utf8 on set -g set-titles on -set -g mouse-utf8 on set -g mode-keys vi diff --git a/urxvt/autocomplete-ALL-the-things b/urxvt/autocomplete-ALL-the-things new file mode 160000 index 0000000..5f9e3d9 --- /dev/null +++ b/urxvt/autocomplete-ALL-the-things @@ -0,0 +1 @@ +Subproject commit 5f9e3d9e997c39dbda9c37080ab596733ee52623 diff --git a/urxvt/perls b/urxvt/perls new file mode 160000 index 0000000..e7bd5d2 --- /dev/null +++ b/urxvt/perls @@ -0,0 +1 @@ +Subproject commit e7bd5d2b94d9f4032e058d8a0b8ee3fe8a985b50 diff --git a/vim/after/plugin/togglelist.vim b/vim/after/plugin/togglelist.vim index 8eb7b2b..dbb06f1 100644 --- a/vim/after/plugin/togglelist.vim +++ b/vim/after/plugin/togglelist.vim @@ -59,9 +59,10 @@ function! s:ToggleUnite() UniteResume endfunction -nmap [oq :copen -nmap ]oq :cclose -nmap coq :call ToggleQuickfixList() -nmap [ol :lopen -nmap ]ol :lclose -nmap col :call ToggleLocationList() +nnoremap [oq :copen +nnoremap ]oq :cclose +nnoremap coq :call ToggleQuickfixList() +nnoremap [ol :lopen +nnoremap ]ol :lclose +nnoremap col :call ToggleLocationList() +nnoremap cop :pclose diff --git a/vim/filetype.vim b/vim/filetype.vim index 47117e7..e310fd8 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -5,6 +5,7 @@ endif augroup filetypedetect autocmd! BufNewFile,BufRead PKGBUILD setfiletype PKGBUILD autocmd! BufRead,BufNewFile *.pro,*.pri setfiletype qmake + autocmd! BufNewFile,BufRead *.qml setfiletype qml.javascript augroup END augroup ft_ros diff --git a/vim/ftdetect/fstab.vim b/vim/ftdetect/fstab.vim new file mode 100644 index 0000000..09c8cff --- /dev/null +++ b/vim/ftdetect/fstab.vim @@ -0,0 +1,2 @@ +" vim:set ft=vim: +au BufRead,BufNewFile fstab* set filetype=fstab diff --git a/vim/ftplugin/cpp.vim b/vim/ftplugin/cpp.vim index 23503b8..faa7395 100644 --- a/vim/ftplugin/cpp.vim +++ b/vim/ftplugin/cpp.vim @@ -17,7 +17,7 @@ let b:load_doxygen_syntax = 1 augroup fswitch au BufEnter *.h let b:fswitchdst = 'cpp,c' au BufEnter *.h let b:fswitchlocs = 'reg:|include.*|source|' - au BufEnter *.cpp let b:fswitchdst = 'h' + au BufEnter *.cpp let b:fswitchdst = 'hpp,h' au BufEnter *.cpp let b:fswitchlocs = 'reg:|source|include/**|' augroup END diff --git a/vim/ftplugin/vimwiki.vim b/vim/ftplugin/vimwiki.vim new file mode 100644 index 0000000..0b80e85 --- /dev/null +++ b/vim/ftplugin/vimwiki.vim @@ -0,0 +1,2 @@ +setlocal textwidth=80 +setlocal formatoptions+=awt " auto-format diff --git a/vim/ultisnips/cmake.snippets b/vim/ultisnips/cmake.snippets index afdbef6..1a2db7a 100644 --- a/vim/ultisnips/cmake.snippets +++ b/vim/ultisnips/cmake.snippets @@ -1,23 +1,18 @@ snippet cmake "CMakeFiles Stub" b -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.5) project(${1:ProjectName}) -find_package(${2:LIBRARY}) +# find_package(Boost REQUIRED) -include_directories( - ${$2_INCLUDE_DIR} +add_executable(\${PROJECT_NAME} + ${1:main.cpp} ) -add_subdirectory(${0:src}) - -add_executable($1) -set_target_properties($1 - PROPERTIES CXX_STANDARD 11 +set_target_properties(\${PROJECT_NAME} + PROPERTIES CXX_STANDARD 14 ) - -target_link_libraries($1 - ${$2_LIBRARIES} +target_link_libraries(\${PROJECT_NAME} ) endsnippet @@ -30,13 +25,7 @@ set(qt5_modules ) foreach(qt5_module ${qt5_modules}) - find_package(${qt5_module} QUIET) - if(${qt5_module}_FOUND) - - else(${qt5_module}_FOUND) - message(FATAL_ERROR "Qt5 module '${qt5_module}' not found") - endif() - endif() + find_package(${qt5_module} REQUIRED) endforeach() endsnippet @@ -48,8 +37,6 @@ endsnippet snippet find find_package(${0:LIBRARY}) -include_dir($0_INCLUDE_DIRS) -link_directories($0_LIBRARY_DIRS) endsnippet snippet glob @@ -61,13 +48,13 @@ add_subdirectory(${0:src}) endsnippet snippet lib -add_library(${1:lib} ${2:STATIC} +add_library(${1:lib} ${${0:SRCS}} ) endsnippet snippet link -target_link_libraries(${1:bin} +target_link_libraries(\${PROJECT_NAME} ${0:somelib} ) endsnippet @@ -87,8 +74,7 @@ add_dependencies(${1:target} endsnippet snippet props -set_target_properties(${1:target} - ${2:PROPERTIES} ${3:COMPILE_FLAGS} - ${0:"-O3 -Wall -pedantic"} +set_target_properties(${1:target} ${2:PROPERTIES} + ${3:COMPILE_FLAGS} ${0:"-O3 -Wall -pedantic"} ) endsnippet diff --git a/vim/vimrc b/vim/vimrc index 1674f0f..8409f10 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -74,6 +74,8 @@ Plugin 'sgeb/vim-diff-fold' " needs editing colorscheme " Plugin 'jeaye/color_coded' " Check LucHermites plugins: https://github.com/LucHermitte/lh-cpp +Plugin 'wincent/loupe' +Plugin 'Ram-Z/vimwiki' call vundle#end() @@ -158,10 +160,18 @@ set mouse=rnv " list of flags for using the mouse set ttymouse=xterm " type of mouse " messages and info {{{2 -set showcmd " Show (partial) command in status line. -set ruler " show the cursor position all the time -set confirm " Ask what to do when closing unsaved documents -set shortmess=filnxtoOI " don't show intro message +set showcmd " Show (partial) command in status line. +set ruler " show the cursor position all the time +set confirm " Ask what to do when closing unsaved documents +set shortmess= " reset option +set shortmess+=a " all abbreviations +set shortmess+=o " overwrite file-written message +set shortmess+=O " file-read message overrides previous +set shortmess+=t " truncate file message at start +set shortmess+=T " truncate other messages in the middle +set shortmess+=W " don't give 'written' or '[w]' when writing a file +set shortmess+=A " ignore swapfile warning +set shortmess+=I " no splash screen " editing text {{{2 set backspace=indent,eol,start " allow backspacing over everything in insert mode @@ -437,9 +447,9 @@ nnoremap zx zMzxzt map :ls:b -" move between windows -nnoremap w -nnoremap W +" move between windows (skip previewwindow) +nnoremap w:if &previewwindow \| wincmd w \| endif +nnoremap W:if &previewwindow \| wincmd W \| endif "xterm mouse with middleclick paste nnoremap i @@ -649,7 +659,7 @@ let g:unite_source_grep_max_candidates = 2000 if executable('ag') " Use ag in unite grep source. let g:unite_source_grep_command = 'ag' - let g:unite_source_grep_default_opts = '--smart-case --vimgrep --hidden --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' + let g:unite_source_grep_default_opts = '--smart-case --vimgrep --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' let g:unite_source_grep_recursive_opt = '' end nnoremap [unite]a :Unite grep:.:: @@ -658,7 +668,7 @@ command! -nargs=1 Ag Unite grep:.:: " unite-file_rec {{{3 if executable('ag') " Use ag in unite rec source - let g:unite_source_rec_async_command = 'ag --follow --nocolor --nogroup --hidden -g ""' + let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '-g', ''] end nnoremap [unite]f :Unite -start-insert file_rec/async call unite#custom#source('file_rec/async', 'sorters', 'sorter_selecta') @@ -734,6 +744,15 @@ xmap T Sneak_T omap t Sneak_t omap T Sneak_T +" vimviki {{{2 +let g:vimwiki_list = [{'path': '$XDG_DATA_HOME/vimwiki'}] +let g:vimwiki_auto_chdir = 1 +augroup myvimwiki + au! BufRead $XDG_DATA_HOME/vimwiki/index.wiki !git -C "%:p:h" pull + au! BufRead,BufNewFile $XDG_DATA_HOME/vimwiki/diary/*.wiki !git -C "%:p:h" pull + au! BufWritePost $XDG_DATA_HOME/vimwiki/*.wiki exe '!git add "";git commit -m"' . strftime("%FT%R") . '";git push' +augroup END + " functions {{{1 " Convenient command to see the difference between the current buffer and the diff --git a/vim/ycm_extra_conf.py b/vim/ycm_extra_conf.py index 7a6ca96..634bcad 100644 --- a/vim/ycm_extra_conf.py +++ b/vim/ycm_extra_conf.py @@ -1,83 +1,86 @@ -import os -import shlex -import subprocess +from glob import glob +from os import path + import ycm_core -def FlagsForFile( filename, **kwargs ): - client_data = kwargs['client_data'] - cwd = client_data['getcwd()'] - # These are the compilation flags that will be used in case there's no - # compilation database set (by default, one is not set). - flags = [ - '-Wall', - # '-Wextra', - # '-Wshadow', - # '-Werror', - # '-Wc++98-compat', - # '-Wno-long-long', - # '-Wno-variadic-macros', - # '-fexceptions', - # '-DNDEBUG', - '-std=c++14', - '-stdlib=libstdc++', - '-x', 'c++', - '-I', '.', - '-I', './include', - ] - flags += rospack() - relative_to = cwd - final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) - return { - 'flags': final_flags, - 'do_cache': True - } +def findCompilationDatabaseFolder(dir='.'): + dirs = [path.dirname(f) for f in glob(dir + '/**/compile_commands.json', + recursive=True)] + return dirs + + +def generateQtFlags(): + flags = [] + for p in glob('/usr/include/qt/*/'): + flags += ['-isystem', p] + return flags -# This function makes it easy to pull in additional flags from rospack -def rospack(): - cmd = ['rospack', 'cflags-only-I'] - try: - out = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE).stdout - except: - return [] - line = out.readline()[:-1].split(" ") - includes = [] - for include in line: - if include.startswith(os.path.expanduser('~')): - includes += ['-I', include] - else: - includes += ['-isystem', include] - return filter(lambda a: a != ' ', includes) +def isHeader(filename): + ext = path.splitext(filename)[1] + return ext in ['.hpp', '.h'] -def DirectoryOfThisScript(): - return os.path.dirname( os.path.abspath( __file__ ) ) -def MakeRelativePathsInFlagsAbsolute( flags, working_directory ): - if not working_directory: - return list( flags ) - new_flags = [] - make_next_absolute = False - path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ] - for flag in flags: - new_flag = flag +def GetCompilationInfoForFile(database, filename): + if isHeader(filename): + basename = path.splitext(filename)[0] + for ext in ['.cpp', '.c']: + cpp_file = basename + ext + if path.exists(cpp_file): + compilation_info = database.GetCompilationInfoForFile( + cpp_file) + if compilation_info.compiler_flags_: + return compilation_info + return None + return database.GetCompilationInfoForFile(filename) - if make_next_absolute: - make_next_absolute = False - if not flag.startswith( '/' ): - new_flag = os.path.join( working_directory, flag ) - for path_flag in path_flags: - if flag == path_flag: - make_next_absolute = True - break +def FlagsForFile(filename, **kwargs): + client_data = kwargs['client_data'] + cwd = client_data['getcwd()'] - if flag.startswith( path_flag ): - path = flag[ len( path_flag ): ] - new_flag = path_flag + os.path.join( working_directory, path ) - break + extra_flags = [ + '-Wall', + '-Wextra', + # '-Wshadow', + # '-Werror', + # '-Wc++98-compat', + # '-Wno-long-long', + # '-Wno-variadic-macros', + # '-fexceptions', + # '-DNDEBUG', + ] - if new_flag: - new_flags.append( new_flag ) - return new_flags + folders = findCompilationDatabaseFolder(cwd) + if not folders: + folder = None + else: + folder = folders[0] + if len(folders) > 1: + print("Multiple compilation databases found!") + print(folders) + print("Selecting first: %s" % (folder)) + + if folder: + database = ycm_core.CompilationDatabase(folder) + compilation_info = GetCompilationInfoForFile(database, filename) + if not compilation_info: + return None + flags = list(compilation_info.compiler_flags_) + else: + flags = [ + '-std=c++14', + '-stdlib=libstdc++', + '-x', 'c++', + '-isystem', '/usr/include', + '-isystem', '/usr/local/include', + '-I', cwd, + '-I', cwd + '/include', + ] + flags += generateQtFlags() + return { + 'flags': flags + extra_flags, + 'do_cache': True + } diff --git a/wakeonlan/shada b/wakeonlan/hactar similarity index 100% rename from wakeonlan/shada rename to wakeonlan/hactar diff --git a/weechat/.gitignore b/weechat/.gitignore index 3cc03c5..452349d 100644 --- a/weechat/.gitignore +++ b/weechat/.gitignore @@ -2,3 +2,5 @@ logs weechat.log script/plugins.xml.gz irc.conf +slack.cache +autoload/ diff --git a/weechat/alias.conf b/weechat/alias.conf index d2cabe4..d0687c2 100644 --- a/weechat/alias.conf +++ b/weechat/alias.conf @@ -1,6 +1,13 @@ # # weechat -- alias.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [cmd] AAWAY = "allserv /away" diff --git a/weechat/aspell.conf b/weechat/aspell.conf index c3d12dc..5b2a417 100644 --- a/weechat/aspell.conf +++ b/weechat/aspell.conf @@ -1,6 +1,13 @@ # # weechat -- aspell.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [color] misspelled = lightred diff --git a/weechat/buffer_autoset.conf b/weechat/buffer_autoset.conf index 7b43f8f..519613c 100644 --- a/weechat/buffer_autoset.conf +++ b/weechat/buffer_autoset.conf @@ -1,6 +1,17 @@ # # weechat -- buffer_autoset.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# + +[look] +instant = on +timer = 1 [buffer] perl.highmon.number = "100" diff --git a/weechat/buffers.conf b/weechat/buffers.conf index f2a5b5e..2dd82b8 100644 --- a/weechat/buffers.conf +++ b/weechat/buffers.conf @@ -1,6 +1,13 @@ # # weechat -- buffers.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [color] current_bg = 31 @@ -42,6 +49,7 @@ whitelist_private_fg = default core_to_front = off detach = 0 detach_buffer_immediately = "highmon" +detach_buffer_immediately_level = 2 detach_display_window_number = off detach_displayed_buffers = on detach_free_content = off @@ -50,6 +58,7 @@ hide_merged_buffers = server hotlist_counter = on immune_detach_buffers = "" indenting = off +indenting_amount = 2 indenting_number = on jump_prev_next_visited_buffer = off mark_inactive = off diff --git a/weechat/charset.conf b/weechat/charset.conf index 99a90d5..00d304c 100644 --- a/weechat/charset.conf +++ b/weechat/charset.conf @@ -1,6 +1,13 @@ # # weechat -- charset.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [default] decode = "iso-8859-1" diff --git a/weechat/exec.conf b/weechat/exec.conf index 39f1929..519ccc1 100644 --- a/weechat/exec.conf +++ b/weechat/exec.conf @@ -1,6 +1,13 @@ # # weechat -- exec.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [command] default_options = "" diff --git a/weechat/iset.conf b/weechat/iset.conf index cafe04f..35e1653 100644 --- a/weechat/iset.conf +++ b/weechat/iset.conf @@ -1,6 +1,13 @@ # # weechat -- iset.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [color] bg_selected = red diff --git a/weechat/logger.conf b/weechat/logger.conf index 0b8b96b..9701311 100644 --- a/weechat/logger.conf +++ b/weechat/logger.conf @@ -1,6 +1,13 @@ # # weechat -- logger.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [look] backlog = 20 diff --git a/weechat/lua/matrix b/weechat/lua/matrix new file mode 160000 index 0000000..bdaf2d4 --- /dev/null +++ b/weechat/lua/matrix @@ -0,0 +1 @@ +Subproject commit bdaf2d4886c1da68bb134ece7bbd506cfec51637 diff --git a/weechat/perl/autoload/beep.pl b/weechat/perl/autoload/beep.pl deleted file mode 120000 index 0cc452e..0000000 --- a/weechat/perl/autoload/beep.pl +++ /dev/null @@ -1 +0,0 @@ -../beep.pl \ No newline at end of file diff --git a/weechat/perl/autoload/buffers.pl b/weechat/perl/autoload/buffers.pl deleted file mode 120000 index 445dc3c..0000000 --- a/weechat/perl/autoload/buffers.pl +++ /dev/null @@ -1 +0,0 @@ -../buffers.pl \ No newline at end of file diff --git a/weechat/perl/autoload/highmon.pl b/weechat/perl/autoload/highmon.pl deleted file mode 120000 index 2eb5e1e..0000000 --- a/weechat/perl/autoload/highmon.pl +++ /dev/null @@ -1 +0,0 @@ -../highmon.pl \ No newline at end of file diff --git a/weechat/perl/autoload/iset.pl b/weechat/perl/autoload/iset.pl deleted file mode 120000 index 2746e0d..0000000 --- a/weechat/perl/autoload/iset.pl +++ /dev/null @@ -1 +0,0 @@ -../iset.pl \ No newline at end of file diff --git a/weechat/perl/buffers.pl b/weechat/perl/buffers.pl index 472f6e9..73eb4b5 100644 --- a/weechat/perl/buffers.pl +++ b/weechat/perl/buffers.pl @@ -20,6 +20,14 @@ # # History: # +# 2016-05-01, mumixam : +# v5.4: added option "detach_buffer_immediately_level" +# 2015-08-21, Matthew Cox +# v5.3: add option "indenting_amount", to adjust the indenting of channel buffers +# 2015-05-02, arza : +# v5.2: truncate long names (name_size_max) more when mark_inactive adds parenthesis +# 2015-03-29, Ed Santiago : +# v5.1: merged buffers: always indent, except when filling is horizontal # 2014-12-12 # v5.0: fix cropping non-latin buffer names # 2014-08-29, Patrick Steinhardt : @@ -164,13 +172,15 @@ use strict; use Encode qw( decode encode ); # -----------------------------[ internal ]------------------------------------- my $SCRIPT_NAME = "buffers"; -my $SCRIPT_VERSION = "5.0"; +my $SCRIPT_VERSION = "5.4"; my $BUFFERS_CONFIG_FILE_NAME = "buffers"; my $buffers_config_file; my $cmd_buffers_whitelist= "buffers_whitelist"; my $cmd_buffers_detach = "buffers_detach"; +my $maxlength; + my %mouse_keys = ("\@item(buffers):button1*" => "hsignal:buffers_mouse", "\@item(buffers):button2*" => "hsignal:buffers_mouse", "\@bar(buffers):ctrl-wheelup" => "hsignal:buffers_mouse", @@ -675,6 +685,13 @@ my %default_options_look = "", 0, 0, "on", "on", 0, "", "", "buffers_signal_config", "", "", "" ], + "indenting_amount" => [ + "indenting_amount", "integer", + "amount of indenting to use. This option only takes effect if bar ". + "is left/right positioned, and indenting is enabled", + "", 0, 16, 2, 2, 0, + "", "", "buffers_signal_config", "", "", "" + ], "short_names" => [ "short_names", "boolean", "display short names (remove text before first \".\" in buffer name)", @@ -778,12 +795,24 @@ my %default_options_look = ], "detach_buffer_immediately" => [ "detach_buffer_immediately", "string", - "comma separated list of buffers to detach immediately. A query and ". - "highlight message will attach buffer again. Allows \"*\" wildcard. ". + "comma separated list of buffers to detach immediately. Buffers ". + "will attach again based on notify level set in ". + "\"detach_buffer_immediately_level\". Allows \"*\" wildcard. ". "Ex: \"BitlBee,freenode.*\"", "", 0, 0, "", "", 0, "", "", "buffers_signal_config_detach_buffer_immediately", "", "", "" ], + "detach_buffer_immediately_level" => [ + "detach_buffer_immediately_level", "integer", + "The value determines what notify level messages are reattached from activity. ". + " This option works in conjunction with \"detach_buffer_immediately\" ". + "0: low priority (like join/part messages), ". + "1: message, ". + "2: private, ". + "3: highlight", + "", 0, 3, 2, 2, 0, + "", "", "buffers_signal_config", "", "", "" + ], "detach_free_content" => [ "detach_free_content", "boolean", "buffers with free content will be detached (Ex: iset, chanmon)", @@ -992,11 +1021,11 @@ sub build_buffers weechat::infolist_free($infolist_channel); } - my $result = check_immune_detached_buffers($buffer->{"name"}); # checking for wildcard - + my $result = check_immune_detached_buffers($buffer->{"name"}); # checking for wildcard + my $maxlevel = weechat::config_integer($options{"detach_buffer_immediately_level"}); next if ( check_detach_buffer_immediately($buffer->{"name"}) eq 1 and $buffer->{"current_buffer"} eq 0 - and ( not exists $hotlist{$buffer->{"pointer"}} or $hotlist{$buffer->{"pointer"}} < 2) ); # checking for buffer to immediately detach + and ( not exists $hotlist{$buffer->{"pointer"}} or $hotlist{$buffer->{"pointer"}} < $maxlevel) ); # checking for buffer to immediately detach unless ($result) { @@ -1116,8 +1145,14 @@ sub build_buffers $name = $buffer->{"name"}; } } - if (weechat::config_integer($options{"name_size_max"}) >= 1){ - $name = encode("UTF-8", substr(decode("UTF-8", $name), 0, weechat::config_integer($options{"name_size_max"}))); + if (weechat::config_integer($options{"name_size_max"}) >= 1) + { + $maxlength = weechat::config_integer($options{"name_size_max"}); + if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0) + { + $maxlength -= 2; + } + $name = encode("UTF-8", substr(decode("UTF-8", $name), 0, $maxlength)); } if ( weechat::config_boolean($options{"core_to_front"}) eq 1) { @@ -1298,8 +1333,17 @@ sub build_buffers } else { - my $indent = ""; - $indent = ((" " x length($buffer->{"number"}))." ") if (($position eq "left") || ($position eq "right")); + # Indentation aligns channels in a visually appealing way + # when viewing list top-to-bottom... + my $indent = (" " x length($buffer->{"number"}))." "; + # ...except when list is top/bottom and channels left-to-right. + my $option_pos = weechat::config_string( weechat::config_get( "weechat.bar.buffers.position" ) ); + if (($option_pos eq 'top') || ($option_pos eq 'bottom')) { + my $option_filling = weechat::config_string( weechat::config_get( "weechat.bar.buffers.filling_top_bottom" ) ); + if ($option_filling =~ /horizontal/) { + $indent = ''; + } + } $str .= weechat::color("default") .$color_bg .$indent; @@ -1314,16 +1358,17 @@ sub build_buffers { if ( weechat::config_integer( $options{"indenting"} ) eq 1 ) { - $str .= " "; + $str .= (" " x weechat::config_integer( $options{"indenting_amount"} ) ); } elsif ( (weechat::config_integer($options{"indenting"}) eq 2) and (weechat::config_integer($options{"indenting_number"}) eq 0) ) #under_name { if ( weechat::config_boolean( $options{"show_number"} ) eq 0 ) { - $str .= " "; - }else + $str .= (" " x weechat::config_integer( $options{"indenting_amount"} ) ); + } + else { - $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) ))." " ); + $str .= ( (" " x ( $max_number_digits - length($buffer->{"number"}) )).(" " x weechat::config_integer( $options{"indenting_amount"} ) ) ); } } } @@ -1389,7 +1434,14 @@ sub build_buffers if (weechat::config_integer($options{"name_size_max"}) >= 1) # check max_size of buffer name { $name = decode("UTF-8", $name); - $str .= encode("UTF-8", substr($name, 0, weechat::config_integer($options{"name_size_max"}))); + + $maxlength = weechat::config_integer($options{"name_size_max"}); + if($buffer->{"type"} eq "channel" and weechat::config_boolean( $options{"mark_inactive"} ) eq 1 and $buffer->{"nicks_count"} == 0) + { + $maxlength -= 2; + } + + $str .= encode("UTF-8", substr($name, 0, $maxlength)); $str .= weechat::color(weechat::config_color( $options{"color_number_char"})).weechat::config_string($options{"name_crop_suffix"}) if (length($name) > weechat::config_integer($options{"name_size_max"})); $str .= add_inactive_parentless($buffer->{"type"}, $buffer->{"nicks_count"}); $str .= add_hotlist_count($buffer->{"pointer"}, %hotlist); diff --git a/weechat/perl/iset.pl b/weechat/perl/iset.pl index f179022..163dfb5 100644 --- a/weechat/perl/iset.pl +++ b/weechat/perl/iset.pl @@ -1,6 +1,6 @@ # # Copyright (C) 2008-2014 Sebastien Helleu -# Copyright (C) 2010-2014 Nils Görs +# Copyright (C) 2010-2015 Nils Görs # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,19 @@ # # History: # +# 2016-07-08, nils_2 +# version 4.2: add diff function +# 2016-02-06, Sebastien Helleu : +# version 4.1: remove debug print +# 2015-12-24, Sebastien Helleu : +# version 4.0: add support of parent options (inherited values in irc servers) +# with WeeChat >= 1.4 +# 2015-05-16, Sebastien Helleu : +# version 3.9: fix cursor position when editing an option with WeeChat >= 1.2 +# 2015-05-02, arza : +# version 3.8: don't append "null" to /set when setting an undefined setting +# 2015-05-01, nils_2 : +# version 3.7: fix two perl warnings (reported by t3chguy) # 2014-09-30, arza : # version 3.6: fix current line counter when options aren't found # 2014-06-03, nils_2 : @@ -117,7 +130,7 @@ use strict; my $PRGNAME = "iset"; -my $VERSION = "3.6"; +my $VERSION = "4.2"; my $DESCR = "Interactive Set for configuration options"; my $AUTHOR = "Sebastien Helleu "; my $LICENSE = "GPL3"; @@ -129,9 +142,11 @@ my $iset_buffer = ""; my $wee_version_number = 0; my @iset_focus = (); my @options_names = (); +my @options_parent_names = (); my @options_types = (); my @options_values = (); my @options_default_values = (); +my @options_parent_values = (); my @options_is_null = (); my $option_max_length = 0; my $current_line = 0; @@ -139,7 +154,7 @@ my $filter = "*"; my $description = ""; my $options_name_copy = ""; my $iset_filter_title = ""; -# search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value +# search modes: 0 = index() on value, 1 = grep() on value, 2 = grep() on option, 3 = grep on option & value, 4 = diff all, 5 = diff parts my $search_mode = 2; my $search_value = ""; my $help_text_keys = "alt + space: toggle, +/-: increase/decrease, enter: change, ir: reset, iu: unset, v: toggle help bar"; @@ -189,6 +204,12 @@ sub iset_title $filter = "*" if ($filter eq ""); $show_filter = $filter; } + elsif ($search_mode == 4 or $search_mode == 5) + { + $iset_filter_title = "diff: "; + $show_filter = "all"; + $show_filter = $search_value if $search_mode == 5; + } elsif ($search_mode eq 3) { $iset_filter_title = "(option) "; @@ -237,6 +258,10 @@ sub iset_create_filter sub iset_buffer_input { my ($data, $buffer, $string) = ($_[0], $_[1], $_[2]); + + # string begins with space? + return weechat::WEECHAT_RC_OK if (substr($string, 0, 1 ) eq " "); + if ($string eq "q") { weechat::buffer_close($buffer); @@ -257,10 +282,27 @@ sub iset_buffer_input weechat::buffer_set($iset_buffer, "localvar_set_iset_search_value", $search_value); } } + # show all diff values + elsif ($string eq "d") + { + $search_mode = 4; +# iset_title(); + iset_create_filter("*"); + iset_get_options("*"); + } + elsif ( $array_count >= 2 and $cmd_array[0] eq "d") + { + $search_mode = 5; + $search_value = substr($cmd_array[1], 0); # cut value_search_char + $search_value = substr($cmd_array[2], 0) if ( $array_count > 2); # cut value_search_char + iset_create_filter($search_value); + iset_get_options($search_value); + + } else { $search_mode = 2; - if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s") + if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s" ) { if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) ) @@ -274,7 +316,8 @@ sub iset_buffer_input { iset_create_filter($string); iset_get_options($search_value); - }else + } + else { iset_create_filter($string); iset_get_options(""); @@ -343,9 +386,11 @@ sub iset_get_options $search_value = $var_value; @iset_focus = (); @options_names = (); + @options_parent_names = (); @options_types = (); @options_values = (); @options_default_values = (); + @options_parent_values = (); @options_is_null = (); $option_max_length = 0; my %options_internal = (); @@ -361,34 +406,61 @@ sub iset_get_options { $key = sprintf("%08d", $i); my $name = weechat::infolist_string($infolist, "full_name"); + my $parent_name = weechat::infolist_string($infolist, "parent_name"); next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1); my $type = weechat::infolist_string($infolist, "type"); my $value = weechat::infolist_string($infolist, "value"); my $default_value = weechat::infolist_string($infolist, "default_value"); + my $parent_value; + if ($parent_name && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value")))) + { + $parent_value = weechat::infolist_string($infolist, "parent_value"); + } my $is_null = weechat::infolist_integer($infolist, "value_is_null"); + if ($search_mode == 3) { my $value = weechat::infolist_string($infolist, "value"); if ( grep /\Q$var_value/,lc($value) ) { + $options_internal{$name}{"parent_name"} = $parent_name; $options_internal{$name}{"type"} = $type; $options_internal{$name}{"value"} = $value; $options_internal{$name}{"default_value"} = $default_value; + $options_internal{$name}{"parent_value"} = $parent_value; $options_internal{$name}{"is_null"} = $is_null; $option_max_length = length($name) if (length($name) > $option_max_length); - $iset_struct{$key} = $options_internal{$name}; - push(@iset_focus, $iset_struct{$key}); + $iset_struct{$key} = $options_internal{$name}; + push(@iset_focus, $iset_struct{$key}); + } + } + # search for diff? + elsif ( $search_mode == 4 or $search_mode == 5) + { + if ($value ne $default_value ) + { + $options_internal{$name}{"parent_name"} = $parent_name; + $options_internal{$name}{"type"} = $type; + $options_internal{$name}{"value"} = $value; + $options_internal{$name}{"default_value"} = $default_value; + $options_internal{$name}{"parent_value"} = $parent_value; + $options_internal{$name}{"is_null"} = $is_null; + $option_max_length = length($name) if (length($name) > $option_max_length); + $iset_struct{$key} = $options_internal{$name}; + push(@iset_focus, $iset_struct{$key}); } } else { + $options_internal{$name}{"parent_name"} = $parent_name; $options_internal{$name}{"type"} = $type; $options_internal{$name}{"value"} = $value; $options_internal{$name}{"default_value"} = $default_value; + $options_internal{$name}{"parent_value"} = $parent_value; $options_internal{$name}{"is_null"} = $is_null; $option_max_length = length($name) if (length($name) > $option_max_length); - $iset_struct{$key} = $options_internal{$name}; - push(@iset_focus, $iset_struct{$key}); + $iset_struct{$key} = $options_internal{$name}; + push(@iset_focus, $iset_struct{$key}); } $i++; } @@ -397,9 +469,11 @@ sub iset_get_options foreach my $name (sort keys %options_internal) { push(@options_names, $name); + push(@options_parent_names, $options_internal{$name}{"parent_name"}); push(@options_types, $options_internal{$name}{"type"}); push(@options_values, $options_internal{$name}{"value"}); push(@options_default_values, $options_internal{$name}{"default_value"}); + push(@options_parent_values, $options_internal{$name}{"parent_value"}); push(@options_is_null, $options_internal{$name}{"is_null"}); } } @@ -422,9 +496,11 @@ sub iset_search_values { my ($var_value,$search_mode) = ($_[0],$_[1]); @options_names = (); + @options_parent_names = (); @options_types = (); @options_values = (); @options_default_values = (); + @options_parent_values = (); @options_is_null = (); $option_max_length = 0; my %options_internal = (); @@ -433,18 +509,26 @@ sub iset_search_values while (weechat::infolist_next($infolist)) { my $name = weechat::infolist_string($infolist, "full_name"); + my $parent_name = weechat::infolist_string($infolist, "parent_name"); next if (weechat::config_boolean($options_iset{"show_plugin_description"}) == 0 and index ($name, "plugins.desc.") != -1); my $type = weechat::infolist_string($infolist, "type"); my $is_null = weechat::infolist_integer($infolist, "value_is_null"); my $value = weechat::infolist_string($infolist, "value"); my $default_value = weechat::infolist_string($infolist, "default_value"); + my $parent_value; + if ($parent_name && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value")))) + { + $parent_value = weechat::infolist_string($infolist, "parent_value"); + } if ($search_mode) { if ( grep /\Q$var_value/,lc($value) ) { + $options_internal{$name}{"parent_name"} = $parent_name; $options_internal{$name}{"type"} = $type; $options_internal{$name}{"value"} = $value; $options_internal{$name}{"default_value"} = $default_value; + $options_internal{$name}{"parent_value"} = $parent_value; $options_internal{$name}{"is_null"} = $is_null; $option_max_length = length($name) if (length($name) > $option_max_length); } @@ -454,9 +538,11 @@ sub iset_search_values # if ($value =~ /\Q$var_value/si) if (lc($value) eq $var_value) { + $options_internal{$name}{"parent_name"} = $parent_name; $options_internal{$name}{"type"} = $type; $options_internal{$name}{"value"} = $value; $options_internal{$name}{"default_value"} = $default_value; + $options_internal{$name}{"parent_value"} = $parent_value; $options_internal{$name}{"is_null"} = $is_null; $option_max_length = length($name) if (length($name) > $option_max_length); } @@ -467,9 +553,11 @@ sub iset_search_values foreach my $name (sort keys %options_internal) { push(@options_names, $name); + push(@options_parent_names, $options_internal{$name}{"parent_name"}); push(@options_types, $options_internal{$name}{"type"}); push(@options_values, $options_internal{$name}{"value"}); push(@options_default_values, $options_internal{$name}{"default_value"}); + push(@options_parent_values, $options_internal{$name}{"parent_value"}); push(@options_is_null, $options_internal{$name}{"is_null"}); } } @@ -498,9 +586,11 @@ sub iset_refresh_line my $color1 = weechat::color(weechat::config_color($options_iset{"color_option"})); my $color2 = weechat::color(weechat::config_color($options_iset{"color_type"})); my $color3 = ""; + my $color4 = ""; if ($options_is_null[$y]) { $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef"})); + $color4 = weechat::color(weechat::config_color($options_iset{"color_value"})); } elsif ($options_values[$y] ne $options_default_values[$y]) { @@ -517,6 +607,7 @@ sub iset_refresh_line if ($options_is_null[$y]) { $color3 = weechat::color(weechat::config_color($options_iset{"color_value_undef_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"})); + $color4 = weechat::color(weechat::config_color($options_iset{"color_value_selected"}).",".weechat::config_color($options_iset{"color_bg_selected"})); } elsif ($options_values[$y] ne $options_default_values[$y]) { @@ -528,7 +619,23 @@ sub iset_refresh_line } } my $value = $options_values[$y]; - $value = "(undef)" if ($options_is_null[$y]); + if ($options_is_null[$y]) + { + $value = "null"; + if ($options_parent_names[$y]) + { + if (defined $options_parent_values[$y]) + { + my $around_parent = ""; + $around_parent = "\"" if ($options_types[$y] eq "string"); + $value .= $color1." -> ".$color4.$around_parent.$options_parent_values[$y].$around_parent; + } + else + { + $value .= $color1." -> ".$color3."null"; + } + } + } my $strline = sprintf($format, $color1, $options_names[$y], $padding, $color2, $options_types[$y], @@ -702,6 +809,39 @@ sub iset_get_option_name_index return -1; } +sub iset_refresh_option +{ + my $option_name = $_[0]; + my $index = $_[1]; + my $infolist = weechat::infolist_get("option", "", $option_name); + if ($infolist) + { + weechat::infolist_next($infolist); + if (weechat::infolist_fields($infolist)) + { + $options_parent_names[$index] = weechat::infolist_string($infolist, "parent_name"); + $options_types[$index] = weechat::infolist_string($infolist, "type"); + $options_values[$index] = weechat::infolist_string($infolist, "value"); + $options_default_values[$index] = weechat::infolist_string($infolist, "default_value"); + $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null"); + $options_parent_values[$index] = undef; + if ($options_parent_names[$index] + && (($wee_version_number < 0x00040300) || (weechat::infolist_search_var($infolist, "parent_value")))) + { + $options_parent_values[$index] = weechat::infolist_string($infolist, "parent_value"); + } + iset_refresh_line($index); + iset_title() if ($option_name eq "iset.look.show_current_line"); + } + else + { + iset_full_refresh(1); # if not found, refresh fully without clearing buffer + weechat::print_y($iset_buffer, $#options_names + 1, ""); + } + weechat::infolist_free($infolist); + } +} + sub iset_config_cb { my ($data, $option_name, $value) = ($_[0], $_[1], $_[2]); @@ -714,25 +854,14 @@ sub iset_config_cb if ($index >= 0) { # refresh info about changed option - my $infolist = weechat::infolist_get("option", "", $option_name); - if ($infolist) + iset_refresh_option($option_name, $index); + # refresh any other option having this changed option as parent + foreach my $i (0 .. $#options_names) { - weechat::infolist_next($infolist); - if (weechat::infolist_fields($infolist)) - { - $options_types[$index] = weechat::infolist_string($infolist, "type"); - $options_values[$index] = weechat::infolist_string($infolist, "value"); - $options_default_values[$index] = weechat::infolist_string($infolist, "default_value"); - $options_is_null[$index] = weechat::infolist_integer($infolist, "value_is_null"); - iset_refresh_line($index); - iset_title() if ($option_name eq "iset.look.show_current_line"); - } - else + if ($options_parent_names[$i] eq $option_name) { - iset_full_refresh(1); # if not found, refresh fully without clearing buffer - weechat::print_y($iset_buffer, $#options_names + 1, ""); + iset_refresh_option($options_names[$i], $i); } - weechat::infolist_free($infolist); } } else @@ -807,20 +936,37 @@ sub iset_cmd_cb { # f/s option =value # option =value - $search_mode = 2; + $search_mode = 2; # grep on option if ( $array_count >= 2 and $cmd_array[0] ne "f" or $cmd_array[0] ne "s") { if ( defined $cmd_array[1] and substr($cmd_array[1], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) or defined $cmd_array[2] and substr($cmd_array[2], 0, 1) eq weechat::config_string($options_iset{"value_search_char"}) ) { - $search_mode = 3; + $search_mode = 3; # grep on option and value $search_value = substr($cmd_array[1], 1); # cut value_search_char $search_value = substr($cmd_array[2], 1) if ( $array_count > 2); # cut value_search_char } } + + # show all diff values + if ( $args eq "d") + { + $search_mode = 4; + $search_value = "*"; + $args = $search_value; + } + if ( $array_count >= 2 and $cmd_array[0] eq "d") + { + $search_mode = 5; + $search_value = substr($cmd_array[1], 0); # cut value_search_char + $search_value = substr($cmd_array[2], 0) if ( $array_count > 2); # cut value_search_char + $args = $search_value; + } + iset_create_filter($args); $filter_set = 1; my $ptrbuf = weechat::buffer_search($LANG, $PRGNAME); + if ($ptrbuf eq "") { iset_init(); @@ -976,22 +1122,34 @@ sub iset_cmd_cb my $value = $options_values[$current_line]; if ($options_is_null[$current_line]) { - $value = "null"; + $value = ""; } else { $quote = "\"" if ($options_types[$current_line] eq "string"); } + $value = " ".$quote.$value.$quote if ($value ne "" or $quote ne ""); + my $set_command = "/set"; - $set_command = "/mute " . $set_command if (weechat::config_boolean($options_iset{"use_mute"}) == 1); - - weechat::buffer_set($iset_buffer, "input", $set_command." ".$options_names[$current_line]." ".$quote.$value.$quote); - weechat::command($iset_buffer, "/input move_beginning_of_line"); - weechat::command($iset_buffer, "/input move_next_word"); - weechat::command($iset_buffer, "/input move_next_word"); - weechat::command($iset_buffer, "/input move_next_word") if (weechat::config_boolean($options_iset{"use_mute"}) == 1); - weechat::command($iset_buffer, "/input move_next_char"); - weechat::command($iset_buffer, "/input move_next_char") if ($quote ne ""); + my $start_index = 5; + if (weechat::config_boolean($options_iset{"use_mute"}) == 1) + { + $set_command = "/mute ".$set_command; + $start_index += 11; + } + $set_command = $set_command." ".$options_names[$current_line].$value; + my $pos_space = index($set_command, " ", $start_index); + if ($pos_space < 0) + { + $pos_space = 9999; + } + else + { + $pos_space = $pos_space + 1; + $pos_space = $pos_space + 1 if ($quote ne ""); + } + weechat::buffer_set($iset_buffer, "input", $set_command); + weechat::buffer_set($iset_buffer, "input_pos", "".$pos_space); } } weechat::bar_item_update("isetbar_help") if (weechat::config_boolean($options_iset{"show_help_bar"}) == 1); @@ -1162,6 +1320,8 @@ sub iset_hsignal_mouse_cb { my ($data, $signal, %hash) = ($_[0], $_[1], %{$_[2]}); + return weechat::WEECHAT_RC_OK unless (@options_types); + if ($hash{"_buffer_name"} eq $PRGNAME && ($hash{"_buffer_plugin"} eq $LANG)) { if ($hash{"_key"} eq "button1") @@ -1397,7 +1557,8 @@ $wee_version_number = weechat::info_get("version_number", "") || 0; iset_config_init(); iset_config_read(); -weechat::hook_command($PRGNAME, "Interactive set", "f || s
|| [=][=]", +weechat::hook_command($PRGNAME, "Interactive set", "d || f || s
|| [=][=]", + "d : show only changed options\n". "f file : show options for a file\n". "s section: show options for a section\n". "text : show options with 'text' in name\n". @@ -1418,6 +1579,7 @@ weechat::hook_command($PRGNAME, "Interactive set", "f || s
|| [ "text,enter : set a new filter using command line (use '*' to see all options)\n". "alt+'v' : toggle help bar on/off\n". "alt+'p' : toggle option \"show_plugin_description\" on/off\n". + "q : as input in iset buffer to close it\n". "\n". "Mouse actions:\n". "wheel up/down : move cursor up/down\n". @@ -1426,8 +1588,8 @@ weechat::hook_command($PRGNAME, "Interactive set", "f || s
|| [ "right button + drag left/right: increase/decrease value (for integer or color)\n". "\n". "Examples:\n". - " show options for file 'weechat'\n". - " /iset f weechat\n". + " show changed options in 'aspell' plugin\n". + " /iset d aspell\n". " show options for file 'irc'\n". " /iset f irc\n". " show options for section 'look'\n". diff --git a/weechat/plugins.conf b/weechat/plugins.conf index 495b7fc..5a88225 100644 --- a/weechat/plugins.conf +++ b/weechat/plugins.conf @@ -1,11 +1,27 @@ # # weechat -- plugins.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [var] fifo.fifo = "on" guile.check_license = "off" lua.check_license = "off" +lua.matrix.autojoin_on_invite = "on" +lua.matrix.backlog_lines = "120" +lua.matrix.debug = "off" +lua.matrix.encrypted_message_color = "lightgreen" +lua.matrix.homeserver_url = "https://matrix.org/" +lua.matrix.local_echo = "on" +lua.matrix.password = "" +lua.matrix.typing_notices = "on" +lua.matrix.user = "" perl.beep.beep_command_dcc = "$bell" perl.beep.beep_command_highlight = "$bell" perl.beep.beep_command_pv = "$bell" @@ -54,10 +70,40 @@ python.screen_away.interval = "5" python.screen_away.message = "Detached from tmux" python.screen_away.set_away = "on" python.screen_away.time_format = "since %Y-%m-%d %H:%M:%S%z" +python.slack_extension.colorize_messages = "0" +python.slack_extension.colorize_nicks = "1" +python.slack_extension.colorize_private_chats = "0" +python.slack_extension.debug_mode = "" +python.slack_extension.distracting_channels = "" +python.slack_extension.server_alias.uh-sensationeditor = "se" +python.slack_extension.server_alias.ultrahaptics = "uh" +python.slack_extension.show_reaction_nicks = "0" +python.slack_extension.slack_api_token = "${sec.data.slack_uh}" +python.slack_extension.switch_buffer_on_join = "1" +python.slack_extension.trigger_value = "0" +python.slack_extension.unfurl_ignore_alt_text = "0" ruby.check_license = "off" +ruby.colorizer.buffer_regex = "" +ruby.colorizer.rule.0 = "" +ruby.colorizer.rule.1 = "" +ruby.colorizer.rule.2 = "" +ruby.colorizer.rule.3 = "" +ruby.colorizer.rule.4 = "" +ruby.colorizer.rule.8 = "Succeeded/lightgreen" +ruby.colorizer.rule.9 = "Failed/lightred" +ruby.colorizer.rule.count = "10" tcl.check_license = "off" [desc] +lua.matrix.autojoin_on_invite = "Automatically join rooms you are invited to (default: "on")" +lua.matrix.backlog_lines = "Number of lines to fetch from backlog upon connecting (default: "120")" +lua.matrix.debug = "Print a lot of extra information to help with finding bugs and other problems. (default: "off")" +lua.matrix.encrypted_message_color = "Print encrypted mesages with this color (default: "lightgreen")" +lua.matrix.homeserver_url = "Full URL including port to your homeserver (including trailing slash) or use default matrix.org (default: "https://matrix.org/")" +lua.matrix.local_echo = "Print lines locally instead of waiting for return from server (default: "on")" +lua.matrix.password = "Your homeserver password (default: "")" +lua.matrix.typing_notices = "Send typing notices when you type (default: "on")" +lua.matrix.user = "Your homeserver username (default: "")" perl.beep.beep_command_dcc = "command for beep on dcc, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" perl.beep.beep_command_highlight = "command for beep on highlight, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" perl.beep.beep_command_pv = "command for beep on private message, special value "$bell" is allowed, as well as "$bell;command" (default: "$bell")" diff --git a/weechat/python/autoload/allquery.py b/weechat/python/autoload/allquery.py deleted file mode 120000 index 90aff3b..0000000 --- a/weechat/python/autoload/allquery.py +++ /dev/null @@ -1 +0,0 @@ -../allquery.py \ No newline at end of file diff --git a/weechat/python/autoload/buffer_autoset.py b/weechat/python/autoload/buffer_autoset.py deleted file mode 120000 index cdcf0db..0000000 --- a/weechat/python/autoload/buffer_autoset.py +++ /dev/null @@ -1 +0,0 @@ -../buffer_autoset.py \ No newline at end of file diff --git a/weechat/python/autoload/grep.py b/weechat/python/autoload/grep.py deleted file mode 120000 index 87d4ca7..0000000 --- a/weechat/python/autoload/grep.py +++ /dev/null @@ -1 +0,0 @@ -../grep.py \ No newline at end of file diff --git a/weechat/python/autoload/screen_away.py b/weechat/python/autoload/screen_away.py deleted file mode 120000 index e485b70..0000000 --- a/weechat/python/autoload/screen_away.py +++ /dev/null @@ -1 +0,0 @@ -../screen_away.py \ No newline at end of file diff --git a/weechat/python/buffer_autoset.py b/weechat/python/buffer_autoset.py index a130909..305bd6b 100644 --- a/weechat/python/buffer_autoset.py +++ b/weechat/python/buffer_autoset.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2010-2012 Sebastien Helleu +# Copyright (C) 2010-2015 Sébastien Helleu # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,30 +18,37 @@ # # Auto-set buffer properties when a buffer is opened. -# (this script requires WeeChat 0.3.2 or newer) +# (this script requires WeeChat 1.0 or newer) # # History: # +# 2015-09-28, Simmo Saan : +# version 0.9: instantly apply properties +# 2015-07-12, Sébastien Helleu : +# version 0.8: add option buffer_autoset.look.timer to add a small timer +# before setting buffer properties +# 2015-04-05, Nils Görs : +# version 0.7: increase priority of hook_signal('buffer_opened') # 2012-12-09, Nils Görs : # version 0.6: add support of core buffer -# 2012-03-09, Sebastien Helleu : +# 2012-03-09, Sébastien Helleu : # version 0.5: fix reload of config file -# 2012-01-03, Sebastien Helleu : +# 2012-01-03, Sébastien Helleu : # version 0.4: make script compatible with Python 3.x -# 2010-12-02, Sebastien Helleu : +# 2010-12-02, Sébastien Helleu : # version 0.3: "no_highlight_nicks" replaced by "hotlist_max_level_nicks" -# 2010-10-11, Sebastien Helleu : +# 2010-10-11, Sébastien Helleu : # version 0.2: add example in /help autosetbuffer with new buffer # property "no_highlight_nicks" -# 2010-04-19, Sebastien Helleu : +# 2010-04-19, Sébastien Helleu : # version 0.1: initial release # -SCRIPT_NAME = "buffer_autoset" -SCRIPT_AUTHOR = "Sebastien Helleu " -SCRIPT_VERSION = "0.6" +SCRIPT_NAME = "buffer_autoset" +SCRIPT_AUTHOR = "Sébastien Helleu " +SCRIPT_VERSION = "0.9" SCRIPT_LICENSE = "GPL3" -SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened" +SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened" SCRIPT_COMMAND = "autosetbuffer" @@ -56,8 +63,10 @@ except ImportError: CONFIG_FILE_NAME = "buffer_autoset" -# config file +# config file / options bas_config_file = "" +bas_options = {} + # =================================[ config ]================================= @@ -66,50 +75,75 @@ def bas_config_init(): Initialization of configuration file. Sections: buffer. """ - global bas_config_file + global bas_config_file, bas_options bas_config_file = weechat.config_new(CONFIG_FILE_NAME, "bas_config_reload_cb", "") if bas_config_file == "": return + # section "look" + section_look = weechat.config_new_section( + bas_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "") + if not section_look: + weechat.config_free(bas_config_file) + return + + # options in section "look" + bas_options["look_timer"] = weechat.config_new_option( + bas_config_file, section_look, "timer", "integer", + "Timer used to delay the set of properties (in milliseconds, " + "0 = don't use a timer)", + "", 0, 2147483647, "1", "1", 0, "", "", "", "", "", "") + + bas_options["look_instant"] = weechat.config_new_option( + bas_config_file, section_look, "instant", "boolean", + "Instantly apply properties to buffers affected", + "", 0, 0, "on", "on", 0, "", "", "", "", "", "") + # section "buffer" section_buffer = weechat.config_new_section( bas_config_file, "buffer", 1, 1, "", "", "", "", "", "", "bas_config_buffer_create_option_cb", "", "", "") - if section_buffer == "": + if not section_buffer: weechat.config_free(bas_config_file) return -def bas_config_buffer_create_option_cb(data, config_file, section, option_name, value): + +def bas_config_buffer_create_option_cb(data, config_file, section, option_name, + value): option = weechat.config_search_option(config_file, section, option_name) if option: - return weechat.config_option_set (option, value, 1) + return weechat.config_option_set(option, value, 1) else: - option = weechat.config_new_option (config_file, section, option_name, "string", - "", "", 0, 0, "", value, 0, - "", "", "", "", "", "") + option = weechat.config_new_option(config_file, section, option_name, + "string", "", "", 0, 0, "", + value, 0, "", "", "", "", "", "") if not option: return weechat.WEECHAT_CONFIG_OPTION_SET_ERROR return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE + def bas_config_reload_cb(data, config_file): - """ Reload configuration file. """ + """Reload configuration file.""" return weechat.config_reload(config_file) + def bas_config_read(): - """ Read configuration file. """ + """Read configuration file.""" global bas_config_file return weechat.config_read(bas_config_file) + def bas_config_write(): - """ Write configuration file. """ + """Write configuration file.""" global bas_config_file return weechat.config_write(bas_config_file) + # ================================[ command ]================================= def bas_cmd(data, buffer, args): - """ Callback for /autosetbuffer command. """ + """Callback for /autosetbuffer command.""" args = args.strip() if args == "": weechat.command("", "/set %s.buffer.*" % CONFIG_FILE_NAME) @@ -133,88 +167,167 @@ def bas_cmd(data, buffer, args): return weechat.WEECHAT_RC_OK return weechat.WEECHAT_RC_OK -def bas_completion_current_buffer_cb(data, completion_item, buffer, completion): - """ Complete with current buffer name (plugin.name), for command '/autosetbuffer'. """ + +def bas_completion_current_buffer_cb(data, completion_item, buffer, + completion): + """ + Complete with current buffer name (plugin.name), + for command '/autosetbuffer'. + """ name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"), weechat.buffer_get_string(buffer, "name")) weechat.hook_completion_list_add(completion, name, 0, weechat.WEECHAT_LIST_POS_BEGINNING) return weechat.WEECHAT_RC_OK + def bas_completion_options_cb(data, completion_item, buffer, completion): - """ Complete with config options, for command '/autosetbuffer'. """ - options = weechat.infolist_get("option", "", "%s.buffer.*" % CONFIG_FILE_NAME) + """Complete with config options, for command '/autosetbuffer'.""" + options = weechat.infolist_get("option", "", + "%s.buffer.*" % CONFIG_FILE_NAME) if options: while weechat.infolist_next(options): - weechat.hook_completion_list_add(completion, - weechat.infolist_string(options, "option_name"), - 0, weechat.WEECHAT_LIST_POS_SORT) + weechat.hook_completion_list_add( + completion, + weechat.infolist_string(options, "option_name"), + 0, weechat.WEECHAT_LIST_POS_SORT) weechat.infolist_free(options) return weechat.WEECHAT_RC_OK -# =================================[ signal ]================================= + +# ==========================[ timer/signal/option ]=========================== + +def bas_apply_options_for_buffer(buffer): + full_name = weechat.buffer_get_string(buffer, "full_name") + options = weechat.infolist_get("option", "", + "%s.buffer.*" % CONFIG_FILE_NAME) + if not options: + return + + while weechat.infolist_next(options): + option = weechat.infolist_string(options, "option_name") + value = weechat.infolist_string(options, "value") + if option: + pos = option.rfind(".") + if pos > 0: + buffer_mask = option[0:pos] + property = option[pos+1:] + if buffer_mask and property: + if weechat.string_match(full_name, buffer_mask, 1): + weechat.buffer_set(buffer, property, value) + + weechat.infolist_free(options) + + +def bas_timer_buffer_opened_cb(data, remaining_calls): + full_name = data + buffer = weechat.buffer_search("==", full_name) + if not buffer: + return weechat.WEECHAT_RC_OK + bas_apply_options_for_buffer(buffer) + return weechat.WEECHAT_RC_OK + def bas_signal_buffer_opened_cb(data, signal, signal_data): + global bas_options buffer = signal_data - name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"), - weechat.buffer_get_string(buffer, "name")) - options = weechat.infolist_get("option", "", "%s.buffer.*" % CONFIG_FILE_NAME) - if options: - while weechat.infolist_next(options): - option = weechat.infolist_string(options, "option_name") - value = weechat.infolist_string(options, "value") - if option: - pos = option.rfind(".") - if pos > 0: - buffer_mask = option[0:pos] - property = option[pos+1:] - if buffer_mask and property: - if weechat.string_match(name, buffer_mask, 1): - weechat.buffer_set(buffer, property, value) - weechat.infolist_free(options) + timer = weechat.config_integer(bas_options["look_timer"]) + if timer == 0: + bas_apply_options_for_buffer(buffer) + else: + weechat.hook_timer(timer, 0, 1, + "bas_timer_buffer_opened_cb", + weechat.buffer_get_string(buffer, "full_name")) + return weechat.WEECHAT_RC_OK + +def bas_config_option_cb(data, option, value): + if not weechat.config_boolean(bas_options["look_instant"]): + return weechat.WEECHAT_RC_OK + + if not weechat.config_get(option): # option was deleted + return weechat.WEECHAT_RC_OK + + option = option[len("%s.buffer." % CONFIG_FILE_NAME):] + + pos = option.rfind(".") + if pos > 0: + buffer_mask = option[0:pos] + property = option[pos+1:] + if buffer_mask and property: + buffers = weechat.infolist_get("buffer", "", buffer_mask) + + if not buffers: + return weechat.WEECHAT_RC_OK + + while weechat.infolist_next(buffers): + buffer = weechat.infolist_pointer(buffers, "pointer") + weechat.buffer_set(buffer, property, value) + + weechat.infolist_free(buffers) + return weechat.WEECHAT_RC_OK # ==================================[ main ]================================== if __name__ == "__main__" and import_ok: - if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, - SCRIPT_DESC, "bas_unload_script", ""): + if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, + SCRIPT_LICENSE, SCRIPT_DESC, "bas_unload_script", ""): version = weechat.info_get("version_number", "") or 0 - if int(version) < 0x00030200: - weechat.prnt("", "%s%s: WeeChat 0.3.2 is required for this script." + if int(version) < 0x01000000: + weechat.prnt("", "%s%s: WeeChat 1.0 is required for this script." % (weechat.prefix("error"), SCRIPT_NAME)) else: bas_config_init() bas_config_read() - weechat.hook_command(SCRIPT_COMMAND, - "Auto-set buffer properties when a buffer is opened", - "[add buffer property value] | [del option]", - " add: add a buffer/property/value in configuration file\n" - " del: delete an option from configuration file\n" - " buffer: name of a buffer (can start or end with \"*\" as wildcard)\n" - "property: buffer property\n" - " value: value for property\n" - " option: name of option from configuration file\n\n" - "Examples:\n" - " disable timestamp on channel #weechat:\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat time_for_each_line 0\n" - " add word \"weechat\" in highlight list on channel #savannah:\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#savannah highlight_words_add weechat\n" - " disable highlights from nick \"mike\" on freenode server, channel #weechat (requires WeeChat >= 0.3.4):\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat hotlist_max_level_nicks_add mike:2\n" - " disable hotlist changes for nick \"bot\" on freenode server (all channels) (requires WeeChat >= 0.3.4):\n" - " /" + SCRIPT_COMMAND + " add irc.freenode.* hotlist_max_level_nicks_add bot:-1", - "add %(buffers_plugins_names)|%(buffer_autoset_current_buffer) %(buffer_properties_set)" - " || del %(buffer_autoset_options)", - "bas_cmd", "") - weechat.hook_completion("buffer_autoset_current_buffer", "current buffer name for buffer_autoset", - "bas_completion_current_buffer_cb", "") - weechat.hook_completion("buffer_autoset_options", "list of options for buffer_autoset", - "bas_completion_options_cb", "") - weechat.hook_signal("buffer_opened", "bas_signal_buffer_opened_cb", "") + weechat.hook_command( + SCRIPT_COMMAND, + "Auto-set buffer properties when a buffer is opened", + "[add buffer property value] | [del option]", + " add: add a buffer/property/value in configuration file\n" + " del: delete an option from configuration file\n" + " buffer: name of a buffer (can start or end with \"*\" as " + "wildcard)\n" + "property: buffer property\n" + " value: value for property\n" + " option: name of option from configuration file\n\n" + "Examples:\n" + " disable timestamp on channel #weechat:\n" + " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat " + "time_for_each_line 0\n" + " add word \"weechat\" in highlight list on channel " + "#savannah:\n" + " /" + SCRIPT_COMMAND + " add irc.freenode.#savannah " + "highlight_words_add weechat\n" + " disable highlights from nick \"mike\" on freenode server, " + "channel #weechat (requires WeeChat >= 0.3.4):\n" + " /" + SCRIPT_COMMAND + " add irc.freenode.#weechat " + "hotlist_max_level_nicks_add mike:2\n" + " disable hotlist changes for nick \"bot\" on freenode " + "server (all channels) (requires WeeChat >= 0.3.4):\n" + " /" + SCRIPT_COMMAND + " add irc.freenode.* " + "hotlist_max_level_nicks_add bot:-1", + "add %(buffers_plugins_names)|" + "%(buffer_autoset_current_buffer) " + "%(buffer_properties_set)" + " || del %(buffer_autoset_options)", + "bas_cmd", "") + weechat.hook_completion( + "buffer_autoset_current_buffer", + "current buffer name for buffer_autoset", + "bas_completion_current_buffer_cb", "") + weechat.hook_completion( + "buffer_autoset_options", + "list of options for buffer_autoset", + "bas_completion_options_cb", "") + weechat.hook_signal("9000|buffer_opened", + "bas_signal_buffer_opened_cb", "") + weechat.hook_config("%s.buffer.*" % CONFIG_FILE_NAME, + "bas_config_option_cb", "") # core buffer is already open on script startup, check manually! bas_signal_buffer_opened_cb("", "", weechat.buffer_search_main()) + + # ==================================[ end ]=================================== def bas_unload_script(): diff --git a/weechat/python/grep.py b/weechat/python/grep.py index 4fd5c64..30bf2a6 100644 --- a/weechat/python/grep.py +++ b/weechat/python/grep.py @@ -66,6 +66,12 @@ # # History: # +# 2016-06-23, mickael9 +# version 0.7.7: fix get_home function +# +# 2015-11-26 +# version 0.7.6: fix a typo +# # 2015-01-31, Nicd- # version 0.7.5: # '~' is now expaned to the home directory in the log file path so @@ -200,7 +206,7 @@ except ImportError: SCRIPT_NAME = "grep" SCRIPT_AUTHOR = "Elián Hanisch " -SCRIPT_VERSION = "0.7.5" +SCRIPT_VERSION = "0.7.7" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Search in buffers and logs" SCRIPT_COMMAND = "grep" @@ -414,8 +420,9 @@ def get_config_log_filter(): def get_home(): home = weechat.config_string(weechat.config_get('logger.file.path')) + home = home.replace('%h', weechat.info_get('weechat_dir', '')) home = path.abspath(path.expanduser(home)) - return home.replace('%h', weechat.info_get('weechat_dir', '')) + return home def strip_home(s, dir=''): """Strips home dir from the begging of the log path, this makes them sorter.""" @@ -1639,7 +1646,7 @@ if __name__ == '__main__' and import_ok and \ If used with 'log ' search in all logs that matches . -b --buffer: Search only in buffers, not in file logs. -c --count: Just count the number of matched lines instead of showing them. - -m --matchcase: Don't do case insensible search. + -m --matchcase: Don't do case insensitive search. -H --hilight: Colour exact matches in output buffer. -o --only-match: Print only the matching part of the line (unique matches). -v -i --invert: Print lines that don't match the regular expression. diff --git a/weechat/python/wee-slack b/weechat/python/wee-slack new file mode 160000 index 0000000..01beb42 --- /dev/null +++ b/weechat/python/wee-slack @@ -0,0 +1 @@ +Subproject commit 01beb42fec5c6dbfc0d8c53ce1de88b48b48f6db diff --git a/weechat/relay.conf b/weechat/relay.conf index e6de21c..565dd14 100644 --- a/weechat/relay.conf +++ b/weechat/relay.conf @@ -1,6 +1,13 @@ # # weechat -- relay.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [look] auto_open_buffer = on @@ -18,6 +25,7 @@ text_bg = default text_selected = white [network] +allow_empty_password = off allowed_ips = "" bind_address = "" clients_purge_delay = 0 @@ -33,6 +41,7 @@ websocket_allowed_origins = "" backlog_max_minutes = 1440 backlog_max_number = 256 backlog_since_last_disconnect = on +backlog_since_last_message = off backlog_tags = "irc_privmsg" backlog_time_format = "[%H:%M] " diff --git a/weechat/ruby/autoload/samechannel.rb b/weechat/ruby/autoload/samechannel.rb deleted file mode 120000 index a6e3a57..0000000 --- a/weechat/ruby/autoload/samechannel.rb +++ /dev/null @@ -1 +0,0 @@ -../samechannel.rb \ No newline at end of file diff --git a/weechat/ruby/colorizer.rb b/weechat/ruby/colorizer.rb new file mode 100644 index 0000000..21c15bb --- /dev/null +++ b/weechat/ruby/colorizer.rb @@ -0,0 +1,198 @@ +# vim: set noet nosta sw=4 ts=4 : +# +# Colorizer +# Michael B. Hix +# http://code.hix.io/projects/colorizer +# +# Color certain parts of text in certain buffers based on rules. +# + +# +# Options: +# +# plugins.var.ruby.colorizer.buffer_regex +# Buffers with names matching this regex are colorized. All buffers are +# colorized if this option is empty. +# +# plugins.var.ruby.colorizer.rule.count +# This is the maximum number of rules to load. +# +# plugins.var.ruby.colorizer.rule.X +# X is zero or a positive integer. Rules are strings consisting of a regular +# expression followed immediately by a slash and a Weechat color name. The +# regular expressions are case-insensitive. +# +# Text matching the regular expression is colored with the given color. The +# last match "wins" and overlapping matches are not detected. +# +# For example: "strelka|mongrel2/lightgreen" +# + +# +# Changelog: +# +# 0.1: Initial release. +# + +SCRIPT_NAME = 'colorizer' +SCRIPT_AUTHOR = 'Michael B. Hix' +SCRIPT_DESC = 'Colorize text in buffers based on rules.' +SCRIPT_VERSION = '0.1' +SCRIPT_LICENSE = 'BSD' + +# A default coloring rule. +# +DEFAULT_RULE = { + :value => '', + :description => 'A colorizing rule of the form: / Empty rules are ignored.', +}.freeze + +# Configuration defaults are supplied and set for the user if they're not already set. +# +DEFAULTS = { + 'rule.0' => DEFAULT_RULE, + 'rule.1' => DEFAULT_RULE, + 'rule.2' => DEFAULT_RULE, + 'rule.3' => DEFAULT_RULE, + 'rule.4' => DEFAULT_RULE, + 'rule.count' => { + :value => 10, + :description => 'The maximum number of rules to look for in your config.', + }, + 'buffer_regex' => { + :value => '', + :description => 'Only colorize text in buffers with names that match this regex. Leaving this empty matches all buffer names.', + }, +}.freeze + +######################################################################## +### I N I T +######################################################################## + +def weechat_init + Weechat.register SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', '' + + Weechat.hook_modifier( 'weechat_print', 'colorize_cb', '' ) + + DEFAULTS.each_pair do |option, opts| + value = opts[:value] + description = opts[:description] + + cur_value = Weechat.config_get_plugin( option ) + + if cur_value.nil? || cur_value.empty? + Weechat.config_set_plugin( option, value.to_s ) + end + + Weechat.config_set_desc_plugin( option, description ) + end + + parse_config + + Weechat.hook_config( "plugins.var.ruby.#{SCRIPT_NAME}.*", 'config_cb', '' ) + + return Weechat::WEECHAT_RC_OK +end + +################################################################################ +### U T I L I T I E S +################################################################################ + +# Provide a way to print legible stack traces. +# +def pp_error( e, message = '' ) + return unless e.is_a? Exception + unless message.nil? or message.empty? + Weechat.print( '', '%s%s' % [Weechat.prefix('error'), message] ) + end + Weechat.print( '', '%s%s: %s' % [Weechat.prefix( 'error' ), SCRIPT_NAME, e.to_s] ) + e.backtrace.each do |line| + Weechat.print( '', '%s%s' % [Weechat.prefix( 'error' ), line] ) + end +end + +# Re-build rules and any regular expressions when the config changes. +# +def parse_config + rules = {} + count = Weechat::config_get_plugin( 'rule.count' ).to_i || + DEFAULTS['rule.count'] + + count.times do |i| + key = "rule.#{i}" + next unless Weechat::config_is_set_plugin( key ) + + conf = Weechat::config_get_plugin( key ) + regex,color,_ = conf.split( /(? e + pp_error( e, 'There was a problem with rule %d:' % [i] ) + end + end + + @rules = rules + + begin + @buffer_regex = /#{Weechat::config_get_plugin( 'buffer_regex' )}/i + rescue Exception => e + pp_error( e, 'There was a problem with buffer_regex:' ) + end +end + +################################################################################ +### C A L L B A C K S +################################################################################ + +# Handle configuration changes. +# +def config_cb( data, option, value ) + parse_config + return Weechat::WEECHAT_RC_OK +end + +# Handle message printing. +# +def colorize_cb( data, modifier, modifier_data, message ) + _,buffer,_ = modifier_data.split( ';' ) + return message unless @buffer_regex =~ buffer + + reset = Weechat.color( 'reset' ) + @rules.each do |reg, color_str| + color = Weechat.color( color_str ) + message.gsub!( reg, '%s\1%s' % [color,reset] ) + end + + return message +end + +__END__ +__LICENSE__ + +Copyright (c) 2014 Michael B. Hix +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/weechat/ruby/samechannel.rb b/weechat/ruby/samechannel.rb index ced194d..84aa4ad 100644 --- a/weechat/ruby/samechannel.rb +++ b/weechat/ruby/samechannel.rb @@ -1,5 +1,6 @@ # # (c) 2013 Hendrik 'henk' Jaeger +# (c) 2015 arza # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,11 +16,18 @@ # along with this program. If not, see . # +# Changelog: +# 2013-10-19 0.0.1 henk: +# - initial release +# 2015-09-24 0.1 arza: +# - option -m/--minimum for minimum count of mutual channels +# - fixed completion + def weechat_init Weechat.register( "samechannel", "henk", - "0.0.1", + "0.1", "GPL3", "Lists multiple occurences of the same nick(s) in a set of channels.", "", @@ -29,34 +37,33 @@ def weechat_init Weechat.hook_command( "samechannel", "Lists multiple occurences of the same nick(s) in a set of channels.", - "[[-s|--servers] servername[,...]] [[-c|--channels] channelname[,...]] [[-n|--nicks] nickname[,...]]", + "[-s/--servers servername[,...]] [-c/--channels channelname[,...]] [-n/--nicks nickname[,...]] [-m/--minimum minimum]", "--servers servername[,servername],...] --channels channelname[@servername][,channelname[@servername],...] --nicks nickname[,nickname,...] -Options used to set filters. All given names are treated as regular expressions. If no names are given, no filters are set. +--minimum minimum (default: 2) -WARNING: If you are joined to MANY or even just a few very crowded channels, this script may have to do a lot of comparisons! +Options used to set filters. All given names are treated as regular expressions. If no names are given, no filters are set. NOTE: Only nicknames from channels the client is joined to are available for comparison! EXAMPLES: + + /samechannel -m 5 -s freenode,IRCnet + Lists nicks found on at least five channels in freenode and IRCnet combined. + /samechannel --channels foo - Lists nicks found in more than two channels on all servers. + Lists nicks found on at least two channels that include 'foo' on all servers. /samechannel --nicks barbaz,hons --servers example,foobarbaz Lists channels from the servers example and foobarbaz for each given nick. /samechannel --nicks foo --channels ^#example.*@.*free.*$ Lists channels you share with nick foo that begin with 'example' from every server with 'free' in their names.", - "-servers %(irc_servers) - || -servers %(irc_servers) -channels %(irc_channels) - || -servers %(irc_servers) -nicks %(irc_server_nicks) - || -channels %(irc_channels) - || -channels %(irc_channels) -servers %(irc_servers) - || -channels %(irc_channels) -nicks %(irc_server_nicks) - || -nicks %(irc_server_nicks) - || -nicks %(irc_server_nicks) -servers %(irc_servers) - || -nicks %(irc_server_nicks) -channels %(irc_channels)", + "--minimum" + + "|| --servers %(irc_servers) --minimum --channels %(irc_channels)" + + "|| --channels %(irc_channels) --servers %(irc_servers)" + + "|| --nicks %(irc_server_nicks) --servers %(irc_servers)", "samechannel_cb", "" ) @@ -98,8 +105,11 @@ def samechannel_cb( data, buffer, args ) end end + minimum = options[:minimumfilter].to_i + minimum = 2 if minimum==0 + duplicate_nicks = nickcount.delete_if do |nickname, nickpaths| - nickpaths.length <= 1 + nickpaths.length < minimum end duplicate_nicks_sorted = duplicate_nicks.sort do |a, b| a[1].length <=> b[1].length @@ -168,6 +178,7 @@ def get_options( args ) options = Hash.new opt_parser = OptionParser.new do |opts| + opts.on("-c", "--channels channelname[,channelname,...]", "Only channels matching the given (partial) channelname(s) will be considered.)") do |channels| options[:channelfilter] = channels.split(',') @@ -182,6 +193,12 @@ def get_options( args ) "Only servers matching the given (partial) servername(s) will be considered.)") do |servers| options[:serverfilter] = servers.split(',') end + + opts.on("-m", "--minimum minimum", + "Only nicks with at least this many matches will be considered.") do |minimum| + options[:minimumfilter] = minimum + end + end opt_parser.parse(args) diff --git a/weechat/script.conf b/weechat/script.conf index ac91c51..ee53242 100644 --- a/weechat/script.conf +++ b/weechat/script.conf @@ -1,6 +1,13 @@ # # weechat -- script.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [look] columns = "%s %n %V %v %u | %d | %t" diff --git a/weechat/sec.conf b/weechat/sec.conf index 3672aa7..7cda227 100644 --- a/weechat/sec.conf +++ b/weechat/sec.conf @@ -1,6 +1,13 @@ # # weechat -- sec.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [crypt] cipher = aes256 @@ -9,3 +16,6 @@ passphrase_file = "" salt = on [data] +__passphrase__ = on +slack_se = "84E589F23F2A92ECC0B106866E51234769E82F6F27E093557A41CECF4C24B004645F52AED4F9F2B5E3BD37CE1C9C1F1EDEDE91A9347EA7CD6DB116F201122AD372F52A28D8CD63A88B5F1FC2340C563814206D02893B4F9445EE07FCAE211499834217525BD357F201A981DA03967F5EDA39" +slack_uh = "D58D59EC51F61E70E8C8D1600D9BD773A345B6EB01339C964888B636CA68949C8AE6D1C8ABD678C3B0A28D3FB2A3838D6FB3EFB85FBB0D1A2839AB3D2F8BC2ADEF13EC3A5CD4CCBDA89060B62D6460420B4553AFB3291C65CE4D702AC3F8BB6D6C53CEE13B1C513B68ABADD0E3EBB7311D" diff --git a/weechat/trigger.conf b/weechat/trigger.conf index 6d0c6d0..10d49e4 100644 --- a/weechat/trigger.conf +++ b/weechat/trigger.conf @@ -1,6 +1,13 @@ # # weechat -- trigger.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [look] enabled = on @@ -9,6 +16,7 @@ monitor_strip_colors = off [color] flag_command = lightgreen flag_conditions = yellow +flag_post_action = lightblue flag_regex = lightcyan flag_return_code = lightmagenta regex = white @@ -22,6 +30,7 @@ beep.command = "/print -beep" beep.conditions = "${tg_highlight} || ${tg_msg_pv}" beep.enabled = on beep.hook = print +beep.post_action = none beep.regex = "" beep.return_code = ok cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth" @@ -29,6 +38,7 @@ cmd_pass.command = "" cmd_pass.conditions = "" cmd_pass.enabled = on cmd_pass.hook = modifier +cmd_pass.post_action = none cmd_pass.regex = "==^((/(msg|quote) +nickserv +(id|identify|register|ghost +\S+|release +\S+|regain +\S+) +)|/oper +\S+ +|/quote +pass +|/set +\S*password\S* +|/secure +(passphrase|decrypt|set +\S+) +)(.*)==$1$.*+" cmd_pass.return_code = ok msg_auth.arguments = "5000|irc_message_auth" @@ -36,6 +46,7 @@ msg_auth.command = "" msg_auth.conditions = "" msg_auth.enabled = on msg_auth.hook = modifier +msg_auth.post_action = none msg_auth.regex = "==^(.*(id|identify|register|ghost +\S+|release +\S+) +)(.*)==$1$.*+" msg_auth.return_code = ok server_pass.arguments = "5000|input_text_display;5000|history_add" @@ -43,5 +54,6 @@ server_pass.command = "" server_pass.conditions = "" server_pass.enabled = on server_pass.hook = modifier +server_pass.post_action = none server_pass.regex = "==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5" server_pass.return_code = ok diff --git a/weechat/weechat.conf b/weechat/weechat.conf index e13b104..60fe678 100644 --- a/weechat/weechat.conf +++ b/weechat/weechat.conf @@ -1,6 +1,13 @@ # # weechat -- weechat.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [debug] @@ -13,6 +20,7 @@ sys_rlimit = "" [look] align_end_of_lines = message +align_multiline_words = on bar_more_down = "▼" bar_more_left = "◀" bar_more_right = "▶" @@ -20,7 +28,7 @@ bar_more_up = "▲" bare_display_exit_on_input = on bare_display_time_format = "%H:%M" buffer_auto_renumber = off -buffer_notify_default = highlight +buffer_notify_default = message buffer_position = first_gap buffer_search_case_sensitive = off buffer_search_force_default = off @@ -41,7 +49,7 @@ command_chars = "" command_incomplete = off confirm_quit = off confirm_upgrade = off -day_change = off +day_change = on day_change_message_1date = "-- %a, %d %b %Y --" day_change_message_2dates = "-- %%a, %%d %%b %%Y (%a, %d %b %Y) --" eat_newline_glitch = off @@ -67,6 +75,7 @@ input_cursor_scroll = 20 input_share = none input_share_overwrite = off input_undo_max = 32 +item_away_message = on item_buffer_filter = "•" item_buffer_zoom = "!" item_mouse_status = "M" @@ -78,6 +87,9 @@ key_bind_safe = on key_grab_delay = 800 mouse = on mouse_timer_delay = 100 +nick_color_force = "" +nick_color_hash = djb2 +nick_color_stop_chars = "_|[" nick_prefix = "" nick_suffix = "" paste_auto_add_newline = on @@ -112,7 +124,7 @@ scroll_amount = 3 scroll_bottom_after_switch = off scroll_page_percent = 100 search_text_not_found_alert = on -separator_horizontal = "―" +separator_horizontal = "─" separator_vertical = "" tab_width = 1 time_format = "%a, %d %b %Y %T" @@ -165,13 +177,14 @@ chat_text_found_bg = lightmagenta chat_time = default chat_time_delimiters = brown chat_value = cyan +chat_value_null = blue emphasized = yellow emphasized_bg = magenta input_actions = lightgreen input_text_not_found = red +item_away = yellow nicklist_away = cyan nicklist_group = green -nicklist_offline = blue separator = 31 status_count_highlight = magenta status_count_msg = brown @@ -247,7 +260,7 @@ buffers.color_fg = default buffers.conditions = "${window.buffer.full_name} == perl.highmon" buffers.filling_left_right = columns_vertical buffers.filling_top_bottom = columns_vertical -buffers.hidden = off +buffers.hidden = on buffers.items = "buffers" buffers.position = left buffers.priority = 0 diff --git a/weechat/xfer.conf b/weechat/xfer.conf index 39ac5bd..c7ef602 100644 --- a/weechat/xfer.conf +++ b/weechat/xfer.conf @@ -1,6 +1,13 @@ # # weechat -- xfer.conf # +# WARNING: It is NOT recommended to edit this file by hand, +# especially if WeeChat is running. +# +# Use /set or similar command to change settings in WeeChat. +# +# For more info, see: https://weechat.org/doc/quickstart +# [look] auto_open_buffer = on diff --git a/xkb/shada.xkb b/xkb/hactar.xkb similarity index 70% rename from xkb/shada.xkb rename to xkb/hactar.xkb index 71f38a1..f1263d2 100644 --- a/xkb/shada.xkb +++ b/xkb/hactar.xkb @@ -2,6 +2,6 @@ xkb_keymap { xkb_keycodes { include "evdev" }; xkb_types { include "complete" }; xkb_compat { include "complete" }; - xkb_symbols { include "pc+inet(evdev)+dvorak+dvorak(demon_king)" }; + xkb_symbols { include "pc+inet(evdev)+dvorak+dvorak(kinesis)" }; xkb_geometry { include "pc(pc104)" }; }; diff --git a/xprofile b/xprofile index 9c2cda5..590f7e2 100644 --- a/xprofile +++ b/xprofile @@ -1,11 +1,21 @@ +#!/usr/bin/env bash + +export URXVT_PERL_LIB="$HOME/src/dotfiles/urxvt/perls:$HOME/src/dotfiles/urxvt/autocomplete-ALL-the-things" +urxvtd -q -o & start-pulseaudio-x11 compton --config ~/.config/compton.conf & xautolock -detectsleep \ -notify 600 -notifier "xset dpms force off" \ -time 20 -locker "i3lock -nc 000000" \ -killtime 70 -killer "systemctl suspend" & -xkbcomp -I$HOME/.config/xkb $HOME/.config/xkb/$(hostname).xkb $DISPLAY unclutter --timeout 1 & [[ -f "$XDG_CONFIG_HOME/xbindkeys/$(hostname)" ]] && xbindkeys --file $XDG_CONFIG_HOME/xbindkeys/$(hostname) +xkbcomp -I$HOME/.config/xkb $HOME/.config/xkb/$(hostname).xkb $DISPLAY xcape -e "Control_L=Escape;Control_R=Escape" -urxvtd -q -f -o + +hash mopidy && urxvtc -name mopidy -icon ~/src/dotfiles/icons/bmp.png -e ncmpcpp -p 6601 +hash ncmpcpp && urxvtc -name ncmpcpp -icon ~/src/dotfiles/icons/bmp.png -e ncmpcpp +hash weechat && urxvtc -name weechat -icon ~/src/dotfiles/icons/im-irc.png -e weechat +hash mutt && urxvtc -name mutt -icon ~/src/dotfiles/icons/internet-mail.png -e mutt + +qutebrowser & diff --git a/zlogin b/zlogin new file mode 100644 index 0000000..5c05cef --- /dev/null +++ b/zlogin @@ -0,0 +1 @@ +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx diff --git a/zsh/aliases/git.zsh b/zsh/aliases/git.zsh index dbf552e..d45e56a 100644 --- a/zsh/aliases/git.zsh +++ b/zsh/aliases/git.zsh @@ -47,7 +47,6 @@ alias gcl='git config --list' alias gcp='git cherry-pick' alias gcount='git shortlog -sn' -alias glg='git --no-pager log --oneline --graph --max-count=20 --decorate' alias glg='git --no-pager log --graph --max-count=20 --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date=short' function glm { glg "${1:-origin}".. } compdef _git glm=git-log @@ -55,6 +54,8 @@ alias glgl='git log --graph --pretty=tformat:"%Cblue%cd %C(auto)%h%d %s" --date= alias glgg='git log --stat --graph --max-count=20 --decorate' alias glgga='git log --stat --graph --decorate --all' +alias grl='git --no-pager reflog --max-count=20' + alias ga='git add' alias gm='git merge' diff --git a/zsh/aliases/pacman.zsh b/zsh/aliases/pacman.zsh index ba27286..c3a71bb 100644 --- a/zsh/aliases/pacman.zsh +++ b/zsh/aliases/pacman.zsh @@ -26,6 +26,30 @@ alias pacmir='sudo pacman -Syy' # Force refresh of all package li paclist() { pacman -Qei "$@" | awk 'BEGIN {FS=": "}/^Name/{printf("\033[1;36m%s\033[0m ",$2)}/^Description/{print $2}' } + +pacclean() { + local _pkgs=( $(pacman -Qeq) ) + for pkg in ${_pkgs[@]}; do + # the file has been removed by a previous clean + pacman -Qq $pkg 2>&1 1>/dev/null || continue + + pacman -Qi $pkg | awk 'BEGIN {FS=": "}/^Name/{printf("\n\033[1;36m%s\033[0m ",$2)}/^Description/{print $2}/^(Required|Optional For)/' + + local edrq='' + while true; do + echo -n "Explicit, Dependency, Remove, Quit? [Edrq] " + read -sk edrq + echo + case $edrq in + [Qq]) return ;; + $'\n') ;& + [Ee]) break ;; + [Rr]) sudo pacman -Rnscu $pkg; break ;; + [Dd]) sudo pacman -D --asdeps $pkg; break ;; + esac + done + done +} # [l]ist [o]orphans alias paclo='pacman -Qdt' # [r]emove [o]orphans diff --git a/zsh/lib/00-key-bindings.zsh b/zsh/lib/00-key-bindings.zsh index 5de80bf..c99f5dd 100644 --- a/zsh/lib/00-key-bindings.zsh +++ b/zsh/lib/00-key-bindings.zsh @@ -4,7 +4,8 @@ bindkey '^N' history-search-forward bindkey '^P' history-search-backward bindkey ' ' magic-space # also do history expansion on space -bindkey -s '^[l' 'ls ' # show dir content +bindkey -s '^[l' '^Qls ' # show dir content +bindkey -s '^Z' '^Qfg ' # fg with ^Z bindkey '^[[Z' reverse-menu-complete diff --git a/zsh/lib/chpwd.zsh b/zsh/lib/chpwd.zsh new file mode 100644 index 0000000..33ca200 --- /dev/null +++ b/zsh/lib/chpwd.zsh @@ -0,0 +1,23 @@ +function git_auto_fetch { + # auto git fetch on intervals + if [[ -d .git ]] || git rev-parse --git-dir 2>/dev/null 1>&2; then + # read interval or store default + local -i interval + if ! interval=$(git config custom.fetch-interval); then + ((interval = 24 * 60 * 60)) # 1 day + git config custom.fetch-interval $interval + fi + + # Don't fetch if interval is <= 0 + (( $interval <= 0 )) && return + + local -i time=$(date -u +%s) + local -i fetch_time=$(git config custom.fetch-time) + if (( $time - $fetch_time > $interval )); then + echo "Fetching from repositories..." + git fetch + git config custom.fetch-time $(date -u +%s) + fi + fi +} +chpwd_functions+=(git_auto_fetch) diff --git a/zsh/lib/zsh-syntax-highlighting b/zsh/lib/zsh-syntax-highlighting index 3679295..2dce602 160000 --- a/zsh/lib/zsh-syntax-highlighting +++ b/zsh/lib/zsh-syntax-highlighting @@ -1 +1 @@ -Subproject commit 367929502fc1e6cb5a1bacc5ff8cc8a317cb998a +Subproject commit 2dce602727d715f142b5067be4f85de84d98a8b7 diff --git a/zshenv b/zshenv index 9184040..b161335 100644 --- a/zshenv +++ b/zshenv @@ -5,6 +5,8 @@ export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" export HOST=$(hostname) +# gpg +export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" # ssh export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" @@ -13,6 +15,7 @@ if hash systemctl 2>/dev/null; then XDG_CACHE_HOME \ XDG_CONFIG_HOME \ XDG_DATA_HOME \ + GNUPGHOME \ SSH_AUTH_SOCK fi @@ -41,8 +44,11 @@ export TASKRC="$XDG_CONFIG_HOME/taskrc" export MPV_HOME="$XDG_CONFIG_HOME/mpv" export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer" -# gpg -export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" - # pass export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" + +# SSH Agent +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" + +# weechat +export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"