mirror of
https://github.com/Phantop/phantop.github.io
synced 2024-12-23 13:16:47 +00:00
Change reads to redirects to original sources (commit history can work as a mirror)
This commit is contained in:
parent
475c7b74e2
commit
697d18d958
7
reads/linux-software.html
Normal file
7
reads/linux-software.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://luongvo209.gitlab.io/Awesome-Linux-Software/">
|
||||
</head>
|
||||
</html>
|
File diff suppressed because it is too large
Load diff
7
reads/ricing.html
Normal file
7
reads/ricing.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://rizonrice.github.io/resources">
|
||||
</head>
|
||||
</html>
|
378
reads/ricing.md
378
reads/ricing.md
|
@ -1,378 +0,0 @@
|
|||
# Table of contents
|
||||
- [A quick summary](#how)
|
||||
- [Window managers](#window-managers)
|
||||
- [Tiling](#tiling)
|
||||
- [Bars](#bars)
|
||||
- [Program Launchers](#program-launchers)
|
||||
- [Terminal emulators](#terminal-emulators)
|
||||
- [Shells](#shells)
|
||||
- [Color schemes](#color-schemes)
|
||||
- [Wallpapers](#wallpapers)
|
||||
- [Fonts](#fonts)
|
||||
- [Firefox](#firefox)
|
||||
- [Seamonkey](#seamonkey)
|
||||
- [Image viewers](#image-viewers)
|
||||
- [Audio](#audio)
|
||||
- [Video](#video)
|
||||
- [IRC](#irc)
|
||||
- [System](#system-info)
|
||||
- [Sharing it!](#sharing-it)
|
||||
|
||||
# How?
|
||||
|
||||
First of all; ricing won't be an easy task. I mean, sure you can copy the config
|
||||
files from someone else and live with that. But that kind of ruins the fun of it all.
|
||||
|
||||
**A word on Linux programs in Windows 10**
|
||||
|
||||
With the release of the WSL on Windows 10 and subsequent improvements made to it by
|
||||
Microsoft, is it easy for you to run many Linux programs on Windows 10 with perfect
|
||||
or almost perfect compatibility. If you are running windows 10 but are interested in
|
||||
using Linux programs (ncmpcpp + mpd, or weechat for example), it is worth looking into
|
||||
the WSL. [You can learn more about the WSL here.](https://msdn.microsoft.com/en-us/commandline/wsl/about)
|
||||
|
||||
**You encounter a problem or error and don't know how to continue?**
|
||||
|
||||
#### Google it
|
||||
|
||||
This solves literally 90% of all the problems people ever have. I can't push
|
||||
this enough. The problem you're encountering is most likely not unique. You're
|
||||
probably not the first to struggle with it. By looking online you will nearly
|
||||
always find your (or a similar) question that will help you get going again.
|
||||
|
||||
* [duckduckgo](https://duckduckgo.com/)
|
||||
* [google](https://google.com/)
|
||||
|
||||
#### Manual
|
||||
|
||||
"How do I do x in y?", "Is it possible to do x with y?". "What does x do?".
|
||||
|
||||
These are all way too common questions, especially for people who are starting
|
||||
with linux. 99% of the applications/binaries you're using have some kind of
|
||||
manual through either `$ man NAME_OF_APPLICATION` or `$ NAME_OF_APPLICATION
|
||||
--help`. This will very likely contain the solution one way or another.
|
||||
|
||||
If you still feel like you want a guide or something as a place to start,
|
||||
you can go [here](http://linuxnewbieguide.org/) for Linux, and for ricing
|
||||
on Windows 7, you can go [here](http://nanami-tan.info/). For windows 10, you can go [here](http://chloechantelle.com/guide)
|
||||
|
||||
# Window managers
|
||||
|
||||
A window manager (WM) is system software that controls the placement and
|
||||
appearance of windows within a windowing system in a graphical user interface (GUI).
|
||||
It can be part of a desktop environment (DE) or be used standalone.
|
||||
|
||||
#### Linux
|
||||
- [X11](https://wiki.archlinux.org/index.php/Xorg)
|
||||
- [Openbox](https://wiki.archlinux.org/index.php/Openbox)
|
||||
- [Awesome](https://wiki.archlinux.org/index.php/Awesome)
|
||||
- [Awesome gaps](https://github.com/copycat-killer/lain)
|
||||
- [i3](https://wiki.archlinux.org/index.php/I3)
|
||||
- [i3 gaps](https://github.com/Airblader/i3)
|
||||
- [Qtile](http://www.qtile.org/)
|
||||
- [herbstluftwm](http://www.herbstluftwm.org/)
|
||||
- [howm](https://github.com/HarveyHunt/howm)
|
||||
- [bspwm](https://wiki.archlinux.org/index.php/Bspwm)
|
||||
- [dwm](https://wiki.archlinux.org/index.php/Dwm)
|
||||
- [xmonad](https://wiki.archlinux.org/index.php/Xmonad)
|
||||
- [FVWM](http://www.fvwm.org/)
|
||||
- [StumpWM](https://stumpwm.github.io/)
|
||||
- [Wayland](https://wiki.archlinux.org/index.php/Wayland)
|
||||
- [velox](https://github.com/michaelforney/velox)
|
||||
- [sway](https://github.com/SirCmpwn/sway)
|
||||
- [Orbment](https://github.com/Cloudef/orbment)
|
||||
|
||||
#### Windows
|
||||
- [Blackbox](http://blackbox4windows.com/) - [bbZero mirror(no registration)](http://spoonm.org/share/bbzero/) - [Github repo](https://github.com/xzero450/bbclean-xzero450)
|
||||
- [Windawesome](https://web.archive.org/web/20170922100802/https://windawesome.codeplex.com/)
|
||||
- [bugn](https://github.com/fuhsjr00/bug.n)
|
||||
- [qt](https://github.com/Vibex/qt.pi)
|
||||
- [Tilde++](https://github.com/ragesalmon/TildePlusPlus)
|
||||
- [MaxTo (paid)](https://maxto.net/)
|
||||
- [HashTWM](https://github.com/ZaneA/HashTWM)
|
||||
|
||||
#### OSX
|
||||
- [Spectacle](https://www.spectacleapp.com/)
|
||||
- [Mjolnir](https://github.com/sdegutis/mjolnir)
|
||||
- [chunkwm](https://github.com/koekeishiya/chunkwm)
|
||||
- [Phoenix](https://github.com/kasper/phoenix)
|
||||
- [ShiftIt](https://github.com/fikovnik/ShiftIt)
|
||||
|
||||
# Tiling
|
||||
|
||||
The following applications are purely created for tiling. They bring nothing
|
||||
else to the table. If you're looking for something more complete consider
|
||||
looking at [window managers](#window-managers).
|
||||
|
||||
#### Linux
|
||||
- [PyTyle](http://sourceforge.net/projects/pytyle/)
|
||||
- [PyTyle2](https://code.google.com/p/pytyle/)
|
||||
- [PyTyle3](https://github.com/BurntSushi/pytyle3)
|
||||
- [The difference between PyTyles](https://bbs.archlinux.org/viewtopic.php?pid=1058199#p1058199).
|
||||
|
||||
#### Windows
|
||||
- [WinSplit](http://download.cnet.com/WinSplit-Revolution/3000-2072_4-10971915.html)
|
||||
- [Gridmove](http://jgpaiva.dcmembers.com/gridmove.html) ([Mirror](https://web.archive.org/web/20170922101505/http://jgpaiva.dcmembers.com/gridmove.html))
|
||||
|
||||
#### OSX
|
||||
- [hs.tiling](https://github.com/dsanson/hs.tiling)
|
||||
|
||||
# Bars
|
||||
|
||||
Bars (aka panels) are used to display everything from current desktops to active windows to
|
||||
system informaton. They have very similiar behaviour to the bar you would expect
|
||||
on Windows and OSX.
|
||||
|
||||
#### Linux
|
||||
- [Candybar](https://github.com/Lokaltog/candybar)
|
||||
- [Dzen](https://wiki.archlinux.org/index.php/Dzen)
|
||||
- [Lemonbar](https://github.com/LemonBoy/bar)
|
||||
- [Tint](https://wiki.archlinux.org/index.php/Tint2)
|
||||
- [n30f](https://github.com/sdhand/n30f)
|
||||
- [polybar](https://github.com/jaagr/polybar)
|
||||
|
||||
#### Windows
|
||||
*Placeholder*
|
||||
|
||||
#### OSX
|
||||
- [bar](https://github.com/callahanrts/bar)
|
||||
|
||||
# Program Launchers
|
||||
|
||||
A launcher is a program displaying a dialog to search for an action, typically launch an application. Many are not limited to just this, and allow you to perform other operations such as open up files and folders on your computer.
|
||||
|
||||
#### Linux
|
||||
- [bmenu](https://github.com/Cloudef/bemenu)
|
||||
- [dmenu](http://tools.suckless.org/dmenu/)
|
||||
- [dmenu2](https://bitbucket.org/melek/dmenu2)
|
||||
- [lighthouse](https://github.com/emgram769/lighthouse)
|
||||
- [interrobang](https://github.com/TrilbyWhite/interrobang)
|
||||
- [thinglaunch](http://git.r-36.net/thinglaunch/)
|
||||
- [rofi](https://github.com/DaveDavenport/rofi)
|
||||
- [xlunch](https://github.com/Tomas-M/xlunch)
|
||||
|
||||
#### OSX
|
||||
- Finder (included with OS)
|
||||
|
||||
#### Windows
|
||||
- Start Menu (included with OS)
|
||||
- [Launchy](http://www.launchy.net/) ([Mirror](https://web.archive.org/web/20170922101723/http://www.launchy.net/))
|
||||
|
||||
# Terminal emulators
|
||||
|
||||
A terminal emulator, terminal application, term, or tty for short, is a program
|
||||
that emulates a video terminal within some other display architecture.
|
||||
Though typically synonymous with a shell or text terminal, the term terminal
|
||||
covers all remote terminals, including graphical interfaces. A terminal emulator
|
||||
inside a graphical user interface is often called a terminal window.
|
||||
|
||||
#### Linux
|
||||
- [termite](https://github.com/thestinger/termite)
|
||||
- [urxvt](https://wiki.archlinux.org/index.php/Rxvt-unicode)
|
||||
- [urxvt-perls](https://github.com/muennich/urxvt-perls)
|
||||
- [st](http://st.suckless.org/)
|
||||
- [st-patches](http://st.suckless.org/patches/)
|
||||
- [Terminator](https://wiki.archlinux.org/index.php/Terminator)
|
||||
- [xfce4-terminal](http://docs.xfce.org/apps/terminal/start)
|
||||
- [cool-retro-term](https://github.com/Swordfish90/cool-retro-term)
|
||||
|
||||
#### Windows
|
||||
- [Console](http://sourceforge.net/projects/console/)
|
||||
- [ConsoleZ](https://github.com/cbucher/console)
|
||||
- [Mintty](https://mintty.github.io/) - [Google Code Archive](https://web.archive.org/web/20170922102049/https://code.google.com/archive/p/mintty/)
|
||||
- [Conemu](https://conemu.github.io/)
|
||||
- [Babun](https://babun.github.io/)
|
||||
|
||||
WSL Terminals:
|
||||
|
||||
- [Wsltty](https://github.com/mintty/wsltty)
|
||||
- [wsl-terminal](https://github.com/goreliu/wsl-terminal)
|
||||
|
||||
#### OSX
|
||||
- [Iterm2](https://www.iterm2.com)
|
||||
- [kitty](https://github.com/kovidgoyal/kitty)
|
||||
- [cool-retro-term](https://github.com/Swordfish90/cool-retro-term)
|
||||
|
||||
# Shells
|
||||
- [Awesome Shell](https://github.com/alebcay/awesome-shell)
|
||||
- [Zsh](http://www.zsh.org/)
|
||||
- [Awesome Zsh](https://github.com/unixorn/awesome-zsh-plugins)
|
||||
- [Oh-My-Zsh](https://github.com/robbyrussell/oh-my-zsh)
|
||||
- [Prezto](https://github.com/sorin-ionescu/prezto)
|
||||
- [Fish](http://fishshell.com/)
|
||||
- [Awesome Fish](https://github.com/fisherman/awesome-fish-shell)
|
||||
- [Fisherman](http://fisherman.sh/)
|
||||
|
||||
# Color schemes
|
||||
- [terminal.sexy](http://terminal.sexy)
|
||||
- [coolors.co](http://coolors.co)
|
||||
- [paletton.com](http://paletton.com)
|
||||
- [xcolors.net](http://www.xcolors.net)
|
||||
- [colourlovers.com](http://www.colourlovers.com)
|
||||
- [materialpalette.com](http://www.materialpalette.com)
|
||||
- [transparenttextures.com](http://www.transparenttextures.com)
|
||||
- [daylerees.github.io](http://daylerees.github.io)
|
||||
- [imagecolorpicker.com](http://www.imagecolorpicker.com)
|
||||
- [pltts.me](http://pltts.me)
|
||||
- [dotshare.it](http://dotshare.it/category/terms/colors)
|
||||
|
||||
# Wallpapers
|
||||
- [alpha.wallhaven.cc](http://alpha.wallhaven.cc)
|
||||
- [simpledesktops.com](http://simpledesktops.com)
|
||||
- [subtlepatterns.com](http://subtlepatterns.com)
|
||||
- [unsplash.com](https://unsplash.com)
|
||||
- [nik.bot.nu](https://nik.bot.nu/browse.html) (NSFW)
|
||||
- [stripegenerator.com](http://www.stripegenerator.com)
|
||||
- [tartanmaker.com](http://www.tartanmaker.com)
|
||||
- [flickr.com](https://www.flickr.com)
|
||||
- [deviantart.com](https://deviantart.com)
|
||||
- [gratisography.com](http://gratisography.com)
|
||||
- [thepatternlibrary.com](http://thepatternlibrary.com/)
|
||||
- [duncjo01's archive](http://cs.gettysburg.edu/~duncjo01/archive/patterns/)
|
||||
|
||||
# Fonts
|
||||
|
||||
## Where to get fonts?
|
||||
- [dafont.com](http://www.dafont.com)
|
||||
- [fontawesome.io](http://fontawesome.io)
|
||||
- [ionicons.com](http://ionicons.com)
|
||||
- [codeface](https://github.com/chrissimpkins/codeface)
|
||||
- [bitmap-fonts](https://github.com/Tecate/bitmap-fonts)
|
||||
|
||||
On Debian/Ubuntu you need to enable bitmap fonts first:
|
||||
|
||||
```bash
|
||||
sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf
|
||||
sudo fc-cache -f -v
|
||||
```
|
||||
|
||||
## Font rendering
|
||||
|
||||
#### Windows
|
||||
- [gdipp](https://code.google.com/p/gdipp)
|
||||
- [mactype](https://code.google.com/p/mactype) - [installer](http://spoonm.org/share/mactype.exe)
|
||||
|
||||
#### OSX
|
||||
*Do you even need it?*
|
||||
|
||||
# Firefox
|
||||
- chrome://browser/content/browser.xul
|
||||
- [Nightly](https://nightly.mozilla.org)
|
||||
- [Stylish](https://addons.mozilla.org/en-US/firefox/addon/stylish)
|
||||
- [LINC](http://www.logicalincrements.com/firefox/)
|
||||
- [Twily's stuff](http://twily.info/firefox/stylish/)
|
||||
- [TinyCSS](http://noha-ra.deviantart.com/art/Tinycss-476413072)
|
||||
|
||||
# Seamonkey
|
||||
- chrome://navigator/content/navigator.xul
|
||||
- [Incompatible addon converter](http://addonconverter.fotokraina.com/)
|
||||
|
||||
# Image viewers
|
||||
|
||||
#### Linux
|
||||
- [sxiv](https://github.com/lucy/sxiv)
|
||||
- [pqiv](https://github.com/phillipberndt/pqiv)
|
||||
- [feh](http://feh.finalrewind.org/)
|
||||
- [meh](http://www.johnhawthorn.com/meh/)
|
||||
- [qimgv](https://github.com/easymodo/qimgv)
|
||||
|
||||
#### Windows
|
||||
- [Honeyview](http://www.bandisoft.com/honeyview/)
|
||||
- [stb](https://github.com/nothings/stb-imv/)
|
||||
|
||||
#### OSX
|
||||
- [Xee 2.2](https://xee.c3.cx/old)
|
||||
|
||||
# Audio
|
||||
|
||||
#### Linux
|
||||
- [mpd](http://www.musicpd.org)
|
||||
- [ncmpcpp](http://ncmpcpp.rybczak.net)
|
||||
- [cava](http://karlstav.github.io/cava)
|
||||
- [mpdviz](https://github.com/lucy/mpdviz)
|
||||
- [nausea](https://github.com/ViktorNova/nausea)
|
||||
- [cmus](https://cmus.github.io/)
|
||||
|
||||
#### Windows
|
||||
- [Aimp](http://www.aimp.ru)
|
||||
- [Foobar](http://www.foobar2000.org)
|
||||
- [WinAmp](http://filehippo.com/es/download_winamp/)
|
||||
|
||||
#### OSX
|
||||
- [Vox](http://coppertino.com/)
|
||||
- [mpd](http://www.musicpd.org)
|
||||
- [Ncmpcpp](https://rybczak.net/ncmpcpp/)
|
||||
|
||||
# Video
|
||||
|
||||
#### Linux
|
||||
- [mpv](https://github.com/mpv-player/mpv)
|
||||
- [mpvhq](https://github.com/haasn/mpvhq)
|
||||
|
||||
#### Windows
|
||||
- [mpv](http://mpv.srsfckn.biz/)
|
||||
- [mpvhq](https://github.com/haasn/mpvhq)
|
||||
- [mpcbe](http://sourceforge.net/projects/mpcbe)
|
||||
- [mpc-hc](https://mpc-hc.org)
|
||||
|
||||
#### OSX
|
||||
- [mpv](https://github.com/mpv-player/mpv)
|
||||
- [mpvhq](https://github.com/haasn/mpvhq)
|
||||
|
||||
# IRC
|
||||
- [Hexchat](https://hexchat.github.io/)
|
||||
- [Weechat](https://weechat.org/)
|
||||
- [Irssi](http://www.irssi.org/)
|
||||
|
||||
# System info
|
||||
|
||||
#### Linux
|
||||
- [Screenfetch](https://github.com/KittyKatt/screenFetch)
|
||||
- [Archey](https://github.com/djmelik/archey)
|
||||
- [Alsi](https://github.com/trizen/alsi)
|
||||
- [Ufetch](https://github.com/jschx/ufetch)
|
||||
- [Neofetch](https://github.com/dylanaraps/neofetch)
|
||||
|
||||
#### Windows
|
||||
- [Cmdfetch](https://github.com/hal-ullr/cmdfetch)
|
||||
- [Neofetch](https://github.com/dylanaraps/neofetch)
|
||||
|
||||
#### OSX
|
||||
- [Screenfetch](https://github.com/KittyKatt/screenFetch)
|
||||
- [osxinfo](https://github.com/yrmt/osxinfo)
|
||||
- [Neofetch](https://github.com/dylanaraps/neofetch)
|
||||
|
||||
# Sharing it
|
||||
- File hosts
|
||||
- [mixtape.moe](https://mixtape.moe)
|
||||
- [catbox.moe](https://catbox.moe)
|
||||
- [teknik.io](https://u.teknik.io)
|
||||
- [p.fuwafuwa.moe](https://p.fuwafuwa.moe)
|
||||
- [safe.moe](https://safe.moe)
|
||||
- [puush.me](http://puush.me)
|
||||
- [transfer.sh](https://transfer.sh)
|
||||
- [u.pste.pw](https://u.pste.pw)
|
||||
- [0x0.st](https://0x0.st/)
|
||||
- Upload tools
|
||||
- [Moe](https://github.com/Imakethings/Moe)
|
||||
- [ShareX](https://getsharex.com/)
|
||||
- [gone](https://github.com/kori/gone)
|
||||
- [uguush](https://github.com/jschx/uguush)
|
||||
- [puush](http://puush.me/)
|
||||
- Screenshot tools
|
||||
- [maim](https://github.com/naelstrof/maim)
|
||||
- [Import](http://www.imagemagick.org/script/import.php)
|
||||
- [scrot](http://freecode.com/projects/scrot)
|
||||
- [Shotgun](https://github.com/Streetwalrus/shotgun)
|
||||
- (Windows only) Pressing the Print Screen key saves the screen to your clipboard. Then, paste in any image manipulation program.
|
||||
- (Windows 8.1+ only) Windows key + Print Screen (stored in your Pictures\Screenshots folder)
|
||||
- Screen recording
|
||||
- [Screencast](http://twily.info/scripts/screencast#view) (Uses ffmpeg to record screen to webm)
|
||||
- Pastebins
|
||||
- [teknik.io](https://p.teknik.io)
|
||||
- [mixtape.moe](https://spit.mixtape.moe)
|
||||
- [ix.io](http://ix.io)
|
||||
- [sprunge.us](http://sprunge.us)
|
||||
- [ptpb.pw](https://ptpb.pw)
|
||||
- [pste.pw](https://pste.pw)
|
||||
- [pst.moe](https://pst.moe)
|
7
reads/tinywm.html
Normal file
7
reads/tinywm.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=http://incise.org/tinywm.html">
|
||||
</head>
|
||||
</html>
|
317
reads/tinywm.md
317
reads/tinywm.md
|
@ -1,317 +0,0 @@
|
|||
|
||||
[Source](http://incise.org/tinywm.html "Permalink to tinywm")
|
||||
|
||||
# tinywm
|
||||
|
||||
TinyWM is a tiny window manager that I created as an exercise in minimalism. It is also maybe helpful in learning some of the very basics of creating a window manager. It is only around 50 lines of C. There is also a Python version using python-xlib.
|
||||
|
||||
It lets you do four basic things:
|
||||
|
||||
1. Move windows interactively with Alt+Button1 drag (left mouse button)
|
||||
2. Resize windows interactively with Alt+Button3 drag (right mouse button)
|
||||
3. Raise windows with Alt+F1 (not high on usability I know, but I needed a keybinding in there somewhere)
|
||||
4. Focus windows with the mouse pointer (X does this on its own)
|
||||
|
||||
## Download
|
||||
|
||||
## Known to be packaged in
|
||||
|
||||
* Debian
|
||||
* Ubuntu
|
||||
* FreeBSD
|
||||
* CRUX
|
||||
|
||||
## TinyWM around the web
|
||||
|
||||
## See Also
|
||||
|
||||
## The source
|
||||
|
||||
Here is tinywm.c from the most recent release, 1.3:
|
||||
|
||||
|
||||
/* TinyWM is written by Nick Welch , 2005.
|
||||
*
|
||||
* This software is in the public domain
|
||||
* and is provided AS IS, with NO WARRANTY. */
|
||||
|
||||
#include
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
int main()
|
||||
{
|
||||
Display * dpy;
|
||||
Window root;
|
||||
XWindowAttributes attr;
|
||||
XButtonEvent start;
|
||||
XEvent ev;
|
||||
|
||||
if(!(dpy = XOpenDisplay(0x0))) return 1;
|
||||
|
||||
root = DefaultRootWindow(dpy);
|
||||
|
||||
XGrabKey(dpy, XKeysymToKeycode(dpy, XStringToKeysym("F1")), Mod1Mask, root,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabButton(dpy, 1, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None);
|
||||
XGrabButton(dpy, 3, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
XNextEvent(dpy, &ev);
|
||||
if(ev.type == KeyPress && ev.xkey.subwindow != None)
|
||||
XRaiseWindow(dpy, ev.xkey.subwindow);
|
||||
else if(ev.type == ButtonPress && ev.xbutton.subwindow != None)
|
||||
{
|
||||
XGrabPointer(dpy, ev.xbutton.subwindow, True,
|
||||
PointerMotionMask|ButtonReleaseMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None, CurrentTime);
|
||||
XGetWindowAttributes(dpy, ev.xbutton.subwindow, &attr);
|
||||
start = ev.xbutton;
|
||||
}
|
||||
else if(ev.type == MotionNotify)
|
||||
{
|
||||
int xdiff, ydiff;
|
||||
while(XCheckTypedEvent(dpy, MotionNotify, &ev));
|
||||
xdiff = ev.xbutton.x_root - start.x_root;
|
||||
ydiff = ev.xbutton.y_root - start.y_root;
|
||||
XMoveResizeWindow(dpy, ev.xmotion.window,
|
||||
attr.x + (start.button==1 ? xdiff : 0),
|
||||
attr.y + (start.button==1 ? ydiff : 0),
|
||||
MAX(1, attr.width + (start.button==3 ? xdiff : 0)),
|
||||
MAX(1, attr.height + (start.button==3 ? ydiff : 0)));
|
||||
}
|
||||
else if(ev.type == ButtonRelease)
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Here is annotated.c, which is just tinywm.c with a lot of comments explaining what is going on. This should give you a reasonable idea of how everything works.
|
||||
|
||||
|
||||
/* TinyWM is written by Nick Welch , 2005.
|
||||
*
|
||||
* This software is in the public domain
|
||||
* and is provided AS IS, with NO WARRANTY. */
|
||||
|
||||
/* much of tinywm's purpose is to serve as a very basic example of how to do X
|
||||
* stuff and/or understand window managers, so i wanted to put comments in the
|
||||
* code explaining things, but i really hate wading through code that is
|
||||
* over-commented -- and for that matter, tinywm is supposed to be as concise
|
||||
* as possible, so having lots of comments just wasn't really fitting for it.
|
||||
* i want tinywm.c to be something you can just look at and go "wow, that's
|
||||
* it? cool!" so what i did was just copy it over to annotated.c and comment
|
||||
* the hell out of it. ahh, but now i have to make every code change twice!
|
||||
* oh well. i could always use some sort of script to process the comments out
|
||||
* of this and write it to tinywm.c ... nah.
|
||||
*/
|
||||
|
||||
/* most X stuff will be included with Xlib.h, but a few things require other
|
||||
* headers, like Xmd.h, keysym.h, etc.
|
||||
*/
|
||||
#include
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
int main()
|
||||
{
|
||||
Display * dpy;
|
||||
Window root;
|
||||
XWindowAttributes attr;
|
||||
|
||||
/* we use this to save the pointer's state at the beginning of the
|
||||
* move/resize.
|
||||
*/
|
||||
XButtonEvent start;
|
||||
|
||||
XEvent ev;
|
||||
|
||||
|
||||
/* return failure status if we can't connect */
|
||||
if(!(dpy = XOpenDisplay(0x0))) return 1;
|
||||
|
||||
/* you'll usually be referencing the root window a lot. this is a somewhat
|
||||
* naive approach that will only work on the default screen. most people
|
||||
* only have one screen, but not everyone. if you run multi-head without
|
||||
* xinerama then you quite possibly have multiple screens. (i'm not sure
|
||||
* about vendor-specific implementations, like nvidia's)
|
||||
*
|
||||
* many, probably most window managers only handle one screen, so in
|
||||
* reality this isn't really *that* naive.
|
||||
*
|
||||
* if you wanted to get the root window of a specific screen you'd use
|
||||
* RootWindow(), but the user can also control which screen is our default:
|
||||
* if they set $DISPLAY to ":0.foo", then our default screen number is
|
||||
* whatever they specify "foo" as.
|
||||
*/
|
||||
root = DefaultRootWindow(dpy);
|
||||
|
||||
/* you could also include keysym.h and use the XK_F1 constant instead of
|
||||
* the call to XStringToKeysym, but this method is more "dynamic." imagine
|
||||
* you have config files which specify key bindings. instead of parsing
|
||||
* the key names and having a huge table or whatever to map strings to XK_*
|
||||
* constants, you can just take the user-specified string and hand it off
|
||||
* to XStringToKeysym. XStringToKeysym will give you back the appropriate
|
||||
* keysym or tell you if it's an invalid key name.
|
||||
*
|
||||
* a keysym is basically a platform-independent numeric representation of a
|
||||
* key, like "F1", "a", "b", "L", "5", "Shift", etc. a keycode is a
|
||||
* numeric representation of a key on the keyboard sent by the keyboard
|
||||
* driver (or something along those lines -- i'm no hardware/driver expert)
|
||||
* to X. so we never want to hard-code keycodes, because they can and will
|
||||
* differ between systems.
|
||||
*/
|
||||
XGrabKey(dpy, XKeysymToKeycode(dpy, XStringToKeysym("F1")), Mod1Mask, root,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
|
||||
/* XGrabKey and XGrabButton are basically ways of saying "when this
|
||||
* combination of modifiers and key/button is pressed, send me the events."
|
||||
* so we can safely assume that we'll receive Alt+F1 events, Alt+Button1
|
||||
* events, and Alt+Button3 events, but no others. You can either do
|
||||
* individual grabs like these for key/mouse combinations, or you can use
|
||||
* XSelectInput with KeyPressMask/ButtonPressMask/etc to catch all events
|
||||
* of those types and filter them as you receive them.
|
||||
*/
|
||||
XGrabButton(dpy, 1, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None);
|
||||
XGrabButton(dpy, 3, Mod1Mask, root, True, ButtonPressMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
/* this is the most basic way of looping through X events; you can be
|
||||
* more flexible by using XPending(), or ConnectionNumber() along with
|
||||
* select() (or poll() or whatever floats your boat).
|
||||
*/
|
||||
XNextEvent(dpy, &ev);
|
||||
|
||||
/* this is our keybinding for raising windows. as i saw someone
|
||||
* mention on the ratpoison wiki, it is pretty stupid; however, i
|
||||
* wanted to fit some sort of keyboard binding in here somewhere, and
|
||||
* this was the best fit for it.
|
||||
*
|
||||
* i was a little confused about .window vs. .subwindow for a while,
|
||||
* but a little RTFMing took care of that. our passive grabs above
|
||||
* grabbed on the root window, so since we're only interested in events
|
||||
* for its child windows, we look at .subwindow. when subwindow
|
||||
* None, that means that the window the event happened in was the same
|
||||
* window that was grabbed on -- in this case, the root window.
|
||||
*/
|
||||
if(ev.type == KeyPress && ev.xkey.subwindow != None)
|
||||
XRaiseWindow(dpy, ev.xkey.subwindow);
|
||||
else if(ev.type == ButtonPress && ev.xbutton.subwindow != None)
|
||||
{
|
||||
/* now we take command of the pointer, looking for motion and
|
||||
* button release events.
|
||||
*/
|
||||
XGrabPointer(dpy, ev.xbutton.subwindow, True,
|
||||
PointerMotionMask|ButtonReleaseMask, GrabModeAsync,
|
||||
GrabModeAsync, None, None, CurrentTime);
|
||||
|
||||
/* we "remember" the position of the pointer at the beginning of
|
||||
* our move/resize, and the size/position of the window. that way,
|
||||
* when the pointer moves, we can compare it to our initial data
|
||||
* and move/resize accordingly.
|
||||
*/
|
||||
XGetWindowAttributes(dpy, ev.xbutton.subwindow, &attr);
|
||||
start = ev.xbutton;
|
||||
}
|
||||
/* the only way we'd receive a motion notify event is if we already did
|
||||
* a pointer grab and we're in move/resize mode, so we assume that. */
|
||||
else if(ev.type == MotionNotify)
|
||||
{
|
||||
int xdiff, ydiff;
|
||||
|
||||
/* here we "compress" motion notify events. if there are 10 of
|
||||
* them waiting, it makes no sense to look at any of them but the
|
||||
* most recent. in some cases -- if the window is really big or
|
||||
* things are just acting slowly in general -- failing to do this
|
||||
* can result in a lot of "drag lag."
|
||||
*
|
||||
* for window managers with things like desktop switching, it can
|
||||
* also be useful to compress EnterNotify events, so that you don't
|
||||
* get "focus flicker" as windows shuffle around underneath the
|
||||
* pointer.
|
||||
*/
|
||||
while(XCheckTypedEvent(dpy, MotionNotify, &ev));
|
||||
|
||||
/* now we use the stuff we saved at the beginning of the
|
||||
* move/resize and compare it to the pointer's current position to
|
||||
* determine what the window's new size or position should be.
|
||||
*
|
||||
* if the initial button press was button 1, then we're moving.
|
||||
* otherwise it was 3 and we're resizing.
|
||||
*
|
||||
* we also make sure not to go negative with the window's
|
||||
* dimensions, resulting in "wrapping" which will make our window
|
||||
* something ridiculous like 65000 pixels wide (often accompanied
|
||||
* by lots of swapping and slowdown).
|
||||
*
|
||||
* even worse is if we get "lucky" and hit a width or height of
|
||||
* exactly zero, triggering an X error. so we specify a minimum
|
||||
* width/height of 1 pixel.
|
||||
*/
|
||||
xdiff = ev.xbutton.x_root - start.x_root;
|
||||
ydiff = ev.xbutton.y_root - start.y_root;
|
||||
XMoveResizeWindow(dpy, ev.xmotion.window,
|
||||
attr.x + (start.button==1 ? xdiff : 0),
|
||||
attr.y + (start.button==1 ? ydiff : 0),
|
||||
MAX(1, attr.width + (start.button==3 ? xdiff : 0)),
|
||||
MAX(1, attr.height + (start.button==3 ? ydiff : 0)));
|
||||
}
|
||||
/* like motion notifies, the only way we'll receive a button release is
|
||||
* during a move/resize, due to our pointer grab. this ends the
|
||||
* move/resize.
|
||||
*/
|
||||
else if(ev.type == ButtonRelease)
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
And here's tinywm.py. XCheckTypedEvent has no equivalent in python-xlib, so it is commented out. It doesn't affect functionality, except that responsiveness is worse when you are moving/resizing (especially resizing a large window).
|
||||
|
||||
|
||||
# TinyWM is written by Nick Welch , 2005.
|
||||
#
|
||||
# This software is in the public domain
|
||||
# and is provided AS IS, with NO WARRANTY.
|
||||
|
||||
from Xlib.display import Display
|
||||
from Xlib import X, XK
|
||||
|
||||
dpy = Display()
|
||||
root = dpy.screen().root
|
||||
|
||||
root.grab_key(XK.string_to_keysym("F1"), X.Mod1Mask, 1,
|
||||
X.GrabModeAsync, X.GrabModeAsync)
|
||||
root.grab_button(1, X.Mod1Mask, 1, X.ButtonPressMask,
|
||||
X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE)
|
||||
root.grab_button(3, X.Mod1Mask, 1, X.ButtonPressMask,
|
||||
X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE)
|
||||
|
||||
while 1:
|
||||
ev = root.display.next_event()
|
||||
|
||||
if ev.type == X.KeyPress and ev.child != X.NONE:
|
||||
ev.window.circulate(X.RaiseLowest)
|
||||
elif ev.type == X.ButtonPress and ev.child != X.NONE:
|
||||
ev.child.grab_pointer(1, X.PointerMotionMask|X.ButtonReleaseMask,
|
||||
X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE, X.CurrentTime)
|
||||
attr = ev.child.get_geometry()
|
||||
start = ev
|
||||
elif ev.type == X.MotionNotify:
|
||||
#while(XCheckTypedEvent(dpy, MotionNotify, &ev));
|
||||
xdiff = ev.root_x - start.root_x
|
||||
ydiff = ev.root_y - start.root_y
|
||||
ev.window.configure(
|
||||
x = attr.x + (start.detail == 1 and xdiff or 0),
|
||||
y = attr.y + (start.detail == 1 and ydiff or 0),
|
||||
width = max(1, attr.width + (start.detail == 3 and xdiff or 0)),
|
||||
height = max(1, attr.height + (start.detail == 3 and ydiff or 0)))
|
||||
elif ev.type == X.ButtonRelease:
|
||||
dpy.ungrab_pointer(X.CurrentTime)
|
||||
|
||||
|
Loading…
Reference in a new issue