diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini new file mode 100644 index 0000000..0dadfaf --- /dev/null +++ b/.config/foot/foot.ini @@ -0,0 +1,218 @@ +# -*- conf -*- + +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot (or xterm-256color if built with -Dterminfo=disabled) +# login-shell=no + +# app-id=foot +# title=foot +# locked-title=no + +# font=monospace:size=8 +font=Fira Code Medium:size=11 +# font-bold= +# font-italic= +# font-bold-italic= +# line-height= +# letter-spacing=0 +# horizontal-letter-offset=0 +# vertical-letter-offset=0 +# underline-offset= +# box-drawings-uses-font-glyphs=no +# dpi-aware=auto + +# initial-window-size-pixels=700x500 # Or, +# initial-window-size-chars= +# initial-window-mode=windowed +# pad=2x2 # optionally append 'center' +pad=6x5 +# resize-delay-ms=100 + +# notify=notify-send -a ${app-id} -i ${app-id} ${title} ${body} + +# bold-text-in-bright=no +# word-delimiters=,│`|:"'()[]{}<> +# selection-target=primary +# workers= + +[environment] +# name=value + +[bell] +# urgent=no +# notify=no +# command= +# command-focused=no + +[scrollback] +# lines=1000 +# multiplier=3.0 +# indicator-position=relative +# indicator-format= + +[url] +# launch=xdg-open ${url} +# label-letters=sadfjklewcmpgh +# osc8-underline=url-mode +# protocols=http, https, ftp, ftps, file, gemini, gopher +# uri-characters=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+="'()[] + +[cursor] +# style=block +# color= +# blink=no +# beam-thickness=1.5 +# underline-thickness= + +[mouse] +# hide-when-typing=no +# alternate-scroll-mode=yes + +[colors] +alpha=0.9 +# foreground=dcdccc +# background=111111 + +## Normal/regular colors (color palette 0-7) +# regular0=222222 # black +# regular1=cc9393 # red +# regular2=7f9f7f # green +# regular3=d0bf8f # yellow +# regular4=6ca0a3 # blue +# regular5=dc8cc3 # magenta +# regular6=93e0e3 # cyan +# regular7=dcdccc # white + +## Bright colors (color palette 8-15) +# bright0=666666 # bright black +# bright1=dca3a3 # bright red +# bright2=bfebbf # bright green +# bright3=f0dfaf # bright yellow +# bright4=8cd0d3 # bright blue +# bright5=fcace3 # bright magenta +# bright6=b3ffff # bright cyan +# bright7=ffffff # bright white + +## dimmed colors (see foot.ini(5) man page) +# dim0= +# ... +# dim7= + +## The remaining 256-color palette +# 16 = <256-color palette #16> +# ... +# 255 = <256-color palette #255> + +## Misc colors +# selection-foreground= +# selection-background= +# jump-labels= # black-on-yellow +# scrollback-indicator= # black-on-bright-blue +# search-box-no-match= # black-on-red +# search-box-match= # black-on-yellow +# urls= + +# -*- conf -*- +# Gruvbox +background=282828 +foreground=ebdbb2 +regular0=282828 +regular1=cc241d +regular2=98971a +regular3=d79921 +regular4=458588 +regular5=b16286 +regular6=689d6a +regular7=a89984 +bright0=928374 +bright1=fb4934 +bright2=b8bb26 +bright3=fabd2f +bright4=83a598 +bright5=d3869b +bright6=8ec07c +bright7=ebdbb2 + +[csd] +# preferred=server +# size=26 +# font= +# color= +# hide-when-typing=no +# border-width=0 +# border-color= +# button-width=26 +# button-color= +# button-minimize-color= +# button-maximize-color= +# button-close-color= + +[key-bindings] +# scrollback-up-page=Shift+Page_Up +# scrollback-up-half-page=none +# scrollback-up-line=none +# scrollback-down-page=Shift+Page_Down +# scrollback-down-half-page=none +# scrollback-down-line=none +# clipboard-copy=Control+Shift+c XF86Copy +# clipboard-paste=Control+Shift+v XF86Paste +# primary-paste=Shift+Insert +# search-start=Control+Shift+r +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+n +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | fuzzel | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none +# show-urls-launch=Control+Shift+u +# show-urls-copy=none +# show-urls-persistent=none +# prompt-prev=Control+Shift+z +# prompt-next=Control+Shift+x +# unicode-input=none +# noop=none + +[search-bindings] +# cancel=Control+g Control+c Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+w +# clipboard-paste=Control+v Control+Shift+v Control+y XF86Paste +# primary-paste=Shift+Insert +# unicode-input=none + +[url-bindings] +# cancel=Control+g Control+c Control+d Escape +# toggle-url-visible=t + +[text-bindings] +# \x03=Mod4+c # Map Super+c -> Ctrl+c + +[mouse-bindings] +# selection-override-modifiers=Shift +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-extend-character-wise=Control+BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 + +# vim: ft=dosini diff --git a/.config/sway/config b/.config/sway/config index f23ce03..65763fa 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -10,7 +10,8 @@ set $right semicolon set $altright ccaron # Terminal -set $term kitty +#set $term kitty +set $term foot # Font font pango:Iosevka SS05 Medium 10 @@ -30,7 +31,8 @@ output eDP-1 { #output eDP-1 resolution 1920x1080 scale 1 #output "*" background ~/Slike/Wallpapers/1596344206877.jpg fill #output "*" background "~/riz0m/Photos/sri lanka/IMG_20220220_120730.jpg" fill -output "*" background "~/Slike/☭/bigstock-Sutjeska-National-Park-Bosnia-63011269.jpg" fill +#output "*" background "~/Slike/☭/bigstock-Sutjeska-National-Park-Bosnia-63011269.jpg" fill +output "*" background "~/sredstva/dotfiles/ozadje.jpg" fill # Zamik dobimo z SIRINA / SCALE output HDMI-A-2 pos 1600 0 scale 1 output HDMI-A-1 pos 1600 0 scale 1 @@ -227,7 +229,7 @@ bar { focused_workspace #555555E5 #555555E5 #ffffff inactive_workspace #272727E5 #272727E5 #888888 } - font pango:FontAwesome Regular 12, Iosevka SS05 Medium 12 + font pango:FontAwesome Regular 12, Iosevka SS01 Medium 12 strip_workspace_numbers yes height 26 #tray_padding 2 @@ -325,13 +327,13 @@ bindsym $mod+space exec "/home/g1smo/bin/get-layout.sh" exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK # transparenca nekativnih oken -exec ~/sredstva/dotfiles/inactive-windows-transparency.py +exec ~/bin/inactive-windows-transparency.py # Desktop notifikacije exec mako --default-timeout=10000 --icon-path /usr/share/icons/Numix # Autotiling https://github.com/nwg-piotr/autotiling -exec ~/.local/bin/autotiling +exec ~/bin/autotiling.py # Rdece, da lahko spim, hvala exec gammastep -m wayland -l 46.05108:14.50513 diff --git a/bin/autotiling.py b/bin/autotiling.py new file mode 100755 index 0000000..8f7e673 --- /dev/null +++ b/bin/autotiling.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python3 + +""" +This script uses the i3ipc python module to switch the layout splith / splitv +for the currently focused window, depending on its dimensions. +It works on both sway and i3 window managers. + +Inspired by https://github.com/olemartinorg/i3-alternating-layout + +Copyright: 2019-2021 Piotr Miller & Contributors +e-mail: nwg.piotr@gmail.com +Project: https://github.com/nwg-piotr/autotiling +License: GPL3 + +Dependencies: python-i3ipc>=2.0.1 (i3ipc-python) +""" +import argparse +import os +import sys +from functools import partial + +from i3ipc import Connection, Event + +try: + from .__about__ import __version__ +except ImportError: + __version__ = "unknown" + + +def temp_dir(): + if os.getenv("TMPDIR"): + return os.getenv("TMPDIR") + elif os.getenv("TEMP"): + return os.getenv("TEMP") + elif os.getenv("TMP"): + return os.getenv("TMP") + + return "/tmp" + + +def save_string(string, file): + try: + file = open(file, "wt") + file.write(string) + file.close() + except Exception as e: + print(e) + + +def output_name(con): + if con.type == "root": + return None + + if p := con.parent: + if p.type == "output": + return p.name + else: + return output_name(p) + + +def switch_splitting(i3, e, debug, outputs, workspaces, depth_limit): + try: + con = i3.get_tree().find_focused() + output = output_name(con) + # Stop, if outputs is set and current output is not in the selection + if outputs and output not in outputs: + if debug: + print( + "Debug: Autotiling turned off on output {}".format(output), + file=sys.stderr, + ) + return + + if con and not workspaces or (str(con.workspace().num) in workspaces): + if con.floating: + # We're on i3: on sway it would be None + # May be 'auto_on' or 'user_on' + is_floating = "_on" in con.floating + else: + # We are on sway + is_floating = con.type == "floating_con" + + if depth_limit: + # Assume we reached the depth limit, unless we can find a workspace + depth_limit_reached = True + current_con = con + current_depth = 0 + while current_depth < depth_limit: + # Check if we found the workspace of the current container + if current_con.type == "workspace": + # Found the workspace within the depth limitation + depth_limit_reached = False + break + + # Look at the parent for next iteration + current_con = current_con.parent + + # Only count up the depth, if the container has more than + # one container as child + if len(current_con.nodes) > 1: + current_depth += 1 + + if depth_limit_reached: + if debug: + print("Debug: Depth limit reached") + return + + is_full_screen = con.fullscreen_mode == 1 + is_stacked = con.parent.layout == "stacked" + is_tabbed = con.parent.layout == "tabbed" + + # Exclude floating containers, stacked layouts, tabbed layouts and full screen mode + if (not is_floating + and not is_stacked + and not is_tabbed + and not is_full_screen): + new_layout = "splitv" if con.rect.height > con.rect.width else "splith" + + if new_layout != con.parent.layout: + result = i3.command(new_layout) + if result[0].success and debug: + print("Debug: Switched to {}".format(new_layout), file=sys.stderr) + elif debug: + print("Error: Switch failed with err {}".format(result[0].error), file=sys.stderr, ) + + elif debug: + print("Debug: No focused container found or autotiling on the workspace turned off", file=sys.stderr) + + except Exception as e: + print("Error: {}".format(e), file=sys.stderr) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-d", + "--debug", + action="store_true", + help="print debug messages to stderr") + parser.add_argument("-v", + "--version", + action="version", + version="%(prog)s {}, Python {}".format(__version__, sys.version), + help="display version information", ) + parser.add_argument("-o", + "--outputs", + help="restricts autotiling to certain output; " + "example: autotiling --output DP-1 HDMI-0", + nargs="*", + type=str, + default=[], ) + parser.add_argument("-w", + "--workspaces", + help="restricts autotiling to certain workspaces; example: autotiling --workspaces 8 9", + nargs="*", + type=str, + default=[], ) + parser.add_argument("-l", + "--limit", + help='limit how often autotiling will split a container; ' + 'try "2", if you like master-stack layouts; default: 0 (no limit)', + type=int, + default=0, ) + """ + Changing event subscription has already been the objective of several pull request. To avoid doing this again + and again, let's allow to specify them in the `--events` argument. + """ + parser.add_argument("-e", + "--events", + help="list of events to trigger switching split orientation; default: WINDOW MODE", + nargs="*", + type=str, + default=["WINDOW", "MODE"]) + + args = parser.parse_args() + + if args.debug and args.outputs: + print("autotiling is only active on outputs:", ",".join(args.outputs)) + + if args.debug and args.workspaces: + print("autotiling is only active on workspaces:", ','.join(args.workspaces)) + + # For use w/ nwg-panel + ws_file = os.path.join(temp_dir(), "autotiling") + if args.workspaces: + save_string(','.join(args.workspaces), ws_file) + else: + if os.path.isfile(ws_file): + os.remove(ws_file) + + if not args.events: + print("No events specified", file=sys.stderr) + sys.exit(1) + + handler = partial( + switch_splitting, + debug=args.debug, + outputs=args.outputs, + workspaces=args.workspaces, + depth_limit=args.limit, + ) + i3 = Connection() + for e in args.events: + try: + i3.on(Event[e], handler) + print("{} subscribed".format(Event[e])) + except KeyError: + print("'{}' is not a valid event".format(e), file=sys.stderr) + + i3.main() + + +if __name__ == "__main__": + # execute only if run as a script + main() diff --git a/ozadje.jpg b/ozadje.jpg new file mode 100644 index 0000000..1b13c7b Binary files /dev/null and b/ozadje.jpg differ diff --git a/povezi.sh b/povezi.sh index b1fa09e..d06c27d 100755 --- a/povezi.sh +++ b/povezi.sh @@ -5,6 +5,7 @@ echo "DIR: $DIR" # Profile ln -s $DIR/.profile ~/.profile +ln -s $DIR/.profile ~/.zprofile # ZSH shell! ln -s $DIR/.zshrc ~/.zshrc @@ -31,6 +32,10 @@ ln -s $DIR/.config/kitty/kitty.conf ~/.config/kitty/kitty.conf ln -s $DIR/.config/kitty/solarized.conf ~/.config/kitty/solarized.conf ln -s $DIR/.config/kitty/gruvbox.conf ~/.config/kitty/gruvbox.conf +# Foot terminal (minimal wayland term) +mkdir ~/.config/foot +ln -s $DIR/.config/foot/foot.ini ~/.config/foot/foot.ini + # compton compositor (za X - transparence oken in efekti) ln -s $DIR/.config/compton.conf ~/.config/compton.conf @@ -75,6 +80,7 @@ ln -s $DIR/bin/inactive-windows-transparency.py ~/bin/inactive-windows-transpare ln -s $DIR/bin/png2ico ~/bin/png2ico # png v ico konverzija ln -s $DIR/bin/vmpk-pa ~/bin/vmpk-pa +ln -s $DIR/bin/autotiling.py ~/bin/autotiling.py # Guile ln -s $DIR/.guile ~/.guile @@ -92,3 +98,4 @@ ln -s $DIR/.emacs.d/bookmarks ~/.emacs.d/bookmarks # SSH (timeout) mkdir ~/.ssh ln -s $DIR/.ssh/config ~/.ssh/config +