Git Product home page Git Product logo

sway-alttab's Introduction

sway-alttab

crates.io crates.io Build Status made-with-rust

A simple daemon that keeps track of your last focused window and switches to it on receiving a SIGUSR1. Automatically binds Alt-Tab to the same action.

To change the key combo from "Mod1+Tab", use the -c flag and set your preferred mapping.

Installation

From Binaries

Binary releases (for Linux x86_64) can be found at the Releases page.

From AUR

If you're using Arch Linux, you can install the sway-alttab-bin package.

yay -S --aur sway-alttab-bin

From Crates.io

cargo install sway-alttab

From Source

git clone https://github.com/reisub0/sway-alttab
cargo install --path sway-alttab

License

sway-alttab is licensed under the MIT License.

sway-alttab's People

Contributors

ammgws avatar autolisis avatar kepet19 avatar whoizit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sway-alttab's Issues

Fails to launch when building on Debian

System:

linux 5.10.46
rustc 1.48.0

Summary:

$ ./sway-alttab
Error: LockPidfile(11)

strace:

execve("./sway-alttab", ["./sway-alttab"], 0x7fff096ed5f0 /* 21 vars */) = 0
brk(NULL)                               = 0x5bd3edb82000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=113801, ...}) = 0
mmap(NULL, 113801, PROT_READ, MAP_PRIVATE, 3, 0) = 0x76be938d1000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0203\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=100736, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76be938cf000
mmap(NULL, 103496, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76be938b5000
mmap(0x76be938b8000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x76be938b8000
mmap(0x76be938c9000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x76be938c9000
mmap(0x76be938cd000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x76be938cd000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@n\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1839792, ...}) = 0
mmap(NULL, 1852680, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76be936f0000
mprotect(0x76be93715000, 1662976, PROT_NONE) = 0
mmap(0x76be93715000, 1355776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x76be93715000
mmap(0x76be93860000, 303104, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x170000) = 0x76be93860000
mmap(0x76be938ab000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x76be938ab000
mmap(0x76be938b1000, 13576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76be938b1000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 |\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=149520, ...}) = 0
mmap(NULL, 136304, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76be936ce000
mmap(0x76be936d5000, 65536, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x76be936d5000
mmap(0x76be936e5000, 20480, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x76be936e5000
mmap(0x76be936ea000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b000) = 0x76be936ea000
mmap(0x76be936ec000, 13424, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76be936ec000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\21\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=18688, ...}) = 0
mmap(NULL, 20752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76be936c8000
mmap(0x76be936c9000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x76be936c9000
mmap(0x76be936cb000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x76be936cb000
mmap(0x76be936cc000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x76be936cc000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76be936c6000
arch_prctl(ARCH_SET_FS, 0x76be936c6c00) = 0
mprotect(0x76be938ab000, 12288, PROT_READ) = 0
mprotect(0x76be936cc000, 4096, PROT_READ) = 0
mprotect(0x76be936ea000, 4096, PROT_READ) = 0
mprotect(0x76be938cd000, 4096, PROT_READ) = 0
mprotect(0x5bd3ebbc1000, 36864, PROT_READ) = 0
mprotect(0x76be93917000, 4096, PROT_READ) = 0
munmap(0x76be938d1000, 113801)          = 0
set_tid_address(0x76be936c6ed0)         = 164247
set_robust_list(0x76be936c6ee0, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x76be936d5690, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x76be936e2140}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x76be936d5730, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x76be936e2140}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
poll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, 0) = 0 (Timeout)
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x76be9372bd60}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=0}, 8) = 0
brk(NULL)                               = 0x5bd3edb82000
brk(0x5bd3edba3000)                     = 0x5bd3edba3000
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "5bd3eba6a000-5bd3eba78000 r--p 0"..., 1024) = 1024
read(3, "03000 fe:00 17050286            "..., 1024) = 1024
read(3, "b/x86_64-linux-gnu/libc-2.31.so\n"..., 1024) = 1024
read(3, "0 17039371                   /us"..., 1024) = 1024
close(3)                                = 0
sched_getaffinity(164247, 32, [0, 1, 2, 3, 4, 5, 6, 7]) = 8
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x5bd3ebb1d680, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x76be9372bd60}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x5bd3ebb1d680, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x76be9372bd60}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76be938ea000
mprotect(0x76be938ea000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0x76be938eb000, ss_flags=0, ss_size=8192}, NULL) = 0
openat(AT_FDCWD, "/dev/null", O_RDONLY|O_CLOEXEC) = 3
pipe2([4, 5], O_CLOEXEC)                = 0
pipe2([6, 7], O_CLOEXEC)                = 0
futex(0x76be936cd0c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x76be938e1000
rt_sigprocmask(SIG_BLOCK, ~[], [], 8)   = 0
clone(child_stack=0x76be938e9ff0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 164248
wait4(164248, NULL, 0, NULL)            = 164248
munmap(0x76be938e1000, 36864)           = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=164248, si_uid=0, si_status=127, si_utime=0, si_stime=0} ---
close(3)                                = 0
close(5)                                = 0
close(7)                                = 0
close(4)                                = 0
close(6)                                = 0
write(2, "Error: ", 7Error: )                  = 7
write(2, "Compat", 6Compat)                   = 6
write(2, " { ", 3 { )                      = 3
write(2, "error", 5error)                    = 5
write(2, ": ", 2: )                       = 2
write(2, "Os", 2Os)                       = 2
write(2, " { ", 3 { )                      = 3
write(2, "code", 4code)                     = 4
write(2, ": ", 2: )                       = 2
write(2, "2", 12)                        = 1
write(2, ", ", 2, )                       = 2
write(2, "kind", 4kind)                     = 4
write(2, ": ", 2: )                       = 2
write(2, "NotFound", 8NotFound)                 = 8
write(2, ", ", 2, )                       = 2
write(2, "message", 7message)                  = 7
write(2, ": ", 2: )                       = 2
write(2, "\"", 1")                       = 1
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\"", 1")                       = 1
write(2, " }", 2 })                       = 2
write(2, " }", 2 })                       = 2
write(2, "\n", 1
)                       = 1
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x76be938ea000, 12288)           = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Error when lauching sway-alttab

Error: Compat { error: Os { code: 2, kind: NotFound, message: "No such file or directory" } }

Installed from sway-alttab-bin aur package.

Multiple windows awareness?

I use default sway-alttab as I have this in sway/config:

exec sway-alttab

The default behavior of sway-alttab seems to switch workspace if there's only one focused window in a workspace.

But sway-alttab can't aware if there's more than one window in a workspace.

For example:

I have two workspace, one have a terminal and other has a terminal and a firefox window
I navigate to workspace that has one window (sway will automatically focus on that one window)
I press alt-tab to navigate to workspace that has two windows, assume that the current focused window is the terminal.
If I press alt-tab again, `sway-alttab` will switch workspace instead of switch between two windows.
I can make `sway-alttab` to switch windows by navigate the 2nd window (firefox window) in that two windows workspace to make `sway-alttab` to switch between two windows.

The reason for this I think sway-alttab keep track of last focused window in current and previous workspace. This seems to handy but what if I want sway-alttab to switch between windows immediately if there're more than one windows in a workspace?

So if we can choose between two behaviors would be ideal.

Multiple key binding definitions

Hello, everyone.

I am using sway-alttab with the following configuration in ~/.config/sway/config

  • exec sway-alttab -c $mod+tab

I would like to set it up so that I can use both of the following two key bindings, is there a way to do this?

  • $mod+tab
  • $mod+semicolon

I set each of the following in ~/.config/sway/config and restarted sway, but it did not work.

  • exec sway-alttab -c $mod+tab $mod+semicolon
  • bindsym $mod+semicolon $mod+tab

Switch windows on a focused workspace only?

I think I'll need only this feature but it should apply on all kinds of windows.

I have a bash for it, but it lag as hell, maybe if rust support if it'll be faster than swaymsg -t get_tree?

Need contributors/maintainers!

This is a pretty simple project and anyone who is interested to contribute or wants to learn more about rust or learn about AUR packages can do so.

I have been overwhelmed with work lately, and am not able to make the time, so expect delays.

Thanks

cannot execute: required file not found

Hi there, I am downloading the latest release, but when I try to run it (same without --help) I get:

λ sway-alttab --help
bash: /etc/profiles/per-user/dustin/bin/sway-alttab: cannot execute: required file not found

Is there another requirement I am not aware of?

Any suggestions?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.